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
Example binToHex(["0111110", "1000000", "1000000", "1111110", "1000001", "1000001", "0111110"])
function binToHex(bins) { return bins.map(bin => ("00" + (parseInt(bin, 2).toString(16))).substr(-2).toUpperCase()).join(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function binToHex(a) {\r\n\tvar newVal = \"\";\r\n\tfor (i = 0; i < a.length/8; i++) \r\n\t\tnewVal += (\"00\" + parseInt(a.slice(8*i, 8*i+8),2).toString(16)).slice(-2);\r\n\treturn newVal;\r\n}", "function binToHex(bin) {\n for (var fourBitChunks = [], c = 0; c < bin.length; c += 4)\n fourBitChunks.push(parseInt(bin.substr(c, 4), 2).toString(16).toUpperCase());\n return fourBitChunks;\n}", "function hex(x) {\n for (var i = 0; i < x.length; i++)\n x[i] = makeHex(x[i]);\n return x.join('');\n}", "function binl2hex(binarray) \n{ \n var hex_tab = \"0123456789abcdef\" \n var str = \"\" \n for(var i = 0; i < binarray.length * 4; i++) \n { \n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + \n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8)) & 0xF) \n } \n return str \n}", "function binl2hex(binarray) \n{ \nvar hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\"; \nvar str = \"\"; \nfor(var i = 0; i < binarray.length * 4; i++) \n{ \nstr += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + \nhex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); \n} \nreturn str; \n}", "function binaryToHexString(bin) {\n let result = \"\";\n binToHex(bin).forEach(str => {result += str});\n return result;\n}", "function hexlify (arr) {\n return arr.map(function (byte) {\n return ('0' + (byte & 0xFF).toString(16)).slice(-2);\n }).join('');\n}", "function binHexa(obj) {\r\n var hexaVal =[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"a\",\"b\",\"c\",\"d\",\"e\",\"f\"];\r\n var decVal =[\"0000\",\"0001\",\"0010\",\"0011\",\"0100\",\"0101\",\"0110\",\"0111\",\"1000\",\"1001\",\"1010\",\"1011\",\"1100\",\"1101\",\"1110\",\"1111\"];\r\n var pas0;\r\n var valeurHex=\"\";\r\n var valeurDec1=obj[0]+obj[1]+obj[2]+obj[3];\r\n var valeurDec2=obj[4]+obj[5]+obj[6]+obj[7];\r\n for(pas0=0;pas0<hexaVal.length;pas0++){\r\n if (valeurDec1==decVal[pas0]){\r\n valeurHex=hexaVal[pas0];\r\n }\r\n }\r\n for(pas0=0;pas0<hexaVal.length;pas0++){\r\n if (valeurDec2==decVal[pas0]){\r\n valeurHex+=hexaVal[pas0];\r\n }\r\n }\r\n return valeurHex;\r\n}", "function binb2hex(binarray){\n\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n\n var str = \"\";\n\n for (var i = 0; i < binarray.length * 4; i++) {\n\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) +\n\n hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\n\n }\n\n return str;\n\n }", "function asHex(value) {\n return Array.from(value).map(function (i) {\n return (\"00\" + i.toString(16)).slice(-2);\n }).join('');\n}", "function binl2hex(binarray)\r\n{\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for(var i = 0; i < binarray.length * 4; i++)\r\n {\r\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\r\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\r\n }\r\n return str;\r\n}", "function binl2hex(binarray)\r\n{\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for(var i = 0; i < binarray.length * 4; i++)\r\n {\r\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\r\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\r\n }\r\n return str;\r\n}", "function binl2hex(binarray)\r\n{\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for(var i = 0; i < binarray.length * 4; i++)\r\n {\r\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\r\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\r\n }\r\n return str;\r\n}", "function hexToBin(a) {\r\n\tvar newVal = \"\";\r\n\tfor (i = 0; i < a.length; i++) \r\n\t\tnewVal += (\"0000\" + parseInt(a.charAt(i),16).toString(2)).slice(-4);\r\n\treturn newVal;\r\n}", "function binb2hex( data )\n{\n for( var hex='', i=0; i<data.length; i++ )\n {\n while( data[i] < 0 ) data[i] += 0x100000000;\n hex += ('0000000'+(data[i].toString(16))).slice( -8 );\n }\n return hex.toUpperCase();\n}", "function asHex(value) {\n return Array.from(value)\n .map(function (i) { return (\"00\" + i.toString(16)).slice(-2); })\n .join('');\n}", "function binl2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) +\n hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 )) & 0xF);\n }\n return str;\n}", "function binb2hex(binarray) {\n\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n\n var str = \"\";\n\n for (var i = 0; i < binarray.length * 4; i++) {\n\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) +\n\n hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\n\n }\n\n return str;\n\n}", "function binb2hex(binarray) {\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for (var i = 0; i < binarray.length * 4; i++) {\r\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\r\n }\r\n return str;\r\n}", "function binl2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) +\n hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 )) & 0xF);\n }\n return str;\n }", "function binb2hex(binarray)\r\n{\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for(var i = 0; i < binarray.length * 4; i++)\r\n {\r\n str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\r\n hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\r\n }\r\n return str;\r\n}", "function binl2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt(binarray[i >> 2] >> i % 4 * 8 + 4 & 0xF) + hex_tab.charAt(binarray[i >> 2] >> i % 4 * 8 & 0xF);\n }\n\n return str;\n}", "function binb2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\n }\n return str;\n}", "function binl2hex(binarray) {\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for (var i = 0; i < binarray.length * 4; i++) {\r\n str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) +\r\n hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 )) & 0xF);\r\n }\r\n return str;\r\n }", "function binb2hex(binarray) {\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for (var i = 0; i < binarray.length * 4; i++) {\r\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) +\r\n hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\r\n }\r\n return str;\r\n}", "function binl2hex(binarray)\n{\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i++)\n {\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\n }\n return str;\n}", "function binl2hex(binarray)\n{\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i++)\n {\n str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\n hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\n }\n return str;\n}", "function arrayOfHexaColors() {\n let output = [];\n let arglength = arguments.length;\n if (arglength > 0) {\n let input = arguments;\n for (let i = 0; i < arglength; i++) {\n output.push(arguments[i].toString(16));\n }\n }\n return output;\n}", "function toHexString(arr) {\n return Array.prototype.map.call(arr, (x) => (\"00\" + x.toString(16)).slice(-2)).join(\"\");\n}", "function array_to_hex(x){\r\n var hexstring = \"0123456789ABCDEF\";\r\n /* var hexstring = \"0123456789abcdef\"; */\r\n var output_string = \"\";\r\n \r\n for (var i = 0; i < x.length * 4; i++) {\r\n var tmp_i = shift_right(i, 2);\r\n \r\n output_string += hexstring.charAt((shift_right(x[tmp_i], ((i % 4) * 8 + 4))) & 0xF) +\r\n hexstring.charAt(shift_right(x[tmp_i], ((i % 4) * 8)) & 0xF);\r\n }\r\n return output_string;\r\n}", "_binb2hex(_binarray) {\n const _this = this;\n const _hexTab = _this._hexcase ? '0123456789ABCDEF' : '0123456789abcdef';\n let _str = '';\n let i;\n const _binLen = _binarray.length * 4;\n for (i = 0; i < _binLen; i++) {\n _str += _hexTab.charAt((_binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n _hexTab.charAt((_binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\n }\n return _str;\n }", "function binb2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\n }\n return str;\n}", "function binl2hex(binarray) {\n\t\tvar hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n\t\tvar str = \"\";\n\t\tfor (var i = 0; i < binarray.length * 4; i++) {\n\t\t\tstr += hex_tab.charAt(binarray[i >> 2] >> i % 4 * 8 + 4 & 0xF) + hex_tab.charAt(binarray[i >> 2] >> i % 4 * 8 & 0xF);\n\t\t}\n\t\treturn str;\n\t}", "function binb2hex(binarray)\n{\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i++)\n {\n str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\n }\n return str;\n}", "function binb2hex(binarray)\n{\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i++)\n {\n str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\n }\n return str;\n}", "function binb2hex(binarray)\n{\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i++)\n {\n str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\n }\n return str;\n}", "function binb2hex(binarray)\n{\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i++)\n {\n str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\n }\n return str;\n}", "function binb2hex(binarray)\n{\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for(var i = 0; i < binarray.length * 4; i++)\n {\n str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);\n }\n return str;\n}", "function binb2hex(binarray) {\r\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\r\n var str = \"\";\r\n for (var i = 0; i < binarray.length * 4; i++) {\r\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\r\n }\r\n return str;\r\n }", "function binToHex (binaryString) {\n var decString;\n // recursively strip all leading zeros\n if (binaryString[0] === '0') {\n return binToHex(binaryString.slice(1));\n }\n binaryString = binaryString.toLowerCase();\n // convert binary string to base 10 string\n decString = binaryString.split('').reverse().reduce( function(previousValue, currentValue, i) {\n // currentValue = currentValue * 1;\n return previousValue + (Math.pow(2, i) * currentValue);\n }, 0);\n // convert base 10 string to hexadecimal string and return\n return _decToBinHex(decString, 16).reverse().join('');\n}", "function binl2hex(binarray) {\n\t\t\tvar hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n\t\t\tvar str = \"\";\n\t\t\tfor(var i = 0; i < binarray.length * 4; i++) {\n\t\t\t\tstr += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF);\n\t\t\t}\n\t\t\treturn str;\n\t\t}", "function _toHexadecimal(value)\n{\n var result = \"\";\n for (var i = 0; i < value.length; ++i) {\n var hex = \"0x\" + (_getElementAt(value, i) & 0xFF).toString(16);\n if (i > 0)\n result += \" \";\n result += hex;\n }\n return result;\n}", "function binb2hex(binarray) {\n const hex_tab = hexcase ? '0123456789ABCDEF' : '0123456789abcdef';\n let str = '';\n for (let i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF)\n + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\n }\n return str;\n}", "function binb2hex(binarray) {\n var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n var str = \"\";\n for (var i = 0; i < binarray.length * 4; i++) {\n str += hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF) + hex_tab.charAt((binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF);\n }\n return str;\n }", "function binl2hex(binarray)\n\t{\n\t var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n\t var str = \"\";\n\t for(var i = 0; i < binarray.length * 4; i++)\n\t {\n\t str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\n\t hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\n\t }\n\t return str;\n\t}", "function binl2hex(binarray)\n\t{\n\t var hex_tab = hexcase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n\t var str = \"\";\n\t for(var i = 0; i < binarray.length * 4; i++)\n\t {\n\t str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +\n\t hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF);\n\t }\n\t return str;\n\t}", "function bin2hex(s) {\r\n\tvar i, l, o0o = '',\r\n\tn;\r\n\ts += '';\r\n\tfor (i = 0, l = s.length; i < l; i++) {\r\n\t\tn = s.charCodeAt(i).toString(16);\r\n\t\to0o += n.length < 2 ? '0' + n : n;\r\n\t}\r\n\treturn o0o;\r\n}", "function decimalToHexBytes(n) {\n return [n >> 8, n & 0xFF];\n}", "function bin2HexStr(bytesArr) {\n var str = \"\";\n for(var i=0; i<bytesArr.length; i++) {\n var tmp = (bytesArr[i] & 0xff).toString(16);\n if(tmp.length == 1) {\n tmp = \"0\" + tmp;\n }\n str += tmp;\n }\n return str;\n}", "toHexString(byteArray) {\n return byteArray.map(byte => {\n return ('0' + (byte & 0xFF).toString(16)).slice(-2);\n }).join('')\n }", "function binb2hex(binarray)\n\t{\n\t\tvar hex_tab = hexCase ? \"0123456789ABCDEF\" : \"0123456789abcdef\";\n\t\tvar str = \"\";\n\t\tvar length = binarray.length * 4;\n\n\t\tfor(var i = 0; i < length; i++)\n\t\t\tstr += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +\n\t\t\t\thex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8)) & 0xF);\n\n\t\treturn str;\n\t}", "function convertToHex(input) {\n var i;\n var output = [];\n //console.log(\"\\nInput to convertToHex is :\"+input+\"\\n\");\n for (i in input) {\n output[i] = (input[i].charCodeAt(0)).toString(16);\n if (output[i].length!=2) {\n output[i]=\"0\"+output[i];\n }\n }\n //console.log(output);\n countFrequncy(output);\n return output;\n}", "toHexString(byteArray) {\n\n return Array.from(byteArray, (byte) => {\n\n return ('0' + (byte & 0xFF).toString(16)).slice(-2);\n\n }).join('');\n\n }", "function decimalToHex(value) {\r\n var v = value;\r\n var array = [];\r\n var remainder = v % 16;\r\n var division = Math.floor(v / 16);\r\n \r\n array.push(remainder);\r\n\r\n while(division >= 0) {\r\n if(division <= 0) {\r\n return array.reverse();\r\n } else {\r\n var next = Math.floor(division / 16);\r\n remainder = division % 16;\r\n division = next;\r\n array.push(remainder);\r\n };\r\n\r\n for (var i = 0; i <= array.length; i++) {\r\n if (array[i] > 9) {\r\n if (array[i] == 10) {\r\n array[i] = \"A\";\r\n };\r\n if (array[i] == 11) {\r\n array[i] = \"B\";\r\n };\r\n if (array[i] == 12) {\r\n array[i] = \"C\";\r\n };\r\n if (array[i] == 13) {\r\n array[i] = \"D\";\r\n };\r\n if (array[i] == 14) {\r\n array[i] = \"E\";\r\n };\r\n if (array[i] == 15) {\r\n array[i] = \"F\";\r\n };\r\n };\r\n };\r\n};\r\n}", "function hex2bin (hex) {\n return ('00000000' + (parseInt(hex, 16)).toString(2)).substr(-8);\n}", "function hex2bin (hex) {\n return ('00000000' + (parseInt(hex, 16)).toString(2)).substr(-8);\n}", "function toHex(...args) {\n return ethers_1.utils.hexlify(...args);\n}", "function convertRgbToHexa() {\n let output = [];\n let arglength = arguments.length;\n if (arglength > 0) {\n let input = arguments;\n for (let i = 0; i < arglength; i++) {\n output.push(arguments[i].toString(16));\n }\n }\n return output;\n}", "static bytesToHex(bytes) {\n return bytes.reduce(\n (str, byte) => str + byte.toString(16).padStart(2, '0'),\n ''\n )\n }", "toHexString (byteArray) {\n return Array.from(byteArray, (byte) => {\n return ('0' + (byte & 0xFF).toString(16)).slice(-2);\n }).join('');\n }", "function convertHexToBytes ( hex ) {\n\n var bytes = [];\n\n for (\n var i = 0,\n j = hex.length;\n i < j;\n i += 2\n ) {\n bytes.push(parseInt(hex.substr(i, 2), 16));\n };\n\n return(bytes);\n\n}", "function hexToBytes(hex) {\n console.log(hex);\n for (var bytes = [], c = 0; c < hex.length; c += 2)\n bytes.push(parseInt(hex.substr(c, 2), 16));\n return bytes;\n }", "function bin2String(array) {\n var result = [];\n for (var i = 0; i < array.length; i++) {\n if (array[i] >= 48 && array[i] <= 57) {\n result.push(String.fromCharCode(array[i]));\n } else if (array[i] >= 65 && array[i] <= 90) {\n result.push(String.fromCharCode(array[i]));\n } else if (array[i] >= 97 && array[i] <= 122) {\n result.push(String.fromCharCode(array[i]));\n } else if (array[i] == 32 || array[i] == 45 || array[i] == 46 || array[i] == 95 || array[i] == 126) {\n result.push(String.fromCharCode(array[i]));\n } else {\n result.push('%' + ('00' + (array[i]).toString(16)).slice(-2).toUpperCase());\n }\n }\n\n return result.join(\"\");\n}", "function bin2string(array){\n var result = \"\";\n for(var i = 0; i < array.length; ++i){\n result += (String.fromCharCode(array[i]));\n }\n return result;\n}", "function convertToBinary(addressArr){\n //console.log(\"here\");\n addressArr.forEach(function(element){\n temp = parseInt(element, 10);\n //console.log(\"temp is \" + temp);\n if(temp == 0){\n bin = \"00000000\";\n }else{\n while(temp > 0){\n if(temp >= binaryCheck[idx]){\n temp = temp - binaryCheck[idx];\n bin += \"1\";\n }else{\n bin += \"0\";\n }\n idx++;\n }\n for(var i = idx;i < 8;i++){\n bin += \"0\";\n }\n idx = 0;\n }\n //console.log(bin);\n binAddress += bin + \".\";\n bin = \"\";\n temp = 0;\n });\n\n return binAddress.substring(0, binAddress.length - 1);\n}", "function hex2bin(hex) {\n return (\"00000000\" + (parseInt(hex, 16))\n .toString(2))\n .substr(-8);\n}", "function bin2hex(bin) {\n return (\"00\" + (parseInt(bin, 2))\n .toString(16))\n .substr(-2);\n}", "function hexlify(bytes) {\n var res = [];\n for (var i = 0; i < bytes.length; i++)\n res.push(hex(bytes[i]));\n\n return res.join('');\n}", "function hexlify(bytes) {\n var res = [];\n for (var i = 0; i < bytes.length; i++)\n res.push(hex(bytes[i]));\n\n return res.join('');\n}", "function hexString2bin (str) {\n let result = '';\n str.split(' ').forEach(str => {\n result += hex2bin(str);\n });\n return result;\n}", "function hexString2bin (str) {\n let result = '';\n str.split(' ').forEach(str => {\n result += hex2bin(str);\n });\n return result;\n}", "function _decToBinHex(n, r) {\n var divisor = Math.floor(n / r);\n var remainder = n % r;\n var digit = {\n '10' : 'a',\n '11' : 'b',\n '12' : 'c',\n '13' : 'd',\n '14' : 'e',\n '15' : 'f'\n };\n if (n < r) {\n n = n + '';\n n = digit[n] || n;\n return [n];\n }\n remainder = remainder + '';\n remainder = digit[remainder] || remainder;\n return [remainder].concat( _decToBinHex( divisor, r ) );\n}", "function binaryBufferToAsciiHexString(binBuffer) {\r\n var str = \"\";\r\n\r\n for (var index = 0; index < binBuffer.length; index++) {\r\n var b = binBuffer[index];\r\n str += binaryByteToAsciiHex(b);\r\n } \r\n\r\n return str;\r\n}", "function bytes2hex(array) {\n let result = '';\n for (let i = 0; i < array.length; ++i)\n result += ('0' + (array[i] & 0xFF).toString(16)).slice(-2);\n return result;\n}", "function bin2String(array) {\n var result = \"\";\n for (var i = 0; i < array.length; i++) {\n result += String.fromCharCode(parseInt(array[i], 10));\n }\n return result;\n}", "function digitToHex(n) {\r\n var hexToChar = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9',\r\n 'A', 'B', 'C', 'D', 'E', 'F');\r\n\r\n var mask = 0xf;\r\n var result = \"\";\r\n\r\n for (i = 0; i < 2; ++i) {\r\n result += hexToChar[n & mask];\r\n n >>>= 4;\r\n }\r\n return reverseStr(result);\r\n}", "function hex2bin(hex) {\n return parseInt(hex, 16).toString(2);\n}", "function hexToBytes(s)\n{\n var digits = \"0123456789abcdef\";\n function n2i(s) { return digits.indexOf(s); };\n var num = s.length / 2;\n var c = [];\n for (var i = 0; i < num; ++i) {\n c[i] = 16 * n2i(s[2*i+0]) + n2i(s[2*i+1]);\n }\n return c;\n}", "function toHex(n){return (n<16?\"0\":\"\")+n.toString(16);}", "function hexify(x)\n{\n\tvar hexies = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"];\n\treturn hexies.slice(x,x+1)\n}", "function hex2ba(str) {\n var ba = [];\n //pad with a leading 0 if necessary\n if (str.length % 2) {\n str = '0' + str;\n }\n for (var i = 0; i < str.length; i += 2) {\n ba.push(parseInt('0x' + str.substr(i, 2)));\n }\n return ba;\n}", "function hexToBin(hex) {\n return hexToBinary(strip0x(hex)).split('');\n}", "function toHex(binary, start, end) {\n var hex = \"\";\n if (end === undefined) {\n end = binary.length;\n if (start === undefined) start = 0;\n }\n for (var i = start; i < end; i++) {\n var byte = binary[i];\n hex += String.fromCharCode(nibbleToCode(byte >> 4)) +\n String.fromCharCode(nibbleToCode(byte & 0xf));\n }\n return hex;\n}", "function toHex(binary, start, end) {\n var hex = \"\";\n if (end === undefined) {\n end = binary.length;\n if (start === undefined) start = 0;\n }\n for (var i = start; i < end; i++) {\n var byte = binary[i];\n hex += String.fromCharCode(nibbleToCode(byte >> 4)) +\n String.fromCharCode(nibbleToCode(byte & 0xf));\n }\n return hex;\n}", "function toHexString(arr) {\n\tvar str ='';\n\tfor(var i = 0; i < arr.length ; i++) {\n\t\tstr += ((arr[i] < 16) ? \"0\":\"\") + arr[i].toString(16);\n\t\tstr += \":\";\n\t}\n\treturn str;\n}", "hex(x) {\n var hexDigits = new Array(\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"a\",\"b\",\"c\",\"d\",\"e\",\"f\");\n return isNaN(x) ? \"00\" : hexDigits[(x - x % 16) / 16] + hexDigits[x % 16];\n }", "function bytesToHex(c)\n{\n var digits = \"0123456789abcdef\";\n var num = c.length;\n var s = \"\";\n for (var i = 0; i < num; ++i) {\n var hi = Math.floor(c[i] >> 4);\n var lo = c[i] & 0xF;\n s += digits[hi] + digits[lo];\n }\n return s;\n}", "function bytesToHex(bytes) {\n var hex = [];\n for (i = 0; i < bytes.length; i++) {\n hex.push((bytes[i] >>> 4).toString(16));\n hex.push((bytes[i] & 0xF).toString(16));\n }\n // console.log(\"0x\" + hex.join(\"\"));\n return \"0x\" + hex.join(\"\");\n}", "function bytesToHex(bytes) {\n var hex = [];\n for (i = 0; i < bytes.length; i++) {\n hex.push((bytes[i] >>> 4).toString(16));\n hex.push((bytes[i] & 0xF).toString(16));\n }\n // console.log(\"0x\" + hex.join(\"\"));\n return \"0x\" + hex.join(\"\");\n}", "function bytesToHex(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n var current = bytes[i] < 0 ? bytes[i] + 256 : bytes[i];\n hex.push((current >>> 4).toString(16));\n hex.push((current & 0xF).toString(16));\n }\n return hex.join(\"\");\n }", "function bytesToHex(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n var current = bytes[i] < 0 ? bytes[i] + 256 : bytes[i];\n hex.push((current >>> 4).toString(16));\n hex.push((current & 0xF).toString(16));\n }\n return hex.join(\"\");\n}", "function littleEndianArrayToHex(ar) {\n var charHex = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');\n\n var str = \"\";\n\n var len = ar.length;\n\n for (var i = 0, tmp = len << 2; i < tmp; i++) {\n str += charHex[((ar[i >> 2] >> (((i & 3) << 3) + 4)) & 0xF)] +\n charHex[((ar[i >> 2] >> ((i & 3) << 3)) & 0xF)];\n }\n\n return str;\n}", "function bytesToHex(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n hex.push((bytes[i] >>> 4).toString(16));\n hex.push((bytes[i] & 0xF).toString(16));\n }\n return hex.join(\"\");\n }", "function binaryNibbleToAsciiHexDigit(nibble) {\r\n var charCode;\r\n var str = \"\";\r\n\r\n if ((nibble >= 0) && (nibble <= 9)) {\r\n charCode = (\"0\".charCodeAt(0)) + nibble;\r\n str += String.fromCharCode(charCode);\r\n }\r\n else if ((nibble >= 10) && (nibble <= 15)) {\r\n charCode = (\"A\".charCodeAt(0)) + (nibble - 10);\r\n str += String.fromCharCode(charCode);\r\n }\r\n \r\n return str;\r\n}", "function bytesToHex(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n hex.push((bytes[i] >>> 4).toString(16));\n hex.push((bytes[i] & 0xF).toString(16));\n }\n return hex.join(\"\");\n}", "function bytesToHex(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n hex.push((bytes[i] >>> 4).toString(16));\n hex.push((bytes[i] & 0xF).toString(16));\n }\n return hex.join(\"\");\n}", "function bytesToHex(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n var current = bytes[i] < 0 ? bytes[i] + 256 : bytes[i];\n hex.push((current >>> 4).toString(16));\n hex.push((current & 0xF).toString(16));\n }\n return hex.join('');\n}", "function makeHex(n) {\n let hex_chr = '0123456789ABCDEF'.split('');\n let s = '';\n for (let index = 0; index < 4; index++)\n s += hex_chr[(n >> (index * 8 + 4)) & 0x0F]\n + hex_chr[(n >> (index * 8)) & 0x0F];\n return s;\n}", "function bytesToHex(bytes) {\r\n for (var hex = [], i = 0; i < bytes.length; i++) {\r\n var current = bytes[i] < 0 ? bytes[i] + 256 : bytes[i];\r\n hex.push((current >>> 4).toString(16));\r\n hex.push((current & 0xf).toString(16));\r\n }\r\n return hex.join(\"\");\r\n}", "static hexToBytes(hex) {\n return new Uint8Array(hex.match(/.{1,2}/g).map(byte => parseInt(byte, 16)))\n }" ]
[ "0.7413676", "0.70409733", "0.7034735", "0.6969076", "0.69535136", "0.69194937", "0.68874204", "0.6870118", "0.6826296", "0.6817666", "0.680198", "0.680198", "0.680198", "0.67952865", "0.67902726", "0.67830145", "0.6762924", "0.6740234", "0.67265904", "0.6723809", "0.67170584", "0.67115045", "0.670939", "0.6707228", "0.67068", "0.67042863", "0.67042863", "0.66927475", "0.6653412", "0.66495794", "0.6634775", "0.66272324", "0.6603006", "0.65986407", "0.65986407", "0.65986407", "0.65986407", "0.65986407", "0.6582634", "0.6565396", "0.6553106", "0.65516037", "0.6545744", "0.6534245", "0.6525839", "0.6525839", "0.6502624", "0.64944375", "0.6485312", "0.64454365", "0.6402964", "0.63817304", "0.6379913", "0.6346997", "0.6310134", "0.6310134", "0.6282281", "0.62449443", "0.6232057", "0.62207186", "0.62105054", "0.6207775", "0.6201301", "0.61813396", "0.61787623", "0.6173432", "0.61725193", "0.61493254", "0.61493254", "0.6115715", "0.6115715", "0.6099877", "0.60971785", "0.6096831", "0.6093941", "0.6092392", "0.60835797", "0.6076469", "0.60760695", "0.60730135", "0.6070278", "0.60591733", "0.6051743", "0.6051743", "0.604856", "0.6047036", "0.60267556", "0.6004065", "0.6004065", "0.5993129", "0.5992583", "0.5973242", "0.59694314", "0.59613883", "0.59553355", "0.59553355", "0.59469444", "0.59465367", "0.59397227", "0.5922572" ]
0.74536294
0
when its the players turn and they click on cell , then the color changes
function changeColors(currentPlayer, col) { console.log(currentPlayer); if (currentPlayer == 1) { col.removeClass('grey'); col.addClass('green'); col.addClass('p1'); } else { col.removeClass('green'); col.addClass('red'); col.addClass('p2'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeColor(e) {\n let column = e.target.cellIndex;\n let row = [];\n\n for (let i = 5; i > -1; i--){\n if(tableRow[i].children[column].style.backgroundColor =='white'){\n row.push(tableRow[i].children[column]);\n if(currentPlayer===1) {\n row[0].style.backgroundColor = player1Color;\n if (horizonalCheck() || verticalCheck() || diagnolCheck1() || diagnolCheck2){\n return(alert('winner'))\n }\n playerTurn.textContent = `${player2}'s turn!`;\n return currentPlayer = 2;\n// We are taking the first index of the array, and turning it into player 1's color, else if it doesnt euqal one, then it is players twos color.\n } else {scroll\n row [0].style.backgroundColor = player2Color;\n playerTurn.textContent = `${player1 }'s turn!`\n return currentPlayer = 1;\n }\n } \n }\n}", "function setColor() {\n // Set the event of clicking in the grid\n $('td').on('click',function(){\n if ($(this).hasClass('colored')){ // Check if its'a coloured square\n $(this).css(\"background-color\", 'white') // Erase if coloured\n }\n else {$(this).css(\"background-color\", colorVal)} // Set if not\n $(this).toggleClass('colored'); // Toggle this square to colored or not\n })\n}", "function color(event) {\n var elem = event.target\n playTurn(elem.id)\n // console.log(movesMade)\n if (movesMade.length % 2 == 0) {\n elem.style.backgroundColor = 'orange'\n elem.textContent = 'X'\n }\n if (movesMade.length % 2 == 1) {\n elem.style.backgroundColor = 'green'\n elem.textContent = 'O'\n }\n }", "play(id, col1, col2, col3, col4, col5, col6){\n //find and select the column that matches the id \n var column;\n for(column in this.state){\n if(column.id===id){\n this.setState((prevState) => {\n return(\n column.s1= col1,\n column.s2= col2,\n column.s3= col3,\n column.s4= col4,\n column.s5= col5,\n column.s6= col6\n )\n });\n }\n }\n this.checkGameEnds();\n // on a click, if the square in the column is white, it changes to the correct player color, if not, nothing happens\n }", "function colorChange(){\n Array.from(rows).forEach(row => {\n let\n rowIdString = row.id,\n rowHour;\n if (rowIdString) {\n rowHour = parseInt(rowIdString);\n }\n if(rowHour){\n if(currentHour === rowHour){\n setColor(row, \"red\");\n }else if ((currentHour < rowHour) && (currentHour > rowHour -6)){\n setColor(row, \"green\");\n }else if ((currentHour > rowHour) && (currentHour < rowHour +6)){\n setColor(row, \"lightgrey\");\n }else{\n setColor(row, \"white\");\n }\n }\n })\n}", "function colorize(event) {\n if (state.currentPlayerIndex === 0) {\n let target = event.target;\n console.log(target)\n console.log(target.className)\n if(!target.className.includes('blue')){\n target.className = 'cell blue'\n } \n console.log('colorize triggered by player 1')\n } else if (state.currentPlayerIndex === 1) {\n let target = event.target;\n console.log(target)\n if(!target.className.includes('red')){\n target.className = 'cell red'\n } \n console.log('colorize triggered by player 2')\n }\n \n}", "function colourChange() {\n if (aktuellerSpieler === playerOne) {\n return \"#78CDD7\"\n } else if (aktuellerSpieler === playerTwo) {\n return \"#F7CACD\"\n }\n}", "function click1(letter) {\r\n // console.log(letter);\r\n\r\n\r\n let newCell = checkForEmptyCellInTheColum(letter); //into the newcell we enter the show of the specific circle\r\n console.log(newCell.id);\r\n if (counter % 2 == 0) {\r\n newCell.style.backgroundColor = \"red\";\r\n player = 'red';\r\n document.getElementById(\"cursor\").style.backgroundColor = \"yellow\";\r\n } else {\r\n newCell.style.backgroundColor = \"yellow\";\r\n player = 'yellow';\r\n document.getElementById(\"cursor\").style.backgroundColor = \"red\";\r\n }\r\n\r\n counter++; //to know which player is playing right now\r\n checkWin(letter, newCell.id, newCell.getAttribute(\"data-row\"), newCell.getAttribute(\"data-Col\"), newCell, player);\r\n\r\n // checkvictory(newCell);\r\n}", "function click(cell, col){\n //console.log(\"clicked cell # \"+cell.id);\n if(cell.hasValue)\n {\n alert(\"Cannot click here.\");\n return;\n }\n\n if(playerRed==true) //player red\n {\n\n let cellSelected=selectCell(cell, col); //finds next available cell at bottom of column and adds emoji to the board\n\n if(winChoice())\n {\n printWinner();\n return;\n }\n }\n else //player yellow\n {\n let cellSelected=selectCell(cell, col);\n\n if(winChoice())\n {\n printWinner();\n return;\n }\n }\n switchPlayer();\n}", "function cellColor(e){\n\t//if BG is set, change color back to white\n\tif(e.className === 'clicked'){\n\t\te.style.backgroundColor = '#FFFF';\n\t\te.className = 'colorCell';\n\t\treturn true;\n\t}\n\n\tlet color;\n\tcolor = document.getElementById('colorPicker').value;\n\te.className = 'clicked';\n\n\n\te.style.backgroundColor = color;\n\treturn true;\n}", "function changeCellColor() {\n\tconsole.log('cell change');\n\tcolor = document.getElementById('colorPicker').value;\n\tthis.style.background = color; \n}", "setColor(color) { \n this.cells[this.position].style.backgroundColor = color; \n this.color = color; \n }", "updateColor() {\n this.color = this.player_side == PLAYER_1 ? \"#dfe6e9\" : \"#ffeaa7\";\n }", "function newCellActive() {\n\n const cellPosition = this.getAttribute('index');\n this.style.color = 'white';\n\n if (this.getAttribute('clicked') === 'true') {\n return;\n }\n \n if (arrayCells.includes(parseInt(cellPosition))) {\n\n this.style.backgroundColor = '#6495ED';\n score++;\n console.log(score);\n this.setAttribute('clicked', 'true');\n\n } else {\n this.style.backgroundColor = 'red';\n setTimeout(gameOver, 1);\n }\n\n setTimeout(gameCompleted, 1);\n \n}", "function updateTurn(){\n var color = (chess.turn() == 'w' ? 'white' : 'black');\n $('.turn').html(color+' to move');\n}", "function setGame(){\n // Set title color\n var newColor = rgb();\n $(\"#title\").html(newColor);\n\n var rightSquare = makeRanNum(0, numSquares -1);\n $(\".col\").each(function(square){\n // If rightSquare -> rightColor\n if(square === rightSquare) {\n changeBackground($(this), newColor);\n // add click event for right square\n $(this).on(\"click\", function(){\n changeBackground($(\".col\"), newColor);\n $(\"#message\").text(\"Right answer!\");\n $(\"#reset\").html(\"Play again\");\n });\n // else -> random colors\n } else {\n // if wrong Square -> random color\n changeBackground($(this), rgb());\n // add click event for wrong square\n $(this).on(\"click\", function(){\n changeBackground($(this), \"white\");\n $(\"#message\").html(\"Try again!\");\n })\n }\n })\n}", "function colorCell(i, j, strColor) {\n //model\n var cell = gBoard[i][j];\n\n //if clicked on a cell decrement the counter\n if (strColor !== 'red' && !cell.isShown) gClickedCellsCounter--;\n cell.isShown = true;\n\n //DOM\n var elCell = document.querySelector(`#cell${i}-${j}`);\n elCell.style.backgroundColor = strColor;\n\n removeColorTranspernt(cell.coord);\n}", "function render() {\n// loop through the board array and apply the color that is assigned that player. the square that was clicked will not change color \n board.forEach(function(sq, idx) {\n squares[idx].style.background = lookup[sq];\n });\n// if winner variable is 'T'(tie) message pops up \n if (winner === 'T') {\n message.innerHTML = 'Rats, another tie!';\n// if winner variable is = not null message will pop up \n } else if (winner) {\n// a 1 or -1 will sit inside lookup[] and that will return the players color in all caps \n message.innerHTML = `Congrats ${lookup[winner].toUpperCase()}!`;\n// if the last two statements is not true the player who's turn it is will show in all caps \n } else {\n message.innerHTML = `${lookup[turn].toUpperCase()}'s Turn`;\n }\n }", "function startColor(color) {\n switch(color) {\n case \"black\":\n for(let i = 0; i < cells.length; i++) {\n cells[i].addEventListener('mouseover', function(e) {\n if (isDrawing) {\n e.target.style.backgroundColor = \"black\";\n }\n \n });\n }\n break;\n\n case \"eraser\":\n for(let i = 0; i < cells.length; i++) {\n cells[i].addEventListener('mouseover', function(e) {\n if (isDrawing) {\n e.target.style.backgroundColor = \"white\";\n }\n \n });\n }\n break;\n \n case \"rainbow\":\n for(let i = 0; i < cells.length; i++) {\n let r = Math.random()*256;\n\t\t\t let g = Math.random()*256;\n\t\t\t let b = Math.random()*256;\n cells[i].addEventListener('mouseover', function(e) {\n if (isDrawing) {\n e.target.style.backgroundColor = `rgb(${r},${g},${b})`;\n }\n \n });\n }\n break;\n \n default:\n for(let i = 0; i < cells.length; i++) {\n cells[i].addEventListener('mouseover', function(e) {\n e.target.style.backgroundColor = \"red\";\n });\n }\n break;\n }\n}", "function turnColor() {\n let cells = document.querySelectorAll('div.cell')\n for (i=0; i < cells.length; i++)\n cells[i].addEventListener('mouseover', function() {\n cells[i].classList.add('color')\n })\n}", "function cellDraw() {\n if (pencilBtn.classList.contains(\"active\")) {\n cell = document.querySelectorAll(\".content\");\n for (let i = 0; i < cell.length; i++) {\n console.log(cell[i]);\n cell[i].addEventListener(\"mouseenter\", (e) => {\n e.target.style.backgroundColor = \"black\";\n });\n }\n } else if (rgbBtn.classList.contains(\"active\")) {\n cell = document.querySelectorAll(\".content\");\n for (let i = 0; i < cell.length; i++) {\n console.log(cell[i]);\n cell[i].addEventListener(\"mouseenter\", (e) => {\n e.target.style.backgroundColor =\n \"#\" + Math.floor(Math.random() * 16777215).toString(16);\n });\n }\n }\n}", "function OnMouseDown()\n{\t\n if(manager.turn == color)\n {\n if(color == 0 && gameObject.tag == \"Inactive White Piece\")\n {\n transform.gameObject.tag = \"Active White Piece\";\n movement();\n }\n else if(color == 0 && gameObject.tag == \"Active White Piece\")\n {\n \tmanager.unhighlightAllSquares();\n \ttransform.gameObject.tag = \"Inactive White Piece\";\n }\n else if(color == 1 && gameObject.tag == \"Inactive Black Piece\")\n {\n transform.gameObject.tag = \"Active Black Piece\";\n movement();\n }\n else if(color == 1 && gameObject.tag == \"Active Black Piece\")\n {\n \tmanager.unhighlightAllSquares();\n \ttransform.gameObject.tag = \"Inactive Black Piece\";\n }\n }\n}", "function switchTurn() {\n if (currentTurn == player1) {\n currentTurn = player2;\n disp.innerHTML = player2 + \"'s turn\"\n c0.setAttribute(\"style\", \"fill:red\")\n c1.setAttribute(\"style\", \"fill:red\")\n c2.setAttribute(\"style\", \"fill:red\")\n c3.setAttribute(\"style\", \"fill:red\")\n c4.setAttribute(\"style\", \"fill:red\")\n c5.setAttribute(\"style\", \"fill:red\")\n c6.setAttribute(\"style\", \"fill:red\")\n } else if (currentTurn == player2) {\n currentTurn = player1;\n disp.innerHTML = player1 + \"'s turn\"\n c0.setAttribute(\"style\", \"fill:blue\")\n c1.setAttribute(\"style\", \"fill:blue\")\n c2.setAttribute(\"style\", \"fill:blue\")\n c3.setAttribute(\"style\", \"fill:blue\")\n c4.setAttribute(\"style\", \"fill:blue\")\n c5.setAttribute(\"style\", \"fill:blue\")\n c6.setAttribute(\"style\", \"fill:blue\")\n }\n}", "function colorChange(i) {\n //do module to find every 5th move\n if(i % 5 == 0){\n //if state ment to change the color of the text\n if((obj.style.color == \"red\") ? (obj.style.color = \"blue\") : (obj.style.color = \"red\"));\n }\n\n\n}", "function action(a_row, a_col){\n\tif(divClass[a_row][a_col] == 'default' || divClass[a_row][a_col] == player){\n\t\treaction(a_row, a_col);\n\t\tFrame.className = toggle(Frame.className);\n\t\tplayer = toggle(player);\n\t\t//auto mode\n\t\tif(auto && (player == 'blue')){\n\t\t\tdo{\n\t\t\t\tauto_row = Math.floor(Math.random()*8);\n\t\t\t\tauto_col = Math.floor(Math.random()*8);\n\t\t\t}\n\t\t\twhile(divClass[auto_row][auto_col] == 'red');\n\t\t\taction(auto_row, auto_col);\n\t\t}\n\t}\n}", "function changeColor(e) {}", "function clickCell(x,y) {\n if (grid[x][y]>0) {\n alert(\"Dont Try To Cheat Bud!!!!!\");\n } \n\n\n// Clicking Of Boxes\n else {\n if (currentPlayer==1) {\n document.getElementById(\"cell_\"+x+\"_\"+y).style.color=\"#3F88C5\";\n document.getElementById(\"cell_\"+x+\"_\"+y).innerHTML=\"X\";\n grid[x][y]=1;\n currentPlayer=2;\n } else {\n document.getElementById(\"cell_\"+x+\"_\"+y).style.color=\"#E2C290\";\n document.getElementById(\"cell_\"+x+\"_\"+y).innerHTML=\"O\";\n grid[x][y]=2;\n currentPlayer=1;\n }\n }\n}", "function changeCellColour(){\n let cellID = this.id;\n console.log(cellID);\n this.style.backgroundColor = \"rgb(\"+Math.random()*255+\",\"+Math.random()*255+\",\"+Math.random()*255+\")\";\n}", "function turnBased() {\n newBoard.highlightMoves(newBoard.activePlayer.character);\n $('.col').click((event) => {\n if ($(event.target).hasClass('highlight')) {\n let currentPlayerCell = Number($(`#${newBoard.activePlayer.character}`).attr('cell'));\n newBoard.movePlayer(newBoard.activePlayer.character);\n $(event.target).addClass('player').attr('id', `${newBoard.activePlayer.character}`);\n let newPlayerCell = Number($(`#${newBoard.activePlayer.character}`).attr('cell'));\n collectWeapon(newBoard.activePlayer, currentPlayerCell, newPlayerCell);\n newBoard.switchPlayer();\n if (fightCondition(newPlayerCell) === true) {\n alert('The fight starts now');\n startFight(newBoard.activePlayer, newBoard.passivePlayer);\n }\n else {\n newBoard.highlightMoves(newBoard.activePlayer.character);\n }\n }\n })\n }", "function giveCellsClick() {\n if(turn)\n {\n player = whitePlayer;\n }\n else\n {\n player = blackPlayer;\n }\n cells.forEach(cell => {\n cell.addEventListener('click', () =>\n { \n i = cell.closest('tr').rowIndex;\n j = cell.cellIndex;\n if(board[i][j] == 0 && player.possiblemoves[i][j] == 1)\n { \n if(HumanIsWhite)\n {\n placePiece(i, j, \"white\");\n }\n else\n {\n placePiece(i, j, \"black\");\n }\n \n }\n }); \n });\n}", "function fillBackgroundColorOfSalvoGrid(gridLocation, eachTurn, hitsOnYourOpponent) {\n\n //console.log(gridLocation);\n\n $(\"#\" + gridLocation).css(\"background-color\", \"green\");\n //$('#' + gridLocation).text(\"X\");\n\n //ADD TURN NUMBER TO SHOTS FIRED\n var turnNumber = eachTurn;\n $(\"#\" + gridLocation).html(\"X\");\n\n for(var x = 0; x < hitsOnYourOpponent.length; x++){\n\n var currentLocation = hitsOnYourOpponent[x].hitLocation;\n\n //CHANGE COLOR OF SQUARE IF U HIT YOUR OPPONENT!\n //$(\"#\" + currentLocation + currentLocation).css(\"background-color\", \"red\");\n //$(\"#\" + currentLocation + currentLocation).html(\"hit\");\n $(\"#\" + currentLocation + currentLocation).addClass(\"firePic\");\n\n }\n }", "function setColor(winner) {\n\tif (winner == 'x') {\n\t\treturn('green');\n\t}\n\telse if (winner == 'o') {\n\t\treturn('yellow');\n\t}\n}", "function changebackground(element)\n{\n\tvar red = element.getAttribute(\"data-red\");\n\tvar green = element.getAttribute(\"data-green\");\n\tvar blue = element.getAttribute(\"data-blue\");\n\n\telement.style.backgroundColor = `rgb(${red},${green},${blue}`;\n\telement.setAttribute(\"data-revealed\" ,\"true\");\n\tcheckgame($(element).index());\n\t\n}", "function change(i,j){\n if(g_checker){\n var index = document.getElementsByClassName('row-'+i)[0].children[j];\n\n\n\n g_newBoard[i][j] += 1;\n\n if(g_newBoard[i][j] > 3){\n index.setAttribute(\"style\", \"background-color:white;\");\n g_newBoard[i][j] = 0;\n }\n\n if(g_newBoard[i][j] === 3){\n index.setAttribute(\"style\", \"background-color:#D79922;\");\n }\n\n if(g_newBoard[i][j] === 1){\n index.setAttribute(\"style\", \"background-color:#4056A1;\");\n }\n\n if(g_newBoard[i][j] === 2){\n index.setAttribute(\"style\", \"background-color:#F13C20;\");\n }\n }\n}", "function cellDblClicked() {\n changeColor()\n}", "function clickMe(elementId,tblrow,tblcol){ //clickMe \n //alert(elementId); // \n //let col = elementId % 10 - 1; // \n let row = getNextAvailableRow(tblcol); //\n \n data[row][tblcol] = player; // element position value to player\n\n let elementposition = 'circle_'+(row)+(tblcol); //\n if(player == 1)\n document.getElementById(elementposition).style.backgroundColor = \"red\"; \n else\n document.getElementById(elementposition).style.backgroundColor = \"yellow\";\n \n horizontalLine(player); \n verticleLine(player);\n //ForwardDiagonal(player);\n\n if(player == 1){ // players are switching\n player =2;\n }else{\n player =1;\n }\n document.getElementById(\"currentplayer\").innerHTML = player;\n\n //console.table(data);\n\n}", "function winningcolor(correctcolor) {\n\tfor ( var i=0; i < modeselect ; i++) {\n\t\tsqlist[i].style.backgroundColor = correctcolor;\n\t}\t\n}", "function wechselfarbe(clicked_id) {\n color[clicked_id]++;\n if (color[clicked_id] > 3){\n color[clicked_id] = 1;\n }\n switch(color[clicked_id]){\n case 1:\n document.getElementById(clicked_id).style.backgroundColor = \"red\";\n dataSent [0] = color[clicked_id];\n\t\t\tdataSent[1] =clicked_id;\n\t\t\twebsocket[1].send(dataSent);\n break;\n case 2:\n document.getElementById(clicked_id).style.backgroundColor = \"green\";\n dataSent [0] = color[clicked_id];\n\t\t\tdataSent[1] =clicked_id;\n\t\t\twebsocket[1].send(dataSent);\n break;\n case 3:\n document.getElementById(clicked_id).style.backgroundColor = \"blue\";\n dataSent [0] = color[clicked_id];\n\t\t\tdataSent[1] =clicked_id;\n\t\t\twebsocket[1].send(dataSent);\n break;\n }\n}", "function connectFour() {\n playerRed=true; //red\n playerYellow=false; //yellow\n table = document.getElementById(\"gameBoard\");\n\n for(let i = 0; i < 6; i++){\n //console.log(\"got here row\"+i);\n\t\ttable.insertRow(i);\n\t\tfor(let j = 0; j < 7; j++){\n //console.log(\"got here col\"+j);\n\t\t\ttable.rows[i].insertCell(j);\n cell = table.rows[i].cells[j];\n cell.id = i*7+j;\n cell.hasValue = false;\n cell.isRed = false;\n cell.isYellow = false;\n\n cell.onclick = function(){\n //this.style.backgroundColor=\"beige\";\n click(this, j);\n };\n\n }\n }\n\n document.getElementById(\"newGame\").onmousedown = function(){\n for(let i=5; i>=0; i--){\n table.deleteRow(i);\n }\n\n document.getElementById(\"test1\").innerHTML=\"\";\n document.getElementById(\"test2\").innerHTML=\"\";\n document.getElementById(\"test3\").innerHTML=\"\";\n document.getElementById(\"test4\").innerHTML=\"\";\n document.getElementById(\"test5\").innerHTML=\"\";\n document.getElementById(\"test6\").innerHTML=\"\";\n document.getElementById(\"test7\").innerHTML=\"\";\n document.getElementById(\"test8\").innerHTML=\"\";\n document.getElementById(\"test9\").innerHTML=\"\";\n document.getElementById(\"test10\").innerHTML=\"\";\n document.getElementById(\"test11\").innerHTML=\"\";\n\n connectFour()};\n}", "function colorPlayed(location, playerNumber) {\n element = document.getElementById(location);\n\t$(element).addClass(\"filled\");\n\t$(element).addClass(\"player\" + playerNumber);\n\t$(element).removeClass(\"playable\");\n\tresetBoard(false);\n}", "function drawActiveGrid() {\n for (let a = 0; a < height; a++) {\n row = canvas.insertRow(a);\n // sets a click event listener and which sets color\n //from the user input\n row.addEventListener(\"click\", e => {\n //function setColor\n var clicked = e.target;\n color.addEventListener(\"change\", e =>\n //function onColorUpdate\n {\n selectedColor = e.target.value;\n }\n );\n clicked.style.backgroundColor = selectedColor;\n });\n for (let b = 0; b < width; b++) {\n cell = row.insertCell(b);\n }\n }\n }", "function triggerTile(){\r\n if($(this).css(\"backgroundColor\")===\"rgb(0, 0, 255)\"){\r\n\t$(this).css(\"background-color\",\"white\");\r\n }else{\r\n $(this).css(\"background-color\",\"blue\"); \r\n }\r\n}", "function mouseon(tile) {\n console.log('test')\n $board = $('#myBoard');\n $(tile.target).css('background-color','green');\n element = $(tile.target)\n if ((element.hasClass(\"thoughtchoiceleft\") && game.turn()=='w') || (element.hasClass(\"thoughtchoiceright\") && game.turn()=='b')) {\n var text = tile.target.textContent\n var attempt = game.move(text);\n game.undo();\n if (attempt != null) { \n var squareto = $board.find(('.square-' + attempt.to))\n highlightTo = squareto\n squareto.css(\"background-color\",\"blue\");\n var squarefrom = $board.find(('.square-' + attempt.from))\n highlightFrom = squarefrom\n squarefrom.css(\"background-color\",\"yellow\");\n }\n}\n}", "function conway_draw() {\n for (let row = 0; row < board_size; row++) {\n for (let col = 0; col < board_size; col++) {\n let alive = grid[row][col];\n let id = row + \"_\" + col;\n let cell = document.getElementById(id);\n cell.classList.remove(\"on\");\n if (using_palette) {\n cell.style.backgroundColor = pal[alive];\n } else {\n if (alive) {\n cell.classList.add(\"on\");\n }\n }\n }\n }\n}", "function drop_down(thecol) {\n let $the_cell = find_empty(thecol)\n if ($the_cell) {\n $the_cell.removeClass('empty')\n if (that.turn % 2 == 0) {\n $the_cell.css('backgroundColor', 'red')\n $('#player_turn').text('Blue')\n that.turn += 1\n return $the_cell\n }\n else {\n $the_cell.css('backgroundColor', 'blue')\n $('#player_turn').text('Red')\n that.turn += 1\n return $the_cell\n }\n }\n return null\n }", "function setAIColor() {\n switch (difficulty) {\n case \"easy\": base_color1 = [34, 142, 250]; break; // (blue)\n case \"medium\": base_color1 = [230, 54, 230]; break; // (fuscia)\n case \"hard\": base_color1 = [255, 60, 0]; break; // (red)\n default: base_color1 = [255, 255, 0]; // (yellow)\n }\n // make cell colors public\n cell_module.player_colors = [base_color0, base_color1];\n\n // update AI score color\n document.querySelector(\"#score1\").style.color = vec2rgb(base_color1);\n\n }", "function setColor(event) {\n \"use strict\";\n var i = 0;\n\n // We must check to see if there is a color class already are there\n for (i = 0; i < myCol.length; i = i + 1) {\n if (event.target.classList.contains(myCol[i]) === true) {\n event.target.classList.remove(myCol[i]);\n numColors = numColors - 1; // Set this one before\n }\n }\n\n // after clensed the old color it's safe to add a new one\n event.target.classList.add(selectedColor);\n\n // If this is the 4-th color do a check\n numColors = numColors + 1; // New color on dot\n if (numColors === 4) {\n checkRow();\n scroll(true); // true means scroll, false means clean.\n resetLowest();\n }\n}", "clicked(key, e){\r\n let k = this.keyToPoint(key)\r\n let j = this.state.prevClick\r\n let moved = false\r\n let cellClicked = this.state.rows[k.x][k.y]\r\n let prevClicked = j !== null ? this.state.rows[j.x][j.y] : null\r\n let nextTurn = this.state.turn\r\n\r\n if (this.sameCell(k, j))\r\n return\r\n \r\n //first click since last turn\r\n //Make sure white doesnt click black pieces and vice versa\r\n //Cells without pieces are not highlighted either\r\n if(prevClicked === null){\r\n if(!cellClicked.holdsPiece() || \r\n this.state.turn !== cellClicked.piece.player){\r\n return\r\n }\r\n else\r\n cellClicked.hl = \"true\"\r\n }\r\n else{\r\n if(cellClicked.holdsPiece() && \r\n prevClicked.piece.player === cellClicked.piece.player){\r\n cellClicked.hl = \"true\"\r\n prevClicked.hl = \"false\"\r\n }\r\n else{\r\n moved = prevClicked.piece.move(cellClicked, this.state.rows)\r\n if(moved){\r\n nextTurn = this.state.moveCount % 2 === 0 ? \"black\" : \"white\"\r\n prevClicked.hl = \"false\"\r\n }\r\n }\r\n }\r\n this.setState(prevState => ({\r\n rows : prevState.rows.map(row => ([...row])),\r\n prevClick : moved ? null : cellClicked.hl === \"true\" ? {...k} : prevState.prevClick,\r\n moveCount : moved ? prevState.moveCount + 1 : prevState.moveCount,\r\n turn : nextTurn\r\n }))\r\n\r\n if(moved){\r\n let mover = this.state.turn === \"white\" ? player1 : player2\r\n let moved = mover === player1 ? player2 : player1\r\n console.log(`${moved.name} is checked: ${mover.checkedOpponent(moved.kingLocation,\r\n this.state.rows)}`)\r\n }\r\n \r\n }", "function alterColor(e) {\n const currentSquare = this;\n if (state === \"Color\") {\n currentSquare.style.backgroundColor = getColor();\n } else if (state === \"Erase\") {\n currentSquare.style.backgroundColor = defaultSquareColor;\n } else if (state === \"Random\") {\n setColor(getRandomColor());\n currentSquare.style.backgroundColor = getColor();\n }\n}", "function changeColor(e){\n if (colorScheme == \"BLACK\"){\n e.target.style.backgroundColor = \"BLACK\";\n e.target.style.opacity = 1;\n } else if (colorScheme == \"RAINBOW\"){\n e.target.style.backgroundColor = \"#\" + Math.floor(Math.random() * 4096).toString(16);\n e.target.style.opacity = 1;\n } else if (colorScheme == \"DARKEN\"){\n let darken = Number(e.target.style.opacity);\n e.target.style.opacity = darken += 0.1;\n e.target.style.backgroundColor = '#000';\n }\n}", "function winningColor(color) {\n for (var i = 0; i < squares.length; i++) {\n squares[i].style.backgroundColor = color\n }\n}", "function gridTransition() {\r\n\t\t$('#game_board').each(function(){\r\n\t\t\tvar $cell = $(this).find('.open');\r\n\t\t\tvar cell_amount = $cell.length;\r\n\t\t\tvar random_cell = $cell.eq(Math.floor(cell_amount*Math.random()));\r\n\r\n\t\t\trandom_cell.animate({'color': jQuery.Color('#fff')}, 100, function(){\r\n\t\t\t\t$(this).animate({'color': jQuery.Color('#bd727b')}, 100);\r\n\t\t\t});\r\n\t\t});\r\n\t}", "function mousePressed(){\n if (mouseY<31) {\n col = \"green\";\n }else if (mouseY > 30 && mouseY < 61){\n col = \"blue\";\n } else if (mouseY > 60 && mouseY < 91){\n col = \"yellow\";\n }\n}", "function setCell(cell){\n cell.style.backgroundColor = \"white\"; //default white background\n\n //add eventlistener of click & change color\n cell.addEventListener(\"click\", function(evt){\n targetCell = evt.target;\n colorSelected = document.getElementById(\"selectedID\").value;\n targetCell.style.backgroundColor = colorSelected;\n });\n}", "checkShouldChangeColor() {\r\n const greenNeighbors = this.neighbors.filter(neighbor => neighbor.color == '1').length;\r\n // console.log(`has [${redNeighbors}] red neighbors and [${greenNeighbors}] green neighbors.`);\r\n\r\n\r\n if (this.color == 0 && [3, 6].includes(greenNeighbors)) {\r\n // console.log(`Cell color is RED AND HAS ${greenNeighbors} GREEN neighbors and should change color to GREEN`);\r\n this.shouldChangeColor = true;\r\n }\r\n\r\n if (this.color == 1 && [0, 1, 4, 5, 7, 8].includes(greenNeighbors)) {\r\n // console.log(`Cell color is GREEN AND HAS ${redNeighbors} RED neighbors and should change color to RED`);\r\n this.shouldChangeColor = true;\r\n }\r\n }", "function attachCellClickListeners() {\n $.each(grid[0].rows, function(i, row) {\n $.each(row.cells, function(j, cell) {\n $(cell).click(function changeColor() {\n var color = color_input();\n $(this).css({backgroundColor: color});\n });\n });\n });\n}", "function hoverColor() {\n\tif (this.id !== board.currentColor) {\n\t\tif (this.id === 'blue') {\n\t\t\t$(this).css('background-color', active_blue)\n\t\t} else if (this.id === 'yellow') {\n\t\t\t$(this).css('background-color', active_yellow)\n\t\t} else if (this.id === 'green') {\n\t\t\t$(this).css('background-color', active_green)\n\t\t} else if (this.id === 'purple') {\n\t\t\t$(this).css('background-color', active_purple)\n\t\t} else if (this.id === 'red') {\n\t\t\t$(this).css('background-color', active_red)\n\t\t} else if (this.id === 'brown') {\n\t\t\t$(this).css('background-color', active_brown)\n\t\t}\n\t}\n}", "function init() {\n squares.forEach((val, index) => {\n val.dataset.index = index;\n val.dataset.clicked = \"-1\";\n val.addEventListener(\"click\", squareClicked);\n });\n currentPlayer.innerText = \"Red\";\n currentPlayer.classList.add(\"redPlayerColor\");\n}", "function checkCanvas(){\n $(\"#check\").click(function(){\n $(\"td\").css(\"background-color\", getColor())\n });\n\n}", "function winningColors(color){\n //loop through all the squares\n for(let i=0;i<squares.length;i++){\n //change all colors to match the picked color\n squares[i].style.backgroundColor = color; \n } \n}", "function matchNumToColor(row,col){\r\n var colorArray2 = [\"rgb(204, 0, 0)\", \"rgb(255, 136, 0)\", \"rgb(0, 126, 51)\", \"rgb(0, 105, 92)\", \"rgb(13, 71, 161)\", \"rgb(153, 51, 204)\"];\r\n if(square.style.backgroundColor == colorArray2[0]){\r\n objArray[row][col].ocupied = 1;\r\n }else if(square.style.backgroundColor == colorArray2[1]){\r\n objArray[row][col].ocupied = 2;\r\n }else if(square.style.backgroundColor == colorArray2[2]){\r\n objArray[row][col].ocupied = 3;\r\n }else if(square.style.backgroundColor == colorArray2[3]){\r\n objArray[row][col].ocupied = 4;\r\n }else if(square.style.backgroundColor == colorArray2[4]){\r\n objArray[row][col].ocupied = 5;\r\n }else if(square.style.backgroundColor == colorArray2[5]){\r\n objArray[row][col].ocupied = 6;\r\n }\r\n}", "function returnColor(row, col) {\r\n if (($('.row'+row+'> td[col='+col+']')[0].classList).length == 1){\r\n return \"none\"\r\n }\r\n else if ($('.row'+row+'> td[col='+col+']')[0].classList[1] == \"toggleRed\"){\r\n return \"red\"\r\n }\r\n else if ($('.row'+row+'> td[col='+col+']')[0].classList[1] == \"toggleBlue\"){\r\n return \"blue\"\r\n }\r\n}", "function showCurrentPlayer()\n{\n if (huidige_speler === SPELER1) {\n naam_speler_1.style.color = \"red\";\n naam_speler_2.style.color = \"black\";\n } else if (huidige_speler === SPELER2) {\n naam_speler_1.style.color = \"black\";\n naam_speler_2.style.color = \"red\";\n } else {\n naam_speler_1.style.color = \"black\";\n naam_speler_2.style.color = \"black\";\n }\n}", "function showCurrentPlayer()\n{\n if(huidige_speler === SPELER1) {\n naam_speler_1.style.color = \"red\";\n naam_speler_2.style.color = \"black\";\n } else if(huidige_speler === SPELER2) {\n naam_speler_1.style.color = \"black\";\n naam_speler_2.style.color = \"red\";\n } else {\n naam_speler_1.style.color = \"black\";\n naam_speler_2.style.color = \"black\";\n }\n}", "function cellPlayed(clickedCell, clickedCellIndex) {\n //Add username to the gameState array[cellindex]\n gameState[clickedCellIndex] = currentPlayer;\n //Display the username on the clicked cell\n const cellContent = document.createElement('p');\n cellContent.classList.add('move');\n cellContent.textContent = currentPlayer;\n clickedCell.append(cellContent);\n \n //Add classes - styling- depending of P1 or P2\n if(currentPlayer === game.players.player01.username){\n clickedCell.classList.add('clickedP1');\n }\n if(currentPlayer === game.players.player02.username) {\n clickedCell.classList.add('clickedP2');\n }\n}", "function setColor() {\n roll.style.backgroundColor = roll.style.backgroundColor == \"green\" ? \"blue\" : \"green\";\n }", "function colourCell( obj )\r\n\t{\r\n\t\tobj.origColor=obj.style.backgroundColor;\r\n\t\tobj.style.backgroundColor = '#E2EBF3';\r\n\t\tobj.style.cursor = \"pointer\";\r\n\t\tobj.style.border = \"solid 1px #A9B7C6\";\r\n\t}", "oncolor() {\n let color = Haya.Utils.Color.rgbHex($.color.red, $.color.green, $.color.blue, \"0x\");\n this.target.sprite.color = color;\n this.target.sprite.tint = color;\n }", "function colorCordenadas(e) { // Si al clickear se encuentra con un barco enemigo se vuelve rojo\n\tif (contador >= 1) {\n\t\tlet coordenadas = e.target.id;\n\t\t//console.log(coordenadas)\n\t\tif (miTraduccion.includes(coordenadas)) {\n\t\t\te.target.style.background = \"red\";\n\t\t} else {\n\t\t\te.target.style.background = \"gray\";\n\t\t}\n\t\tcontador--;\n\t}\n}", "function colorChange (newCell) {\n newCell.addEventListener('click', function () {\n newCell.style.backgroundColor = color.value\n }); newCell.addEventListener('dblclick', function () {\n newCell.style.backgroundColor = ''\n })\n}", "function changeColor(){\n var i = Math.floor(Math.random() * 8);\n col = c[i];\n}", "function Clicked(CellClicked){ \n if (typeof originalBoard[CellClicked.target.id]=='number'){\n if(PlayerDecide%2==1) {\n Show(CellClicked.target.id,FirstPlayer);\n PlayerDecide=PlayerDecide+1;\n }\n else { \n Show(CellClicked.target.id,SecondPlayer);\n PlayerDecide=PlayerDecide+1;\n }\n }\n}", "selectSquare(currPlayer, color,nxtPlayer ){\n this.element.querySelector(\".face-container\").querySelector(\".facedown\").innerHTML = '<p>'+currPlayer.toUpperCase()+'</p>';\n this.element.querySelector(\".face-container\").querySelector(\".facedown\").style.color = color;\n this.choice = currPlayer;\n this.checkForWinner();\n this.checkForDraw();\n player = nxtPlayer;\n turn ++;\n }", "selectSquare(currPlayer, color,nxtPlayer ){\n this.element.querySelector(\".face-container\").querySelector(\".facedown\").innerHTML = '<p>'+currPlayer.toUpperCase()+'</p>';\n this.element.querySelector(\".face-container\").querySelector(\".facedown\").style.color = color;\n this.choice = currPlayer;\n this.checkForWinner();\n this.checkForDraw();\n player = nxtPlayer\n turn ++;\n }", "function chcolor(){if(v_chcolor == 1){ document.getElementById(\"sgb\").style.color=color[x];(x < color.length-1) ? x++ : x = 0;}}", "function nextStates(){\r\n var actives=getNumOfActiveNeighbors(rowsData);\r\n var activeCells=[];\r\n for(var i=0;i<rowsData.length;i++){\r\n if(rowsData[i].css(\"backgroundColor\")===\"rgb(0, 0, 255)\"){\r\n activeCells.push(i);\r\n }\r\n }\r\n previousState.push(activeCells); //save the current iteration \r\n //check the game rules\r\n for(var i=0;i<actives.length;i++){\r\n if(rowsData[i].css(\"backgroundColor\")===\"rgb(0, 0, 255)\"){ //check the rules of active cell\r\n if(actives[i]<2){\r\n rowsData[i].css(\"backgroundColor\",\"white\"); \r\n }else if(actives[i]==2 || actives[i]==3){\r\n rowsData[i].css(\"backgroundColor\",\"blue\");\r\n }\r\n else if(actives[i]>3)\r\n {\r\n rowsData[i].css(\"backgroundColor\",\"white\");\r\n }\r\n }\r\n else{ //check the rules of inactive cell\r\n if(actives[i]==3){\r\n rowsData[i].css(\"backgroundColor\",\"blue\");\r\n }\r\n }\r\n \r\n } \r\n}", "function showTurn(){\n if(model.player1.myTurn){\n $(\".player1-info p\").css({\n \"color\" : \"tomato\",\n \"font-weight\" : \"bold\" \n });\n $(\".player2-info p\").css({\n \"color\" : \"black\",\n \"font-weight\" : 'normal'\n })\n } else if(model.player2.myTurn){\n $(\".player2-info p\").css({\n \"color\" : \"red\",\n \"font-weight\" : \"bold\"\n });\n $(\".player1-info p\").css({\n \"color\" : \"black\",\n \"font-weight\" : \"normal\"\n })\n }\n }", "function markSquare() {\n $(document).ready(function( ){\n $(\"td\").bind(\"click\", function(){\n if (currentPlayer == user.userx.name && $(this).text() ==\"\") {\n //mark with user symbol:\n $(this).text(\"X\");\n //switch the user after being selected:\n currentPlayer = user.usero.name;\n $(\"p\").text(\"Player \" + currentPlayer + \"'s turn\");\n }else if (currentPlayer == user.usero.name && $(this).text() ==\"\") {\n $(this).text(\"O\");\n currentPlayer = user.userx.name;\n $(\"p\").text(\"Player \" + currentPlayer + \"'s turn\");\n }\n $(this).css(\"background-color\", \"blue\");\n });\n });\n }", "function highlightGrid(e) {\n //if it is the computer's turn or the game is over do not highlight\n if (!playersTurn || gameOver) {\n return;\n }\n highlightCell(e.clientX, e.clientY);\n}", "function changeColor(cell) {\n cell.style.backgroundColor = document.querySelector(\"#colorPicker\").value;\n}", "function CelluleJouer(clickedCell, clickedCellIndex) {\n GameState[clickedCellIndex] = CurrentPlayer;\n clickedCell.innerHTML = CurrentPlayer;\n}", "function gameOver() {\n\tgridCells.forEach((cell) => {\n\t\tcell.classList.add(\"active\");\n\t});\n}", "function itsClicked1(event) {\n r = r + 1;\n result.style.backgroundColor = \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\n color.innerHTML = `${r},${g},${b}`;\n}", "function changeColor (color) {\n // -(7.1)- Loop through all squares \n for (let index = 0; index < squares.length; index++) {\n\n // -(7.2)- Change each color to match goal color\n squares[index].style.backgroundColor = color;\n }\n}", "function teamClicked(e)\n{\n if(e.target.id.indexOf(\"red\") > -1)\n teamIndexes[0] = e.target.id.substring(\"red\".length) - 0 - 1;\n \n else\n teamIndexes[1] = e.target.id.substring(\"blue\".length) - 0 - 1;\n \n updateDom();\n}", "function gameOver(winObj) {\r\n // Get the starting row/column values\r\n let startRow = winObj.start[0];\r\n let startCol = winObj.start[1];\r\n\r\n // Get the direction of the victory\r\n const direction = winObj.direction;\r\n\r\n // Apply styling according to the start point and direction of victory\r\n switch(direction) {\r\n case \"horizontal\":\r\n $(\".cell[name=cell_\" + startRow + \"-\" + startCol + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + startRow + \"-\" + (startCol + 1) + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + startRow + \"-\" + (startCol + 2) + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + startRow + \"-\" + (startCol + 3) + \"]\").addClass(\"cellHighlight\");\r\n break;\r\n case \"vertical\":\r\n $(\".cell[name=cell_\" + startRow + \"-\" + startCol + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + (startRow + 1) + \"-\" + startCol + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + (startRow + 2) + \"-\" + startCol + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + (startRow + 3) + \"-\" + startCol + \"]\").addClass(\"cellHighlight\");\r\n break;\r\n case \"diagonalUp\":\r\n $(\".cell[name=cell_\" + startRow + \"-\" + startCol + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + (startRow + 1) + \"-\" + (startCol + 1) + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + (startRow + 2) + \"-\" + (startCol + 2) + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + (startRow + 3) + \"-\" + (startCol + 3) + \"]\").addClass(\"cellHighlight\");\r\n break;\r\n case \"diagonalDown\":\r\n $(\".cell[name=cell_\" + startRow + \"-\" + startCol + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + (startRow - 1) + \"-\" + (startCol + 1) + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + (startRow - 2) + \"-\" + (startCol + 2) + \"]\").addClass(\"cellHighlight\");\r\n $(\".cell[name=cell_\" + (startRow - 3) + \"-\" + (startCol + 3) + \"]\").addClass(\"cellHighlight\");\r\n break;\r\n }\r\n}", "function gameWin(player){\n var playerColor = player.toUpperCase();\n $(\"#winMsg\").html(playerColor + \" WINS!!!\");\n $(\"#winModal\").modal(\"show\");\n if(player == \"red\"){\n redWins++;\n $(\".redWins\").html(redWins);\n turn = \"red\";\n }else{\n blackWins++;\n $(\".blackWins\").html(blackWins);\n turn = \"black\";\n }\n }", "function ChangeColor()\n{\n\tlet cell = document.createElement(\"td\"); //lets the cell value be determined by td\n\t//create an event on click to have the cells change color when clicked\n cell.addEventListener('click', function(){this.style.backgroundColor = colorSelected}, false); \n\t//return the value of the cell\n return cell;\n}", "handleClick(row, col) {\n let valuesCopy = this.state.values.slice().slice();\n let rowToFill = null;\n for (let i = 0; i < 6; i++) {\n if (valuesCopy[i][col] === null) {\n rowToFill = i;\n } else {\n break;\n }\n }\n\n let color = this.state.turn ? 'red' : 'blue';\n let next = this.state.turn ? false : true;\n this.setState({turn: next})\n\n valuesCopy[rowToFill][col] = color;\n this.setState({values: valuesCopy})\n\n }", "function handleCellPlayed(clickedCell, clickedCellIndex) {\n //updating state\n gameState[clickedCellIndex] = currentPlayer;\n //updating interface\n clickedCell.innerHTML = currentPlayer;\n}", "function selectCell(cell, col){\n for(let i=0; i<5; i++)\n {\n for(let j=0; j<7; j++)\n {\n if(j==col)\n {\n if(cell.hasValue==false && table.rows[i+1].cells[j].hasValue==false) //if cell has no value yet, move down to the next cell\n {\n cell=table.rows[i+1].cells[j]; //this will move it to the bottom of the table\n }\n }\n }\n }\n\n cell.hasValue=true;\n if(playerRed==true)\n {\n cell.innerHTML=\"&#x1F534;\"; //red\n cell.isRed=true;\n }\n else //if yellow turn\n {\n cell.innerHTML=\"&#x1F601\"; //yellow\n cell.isYellow=true;\n }\n return(cell);\n}", "function draw(e) {\n e.target.style.backgroundColor = choosenColor();\n}", "function changeCell() {\n var clicked = document.getElementById(\"box\").click;\n if (clicked == true) {\n alert(\"box clicked\")\n document.getElementById(\"box\").background = colorSelected;\n }\n // mouse clicks on cell change to colorSelecetd value\n}", "function clickTestMode(cell, col, testNum){\n\n //console.log(\"clicked cell # \"+cell.id);\n if(cell.hasValue)\n {\n alert(\"Cannot click here.\");\n return;\n }\n\n if(playerRed==true) //player red\n {\n\n let cellSelected=selectCell(cell, col); //finds next available cell at bottom of column and adds emoji to the board\n\n if(winChoice())\n {\n //printWinner();\n if(test5Bool==true)\n {\n document.getElementById(\"test5\").innerHTML=testNum + \"PASSED\";\n }\n else if(test7Bool==true)\n {\n document.getElementById(\"test7\").innerHTML=testNum + \"PASSED\";\n }\n else if(test9Bool==true)\n {\n document.getElementById(\"test9\").innerHTML=testNum + \"PASSED\";\n }\n return;\n }\n else if(test5Bool==true)\n {\n document.getElementById(\"test5\").innerHTML=testNum + \"FAILED\";\n }\n else if(test7Bool==true)\n {\n document.getElementById(\"test7\").innerHTML=testNum + \"FAILED\";\n }\n else if(test9Bool==true)\n {\n document.getElementById(\"test9\").innerHTML=testNum + \"FAILED\";\n }\n\n }\n else //player yellow\n {\n let cellSelected=selectCell(cell, col);\n\n if(winChoice())\n {\n //printWinner();\n if(test6Bool==true)\n {\n document.getElementById(\"test6\").innerHTML=testNum + \"PASSED\";\n }\n else if(test8Bool==true)\n {\n document.getElementById(\"test8\").innerHTML=testNum + \"PASSED\";\n }\n else if(test10Bool==true)\n {\n document.getElementById(\"test10\").innerHTML=testNum + \"PASSED\";\n }\n return;\n }\n else if(test6Bool==true)\n {\n document.getElementById(\"test6\").innerHTML=testNum + \"FAILED\";\n }\n else if(test8Bool==true)\n {\n document.getElementById(\"test8\").innerHTML=testNum + \"FAILED\";\n }\n else if(test10Bool==true)\n {\n document.getElementById(\"test10\").innerHTML=testNum + \"FAILED\";\n }\n }\n switchPlayer();\n}", "function addClickEventToCells() {\n var cells = document.getElementsByClassName('cell');\n for (var i = 0; i < cells.length; i++) {\n cells[i].addEventListener(\"click\", function(event) {\n var chosenCell = event.target;\n chosenCell.style.backgroundColor = chosenColor;\n });\n }\n}", "function addRedorYellow() {\n\t\tvar $dropCell = $(this);\n\t\tvar $boxes = $('td');\n\t\tvar $colHead = $('th');\n\t\tvar index = $dropCell[0].cellIndex;\n\t\tvar $box1 = $($boxes[index+20]);\n\t\tvar $box2 = $($boxes[index+15]);\n\t\tvar $box3 = $($boxes[index+10]);\n\t\tvar $box4 = $($boxes[index+5]);\n\t\tvar $box5 = $($boxes[index+0]);\n\n\t\tif ($box1.hasClass(\"\")) {\n\t\t\tsetBoxRedOrYellow($box1);\n\t\t\taudio.play();\n\t\t\t} else if ($box2.hasClass(\"\")) {\n\t\t\t\taudio.play();\n\t\t\t\tsetBoxRedOrYellow($box2)\n\t\t\t} else if ($box3.hasClass(\"\")) {\n\t\t\t\taudio.play();\n\t\t\t\tsetBoxRedOrYellow($box3)\n\t\t\t} else if ($box4.hasClass(\"\")) {\n\t\t\t\taudio.play();\n\t\t\t\tsetBoxRedOrYellow($box4)\n\t\t\t} else if ($box5.hasClass(\"\")) {\n\t\t\t\taudio.play();\n\t\t\t\tsetBoxRedOrYellow($box5)\n\t\t\t}\n\t\t}", "function switchPlayer(){\n if(playerRed==true)\n {\n playerRed=false;\n playerYellow=true;\n }\n else\n {\n playerRed=true;\n playerYellow=false;\n }\n}", "function clickedColor(){\n\tfor(i = 0; i < squares.length; i++){\n\t\tsquares[i].style.backgroundColor = colors[i];\n\t\tsquares[i].addEventListener(\"click\", \n\t\t\tfunction(){\n\t\t\t\tvar clickedColor = this.style.backgroundColor;\n\t\t\t\tif(clickedColor === pickedColor){\n\t\t\t\t\tmessage.textContent = \"Correct!\";\n\t\t\t\t\tchangeColors(clickedColor);\n\t\t\t\t\th1.style.backgroundColor = clickedColor;\n\t\t\t\t\treset.textContent = \"Try Again?\";\n\t\t\t\t}else{\n\t\t\t\t\tthis.style.backgroundColor = \"#232323\";\n\t\t\t\t\tmessage.textContent = \"Try Again.\";\n\t\t\t\t}\n\n\t\t\t});\n\t}\n}", "function colorSelector(colorColumn)\n{\n document.getElementById(colorColumn).addEventListener(\"click\", function(){\n document.getElementById(colorColumn).style.backgroundColor = color;\n });\n}", "function setupColors(){\n for (var i = 0; i < squares.length; i++) {\n\n squares[i].addEventListener('click', function() {\n var clickedColor = this.style.backgroundColor;\n if (clickedColor === pickedColor) {\n prompt.textContent = \"CORRECT!!\";\n newGame.textContent = \"Play Again?\";\n changeColor(clickedColor);\n } else {\n this.style.backgroundColor = \"#4abdac\";\n prompt.textContent = \"Try again...\";\n }\n });\n }\n}" ]
[ "0.78940594", "0.75791633", "0.7496699", "0.7407657", "0.7294252", "0.723321", "0.71987605", "0.71439785", "0.71367407", "0.70968103", "0.7058698", "0.702306", "0.69892895", "0.688082", "0.68590707", "0.6855624", "0.6830104", "0.68278027", "0.6810469", "0.6797483", "0.6774784", "0.67363673", "0.67255056", "0.6720115", "0.6717902", "0.6688599", "0.6686533", "0.6683455", "0.6683", "0.668035", "0.66796345", "0.6669852", "0.6657866", "0.66523135", "0.66420966", "0.664017", "0.663583", "0.663426", "0.6627722", "0.6626957", "0.6623098", "0.66138047", "0.66064435", "0.66045284", "0.6584513", "0.6580936", "0.6578658", "0.6571796", "0.65691656", "0.65642846", "0.65619314", "0.6559887", "0.654969", "0.6548757", "0.65455407", "0.6538478", "0.6535783", "0.65351135", "0.6530785", "0.6527585", "0.6520286", "0.6518168", "0.6511291", "0.6509228", "0.6506932", "0.6504032", "0.6503304", "0.65000474", "0.6491782", "0.64763796", "0.64757246", "0.64721805", "0.64681005", "0.6463311", "0.6458736", "0.6438409", "0.643404", "0.64324445", "0.64296705", "0.6427994", "0.64267075", "0.64231724", "0.6422293", "0.6422177", "0.6416631", "0.64161617", "0.64126974", "0.64090055", "0.6408194", "0.6398226", "0.639483", "0.63938254", "0.63929546", "0.6387639", "0.6386324", "0.6382918", "0.6378801", "0.6371438", "0.63711345", "0.6370935" ]
0.72036785
6
Get picture by ID
get(req, res, next) { req.checkParams( 'id', 'Invalid picture ID provided').isMongoId(); req.getValidationResult() .then( (result) =>{ if( !result.isEmpty() ){ let errorMessages = result.array().map(function (elem){ return elem.msg; }); PictureController.respondWithError(res, 500, 'There are validation errors: ' + errorMessages.join(' && ')); } let picId = req.params.id; return new Promise(function (resolve, reject) { PictureModel.findById(picId, function (err, pic) { if (pic === null) { PictureController.respondWithError(res, 500, "User not found against Provided id "+ picId); } else { resolve(pic); } }); }); }) .then((pic) => { PictureController.respondWithSuccess(res, 200, pic,"Successfully created"); }) .catch( (error) => { PictureController.respondWithError(res,error.status || 500, error); }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get(id, callback) {\n database.schema.Img.find({\n id: id\n }, function (err, imgs) {\n if (err)\n callback(err, null)\n else if (imgs.length === 0)\n callback(new Error('No such image exists.'), null);\n else\n callback(null, imgs[0]);\n });\n}", "async getImage(id) {\n let filename = this._formatFilename(id);\n\n return await fs.readFile(filename, { encoding: null });\n }", "async _getImage(id) {\n const { body: image } =\n await request.get(this._syncUrl + '/api/image/' + id)\n .proto(imagery.Image)\n .timeout(5000);\n\n return image;\n }", "function displayImage(id) {\n //log('display ' + key);\n return initDB('thr').then(function(db) {\n return readRecord(db, 'books', id).then(function(book) {\n var key = uriToKey(book.pages[0].url);\n return readRecord(db, 'images', key).then(function(result) {\n var $img = $('<img>');\n if (result instanceof Blob) {\n result = window.URL.createObjectURL(result);\n }\n $img.attr('src', result);\n return $img;\n });\n });\n });\n }", "function getImage64withId(id,srcId){\n \n var imgId = id ;\n var currDate = new Date();\n var currTime = currDate.getTime();\n console.log(\"finding image for - \"+imgId);\n \n if(id!=null){\n config.db.get(imgId, function(err, view){\n \n \n if(err){\n console.log(\"err - \"+ JSON.stringify(err));\n }\n else{\n document.getElementById(srcId).setAttribute( 'src', 'data:image/jpg;base64,'+view.image_data);\n }\n });\n }\n \n \n \n \n \n}", "function find(list, id) {\n for (let i = 0; i < list.length; i++) {\n const img = list[i];\n if (img.id === id) return img;\n }\n return null;\n}", "function getImage(id) {\r\n\treturn make_flickr_api_request(\"flickr.photos.getSizes\", id);\r\n}", "function AdminPhotoGet(id,useHttp)\n{\n return api(AdminPhotoGetUrl,{id:id},useHttp).sync();\n}", "getById(id){\n return new Promise((resolve, reject) => {\n this.con.query(\"SELECT * FROM images WHERE id = ?\", [id], (error, result) => {\n if (error) {\n reject(new Error(\"Database error\"))\n }\n if (result.length == 0) {\n reject(new Error(\"No results found in the database\"))\n } else {\n resolve(result)\n }\n })\n })\n }", "function getUnitPhotoById (id) {\n var resultById = unitphotoService.getByIdUnitPhoto(id);\n resultById.then(function (response) {\n $scope.imageUrl = response.data.PathName;\n $scope.description = response.data.Description;\n $scope.unitId = response.data.UnitId;\n }, function (error) {\n $scope.message = response.statusText;\n })\n } // close function", "function searchID(clickedButtonID) {\n\n let image = imageCollection.find(imageCollection => imageCollection.imgID == clickedButtonID);\n document.querySelector(\".viewImageTitle\").innerHTML = image.imgTitle;\n document.querySelector(\".viewImage\").src = image.imgUrl;\n document.querySelector(\".viewImageDate\").innerHTML = \"Created at \" + image.imgCreationTime;\n document.querySelector(\".deleteImage\").id = image.imgID;\n document.querySelector(\".viewImageDescription\").innerHTML = \"Description: \" + image.imgDesc;\n }", "function getImage(map, id) {\n var alias = \"alias:\";\n var image = map[id];\n while(image != null) {\n if(!image.startsWith(alias)) {\n var img = document.createElement(\"img\");\n img.src = image;\n img.alt = id;\n img.title = id;\n img.width = 25;\n return img.outerHTML;\n }\n id = image.replace(alias, \"\")\n image = map[id];\n }\n\n return null;\n}", "getImgUrl(id) {\n if (id === 1) {\n return `images/profile/4randy.png`; // special pic for randy\n } else {\n const index = id%18;\n return `images/profile/${index}.png`\n }\n }", "async getMetadata(id) {\n const filename = this._formatMetadataFilename(id);\n\n const contents = await fs.readFile(filename);\n\n return imagery.Image.fromObject(JSON.parse(contents));\n }", "function ecraFilmeImagens(id) {\n return getFilmeImagens(id)\n .then(function (imagens) {\n mostraFilmeImagens(imagens);\n })\n .catch(function (erro) {\n console.error(erro);\n });\n}", "static async getPhotoById(req, res, next) {\n try {\n const { id } = req.params\n const photo = await gallery.findByPk(id)\n if (!photo) throw { name: \"CustomError\", msg: 'Data not found', status: 400 }\n res.status(200).json(photo)\n } catch (error) {\n next(error)\n }\n }", "getInfo(id) {\n return new Promise((resolve, reject) => {\n fetch(`${env.apiUrl}/public/users/image-info/${id}`)\n .then((response) => response.json())\n .then((data) => resolve(data))\n .catch((error) => reject(error));\n });\n }", "function getUserPicture(id) {\n return $q(function(resolve, reject) {\n FacebookResource.apiCall(id+Constants.FACEBOOK_FRIEND_FIELDS).then(function (response) {\n var url = \"\";\n if(response.picture && response.picture.data)\n {\n url = response.picture.data.url;\n }\n \n return resolve(url);\n \n }, function (error) {\n return reject(error);\n });\n })\n }", "async function getById(id) {\n const _id = new ObjectId(id);\n try {\n let connection = await mongoService.connect();\n let user = await connection.collection(USERS_COLLECTION).findOne({ _id })\n let img = await cloudService.loadImg(user.imgUrl);\n user.img = img;\n return user;\n }\n catch{\n return null;\n\n }\n}", "function view_order_item_image(id){\n \n console.log(\"id\");\n console.log(id);\n $.ajax({\n url:\"./includes/fetch_order_item_by_id.php\",\n type:'post',\n data: {id: id },\n dataType : 'json',\n success : function(response) {\n console.log(response.id );\n\n document.getElementById(\"imageId\").src = \"media/custom_order_items/\"+response.image;\n\n },\n error: function(err){\n console.log(err);\n }\n })\n}", "function getImageForItem(id) {\r\n switch(id) {\r\n case 1: // attack potion\r\n return img = $(\"#red-potion-icon\")[0];\r\n break;\r\n case 2: // defense potion\r\n return img = $(\"#blue-potion-icon\")[0];\r\n break;\r\n case 3: // bomb potion\r\n return img = $(\"#bomb-icon\")[0];\r\n break;\r\n }\r\n}", "function getSingleImage(imageId){\n return new Promise(function(resolve, reject){\n const q = `SELECT images.id, images.likes, images.username, images.image, images.title, images.description, images.created_at, hashtags.hashtag\n FROM images\n JOIN hashtags ON images.id = hashtags.image_id\n WHERE images.id = $1;`\n ;\n const params = [imageId]\n return db.query(q, params).then(function(results){\n resolve(results);\n }).catch(function(e){\n reject(e);\n });\n })\n}", "static getMedium(id){\n return fetch(`${BASE_URL}media/${id}`)\n .then(res => res.json())\n }", "function get_pic_npd(id) {\n\tvar div_id=\"npd_image_div_\"+id;\n\ttemp_image_div=div_id;\n\t//var image = document.getElementById(temp_image_div);\n\tvar hidden_name=\"npd_image_name_hidden_\" + id ;\n\tvar tempTime = $.now();\n\tnpd_image_name=tempTime.toString()+localStorage.selectedOutlet+id.toString()+\"_npd.jpg\";\n\t$(\"#\"+hidden_name).val(npd_image_name);\n\tnavigator.camera.getPicture(onSuccessNpd, onFailNpd, { quality: 50,\n\t\ttargetWidth: 300,\n\t\tdestinationType: Camera.DestinationType.FILE_URI,correctOrientation: true });\n\t // targetHeight: 512,\n}", "function getPhoto(placeID) {\n\n var photoURL = ''\n\n var request = {\n placeId: placeID\n };\n\n service.getDetails(request, function(place, status) {\n if (status == google.maps.places.PlacesServiceStatus.OK) {\n photoURL = typeof place.photos !== 'undefined'\n ? place.photos[0].getUrl({'maxWidth': 100, 'maxHeight': 100})\n : NO_IMAGE_PLACEHOLDER;\n $('#' + IMAGE_TAG_ID).attr(\"src\",photoURL);\n } else {\n photoURL = NO_IMAGE_PLACEHOLDER;\n $('#' + IMAGE_TAG_ID).attr(\"src\",photoURL);\n }\n });\n return ''; // no return directly since place api returns value asynchronous\n}", "function getPhoto(filmId, filmTitle){\n\tvar image = \"https://nelson.uib.no/o/\";\n\tvar imageURL = \"\";\n\n\t// undersøker verdien av filmens ID for å sørge for at det letes i riktig mappe på serveren\n\tif (filmId < 1000){\n\t\timageURL = image + \"0/\" + filmId + \".jpg\"; \n\t}\n\telse if (filmId > 1000 && filmId < 2000){\n\t\timageURL = image + \"1/\" + filmId + \".jpg\";\n\t}\n\telse if (filmId > 2000 && filmId < 3000) {\n\t\timageURL = image + \"2/\" + filmId + \".jpg\";\n\t}\n\telse {\n\t\timageURL = image + \"3/\" + filmId + \".jpg\";\n\t}\n\n\t// lenke til bilde\n\tvar imageLink = '<img src=\"' + imageURL + '\" alt=\"' + filmTitle + '\" width=\"300\">';\n\n\t// lenke til filmside\n\tvar clickableImage = '<a href=\"v3_showmovie.html?id=' + filmId + '\">' + imageLink;\n\n\t// returnerer et bilde som lenker til filmens informasjonsside ved klikk\n\treturn clickableImage;\n}", "retrievePoliticianImages(id){\n var self = this;\n id = id.replace(/-/g, \" \");\n var args = \"state=\" + self.selected_state_id + \"&role=\" + self.selected_role + \"&district=\" + self.selected_district;\n get_state_politician_profile(args, self.loadPoliticianImages.bind(self));\n }", "function generatePhoto(id) {\n\treturn ('[url=' + images[id].link + '][img]' + images[id].url + document.getElementById('photoSize').value +'[/img][/url]');\n}", "function obtenerImagen(idNoticia) {\r\n var src=\"\"\r\n $.ajax({\r\n url: ENDPOINTIMAGES+$.md5(idNoticia)+\".jpg\",\r\n type: 'GET',\r\n async:false,\r\n success: function(data) {\r\n src=ENDPOINTIMAGES+$.md5(idNoticia)+\".jpg\";\r\n },\r\n error: function(data) {\r\n src=ENDPOINTIMAGES+\"default.jpg\";\r\n }\r\n });\r\n\r\n return src;\r\n }", "function IDtoImage(id){\n\tvar scale = '1.0'\n\treturn 'https://static-cdn.jtvnw.net/emoticons/v1/' + id + '/' + scale;\n}", "function get_pic_fdisplay(id) {\n\t\n\t//$('#fddiv_'+id).find('input, textarea, button, select').attr('disabled','disabled');\n\talert (id)\n\n\tvar div_id=\"fdSL_image_div_\"+id;\n\ttemp_image_div=div_id;\n\tvar hidden_name=\"fdSL_image_name_hidden_\"+id;\n\tvar tempTime = $.now();\n\tfd_image_name=tempTime.toString()+\"_\"+localStorage.selectedOutlet+id.toString()+\".jpg\";\n\t$(\"#\"+hidden_name).val(fd_image_name);\n\tnavigator.camera.getPicture(onSuccessFd, onFailFd, { quality: 70,\n\t\ttargetWidth: 450,\n\t\tdestinationType: Camera.DestinationType.FILE_URI , correctOrientation: true });\n\t\n}", "function setSpeakerImage(img, id) {\n let url = location.origin + \"/api/speakers/\" + id + \"/image\";\n fetch(url)\n .then(function (response) {\n if (response.ok) {\n return response.blob();\n }\n })\n .then(function (blob) {\n const objUrl = URL.createObjectURL(blob);\n img.src = objUrl;\n })\n .catch(function (err) {\n console.log(err);\n });\n}", "_FB_getPhoto(photoId, callback) {\n const _this = this;\n\n _this._FB_API('/' + photoId + '/picture', callback);\n }", "function AdminPhotoGetImageID(useHttp)\n{\n return api(AdminPhotoGetImageIDUrl,{},useHttp).sync();\n}", "function getWebcamById(id) {\n var webcamObject = undefined;\n\n for (var i = 0; i < currentCountryObject.webcams.length; i++) {\n if (currentCountryObject.webcams[i].id === id) {\n // found the webcam\n webcamObject = currentCountryObject.webcams[i];\n break;\n }\n }\n return webcamObject;\n }", "function getSingleImageInfo(req, res, next) {\n db\n .any(\"SELECT user_id AS image_owner_id, img_id, img_url, img_likes, comments.id AS comment_id, comment, comments.username AS commenters_username, comment_timestamp FROM comments JOIN images ON (img_id = images.id) WHERE img_id=${img_id} ORDER BY comment_timestamp DESC\",\n { img_id: req.params.img_id } \n )\n .then(function(data) {\n res.status(200).json({\n status: \"success\",\n data: data,\n message: \"Fetched info for single image\"\n });\n })\n .catch(function(err) {\n return next(err);\n });\n}", "function setIdPic(idName) {\r\n\tid = idName;\r\n}", "function getImagesByServiceId(db, idService, callback) {\r\n var query = {\r\n sql: 'GetServiceImagesByServiceId @idService',\r\n parameters: [\r\n { name: 'idService', value: idService }\r\n ]\r\n };\r\n db.execute(query)\r\n .then(function (results) {\r\n callback(results, null);\r\n })\r\n .catch(function(err) {\r\n callback(null, err);\r\n });\r\n }", "function displayProfilePicture(picture, imageID) {\n try {\n if(picture) {\n const path = '/userProfilePictures/' + picture;\n var img = document.getElementById(imageID);\n img.src = path;\n }\n } catch(err) {\n console.error(err);\n }\n}", "function getCustomerProfileAvatar(id) {\n return $http({\n method: 'GET',\n url: API_URL + CUSTOMER_PROFILE_AVATAR_URL + \"/\" + id\n }).then(function successCallback(response) {\n $log.log(\"successCallback getCustomerProfileAvatar result: \");\n $log.log(response);\n return response.data;\n }, function errorCallback(response) {\n $log.log(\"errorCallback getCustomerProfileAvatar result: \");\n $log.log(response);\n return response.data;\n });\n }", "function getFaceImage(identityId) {\n const url = config.GIPS_URL + PATH_V1_IDENTITY + identityId + '/attributes/portrait/capture';\n\n return fetch(url, {\n method: 'GET',\n headers: authenticationHeader(),\n agent: agent\n }).then(res => {\n return res.status === 200 ? res.buffer() : Promise.reject(res);\n }).then(body => {\n const data = (String(body));\n const boundary = data.split('\\r')[0];\n const parts = multipart.Parse(body, boundary.replace('--', ''));\n return parts[0].data;\n }).catch(err => {\n debug(url, ' Failed to request gips server - error:', err);\n return Promise.reject(err);\n });\n}", "function getImageData(id){\n\t\t\tvar defer = $q.defer()\n\t\t\tfb.imageData.child(id).on('value', function(snap){\n\t\t\t\tdefer.resolve(snap.val())\n\t\t\t})\n\t\t\treturn defer.promise\n\t\t}", "function getGistbyID(id) {\n for (var i = 0; i < GistList.length; i++) {\n if (GistList[i].id == id) {\n return GistList[i];\n }\n }\n}", "async fetchGallery(_,{ id }) {\n const galleries = await Gallery.find(id)\n return galleries.toJSON()\n }", "function selectImage(imgID) {\n var theImage = document.getElementById('largeImage');\n var newImg;\n newImg = imgArray[imgID];\n theImage.src = imgPath + newImg;\n}", "static async getPhotoByAlbumId(req, res, next) {\n try {\n const { albumId } = req.params\n const galleries = await gallery.findAll(\n {\n attributes: {\n exclude: ['updatedAt', 'createdAt']\n },\n where: {\n albumId: albumId\n }\n }\n )\n res.status(200).json(galleries)\n } catch (error) {\n next(error)\n }\n }", "function getMarsPic() {\n $.ajax({\n url: marsUrl + key,\n type: 'GET',\n dataType: 'json'\n }).done(function(r) {\n showMarsGallery(r);\n }).fail(function(error) {\n console.error(error);\n });\n }", "function detailsGET(id){\n $(\"#detailsMarco\").attr(\"src\", BASE_URL+\"/apis/detail?idQuery=\"+id);\n}", "retrieveProfilePicture (id) {\n // getUserProfilePic(id)\n // .catch(e => console.log('PIC ERROR', e))\n // .then(r => {\n // this.state.img = r.data.url || 'default image'\n // this.setState(this.state)\n // })\n }", "function getGoogleAvatar(index, googleId, callback) {\n gapi.client.load('plus','v1', function() {\n var request = gapi.client.plus.people.get({\n 'userId': googleId\n });\n request.execute(function(resp) {\n var img;\n if(resp.image) {\n if(!resp.image.isDefault) {\n img = resp.image.url.replace('?sz=50', '?sz=100');\n }\n }\n callback(index, img);\n });\n });\n}", "function fetchPhotos(id) {\n\t\t\t// console.log('fetchPhotos',id)\n\t\t\tvar directory = '';\n\t\t\tvar filePath = 'content/spaces/' + directory + '/carousel.php';\n\t\t\tconsole.log('fetchPhotos',id,directory,filePath);\n\t\t\t// Load Stage photos\n\t\t\tif (id === 'thestage') {\n\t\t\t\tdirectory = 'stage';\n\t\t\t\tfilePath = 'content/spaces/' + directory + '/carousel.php';\n\t\t\t\tif (stagePicsInPlace === 0) {\n\t\t\t\t\tloadCarousel(filePath, id);\n\t\t\t\t\tstagePicsInPlace++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Load Hall photos\n\t\t\telse if (id === 'thehall') {\n\t\t\t\tdirectory = 'hall';\n\t\t\t\tfilePath = 'content/spaces/' + directory + '/carousel.php';\n\t\t\t\tif (hallPicsInPlace === 0) {\n\t\t\t\t\tloadCarousel(filePath, id);\n\t\t\t\t\thallPicsInPlace++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Load Gallery photos\n\t\t\telse if (id === 'thegallery') {\n\t\t\t\tdirectory = 'lobby';\n\t\t\t\tfilePath = 'content/spaces/' + directory + '/carousel.php';\n\t\t\t\tif (galleryPicsInPlace === 0) {\n\t\t\t\t\tloadCarousel(filePath, id);\n\t\t\t\t\tgalleryPicsInPlace++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Load Screening room photos\n\t\t\telse if (id === 'thescreeningroom') {\n\t\t\t\tdirectory = 'screening';\n\t\t\t\tfilePath = 'content/spaces/' + directory + '/carousel.php';\n\t\t\t\tif (screeningPicsInPlace === 0) {\n\t\t\t\t\tloadCarousel(filePath, id);\n\t\t\t\t\tscreeningPicsInPlace++;\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function getProfilePicture(req, res) {\n gfs.files.findOne({\n filename: req.params.name\n }, (err, file) => {\n if (!file || file.length === 0) return res.status(404).json({\n err: 'No file exists'\n });\n if (file.contentType === 'image/jpeg' || file.contentType === 'image/png') {\n const readstream = gfs.createReadStream(file.filename);\n readstream.pipe(res);\n } else {\n res.status(404).json({\n err: 'Not an image'\n });\n }\n });\n}", "async function getImages(idsg) {\n return await Actions.find({ sgame: idsg })\n .sort('prog_nr')\n .select('group_photo')\n .lean();\n}", "function buscarImagen(id, datos){\n const imagen = datos.includes.Asset.find((asset) => {\n return asset.sys.id == id; });\n return imagen \n}", "function getPic(type, userid, size) {\n // If userid is current user\n if (typeof _session.user != \"undefined\" && userid == _session.user.userid) {\n //age = _session.user.age;\n //gender = _session.user.gender;\n picextension = _session.user.picextension;\n }else if (typeof _session.users.user[userid] != \"undefined\") {\n // If Object is present in the current streamMember cache\n //age = _session.users.user[userid].age;\n //gender = _session.users.user[userid].gender;\n picextension = _session.users.user[userid].picextension;\n }else{\n // If Object is not present in the current streamMember cache\n //age = 0;\n //gender = \"\"\n //picextension = \"\"\n }\n \n // If no profile pic exists\n if(typeof picextension == \"undefined\" || picextension == null || picextension.length == 0){\n // Display age appropriate Silohoutte *TODO: Get Age from results\n if(userid < 50){\n gender = \"M\";\n } else {\n gender = \"F\";\n }\n \n imgSrc = 'img/profiles/no-picture-' + gender.toLowerCase() + '.png';\n }else{\n imgSrc = _application.url.fetch[type] + userid + size + picextension;\n }\n \n return imgSrc;\n}", "function readFile(id) {\n return readFileSync(`./images/data-set-${id}.jpg`);\n}", "function getGiphy(searchFor){\n fetch(\"http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=\"+searchFor)\n .then(response => response.json())\n .then(object => {\n document.getElementById(searchFor).src=object.data.image_url;\n });\n}", "function fetchAllImgs(id){\n storage = firebase.storage()\n let storeRef = storage.ref()\n let resRef = storeRef.child(id.id)\n resRef.listAll().then(function(res) {\n res.items.forEach(r => {\n let url\n r.getDownloadURL().then(function(r){\n url = r\n let a = document.createElement(\"div\")\n a.className=\"mySlides\"\n let b =\n ` \n \n <img src=\"`+ url +`\" class=\"slideImg\"> \n `\n a.innerHTML = b\n photosDiv.appendChild(a)\n })\n })\n })\n\n\n let req = {\n placeId: id.id,\n fields: ['photos']\n };\n service.getDetails(req, photosCallback);\n console.log(\"clicked\")\n}", "function getImageUrlForVariantId(id, apiData) {\r\n const currentItem = apiData.find(o => o.number == id);\r\n let url;\r\n if (currentItem) {\r\n const imageWithCheckoutTag = currentItem.images.find(function (image) {\r\n return image.tags.includes(\"checkout\");\r\n });\r\n\r\n if (imageWithCheckoutTag) {\r\n url = imageWithCheckoutTag.url;\r\n } else {\r\n const firstImage = currentItem.images[0];\r\n if (firstImage) {\r\n url = firstImage.url;\r\n }\r\n }\r\n }\r\n return url;\r\n}", "function handlePlanImage(id) {\n alert(id);\n }", "function getCharacterImg(id){\n if (id < 10){\n id = \"0\" + id.toString()\n } \n return `../../asset/Yang_Walk_LR/Yang_Walk_LR_000${id}.png`\n }", "async function getTeamImg(position, id) {\n // Set image URL, using xsmall images\n let imageUrl = encodeURI(apiBaseUrl + \"/images/team/\" + id + \"_xsmall\");\n let image;\n try {\n image = await new Request(imageUrl).loadImage();\n // If image successfully retrieved, write to cache\n fm.writeImage(fm.joinPath(offlinePath, \"badge_\" + position + \".png\"), image);\n } catch (err) {\n console.log(\"Badge Image \" + err + \" Trying to read cached data.\");\n try {\n // If image not successfully retrieved, read from cache\n await fm.downloadFileFromiCloud(fm.joinPath(offlinePath, \"badge_\" + position + \".png\"));\n image = fm.readImage(fm.joinPath(offlinePath, \"badge_\" + position + \".png\"));\n } catch (err) {\n console.log(\"Badge Image \" + err);\n }\n }\n return image;\n}", "function obtenerFotoPerfil(){\n FB.api('/me/picture?width=325&height=325', function(responseI) {\n var profileImage = responseI.data.url;\n var fbid=jQuery(\"#pictureP\").val(profileImage);\n\n\n //console.log(profileImage);\n });\n}", "function getPhoto(photoID) {\n\t\tunselectPreviousFeaturesPointClick();\n\n\t\tvar selectedFeatures1 = [];\n\n\t\tselectedFeatures1 = map.getLayers().getArray()[2].getSource().getFeatures();\n\n\t\tselectedFeatures = jQuery.grep(selectedFeatures1, function(n, i){\n\t\t\t return n.get(\"Image\") == photoID;\n\t\t});\n\n\t\t\n\t\t\tvar info = document.getElementById('results');\n\t\t\t\t if (selectedFeatures.length > 0) {\n\n\t\t\t\t\tvar coords = selectedFeatures[0].getGeometry().getCoordinates();\n\n//\t\t\t\t\tmap.getView().animate({\n//\t\t\t\t\t\tcenter: [coords[0] , coords[1] ],\n//\t\t\t\t\t\tzoom: 8,\n//\t\t\t\t\t\tduration: 1000\n//\t\t\t\t\t});\n\n\t\t\t\t\tvar pixel = map.getPixelFromCoordinate(coords);\n\n\n\t\t\t\tunselectPreviousFeaturesPointClick();\n\n\t\t\t\tvar feature = map.forEachFeatureAtPixel(pixel, function(feature, layer) {\n\t\t\t feature.setStyle([\n\t\t\t // selectedStyle\n\t\t\t\t\t iconStyle_selected\n\t\t\t ]);\n\n\t\t\t selectedFeatures.push(feature);\n\t\t\t\t }, {\n\t\t\t hitTolerance: 1\n\t\t\t });\n\n\t\t\t\t\tvar resultsheader = \"\";\n\t\t\t\n\t\t\t\t\tif (selectedFeatures.length == 1)\n\t\t\t\t resultsheader += '<p style=\"text-transform:uppercase;\"><strong>1 photo of ' + selectedFeatures[0].get(\"Location\") + '</strong><br>(click to view)</p>' +\n\t\t\t\t '<div class = \"\"></div>';\n\t\t\t\t\telse if (selectedFeatures.length > 1)\n\t\t\t\n\t\t\t\t resultsheader += '<p style=\"text-transform:uppercase;\"><strong>' + selectedFeatures.length + ' photos of ' + selectedFeatures[0].get(\"Location\") + '</strong><br>(click to view)</p>' +\n\t\t\t\t\t'<div class = \"\"></div>';\n\t\t\t\n\t\t\t\t setResultsheader(resultsheader);\n\n\n\n\t\t\t\t\tvar results = \"\";\n\t\t\t var k;\n\t\t\t for(k=0; k< selectedFeatures.length; k++) {\n\n\n\t\t\t\t\tresults += '<div id=\"' + selectedFeatures[k].get(\"Image\") + '\" class=\"resultslist\" data-layerid=\"' + selectedFeatures[k].get(\"Image\") + \n\t\t\t\t\t'\" ><strong>Location: ' + selectedFeatures[k].get(\"Location\") + '</strong><a class=\"\" href=\"../images/' + selectedFeatures[k].get(\"Image\") + '.jpg\" data-fancybox=\"gallery\" data-caption=\"' + selectedFeatures[k].get(\"Caption\") + '\"><img src=\"../images/' + selectedFeatures[k].get(\"Image\") + '-thumb.jpg\" alt=\"' + selectedFeatures[k].get(\"Caption\") + '\" width=\"300\"></a><p>' + \n\t\t\t\t\tselectedFeatures[k].get(\"Caption\") + '</p></div>';\n\n\t\t\t\t\tresults += '<div class = \"\"></div>';\n\t\t\t }\n\n\t\t\t\t\tinfo.innerHTML = results;\n\t\t\t\t\n\t\t\t\t } else {\n\n\t\t\t\t\tvar resultsheader = \"\";\n\t\t\t\t\tresultsheader += '';\n\t\t\t\t setResultsheader(resultsheader);\n\t\t\t\t info.innerHTML = 'No photos selected - please click on a blue marker to view photos.';\n\t\t\t\t }\n\n\t}", "static find(id, cb){\n db.get('SELECT * FROM artwork WHERE id=?', id, cb);\n }", "function getImg (directory, name) {\n //if image is not found then create a packet to send back with not found\n if (resType == 0) {\n imgContent = Buffer.alloc(1);\n ITPpacket.init(ITPVer, resType, seqNo, timeStamp, 0, imgContent);\n packet = ITPpacket.getPacket();\n sock.write(packet);\n } else {\n // searching the image directory for the specific image\n fs.readFile(directory + '\\\\' + name, (err, content) => {\n if (err) {\n throw err;\n } else {\n //returning the packet which now includes the image\n imgSize = content.length;\n imgContent = content;\n ITPpacket.init(ITPVer, resType, seqNo, timeStamp, imgSize, imgContent);\n packet = ITPpacket.getPacket();\n sock.write(packet);\n }\n });\n }\n }", "static get(name, id, state, opts) {\n return new Image(name, state, Object.assign(Object.assign({}, opts), { id: id }));\n }", "function getImagesLinkHTML(id) {\n return '<a href=\"gallery.html?id=' + id + '\">View images</a>';\n}", "function showPhotos(id) {\n\turl = \"showPhotos.php?id=\" + id;\n\tdoAjaxCall(url, \"updateMain\", \"GET\", true);\n}", "function tswImageCarouselGetForId(id)\n{\n\tvar imageScroll = tswImageCarouselMap[id];\n\tif(imageScroll == null)\n\t{\n\t\timageScroll = new TSWImageCarousel(id);\n\t\ttswImageCarouselMap[id] = imageScroll;\n\t}\n\treturn imageScroll;\n}", "getImg() {\n axios.get('/api/getPicture/' + this.state.profilePictureID.imgData)\n .then((res) => {\n this.setState({\n profilePicture: res.data.data\n });\n }, (error) => {\n console.error(\"Could not get uploaded profile image from database (API call error) \" + error);\n });\n }", "function showOriginalImage(id) {\r\n var photo = images[id];\r\n document.getElementById(\"image-title\").innerHTML = photo.title;\r\n document.getElementById(\"image-content\").innerHTML =\r\n '<img src=\"https://farm' +\r\n photo.farm +\r\n '.staticflickr.com/' +\r\n photo.server +\r\n '/' +\r\n photo.id +\r\n '_' +\r\n photo.secret +\r\n '_z.jpg' +\r\n '\" alt=\"' +\r\n photo.title +\r\n '\"/>';\r\n document.getElementById(\"image\").className += \" visible\";\r\n}", "function getBreed(breed_id) {\n ajax_get('https://api.thedogapi.com/v1/images/search?include_breed=1&breed_id=' + breed_id, function(data) {\n displayData(data[0])\n });\n}", "function getDogImage(chosenBreed) {\n let dogURL=`https://dog.ceo/api/breed/${chosenBreed}/images/random`;\n fetch(dogURL)\n .then(response => response.json())\n .then(responseJson => displayImage(responseJson, chosenBreed))\n .catch(error=>alert('Something is not working, please try again in a bit.'));\n }", "function getImage(bool, ID) {\n\tvar image = document.getElementById(\"image\" + ID);\n\tif (image == null) {\n\t\timage = new Image(15, 15);\n\t\timage.id = \"image\" + ID;\n\t}\n\timage.src = bool ? './style/correct.png' : './style/wrong.png';\n\treturn image;\n}", "show(req, res) {\n Image.findById(req.params.id, {})\n .then(function (author) {\n res.status(200).json(author);\n })\n .catch(function (error){\n res.status(500).json(error);\n });\n }", "function getImage(number)\n{\n\t//request the pokedex data for a particular pokedex entry number\n\tvar xhr = new XMLHttpRequest();\n\txhr.open(\"GET\", \"http://pokeapi.co/api/v1/pokemon/\" + number + \"/\", false);\n\txhr.send();\t\n\t\n\t//extract the url for the array of urls for a pokemon's sprites\n\t//select first entry in array and request for the sprite data\n\tvar imguri = \"http://pokeapi.co\" + JSON.parse(xhr.response).sprites[0].resource_uri;\n\txhr.open(\"GET\", imguri, false);\t\n\txhr.send();\n\t\n\t//extract the url of the sprite image file\n\timg = \"http://pokeapi.co\" + JSON.parse(xhr.response).image\n\treturn img;\n}", "function getDogImage(dogNum) {\n fetch(`https://dog.ceo/api/breeds/image/random/${dogNum}`)\n .then(response => response.json())\n .then(responseJson => console.log(responseJson))\n .catch(error => alert('Something went wrong. Try again later.'));\n}", "function getDogImage(dogNum) {\n fetch(`https://dog.ceo/api/breeds/image/random/${dogNum}`)\n .then(response => response.json())\n .then(responseJson => displayImages(responseJson))\n .catch(error => alert('Something went wrong. Try again later.'));\n}", "getGalleryAvatarPict(uid) {\n let j = this.jQuery;\n let prefUrl = 'https://sonic-world.ru/files/public/avatars/av';\n if (uid == undefined) return false;\n j.ajax({\n url: prefUrl + uid +'.jpg',\n type:'HEAD',\n error:\n function(){\n j.ajax({\n url: prefUrl + uid +'.png',\n type:'HEAD',\n error:\n function(){\n j.ajax({\n url: prefUrl + uid +'.gif',\n type:'HEAD',\n error:\n function(){\n j('.sw_gallery_avatar_'+ uid)\n .css('background-color', '#E0E0E0');\n },\n success:\n function(){\n j('.sw_gallery_avatar_'+ uid)\n .css('background-image', 'url(../files/public/avatars/av'+ uid +'.gif)');\n }\n });\n },\n success:\n function(){\n j('.sw_gallery_avatar_'+ uid)\n .css('background-image', 'url(../files/public/avatars/av'+ uid +'.png)');\n }\n });\n },\n success:\n function(){\n j('.sw_gallery_avatar_'+ uid)\n .css('background-image', 'url(../files/public/avatars/av'+ uid +'.jpg)');\n }\n });\n }", "static getDog(id) {\n return $.get(`${this.url}/${id}`);\n }", "get(id) {\n\n }", "async function getFile(id) {\n var file = await db.readDataPromise('file', { id: id })\n return file[0];\n}", "function loadThumbnail(id){\n return '<img class=\"youtube-thumb\" src=\"//i.ytimg.com/vi/' + id + '/hqdefault.jpg\"><div class=\"play-button\"></div>';\n }", "function getImageUrl(nodeId) {\n const endpoint = `https://api.figma.com/v1/images/${FIGMA_FILE_KEY}`;\n\n const url = new URL(endpoint);\n const params = url.searchParams;\n\n params.set('ids', nodeId);\n params.set('scale', '4');\n params.set('format', 'png');\n\n return fetch(url, {\n method: 'GET',\n headers: {\n 'X-Figma-Token': FIGMA_API_KEY\n }\n })\n .then(res => res.json())\n .then(data => data.images[nodeId]);\n}", "getAlbumById(id) {\n let album = this.collectAlbums().find((a)=>a.id===id) ;\n return this.returnIfExists(album, \"album\");\n }", "function loadPictureFromParamsMiddleware(req, res, next) {\n\n const pictureId = req.params.id;\n if (!ObjectId.isValid(pictureId)) {\n return pictureNotFound(res, pictureId);\n }\n\n let query = Picture.findById(pictureId)\n\n query.exec(function (err, picture) {\n if (err) {\n return next(err);\n } else if (!picture) {\n return pictureNotFound(res, pictureId);\n }\n\n req.picture = picture;\n next();\n });\n}", "function getPhotoURL(id, farm, server, secret, size) {\n if(!size) size = '';\n else size = '_' + size;\n return 'https://farm' + farm + '.staticflickr.com/' + server + '/' + id + '_' + secret + size + '.jpg';\n}", "function randomDog(){\n let dogPic = document.getElementById(\"dogPic\")\n\n fetch(\"https://dog.ceo/api/breeds/image/random\")\n .then((response) => {return response.json()})\n .then((json) => {\n console.log(`Status Dag API fetch: ${json.status}`);\n let imageUrl = json.message\n dogPic.src = imageUrl\n })\n .catch((error) => console.log(`ERROR: ${error}`))\n}", "function selectimage(id){\n\tif (selectedimage == undefined) {\n\t\t//geeft witte border aan de speler\n\t\tdocument.getElementById(id).classList.add(\"borders\");\n\t\tselectedimage = id;\n\t\tcheckimage = document.getElementById(id).src;\n\t}else{\n\t\t//removes border when another player or name is selected\n\t\tdocument.getElementById(selectedimage).classList.remove(\"borders\");\n\t\tdocument.getElementById(id).classList.add(\"borders\");\n\t\tselectedimage = id;\n\t\tcheckimage = document.getElementById(id).src;\n\t}\n\tcheckimage = checkimage.substring(checkimage.indexOf(\"img\"));\n\tconsole.log(checkimage);\n\tcheckMatch();\n}", "function getDogImage(breed) {\n fetch(`https://dog.ceo/api/breed/${breed}/images/random`)\n .then(response => response.json())\n .then(responseJson => \n displayResults(responseJson))\n .catch(error => alert('Sorry, no luck! Try a different breed!'));\n}", "function getDogImage(dogImg) {\n fetch(`https://dog.ceo/api/breeds/image/random/${dogImg}`)\n .then(response => response.json())\n .then(responseJson => displayResults(responseJson))\n .catch(error => {\n alert('Something went wrong. Try again later.')\n console.log(error);\n });\n}", "function getProfilePicture(userID) {\n try {\n\n var fileNames = fs.readdirSync(`${__dirname}/../ProfilePictures/`)\n var available;\n fileNames.forEach(file => {\n if (file == `${userID}.png`) { available = true }\n })\n\n if (available) {\n var img = fs.readFileSync(`${__dirname}/../ProfilePictures/${userID}.png`)\n var base64 = Buffer.from(img).toString('base64');\n base64 = 'data:image/png;base64,' + base64;\n return base64;\n }\n } catch (error) {\n console.error(error.stack);\n }\n}", "function getImg(){\n\tvar url1 = window.location.search.substring(1);\n\tvar args = url1.split(\"=\");\n\timgSrc = args[1];\n\tvar div = document.getElementById('photoDiv');\n\tdiv.innerHTML = \"<img src=images/\" + imgSrc + \".PNG style=\\\"max-height:800px; max-width:800px\\\">\";\n}", "function viewImage(id,path_image) {\n var address='<img src={}>';\n document.getElementById(id).innerHTML=address.replace(\"{}\",path_image);\n}", "function pictureNotFound(res, pictureId) {\n return res.status(404).type('text').send(`No picture found with ID ${pictureId}`);\n}", "function findImage(){\n return db('images');\n}", "render() {\n const that = this;\n\n const id = this.props.data;\n const picture = aBadHackForData.data.get(id, Map());\n const file = picture.get('file');\n const album = picture.get('album');\n const location = consts.PICTURE_PATH + album + '/' + file;\n return <div>\n <img src={location} alt={file} style={style} onClick={that._openModel}/>\n <ModalPicture picture={picture}\n albums={aBadHackForData.albums}\n data={aBadHackForData.data}\n isOpen={that.state.modalIsOpen}\n setOpen={that._setModalOpen}/>\n </div>;\n }", "function di20(id, newSrc) {\n var theImage = FWFindImage(document, id, 0);\n if (theImage) {\n theImage.src = newSrc;\n }\n}", "function load_image(){\n\tvar url_string = window.location.href\n\tvar url = new URL(url_string);\n\tvar nasa_id = url.searchParams.get(\"nasa_id\");\n\t\n\tvar query = \"https://images-api.nasa.gov/asset/\" + nasa_id;\n\tvar result = httpGetAsync(query, large_image);\n}" ]
[ "0.7613639", "0.7359118", "0.7139366", "0.70564103", "0.702378", "0.695637", "0.6928418", "0.6888502", "0.68387246", "0.6810745", "0.6776196", "0.67119944", "0.6700618", "0.66877294", "0.66669065", "0.66419965", "0.6623405", "0.6592644", "0.6559659", "0.6551724", "0.65137815", "0.6497332", "0.6447384", "0.64382", "0.6414942", "0.6393054", "0.6379204", "0.6349136", "0.63449615", "0.6344371", "0.63421404", "0.6304874", "0.62957966", "0.62885517", "0.62392396", "0.62370956", "0.6226309", "0.6218502", "0.61909926", "0.61896324", "0.6158477", "0.6155756", "0.6136794", "0.6111973", "0.60879713", "0.60853094", "0.6085235", "0.6082403", "0.60800594", "0.6074827", "0.6070056", "0.6062326", "0.6059198", "0.60544044", "0.605375", "0.60524315", "0.60411435", "0.60406363", "0.6023343", "0.6008601", "0.59973645", "0.59955835", "0.5967051", "0.5965038", "0.5957067", "0.594674", "0.5946583", "0.5946559", "0.5942987", "0.593225", "0.5921799", "0.58892155", "0.58882564", "0.58821917", "0.58810705", "0.5878855", "0.5875882", "0.586497", "0.5839467", "0.58268404", "0.58226806", "0.58150375", "0.5813916", "0.5808222", "0.5804976", "0.58014315", "0.5801407", "0.5798375", "0.5795812", "0.5789165", "0.5786287", "0.5784891", "0.5779112", "0.5773944", "0.57693666", "0.5758528", "0.57573247", "0.57538605", "0.5734942", "0.57335097" ]
0.5866057
77
Build a list of configuration (custom launcher names).
function buildConfiguration(type, target) { const targetBrowsers = Object.keys(browserConfig) .map(browserName => [browserName, browserConfig[browserName][type]]) .filter(([, config]) => config.target === target) .map(([browserName]) => browserName); // For browsers that run locally, the browser name shouldn't be prefixed with the target // platform. We only prefix the external platforms in order to distinguish between // local and remote browsers in our "customLaunchers" for Karma. if (target === 'local') { return targetBrowsers; } return targetBrowsers.map(browserName => { return `${target.toUpperCase()}_${browserName.toUpperCase()}`; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static Configurators() {\n const customizeNothing = []; // no customization steps\n return [ customizeNothing ];\n }", "function updateArgProcessorList() {\n var argProcessorList = new commandLineUtils.ArgProcessorList();\n\n // App type\n addProcessorFor(argProcessorList, 'apptype', 'Enter your application type (native, hybrid_remote, or hybrid_local):', 'App type must be native, hybrid_remote, or hybrid_local.', \n function(val) { return ['native', 'hybrid_remote', 'hybrid_local'].indexOf(val) >= 0; });\n\n // App name\n addProcessorFor(argProcessorList, 'appname', 'Enter your application name:', 'Invalid value for application name: \\'$val\\'.', /^\\S+$/);\n\n // Output dir\n addProcessorForOptional(argProcessorList, 'outputdir', 'Enter the output directory for your app (defaults to the current directory):');\n return argProcessorList;\n}", "configLocator (options = {}) {\n let goinstallation = atom.config.get('go-config.goinstallation')\n let stat = this.statishSync(goinstallation)\n if (isTruthy(stat)) {\n let d = goinstallation\n if (stat.isFile()) {\n d = path.dirname(goinstallation)\n }\n return this.findExecutablesInPath(d, this.executables, options)\n }\n\n return []\n }", "function configureRuntime () {\n return (\n build()\n // Brand is used for default config files (if any).\n .brand(BRAND)\n // The default plugin is the directory we're in right now, so\n // the commands sub-directory will contain the first right of\n // refusal to handle user's requests.\n .loadDefault(__dirname)\n // TODO: maybe there's other places you'd like to load plugins from?\n // .load(`~/.${BRAND}`)\n\n // These are the magic tokens found inside command js sources\n // which plugin authors use to specify the command users can type\n // as well as the help they see.\n .token('commandName', `${BRAND}Command`)\n .token('commandDescription', `${BRAND}Description`)\n // let's build it\n .createRuntime()\n )\n}", "generateLaunchAgentPlist() {\n const programArguments = ['/usr/local/bin/gsts']\n\n for (let [key, value] of Object.entries(this.args)) {\n if (key.includes('daemon') || value === undefined) {\n continue;\n }\n\n programArguments.push(`--${key}${typeof value === 'boolean' ? '' : `=${value}`}`);\n }\n\n const payload = {\n Label: PROJECT_NAMESPACE,\n EnvironmentVariables: {\n PATH: '/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin'\n },\n RunAtLoad: true,\n StartInterval: 600,\n StandardErrorPath: this.args['daemon-out-log-path'],\n StandardOutPath: this.args['daemon-error-log-path'],\n ProgramArguments: programArguments\n };\n\n return plist.build(payload);\n }", "get miniConfig() {\n return [\n {\n type: \"button-group\",\n buttons: [\n this.boldButton,\n this.italicButton,\n this.removeFormatButton,\n ],\n },\n this.linkButtonGroup,\n this.scriptButtonGroup,\n {\n type: \"button-group\",\n buttons: [this.orderedListButton, this.unorderedListButton],\n },\n ];\n }", "processConfig() {\n /** merge type for arrays */\n const action = actions.importConfig(this.config);\n this.store.dispatch(action);\n const { config: storedConfig } = this.store.getState();\n\n storedConfig.windows.forEach((miradorWindow, layoutOrder) => {\n const windowId = `window-${uuid()}`;\n const manifestId = miradorWindow.manifestId || miradorWindow.loadedManifest;\n\n this.store.dispatch(actions.addWindow({\n // these are default values ...\n id: windowId,\n layoutOrder,\n manifestId,\n thumbnailNavigationPosition: storedConfig.thumbnailNavigation.defaultPosition,\n // ... overridden by values from the window configuration ...\n ...miradorWindow,\n }));\n });\n }", "list() {\n let config = this.readSteamerConfig();\n\n for (let key in config) {\n if (config.hasOwnProperty(key)) {\n this.info(key + '=' + config[key] || '');\n }\n }\n\n }", "_splitConfig() {\n const res = [];\n if (typeof (this.options.targetXPath) !== 'undefined') {\n // everything revolves around an xpath\n if (Array.isArray(this.options.targetXPath)) {\n // group up custom classes according to index\n const groupedCustomClasses = this._groupCustomClasses();\n // need to ensure it's array and not string so that code doesnt mistakenly separate chars\n const renderToPathIsArray = Array.isArray(this.options.renderToPath);\n // a group should revolve around targetXPath\n // break up the array, starting from the first element\n this.options.targetXPath.forEach((xpath, inner) => {\n // deep clone as config may have nested objects\n const config = cloneDeep(this.options);\n // overwrite targetXPath\n config.targetXPath = xpath;\n // sync up renderToPath array\n if (renderToPathIsArray && typeof (this.options.renderToPath[inner]) !== 'undefined') {\n config.renderToPath = this.options.renderToPath[inner] ? this.options.renderToPath[inner] : null;\n } else {\n // by default, below parent of target\n config.renderToPath = '..';\n }\n // sync up relatedElementActions array\n if (this.options.relatedElementActions\n && typeof (this.options.relatedElementActions[inner]) !== 'undefined'\n && Array.isArray(this.options.relatedElementActions[inner])) {\n config.relatedElementActions = this.options.relatedElementActions[inner];\n }\n // sync up customClasses\n if (typeof (groupedCustomClasses[inner]) !== 'undefined') {\n config.customClasses = groupedCustomClasses[inner];\n }\n // duplicate ignoredPriceElements string / array if exists\n if (this.options.ignoredPriceElements) {\n config.ignoredPriceElements = this.options.ignoredPriceElements;\n }\n // that's all, append\n res.push(config);\n });\n } else {\n // must be a single string\n res.push(this.options);\n }\n }\n return res;\n }", "getActiveConfigurations() {\n return __awaiter(this, void 0, void 0, function* () {\n return yield Gestalt_1.Gestalt.get(`/bots/${this.bot.id}/clients/${this.type}`);\n });\n }", "function loadConfigs() {\n if (allthings.configs !== null) {\n for (let i = 0; i < allthings.configs.length; i++) {\n let opt = `Team:${allthings.configs[i].team} Name:${\n\tallthings.configs[i].name\n }`;\n var el = document.createElement(\"option\");\n el.name = opt;\n el.textContent = opt;\n el.value = opt;\n document.getElementById(\"selectConfig\").appendChild(el);\n }\n }\n}", "generateConfigs() {\n this._createDirs();\n this._readFiles(this.source)\n .then(files => {\n console.log('Loaded ', files.length, ' files');\n const configs = this._loadConfigs(files);\n const common = this._getCommonJson(configs);\n\n this._writeData(common, 'default', 'json');\n this._generateFilesWithoutCommon(configs, common);\n this._generateCustomEnvironmentVariablesJson();\n })\n .catch(error => console.log(error));\n }", "getEntries(configurationFiles) {\n let entries = [];\n try {\n if (!configurationFiles['angular-config'].generated) {\n const { parsed } = configurationFiles['angular-config'];\n entries = entries.concat(getAngularJSONEntries(parsed));\n } else {\n const { parsed } = configurationFiles['angular-cli'];\n entries = entries.concat(getAngularCLIEntries(parsed));\n }\n } catch (e) {\n console.warn(\n `${configurationFiles['angular-config'].path} is malformed: ${e.message}`\n );\n }\n if (\n configurationFiles.package.parsed &&\n configurationFiles.package.parsed.main\n ) {\n entries.push(path_1.absolute(configurationFiles.package.parsed.main));\n }\n entries.push('/src/main.ts');\n entries.push('/main.ts');\n return entries;\n }", "function configureEntries (entryBase) {\n return function (entries, dir) {\n var app = path.basename(dir);\n var targets = glob.sync(dir + \"/**/target.js\");\n\n targets.forEach(function(target) {\n var targetName = path.basename(path.dirname(target));\n entries[app + \"__\" + targetName] = entryBase.slice().concat([target]);\n });\n\n return entries;\n }\n}", "function createConfiguration() {\r\n switch (selected_layout_id) {\r\n case CONFIGS.ONE_DEVICE:\r\n _configManager.setConfig('test-1d', 'test-1d', 'bob', 'dev', 1, 1, device_array.slice(0));\r\n break;\r\n case CONFIGS.TWO_DEVICES_1:\r\n _configManager.setConfig('test-2d1', 'test-2d', 'bob', 'dev', 2, 1, device_array.slice(0));\r\n break;\r\n case CONFIGS.TWO_DEVICES_2:\r\n _configManager.setConfig('test-2d2', 'test-2d2', 'bob', 'dev', 1, 2, device_array.slice(0));\r\n break;\r\n case CONFIGS.THREE_DEVICES_3:\r\n _configManager.setConfig('test-3d1', 'test-3d1', 'bob', 'dev', 3, 1, device_array.slice(0));\r\n break;\r\n case CONFIGS.THREE_DEVICES_4:\r\n _configManager.setConfig('test-3d2', 'test-3d2', 'bob', 'dev', 1, 3, device_array.slice(0));\r\n break;\r\n case CONFIGS.FOUR_DEVICES_5:\r\n _configManager.setConfig('test-4d1', 'test-4d1', 'bob', 'dev', 2, 2, device_array.slice(0));\r\n break;\r\n case CONFIGS.FOUR_DEVICES_6:\r\n _configManager.setConfig('test-4d2', 'test-4d2', 'bob', 'dev', 4, 1, device_array.slice(0));\r\n break;\r\n case CONFIGS.FIVE_DEVICES_7:\r\n _configManager.setConfig('test-5d', 'test-5d', 'bob', 'dev', 3, 2, device_array.slice(0));\r\n break;\r\n case CONFIGS.SIX_DEVICES_8:\r\n _configManager.setConfig('test-6d', 'test-6d', 'bob', 'dev', 3, 2, device_array.slice(0));\r\n break;\r\n }\r\n }", "function listAllConfigs() {\n\n\t// list the title\n\tconsole.log( \"Available .gitconfig files:\\n\" );\n\n\t// return the symbolic link value\n\tfs.readlink( GITCONFIG, ( err, linkString ) => {\n\n\t\t// get the symbolic link value\n\t\t// -- returns the actual file name\n\t\tlinkString = linkString && path.basename( linkString );\n\n\t\t// read the contents of the directory\n\t\tfs.readdirSync( GITCONFIGS ).forEach( ( configurations ) => {\n\t\t\tif( configurations[ 0 ] !== '.' ) {\n\n\t\t\t\t// list the file names\n\t\t\t\t// -- if the active config mark it\n\t\t\t\tconsole.log(\n\t\t\t\t\t' %s %s',\n\t\t\t\t\tlinkString == configurations ? '>' : ' ',\n\t\t\t\t\tconfigurations\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t});\n}", "function LoadConfig(){\n var cfg = fs.readFileSync(path.join(app.getPath('userData'), '../../Local/Crashday/config/launcher.config'))\n var colls = fs.readFileSync(path.join(app.getPath('userData'), '../../Local/Crashday/config/collections.config'), {flag: 'a+'})\n try{\n cfg = JSON.parse(cfg)\n } catch(e){\n cfg = {}\n }\n\n if(!cfg.hasOwnProperty('WorkshopItems'))\n cfg['WorkshopItems'] = []\n\n\n try{\n \tcolls = JSON.parse(colls)\n } catch(e){\n \tcolls = {}\n }\n\n if(!colls.hasOwnProperty('Collections'))\n colls['Collections'] = {}\n\n if(!colls.hasOwnProperty('CrashdayPath')){\n colls['CrashdayPath'] = ''\n }\n else{\n if(!fs.existsSync(colls['CrashdayPath'])) {\n colls['CrashdayPath'] = ''\n }\n }\n\n if(colls['CrashdayPath'] == '')\n $.toast({title: 'crashday.exe not found',\n content: 'Specify crashday.exe path in settings to enable auto scanning for newly subscribed mods. Otherwise default launcher has to be started after subscribing to new mods.',\n type: 'error', delay: 5000, container: $('#toaster')})\n\n //check for new mods in the workshop folder\n var p = path.join(colls['CrashdayPath'], '../../workshop/content/508980')\n var unlistedMods = 0\n var listedMods = 0\n var emptyFolders = 0\n var otherFiles = 0\n if(fs.existsSync(p)){\n fs.readdirSync(p).forEach(file => {\n var foundFile = false\n var name = parseInt(file, 10)\n //skip not numbered folder names\n if(name == NaN) {\n otherFiles++\n return\n }\n \n folder = fs.statSync(path.join(p, file))\n if(!folder.isDirectory()) {\n otherFiles++\n return\n }\n //check there is a mod file in mod folder\n files = fs.readdirSync(path.join(p, file))\n if(files.length == 0) {\n emptyFolders++\n return\n }\n\n for(n in cfg['WorkshopItems'])\n {\n if(cfg['WorkshopItems'][n][0] == name)\n {\n listedMods++\n foundFile = true\n }\n }\n if(!foundFile){\n cfg['WorkshopItems'].push([name, false])\n unlistedMods++\n }\n })\n }\n\n console.log(`Found ${listedMods} listed mods, ${unlistedMods} unlisted mods, ${emptyFolders} empty folders and ${otherFiles} other files in Workshop folder`)\n\n if(unlistedMods > 0){\n $.toast({title: 'New mods found',\n content: 'Launcher found and added ' + unlistedMods + ' new mods.',\n type: 'info', delay: 5000, container: $('#toaster')})\n }\n\n return [cfg, colls]\n}", "_setLabels () {\n const target = '\"labels\":[\"os=linux\"';\n const labels = this._opts.Labels;\n if (!labels || !labels.length) {\n return;\n }\n\n const labelsStr = labels\n .map(str => `\"${str}\"`)\n .join(',');\n\n let newLaunchConfig = this\n ._getLaunchConfigCode()\n .map(str => {\n if (!(typeof str === 'string' || str instanceof String)) {\n return str\n }\n\n if (str.indexOf(target) == -1) {\n return str\n }\n\n return str.replace(target, `${target},${labelsStr}`)\n });\n\n this._setLaunchConfigCode(newLaunchConfig);\n }", "function makeConfig() {\n\tif (config)\n\t\tthrow new Error('Config can only be created once');\n\n\toptions = project.custom.webpack || {}\n\t_.defaultsDeep(options,defaultOptions);\n\n\tif (options.config) {\n\t\tconfig = options.config;\n\t} else {\n\t\tlet configPath = path.resolve(options.configPath);\n\t\tif (!fs.existsSync(configPath)) {\n\t\t\tthrow new Error(`Unable to location webpack config path ${configPath}`);\n\t\t}\n\n\t\tlog(`Making compiler with config path ${configPath}`);\n\t\tconfig = require(configPath);\n\n\t\tif (_.isFunction(config))\n\t\t\tconfig = config()\n\t}\n\n\n\tconfig.target = 'node';\n\n\t// Output config\n\toutputPath = path.resolve(process.cwd(),'target');\n\tif (!fs.existsSync(outputPath))\n\t\tmkdirp.sync(outputPath);\n\n\tconst output = config.output = config.output || {};\n\toutput.library = '[name]';\n\n\t// Ensure we have a valid output target\n\tif (!_.includes([CommonJS,CommonJS2],output.libraryTarget)) {\n\t\tconsole.warn('Webpack config library target is not in',[CommonJS,CommonJS2].join(','))\n\t\toutput.libraryTarget = CommonJS2\n\t}\n\n\t// Ref the target\n\tlibraryTarget = output.libraryTarget\n\n\toutput.filename = '[name].js';\n\toutput.path = outputPath;\n\n\tlog('Building entry list');\n\tconst entries = config.entry = {};\n\n\tconst functions = project.getAllFunctions();\n\tfunctions.forEach(fun => {\n\n\t\t// Runtime checks\n\t\t// No python or Java :'(\n\n\t\tif (!/node/.test(fun.runtime)) {\n\t\t\tlog(`${fun.name} is not a webpack function`);\n\t\t\treturn\n\t\t}\n\n\n\t\tconst handlerParts = fun.handler.split('/').pop().split('.');\n\t\tlet modulePath = fun.getRootPath(handlerParts[0]), baseModulePath = modulePath;\n\t\tif (!fs.existsSync(modulePath)) {\n\t\t\tfor (let ext of config.resolve.extensions) {\n\t\t\t\tmodulePath = `${baseModulePath}${ext}`;\n\t\t\t\tlog(`Checking: ${modulePath}`);\n\t\t\t\tif (fs.existsSync(modulePath))\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!fs.existsSync(modulePath))\n\t\t\tthrow new Error(`Failed to resolve entry with base path ${baseModulePath}`);\n\n\t\tconst handlerPath = require.resolve(modulePath);\n\n\t\tlog(`Adding entry ${fun.name} with path ${handlerPath}`);\n\t\tentries[fun.name] = handlerPath;\n\t});\n\n\tlog(`Final entry list ${Object.keys(config.entry).join(', ')}`);\n}", "function generateBuildConfig(){\n var jsBaseDir = './js';\n var lessBaseDir = './less';\n var fontsBaseDir= './fonts';\n\n var buildConfig = {\n jsBaseDir: jsBaseDir,\n fontsBaseDir: fontsBaseDir,\n fontsDestDir: './dist',\n jsDistDir: './dist',\n lessDistDir: './dist',\n lessBaseDir: lessBaseDir,\n //tell browserify to scan the js directory so we don't have to use relative paths when referencing modules (e.g. no ../components).\n paths:['./js'],\n //assume these extensions for require statements so we don't have to include in requires e.g. components/header vs components/header.jsx\n extensions:['.js'],\n\n //http://jshint.com/docs/options/\n jshintThese:[\n \"core/**/*\"\n ],\n jshint:{\n curly: true,\n strict: true,\n browserify: true\n },\n\n //http://lisperator.net/uglifyjs/codegen\n uglify:{\n mangle:true,\n output:{ //http://lisperator.net/uglifyjs/codegen\n beautify: false,\n quote_keys: true //this is needed because when unbundling/browser unpack, the defined modules need to be strings or we wont know what their names are.\n }\n //compress:false // we can refine if needed. http://lisperator.net/uglifyjs/compress\n }\n };\n\n\n return buildConfig;\n}", "getWebpackConfig() {\n // Now it can be a single compiler, or multicompiler\n // In any case, figure it out, create the compiler options\n // and return the stuff.\n // If the configuration is for multiple compiler mode\n // Then return an array of config.\n if (this.isMultiCompiler()) {\n // Return an array of configuration\n const config = [];\n this.projectConfig.files.forEach(file => {\n config.push(this.getSingleWebpackConfig(file));\n });\n return config;\n } // Otherwise, just return a single compiler mode config\n\n\n return this.getSingleWebpackConfig(this.projectConfig.files[0]);\n }", "function generateGulpResponsiveConfiguration(){\n\n // Loop the sizes array and create an object that fits the gulp-responsive reference\n var responsiveImages = sizes.map(function(item){\n var object = {\n width: item.width,\n rename: function(path) {\n path.dirname += `/${item.name}`;\n return path;\n }\n }\n if(item.height) {\n object.height = item.height;\n }\n return object;\n });\n\n // Loop the sizes array and create an object that fits the gulp-responsive reference\n // and is a retina version of the former\n var responsiveImages2x = sizes.map(function(item){\n var object = {\n width: item.width * 2,\n rename: function(path) {\n path.dirname += `/${item.name}`;\n path.basename += '@2x';\n return path;\n }\n }\n if(item.height) {\n object.height = item.height * 2;\n }\n return object;\n });\n \n return [ ...responsiveImages, ...responsiveImages2x ];\n}", "function createConfigList() {\n var hostUrl = decodeURIComponent(getQueryStringParameter(\"SPHostUrl\"));\n var currentcontext = new SP.ClientContext.get_current();\n var hostcontext = new SP.AppContextSite(currentcontext, hostUrl);\n var hostweb = hostcontext.get_web();\n\n //Set ListCreationInfomation()\n var listCreationInfo = new SP.ListCreationInformation();\n listCreationInfo.set_title('spConfig');\n listCreationInfo.set_templateType(SP.ListTemplateType.genericList);\n var newList = hostweb.get_lists().add(listCreationInfo);\n newList.set_hidden(true);\n newList.set_onQuickLaunch(false);\n newList.update();\n\n //Set column data\n var newListWithColumns = newList.get_fields().addFieldAsXml(\"<Field Type='Note' DisplayName='Value' Required='FALSE' EnforceUniqueValues='FALSE' NumLines='6' RichText='TRUE' RichTextMode='FullHtml' StaticName='Value' Name='Value'/>\", true, SP.AddFieldOptions.defaultValue);\n\n //final load/execute\n context.load(newListWithColumns);\n context.executeQueryAsync(function () {\n console.log('spConfig list created successfully!');\n },\n function (sender, args) {\n console.error(sender);\n console.error(args);\n alert('Failed to create the spConfig list. ' + args.get_message());\n });\n }", "createConfig() {\n return {\n facets: [{ key: 'main', fixedFactSheetType: 'Application' }],\n ui: {\n elements: createElements(this.settings),\n timeline: createTimeline(),\n update: (selection) => this.handleSelection(selection)\n }\n };\n }", "commonOptions() {\n let config = this.config;\n let cmd = [];\n\n if (config.datadir) {\n cmd.push(`--datadir=${config.datadir}`);\n }\n\n if (Number.isInteger(config.verbosity) && config.verbosity >= 0 && config.verbosity <= 5) {\n switch (config.verbosity) {\n case 0:\n cmd.push(\"--lvl=crit\");\n break;\n case 1:\n cmd.push(\"--lvl=error\");\n break;\n case 2:\n cmd.push(\"--lvl=warn\");\n break;\n case 3:\n cmd.push(\"--lvl=info\");\n break;\n case 4:\n cmd.push(\"--lvl=debug\");\n break;\n case 5:\n cmd.push(\"--lvl=trace\");\n break;\n default:\n cmd.push(\"--lvl=info\");\n break;\n }\n }\n\n return cmd;\n }", "static getExtraConfig () {\n return {}\n }", "function list(appName, callback) {\n var uri = format('/%s/apps/%s/config/', deis.version, appName);\n commons.get(uri, function onListResponse(err, result) {\n callback(err, result ? result.values : null);\n });\n }", "function get_config() {\n // This is a placeholder, obtaining values from command line options.\n // Subsequent developments may access a configuration file\n // and extract an initial default configuration from that.\n //\n // See also: https://nodejs.org/api/process.html#process_process_env\n if (program.debug) {\n meld.CONFIG.debug = program.debug;\n } \n if (program.verbose) {\n meld.CONFIG.verbose = program.verbose;\n } \n if (program.author) {\n meld.CONFIG.author = program.author;\n } \n if (program.baseurl) {\n meld.CONFIG.baseurl = program.baseurl;\n }\n if (program.stdinurl) {\n meld.CONFIG.stdinurl = program.stdinurl;\n }\n}", "function getConfiguration(stats) {\n\tconst production = [getProductionModules(stats)]\n\tconst fermenting = getFermentingModules(stats, production[0])\n\tconst addons = getAddonsModules(stats)\n\n\t// concatinating arrays\n\t// const all = production.concat(fermenting).concat(addons)\n\tconst all = (production.concat(fermenting)).concat(addons)\n\n\treturn { production, fermenting, addons, all }\n}", "getConfig() {\n // NOTE(cais): We override the return type of getConfig() to `any` here,\n // because the `Sequential` class is a special case among `Container`\n // subtypes in that its getConfig() method returns an Array (not a\n // dict).\n const layers = [];\n for (const layer of this.layers) {\n const dict = {};\n dict['className'] = layer.getClassName();\n dict['config'] = layer.getConfig();\n layers.push(dict);\n }\n return { name: this.name, layers };\n }", "function use_config() {\n var n = arguments.length;\n var name = make_name(arguments, n - 1);\n all_configs[name] = arguments[n - 1];\n if (audio_graph) {\n audio_graph.config(name.split('.'), all_configs[name]);\n }\n if (audio_ui) {\n audio_ui.config(name.split('.'), all_configs[name]);\n }\n}", "configure () {\n return Promise.all([\n lib.ProxyCart.configure(this.app),\n lib.ProxyCart.addPolicies(this.app),\n lib.ProxyCart.addRoutes(this.app),\n lib.ProxyCart.resolveGenerics(this.app),\n lib.ProxyCart.copyDefaults(this.app),\n lib.ProxyCart.addCrons(this.app),\n lib.ProxyCart.addEvents(this.app),\n lib.ProxyCart.addTasks(this.app)\n ])\n }", "function getDefaultConfig() {\n\tvar config = {};\n\t\n\tvar configZen = CSScomb.getConfig('zen');\n\t\n\t// Copy only sort-order data:\n\tconfig['sort-order'] = configZen['sort-order'];\n\t\n\t// If sort-order is separated into sections, add an empty section at top:\n\tif (config['sort-order'].length > 1) {\n\t\tconfig['sort-order'].unshift([]);\n\t}\n\t\n\t// Add sort-order info for SCSS, Sass and Less functions into the first section:\n\tconfig['sort-order'][0].unshift('$variable', '$include', '$import');\n\t\n\t// Add configuration that mimics most of the settings from Espresso:\n\tconfig['block-indent'] = tabString;\n\tconfig['strip-spaces'] = true;\n\tconfig['always-semicolon'] = true;\n\tconfig['vendor-prefix-align'] = true;\n\tconfig['unitless-zero'] = true;\n\tconfig['leading-zero'] = true;\n\tconfig['quotes'] = 'double';\n\tconfig['color-case'] = 'lower';\n\tconfig['color-shorthand'] = false;\n\tconfig['space-before-colon'] = '';\n\tconfig['space-after-colon'] = ' ';\n\tconfig['space-before-combinator'] = ' ';\n\tconfig['space-after-combinator'] = ' ';\n\tconfig['space-before-opening-brace'] = ' ';\n\tconfig['space-after-opening-brace'] = lineEndingString;\n\tconfig['space-before-closing-brace'] = lineEndingString;\n\tconfig['space-before-selector-delimiter'] = '';\n\tconfig['space-after-selector-delimiter'] = lineEndingString;\n\tconfig['space-between-declarations'] = lineEndingString;\n\t\n\treturn config;\n}", "get configs() {\n\t\treturn this._configs;\n\t}", "static get pluginConfig() {\n return {\n assign : ['collapseAll', 'expandAll', 'collapse', 'expand', 'expandTo', 'toggleCollapse'],\n before : ['navigateRight', 'navigateLeft'],\n chain : ['onElementClick', 'onElementKeyDown']\n };\n }", "getName() {\n return this.configs.name\n }", "function makeConfigurationChecklist(basePath, metaData) {\n\tvar deferred = Q.defer();\n\n\tvar content = utils.htmlHead(\"Configuration checklist\");\n\tcontent += utils.htmlHeader(\"Configuration checklist\", 1);\n\n\tvar tableData;\n\t//indicators\n\tif (metaData.indicators && metaData.indicators.length > 0) {\n\t\ttableData = [];\n\t\ttableData.push([\"Name\", \"Configured\"]);\n\n\t\tvar ind;\n\t\tfor (var i = 0; i < metaData.indicators.length; i++) {\n\t\t\tind = metaData.indicators[i];\n\n\t\t\ttableData.push([ind.name, \"▢\"]);\n\t\t}\n\n\t\tutils.htmlHeader(\"Indicators\", 2);\n\t\tcontent += utils.htmlTableFromArray(tableData, true, [85, 15], [\"left\", \"center\"]);\n\t}\n\n\t//category option group sets\n\tif (metaData.categoryOptionGroups && metaData.categoryOptionGroups.length > 0) {\n\t\ttableData = [];\n\t\ttableData.push([\"Name\", \"Configured\"]);\n\n\t\tvar cog;\n\t\tfor (var i = 0; i < metaData.categoryOptionGroups.length; i++) {\n\t\t\tcog = metaData.categoryOptionGroups[i];\n\n\t\t\ttableData.push([cog.name, \"▢\"]);\n\t\t}\n\n\t\tutils.htmlHeader(\"Category Option Groups, 2\");\n\t\tcontent += utils.htmlTableFromArray(tableData, true, [85, 15], [\"left\", \"center\"]);\n\t}\n\n\tcontent += utils.htmlTail();\n\tcontent = pretty(content);\n\n\tfs.writeFile(basePath + \"/configuration.html\", content, function (err) {\n\t\tif (err) {\n\t\t\tconsole.log(err);\n\t\t\tdeferred.resolve(false);\n\t\t}\n\n\t\tconsole.log(\"✔ Configuration checklist saved\");\n\t\tdeferred.resolve(true);\n\t});\n\n\treturn deferred.promise;\n}", "function getConfigs( args ){\n Y.log('Entering Y.doccirrus.api.incaseconfiguration.getConfigs', 'info', NAME);\n if (args.callback) {\n args.callback = require(`${ process.cwd() }/server/utils/logWrapping.js`)(Y, NAME)\n .wrapAndLogExitAsync(args.callback, 'Exiting Y.doccirrus.api.incaseconfiguration.getConfigs');\n }\n const\n { user, callback } = args,\n async = require( 'async' );\n async.series({\n inCaseConfig( next ){\n Y.doccirrus.api.incaseconfiguration.readConfig({\n user,\n checkPatientNumber: true,\n callback: next\n });\n },\n masterTabConfigs( next ){\n Y.doccirrus.mongodb.runDb({\n user,\n model: 'mastertabconfig',\n action: 'get',\n query: {},\n options: {\n sort: {\n _id: -1\n },\n limit: 2\n }\n }, next );\n }\n }, callback );\n }", "async getBuildList( paths, opts ) {\n return [];\n }", "static get pluginConfig() {\n return {\n chain: ['render', 'renderContents', 'onElementClick', 'onElementDblClick', 'onElementMouseOver', 'onElementMouseOut', 'onProjectRefresh'],\n assign: ['getElementForDependency', 'getElementsForDependency', 'getDependencyForElement']\n };\n }", "function getCronConfig() {\n return {\n daily: `${wakeUpMinute} ${wakeupHour} * * *`,\n weekly: {\n sun: `${wakeUpMinute} ${wakeupHour} * * sun`,\n mon: `${wakeUpMinute} ${wakeupHour} * * mon`,\n tue: `${wakeUpMinute} ${wakeupHour} * * tue`,\n wed: `${wakeUpMinute} ${wakeupHour} * * wed`,\n thu: `${wakeUpMinute} ${wakeupHour} * * thu`,\n fri: `${wakeUpMinute} ${wakeupHour} * * fri`,\n sat: `${wakeUpMinute} ${wakeupHour} * * sat`,\n },\n makeDaily: makeDaily,\n makeWeekly: makeWeekly,\n makeMonthly: makeMonthly\n }\n}", "function Config () {\n let obj\n\n this._entriesApp = [] // storage for App config\n this._entries = [] // storage for Module configs\n this._entriesRefs = {} // references per dirname to storage items\n\n this.env = envVar.setup() // environment vars\n this.baseNames = utils.baseNames(this.env) // allowed basenames in right order\n this.extNames = File().extNames() // parseable extension\n\n // envVar.delvars() // FIXME - can cause trouble when not used as peerDependency\n // utils.setSuppressWarnings(this.env)\n\n /// add config from NODE_CONFIG\n this.addAppEntry(utils.parseNodeConfig(this.env))\n\n if (this.env.NODE_CONFIG_DIR) {\n obj = this.loadFiles(\n utils.normDir(this.env.NODE_CONFIG_DIR),\n undefined,\n this.env.NODE_CONFIG_STRICT_MODE\n )\n }\n // add config from NODE_CONFIG_DIR\n this.addAppEntry(obj)\n}", "function list(confDirs = default_confdirs) {\n return Promise.all(confDirs.map(function(dir){\n return readdir(dir,\"^mimeapps.list$\");\n })).then(function (contents) {\n var obj = {};\n contents.forEach(function(file){\n if(!file||!(file = file[\"mimeapps.list\"])||!(file = file[\"Default Applications\"])){\n return;\n }\n Object.keys(file).forEach(function(key){\n if(!obj[key]){\n obj[key] = [];\n }\n obj[key].push( file[key]);\n });\n });\n return obj;\n });\n}", "function loadConfigs (script) {\n var crawlerId = script.split('/').reverse()[0].replace('.js', '')\n\n var configs\n var scriptObj = require(path.join(projectRootDir, script))\n if (scriptObj.configs && scriptObj.configs.constructor === Array) {\n configs = scriptObj.configs\n } else if (scriptObj.config && scriptObj.config.constructor === Object) {\n configs = [scriptObj.config]\n } else if (Object.keys(scriptObj).filter((key) => key.match(/^cinema/)).length > 0) {\n configs = [scriptObj]\n } else {\n throw new Error(`no config found in ${script}`)\n }\n\n configs.forEach((config) => {\n config.crawler = config.crawler || {}\n config.crawler.id = crawlerId\n })\n\n return configs\n}", "function configForEnv(env) {\n if (!['dev', 'prod', 'watch'].includes(env)) {\n return [{}]\n }\n\n const configs = ['base', env].reduce(\n (list, confName) => {\n const userConf = configForName(confName)\n if (userConf) {\n return list.concat(userConf)\n }\n return list\n },\n []\n )\n\n return configs\n}", "function buildAppConfiguration({\n auth,\n broker,\n cache,\n system,\n telemetry\n}) {\n const systemOptions = {\n ...DEFAULT_SYSTEM_OPTIONS,\n networkClient: new HttpClient(system == null ? void 0 : system.proxyUrl, system == null ? void 0 : system.customAgentOptions),\n loggerOptions: (system == null ? void 0 : system.loggerOptions) || DEFAULT_LOGGER_OPTIONS\n };\n return {\n auth: {\n ...DEFAULT_AUTH_OPTIONS,\n ...auth\n },\n broker: {\n ...broker\n },\n cache: {\n ...DEFAULT_CACHE_OPTIONS,\n ...cache\n },\n system: {\n ...systemOptions,\n ...system\n },\n telemetry: {\n ...DEFAULT_TELEMETRY_OPTIONS,\n ...telemetry\n }\n };\n}", "function GetComposerOptions() {\n InitializeWorklist();\n var output = '';\n var longname;\n var abbr;\n var i;\n\n for (i=0; i<WORKLIST.length; i++) {\n longname = WORKLIST[i].comlong;\n shortname = WORKLIST[i].comshort;\n abbr = WORKLIST[i].repid;\n output += '<option value=\"' + abbr + '\">';\n // output += longname + '</option>\\n';\n output += shortname + '</option>\\n';\n if (abbr == 'Jos') {\n output += '<option value=\"Joa\">Josquin (secure)</option>\\n';\n output += '<option value=\"Job\">';\n output += 'Josquin&nbsp;';\n output += '(not&nbsp;secure)</option>\\n';\n }\n }\n return output;\n}", "function createComponentsFromConfig() {\n let config = require(configPath);\n if (config.theme === \"\") {\n for (let i = 0; i < config.components.length; i++) {\n let component = createComponent(\n config.components[i].name,\n config.components[i].theme\n );\n writeComponent(component);\n }\n\n console.log(\"Finished generating components\");\n\n return;\n }\n\n createComponentFromGlobalTheme(config.theme);\n}", "function config() {\n for (var i = 0; i < keys.length; i++) {\n var line = keys[i] + ' = ' + process.env[keys[i]] + '\\n';\n debug('added %s to config.ini', line);\n fs.appendFileSync('config.ini', line);\n }\n}", "_copyLaunchConfig () {\n let nodeAsg = objectExtend(\n {},this._template.Resources[`NodeLaunchConfig${this._versionString}`]);\n\n this._template.Resources[`${this._opts.Name}WorkerLaunchConfig${this._versionString}`] = nodeAsg;\n }", "function genConfig(PATH_UIKITS){\n console.log(\"genUikitsConfig\")\n let file_global_components = PATH_UIKITS +'/components.js'\n let file_global_annotations = PATH_UIKITS + '/annotations.js'\n let global_components_import = '//auto create components.js\\n'\n let global_annotations_improt = '//auto create annotations.js\\n'\n let global_text = 'export default {\\n'\n let files = fs.readdirSync(PATH_UIKITS)\n for (let i = 0; i < files.length; i++) {\n let name = files[i]\n let abPath = path.join(PATH_UIKITS, name)\n let stat = fs.lstatSync(abPath)\n if (!stat.isDirectory()) continue\n abPath = path.join(PATH_UIKITS, name, 'packages')\n if (!fs.existsSync(abPath)) continue\n stat = fs.lstatSync(abPath)\n if (stat.isDirectory()) {\n scan_kit(path.join(PATH_UIKITS, name))\n global_components_import += `import _${name.replace(/-/g,'_')} from './${name}/packages/components';\\n`\n global_annotations_improt += `import _${name.replace(/-/g,'_')} from './${name}/packages/annotations';\\n`\n global_text += ` ${name}: _${name.replace(/-/g,'_')},\\n`\n }\n }\n global_text += '}\\n'\n writeJavascript(file_global_components,global_components_import+global_text)\n writeJavascript(file_global_annotations,global_annotations_improt+global_text)\n}", "static get pluginConfig() {\n return {\n assign: ['collapseAll', 'expandAll'],\n chain: ['renderHeader', 'populateHeaderMenu', 'getColumnDragToolbarItems', 'onElementTouchStart', 'onElementClick', 'onElementKeyDown']\n };\n }", "function LoginConfigJSBuilder(args,options) {\n this.args = args;\n this.options = options;\n this.importItems = []\n this.bodyItems = [];\n this.exportItems = [];\n}", "function parseConfig() {\n var p = this.path + '/config/',\n files = framework.util.getFiles(p),\n mainPos = files.indexOf('main.js'),\n jsExt = framework.regex.jsFile,\n config = require(this.path + '/config/main.js');\n\n for (var file,key,cfg,i=0; i < files.length; i++) {\n if (i==mainPos) continue;\n file = files[i];\n key = file.replace(jsExt, '');\n cfg = require(this.path + '/config/' + file);\n if (typeof config[key] == 'object') _.extend(config[key], cfg); \n else config[key] = cfg;\n }\n\n return config;\n}", "static get pluginConfig() {\n return {\n chain: ['renderHeader', 'getCellMenuItems', 'getHeaderMenuItems', 'onElementClick']\n };\n }", "static get pluginConfig() {\n return {\n chain : ['onElementTouchStart', 'onElementTouchMove', 'onElementTouchEnd', 'onElementMouseDown',\n 'onElementMouseMove', 'onElementDblClick', 'onElementMouseUp', 'onSubGridCollapse', 'onSubGridExpand',\n 'render']\n };\n }", "readConfigFile()\n\t{\n\t let file_path = join(this.rootDir, CONFIGS_FILENAME);\n\t\t//Recuperer le contenu du fichier\n\t let file_content = readFileSync(file_path, 'utf8');\n\t //Parser le JSON\n\t\tconfigs = JSON.parse(file_content);\n\t\t//Ajouter les elements n'existant pas avec une valeur par defaut\n\t\tconfigs.showStartup\t= typeof(configs.showStartup) === 'undefined' ? false : configs.showStartup;\n\t\tconfigs.showOutput\t= typeof(configs.showOutput) === 'undefined' ? false : configs.showOutput;\n\t\tconfigs.showError\t= typeof(configs.showError) === 'undefined' ? true : configs.showError;\n\t\tconfigs.javaBin\t\t= typeof(configs.javaBin) === 'undefined' ? 'java' : configs.javaBin;\n\t\tconfigs.outputFilename\t= typeof(configs.outputFilename) === 'undefined' ? '$1.min.js' : configs.outputFilename;\n\t\t//Ajouter le slash de fin si necessaire\n\t\tconfigs.inputDir += configs.inputDir.slice(-1) !== '/' ? '/' : '';\n\t\tconfigs.outputDir += configs.outputDir.slice(-1) !== '/' ? '/' : '';\n\t\t//Retourner le tableau de configuration\n\t\treturn configs;\n\t}", "get defaultConfig() {\n return [\n this.historyButtonGroup,\n this.basicInlineButtonGroup,\n this.linkButtonGroup,\n this.clipboardButtonGroup,\n this.scriptButtonGroup,\n this.insertButtonGroup,\n this.listIndentButtonGroup,\n ];\n }", "@action setup_apps() {\n this._applications_to_configure.forEach((app_conf) => {\n if ( !app_conf.name ) {\n throw new TypeError(`Apps need a name as part of their configuration! Looked inside: ${JSON.stringify(app_conf)}`)\n }\n\n // Parse its routes into our router\n // TideStore (.. which is badly named... its technically just a rendering engine).\n // will end up using the context to determine which layout to use during a render\n for (let route of app_conf.routes) {\n route.context.app_label = app_conf.name;\n this.router.set(route);\n }\n\n // Give the application some of its own configured data\n app_conf.app.store = app_conf.store;\n app_conf.app.tide = this;\n\n if(this._apps.has(app_conf.name)){\n throw new ConfigurationError(`The application named ${app_conf.name} was listed twice.`)\n }\n\n // Set the completed app in our table\n this._apps.set(app_conf.name, app_conf);\n });\n\n // Now that all the apps are in the listing\n // Let it complete them complete their initialization\n this.apps().map(app_conf => {\n let initial = this.initial_data[app_conf.name] || {};\n console.log(`[Tide] Initial for ${app_conf.name}`, initial);\n app_conf.ready(initial)\n })\n }", "startConfigure(config) {\n const {\n tabPanelItems\n } = config,\n tabPanel = config.items.find(w => w.ref === 'tabs');\n ObjectHelper.merge(tabPanel.items, tabPanelItems); // const\n // tabsConfig = config.tabsConfig || {},\n // tabs = ObjectHelper.clone(config.defaultTabs);\n //\n // Object.keys(tabsConfig).forEach(tabType => {\n // let index;\n // const\n // config = tabsConfig[tabType],\n // tab = tabs.find((t, i) => {\n // index = i;\n // return (tabType || '').toLowerCase() === t.type;\n // });\n //\n // if (tab) {\n // // remove unwanted tab\n // if (config === false) {\n // tabs.splice(index, 1);\n // }\n // // apply custom config to the default tab\n // else if (typeof (config) === 'object') {\n // Object.assign(tab, config);\n // }\n // }\n // // add the custom tab\n // else {\n // tabs.push(config);\n // }\n // });\n //\n // // mutate tabpanel config\n // config.items[0].items = tabs;\n //\n // super.startConfigure(config);\n }", "constructor(configs) {\n const defaults = {\n name: 'default'\n }\n this.configs = Object.assign({}, defaults, configs)\n }", "function createMenuItems() {\n var menuArray = [];\n // Create the menu entry for searching with all engines\n if (preferences['showAll']) {\n menuArray.push(contextMenu.Item({\n label: 'All Engines',\n data: '-all'\n }));\n menuArray.push(contextMenu.Separator());\n }\n engines.forEach(function (engine) {\n if (preferences[engine.prefName]) {\n menuArray.push(contextMenu.Item({\n label: engine.name,\n data: engine.url,\n image: engine.icon\n }));\n }\n });\n return menuArray;\n}", "function buildConfig(args) {\n var entry = args._[1];\n var mountId = args['mount-id'] || 'app';\n\n var config = {\n babel: {\n presets: ['inferno'],\n stage: 0\n },\n output: {\n filename: 'app.js',\n path: process.cwd(),\n publicPath: '/'\n },\n plugins: {\n html: {\n mountId,\n title: args.title || 'Inferno App'\n }\n },\n resolve: {\n alias: {\n 'react': 'inferno-compat',\n 'react-dom': 'inferno-compat'\n }\n }\n };\n\n if (args.force === true) {\n config.entry = [_path2.default.resolve(entry)];\n } else {\n // Use a render shim module which supports quick prototyping\n config.entry = [require.resolve('../infernoRunEntry')];\n config.plugins.define = { NWB_INFERNO_RUN_MOUNT_ID: JSON.stringify(mountId) };\n // Allow the render shim module to resolve Inferno from the cwd\n config.resolve.alias['inferno'] = _path2.default.dirname(_resolve2.default.sync('inferno/package.json', { basedir: process.cwd() }));\n // Allow the render shim module to import the provided entry module\n config.resolve.alias['nwb-inferno-run-entry'] = _path2.default.resolve(entry);\n }\n\n if (args.polyfill === false || args.polyfills === false) {\n config.polyfill = false;\n }\n\n return config;\n}", "function loadHarnessConfigs() {\n\t\t\tfunction loadConfig(setIndex, configDir, configName) {\n\t\t\t\tvar stat = fs.statSync(configDir + \"/\" + configName);\n\t\t\t\tif (stat.isDirectory()) {\n\t\t\t\t\tconfigs[setIndex].setConfigs.push({\n\t\t\t\t\t\tconfigDir: configDir,\n\t\t\t\t\t\tconfigName: configName\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// load standard configs\n\t\t\tvar files = fs.readdirSync(driverGlobal.configSetDir + \"/configs\");\n\t\t\tif (files.length > 0) {\n\t\t\t\tconfigs.push({\n\t\t\t\t\tsetDir: driverGlobal.configSetDir,\n\t\t\t\t\tsetName: \"standard\",\n\t\t\t\t\tsetConfigs: []\n\t\t\t\t});\n\n\t\t\t\tfor (var i = 0; i < files.length; i++) {\n\t\t\t\t\tloadConfig((configs.length - 1), driverGlobal.configSetDir + \"/configs\", files[i]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// load custom configs\n\t\t\tif ((typeof driverGlobal.config.customHarnessConfigDirs) !== \"undefined\") {\n\t\t\t\tif (Object.prototype.toString.call(driverGlobal.config.customHarnessConfigDirs) === \"[object Array]\") {\n\t\t\t\t\tfor (var i = 0; i < driverGlobal.config.customHarnessConfigDirs.length; i++) {\n\t\t\t\t\t\tvar configSetDir = driverGlobal.config.customHarnessConfigDirs[i];\n\t\t\t\t\t\tvar configSetName;\n\n\t\t\t\t\t\t// load the config set name\n\t\t\t\t\t\tif (path.existsSync(configSetDir + \"/name.txt\")) {\n\t\t\t\t\t\t\tconfigSetName = util.trimStringRight(fs.readFileSync(configSetDir + \"/name.txt\", \"ascii\"));\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tutil.log(\"the custom harness config set at <\" + configSetDir + \"/name.txt\" + \n\t\t\t\t\t\t\t\"> does not contain a name.txt file that provides a harness config set name, ignoring\",\n\t\t\t\t\t\t\t\tdriverGlobal.logLevels.quiet);\n\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tvar files = fs.readdirSync(configSetDir + \"/configs\");\n\t\t\t\t\t\tif (files.length > 0) {\n\t\t\t\t\t\t\tconfigs.push({\n\t\t\t\t\t\t\t\tsetDir: configSetDir,\n\t\t\t\t\t\t\t\tsetName: configSetName,\n\t\t\t\t\t\t\t\tsetConfigs: []\n\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\tfor (var j = 0; j < files.length; j++) {\n\t\t\t\t\t\t\t\tloadConfig((configs.length - 1), configSetDir + \"/configs\", files[j]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tutil.log(\"the customHarnessConfigDirs property in the config module is set but is not an array\",\n\t\t\t\t\t\tdriverGlobal.logLevels.quiet);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (configs.length < 1) {\n\t\t\t\tutil.log(\"there must be at least one harness config, exiting\");\n\t\t\t\tprocess.exit(1);\n\t\t\t}\n\t\t}", "static get pluginConfig() {\n return {\n chain: ['getHeaderMenuItems', 'getColumnDragToolbarItems']\n };\n }", "getConfig () {}", "function getCapabilitiesConfigs(config, target) {\n _.forEach(config.layers, function(layer) {\n if (isService(layer.capabilities)) {\n // Capabilities has been defined for the main-level layer.\n target.push(layer.capabilities);\n // WFS needs to have own capabilities also for sublayers\n // because capabilities are layer and not only URL specific for WFS.\n var animation = findAnimation(layer.args);\n if (animation) {\n _.forEach(animation.layers, function(animationLayer) {\n target.push({\n url : layer.capabilities.url,\n layer : animationLayer.layer,\n storedQueryId : animationLayer.storedQueryId\n });\n });\n }\n }\n });\n }", "function createConfigInitializeSetting() {\n return {\n initialize: {\n id: 'gladys-connector',\n name: 'Gladys',\n description: 'Gladys SmartThings connector',\n permissions: shared.scopes,\n firstPageId: 'gladysPage'\n }\n };\n}", "static get pluginConfig() {\n return {\n chain: ['onElementClick', 'getHeaderMenuItems', 'getColumnDragToolbarItems', 'renderHeader']\n };\n }", "static get pluginConfig() {\n return {\n chain : ['populateHeaderMenu']\n };\n }", "function configGen() {\n return {\n input: 'src/index.ts',\n output: {\n file: 'dist/web/buttplug.js',\n format: 'iife',\n name: \"Buttplug\"\n },\n plugins: [\n nodeResolve({\n jsnext: true,\n main: true,\n extensions: [ '.ts', '.js', '.json' ],\n browser: true\n }),\n typescript({ tsconfigOverride: { compilerOptions: { module: \"ES2015\" } } }),\n json(),\n nodeBuiltins(),\n nodeGlobals(),\n commonjs({\n // non-CommonJS modules will be ignored, but you can also\n // specifically include/exclude files\n include: ['../../node_modules/**', './node_modules/**'], // Default: undefined\n }),\n ]\n };\n}", "function build(config) {\n\n // populate screen location properties\n Screen.location = {\n address : config.interface.location,\n latitude : config.interface.latitude,\n longitude : config.interface.longitude,\n geocode : config.interface.latitude + \",\" + config.interface.longitude\n };\n\n // setup interface\n Interface.setup(config.interface);\n\n // create panes\n for (var id in config.panes) {\n var pane = config.panes[id];\n Panes.add(id, pane);\n }\n\n // create turtles\n for (var id in config.turtles) {\n var turtle = config.turtles[id];\n Turtles.grow(turtle.type, id, turtle.pane, turtle.order, turtle.options);\n }\n\n // enable plugins\n for (var name in config.plugins) {\n // try uppercase or lowercase\n if (window[plugin] == null) {\n var plugin = window[name.charAt(0).toUpperCase() + name.slice(1)];\n } else {\n var plugin = window[name];\n }\n\n if (config.plugins[name] != null && config.plugins[name] != 0 && plugin != null) {\n if(config.plugins[name] == 1){\n plugin.enable();\n }else{\n plugin.enable(config.plugins[name]);\n }\n } else {\n plugin.disable();\n }\n }\n\n // create jobs\n for(var id in config.jobs) {\n var job = config.jobs[id];\n Jobs.add(job);\n }\n }", "get configTemplate() {\n return {\n // The color is used for the `this.log()` function and also custom command help\n color: '1af463',\n // The optional icon to use with the `this.sendLocalMessage` function. If left blank, a default one will be used instead\n iconURL: 'https://i.ytimg.com/vi/KEkrWRHCDQU/maxresdefault.jpg'\n };\n }", "static get pluginConfig() {\n return [];\n }", "static get pluginConfig() {\n return [];\n }", "function generateBuildOptions(metadata, options) {\n const results = Object.assign({}, command_1.filterOptionsByIntent(metadata, options), command_1.filterOptionsByIntent(metadata, options, 'app-scripts'));\n // Serve specific options not related to the actual run or emulate code\n return Object.assign({}, results, { externalAddressRequired: true, iscordovaserve: true, nobrowser: true, target: 'cordova' });\n}", "configureJava() {\n this.config.defaults(requiredConfig);\n }", "static get pluginConfig() {\n return {\n chain: [\n 'onElementTouchStart',\n 'onElementTouchMove',\n 'onElementTouchEnd',\n 'onElementMouseDown',\n 'onElementMouseMove',\n 'onElementDblClick',\n 'onElementMouseUp',\n 'onSubGridCollapse',\n 'onSubGridExpand',\n 'render'\n ]\n };\n }", "function getConfiguration()\n {\n var result = {};\n\n if (undefined == result.beforeShow)\n {\n result.beforeShow = readLinked;\n }\n\n if (undefined == result.onSelect)\n {\n result.onSelect = updateLinked;\n }\n\n return $.extend(true, configuration, result);\n }", "function mergeConfigs() {\n var configs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n configs[_i] = arguments[_i];\n }\n function isNilOrNaN(val) {\n return lodash_1.isNil(val) || (lodash_1.isNumber(val) && isNaN(val));\n }\n // helper to get the first defined value for a given config key\n // from the config sources in a type safe manner\n function get(k) {\n return configs\n .reverse()\n .reduce(function (entry, config) { return !isNilOrNaN(config[k]) ? config[k] : entry; }, exports.DefaultConfig[k]);\n }\n return {\n port: get('port'),\n bind: get('bind'),\n env: get('env'),\n debugNamespace: get('debugNamespace'),\n keyPath: get('keyPath'),\n crtPath: get('crtPath'),\n logFile: get('logFile'),\n disableSSL: get('disableSSL'),\n disableProxy: get('disableProxy'),\n disableEnvCheck: get('disableEnvCheck'),\n timeout: get('timeout'),\n customRootUri: get('customRootUri'),\n customBitcoinNetwork: get('customBitcoinNetwork'),\n };\n}", "includeConfigOption(context, prevArgv) {\n const { primaryDriver } = context;\n const configPath = context.findConfigByName(primaryDriver.metadata.configName);\n const argv = [...prevArgv];\n if (configPath && primaryDriver.metadata.configOption) {\n argv.push(primaryDriver.metadata.configOption, configPath.path.path());\n }\n this.debug('Including config option to args');\n return argv;\n }", "function config(k, v, _argc) {\n if ( (_argc = arguments.length) == 1 ) {\n \tif(isObject(k)){\n \t\t_configs = extend(TRUE, _configs,k)\n \t} else {\n var r = _configs;\n split(k, function(_, it){\n r = r && r[it];\n }, '.')\n return r;\n }\n } else if (_argc == 0){\n \treturn _configs\n } else if (isObject(v)) {\n _configs[k] = extend(TRUE, _configs[k] || {}, v)\n } else {\n _configs[k] = v\n }\n}", "async function jupyterConfigData() {\n /**\n * Return the value if already cached for some reason\n */\n if (_JUPYTER_CONFIG != null) {\n return _JUPYTER_CONFIG;\n }\n\n let parent = new URL(HERE).toString();\n let promises = [getPathConfig(HERE)];\n while (parent != FULL_LITE_ROOT) {\n parent = new URL('..', parent).toString();\n promises.unshift(getPathConfig(parent));\n }\n\n const configs = (await Promise.all(promises)).flat();\n\n let finalConfig = configs.reduce(mergeOneConfig);\n\n // apply any final patches\n finalConfig = dedupFederatedExtensions(finalConfig);\n\n // hoist to cache\n _JUPYTER_CONFIG = finalConfig;\n\n return finalConfig;\n}", "function getCapabilitiesConfigs(config, target) {\n // Insert capabilities objects from config layers into the target array.\n target.push.apply(target, _.map(_.filter(config.layers, function(layer) {\n return layer && isService(layer.capabilities);\n }), \"capabilities\"));\n }", "static get pluginConfig() {\n return {\n chain: ['populateHeaderMenu', 'getColumnDragToolbarItems']\n };\n }", "static get pluginConfig() {\n return {\n chain: [\n 'render',\n 'renderContents',\n 'onElementClick',\n 'onElementDblClick',\n 'onElementMouseOver',\n 'onElementMouseOut'\n ],\n assign: ['getElementForDependency', 'getDependencyForElement']\n };\n }", "function listConfigurations(url){\n if (!url) {\n // default search endpoint\n url = Config.CONFIGURATION_URL;\n }\n $.ajax({\n url: url,\n cache: false,\n })\n .done(function(data, textStatus, jqXHR){\n // generate pagination on UI\n paginate(jqXHR);\n\n // clear the existing data on results table and add new page\n var tbody = $('table#configurations tbody');\n var table = $('table#configurations').DataTable();\n table.clear();\n table.rows.add(data).draw();\n $('div#spinner').css('display', 'none');\n $('div#search-config').css('display', 'block').fadeIn(1500);\n // set message if no results returned from this url..\n $('td.dataTables_empty').html('No configuration files found.');\n\n // enable checkboxes on selections\n $(selections).each(function(idx, selection){\n $('input[id=\"' + selection.uid + '\"]').prop('checked', true);\n toggleCheckboxes(selection, true);\n });\n\n // bind a listener to the selection checkboxes\n $('input[name=\"config\"]').on('change', function(e){\n var isSelected = $(e.target).is(':checked');\n var uid = e.target.id;\n var type = e.target.getAttribute('data-type');\n var filename = e.target.getAttribute('data-filename');\n var published = e.target.getAttribute('data-published') === true ? 'Published' : 'Private';\n if (isSelected) {\n var selection = {}\n selection['uid'] = uid;\n selection['config_type'] = type;\n selection['filename'] = filename;\n selection['published'] = published;\n selections.push(selection);\n toggleCheckboxes(selection, true);\n if (type === 'PRESET') {\n $(document).trigger({type: 'preset:selected', source: 'config-browser'});\n }\n }\n else {\n $(selections).each(function(idx, selection){\n if (selection.uid === e.target.id) {\n selections.splice(idx, 1);\n toggleCheckboxes(selection, false);\n }\n });\n if (type === 'PRESET') {\n $(document).trigger({type: 'preset:deselected', source: 'config-browser'});\n }\n }\n });\n });\n }", "function getDefaultNomicLabsConfig(){\n const logger = process.env.SILENT ? { log: () => {} } : console;\n const reporter = process.env.SILENT ? 'dot' : 'spec';\n\n const mockwd = path.join(process.cwd(), temp);\n const vals = {\n paths : {\n root: mockwd,\n artifacts: path.join(mockwd, 'artifacts'),\n cache: path.join(mockwd, 'cache'),\n sources: path.join(mockwd, 'contracts'),\n tests: path.join(mockwd, 'test'),\n },\n logger: logger,\n mocha: {\n reporter: reporter\n },\n networks: {\n development: {\n url: \"http://127.0.0.1:8545\",\n }\n }\n }\n\n return vals;\n}", "function createConfigFiles() {\n return __awaiter(this, void 0, void 0, function* () {\n const config = vscode.workspace.getConfiguration();\n // Update the Python path if required.\n if (config.get(PYTHON_AUTOCOMPLETE_PATHS, []).length === 0) {\n updatePythonPath();\n }\n // Ensure the \".vscode\" directory exists then update the C++ path.\n const dir = path.join(vscode.workspace.rootPath, \".vscode\");\n if (!(yield pfs.exists(dir))) {\n yield pfs.mkdir(dir);\n }\n pfs.exists(path.join(dir, \"c_cpp_properties.json\")).then(exists => {\n if (!exists) {\n updateCppProperties();\n }\n });\n });\n}", "function createBuildConfig(args, options) {\n let {\n commandConfig: extraConfig = {},\n defaultTitle,\n renderShim,\n renderShimAliases\n } = options;\n\n let entry = _path2.default.resolve(args._[1]);\n let dist = _path2.default.resolve(args._[2] || 'dist');\n let mountId = args['mount-id'] || 'app';\n\n let production = process.env.NODE_ENV === 'production';\n let filenamePattern = production ? '[name].[chunkhash:8].js' : '[name].js';\n\n let config = {\n babel: {\n stage: 0\n },\n devtool: 'source-map',\n output: {\n chunkFilename: filenamePattern,\n filename: filenamePattern,\n path: dist,\n publicPath: '/'\n },\n plugins: {\n html: {\n mountId,\n title: args.title || defaultTitle\n },\n // A vendor bundle can be explicitly enabled with a --vendor flag\n vendor: args.vendor\n }\n };\n\n if (renderShim == null || args.force === true) {\n config.entry = { app: [entry] };\n } else {\n // Use a render shim module which supports quick prototyping\n config.entry = { app: [renderShim] };\n config.plugins.define = { NWB_QUICK_MOUNT_ID: JSON.stringify(mountId) };\n config.resolve = {\n alias: _extends({\n // Allow the render shim module to import the provided entry module\n 'nwb-quick-entry': entry\n }, renderShimAliases)\n };\n }\n\n if (args.polyfill === false || args.polyfills === false) {\n config.polyfill = false;\n }\n\n return (0, _webpackMerge2.default)(config, extraConfig);\n}", "buildSuiteOptionList () {\n\t\tconst project = this.projectManager.getProject(this.selectedProject)\n\t\tconst active = project.getSelectedSuiteNames()\n\n\t\tconst options = []\n\n\t\tproject.getAvailableSuiteNames().forEach(name => {\n\t\t\tconst attributes = {}\n\n\t\t\tif (-1 !== active.indexOf(name)) {\n\t\t\t\tattributes.selected = true\n\t\t\t}\n\n\t\t\toptions.push(\n\t\t\t\t<span { ...attributes }\n\t\t\t\t\tkey={ name }\n\t\t\t\t>\n\t\t\t\t\t{ name }\n\t\t\t\t</span>\n\t\t\t)\n\t\t})\n\n\t\treturn options\n\t}", "function reveive_available_hinet_configs(json_object) {\n $(\"#hinet_available_config\").empty();\n var config_names = json_object.result;\n var i;\n for (i = 0; i < config_names.length; i += 1) {\n $(\"#hinet_available_config\").append(\n $(\"<option></option>\").val(config_names[i]).html(config_names[i])\n );\n }\n}", "function configCompl (opts, cb) {\n var word = opts.word\n var split = word.match(/^(-+)((?:no-)*)(.*)$/)\n var dashes = split[1]\n var no = split[2]\n var flags = configNames.filter(isFlag)\n console.error(flags)\n\n return cb(null, allConfs.map(function (c) {\n return dashes + c\n }).concat(flags.map(function (f) {\n return dashes + (no || 'no-') + f\n })))\n}", "function makeConfig(config) {\n\tvar wpCfg = config.webpack;\n\tvar bootstrapSass = path.resolve(config.buildPath, 'node_modules/bootstrap/scss');\n\tvar wpEntries = {};\n\n\tObject.entries(wpCfg.entries).forEach(function(entry) {\n\t\twpEntries[entry[0]] = resolveGlobs(entry[1]);\n\t});\n\n\tconsole.warn('wpEntries');\n\tconsole.warn(wpEntries);\n\n\taddLibEntries(wpEntries, config.libEntries);\n\n\t// Add common rules to pack different kinds of resources\n\tvar rules = [\n\t\t{\n\t\t\ttest: /\\.tsx?$/,\n\t\t\tuse: 'ts-loader',\n\t\t\texclude: /node_modules/,\n\t\t},\n\t\t{\n\t\t\ttest: /\\.s[ac]ss$/,\n\t\t\tuse: [\n\t\t\t\tMiniCssExtractPlugin.loader,\n\t\t\t\t// Translates CSS into CommonJS\n\t\t\t\t{\n\t\t\t\t\tloader: 'css-loader',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tsourceMap: true\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t// Compiles Sass to CSS\n\t\t\t\t{\n\t\t\t\t\tloader: 'sass-loader',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\timplementation: require('node-sass'),\n\t\t\t\t\t\tsourceMap: true,\n\t\t\t\t\t\tsassOptions: {\n\t\t\t\t\t\t\tindentWidth: 4,\n\t\t\t\t\t\t\tincludePaths: [bootstrapSass, config.buildPath],\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\ttest: /\\.(png|jpe?g|gif|svg)$/,\n\t\t\ttype: 'asset/resource',\n\t\t\tgenerator: {\n\t\t\t\tfilename: '[file]'\n\t\t\t}\n\t\t}\n\t];\n\t// Add basic plugins\n\tvar plugins = [\n\t\t// This plugin says that we need\n\t\tnew webpack.DllPlugin({\n\t\t\tname: '[name]',\n\t\t\tpath: path.join(wpCfg.manifestsPath, '[name].manifest.json'),\n\t\t\tformat: true\n\t\t}),\n\t\tnew MiniCssExtractPlugin({\n\t\t\t// Options similar to the same options in webpackOptions.output\n\t\t\t// both options are optional\n\t\t\tfilename: '[name].css',\n\t\t\tchunkFilename: '[id].css',\n\t\t}),\n\t\tnew webpack.NormalModuleReplacementPlugin(\n\t\t\t/\\.ivy$/,\n\t\t\tfunction (resource) {\n\t\t\t\tresource.request = path.join('buildAux', resource.request + '.js')\n\t\t\t}\n\t\t)\n\t];\n\t// Add plugins to resolve dependencies from other libraries\n\taddExtLibPlugins(plugins, wpCfg);\n\n\treturn {\n\t\tcontext: config.buildPath,\n\t\tmode: (config.devMode? 'development': 'production'),\n\t\tentry: wpEntries,\n\t\tresolve: {\n\t\t\tmodules: [\n\t\t\t\tconfig.buildPath,\n\t\t\t\tconfig.buildAuxPath\n\t\t\t],\n\t\t\textensions: [\n\t\t\t\t'.tsx',\n\t\t\t\t'.ts',\n\t\t\t\t'.js',\n\t\t\t\t'.scss'\n\t\t\t],\n\t\t\tsymlinks: false\n\t\t},\n\t\tresolveLoader: {\n\t\t\tmodules: [path.join(config.buildPath, 'node_modules')]\n\t\t},\n\t\tmodule: {\n\t\t\trules: rules\n\t\t},\n\t\tplugins: plugins,\n\t\tdevtool: 'cheap-source-map',\n\t\toutput: {\n\t\t\tpath: config.outPub,\n\t\t\tpublicPath: config.publicPath,\n\t\t\tfilename: '[name].js',\n\t\t\tlibraryTarget: wpCfg.libraryTarget,\n\t\t\tlibrary: '[name]'\n\t\t}\n\t};\n}", "showConfigs () {\n const activeConfigs = this.dag.requiredConfigNodes() // returns an array of DagNode references\n console.log('ACTIVE CONFIGS:')\n activeConfigs.forEach(cfg => { console.log(cfg.key(), cfg.value()) })\n }", "function init() {\n\n initFloorsMapping(Config.BUILDINGS);\n createElevators(Config.BUILDINGS);\n\n AppUI.init();\n attachEvents(Config.BUILDINGS);\n }", "static get pluginConfig() {\n return {\n chain: ['onPaint', 'populateHeaderMenu', // TODO: 'headerContextMenu' is deprecated. Please see https://bryntum.com/docs/scheduler/#guides/upgrades/3.1.0.md for more information.\n 'populateTimeAxisHeaderMenu']\n };\n }", "function computeConfiguration(params, _token, _next) {\n if (!params.items) {\n return null;\n }\n let result = [];\n for (let item of params.items) {\n // The server asks the client for configuration settings without a section\n // If a section is present we return null to indicate that the configuration\n // is not supported.\n if (item.section) {\n result.push(null);\n continue;\n }\n let config;\n if (item.scopeUri) {\n config = vscode_1.workspace.getConfiguration('lspMultiRootSample', client.protocol2CodeConverter.asUri(item.scopeUri));\n }\n else {\n config = vscode_1.workspace.getConfiguration('lspMultiRootSample');\n }\n result.push({\n maxNumberOfProblems: config.get('maxNumberOfProblems')\n });\n }\n return result;\n }", "function createServiceConfig () {\n console.log(`Creating ${configFilePath}`)\n\n const content = {\n apps: []\n }\n\n function addServiceConfig (name) {\n return new Promise((resolve, reject) => {\n content.apps.push({\n name,\n script: 'index.js',\n cwd: path.resolve(__dirname, '../../back-end/services', name),\n instances: config.services[name].totalInitialInstances,\n max_restarts: 15,\n env: {\n NODE_ENV: process.env.NODE_ENV\n }\n })\n\n resolve()\n })\n }\n\n return Promise.all(Object.keys(config.services)\n .map(addServiceConfig)\n )\n .then(() => fs.writeFileSync(\n path.resolve(__dirname, configFilePath),\n JSON.stringify(content, undefined, 2),\n 'utf8'\n ))\n .then(() => console.log(`${configFilePath} successfully created`))\n}", "function apply_all_configs() {\n for (var name in all_configs) {\n if (audio_graph) {\n audio_graph.config(name.split('.'), all_configs[name]);\n }\n if (audio_ui) {\n audio_ui.config(name.split('.'), all_configs[name]);\n }\n }\n}" ]
[ "0.5952684", "0.54929423", "0.5462945", "0.54263645", "0.53882575", "0.5377423", "0.534919", "0.5339271", "0.53169733", "0.53052163", "0.5300868", "0.5283008", "0.5272032", "0.52457243", "0.5242057", "0.5235154", "0.52095884", "0.5202356", "0.5185812", "0.5145657", "0.51259655", "0.5096008", "0.50841707", "0.507554", "0.5056314", "0.50410324", "0.50401795", "0.5036896", "0.5025826", "0.49988222", "0.49902543", "0.49888352", "0.49868298", "0.49847108", "0.49802282", "0.49654683", "0.49609554", "0.49609104", "0.49535316", "0.49341628", "0.4932012", "0.49175715", "0.49047408", "0.48954862", "0.48883513", "0.4888041", "0.48867425", "0.48807713", "0.48798445", "0.48775515", "0.48696932", "0.48689076", "0.48660427", "0.4863759", "0.48630312", "0.48598343", "0.48466697", "0.48455098", "0.48449743", "0.48368722", "0.48329476", "0.48235807", "0.4818721", "0.48067257", "0.47977373", "0.47928897", "0.47916928", "0.479031", "0.4787858", "0.47869503", "0.47864643", "0.47851318", "0.4783881", "0.47783908", "0.47783908", "0.47773522", "0.47710076", "0.47702193", "0.47701132", "0.4765088", "0.4761539", "0.4758654", "0.47456953", "0.47449526", "0.47392014", "0.47388557", "0.47303832", "0.4724292", "0.47224072", "0.4720568", "0.4719695", "0.47159123", "0.471496", "0.47148845", "0.47102702", "0.47100857", "0.47025704", "0.46987727", "0.46951988", "0.46934456" ]
0.5686087
1
Duplicate layer warnning message
function showDuplicateMsg() { $("#worning-duplicate").dialog("open"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function warnConflictLayerName(module, layerName, layersMap) {\n\t\tif (module.mid !== layerName && layersMap[module.mid]) {\n\t\t\twarn(\"The layer \" + layerName + \" contains the module \" + module.mid +\n\t\t\t\t\" which is also a layer name.\\nThis is likely to cause problems as the layer \" +\n\t\t\t\tmodule.mid + \" will not be loaded if the layer \" +\n\t\t\t\tlayerName + \" is loaded before the layer \" + module.mid + \".\");\n\t\t}\n\t}", "function duplicateOperationNameMessage(operationName) {\n return 'There can be only one operation named \"' + operationName + '\".';\n}", "function duplicateOperationNameMessage(operationName) {\n return \"There can be only one operation named \\\"\".concat(operationName, \"\\\".\");\n}", "function duplicateOperationNameMessage(operationName) {\n return 'There can only be one operation named \"' + operationName + '\".';\n}", "function duplicateVariableMessage(variableName) {\n return \"There can be only one variable named \\\"\".concat(variableName, \"\\\".\");\n}", "function duplicateDirectiveMessage(directiveName) {\n return \"The directive \\\"\".concat(directiveName, \"\\\" can only be used once at \") + 'this location.';\n}", "function duplicateDirectiveMessage(directiveName) {\n return 'The directive \"' + directiveName + '\" can only be used once at ' + 'this location.';\n}", "function duplicateArgMessage(argName) {\n return 'There can be only one argument named \"' + argName + '\".';\n}", "function duplicateTypeNameMessage(typeName) {\n return \"There can be only one type named \\\"\".concat(typeName, \"\\\".\");\n}", "function duplicateFragmentNameMessage(fragName) {\n return 'There can be only one fragment named \"' + fragName + '\".';\n}", "function duplicateArgMessage(argName) {\n return \"There can be only one argument named \\\"\".concat(argName, \"\\\".\");\n}", "function duplicateDirectiveNameMessage(directiveName) {\n return \"There can be only one directive named \\\"\".concat(directiveName, \"\\\".\");\n}", "function duplicateFragmentNameMessage(fragName) {\n return \"There can be only one fragment named \\\"\".concat(fragName, \"\\\".\");\n}", "function duplicateOperationTypeMessage(operation) {\n return \"There can be only one \".concat(operation, \" type in schema.\");\n}", "addLayer(details){\n //if the layer already exists then delete it\n if (this.map.getLayer(details.id)){\n this.map.removeLayer(details.id);\n } \n this.map.addLayer({\n 'id': details.id,\n 'type': details.type,\n 'source': details.sourceId,\n 'source-layer': details.sourceLayer,\n 'paint': details.paint\n }, (details.beforeId) ? details.beforeId : undefined);\n //set a filter if one is passed\n if (details.hasOwnProperty('filter')) this.map.setFilter(details.id, details.filter);\n if (this.props.view === 'country'){\n //set the visibility of the layer depending on the visible property of the status \n let status = this.props.statuses.filter(status => {\n return (status.layers.indexOf(details.id) !== -1);\n })[0];\n if (status) this.map.setLayoutProperty(details.id, \"visibility\", (status.visible) ? \"visible\" : \"none\" );\n }\n }", "function duplicateInputFieldMessage(fieldName) {\n return 'There can be only one input field named \"' + fieldName + '\".';\n}", "function duplicateInputFieldMessage(fieldName) {\n return \"There can be only one input field named \\\"\".concat(fieldName, \"\\\".\");\n}", "function addNetworkWarning(msg)\n{\n\tif (!g_NetworkWarningTexts[msg.warntype])\n\t{\n\t\twarn(\"Unknown network warning type received: \" + uneval(msg));\n\t\treturn;\n\t}\n\n\tif (Engine.ConfigDB_GetValue(\"user\", \"overlay.netwarnings\") != \"true\")\n\t\treturn;\n\n\tg_NetworkWarnings[msg.guid || \"server\"] = {\n\t\t\"added\": Date.now(),\n\t\t\"msg\": msg\n\t};\n}", "addLayer() {\n EventBus.$emit(\"try-adding-layer\", \"Layer 1\");\n }", "function showDuplicateMsg() {\n $(\"#warning-duplicate\").dialog(\"open\");\n }", "function duplicateFieldDefinitionNameMessage(typeName, fieldName) {\n return \"Field \\\"\".concat(typeName, \".\").concat(fieldName, \"\\\" can only be defined once.\");\n}", "function handleLineChartDuplicateWarning(button) {\r\n var btn = button.id;\r\n\r\n d3.selectAll(\r\n \".alert.alert-danger.alert-dismissible.lineChart.duplicateSelection\"\r\n ).classed(\"aleph-hide\", true);\r\n\r\n return;\r\n}", "mergeBelow(layer) {\n EventBus.$emit(\"try-merging-layer-below\", layer.name);\n }", "renameLayer(layer, name) {\n EventBus.$emit(\"try-renaming-layer\", layer.name, name);\n this.renaming = null;\n }", "duplicateLayer(elementId){\n document.getElementById(elementId).addEventListener('click', () => {\n const currentCanvas = this.animationProj.getCurrFrame().currentCanvas;\n const newLayer = this.insertNewLayer();\n newLayer.getContext('2d').drawImage(currentCanvas, 0, 0);\n });\n }", "updateLayer() {\n /* This layer is always reloaded */\n return;\n }", "function fetchDuplicatesForNewViewFailure(error) {\n return {\n type: FETCH_DUPLICATES_FOR_NEW_VIEW_FAILURE,\n payload: error\n };\n }", "function showRemoveMsg() {\n $(\"#warning-no-layer\").dialog(\"open\");\n }", "function updateMessageLayers() {\n var messages = attrs.messages ? scope.messages : [ scope.message ];\n\n // Reset layers\n nwLayer.getSource().clear();\n nmLayer.getSource().clear();\n scope.noPosMessages.length = 0;\n\n // Update the NW-NM message layers\n for (var x = 0; x < messages.length; x++) {\n var message = messages[x];\n var features = MessageService.featuresForMessage(message);\n if (features.length > 0) {\n var olFeatures = [];\n angular.forEach(features, function (gjFeature) {\n var olFeature = MapService.gjToOlFeature(gjFeature);\n addMessageFeature(message, olFeature);\n olFeatures.push(olFeature);\n });\n\n // Check if we need to add a center point for the message features\n if (showFeatureCenter(olFeatures)) {\n var center = MapService.getFeaturesCenter(olFeatures);\n if (center) {\n var centerFeature = new ol.Feature({\n geometry: new ol.geom.Point(center)\n });\n addMessageFeature(message, centerFeature);\n }\n }\n\n } else {\n scope.noPosMessages.push(messages[x]);\n }\n }\n }", "displayDefaultTurnWarning() {\n let message = '<h1><span>&#9888;</span> Using a default TURN</h1>Performance is not optimal.';\n const warning = document.createElement('a');\n warning.classList.add('gm-default-turn-button');\n warning.classList.add('gm-icon-button');\n const hover = document.createElement('div');\n hover.className = 'gm-default-turn-used gm-hidden';\n if (this.instance.options.connectionFailedURL) {\n message = message + '<br>Click on the icon to learn more.';\n warning.href = this.instance.options.connectionFailedURL;\n warning.target = '_blank';\n }\n hover.innerHTML = message;\n warning.appendChild(hover);\n\n warning.onmouseenter = () => {\n hover.classList.remove('gm-hidden');\n };\n warning.onmouseleave = () => {\n hover.classList.add('gm-hidden');\n };\n const toolbar = this.instance.getChildByClass(this.instance.root, 'gm-toolbar');\n toolbar.appendChild(warning);\n }", "function checkForDuplicates()\r\n\t{\r\n\tfor (i=0; i < activeClippings.length; i++)\r\n\t\t{\r\n\t\tif (newClipping == activeClippings[i].id) {i = allClippings.length; duplicate = true;}\r\n\t\t}\r\n\t}", "updateLayer(state) {\n return;\n }", "function createWarnOnce() {\n let calls = 0;\n return function (msg) {\n // eslint-disable-next-line\n !calls++ && console.warn(msg);\n };\n }", "function checkLayerOverlap(pl){\n var mouse = d3.mouse(d3.select(_canvas).node());\n var mouseX = mouse[0];\n var mouseY = mouse[1];\n var bounds = {\n 'top': mouse[1],\n 'left': mouse[0],\n 'bottom': mouse[1],\n 'right': mouse[0],\n };\n var uuid = pl.uuid();\n var overlap = null;\n // Find the first layer that is overlapped\n for(var i = 0; i < _pixelLayers.length; i++){\n var p = _pixelLayers[i];\n if(p.uuid() === uuid){ continue; }\n if(rectOverlap(bounds, p.boundingRect(_zoomScale, _zoomPan))){ \n overlap = p; \n break;\n }\n }\n if(_overlap == null && overlap != null){\n _overlap = p;\n _obj.onLayerOverlapEnter(pl, _overlap);\n }\n else if(_overlap != null && overlap == null){\n _obj.onLayerOverlapLeave(pl, _overlap);\n _overlap = null;\n }\n else if(_overlap != null && overlap != null){\n // We passed from one overlapping item to another without\n // breaking\n if(p.uuid() != _overlap.uuid()){\n _obj.onLayerOverlapLeave(pl, _overlap);\n _overlap = p;\n _obj.onLayerOverlapEnter(pl, _overlap);\n }\n }\n }", "function checkLayers() {\n if (recentGroup.hasLayer() != true) {\n recentPop();\n } else clearRecents();\n }", "function updateLabelLayer() {\n\n labelLayer.getSource().clear();\n if (scope.message) {\n var features = MessageService.featuresForMessage(scope.message);\n if (features.length > 0) {\n var coordIndex = 1;\n angular.forEach(features, function (gjFeature) {\n\n var olFeature = MapService.gjToOlFeature(gjFeature);\n var styles = [];\n\n // Create a label for the feature\n var name = gjFeature.properties\n ? gjFeature.properties['name:' + $rootScope.language]\n : undefined;\n\n if (name) {\n styles.push(scope.styleForFeatureName(\n olFeature,\n name));\n }\n\n // Create labels for the \"readable\" coordinates\n var coords = [];\n MapService.serializeReadableCoordinates(gjFeature, coords);\n for (var x = 0; x < coords.length; x++) {\n\n var c = MapService.fromLonLat([ coords[x].lon, coords[x].lat ]);\n\n styles.push(scope.styleForFeatureCoordIndex(\n olFeature,\n coordIndex,\n c));\n\n if (coords[x].name) {\n styles.push(scope.styleForFeatureCoordName(\n olFeature,\n coords[x].name,\n c));\n }\n coordIndex++;\n }\n\n if (styles.length > 0) {\n olFeature.setStyle(styles);\n labelLayer.getSource().addFeature(olFeature);\n }\n });\n }\n }\n }", "function loadFailure(failure){\n layer.loadError = true;\n console.log('GEE Tile Service request failed for '+layer.name);\n console.log(containerID)\n $('#'+containerID).css('background','red');\n $('#'+containerID).attr('title','Layer failed to load. Error message: \"'+failure + '\"')\n // getGEEMapService();\n }", "addToChangeLayers(){\n let _to = this.props.toVersion.key;\n //attribute change in protected areas layers\n this.addLayer({id: window.LYR_TO_CHANGED_ATTRIBUTE, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(99,148,69,0.4)\", \"fill-outline-color\": \"rgba(99,148,69,0.8)\"}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n //geometry change in protected areas layers - to\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY_LINE, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_COUNT_CHANGED_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_COUNT_CHANGED_POLYGON_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY_LINE, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_SHIFTED_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_SHIFTED_POLYGON_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY_LINE, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n //added protected areas layers\n this.addLayer({id: window.LYR_TO_NEW_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(63,127,191,0.2)\", \"fill-outline-color\": \"rgba(63,127,191,0.6)\"}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_NEW_POINT, sourceId: window.SRC_TO_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _to + \"_points\", layout: {visibility: \"visible\"}, paint: {\"circle-radius\": CIRCLE_RADIUS_STOPS, \"circle-color\": \"rgb(63,127,191)\", \"circle-opacity\": 0.6}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n \n }", "logIfDuplicate(node, id) {\n if (this.conditionalScope.isIgnoredId(id)) {\n return;\n }\n if (this.conditionalScope.isDuplicateId(id)) {\n this.log({\n message: ERROR_MESSAGE,\n node,\n });\n } else {\n this.conditionalScope.addId(id);\n }\n }", "loadVertexDuplicateData(jsndvis) {\n//----------------------\nthis.vertexDuplicateIndices = jsndvis;\nreturn this.appendDuplicatedVertices();\n}", "warn() {}", "function canBeDuplicator() { }", "function warnMSG(message) {\n $('#warnContainer').addClass('warnContainerActive');\n $('#warnContainer').html(message);\n}", "_updateTooltipMessage() {\n // Must wait for the message to be painted to the tooltip so that the overlay can properly\n // calculate the correct positioning based on the size of the text.\n if (this._tooltipInstance) {\n this._tooltipInstance.message = this.message;\n this._tooltipInstance._markForCheck();\n this._ngZone.onMicrotaskEmpty.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"take\"])(1), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_13__[\"takeUntil\"])(this._destroyed)).subscribe(() => {\n if (this._tooltipInstance) {\n this._overlayRef.updatePosition();\n }\n });\n }\n }", "_changeLayer(layer) {\n //console.log(\"Layer is changed to layer\", layer, this);\n }", "isDuplicate(msg) {\n return (\n this.state.latestMessages\n .map(existing => JSON.stringify(existing) == JSON.stringify(msg))\n .filter(value => value).length > 0\n );\n }", "static renderCompileError(message) {\n const noCreate = !message\n const overlay = this.getErrorOverlay(noCreate)\n if (!overlay) return\n overlay.setCompileError(message)\n }", "function toDuplicate (shapeLayer, newName, newPos, newScale) {\n\n\t\t// Duplicate Path\n\tvar dupShapeGroup = shapeLayer.property(\"ADBE Root Vectors Group\")\n\t.property(\"ADBE Vector Group\").duplicate();\n\n\t\t// New Name\n\tdupShapeGroup.name = newName;\n\n\t\t// Re Position\n\tvar dupShapeTransGrp = dupShapeGroup.property(\"ADBE Vector Transform Group\");\n\tvar dupShapeGrpPosition = dupShapeTransGrp.property(\"ADBE Vector Position\");\n\tdupShapeGrpPosition.setValue(newPos);\n\n\t\t// Re Scale\n\tvar dupShapeGrpScale = dupShapeTransGrp.property(\"ADBE Vector Scale\");\n\tdupShapeGrpScale.setValue(newScale);\n\n}", "diagnosticFindDuplicateFunctionDeclarations(callableContainersByLowerName) {\n //for each list of callables with the same name\n for (let [lowerName, callableContainers] of callableContainersByLowerName) {\n let globalCallables = [];\n let nonGlobalCallables = [];\n let ownCallables = [];\n let ancestorNonGlobalCallables = [];\n for (let container of callableContainers) {\n if (container.scope === this.program.globalScope) {\n globalCallables.push(container);\n }\n else {\n nonGlobalCallables.push(container);\n if (container.scope === this) {\n ownCallables.push(container);\n }\n else {\n ancestorNonGlobalCallables.push(container);\n }\n }\n }\n //add info diagnostics about child shadowing parent functions\n if (ownCallables.length > 0 && ancestorNonGlobalCallables.length > 0) {\n for (let container of ownCallables) {\n //skip the init function (because every component will have one of those){\n if (lowerName !== 'init') {\n let shadowedCallable = ancestorNonGlobalCallables[ancestorNonGlobalCallables.length - 1];\n if (!!shadowedCallable && shadowedCallable.callable.file === container.callable.file) {\n //same file: skip redundant imports\n continue;\n }\n this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.overridesAncestorFunction(container.callable.name, container.scope.name, shadowedCallable.callable.file.pkgPath, \n //grab the last item in the list, which should be the closest ancestor's version\n shadowedCallable.scope.name)), { range: container.callable.nameRange, file: container.callable.file }));\n }\n }\n }\n //add error diagnostics about duplicate functions in the same scope\n if (ownCallables.length > 1) {\n for (let callableContainer of ownCallables) {\n let callable = callableContainer.callable;\n this.diagnostics.push(Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.duplicateFunctionImplementation(callable.name, callableContainer.scope.name)), { range: util_1.util.createRange(callable.nameRange.start.line, callable.nameRange.start.character, callable.nameRange.start.line, callable.nameRange.end.character), file: callable.file }));\n }\n }\n }\n }", "function userDuplicate() {\n $('.userwarn').html('Username already taken');\n}", "function validateSmsDuplicatePolicyFailure(response) {\n\tnotEqual(response[\"RequestError\"], undefined, \"RequestError\");\n\tre = response[\"RequestError\"];\n\tif (re != null) {\n\t\tnotEqual(re[\"PolicyException\"], undefined, \"PolicyException\");\n\t\tse = re[\"PolicyException\"];\n\t\tif (se != null) {\n\t\t\tequal(se[\"MessageId\"], \"POL0013\", \"MessageId\");\n\t\t\tnotEqual(se[\"Text\"], undefined, \"Text\");\n\t\t\tnotEqual(se[\"Variables\"], undefined, \"Variables\");\n\t\t}\n\t}\n}", "function gLyphsNoUserWarn(message) {\n var main_div = document.getElementById(\"global_panel_layer\");\n if(!main_div) { return; }\n\n var e = window.event\n moveToMouseLoc(e);\n var ypos = toolTipSTYLE.ypos-35;\n if(ypos < 100) { ypos = 100; }\n\n var divFrame = document.createElement('div');\n main_div.appendChild(divFrame);\n divFrame.setAttribute('style', \"position:absolute; background-color:LightYellow; text-align:left; \"\n +\"border:inset; border-width:1px; padding: 3px 7px 3px 7px; \"\n +\"z-index:1; opacity: 0.95; \"\n +\"left:\" + ((winW/2)-200) +\"px; \"\n +\"top:\"+ypos+\"px; \"\n +\"width:400px;\"\n );\n var tdiv = divFrame.appendChild(document.createElement('div'));\n tdiv.setAttribute('style', \"font-size:14px; font-weight:bold;\");\n var tspan = tdiv.appendChild(document.createElement('span'));\n tspan.innerHTML = \"Warning: Not logged into the ZENBU system\";\n\n var a1 = tdiv.appendChild(document.createElement('a'));\n a1.setAttribute(\"target\", \"top\");\n a1.setAttribute(\"href\", \"./\");\n a1.setAttribute(\"onclick\", \"gLyphsSaveConfigParam('cancel'); return false;\");\n var img1 = a1.appendChild(document.createElement('img'));\n img1.setAttribute(\"src\", eedbWebRoot+\"/images/close_icon16px_gray.png\");\n img1.setAttribute(\"style\", \"float: right;\");\n img1.setAttribute(\"width\", \"16\");\n img1.setAttribute(\"height\", \"16\");\n img1.setAttribute(\"alt\",\"close\");\n\n var tdiv = divFrame.appendChild(document.createElement('div'));\n tdiv.setAttribute('style', \"margin-top:10px; font-size:12px;\");\n var tspan = tdiv.appendChild(document.createElement('span'));\n tspan.innerHTML = \"In order to \"+message+\", you must first log into ZENBU.\";\n //tspan.innerHTML += \"<br>Please go to the <a href=\\\"../user/#section=profile\\\">User profile section</a> and either create a profile or login with a previous profile.\";\n eedbLoginAction(\"login\");\n}", "function isNotMarker(data) {\n let dataArr = data;\n var myIcon = L.icon({\n iconUrl: 'images/show/bus.png',\n iconSize: [22, 45],\n iconAnchor: [11, 22],\n popupAnchor: [0, -7]\n });\n\n markers[dataArr['id']] = new L.Marker([dataArr['lat'], dataArr['lng']], {\n title: dataArr[\"id\"],\n icon: myIcon,\n rotationAngle: dataArr['course'],\n rotationOrigin: 'center center',\n \n }).bindPopup(\n 'รายละเอียด' +\n '<br>ทะเบียน : ' +\n data['name'] +\n '<br>ความเร็ว : ' +\n toFixed(data['speed'], 2) +\n '<br>เวลา : ' +\n data['devicetime'] +\n '<br>ตำแหน่ง : ' +\n '<a href=\"http://www.google.com/maps/place/' + toFixed(data['lat'], 5) + ',' + toFixed(data['lng'], 5) + ' \" target=\"_blank\" style=\"color:#515151;\">' + toFixed(data['lat'], 5) + ',' + toFixed(data['lng'], 5) + '</a>' +\n '<br>ที่อยู่ : <i style=\"font-size:12px\">เรียกข้อมูลที่อยู่.....</i>' +\n '<br>รหัสใบขับขี่ : ' +\n devLicense(data['driverLicense']) +\n '<br>เชื่อมต่อกับ : ' + connectDlt(data['connect']) + ' ' + connectPost(data['connect_post']), popupOption\n )\n .bindTooltip(dataArr['name'], {\n permanent: true,\n direction: 'bottom',\n offset: [0, 20],\n interactive: false,\n opacity: 15,\n className: 'tooltip-realtime',\n })\n .openTooltip();\n markers.id = dataArr['id'];\n markers[dataArr['id']].previousLatLngs = [];\n markerGroup.addLayer(markers[dataArr['id']]);\n}", "on_add_stat(stat_name) {\n this.viewer.show_error_popup('Error',`on_add_stat not implemented for ${this.name}`)\n $(this.element).effect('shake')\n }", "warn(msg) {\n if (!bna.quiet) { return log(msg.gray); }\n }", "checkDuplicates(error) {\n if (error.name === \"MongoError\" && error.code === 11000) {\n // check if the error from Mongodb is duplication error\n // eslint-disable-next-line no-useless-escape\n const regex = /index\\:\\ (?:.*\\.)?\\$?(?:([_a-z0-9]*)(?:_\\d*)|([_a-z0-9]*))\\s*dup key/i;\n const match = error.message.match(regex);\n const fieldName = match[1] || match[2];\n return new APIError({\n message: `${fieldName} already exists`,\n status: httpStatus.CONFLICT,\n isPublic: true,\n stack: error.stack,\n });\n }\n return error;\n }", "addLayer(layer) {\n super.addLayer(layer);\n var i = 0;\n this.getLayers().forEach(function(layer) {\n // Layers having zIndex equal to 1000 are overlays.\n if (layer.getZIndex() < 1000) {\n layer.setZIndex(i);\n i++;\n }\n });\n }", "function duplicatePage (model) {\n var sb = ModestBox.get('lightbox');\n var view = new SubmissionSubviews.SubmissionMessageView({\n componentId: model.get('componentId'),\n message: postMsgPack.duplicateContent(),\n offScreenText: postMsgPack.postSubmission_unrecoverableErrorOffScreenText(),\n classList: ['duplicate'],\n icon: '&#x2718;'\n });\n var config = _.extend({}, lightboxOptions, {\n view: view,\n closeUrl: model.closeUrl || null,\n duplicatePage: true\n });\n sb.pushOrOpen(config);\n\n BVTracker.pageview({\n type: 'Product',\n label: 'Lightbox',\n value: 'AlreadySubmitted',\n context: 'Write',\n productId: ProductInfo.getId(this)\n });\n }", "function addMapServerLegend(layerName, layerDetails) {\n\n\n if (layerDetails.wimOptions.layerType === 'agisFeature') {\n\n //for feature layer since default icon is used, put that in legend\n var legendItem = $('<div align=\"left\" id=\"' + camelize(layerName) + '\"><img alt=\"Legend Swatch\" src=\"https://raw.githubusercontent.com/Leaflet/Leaflet/master/dist/images/marker-icon.png\" /><strong>&nbsp;&nbsp;' + layerName + '</strong></br></div>');\n $('#legendDiv').append(legendItem);\n\n }\n\n else if (layerDetails.wimOptions.layerType === 'agisWMS') {\n\n //for WMS layers, for now just add layer title\n var legendItem = $('<div align=\"left\" id=\"' + camelize(layerName) + '\"><img alt=\"Legend Swatch\" src=\"https://placehold.it/25x41\" /><strong>&nbsp;&nbsp;' + layerName + '</strong></br></div>');\n $('#legendDiv').append(legendItem);\n\n }\n\n else if (layerDetails.wimOptions.layerType === 'agisDynamic') {\n\n //create new legend div\n var legendItemDiv = $('<div align=\"left\" id=\"' + camelize(layerName) + '\"><strong>&nbsp;&nbsp;' + layerName + '</strong></br></div>');\n $('#legendDiv').append(legendItemDiv);\n\n //get legend REST endpoint for swatch\n $.getJSON(layerDetails.url + '/legend?f=json', function (legendResponse) {\n\n console.log(layerName,'legendResponse',legendResponse);\n\n\n\n //make list of layers for legend\n if (layerDetails.options.layers) {\n //console.log(layerName, 'has visisble layers property')\n //if there is a layers option included, use that\n var visibleLayers = layerDetails.options.layers;\n }\n else {\n //console.log(layerName, 'no visible layers property', legendResponse)\n\n //create visibleLayers array with everything\n var visibleLayers = [];\n $.grep(legendResponse.layers, function(i,v) {\n visibleLayers.push(v);\n });\n }\n\n //loop over all map service layers\n $.each(legendResponse.layers, function (i, legendLayer) {\n\n //var legendHeader = $('<strong>&nbsp;&nbsp;' + legendLayer.layerName + '</strong>');\n //$('#' + camelize(layerName)).append(legendHeader);\n\n //sub-loop over visible layers property\n $.each(visibleLayers, function (i, visibleLayer) {\n\n //console.log(layerName, 'visibleLayer', visibleLayer);\n\n if (visibleLayer == legendLayer.layerId) {\n\n console.log(layerName, visibleLayer,legendLayer.layerId, legendLayer)\n\n //console.log($('#' + camelize(layerName)).find('<strong>&nbsp;&nbsp;' + legendLayer.layerName + '</strong></br>'))\n\n var legendHeader = $('<strong>&nbsp;&nbsp;' + legendLayer.layerName + '</strong></br>');\n $('#' + camelize(layerName)).append(legendHeader);\n\n //get legend object\n var feature = legendLayer.legend;\n /*\n //build legend html for categorized feautres\n if (feature.length > 1) {\n */\n\n //placeholder icon\n //<img alt=\"Legend Swatch\" src=\"http://placehold.it/25x41\" />\n\n $.each(feature, function () {\n\n //make sure there is a legend swatch\n if (this.imageData) {\n var legendFeature = $('<img alt=\"Legend Swatch\" src=\"data:image/png;base64,' + this.imageData + '\" /><small>' + this.label.replace('<', '').replace('>', '') + '</small></br>');\n\n $('#' + camelize(layerName)).append(legendFeature);\n }\n });\n /*\n }\n //single features\n else {\n var legendFeature = $('<img alt=\"Legend Swatch\" src=\"data:image/png;base64,' + feature[0].imageData + '\" /><small>&nbsp;&nbsp;' + legendLayer.layerName + '</small></br>');\n\n //$('#legendDiv').append(legendItem);\n $('#' + camelize(layerName)).append(legendFeature);\n\n }\n */\n }\n }); //each visible layer\n }); //each legend item\n }); //get legend json\n }\n }", "conflicts() {\n this.log('conflicts');\n }", "removeToChangeLayers(){\n if (this.map && !this.map.isStyleLoaded()) return;\n this.props.statuses.forEach(status => {\n if (status.key !== 'no_change'){\n status.layers.forEach(layer => {\n if (this.map.getLayer(layer)) {\n this.map.removeLayer(layer);\n }\n });\n }\n });\n }", "function addLayer(layer){\n\n //Initialize a bunch of variables\n layer.loadError = false;\n\tvar id = layer.legendDivID;\n layer.id = id;\n var queryID = id + '-'+layer.ID;\n\tvar containerID = id + '-container-'+layer.ID;\n\tvar opacityID = id + '-opacity-'+layer.ID;\n\tvar visibleID = id + '-visible-'+layer.ID;\n\tvar spanID = id + '-span-'+layer.ID;\n\tvar visibleLabelID = visibleID + '-label-'+layer.ID;\n\tvar spinnerID = id + '-spinner-'+layer.ID;\n var selectionID = id + '-selection-list-'+layer.ID;\n\tvar checked = '';\n layerObj[id] = layer;\n layer.wasJittered = false;\n layer.loading = false;\n layer.refreshNumber = refreshNumber;\n\tif(layer.visible){checked = 'checked'}\n \n if(layer.viz.isTimeLapse){\n // console.log(timeLapseObj[layer.viz.timeLapseID]);\n timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.push(id);\n timeLapseObj[layer.viz.timeLapseID].sliders.push(opacityID);\n timeLapseObj[layer.viz.timeLapseID].layerVisibleIDs.push(visibleID);\n\n }\n\n //Set up layer control container\n\t$('#'+ layer.whichLayerList).prepend(`<li id = '${containerID}'class = 'layer-container' rel=\"txtTooltip\" data-toggle=\"tooltip\" title= '${layer.helpBoxMessage}'>\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t <div id=\"${opacityID}\" class = 'simple-layer-opacity-range'></div>\n\t\t\t\t\t\t\t\t <input id=\"${visibleID}\" type=\"checkbox\" ${checked} />\n\t\t\t\t\t\t\t\t <label class = 'layer-checkbox' id=\"${visibleLabelID}\" style = 'margin-bottom:0px;display:none;' for=\"${visibleID}\"></label>\n\t\t\t\t\t\t\t\t <i id = \"${spinnerID}\" class=\"fa fa-spinner fa-spin layer-spinner\" rel=\"txtTooltip\" data-toggle=\"tooltip\" title='Waiting for layer service from Google Earth Engine'></i>\n\t\t\t\t\t\t\t\t <i id = \"${spinnerID}2\" style = 'display:none;' class=\"fa fa-cog fa-spin layer-spinner\" rel=\"txtTooltip\" data-toggle=\"tooltip\" title='Waiting for map tiles from Google Earth Engine'></i>\n\t\t\t\t\t\t\t\t <i id = \"${spinnerID}3\" style = 'display:none;' class=\"fa fa-cog fa-spin layer-spinner\" rel=\"txtTooltip\" data-toggle=\"tooltip\" title='Waiting for map tiles from Google Earth Engine'></i>\n \n\t\t\t\t\t\t\t\t <span id = '${spanID}' class = 'layer-span'>${layer.name}</span>\n\t\t\t\t\t\t\t\t </li>`);\n //Set up opacity slider\n\t$(\"#\"+opacityID).slider({\n min: 0,\n max: 100,\n step: 1,\n value: layer.opacity*100,\n \tslide: function(e,ui){\n \t\tlayer.opacity = ui.value/100;\n \t\t// console.log(layer.opacity);\n \t\t if(layer.layerType !== 'geeVector' && layer.layerType !== 'geoJSONVector'){\n layer.layer.setOpacity(layer.opacity);\n \n \n }else{\n \t var style = layer.layer.getStyle();\n \t style.strokeOpacity = layer.opacity;\n \t style.fillOpacity = layer.opacity/layer.viz.opacityRatio;\n \t layer.layer.setStyle(style);\n \t if(layer.visible){layer.range}\n }\n if(layer.visible){\n \tlayer.rangeOpacity = layer.opacity;\n } \n layerObj[id].visible = layer.visible;\n layerObj[id].opacity = layer.opacity;\n \t\tsetRangeSliderThumbOpacity();\n \t\t}\n\t})\n\tfunction setRangeSliderThumbOpacity(){\n\t\t$('#'+opacityID).css(\"background-color\", 'rgba(55, 46, 44,'+layer.rangeOpacity+')')\n\t}\n //Progress bar controller\n\tfunction updateProgress(){\n\t\tvar pct = layer.percent;\n if(pct === 100 && (layer.layerType === 'geeImage' || layer.layerType === 'geeVectorImage' || layer.layerType === 'geeImageCollection')){jitterZoom()}\n\t\t$('#'+containerID).css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${pct}%, transparent ${pct}%, transparent 100%)`)\n\t}\n\t//Function for zooming to object\n\tfunction zoomFunction(){\n\n\t\tif(layer.layerType === 'geeVector' ){\n\t\t\tcenterObject(layer.item)\n\t\t}else if(layer.layerType === 'geoJSONVector'){\n\t\t\t// centerObject(ee.FeatureCollection(layer.item.features.map(function(t){return ee.Feature(t).dissolve(100,ee.Projection('EPSG:4326'))})).geometry().bounds())\n\t\t\t// synchronousCenterObject(layer.item.features[0].geometry)\n\t\t}else{\n \n\t\t\tif(layer.item.args !== undefined && layer.item.args.value !== null && layer.item.args.value !== undefined){\n\t\t\t\tsynchronousCenterObject(layer.item.args.value)\n\t\t\t}\n else if(layer.item.args !== undefined &&layer.item.args.featureCollection !== undefined &&layer.item.args.featureCollection.args !== undefined && layer.item.args.featureCollection.args.value !== undefined && layer.item.args.featureCollection.args.value !== undefined){\n synchronousCenterObject(layer.item.args.featureCollection.args.value);\n };\n\t\t}\n\t}\n //Try to handle load failures\n function loadFailure(failure){\n layer.loadError = true;\n console.log('GEE Tile Service request failed for '+layer.name);\n console.log(containerID)\n $('#'+containerID).css('background','red');\n $('#'+containerID).attr('title','Layer failed to load. Error message: \"'+failure + '\"')\n // getGEEMapService();\n }\n //Function to handle turning off of different types of layers\n function turnOff(){\n ga('send', 'event', 'layer-off', layer.layerType,layer.name);\n if(layer.layerType === 'dynamicMapService'){\n layer.layer.setMap(null);\n layer.visible = false;\n layer.percent = 0;\n layer.rangeOpacity = 0;\n setRangeSliderThumbOpacity();\n updateProgress();\n $('#'+layer.legendDivID).hide();\n } else if(layer.layerType !== 'geeVector' && layer.layerType !== 'geoJSONVector'){\n layer.visible = false;\n layer.map.overlayMapTypes.setAt(layer.layerId,null);\n layer.percent = 0;\n updateProgress();\n $('#'+layer.legendDivID).hide();\n layer.rangeOpacity = 0;\n if(layer.layerType !== 'tileMapService' && layer.layerType !== 'dynamicMapService' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n }else{\n layer.visible = false;\n \n layer.percent = 0;\n updateProgress();\n $('#'+layer.legendDivID).hide();\n layer.layer.setMap(null);\n layer.rangeOpacity = 0;\n $('#' + spinnerID+'2').hide();\n // geeTileLayersDownloading = 0;\n // updateGEETileLayersLoading();\n if(layer.layerType === 'geeVector' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n \n }\n layer.loading = false;\n updateGEETileLayersDownloading();\n \n $('#'+spinnerID + '2').hide();\n $('#'+spinnerID + '3').hide();\n vizToggleCleanup();\n }\n //Function to handle turning on different layer types\n function turnOn(){\n ga('send', 'event', 'layer-on', layer.layerType,layer.name);\n if(!layer.viz.isTimeLapse){\n turnOffTimeLapseCheckboxes();\n }\n if(layer.layerType === 'dynamicMapService'){\n layer.layer.setMap(map);\n layer.visible = true;\n layer.percent = 100;\n layer.rangeOpacity = layer.opacity;\n setRangeSliderThumbOpacity();\n updateProgress();\n $('#'+layer.legendDivID).show();\n } else if(layer.layerType !== 'geeVector' && layer.layerType !== 'geoJSONVector'){\n layer.visible = true;\n layer.map.overlayMapTypes.setAt(layer.layerId,layer.layer);\n $('#'+layer.legendDivID).show();\n layer.rangeOpacity = layer.opacity;\n if(layer.isTileMapService){layer.percent = 100;updateProgress();}\n layer.layer.setOpacity(layer.opacity); \n if(layer.layerType !== 'tileMapService' && layer.layerType !== 'dynamicMapService' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n }else{\n\n layer.visible = true;\n layer.percent = 100;\n updateProgress();\n $('#'+layer.legendDivID).show();\n layer.layer.setMap(layer.map);\n layer.rangeOpacity = layer.opacity;\n if(layer.layerType === 'geeVector' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n }\n vizToggleCleanup();\n }\n //Some functions to keep layers tidy\n function vizToggleCleanup(){\n setRangeSliderThumbOpacity();\n layerObj[id].visible = layer.visible;\n layerObj[id].opacity = layer.opacity;\n }\n\tfunction checkFunction(){\n if(!layer.loadError){\n if(layer.visible){\n turnOff();\n }else{turnOn()} \n }\n \n\t}\n function turnOffAll(){ \n if(layer.visible){\n $('#'+visibleID).click();\n }\n }\n function turnOnAll(){\n if(!layer.visible){\n $('#'+visibleID).click();\n }\n }\n\t$(\"#\"+ opacityID).val(layer.opacity * 100);\n\n //Handle double clicking\n\tvar prevent = false;\n\tvar delay = 200;\n\t$('#'+ spanID).click(function(){\n\t\tsetTimeout(function(){\n\t\t\tif(!prevent){\n\t\t\t\t$('#'+visibleID).click();\n\t\t\t}\n\t\t},delay)\n\t\t\n\t});\n $('#'+ spinnerID + '2').click(function(){$('#'+visibleID).click();});\n //Try to zoom to layer if double clicked\n\t$('#'+ spanID).dblclick(function(){\n zoomFunction();\n\t\t\tprevent = true;\n\t\t\tzoomFunction();\n\t\t\tif(!layer.visible){$('#'+visibleID).click();}\n\t\t\tsetTimeout(function(){prevent = false},delay)\n\t\t})\n\n\t//If checkbox is toggled\n\t$('#'+visibleID).change( function() {checkFunction();});\n \n\n\tlayerObj[id].visible = layer.visible;\n layerObj[id].opacity = layer.opacity;\n\t\n //Handle different scenarios where all layers need turned off or on\n if(!layer.viz.isTimeLapse){\n $('.layer-checkbox').on('turnOffAll',function(){turnOffAll()});\n }\n if(layer.layerType === 'geeVector' || layer.layerType === 'geeVectorImage' || layer.layerType === 'geoJSONVector'){\n $('#'+visibleLabelID).addClass('vector-layer-checkbox');\n $('.vector-layer-checkbox').on('turnOffAll',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAll',function(){turnOnAll()});\n $('.vector-layer-checkbox').on('turnOffAllVectors',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllVectors',function(){turnOnAll()});\n\n if(layer.viz.isUploadedLayer){\n $('#'+visibleLabelID).addClass('uploaded-layer-checkbox');\n selectionTracker.uploadedLayerIndices.push(layer.layerId)\n $('.vector-layer-checkbox').on('turnOffAllUploadedLayers',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllUploadedLayers',function(){turnOnAll()});\n }\n }\n\n //Handle different object types\n\tif(layer.layerType === 'geeImage' || layer.layerType === 'geeVectorImage' || layer.layerType === 'geeImageCollection'){\n //Handle image colletions\n if(layer.layerType === 'geeImageCollection'){\n // layer.item = ee.ImageCollection(layer.item);\n layer.imageCollection = layer.item;\n\n if(layer.viz.reducer === null || layer.viz.reducer === undefined){\n layer.viz.reducer = ee.Reducer.lastNonNull();\n }\n var bandNames = ee.Image(layer.item.first()).bandNames();\n layer.item = ee.ImageCollection(layer.item).reduce(layer.viz.reducer).rename(bandNames).copyProperties(layer.imageCollection.first());\n \n //Handle vectors\n } else if(layer.layerType === 'geeVectorImage' || layer.layerType === 'geeVector'){\n\n if(layer.viz.isSelectLayer){\n \n selectedFeaturesJSON[layer.name] = {'layerName':layer.name,'filterList':[],'geoJSON':new google.maps.Data(),'id':layer.id,'rawGeoJSON':{},'selection':ee.FeatureCollection([])}\n // selectedFeaturesJSON[layer.name].geoJSON.setMap(layer.map);\n\n // layer.infoWindow = getInfoWindow(infoWindowXOffset);\n // infoWindowXOffset += 30;\n // selectedFeaturesJSON[layer.name].geoJSON.setStyle({strokeColor:invertColor(layer.viz.strokeColor)});\n // layer.queryVector = layer.item; \n $('#'+visibleLabelID).addClass('select-layer-checkbox');\n $('.vector-layer-checkbox').on('turnOffAllSelectLayers',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllSelectLayers',function(){turnOnAll()});\n $('.vector-layer-checkbox').on('turnOffAll',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAll',function(){turnOnAll()});\n }\n layer.queryItem = layer.item;\n if(layer.layerType === 'geeVectorImage'){\n layer.item = ee.Image().paint(layer.item,null,layer.viz.strokeWeight);\n layer.viz.palette = layer.viz.strokeColor;\n }\n //Add functionality for select layers to be clicked and selected\n if(layer.viz.isSelectLayer){\n var name;\n layer.queryItem.first().propertyNames().evaluate(function(propertyNames,failure){\n if(failure !== undefined){showMessage('Error',failure)}\n else{\n propertyNames.map(function(p){\n if(p.toLowerCase().indexOf('name') !== -1){name = p}\n })\n if(name === undefined){name = 'system:index'}\n }\n selectedFeaturesJSON[layer.name].fieldName = name\n selectedFeaturesJSON[layer.name].eeObject = layer.queryItem.select([name],['name'])\n })\n \n }\n if(layer.viz.isSelectedLayer){\n $('#'+visibleLabelID).addClass('selected-layer-checkbox');\n $('.vector-layer-checkbox').on('turnOffAllSelectLayers',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllSelectLayers',function(){turnOnAll()});\n $('.vector-layer-checkbox').on('turnOffAllSelectedLayers',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllSelectedLayers',function(){turnOnAll()});\n selectionTracker.seletedFeatureLayerIndices.push(layer.layerId)\n }\n \n // // selectedFeaturesJSON[layer.name].geoJSON.addListener('click',function(event){\n // // console.log(event);\n // // var name = event.feature.j.selectionTrackingName;\n // // delete selectedFeaturesJSON[layer.name].rawGeoJSON[name]\n // // selectedFeaturesJSON[layer.name].geoJSON.remove(event.feature);\n // // updateSelectedAreasNameList();\n // // updateSelectedAreaArea();\n\n // // });\n // var name;\n // layer.queryItem.first().propertyNames().evaluate(function(propertyNames,failure){\n // if(failure !== undefined){showMessage('Error',failure)}\n // else{\n // propertyNames.map(function(p){\n // if(p.toLowerCase().indexOf('name') !== -1){name = p}\n // })\n // if(name === undefined){name = 'system:index'}\n // }\n \n // })\n // printEE(propertyNames);\n // // map.addListener('click',function(event){\n // // // console.log(layer.name);console.log(event);\n // // if(layer.currentGEERunID === geeRunID){\n \n // // if(layer.visible && toolFunctions.area.selectInteractive.state){\n // // $('#'+spinnerID + '3').show();\n // // $('#select-features-list-spinner').show();\n // // // layer.queryGeoJSON.forEach(function(f){layer.queryGeoJSON.remove(f)});\n\n // // var features = layer.queryItem.filterBounds(ee.Geometry.Point([event.latLng.lng(),event.latLng.lat()]));\n // // selectedFeaturesJSON[layer.name].eeFeatureCollection =selectedFeaturesJSON[layer.name].eeFeatureCollection.merge(features);\n // // var propertyNames = selectedFeaturesJSON[layer.name].eeFeatureCollection.first().propertyNames();\n // // printEE(propertyNames);\n // // // features.evaluate(function(values,failure){\n // // // if(failure !== undefined){showMessage('Error',failure);}\n // // // else{\n // // // console.log\n // // // }\n // // // var features = values.features;\n // // // var dummyNameI = 1;\n // // // features.map(function(f){\n // // // var name;\n // // // // selectedFeatures.features.push(f);\n // // // Object.keys(f.properties).map(function(p){\n // // // if(p.toLowerCase().indexOf('name') !== -1){name = f.properties[p]}\n // // // })\n // // // if(name === undefined){name = dummyNameI.toString();dummyNameI++;}\n // // // // console.log(name)\n // // // if(name !== undefined){\n // // // }\n // // // if(getSelectedAreasNameList(false).indexOf(name) !== -1){\n // // // name += '-'+selectionUNID.toString();\n // // // selectionUNID++;\n // // // }\n // // // f.properties.selectionTrackingName = name\n \n\n // // // selectedFeaturesJSON[layer.name].geoJSON.addGeoJson(f);\n // // // selectedFeaturesJSON[layer.name].rawGeoJSON[name]= f;\n // // // });\n // // // updateSelectedAreasNameList(); \n \n // // // $('#'+spinnerID + '3').hide();\n // // // $('#select-features-list-spinner').hide();\n // // // updateSelectedAreaArea();\n // // // })\n // // }\n // // }\n \n // // })\n // } \n };\n //Add layer to query object if it can be queried\n if(layer.canQuery){\n queryObj[queryID] = {'visible':layer.visible,'queryItem':layer.queryItem,'queryDict':layer.viz.queryDict,'type':layer.layerType,'name':layer.name}; \n }\n\t\tincrementOutstandingGEERequests();\n\n\t\t//Handle creating GEE map services\n\t\tfunction getGEEMapServiceCallback(eeLayer){\n decrementOutstandingGEERequests();\n $('#' + spinnerID).hide();\n if(layer.viz.isTimeLapse){\n timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs = timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.filter(timeLapseLayerID => timeLapseLayerID !== id)\n var prop = parseInt((1-timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length /timeLapseObj[layer.viz.timeLapseID].nFrames)*100);\n // $('#'+layer.viz.timeLapseID+'-loading-progress').css('width', prop+'%').attr('aria-valuenow', prop).html(prop+'% frames loaded'); \n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${prop}%, transparent ${prop}%, transparent 100%)`)\n \n // $('#'+layer.viz.timeLapseID+'-loading-count').html(`${timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length}/${timeLapseObj[layer.viz.timeLapseID].nFrames} layers to load`)\n if(timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length === 0){\n $('#'+layer.viz.timeLapseID+'-loading-spinner').hide();\n $('#'+layer.viz.timeLapseID+'-year-label').hide();\n // $('#'+layer.viz.timeLapseID+'-loading-progress-container').hide();\n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${0}%, transparent ${0}%, transparent 100%)`)\n \n // $('#'+layer.viz.timeLapseID+'-icon-bar').show();\n // $('#'+layer.viz.timeLapseID+'-time-lapse-layer-range-container').show();\n $('#'+layer.viz.timeLapseID+'-toggle-checkbox-label').show();\n \n \n timeLapseObj[layer.viz.timeLapseID].isReady = true;\n };\n }\n $('#' + visibleLabelID).show();\n \n if(layer.currentGEERunID === geeRunID){\n if(eeLayer === undefined){\n loadFailure();\n }\n else{\n //Set up GEE map service\n var MAPID = eeLayer.mapid;\n var TOKEN = eeLayer.token;\n layer.highWaterMark = 0;\n var tileIncremented = false;\n var eeTileSource = new ee.layers.EarthEngineTileSource(eeLayer);\n // console.log(eeTileSource)\n layer.layer = new ee.layers.ImageOverlay(eeTileSource)\n var overlay = layer.layer;\n //Set up callback to keep track of tile downloading\n layer.layer.addTileCallback(function(event){\n\n event.count = event.loadingTileCount;\n if(event.count > layer.highWaterMark){\n layer.highWaterMark = event.count;\n }\n\n layer.percent = 100-((event.count / layer.highWaterMark) * 100);\n if(event.count ===0 && layer.highWaterMark !== 0){layer.highWaterMark = 0}\n\n if(layer.percent !== 100){\n layer.loading = true;\n $('#' + spinnerID+'2').show();\n if(!tileIncremented){\n incrementGEETileLayersLoading();\n tileIncremented = true;\n if(layer.viz.isTimeLapse){\n timeLapseObj[layer.viz.timeLapseID].loadingTilesLayerIDs.push(id);\n\n }\n }\n }else{\n layer.loading = false;\n $('#' + spinnerID+'2').hide();\n decrementGEETileLayersLoading();\n if(layer.viz.isTimeLapse){\n timeLapseObj[layer.viz.timeLapseID].loadingTilesLayerIDs = timeLapseObj[layer.viz.timeLapseID].loadingTilesLayerIDs.filter(timeLapseLayerID => timeLapseLayerID !== id)\n \n }\n tileIncremented = false;\n }\n //Handle the setup of layers within a time lapse\n if(layer.viz.isTimeLapse){\n var loadingTimelapseLayers = Object.values(layerObj).filter(function(v){return v.loading && v.viz.isTimeLapse && v.whichLayerList === layer.whichLayerList});\n var loadingTimelapseLayersYears = loadingTimelapseLayers.map(function(f){return [f.viz.year,f.percent].join(':')}).join(', ');\n var notLoadingTimelapseLayers = Object.values(layerObj).filter(function(v){return !v.loading && v.viz.isTimeLapse && v.whichLayerList === layer.whichLayerList});\n var notLoadingTimelapseLayersYears = notLoadingTimelapseLayers.map(function(f){return [f.viz.year,f.percent].join(':')}).join(', ');\n $('#'+layer.viz.timeLapseID + '-message-div').html('Loading:<br>'+loadingTimelapseLayersYears+'<hr>Not Loading:<br>'+notLoadingTimelapseLayersYears);\n var propTiles = parseInt((1-(timeLapseObj[layer.viz.timeLapseID].loadingTilesLayerIDs.length/timeLapseObj[layer.viz.timeLapseID].nFrames))*100);\n // $('#'+layer.viz.timeLapseID+'-loading-progress').css('width', propTiles+'%').attr('aria-valuenow', propTiles).html(propTiles+'% tiles loaded');\n $('#'+layer.viz.timeLapseID+ '-loading-gear').show();\n \n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(90deg, #FFF, #FFF ${propTiles}%, transparent ${propTiles}%, transparent 100%)`)\n if(propTiles < 100){\n // console.log(propTiles)\n // if(timeLapseObj[layer.viz.timeLapseID] === 'play'){\n // pauseButtonFunction(); \n // }\n }else{\n $('#'+layer.viz.timeLapseID+ '-loading-gear').hide();\n }\n }\n\n // var loadingLayers = Object.values(layerObj).filter(function(v){return v.loading});\n // console.log(loadingLayers);\n updateProgress();\n // console.log(event.count);\n // console.log(inst.highWaterMark);\n // console.log(event.count / inst.highWaterMark);\n // console.log(layer.percent)\n });\n if(layer.visible){\n layer.map.overlayMapTypes.setAt(layer.layerId, layer.layer);\n $('#'+layer.legendDivID).show();\n layer.rangeOpacity = layer.opacity; \n \n layer.layer.setOpacity(layer.opacity); \n }else{\n $('#'+layer.legendDivID).hide();\n layer.rangeOpacity = 0;\n \n }\n setRangeSliderThumbOpacity(); \n }\n \n }\n }\n function updateTimeLapseLoadingProgress(){\n var loadingTimelapseLayers = Object.values(layerObj).filter(function(v){return v.loading && v.viz.isTimeLapse && v.whichLayerList === layer.whichLayerList}).length;\n var notLoadingTimelapseLayers = Object.values(layerObj).filter(function(v){return !v.loading && v.viz.isTimeLapse && v.whichLayerList === layer.whichLayerList}).length;\n var total = loadingTimelapseLayers+notLoadingTimelapseLayers\n var propTiles = (1-(loadingTimelapseLayers/timeLapseObj[layer.viz.timeLapseID].nFrames))*100\n \n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(0deg, #FFF, #FFF ${propTiles}%, transparent ${propTiles}%, transparent 100%)`)\n if(propTiles < 100){\n $('#'+layer.viz.timeLapseID+ '-loading-gear').show();\n // console.log(propTiles)\n // if(timeLapseObj[layer.viz.timeLapseID] === 'play'){\n // pauseButtonFunction(); \n // }\n }else{\n $('#'+layer.viz.timeLapseID+ '-loading-gear').hide();\n }\n }\n //Handle alternative GEE tile service format\n function geeAltService(eeLayer,failure){\n decrementOutstandingGEERequests();\n $('#' + spinnerID).hide();\n if(layer.viz.isTimeLapse){\n timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs = timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.filter(timeLapseLayerID => timeLapseLayerID !== id)\n var prop = parseInt((1-timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length /timeLapseObj[layer.viz.timeLapseID].nFrames)*100);\n // $('#'+layer.viz.timeLapseID+'-loading-progress').css('width', prop+'%').attr('aria-valuenow', prop).html(prop+'% frames loaded'); \n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${prop}%, transparent ${prop}%, transparent 100%)`)\n \n // $('#'+layer.viz.timeLapseID+'-loading-count').html(`${timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length}/${timeLapseObj[layer.viz.timeLapseID].nFrames} layers to load`)\n if(timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length === 0){\n $('#'+layer.viz.timeLapseID+'-loading-spinner').hide();\n $('#'+layer.viz.timeLapseID+'-year-label').hide();\n // $('#'+layer.viz.timeLapseID+'-loading-progress-container').hide();\n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${0}%, transparent ${0}%, transparent 100%)`)\n \n // $('#'+layer.viz.timeLapseID+'-icon-bar').show();\n // $('#'+layer.viz.timeLapseID+'-time-lapse-layer-range-container').show();\n $('#'+layer.viz.timeLapseID+'-toggle-checkbox-label').show();\n \n \n timeLapseObj[layer.viz.timeLapseID].isReady = true;\n };\n }\n $('#' + visibleLabelID).show();\n \n if(layer.currentGEERunID === geeRunID){\n if(eeLayer === undefined || failure !== undefined){\n loadFailure(failure);\n }\n else{\n const tilesUrl = eeLayer.urlFormat;\n \n var getTileUrlFun = function(coord, zoom) {\n var t = [coord,zoom];\n \n \n let url = tilesUrl\n .replace('{x}', coord.x)\n .replace('{y}', coord.y)\n .replace('{z}', zoom);\n if(!layer.loading){\n layer.loading = true;\n layer.percent = 10;\n $('#' + spinnerID+'2').show();\n updateGEETileLayersDownloading();\n updateProgress();\n if(layer.viz.isTimeLapse){\n updateTimeLapseLoadingProgress(); \n }\n }\n \n return url\n }\n layer.layer = new google.maps.ImageMapType({\n getTileUrl:getTileUrlFun\n })\n\n layer.layer.addListener('tilesloaded',function(){\n layer.percent = 100;\n layer.loading = false;\n \n \n $('#' + spinnerID+'2').hide();\n updateGEETileLayersDownloading();\n updateProgress();\n if(layer.viz.isTimeLapse){\n updateTimeLapseLoadingProgress(); \n }\n })\n \n \n if(layer.visible){\n layer.map.overlayMapTypes.setAt(layer.layerId, layer.layer);\n layer.rangeOpacity = layer.opacity; \n layer.layer.setOpacity(layer.opacity);\n $('#'+layer.legendDivID).show();\n }else{layer.rangeOpacity = 0;}\n $('#' + spinnerID).hide();\n $('#' + visibleLabelID).show();\n\n setRangeSliderThumbOpacity();\n }\n }\n }\n //Asynchronous wrapper function to get GEE map service\n layer.mapServiceTryNumber = 0;\n function getGEEMapService(){\n // layer.item.getMap(layer.viz,function(eeLayer){getGEEMapServiceCallback(eeLayer)});\n \n //Handle embeded visualization params if available\n var vizKeys = Object.keys(layer.viz);\n var possibleVizKeys = ['bands','min','max','gain','bias','gamma','palette'];\n var vizFound = false;\n possibleVizKeys.map(function(k){\n var i = vizKeys.indexOf(k) > -1;\n if(i){vizFound = true}\n });\n \n if(vizFound == false){layer.usedViz = {}}\n else{layer.usedViz = layer.viz}\n // console.log(layer.usedViz);\n ee.Image(layer.item).getMap(layer.usedViz,function(eeLayer,failure){\n if(eeLayer === undefined && layer.mapServiceTryNumber <=1){\n queryObj[queryID].queryItem = layer.item;\n layer.item = layer.item.visualize();\n getGEEMapService();\n }else{\n geeAltService(eeLayer,failure);\n } \n });\n\n // layer.item.getMap(layer.viz,function(eeLayer){\n // console.log(eeLayer)\n // console.log(ee.data.getTileUrl(eeLayer))\n // })\n layer.mapServiceTryNumber++;\n };\n getGEEMapService();\n\n //Handle different vector formats\n\t}else if(layer.layerType === 'geeVector' || layer.layerType === 'geoJSONVector'){\n if(layer.canQuery){\n queryObj[queryID] = {'visible':layer.visible,'queryItem':layer.queryItem,'queryDict':layer.viz.queryDict,'type':layer.layerType,'name':layer.name}; \n }\n\t\tincrementOutstandingGEERequests();\n //Handle adding geoJSON to map\n\t\tfunction addGeoJsonToMap(v){\n\t\t\t$('#' + spinnerID).hide();\n\t\t\t$('#' + visibleLabelID).show();\n\n\t\t\tif(layer.currentGEERunID === geeRunID){\n if(v === undefined){loadFailure()}\n\t\t\t\tlayer.layer = new google.maps.Data();\n // layer.viz.icon = {\n // path: google.maps.SymbolPath.BACKWARD_CLOSED_ARROW,\n // scale: 5,\n // strokeWeight:2,\n // strokeColor:\"#B40404\"\n // }\n\t\t layer.layer.setStyle(layer.viz);\n\t\t \n\t\t \tlayer.layer.addGeoJson(v);\n if(layer.viz.clickQuery){\n map.addListener('click',function(){\n infowindow.setMap(null);\n })\n layer.layer.addListener('click', function(event) {\n console.log(event);\n infowindow.setPosition(event.latLng);\n var infoContent = `<table class=\"table table-hover bg-white\">\n <tbody>`\n var info = event.feature.h;\n Object.keys(info).map(function(name){\n var value = info[name];\n infoContent +=`<tr><th>${name}</th><td>${value}</td></tr>`;\n });\n infoContent +=`</tbody></table>`;\n infowindow.setContent(infoContent);\n infowindow.open(map);\n }) \n }\n\t\t \tfeatureObj[layer.name] = layer.layer\n\t\t \t// console.log(this.viz);\n\t\t \n\t\t \tif(layer.visible){\n\t\t \tlayer.layer.setMap(layer.map);\n\t\t \tlayer.rangeOpacity = layer.viz.strokeOpacity;\n\t\t \tlayer.percent = 100;\n\t\t \tupdateProgress();\n\t\t \t$('#'+layer.legendDivID).show();\n\t\t \t}else{\n\t\t \tlayer.rangeOpacity = 0;\n\t\t \tlayer.percent = 0;\n\t\t \t$('#'+layer.legendDivID).hide();\n\t\t \t\t}\n\t\t \tsetRangeSliderThumbOpacity();\n\t\t \t}\n \t\t}\n \t\tif(layer.layerType === 'geeVector'){\n decrementOutstandingGEERequests();\n \t\t\tlayer.item.evaluate(function(v){addGeoJsonToMap(v)})\n \t\t}else{decrementOutstandingGEERequests();addGeoJsonToMap(layer.item)}\n\t//Handle non GEE tile services\t\n\t}else if(layer.layerType === 'tileMapService'){\n\t\tlayer.layer = new google.maps.ImageMapType({\n getTileUrl: layer.item,\n tileSize: new google.maps.Size(256, 256),\n // tileSize: new google.maps.Size($('#map').width(),$('#map').height()),\n maxZoom: 15\n \n })\n\t\tif(layer.visible){\n \t\n \tlayer.map.overlayMapTypes.setAt(layer.layerId, layer.layer);\n \tlayer.rangeOpacity = layer.opacity; \n \tlayer.layer.setOpacity(layer.opacity); \n }else{layer.rangeOpacity = 0;}\n $('#' + spinnerID).hide();\n\t\t\t$('#' + visibleLabelID).show();\n\t\t\tsetRangeSliderThumbOpacity();\n \n\t//Handle dynamic map services\n\t}else if(layer.layerType === 'dynamicMapService'){\n\t\tfunction groundOverlayWrapper(){\n\t if(map.getZoom() > layer.item[1].minZoom){\n\t return getGroundOverlay(layer.item[1].baseURL,layer.item[1].minZoom)\n\t }\n\t else{\n\t return getGroundOverlay(layer.item[0].baseURL,layer.item[0].minZoom)\n\t }\n\t };\n\t function updateGroundOverlay(){\n if(layer.layer !== null && layer.layer !== undefined){\n layer.layer.setMap(null);\n }\n \n layer.layer =groundOverlayWrapper();\n if(layer.visible){\n \tlayer.layer.setMap(map);\n \tlayer.percent = 100;\n\t\t\t\t\tupdateProgress();\n \tgroundOverlayOn = true\n \t\t$('#'+layer.legendDivID).show();\n \tlayer.layer.setOpacity(layer.opacity);\n \tlayer.rangeOpacity = layer.opacity;\n \t\n }else{layer.rangeOpacity = 0};\n setRangeSliderThumbOpacity(); \n\n };\n updateGroundOverlay();\n // if(layer.visible){layer.opacity = 1}\n // else{this.opacity = 0}\n google.maps.event.addListener(map,'zoom_changed',function(){updateGroundOverlay()});\n\n google.maps.event.addListener(map,'dragend',function(){updateGroundOverlay()});\n $('#' + spinnerID).hide();\n\t\t\t$('#' + visibleLabelID).show();\n\t\t\tsetRangeSliderThumbOpacity();\n\t}\n}", "function markDuplicateOfResidualStyling(tNode, tStylingKey, tData, index, isClassBinding) {\n var residual = isClassBinding ? tNode.residualClasses : tNode.residualStyles;\n\n if (residual != null\n /* or undefined */\n && typeof tStylingKey == 'string' && keyValueArrayIndexOf(residual, tStylingKey) >= 0) {\n // We have duplicate in the residual so mark ourselves as duplicate.\n tData[index + 1] = setTStylingRangeNextDuplicate(tData[index + 1]);\n }\n }", "function addLayer(isyLayer) {\n layerHandler.AddLayer(isyLayer);\n }", "function leaveLayer(){\n this.setStyle({ weight: 0.5 });\n // method that we will use to reset the tooltip feature\n info.update = function () {\n this._div.innerHTML = 'Hover over a country for more information';\n };\n info.addTo(map0);\n }", "removeLayer() {\n if (this.__shown) {\n const map = this.map;\n map.removeLayer(this.uniqueId + 'fillpoly');\n this.__shown = false;\n }\n }", "warn (msg, ...rest) {\n if (_shouldOutputMessage(this, \"warning\", \"warnings\")) {\n console.warn(this.theme.warning(`${this.getContextName()} warns:`, msg), ...rest);\n }\n return this;\n }", "function getTrainingWarningMsg(attName, gain) {\n var ret = '';\n if (getTrainingStatus(attName)+gain < 100) {\n if (getTrainingStatus(attName)+(Math.round(gain*1.1)) >= 100) {\n //ret += ' *** Warning : A training breakthrough could cause rollover.<br/>';\n ret += '<br/>';\n } else {\n ret += '<br/>';\n }\n } else {\n ret += ' *** Training will cause rollover.<br/>';\n }\n return ret;\n}", "function DisplayMultiTabError() {\n let overlay = $('#overlay')\n let popup = $('#dialog').html('')\n\n if (overlay.css('display') == 'none')\n overlay.removeAttr('style')\n $(window).off('keydown')\n\n popup.append('You are already connected from this browser. If you want to connect as another client try incognito mode or other browsers')\n\n popup.dialog({\n closeOnEscape: false,\n modal: true,\n draggable: false,\n resizable: false,\n dialogClass: 'no-close ui-dialog-errormsg',\n width: 500,\n height: 250,\n title: 'MultiTab Error'\n })\n}", "warn(...args) {\n return this.getInstance().warn(...args);\n }", "warn(...args) {\n console.warn(this.getColorOn() + args.join(\" \"));\n }", "function errorNameUsed(data) {\r\n let p = createP(`${data} has already been used!!`);\r\n p.parent(\".homepage\");\r\n}", "function displayConflictMessage() {\n\t$('#singleDeleteModalWindow, .window').hide(0);\n\taddErrorClass();\n\tinlineMessageBlock();\n\tdocument.getElementById(\"successmsg\").innerHTML = getUiProps().MSG0205;\n\tobjCommon.centerAlignRibbonMessage(\"#crudOperationMessageBlock\");\n\tobjCommon.autoHideAssignRibbonMessage('crudOperationMessageBlock');\n}", "static NameToLayer() {}", "_processLayerOverrides(l,prefix,lostOverrides){\n const slayer = l.slayer\n \n let newLostOverrides = undefined\n let overrides = []\n\n if( lostOverrides!=undefined && l.objectID in lostOverrides) Array.prototype.push.apply(overrides,lostOverrides[l.objectID]) \n if( l.isSymbolInstance && slayer.overrides) Array.prototype.push.apply(overrides,slayer.overrides)\n \n if(overrides.length==0) return newLostOverrides \n \n\n // check if target was customized\n overrides.forEach(function (customProperty){ \n if( !(customProperty.property==='flowDestination' && !customProperty.isDefault && customProperty.value!='') ) return; \n\n let sourceID = customProperty.path\n exporter.log(prefix+\"found custom property / sourceID=\"+sourceID + \" customProperty.value=\"+customProperty.value)\n\n let srcLayer = undefined \n if(sourceID.indexOf(\"/\")>0){\n // found nested symbols\n const splitedPath = sourceID.split(\"/\")\n // find override owner\n exporter.log(prefix+\"override owner path=\"+sourceID) \n srcLayer = this.childFinder.findChildInPath(prefix+\" \",l,splitedPath,0) \n if(srcLayer==undefined && !(l.objectID in lostOverrides) )\n { \n exporter.log(prefix+\"pushed to newLostOverrides\") \n\n if(newLostOverrides==undefined) \n newLostOverrides = []\n const firstID = splitedPath[0]\n if(!(firstID in newLostOverrides)) \n newLostOverrides[firstID] = []\n newLostOverrides[firstID].push(customProperty)\n\n exporter.log(prefix+\" pushed newOverrides=\"+(newLostOverrides?newLostOverrides[firstID].length:\" undefined\"))\n }\n }else{ \n srcLayer = this.childFinder.findChildByID(l,sourceID)\n }\n \n if(srcLayer) exporter.log(prefix+\"found srcLayer: \"+srcLayer.name)\n\n if(srcLayer==undefined){\n exporter.log(prefix+\"ERROR! can't find child by ID=\"+sourceID)\n return\n }\n \n // srcLayer link was already overrided by parents\n if(srcLayer.customLink!=undefined){\n return\n }\n \n // setup customLink\n if(customProperty.value=='back'){\n // handle Back link\n srcLayer.customLink = {\n linkType: \"back\"\n }\n exporter.log(prefix+\"srcLayer.customLink.linkType=\"+srcLayer.customLink.linkType)\n return\n }else{ \n // handle link to artboard\n if(!(customProperty.value in exporter.pageIDsDict)){\n return\n }\n const targetArtboard = exporter.pageIDsDict[customProperty.value]\n\n // handle link to External Artboard\n if(targetArtboard.externalArtboardURL!=undefined){ \n const externalLink = {\n 'href' : targetArtboard.externalArtboardURL,\n 'openNewWindow': false \n }\n srcLayer.customLink = {\n artboardID: targetArtboard.objectID\n }\n this._specifyExternalURLHotspot(prefix+\" \",srcLayer.customLink,externalLink) \n }else{\n // handle link to Reguler Artboard\n srcLayer.customLink = {\n linkType: \"artboard\",\n artboardID: targetArtboard.objectID\n }\n } \n //log(prefix+\"srcLayer.customLink.linkType=\"+srcLayer.customLink.linkType+\" artboardID=\"+ srcLayer.customLink.artboardID+\" customValue='\"+customProperty.value+\"'\")\n return\n }\n\n },this); \n \n exporter.log(prefix+\" _processLayerOverrides, newLostOverrides=\"+newLostOverrides) \n l.tempOverrides = newLostOverrides\n }", "applyAudit() {\n super.applyAudit();\n this.log.debug('This is only another custom messagem from your custom server :)');\n }", "addTrace() {\n TraceService.sendTrace(this.state.newTraceMessage, (res) => {\n Plotly.addTraces('plot',Object.assign(calculate.extractPoints(res.data.points),\n {type:'scatter3d', mode:'markers', name:res.data.id}))\n this.props.pushUndolist({action:'add',id:res.data.id, data:this.state.newTraceMessage})\n this.props.clearRedolist();\n })\n }", "function addWarning(e, message) {\n if (!e.target.parentNode.querySelector('.warning-text')) {\n const warning = e.target.parentNode.appendChild(document.createElement('p'))\n warning.textContent = message\n warning.classList.add(\"warning-text\")\n } else {\n return\n }\n}", "warn(...args) {\n }", "function alertOfDuplicateFailure(id, name_ru) {\n removeAllChildNodes(\"success\");\n document.getElementById(\"alert1\").innerHTML =\n '<div class=\"alert alert-danger fade in\">' +\n '<a href=\"#\" class=\"close\" data-dismiss=\"alert\">&times;</a>' +\n '<strong>Error!</strong> Id is not unique, it\\'s one already accociated with <b>' + id + ' (' + name_ru + ')</b>. Try to use another id!' +\n '</div>';\n}", "function reportDuplicateLabels(ast) {\n function checkExpressionWithClonedEnv(node, env) {\n check(node.expression, objects.clone(env));\n }\n\n var check = visitor.build({\n rule: function (node) {\n check(node.expression, {});\n },\n choice: function (node, env) {\n arrays.each(node.alternatives, function (alternative) {\n check(alternative, objects.clone(env));\n });\n },\n action: checkExpressionWithClonedEnv,\n labeled: function (node, env) {\n if (env.hasOwnProperty(node.label)) {\n throw new GrammarError(\"Label \\\"\" + node.label + \"\\\" is already defined \" + \"at line \" + env[node.label].start.line + \", \" + \"column \" + env[node.label].start.column + \".\", node.location);\n }\n\n check(node.expression, env);\n env[node.label] = node.location;\n },\n text: checkExpressionWithClonedEnv,\n simple_and: checkExpressionWithClonedEnv,\n simple_not: checkExpressionWithClonedEnv,\n optional: checkExpressionWithClonedEnv,\n zero_or_more: checkExpressionWithClonedEnv,\n one_or_more: checkExpressionWithClonedEnv,\n group: checkExpressionWithClonedEnv\n });\n check(ast);\n}", "function provideSomeLayer(layer, __trace) {\n return self => provideLayer_(self, layer[\"+++\"](L.identity()), __trace);\n}", "function warn (mssg) {\n console.log ('WARNING %s', mssg);\n }", "addBicyclingLayer(layer) {\n const newLayer = this._wrapper.createBicyclingLayer();\n this._layers.set(layer, newLayer);\n }", "addToLayers(){\n try {\n let _to = this.props.toVersion.key;\n //add the sources\n let attribution = \"IUCN and UNEP-WCMC (\" + this.props.toVersion.year + \"), The World Database on Protected Areas (\" + this.props.toVersion.year + \") \" + this.props.toVersion.title + \", Cambridge, UK: UNEP-WCMC. Available at: <a href='http://www.protectedplanet.net'>www.protectedplanet.net</a>\";\n this.addSource({id: window.SRC_TO_POLYGONS, source: {type: \"vector\", attribution: attribution, tiles: [ window.TILES_PREFIX + \"wdpa_\" + _to + \"_polygons\" + window.TILES_SUFFIX]}});\n this.addSource({id: window.SRC_TO_POINTS, source: {type: \"vector\", tiles: [ window.TILES_PREFIX + \"wdpa_\" + _to + \"_points\" + window.TILES_SUFFIX]}});\n //no change protected areas layers\n this.addLayer({id: window.LYR_TO_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(99,148,69,0.2)\", \"fill-outline-color\": \"rgba(99,148,69,0.3)\"}, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_POINT, sourceId: window.SRC_TO_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _to + \"_points\", layout: {visibility: \"visible\"}, paint: {\"circle-radius\": CIRCLE_RADIUS_STOPS, \"circle-color\": \"rgb(99,148,69)\", \"circle-opacity\": 0.6}, beforeID: window.LYR_TO_SELECTED_POLYGON});\n //selection layers\n this.addLayer({id: window.LYR_TO_SELECTED_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_SELECTED_POLYGON, filter:INITIAL_FILTER});\n this.addLayer({id: window.LYR_TO_SELECTED_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_SELECTED_LINE, filter:INITIAL_FILTER});\n this.addLayer({id: window.LYR_TO_SELECTED_POINT, sourceId: window.SRC_TO_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _to + \"_points\", layout: {visibility: \"visible\"}, paint: P_SELECTED_POINT, filter:INITIAL_FILTER});\n //add the change layers if needed\n if (this.props.fromVersion.id !== this.props.toVersion.id) this.addToChangeLayers();\n } catch (e) {\n console.log(e);\n }\n }", "function addMessage(layer, message, color) {\n layer.html('<p style=\"color:' + color + '\">' + message + '</p>');\n }", "function detectWarningInContainer(containerEl) {\r\n return containerEl.find('.fc-license-message').length >= 1;\r\n}", "function OnAfterCallBack(param, mode) {\n if (typeof (param[\"Duplicate\"]) != \"undefined\") {\n showErrorMessage(param[\"Duplicate\"]);\n }\n}", "addMapLayers() {\r\n // console.log('method: addMapLayers');\r\n let layers = this.map.getStyle().layers;\r\n // Find the index of the first symbol layer in the map style\r\n let firstSymbolId;\r\n for (let i = 0; i < layers.length; i++) {\r\n if (layers[i].type === 'symbol') {\r\n firstSymbolId = layers[i].id;\r\n break;\r\n }\r\n }\r\n this.options.mapConfig.layers.forEach((layer, index) => {\r\n\r\n // Add map source\r\n this.map.addSource(layer.source.id, {\r\n type: layer.source.type,\r\n data: layer.source.data\r\n });\r\n \r\n\r\n // Add layers to map\r\n this.map.addLayer({\r\n \"id\": layer.id,\r\n \"type\": \"fill\",\r\n \"source\": layer.source.id,\r\n \"paint\": {\r\n \"fill-color\": this.paintFill(layer.properties[0]),\r\n \"fill-opacity\": 0.8,\r\n \"fill-outline-color\": \"#000\"\r\n },\r\n 'layout': {\r\n 'visibility': 'none'\r\n }\r\n }, firstSymbolId);\r\n\r\n\r\n // check if touch device. if it's not a touch device, add mouse events\r\n if (!checkDevice.isTouch()) {\r\n this.initMouseEvents(layer);\r\n } // checkDevice.isTouch()\r\n\r\n\r\n // Store all the custom layers\r\n this.customLayers.push(layer.id);\r\n });\r\n }", "function messagesUpdated() {\n\n updateMessageLayers();\n\n if (scope.detailsMap) {\n updateLabelLayer();\n }\n\n if (scope.fitExtent) {\n var extent = ol.extent.createEmpty();\n ol.extent.extend(extent, nwLayer.getSource().getExtent());\n ol.extent.extend(extent, nmLayer.getSource().getExtent());\n if (!ol.extent.isEmpty(extent)) {\n map.getView().fit(extent, {\n padding: [5, 5, 5, 5],\n size: map.getSize(),\n maxZoom: maxZoom\n });\n } else if (scope.rootArea && scope.rootArea.latitude\n && scope.rootArea.longitude && scope.rootArea.zoomLevel) {\n // Update the map center and zoom\n var center = MapService.fromLonLat([ scope.rootArea.longitude, scope.rootArea.latitude ]);\n map.getView().setCenter(center);\n map.getView().setZoom(scope.rootArea.zoomLevel);\n }\n }\n }", "manageDuplicates(){\n\n // Manage duplicate IDs from swiper loop\n this.duplicates = this.sliderPastilles.container[0].querySelectorAll('.pastille--image.swiper-slide');\n\n for ( let i = 0; i < this.duplicates.length; i++ ){\n\n // Vars\n let mask = this.duplicates[i].querySelector('svg > defs > mask');\n let image = this.duplicates[i].querySelector('svg > image');\n\n // Update values\n let id = mask.getAttribute('id');\n let newId = id+i;\n\n mask.setAttribute('id', newId);\n image.setAttribute('mask','url(#'+newId+')');\n }\n }", "static LayerToName() {}", "removeLayer() {\n if (this.__shown) {\n const map = this.map;\n map.removeLayer(this.uniqueId);\n map.removeLayer(this.uniqueId + 'label');\n map.removeLayer(this.uniqueId + 'citylabel');\n map.removeLayer(this.uniqueId + 'citylabelun');\n this.__shown = false;\n }\n }", "addFromLayers(){\n let _from = this.props.fromVersion.key;\n //add the sources\n this.addSource({id: window.SRC_FROM_POLYGONS, source: {type: \"vector\", tiles: [ window.TILES_PREFIX + \"wdpa_\" + _from + \"_polygons\" + window.TILES_SUFFIX]}});\n this.addSource({id: window.SRC_FROM_POINTS, source: {type: \"vector\", tiles: [ window.TILES_PREFIX + \"wdpa_\" + _from + \"_points\" + window.TILES_SUFFIX]}});\n //add the layers\n this.addLayer({id: window.LYR_FROM_DELETED_POLYGON, sourceId: window.SRC_FROM_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(255,0,0, 0.2)\", \"fill-outline-color\": \"rgba(255,0,0,0.5)\"}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_POLYGON});\n this.addLayer({id: window.LYR_FROM_DELETED_POINT, sourceId: window.SRC_FROM_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _from + \"_points\", layout: {visibility: \"visible\"}, paint: {\"circle-radius\": CIRCLE_RADIUS_STOPS, \"circle-color\": \"rgb(255,0,0)\", \"circle-opacity\": 0.6}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_POLYGON});\n //geometry change in protected areas layers - from\n this.addLayer({id: window.LYR_FROM_GEOMETRY_POINT_TO_POLYGON, sourceId: window.SRC_FROM_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _from + \"_points\", layout: {visibility: \"visible\"}, paint: {\"circle-radius\": CIRCLE_RADIUS_STOPS, \"circle-color\": \"rgb(255,0,0)\", \"circle-opacity\": 0.5}, filter:INITIAL_FILTER, beforeId: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON});\n this.addLayer({id: window.LYR_FROM_GEOMETRY_POINT_COUNT_CHANGED_LINE, sourceId: window.SRC_FROM_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"line-color\": \"rgb(255,0,0)\", \"line-width\": 1, \"line-opacity\": 0.5, \"line-dasharray\": [3,3]}, filter:INITIAL_FILTER, beforeId: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON});\n this.addLayer({id: window.LYR_FROM_GEOMETRY_SHIFTED_LINE, sourceId: window.SRC_FROM_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"line-color\": \"rgb(255,0,0)\", \"line-width\": 1, \"line-opacity\": 0.5, \"line-dasharray\": [3,3]}, filter:INITIAL_FILTER, beforeId: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON});\n //selection layers\n this.addLayer({id: window.LYR_FROM_SELECTED_POLYGON, sourceId: window.SRC_FROM_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_SELECTED_POLYGON, filter:INITIAL_FILTER, beforeId: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_FROM_SELECTED_LINE, sourceId: window.SRC_FROM_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _from + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_SELECTED_LINE, filter:INITIAL_FILTER, beforeId: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_FROM_SELECTED_POINT, sourceId: window.SRC_FROM_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _from + \"_points\", layout: {visibility: \"visible\"}, paint: P_SELECTED_POINT, filter:INITIAL_FILTER, beforeId: window.LYR_TO_SELECTED_POLYGON});\n }", "function MultiplicatorUnitFailure() {}", "function errback(error) {\n console.error(\"Creating legend failed. \", error);\n }", "notifyUnderConstruction() {\n UX.createNotificationForResult({ success : true, type : \"INFO\", icon : \"TRIANGLE\", key : \"common.label_under_construction\"})\n }", "copyMetricWarnings(...ms) {\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_cloudwatch_IMetric(ms);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"DeprecationError\") {\n Error.captureStackTrace(error, this.copyMetricWarnings);\n }\n throw error;\n }\n this.warnings?.push(...ms.flatMap(m => m.warnings ?? []));\n }", "static setNoDataStyle(layer){\n layer.unbindPopup();\n layer.setStyle({\n \"weight\": 1,\n \"color\": \"#000\",\n \"opacity\": 0.7,\n \"fillColor\": \"#a4a4a5\",\n \"fillOpacity\": 0.8\n });\n layer.bindPopup(Mapper.setNoDataPopUp(layer.feature.properties.adm3_name));\n layer.on('mouseover', function (e) {\n this.openPopup();\n });\n layer.on('mouseout', function (e) {\n this.closePopup();\n });\n }", "function publicWarning(message) {\n publicMessageLabel.className = 'warning';\n publicMessageLabel.innerHTML = message;\n console.warn(message);\n}" ]
[ "0.6802336", "0.6285311", "0.62693626", "0.626083", "0.5824914", "0.58229935", "0.5817325", "0.579206", "0.5733343", "0.57217723", "0.56994754", "0.5674651", "0.5636674", "0.5588524", "0.5580182", "0.55401933", "0.55259746", "0.54604703", "0.5458214", "0.54571515", "0.54509795", "0.54267263", "0.5352262", "0.5318487", "0.5267421", "0.52536714", "0.52443415", "0.52131075", "0.51995236", "0.5194498", "0.5187883", "0.51825535", "0.5176541", "0.51764834", "0.5173862", "0.5170043", "0.51687485", "0.5158222", "0.513267", "0.505927", "0.5054215", "0.50527257", "0.50401425", "0.50379467", "0.50345063", "0.50138855", "0.5006025", "0.4966733", "0.49658567", "0.49610183", "0.4944852", "0.4940519", "0.49396816", "0.4918152", "0.4903032", "0.489453", "0.48913625", "0.48836637", "0.48825186", "0.4876104", "0.4875437", "0.48684084", "0.4866057", "0.4863617", "0.48619315", "0.4861379", "0.48599958", "0.48590666", "0.48576567", "0.48557484", "0.4855197", "0.48523018", "0.48495132", "0.48451984", "0.48440862", "0.48367545", "0.48306644", "0.48286477", "0.48241803", "0.48192203", "0.48191014", "0.48187304", "0.4809662", "0.48095208", "0.48042673", "0.47961417", "0.47945705", "0.47857642", "0.4780072", "0.47789106", "0.47769886", "0.4775696", "0.4774126", "0.4769498", "0.47592077", "0.47565293", "0.47559065", "0.47552827", "0.4753217", "0.4751438" ]
0.49626294
49
No Layer to remove warnning message
function showRemoveMsg() { $("#worning-no-layer").dialog("open"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeWarning() {\n document.getElementById(this.id + \"_error\").innerHTML = \"\";\n }", "warn() {}", "function hideWorkingMessage() {\n psc().hideLayer();\n}", "static notifyWarning()\n\t\t{\n\t\t\tthis.notify(NotificationFeedbackType.Warning);\n\t\t}", "function noWarning(){\n noLoading.style.display = 'none' ;\n}", "warn(msg) {\n if (!bna.quiet) { return log(msg.gray); }\n }", "function showSpecialWarning() {\r\n return true;\r\n}", "hideDefaultTurnWarning() {\n const element = this.instance.getChildByClass(this.instance.root, 'gm-default-turn-button');\n if (element) {\n element.remove();\n }\n }", "function eliminateSONetworking() {\n let replacementMessage = '<span style=\"opacity:0.25;\"><3 KaiWeb ditched this for you <3</span>';\n let networkDiv=document.getElementById('hot-network-questions');\n if (networkDiv) {\n networkDiv.innerHTML = replacementMessage;\n }\n}", "function dontDisplayInfo(candidate){\n\t\tcandidate.element\n\t\t\t.transition()\n\t\t\t.duration(300)\n\t\t\t.attr(\"r\", function(d){return linearElementScale(narrowerDimension);})\n\t\tvar infoDiv = document.getElementById(candidate.name);\n\t\tinfoDiv.parentNode.removeChild(infoDiv);\n\t}", "hideAllCatchments() {\n\t\tconsole.log(\"hiding all catchments\");\n\t\tthis.kmlLayer.setMap(null);\n\t}", "function noop() {\n console.warn('Hermes messaging is not supported.');\n }", "displayDefaultTurnWarning() {\n let message = '<h1><span>&#9888;</span> Using a default TURN</h1>Performance is not optimal.';\n const warning = document.createElement('a');\n warning.classList.add('gm-default-turn-button');\n warning.classList.add('gm-icon-button');\n const hover = document.createElement('div');\n hover.className = 'gm-default-turn-used gm-hidden';\n if (this.instance.options.connectionFailedURL) {\n message = message + '<br>Click on the icon to learn more.';\n warning.href = this.instance.options.connectionFailedURL;\n warning.target = '_blank';\n }\n hover.innerHTML = message;\n warning.appendChild(hover);\n\n warning.onmouseenter = () => {\n hover.classList.remove('gm-hidden');\n };\n warning.onmouseleave = () => {\n hover.classList.add('gm-hidden');\n };\n const toolbar = this.instance.getChildByClass(this.instance.root, 'gm-toolbar');\n toolbar.appendChild(warning);\n }", "LogWarning() {}", "function hideMessage() {\n $scope.showToolMessage = false;\n }", "function drawEmptyLineChartLabel(on) {\n\tif (on) {\n\t\td3.select(\"#lineChartWarning\").attr(\"visibility\", \"visible\");\n\t} else {\n\t\td3.select(\"#lineChartWarning\").attr(\"visibility\", \"hidden\");\n\t}\n}", "function gLyphsNoUserWarn(message) {\n var main_div = document.getElementById(\"global_panel_layer\");\n if(!main_div) { return; }\n\n var e = window.event\n moveToMouseLoc(e);\n var ypos = toolTipSTYLE.ypos-35;\n if(ypos < 100) { ypos = 100; }\n\n var divFrame = document.createElement('div');\n main_div.appendChild(divFrame);\n divFrame.setAttribute('style', \"position:absolute; background-color:LightYellow; text-align:left; \"\n +\"border:inset; border-width:1px; padding: 3px 7px 3px 7px; \"\n +\"z-index:1; opacity: 0.95; \"\n +\"left:\" + ((winW/2)-200) +\"px; \"\n +\"top:\"+ypos+\"px; \"\n +\"width:400px;\"\n );\n var tdiv = divFrame.appendChild(document.createElement('div'));\n tdiv.setAttribute('style', \"font-size:14px; font-weight:bold;\");\n var tspan = tdiv.appendChild(document.createElement('span'));\n tspan.innerHTML = \"Warning: Not logged into the ZENBU system\";\n\n var a1 = tdiv.appendChild(document.createElement('a'));\n a1.setAttribute(\"target\", \"top\");\n a1.setAttribute(\"href\", \"./\");\n a1.setAttribute(\"onclick\", \"gLyphsSaveConfigParam('cancel'); return false;\");\n var img1 = a1.appendChild(document.createElement('img'));\n img1.setAttribute(\"src\", eedbWebRoot+\"/images/close_icon16px_gray.png\");\n img1.setAttribute(\"style\", \"float: right;\");\n img1.setAttribute(\"width\", \"16\");\n img1.setAttribute(\"height\", \"16\");\n img1.setAttribute(\"alt\",\"close\");\n\n var tdiv = divFrame.appendChild(document.createElement('div'));\n tdiv.setAttribute('style', \"margin-top:10px; font-size:12px;\");\n var tspan = tdiv.appendChild(document.createElement('span'));\n tspan.innerHTML = \"In order to \"+message+\", you must first log into ZENBU.\";\n //tspan.innerHTML += \"<br>Please go to the <a href=\\\"../user/#section=profile\\\">User profile section</a> and either create a profile or login with a previous profile.\";\n eedbLoginAction(\"login\");\n}", "function ux_hideMsg() {\n _hideErrMsg();\n}", "function removeWarning(e) {\n if(e.target.parentNode.querySelector('.warning-text')) {\n e.target.parentNode.querySelector('.warning-text').remove()\n }\n}", "function displayNoWebGLMessage() {\n document.getElementById('no-webgl').style.display = 'block';\n}", "function setLayerVisibilityFalse(myDoc,name,progressWindow){\n\tmyLayer = myDoc.layers.item(name);\n\tif(myLayer.isValid){\n\t\tmyLayer.visible = false;\n\t\tprogressWindow.processStatus.text += \"Layer \" + name + \" visibility set to false\\r\\n\";\n\t\treturn 1;\n\t} else {\n\t\talert(\"Set Layer Visibility FALSE Error\\nNo layer named \" + name + \" was found.\");\n\t\treturn 0;\n\t}\n}", "function clearWarnings() {\n let warningHolder = document.getElementById('warnings-holder');\n\n while (warningHolder.firstChild != null) {\n warningHolder.removeChild(warningHolder.firstChild);\n }\n}", "function clearErrorMsg() {\n AlmCommon.clearMsgs();\n }", "warning() {\n this.canvas[1].font = \"20px Arial\";\n this.canvas[1].fillText(this.message,10,130);\n }", "function silence() {\n replaceLog({\n debug: function () { return null; },\n info: function () { return null; },\n warn: function () { return null; },\n warning: function () { return null; },\n error: function () { return null; }\n });\n}", "function StudyNotDisabledWarningController() {\n\n}", "function deprecationWarn(msg) {\n if (environment_1.ENV.getBool('DEPRECATION_WARNINGS_ENABLED')) {\n console.warn(msg + ' You can disable deprecation warnings with ' +\n 'tf.disableDeprecationWarnings().');\n }\n}", "function noOP() {\n }", "function noOP() {\n }", "static setNoDataStyle(layer){\n layer.unbindPopup();\n layer.setStyle({\n \"weight\": 1,\n \"color\": \"#000\",\n \"opacity\": 0.7,\n \"fillColor\": \"#a4a4a5\",\n \"fillOpacity\": 0.8\n });\n layer.bindPopup(Mapper.setNoDataPopUp(layer.feature.properties.adm3_name));\n layer.on('mouseover', function (e) {\n this.openPopup();\n });\n layer.on('mouseout', function (e) {\n this.closePopup();\n });\n }", "function _noop() {}", "function _noop() {}", "function _noop() {}", "function _noop() {}", "function _noop() {}", "function _noop() {}", "function _noop() {}", "function ignore() { }", "function displayWarning() {\n warn(\"block\");\n setTimeout(() => {\n warn(\"none\");\n }, 10000);\n }", "function _noAssignedHedgeNum(msg)\r\n{\r\n if(msg)\r\n {\r\n\t var htmlErrors = new htmlAjax ().error(); \r\n\t htmlErrors.addError(\"warningInfo\", msg, false);\r\n\t messagingDiv(htmlErrors);\r\n return;\r\n }\r\n \r\n}", "function warn (mssg) {\n console.log ('WARNING %s', mssg);\n }", "function addEarlyWarningMsg() {\n if(!SailPoint.getTimeoutLock()) {\n Ext.Msg.show(\n {title: \"#{msgs.session_pre_expiration_title}\",\n msg: \"#{msgs.session_pre_expiration_msg}\",\n buttons: Ext.Msg.OKCANCEL,\n fn: function(button) {\n if(button === 'ok') {\n Ext.Ajax.request({\n url: CONTEXT_PATH + '/rest/ping',\n success: function() {\n SailPoint.resetTimeout();\n }\n })\n }\n },\n icon: Ext.MessageBox.WARNING\n });\n } else {\n SailPoint.resetTimeout();\n }\n}", "notifyUnderConstruction() {\n UX.createNotificationForResult({ success : true, type : \"INFO\", icon : \"TRIANGLE\", key : \"common.label_under_construction\"})\n }", "function useWarnings(options) {\n \n }", "function disableDeprecationWarnings() {\n environment_1.ENV.set('DEPRECATION_WARNINGS_ENABLED', false);\n console.warn(\"TensorFlow.js deprecation warnings have been disabled.\");\n}", "function hideMapboxCSSWarning() {\n const missingCssWarning = document.getElementsByClassName('mapboxgl-missing-css')[0];\n if (missingCssWarning) {\n missingCssWarning.style.display = 'none';\n }\n}", "_assertNotAttached() {\n if (this._portalOutlet.hasAttached() && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('Attempting to attach snack bar content after content is already attached');\n }\n }", "_assertNotAttached() {\n if (this._portalOutlet.hasAttached() && (typeof ngDevMode === 'undefined' || ngDevMode)) {\n throw Error('Attempting to attach snack bar content after content is already attached');\n }\n }", "function deprecationWarn(msg) {\n if (Object(_environment__WEBPACK_IMPORTED_MODULE_1__[\"env\"])().getBool('DEPRECATION_WARNINGS_ENABLED')) {\n console.warn(msg + ' You can disable deprecation warnings with ' +\n 'tf.disableDeprecationWarnings().');\n }\n}", "displayMessageIfNoAnnotations() {\r\n if (this.shadowRoot.querySelectorAll('annotation-item').length === 0) {\r\n this.shadowRoot.querySelector('button.remove').style.visibility = 'hidden';\r\n this.shadowRoot.querySelector('.empty-message').style.display = 'inline';\r\n } else {\r\n this.shadowRoot.querySelector('.empty-message').style.display = 'none';\r\n this.shadowRoot.querySelector('button.remove').style.visibility = 'visible';\r\n }\r\n }", "function deprecationWarn(msg) {\n if (exports.ENV.get('DEPRECATION_WARNINGS_ENABLED')) {\n console.warn(msg + ' You can disable deprecation warnings with ' +\n 'tf.disableDeprecationWarnings().');\n }\n}", "function restoreWarnings (t) {\n console.warn = t.context.warn\n}", "function noop() {\n\t\t // No operation performed.\n\t\t }", "function noop() {\n\t\t // No operation performed.\n\t\t }", "function showAPICallFailure(data, msg){\n\t\t\t\tlogger.debug(\"showAPICallFailure\", data);\n\t\t\t\tlpChatShowView(lpCWAssist.lpChatMakeOfflineScreenHtml(msg), true);\n\t\t\t\tshowChatWizContainer();\n\t\t\t}", "warn(toWarn) {\r\n if (this.configManager.envConfig.messagingWebClient.enableConsoleLogging) {\r\n this.console.warn(toWarn);\r\n }\r\n }", "function resetAfkWarningTimer() {\n if (afk.active) {\n clearTimeout(afk.warnTimer);\n afk.warnTimer = setTimeout(function () {\n showAfkOverlay();\n }, afk.warnTimeout * 1000);\n }\n}", "function hideLayerTitles() {\n svg.selectAll('.Layer').remove();\n }", "function warn(msg) {\n\t console.log(_chalk2.default.yellow('Knex:warning - ' + msg));\n\t}", "removeLayer() {\n if (this.__shown) {\n const map = this.map;\n map.removeLayer(this.uniqueId + 'fillpoly');\n this.__shown = false;\n }\n }", "function hideOfflineWarning(){\n if (document.getElementById('offline_div')!=null)\n document.getElementById('offline_div').style.display='none';\n}", "warn (msg, ...rest) {\n if (_shouldOutputMessage(this, \"warning\", \"warnings\")) {\n console.warn(this.theme.warning(`${this.getContextName()} warns:`, msg), ...rest);\n }\n return this;\n }", "removeToChangeLayers(){\n if (this.map && !this.map.isStyleLoaded()) return;\n this.props.statuses.forEach(status => {\n if (status.key !== 'no_change'){\n status.layers.forEach(layer => {\n if (this.map.getLayer(layer)) {\n this.map.removeLayer(layer);\n }\n });\n }\n });\n }", "function noop(){\r\n\r\n }", "function handleGeolocateNoSupport() {\n\t\t\tui.showGeolocationError(true, true);\n\t\t\tui.showGeolocationSearching(false);\n\t\t}", "function noop() {\n // No operation performed.\n }", "function noop() {\n // No operation performed.\n }", "function noop() {\n // No operation performed.\n }", "function noop() {\n // No operation performed.\n }", "importNoStatisticsLayer(request, response) {\n\t\tlogger.info('LayerImporterController#importNoStatisticsLayer');\n\n\t\tthis.getImportInputs(request).then(inputs => {\n\t\t\tthis._layerImporter.importLayerWithoutStatistics(inputs);\n\t\t\tresponse.send(this._layerImporter.getCurrentImporterTask());\n\t\t}).catch(error => {\n\t\t\tresponse.send({\n\t\t\t\tmessage: error.message,\n\t\t\t\tsuccess: false\n\t\t\t})\n\t\t});\n\t}", "function disableDeprecationWarnings() {\n Object(_environment__WEBPACK_IMPORTED_MODULE_1__[\"env\"])().set('DEPRECATION_WARNINGS_ENABLED', false);\n console.warn(`TensorFlow.js deprecation warnings have been disabled.`);\n}", "function disableDeprecationWarnings() {\n exports.ENV.set('DEPRECATION_WARNINGS_ENABLED', false);\n console.warn(\"TensorFlow.js deprecation warnings have been disabled.\");\n}", "checkValidationWarnings () {\n\t\tif (\n\t\t\tthis.model.validationWarnings instanceof Array &&\n\t\t\tthis.api\n\t\t) {\n\t\t\tthis.api.warn(`Validation warnings: \\n${this.model.validationWarnings.join('\\n')}`);\n\t\t}\n\t}", "function WARNING$static_(){ValidationState.WARNING=( new ValidationState(\"warning\"));}", "function noWeather() {\n app.textContent = 'Unable to get weather data at this time.';\n }", "function Ge(t){console.error(\"[BScroll warn]: \"+t)}", "function onwarn(warning) {\n if (warning.code === 'THIS_IS_UNDEFINED') return;\n console.error(warning.message);\n}", "function noop() {\n }", "function zenbuClearGlobalPanelLayer() {\n var global_layer_div = document.getElementById(\"global_panel_layer\");\n if(!global_layer_div) { return; }\n global_layer_div.innerHTML =\"\";\n}", "function _noop(){}", "function noop() {\n\t\t // No operation performed.\n\t\t}", "setTargetNotice() {\n return;\n }", "function nypwarning(){\n\tif(document.getElementById('nyp').getAttributeNS(null,'display') == 'none'){\n\t\tdocument.getElementById('nyp').setAttributeNS(null,'display','inline');\n\t\tsetTimeout('nypwarning()',2000);\n\t}else{\n\t\tdocument.getElementById('nyp').setAttributeNS(null,'display','none');\n\t}\n}", "function noop() {\r\n }", "function noConnectionError(list) {\n list.append(\n '<li class=\"disabled\">' +\n '<p>Content not available while offline.</p>' +\n '<p>Check your connection and try again.</p>' +\n '</li>',\n );\n }", "function warn(msg) {\n var stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined') {\n console.warn('Deprecation Warning: ', msg);\n }\n else {\n // chop off the stack trace which includes pixi.js internal calls\n stack = stack.split('\\n').splice(3).join('\\n');\n\n if (console.groupCollapsed) {\n console.groupCollapsed('%cDeprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', msg);\n console.warn(stack);\n console.groupEnd();\n }\n else {\n console.warn('Deprecation Warning: ', msg);\n console.warn(stack);\n }\n }\n}", "resetWarnings() {\n this.warningCount = 0;\n this.seenWarnings.clear();\n }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }", "function noop() {\n\t // No operation performed.\n\t }" ]
[ "0.6376763", "0.62939286", "0.6247481", "0.6026614", "0.5996649", "0.5991714", "0.5986352", "0.5960493", "0.5948277", "0.5915595", "0.5890063", "0.5885589", "0.5862935", "0.5840045", "0.5839866", "0.58298117", "0.5802476", "0.5760516", "0.5749318", "0.5715565", "0.57076156", "0.5675957", "0.56753165", "0.56519604", "0.5642124", "0.56316787", "0.5624206", "0.5600869", "0.5600869", "0.56007975", "0.55906403", "0.55906403", "0.55906403", "0.55906403", "0.55906403", "0.55906403", "0.55906403", "0.55881435", "0.55781865", "0.55699944", "0.55656314", "0.5564055", "0.5559807", "0.554765", "0.55382407", "0.55368304", "0.5528448", "0.5528448", "0.55279315", "0.5527142", "0.5523612", "0.5516606", "0.5509486", "0.5509486", "0.5507003", "0.5506528", "0.55003726", "0.5494949", "0.54853684", "0.54840195", "0.5483331", "0.5474644", "0.5469506", "0.5464493", "0.54535604", "0.5451835", "0.5451835", "0.54505086", "0.54411477", "0.5440139", "0.54385215", "0.54360735", "0.5431339", "0.5423124", "0.54227793", "0.54197764", "0.54073536", "0.5406188", "0.5405206", "0.540507", "0.5392033", "0.53913945", "0.5388046", "0.5386018", "0.53806984", "0.5378667", "0.5375194", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159", "0.5375159" ]
0.0
-1
gets called when the user clicks on an observable link
function observable_link_clicked(observable_id) { $("#frm-filter").append('<input type="checkbox" name="observable_' + observable_id + '" CHECKED>').submit(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "click(e){\r\n if ( this.url ){\r\n bbn.fn.link(this.url);\r\n }\r\n else{\r\n this.$emit('click', e);\r\n }\r\n }", "function onClick(link){\n \n}", "function handleClickedLink( url, view ) {\n\t// return true if the link was handled or to prevent other plugins or Colloquy from handling it\n\treturn false;\n}", "function jsLinkClicked() {\n const url = this.getAttribute('data-linkto');\n window.open(url, '_blank');\n }", "function links_click_event(event) {\n console.log(\"works link\");\n}", "function openlink(upperCase){\n clickAnchor(upperCase,getItem(\"link\"));\n}", "_onClickUrl(urlLink) {\n //Alert.alert(\"clicked\");\n Linking.openURL(\"http://\"+urlLink);\n \n }", "function bindingArticleClick() {\n $('#rovat .content a').bind('click', function (event, ui) {\n document.getElementById(\"article-content\").src = this.dataset.url;\n });\n}", "function manuallinkClickIO(href,linkname,modal){\n\tif(modal){\n\t\tcmCreateManualLinkClickTag(href,linkname,modal_variables.CurrentURL);\n\t}else{\n\t\tcmCreateManualLinkClickTag(href,linkname,page_variables.CurrentURL);\n\t}\n}", "function onLinkClick( event ){\n event.preventDefault();\n var link = event.target,\n html = link.innerHTML;\n link.innerHTML = 'Click';\n link.className = 'item clicked';\n setTimeout( function(){\n link.innerHTML = link.getAttribute('data-num');\n link.className = 'item';\n }, 500 );\n return false;\n }", "function onClickEventHandler(event){\n \n var target = event.target;\n if(target && target.getAttribute(\"cricket\", \"1\")) {\n \n var url = target.getAttribute(\"value\");\n if(url) {\n loadLink(event, url, false);\n }\n }\n}", "function handleLinkClick(event) {\n\t\tvar linkLabel = event.currentTarget.id;\n\t\tvar url;\n\t\tswitch(linkLabel) {\n\t\t\tcase 'pivotal' :\n\t\t\t\turl = \"http://www.gopivotal.com/\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'support' :\n\t\t\t\turl = \"https://support.gopivotal.com/hc/en-us\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'feedback' :\n\t\t\t\turl = \"http://www.gopivotal.com/contact\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'help' :\n\t\t\t\turl = \"../../static/docs/gpdb_only/index.html\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'logout' :\n\t\t\t\tlogoutClick();\n\t\t\t\tbreak;\n\t\t}\n\t}", "function handleLinkClick(event) {\n event.preventDefault();\n console.dir(event);\n}", "navigateHyperlink() {\n let fieldBegin = this.getHyperlinkField();\n if (fieldBegin) {\n this.fireRequestNavigate(fieldBegin);\n }\n }", "function linkTopic(a) {\n a .on(\"click\", click);\n //.on(\"mouseover\", mouseover)\n //.on(\"mouseout\", mouseout);\n}", "handleLinkEvent(event, link) {\n if (this.renderer && this.renderer.handleLinkEvent) {\n this.renderer.handleLinkEvent(this.editorContext, event, link);\n }\n }", "function onLinkClick(event) {\n event.preventDefault();\n navigate(event.target.href);\n}", "function linkClick(link) {\n\t\tsubjectRead(subjects);\n\t\t$(links[link]).css(\"z-index\",\"1\");\n\t\t$(links[link]).css(\"opacity\",\"1\");\n\t\t$(link).css(\"background-color\",\"#8C6954\");\n\t\t$(link).css(\"color\",\"white\");\n\t\t$.each(links, function (key,value)\n\t\t{\n\t\t\tif (key!=link)\n\t\t\t{\n\t\t\t\t$(links[key]).css(\"z-index\",\"0\");\n\t\t\t\t$(links[key]).css(\"opacity\",\"0\");\n\t\t\t\t$(key).css('background-color','#59323C');\n\t\t\t\t$(key).css(\"color\",\"#F2EEB3\");\n\t\t\t}\n\t\t});\n\t}", "handleClick(e) {\n e.preventDefault();\n console.log(e.target)\n //this.props.offline() \n console.log('The link was clicked.');\n \n }", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function changeOnAnnaLink() {\n $(\"#anna-link\").on(\"click\", function() {\n changeToPerson(1);\n });\n}", "function linkTopic(a) {\n a.on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n }", "linksHandler() {\n\t\treplaceLinks(this.content, (href) => {\n\t\t\tthis.emit(EVENTS.CONTENTS.LINK_CLICKED, href);\n\t\t});\n\t}", "function handlelinkClick(e) {\n e.preventDefault();\n var copyText = window.location.href;\n\n document.addEventListener('copy', function (e) {\n e.clipboardData.setData('text/plain', copyText);\n e.preventDefault();\n }, true);\n\n document.execCommand('copy');\n alert('copied text: ' + copyText);\n }", "function onLinkClick(linkClicked) {\n\n // Determines the number of the clicked button\n const linkNumber = String(linkClicked.textContent);\n\n // Removes any class names from the anchor tags\n resetLinkClassNames();\n\n // Adds an active class to the selected button\n linkClicked.className = \"active\";\n\n // Remakes the links based on button number clicked\n placePaginatedLinks(linkNumber);\n\n}", "function clickLink(url) {\n\tvar link;\n\t// if client clicks the link icon\n\t$(\"#copy-link\").on('click', function(){\n\t\tlink = $(this).siblings('div.copy-link'); // get the hidden div that has the link value stored in it\n\t\tconsole.log(link)\n\t\t$(link).tooltip(); // initialize a tooltip for the link\n\t\t$(link).tooltip({ // change the position of the tooltip\n \t\t\tposition: {my: \"left center\", at: \"right center\", of: this}\n\t\t})\n\t\t$(link).tooltip(\"open\"); // open the tooltip\n\t});\n\t// to close the tooltip, the client must scroll anywhere on the page\n\t$(window).scroll(function() {\n\t if ($(this).scrollTop()>0){\n\t \t$(link).tooltip(); // reinitialize the tooltip\n\t \t$(link).tooltip(\"close\"); // close the tooltip\n\t }\n\t});\n}", "function onLinkClick (event) {\n const linkNode = event.target;\n if (!linkNode || linkNode.tagName !== 'A') {\n return;\n }\n\n event.preventDefault();\n\n const fn = linkNode.getAttribute('data-fn');\n if (fn === 'back') {\n back(); // router.back is an alias\n return;\n } else if (fn === 'forward') {\n forward(); // router.forward is an alias\n return;\n }\n\n const action = linkNode.getAttribute('data-action');\n const name = linkNode.getAttribute('data-name');\n if (name) {\n const params = linkNode.onclick();\n if (action === 'replace') {\n router.replaceRoute(name, params);\n } else {\n router.pushRoute(name, params);\n }\n return;\n }\n\n const href = linkNode.getAttribute('href');\n if (action === 'replace') {\n replaceUri(href); // router.replaceUri is an alias\n } else {\n pushUri(href); // router.pushUri is an alias\n }\n}", "handleLink(event) {\n // only left click, no modifiers, on 'a' element with '_top' target\n // 'meta' is not actually detected, and 'alt' clicks never make it here\n if ((event.button == 0) &&\n !event.ctrlKey && !event.shiftKey &&\n // !event.altKey && !event.metaKey &&\n (event.target.tagName == 'A') && (event.target.target == '_top')) {\n // open externally\n shell.openExternal(event.target.href)\n }\n }", "function link(e) {\n let eqList = [];\n\n for (let f of funcs) {\n eqList.push(f.value);\n }\n let url = window.location.origin + window.location.pathname;\n let eqs = [];\n for (let eq of eqList) {\n eqs.push(`\"${eq}\"`);\n }\n url += `?eqs=[${eqs}]`;\n url += `&angles=[${data.cameraUniforms.u_angles}]`;\n url += `&zoom=${data.cameraUniforms.u_zoom}`;\n url += `&size=${data.settings.u_bounds}`;\n // the string needs to be doubly escaped to be valid JSON\n url = encodeURI(url.replace(/\\\\/g, \"\\\\\\\\\"));\n message(\"Copied URL to Clipboard\");\n console.log(\"Copied URL to Clipboard: \" + url);\n navigator.clipboard.writeText(url);\n }", "'click a' (event) {\n event.preventDefault();\n window.open(event.target.href, '_blank');\n }", "function handleLinkClick (e) {\n if (oToggle.isOpen && e.target.classList.contains(config.linkClass)) {\n handleToggle();\n }\n }", "measurementClicked (){\n this.measurement.addEventListener('click',()=>{\n window.open(\"././links/measurement/measurement.htm\");\n },false);\n }", "function clickLink() {\t\t\t\t\t\t\n\t$(\".link-map\").on(\"click\", function(e){\n\t\te.preventDefault();\n\t\ttoggleLink($(this));\n\t});\n}", "function onClickingLink(event, breadcrumb) {\r\n event.preventDefault(); // prevent default action\r\n $state.go(breadcrumb.stateName); // move to state\r\n }", "function onLinkClicked(aElemID, href) {\n\tif (aElemID !== undefined) {\n\t\tvar aElem = document.getElementById(aElemID);\n\t\tvar e = document.createEvent(\"Events\");\n\t\te.initEvent(\"linkClicked\", false, true);\n\t\taElem.dispatchEvent(e);\n\t}\n}", "openLink(event) {\n event.preventDefault();\n\n if (this.scope_['disabled']) {\n return;\n }\n this.grrRoutingService_.go(this.scope_['state'], this.scope_['params']);\n }", "function activateLink(e){\n // remove/add .active\n let activeLink = document.getElementsByClassName('active')[0] ? \n document.getElementsByClassName('active')[0] : \n null;\n\n if(activeLink){\n activeLink.removeAttribute('class');\n }\n e.target.setAttribute('class', 'active');\n\n // get the paragraph\n let content = new Content();\n content.getParagraphByIndex(e.target.id);\n\n // change the url in the address bar\n window.history.pushState(\"\", \"\", e.target.id);\n}", "bindEvents() {\n this.sorting.querySelectorAll(\"a\").forEach((a) => {\n a.addEventListener(\"click\", (e) => {\n e.preventDefault();\n this.loadUrl(a.getAttribute(\"href\"));\n });\n });\n }", "function fnVoltarLink() {\r\n\tvar oLink = document.links[0];\r\n\toLink.innerHTML = \"Pegar Feeds\";\r\n\toLink.className = \"\";\r\n\toLink.onclick = fnGo;\r\n}", "function subscribe(event) \n{\n\twidget.openURL(feed.replace(/http/,\"itpc\"));\n}", "_events() {\n this._linkClickListener = this._handleLinkClick.bind(this);\n this.$element.on('click.zf.smoothScrollWithLinks', 'a[href*=\"#\"]', this._linkClickListener);\n }", "function showLink(value){\n\t\t\tif(value == 'ok'){\n\t\t\t\tif(KCI.util.Config.getHybrid() == true){\n\t\t\t\t\tif(KCI.app.getApplication().getController('Hybrid').cordovaCheck() == true){\n\t\t\t\t\t\t//hybrid childbrowser function\n\t\t\t\t\t\tKCI.app.getApplication().getController('Hybrid').doShowLink(button.getUrl());\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Google Analytics Tracking\n\t\t\t\t\t\tKCI.app.getApplication().getController('Hybrid').doTrackEvent('Link','View',button.getText());\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tKCI.app.getApplication().getController('Main').doShowExternal(button.getUrl());\n\t\t\t\t\t\n\t\t\t\t\t//Google Analytics Tracking\n\t\t\t\t\tKCI.app.getApplication().getController('Main').doTrackEvent('Link','View',button.getText());\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t}", "function onLinkClick(ConfigUtils, logService, UriUtils, $window) {\n return function ($event, menuObject) {\n $event.preventDefault();\n $event.stopPropagation();\n\n // NOTE: if link goes to a chaise app, client logging is not necessary (we're using ppid, pcid instead)\n if (!isChaise(menuObject.url, ConfigUtils.getContextJSON())) {\n // check if external or internal resource page\n var action = UriUtils.isSameOrigin(menuObject.url) ? logService.logActions.NAVBAR_MENU_INTERNAL : logService.logActions.NAVBAR_MENU_EXTERNAL;\n logService.logClientAction({\n action: logService.getActionString(action, \"\", \"\"),\n names: menuObject.names\n });\n }\n\n if (menuObject.newTab) {\n $window.open(menuObject.url, '_blank');\n } else {\n $window.location = menuObject.url;\n }\n };\n }", "function handleClick() {\n history.push('/' + props.link);\n }", "clicked() {\n this.get('onOpen')();\n }", "function linkHandler ( info, tab ) {\n sendItem( { 'message': info.linkUrl } );\n}", "clickOnServicesLink() {\n this.servicesLink.click();\n }", "function waLinkClick(obj,linkName,pv_sSwitchStmt,pv_linkDetail)\n{\nvar events;\nwa.linkName = false;\n switch(pv_sSwitchStmt)\n {\n case \"link\":\n switch(linkName)\n\t\t\t{\n\t\t\t\tcase \"globalnav\":\n\t\t\t\t\twa.linkTrackVars=\"prop10,prop21,eVar21\";\n\t\t\t\t\tbreak;\t\t\t\t\t\n\t\t\n\t\t\t\t//Calendar Widget\n\t\t\t\tcase \"calclick\":\n\t\t\t\t\twa.linkTrackVars=\"prop7\";\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//Overview\n\t\t\t\tcase \"overviewclick\":\n\t\t\t\tcase \"overlaylink\":\n\t\t\t\t\twa.linkTrackVars=\"prop7\";\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Transaction\n\t\t\t\tcase \"transaction\":\n\t\t\t\t\twa.linkTrackVars=\"prop7\";\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//Planning\n\t\t\t\tcase \"planning\":\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//Trend\n\t\t\t\tcase \"trend\":\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//FIs\n\t\t\t\tcase \"addfi\":\n\t\t\t\t\twa.linkTrackVars=\"events\";\n\t\t\t\t\tevents=\"event11,event10\";\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents+\":\"+wa.userGuid;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"searchfi\":\t\t\n\t\t\t\t\twa.linkTrackVars=\"events\";\n\t\t\t\t\tevents=\"event12\";\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents+\":\"+wa.userGuid;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"sysmsg\":\t\t\t\t\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents;\n\t\t\t\t\tif(wa.events) { s.events=s.events+\":\"+wa.userGuid; }\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"closefioverlay\":\t//REMOVE FOR PHASE2(?)\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=\"event13\";\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents+\":\"+wa.userGuid;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Goals\n\t\t\t\tcase \"goalsclick\":\t\t\n\t\t\t\t\twa.linkTrackVars=\"prop7,eVar11\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"upload photo\":\t\n\t\t\t\t\twa.linkTrackVars=\"prop11,eVar11,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents = events;\n\t\t\t\t\ts.events = s.linkTrackEvents;\n\t\t\t\t\tif(wa.goalID) {s.events=s.events+\":\"+wa.goalID;}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"autosave goal\":\n\t\t\t\t\twa.linkTrackVars=\"prop11,eVar11,events\";\t\t\t\t\t\n\t\t\t\t\tevents=s.linkTrackEvents=wa.events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tif(wa.goalID) {s.events=s.events+\":\"+wa.goalID;}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"add a goal\":\n\t\t\t\tcase \"edit goal\":\n\t\t\t\tcase \"add account\":\n\t\t\t\tcase \"uncomplete goal\":\n\t\t\t\tcase \"click add task\":\n\t\t\t\tcase \"create task\":\n\t\t\t\tcase \"view task\":\n\t\t\t\tcase \"edit task\":\n\t\t\t\tcase \"complete task\":\n\t\t\t\tcase \"uncheck task\":\n\t\t\t\tcase \"rate details\":\n\t\t\t\t\twa.linkTrackVars=\"prop11,eVar11\";\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Offers\n\t\t\t\tcase \"offerclick\":\n\t\t\t\t\twa.linkTrackVars=\"events,transactionID,products,prop6,eVar6,prop7,eVar11\";\n\t\t\t\t\ts.linkTrackEvents=s.events;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"offerimpression\":\n\t\t\t\t\twa.linkTrackVars=\"eVar11,events,products\";\n\t\t\t\t\ts.linkTrackEvents=s.events;\n\t\t\t\t\tbreak;\n\n\t\t\t\t//Alerts\n\t\t\t\tcase \"alertimpression\":\n\t\t\t\tcase \"alertclick\":\n\t\t\t\tcase \"alertdismiss\":\n\t\t\t\t\twa.linkTrackVars=\"events,products\";\n\t\t\t\t\ts.linkTrackEvents=s.events;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Ways to Save (W2S)\n\t\t\t\tcase \"waW2SActions\":\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t//Ways to Invest (W2I)\n\t\t\t\tcase \"investmentActions\":\n\t\t\t\t\twa.linkTrackVars=\"prop7,events\";\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\t\t\t\t\n\t\t\t\t\n\t\t\t\t//Advice\n\t\t\t\tcase \"adviceshowdetails\":\n\t\t\t\tcase \"advicehidedetails\":\n\t\t\t\t\twa.linkTrackVars=\"prop26,\";\n\t\t\t\tcase \"adviceimpression\":\n\t\t\t\tcase \"advicelearnmore\":\n\t\t\t\tcase \"advicenext\":\n\t\t\t\tcase \"adviceignore\":\n\t\t\t\t\tif(wa.linkTrackVars) {\n\t\t\t\t\t\twa.linkTrackVars=wa.linkTrackVars+\"prop7,events,products\"; \n\t\t\t\t\t} else {\n\t\t\t\t\t\twa.linkTrackVars=\"prop7,events,products\"; \n\t\t\t\t\t}\n\t\t\t\t\tevents=wa.events;\n\t\t\t\t\ts.linkTrackEvents=events;\n\t\t\t\t\ts.events=s.linkTrackEvents;\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\t//Google Local\n\t\t\t\tcase \"glocal\":\n\t\t\t\t\twa.linkTrackVars=\"prop19\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"glocal-scid\":\n\t\t\t\t\twa.linkTrackVars=\"prop21,eVar21,prop19\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\twa.linkTrackVars=\"prop7\";\n\t\t\t\t\tif(wa.pageDetail) {\ts.prop7=wa.pageDetail; } else { s.prop7=defaultPath; }\n\t\t\t\t\ts.prop7=s.prop7+\":\"+linkName;\n\t\t\t\t\tif(pv_linkDetail) { s.prop7=s.prop7+\"_\"+pv_linkDetail; }\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t//if (stickyCid) {s.prop26= stickyCid+\" -- \"+wa.pageDetail+\"/\"+linkName+\"|\"+s.prop3;}else {s.prop26= wa.pageDetail+\"/\"+linkName+\"|\"+s.prop3; }\n\t\t\t\n\t\t\tif(wa.linkTrackVars) { s.linkTrackVars=s.linkTrackVars+\",\"+wa.linkTrackVars; }\n\n\t\t\twa.linkName=true;\n\n\t\t\ts=s_gi(s_account);\n\t\t\tvar lt=obj.href!=null?s.lt(obj.href):\"\";\n if (lt==\"\") { s.tl(obj,'o',linkName); }\n break;\n\n case \"page\":\n\t\t\tif(wa.events) {s.events = wa.events;}\n\t\t\tswitch(linkName) {\n\t\t\t\tcase \"closeoverlay\":\tbreak;\n\t\t\t\tcase \"searchfi\":\n\t\t\t\tcase \"addfi\":\t\t\t\n\t\t\t\t\ts.events=s.events+\":\"+wa.userGuid;break;\n\t\t\t}\n\t\t\tif(wa.goalAppendID) {\n\t\t\t\tif(wa.goalID) { s.events=s.events+\":\"+wa.goalID; }\n\t\t\t\twa.goalAppendID=false;\n\t\t\t}\n\t\t\t\n\t\t\ts.t(); //send page call\n\t\t\ts.products=\"\"; //reset products variable\n\t\t\twa.events=s.events=\"\"; //reset events variables\n break;\n default:\n s.pageName = linkName; //used for page tracking\n s.prop6=s.eVar6= \"\";\n //if (bEventTrack)\n s.events = events;\n s.t();\n break;\n }\n}", "goLink() {\n\t\tlet link = this.props.link;\n\t\twindow.open(link, \"_blank\")\n\t}", "function handleContactLinkClicked(event) {\n ReactGA.event({ category: 'Contact Us Link', action: 'Clicked', label: event.target.href });\n }", "function click(e) {\n //prevent all default clicks.\n //e.preventDefault();\n\n if (this.href.indexOf(\"_jcr_content\") === -1 && this.href.indexOf(\"jcr:content\") === -1) {\n var asynchronousPath = $(Cru.components.searchresults.className).data(\"asynchronous-path\");\n var a = $('<a>', { href:asynchronousPath } )[0];\n var path = a.href.split(\"/jcr:content\")[0];\n var selectors = this.href.split(path).pop();\n\n Cru.components.searchresults.refresh(asynchronousPath + selectors);\n } else {\n Cru.components.searchresults.refresh(this.href);\n }\n }", "function handleCrmLinkModal(event){\n \n setCurrentCrmOppType(event.currentTarget.id);\n crmModalToggle();\n setCurrentCrmSelectedOpp(null);\n setCurrentCrmSelectedOppText(\"Type-in and Select the CRM Opportunity to link !\");\n }", "function linkOnClickHandler(_e) {\n // switch back to map view if on mobile\n showMap();\n // Update the currentFeature to the art associated with the clicked link\n // var clickedListing = data.features[this.dataPosition];\n var clickedListing = this.listingFeature;\n\n if (!clickedListing.geometry.coordinates) {\n return console.warn(\n `Missing coordinates for listing: \"${\n clickedListing.properties.title\n }\". There is no marker on the map for this listing.`\n );\n }\n\n // 1. Fly to the point\n flyToArt(clickedListing);\n // 2. Close all other popups and display popup for clicked point\n createPopUp(clickedListing, this.listingId);\n\n // 3. Highlight listing in sidebar (and remove highlight for all other listings)\n var activeItem = document.getElementsByClassName(\"active\");\n\n if (activeItem[0]) {\n activeItem[0].classList.remove(\"active\");\n }\n this.parentNode.classList.add(\"active\");\n }", "function onLinkClicked(element) {\n const section = document.querySelector('#'+element.dataset.section);\n checkSectionsInView();\n scrollTO(section);\n}", "callEvent(event) {\n trackEvent('Single Page', 'clicked ' + event.currentTarget.id)\n }", "function linkOnClick(e) {\r\n\tvar obj = targetElement(e);\r\n\tif (isNS6) {\r\n\t\tobj = obj.parentNode;\r\n\t}\r\n\tvar id = obj.id;\r\n\tvar idarray = new Array();\r\n\tidarray = id.split(\"_\");\r\n\tcallFunction(idarray);\r\n}", "function link() {\n var LINKY_URL_REGEXP =\n /((ftp|https?):\\/\\/|(www\\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\\S*[^\\s.;,(){}<>\"”’]$/;\n var sub = selection.anchorNode.data.substring(0, selection.anchorOffset - 1);\n if (LINKY_URL_REGEXP.test(sub)) {\n var matchs = sub.match(LINKY_URL_REGEXP);\n if (matchs && matchs.length) {\n var st = selection.anchorOffset - matchs[0].length - 1;\n range.setStart(selection.anchorNode, st);\n scope.doCommand(null, {\n name: 'createLink',\n param: matchs[0]\n });\n }\n }\n }", "function linkClicked(type){\n\t\tswitch(type){\n\t\t\tcase 'people':\n\t\t\t\tturnOffListenersButCurrentOne($dropDownPeople);\n\t\t\t\tajaxForPeople();\n\t\t\t\tbreak;\n\t\t\tcase 'planets':\n\t\t\t\tturnOffListenersButCurrentOne($dropDownPlanets);\n\t\t\t\tajaxForPlanets();\n\t\t\t\tbreak;\n\t\t\tcase 'films':\n\t\t\t\tturnOffListenersButCurrentOne($dropDownFilms);\n\t\t\t\tajaxForFilms();\n\t\t\t\tbreak;\n\t\t\tcase 'species':\n\t\t\t\tturnOffListenersButCurrentOne($dropDownSpecies);\n\t\t\t\tajaxForSpecies();\n\t\t\t\tbreak;\n\t\t\tcase 'vehicles':\n\t\t\t\tturnOffListenersButCurrentOne($dropDownVehicles);\n\t\t\t\tajaxForVehicles();\n\t\t\t\tbreak;\n\t\t\tcase 'starships':\n\t\t\t\tturnOffListenersButCurrentOne($dropDownStarships);\n\t\t\t\tajaxForStarships();\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconsole.log(\"inside default linkClicked()\");\n\t\t}\n\t}", "function handleLinkClick(srcElement,cid){\t\t\n\t\tvar href = srcElement.href; \n\t\tvar temp = cid.split(\"|\")\n\t\tvar windowId = temp[0]\n\t\tvar id = temp[1]\n\n\t\tchrome.runtime.getBackgroundPage(function(eventPage) {\n\t\t\teventPage.switchTab(windowId,id);\n\t\t});\n}", "onSelect(event) {\n window.location.href = event.value;\n }", "function clickListener(num) {\n\treturn function() {\n\t\tself.port.emit(\"clicked-link\", num);\n\t};\n}", "function onClick() {return thisObj.load(this.href);}", "function onClick() {return thisObj.load(this.href);}", "function onExternalLinkClicked(link){\r\n //we are forcing all links in our docviewer to open in a new window.\r\n window.open(link);\r\n}", "function eventPoolLink(elm, e) {\n\t\tif (elm.attr(\"href\") === \"#\") {\n\t\t\te.preventDefault();\n\t\t}\n\t\t\n\t\tvar eventName = elm.attr(\"callbackEvent\");\n\t\ttdc.Grd.Event.Pool.trigger(eventName, {\n\t\t\t'elm': elm,\n\t\t\t'event': e\n\t\t});\n\t}", "_onLabelClick(e) {\n if (this.disabled) return;\n if (e.target.nodeName === \"A\") {\n // If click on link within label, navigate\n return;\n }\n\n this.model = !this.model;\n this._emit(\"model-change\", {\n value: this.model,\n });\n // prevent click checkbox within <a></a> triggering navigation\n e.preventDefault();\n }", "function onPreviewLinkClicked(event) {\n\n var url = event.target.getAttribute('href');\n if (url) {\n openPreview(url);\n event.preventDefault();\n }\n\n }", "function handleBroadLinkEvent(thisObj) {\n if (thisObj.getMeta().isMultivalued) {\n var selectedValues = thisObj.getPrimaryValues();\n thisObj.showBroadValueSet();\n thisObj.selectPrimaryValues(selectedValues);\n }\n else {\n thisObj.showBroadValueSet();\n thisObj.clearPrimaryValues();\n }\n thisObj.showOther();\n\n // We want to expand/collapse in both situations (singlevalued and multivalued data elements).\n // The multivalued case is obvious since we kept the selections from the previous value set.\n // In the singlevalued case, we may have generated the HTML on the server with a value\n // selected, and since we clear the value above we need to make sure the parent is collapsed.\n thisObj.expandCollapsePrimaryValues();\n }", "function webLinkHandler5x(event) {\n webLinkHandler(event, \"href\");\n }", "function webLinkHandler6x(event) {\n webLinkHandler(event, \"data-vtz-browse\");\n }", "onClick(options, activeModal, url) {\n let reason = options.reason;\n if (!reason && url) {\n reason = `Link click: ${url}`;\n }\n if (options.type === 'dismiss') {\n activeModal.dismiss(reason);\n }\n else if (options.type === 'close') {\n activeModal.close(reason);\n }\n }", "function setChannelLink(){\n document.querySelectorAll('.channel-link').forEach(link => {\n link.onclick = ()=> {\n load_channel(link.dataset.channel);\n return false;\n }\n });\n }" ]
[ "0.6859117", "0.68423307", "0.6615774", "0.656904", "0.65555376", "0.65233034", "0.6451522", "0.6348706", "0.6241252", "0.6215904", "0.6196734", "0.6171554", "0.6155926", "0.6136672", "0.61081654", "0.6096219", "0.6093206", "0.6088368", "0.60765094", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.6024824", "0.60089475", "0.6004479", "0.6000528", "0.59871674", "0.5966408", "0.5954488", "0.5917715", "0.5911001", "0.5901771", "0.5890483", "0.58780265", "0.58723444", "0.5867423", "0.5856524", "0.58563155", "0.58529943", "0.585005", "0.58355993", "0.58051777", "0.5803756", "0.580242", "0.57932615", "0.5792385", "0.5788557", "0.5762677", "0.5754991", "0.5746695", "0.5732233", "0.57040846", "0.56970924", "0.568023", "0.5678149", "0.5673607", "0.56597745", "0.5652196", "0.5647585", "0.5646755", "0.564265", "0.56198376", "0.5619502", "0.56123847", "0.5609807", "0.5609807", "0.56077296", "0.5603683", "0.5594206", "0.55878747", "0.55824226", "0.5565047", "0.5557654", "0.55575705", "0.5552947" ]
0.5703929
77
gets called when the user clicks on a tag link
function tag_link_clicked(tag_id) { $("#frm-filter").append('<input type="checkbox" name="tag_' + tag_id + '" CHECKED>').submit(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onTagClick(e) {\r\n console.log(e.detail);\r\n console.log(\"onTagClick: \", e.detail);\r\n }", "function onTagClick(e){\n console.log(e.detail);\n console.log(\"onTagClick: \", e.detail);\n }", "function onClickTag(e)\n{\n\tif (!e) var e = window.event;\n\tvar theTarget = resolveTarget(e);\n\tvar popup = Popup.create(this);\n\tvar tag = this.getAttribute(\"tag\");\n\tvar title = this.getAttribute(\"tiddler\");\n\tif(popup && tag)\n\t\t{\n\t\tvar tagged = store.getTaggedTiddlers(tag);\n\t\tvar titles = [];\n\t\tvar li,r;\n\t\tfor(r=0;r<tagged.length;r++)\n\t\t\tif(tagged[r].title != title)\n\t\t\t\ttitles.push(tagged[r].title);\n\t\tvar lingo = config.views.wikified.tag;\n\t\tif(titles.length > 0)\n\t\t\t{\n\t\t\tvar openAll = createTiddlyButton(createTiddlyElement(popup,\"li\"),lingo.openAllText.format([tag]),lingo.openAllTooltip,onClickTagOpenAll);\n\t\t\topenAll.setAttribute(\"tag\",tag);\n\t\t\tcreateTiddlyElement(createTiddlyElement(popup,\"li\"),\"hr\");\n\t\t\tfor(r=0; r<titles.length; r++)\n\t\t\t\t{\n\t\t\t\tcreateTiddlyLink(createTiddlyElement(popup,\"li\"),titles[r],true);\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\tcreateTiddlyText(createTiddlyElement(popup,\"li\",null,\"disabled\"),lingo.popupNone.format([tag]));\n\t\tcreateTiddlyElement(createTiddlyElement(popup,\"li\"),\"hr\");\n\t\tvar h = createTiddlyLink(createTiddlyElement(popup,\"li\"),tag,false);\n\t\tcreateTiddlyText(h,lingo.openTag.format([tag]));\n\t\t}\n\tPopup.show(popup,false);\n\te.cancelBubble = true;\n\tif (e.stopPropagation) e.stopPropagation();\n\treturn(false);\n}", "function onTagClick($e){\n\t\t\tvar el = $($e.currentTarget);\n\t\t\tvar str = el.text();\n\t\t\t\n\t\t\taddTag(str);\n\t\t}", "function click_tag(){\n $('.post__tag_link').click(function(){\n /*\n When clicking on one of the tags, only tag related articles will be shown\n remove unrelevant stuff, e.g. header part, exisiting articles, etc.\n */\n $(\".main__header, article, .rslides_container, .whatsnew__div\").remove();\n $(\"#newer\").hide();\n tag_doc = filter_post_by_tag(mygene_doc, this.innerHTML);\n //reset the current page to 1\n current_page = 1;\n // calculate the number of relevant articles, and insert an h2 title on top of articles\n $(\".menu\").after('<h2 class=\"main__header\">Tag archive: <span class=\"main__header--tagname\">' + this.innerHTML + ' ' + '(' + tag_doc.length + ')</span></h2>')\n //recalculate the total number of pages\n page_num = Math.ceil(tag_doc.length/4);\n $('#page').text('page ' + current_page + ' of ' + page_num);\n //If only one page exists, then hide the \"older\" button\n if (page_num == 1) {\n $(\"#older\").hide();\n } else {\n $(\"#older\").show();\n }\n show_post_by_page(current_page, tag_doc);\n add_transition();\n //self call function\n click_tag();\n })\n }", "function clicktags(){\n $(\".listtags a\").each(function(i){\n $(this).click(function(e) {\n $(this).remove();\n registertags();\n return false;\n });\n });\n }", "function onClick(link){\n \n}", "function onTagChange() {\n\n\t}", "function tagItem1(){\r\n var current = getCurrentEntry();\r\n var currentEntry = current.getElementsByTagName(\"entry-tagging-action-title\")[0];\r\n // var currentEntry = $(\"#current-entry .entry-actions\r\n // .entry-tagging-action-title\");\r\n simulateClick(currentEntry);\r\n }", "onTagClick(tag) {\n\t\tlet tags = storeActions.getTags();\n\n\t\tif (tags.includes(tag)) {\n\t\t\tstoreActions.deleteTag(tag);\n\t\t} else {\n\t\t\tstoreActions.addTag(tag)\n\t\t}\n\t}", "function tagClick(e, element) {\n\te.stopPropagation(); //impedisce che venga chiamato l'onclick del div padre.\n\tsetTag(element.value);\n}", "function links_click_event(event) {\n console.log(\"works link\");\n}", "function handleClickedLink( url, view ) {\n\t// return true if the link was handled or to prevent other plugins or Colloquy from handling it\n\treturn false;\n}", "function _handleTagClick(e) {\n var labelTags = status.targetLabel.getProperty('tagIds');\n\n // Use position of cursor to determine whether the click came from the mouse or from a keyboard shortcut.\n var wasClickedByMouse = e.hasOwnProperty(\"originalEvent\") &&\n e.originalEvent.clientX !== 0\n && e.originalEvent.clientY !== 0;\n\n $(\"body\").unbind('click').on('click', 'button', function(e) {\n if (e.target.name === 'tag') {\n // Get the tag_id from the clicked tag's class name (e.g., \"tag-id-9\").\n var currTagId = parseInt($(e.target).attr('class').split(\" \").filter(c => c.search(/tag-id-\\d+/) > -1)[0].match(/\\d+/)[0], 10);\n var tag = self.labelTags.filter(tag => tag.tag_id === currTagId)[0];\n\n // Adds or removes tag from the label's current list of tags.\n if (!labelTags.includes(tag.tag_id)) {\n // Deals with 'no alternate route' and 'alternate route present' being mutually exclusive.\n var alternateRoutePresentId = self.labelTags.filter(tag => tag.tag === 'alternate route present')[0].tag_id;\n var noAlternateRouteId = self.labelTags.filter(tag => tag.tag === 'no alternate route')[0].tag_id;\n // Automatically deselect one of the tags above if the other one is selected.\n if (currTagId === alternateRoutePresentId) {\n labelTags = _autoRemoveAlternateTagAndUpdateUI(noAlternateRouteId, labelTags);\n } else if (currTagId === noAlternateRouteId) {\n labelTags = _autoRemoveAlternateTagAndUpdateUI(alternateRoutePresentId, labelTags);\n }\n\n // Deals with 'street has a sidewalk' and 'street has no sidewalks' being mutually exclusive.\n var streetHasOneSidewalkId = self.labelTags.filter(tag => tag.tag === 'street has a sidewalk')[0].tag_id;\n var streetHasNoSidewalksId = self.labelTags.filter(tag => tag.tag === 'street has no sidewalks')[0].tag_id;\n // Automatically deselect one of the tags above if the other one is selected.\n if (currTagId === streetHasOneSidewalkId) {\n labelTags = _autoRemoveAlternateTagAndUpdateUI(streetHasNoSidewalksId, labelTags);\n } else if (currTagId === streetHasNoSidewalksId) {\n labelTags = _autoRemoveAlternateTagAndUpdateUI(streetHasOneSidewalkId, labelTags);\n }\n\n // Log the tag click.\n labelTags.push(tag.tag_id);\n if (wasClickedByMouse) {\n svl.tracker.push('ContextMenu_TagAdded', { tagId: tag.tag_id, tagName: tag.tag });\n } else {\n svl.tracker.push('KeyboardShortcut_TagAdded', { tagId: tag.tag_id, tagName: tag.tag });\n }\n } else {\n var index = labelTags.indexOf(tag.tag_id);\n labelTags.splice(index, 1);\n if (wasClickedByMouse) {\n svl.tracker.push('ContextMenu_TagRemoved', { tagId: tag.tag_id, tagName: tag.tag });\n } else {\n svl.tracker.push('KeyboardShortcut_TagRemoved', { tagId: tag.tag_id, tagName: tag.tag });\n }\n }\n _toggleTagColor(labelTags, tag.tag_id, e.target);\n status.targetLabel.setProperty('tagIds', labelTags);\n e.target.blur();\n $tagHolder.trigger('tagIds-updated'); // For events that depend on up-to-date tagIds.\n }\n });\n }", "function onClickTagOpenAll(e)\n{\n\tif (!e) var e = window.event;\n\tvar tag = this.getAttribute(\"tag\");\n\tvar tagged = store.getTaggedTiddlers(tag);\n\tfor(var t=tagged.length-1; t>=0; t--)\n\t\tstory.displayTiddler(this,tagged[t].title,null,false,e.shiftKey || e.altKey);\n\treturn(false);\n}", "onAddTag() {}", "function tagClickCallback() {\n if (status.applied) {\n sg.tracker.push(\"TagUnapply\", null, {\n Tag: properties.tag,\n Label_Type: properties.label_type\n });\n unapply();\n } else {\n sg.tracker.push(\"TagApply\", null, {\n Tag: properties.tag,\n Label_Type: properties.label_type\n });\n apply();\n }\n\n sg.cardFilter.update();\n }", "function initTagClicks(){\n\t\t\tconsole.log(\"initTagClicks\");\n\t\t\t$(\"ul.tags li\").click(jQuery.scope(onTagClick,this));\n\t\t}", "function Tagged() {\r\n}", "click(e){\r\n if ( this.url ){\r\n bbn.fn.link(this.url);\r\n }\r\n else{\r\n this.$emit('click', e);\r\n }\r\n }", "function handleClick(el,e) {\n\tloadURL(el.attributes.target,el.text);\n}", "function onLinkClick(linkClicked) {\n\n // Determines the number of the clicked button\n const linkNumber = String(linkClicked.textContent);\n\n // Removes any class names from the anchor tags\n resetLinkClassNames();\n\n // Adds an active class to the selected button\n linkClicked.className = \"active\";\n\n // Remakes the links based on button number clicked\n placePaginatedLinks(linkNumber);\n\n}", "function onentertag() {\n currentTag = {\n type: 'mdxTag',\n name: null,\n close: false,\n selfClosing: false,\n attributes: []\n }\n }", "function onTagChange($e,$data){\n\t\t\taddTag($data.item.value);\n\t\t}", "function openlink(upperCase){\n clickAnchor(upperCase,getItem(\"link\"));\n}", "function tagHandler(event) {\n let page;\n let list;\n if (!allRecipesDisplay.classList.contains('hidden')\n && !tagList.classList.contains('hidden')) {\n page = allRecipesDisplay;\n list = instantiatedRecipes;\n } else if (!favoriteRecipesDisplay.classList.contains('hidden')\n && !tagList.classList.contains('hidden')) {\n page = favoriteRecipesDisplay;\n list = currentUser.lists.favoriteRecipes\n }\n runTag(page, list);\n resetTagsIfEmpty();\n}", "function handleLinkClick(event) {\n\t\tvar linkLabel = event.currentTarget.id;\n\t\tvar url;\n\t\tswitch(linkLabel) {\n\t\t\tcase 'pivotal' :\n\t\t\t\turl = \"http://www.gopivotal.com/\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'support' :\n\t\t\t\turl = \"https://support.gopivotal.com/hc/en-us\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'feedback' :\n\t\t\t\turl = \"http://www.gopivotal.com/contact\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'help' :\n\t\t\t\turl = \"../../static/docs/gpdb_only/index.html\";\n\t\t\t\twindow.open(url, '_blank');\n\t\t\t\tbreak;\n\t\t\tcase 'logout' :\n\t\t\t\tlogoutClick();\n\t\t\t\tbreak;\n\t\t}\n\t}", "function onClickEventHandler(event){\n \n var target = event.target;\n if(target && target.getAttribute(\"cricket\", \"1\")) {\n \n var url = target.getAttribute(\"value\");\n if(url) {\n loadLink(event, url, false);\n }\n }\n}", "function updateTags(tags) {\n $('#tags').empty();\n tags = Object.keys(tags);\n tags = tags.sort();\n $.each(tags, function(index, tag) {\n var taglink = $('<a>')\n .text(tag)\n .addClass('taglink')\n .bind('click', function() {\n updateTagView(readTagView(), tag);\n });\n $('#tags').append(taglink);\n });\n}", "function listenToATags() {\n $('a.tooltipped').on('click', (e) => {\n // Close the tooltip for the clicked a element\n closeToolTip(e.currentTarget);\n });\n}", "function selectTag(tag) {\n //update list of tags to reflect which is active\n activateTag(tag);\n\n activeTag = tag;\n\n //display results\n filter();\n}", "function onLinkClick( event ){\n event.preventDefault();\n var link = event.target,\n html = link.innerHTML;\n link.innerHTML = 'Click';\n link.className = 'item clicked';\n setTimeout( function(){\n link.innerHTML = link.getAttribute('data-num');\n link.className = 'item';\n }, 500 );\n return false;\n }", "function torrentOnClick(info, tab) {\r\n add_torrent(info.linkUrl);\r\n}", "function setDrawEventListener(tagIdName, flagHTML) {\n var link = document.getElementById(tagIdName);\n\n link.addEventListener(\"click\", function (event) {\n addHTML(\"flag\", flagHTML);\n // Prevent the link tag from following a url.\n event.preventDefault();\n });\n }", "function handleLinkClick(event) {\n event.preventDefault();\n console.dir(event);\n}", "openTag() {\n var _a;\n this.processAttribs();\n const { tags } = this;\n const tag = this.tag;\n tag.isSelfClosing = false;\n // There cannot be any pending text here due to the onopentagstart that was\n // necessarily emitted before we get here. So we do not check text.\n // eslint-disable-next-line no-unused-expressions\n (_a = this.openTagHandler) === null || _a === void 0 ? void 0 : _a.call(this, tag);\n tags.push(tag);\n this.state = S_TEXT;\n this.name = \"\";\n }", "function appendTags() {\n \n $.each(availableTags, function(k, tag) {\n $('#DataTags').append(\n '<a href=\"#\" class=\"label\" onclick=\"Tags.toggleTag(this, \\''+tag+'\\')\">'+tag+'</a> '\n );\n });\n \n }", "function tag_click(tagButton) {\n let id = tagButton.className.substring(40);\n uploadTagArray[parseInt(id)].tag = tagButton.innerHTML;\n $(\"#word\" + id).css(\"background-color\", getTagColor(tagButton.innerHTML, availableOptionArray));\n}", "function fnVoltarLink() {\r\n\tvar oLink = document.links[0];\r\n\toLink.innerHTML = \"Pegar Feeds\";\r\n\toLink.className = \"\";\r\n\toLink.onclick = fnGo;\r\n}", "function tagInvoked(e) {\n tagcloud.splice(e.detail.itemPromise._value.index, 1);\n\n if (document.getElementById(\"b1\").innerText == \"_________\") {\n document.getElementById(\"b1\").innerText = e.detail.itemPromise._value.data.name;\n searchTags(e.detail.itemPromise._value.data.name);\n //getMixes(1, \"\", document.getElementById(\"b1\").innerText, \"\", 8, 4);\n }\n else if (document.getElementById(\"b2\").innerText == \"_________\") {\n document.getElementById(\"b2\").innerText = e.detail.itemPromise._value.data.name;\n var tag1 = document.getElementById(\"b1\").innerText;\n var tag2 = document.getElementById(\"b2\").innerText;\n //getMixes(1, \"\", tag1 + \"%2B\" + tag2, \"\", 8, 4);\n getMixes(1, \"\", tag1 + \"%2B\" + tag2, \"\", 40, 3);\n var testlist = new Array(24);\n thirdgridview.winControl.itemDataSource = testlist.dataSource;\n window.location.hash = '#secondgridview';\n document.getElementById(\"b1\").innerText = \"_________\";\n document.getElementById(\"b2\").innerText = \"_________\";\n searchTags(\"\");\n }\n }", "function linkOnClick(e) {\r\n\tvar obj = targetElement(e);\r\n\tif (isNS6) {\r\n\t\tobj = obj.parentNode;\r\n\t}\r\n\tvar id = obj.id;\r\n\tvar idarray = new Array();\r\n\tidarray = id.split(\"_\");\r\n\tcallFunction(idarray);\r\n}", "function suggestedTagClicked( tagId, tagName ) {\r\n // If the input field is disabled, return without doing anything\r\n if ( jQuery('#tagsInput').prop('disabled') )\r\n return;\r\n\r\n // Determine if the element has already been selected\r\n var previouslySelected = false;\r\n if ( jQuery('#related-tag-id-'+tagName).data('isSelected') === true )\r\n previouslySelected = true;\r\n\r\n // Adds the clicked recipient to the selection list if not already selected\r\n if ( ! previouslySelected ) {\r\n jQuery('#tagsInput').tagsinput('add', tagName);\r\n }\r\n // Otherwise, removes the selected recipient\r\n else {\r\n jQuery('#tagsInput').tagsinput('remove', tagName);\r\n }\r\n}", "function addTag(tag) {\n var node = document.createElement(\"li\");\n $(node).append('<span>' + tag + '</span><a href=\"#\" title=\"Remove tag\">x</a>');\n\n // When clicked, remove the node and save the tags list.\n $(node).find('a').click(function() {\n $(node).remove();\n saveTags();\n })\n\n // Add to the list.\n $list.append(node);\n }", "function addTagLabel(name) {\n let tagList = document.getElementById(\"tag-line\");\n let newTag = document.createElement(\"span\");\n let newText = document.createElement(\"span\");\n let newRemove = document.createElement(\"a\");\n let newIcon = document.createElement(\"i\");\n let input = document.getElementById(\"tag-add\");\n\n input.value = \"\";\n\n newTag.className = \"tag-label tag\";\n newTag.id = name;\n\n let aElement = document.createElement('a');\n aElement.innerText = name;\n newText.appendChild(aElement);\n\n newIcon.className = \"remove glyphicon glyphicon-remove-sign glyphicon-white\";\n\n newRemove.onclick = function() {\n tagList.removeChild(newTag);\n toAddTagList.delete(name.toLowerCase());\n removeTagFromItem(name);\n };\n newText.onclick = function() {\n window.location.href = '/tags/display/' + encodeURIComponent(name.toLowerCase());\n };\n newRemove.appendChild(newIcon);\n newTag.appendChild(newText);\n newTag.appendChild(newRemove);\n\n if(!toAddTagList.has(name)) {\n toAddTagList.add(name);\n tagList.appendChild(newTag);\n }\n}", "function activateLink(e){\n // remove/add .active\n let activeLink = document.getElementsByClassName('active')[0] ? \n document.getElementsByClassName('active')[0] : \n null;\n\n if(activeLink){\n activeLink.removeAttribute('class');\n }\n e.target.setAttribute('class', 'active');\n\n // get the paragraph\n let content = new Content();\n content.getParagraphByIndex(e.target.id);\n\n // change the url in the address bar\n window.history.pushState(\"\", \"\", e.target.id);\n}", "static get tag() {\n return \"rich-text-editor-link\";\n }", "function handle_vote(o,e)\n{\n\te.preventDefault();\t\t// prevent the link to continue\n\tdo_vote(o);\n}", "function tagLinks(tags) {\n\tvar t = tags.split(\",\");\n\tvar i;\n\tvar links = \"\";\n\tfor(i=0;i<t.length;i++){\n\t\tlinks = links +\"<a href='tag.php?tag=\"+t[i].trim()+\"'>\"+t[i].trim()+\"</a>\";\n\t}\n\treturn links;\n}", "function tagItem2(){\r\n var tagEdit = document.getElementsByTagName(\"tags-edit\");\r\n var tagEditTags = tagEdit.getElementsByTagName(\"tags-edit-tags\");\r\n \r\n tagEditTags.innerHTML += txtTag.innerText;\r\n /*\r\n * $(\".tags-edit .tags-edit-tags\").val( $(\".tags-edit\r\n * .tags-edit-tags\").val() + $(\"#txtTag\").val()); //\r\n * document.getElementById('tags-container-template');\r\n *\r\n * var popup = $(\".tags-edit .tags-edit-buttons\")\r\n * .find(\".goog-button-body\"); //\r\n * document.getElementById('tags-container-template');\r\n */\r\n var tagEditButton = tagEdit.getElementsByTagName(\"tags-edit-buttons\")[0];\r\n var popup = tagEditButton.getElementsByTagName(\"goog-button-body\")[0];\r\n \r\n simulateClick(popup);\r\n }", "function handleContactLinkClicked(event) {\n ReactGA.event({ category: 'Contact Us Link', action: 'Clicked', label: event.target.href });\n }", "function postTagInHtml(successData, neededValues) {\n //Add new tag span layout to page\n $('.contents a[href$=\\'' + neededValues.currentPageURL + '\\']').parent().after('<span class=\\'tag\\'>' + neededValues.newTags + ' <i class=\"fas fa-times deleteTagButton\"></i></span>');\n //Remove input field\n $('.tagInputOverview').remove();\n\n // Find new tag\n const newDeleteTagButton = $('a[href$=\\'' + neededValues.currentPageURL + '\\']').parent().parent().find('.deleteTagButton').first();\n // Assign hover listener to new tag\n deleteClickAndHoverEvent(newDeleteTagButton);\n}", "tagSearch(event) {\n //Search for tags matching\n }", "navigateHyperlink() {\n let fieldBegin = this.getHyperlinkField();\n if (fieldBegin) {\n this.fireRequestNavigate(fieldBegin);\n }\n }", "function modifyAnchorTags(caller) {\n var tagParts, currentStateLink, isSamePage, pathHashCount;\n if (caller === \"modalPopupCtrl.pageContent\" || ctrl.currentLink === undefined) {\n currentStateLink = [];\n }\n else {\n currentStateLink = ctrl.currentLink.split('/');\n }\n $(ctrl.anchorTags).each(function (index) {\n if (ctrl.anchorTags[index].hasAttribute('href')) {\n var isExternalLink = ctrl.anchorTags[index].getAttribute('href').indexOf('http');\n if (isExternalLink === -1) {\n if (ctrl.anchorTags[index].getAttribute('href').indexOf('Page?$filter=contains(Title') !== -1) {\n $(ctrl.anchorTags[index]).attr('class', 'removed-link');\n var splittedArray = ctrl.anchorTags[index].getAttribute('href').split(\"'\");\n var pageTitle = null;\n if (splittedArray[1]) {\n pageTitle = splittedArray[1];\n }\n var docId = null;\n if (splittedArray[3]) {\n docId = splittedArray[3];\n }\n DocumentService.getAllPages(\"$filter=contains(tolower(Title),tolower('\" + pageTitle + \"')) and DocumentCode eq '\" + docId + \"'\")\n .then(function (result) {\n if (result.value.length > 0) {\n var popupData = '';\n var currentReleasePage = $.grep(result.value, function (e) { return e.ReleaseId === $rootScope.release; });\n if (currentReleasePage.length === 0) {\n if (result.value.length > 1) {\n popupData = createPopupData(result.value, index, caller);\n angular.element(ctrl.anchorTags[index]).attr('id', 'linktag' + index);\n angular.element(ctrl.anchorTags[index]).attr('data-toggle', 'dropdown');\n angular.element(ctrl.anchorTags[index]).attr('aria-haspopup', 'true');\n angular.element(ctrl.anchorTags[index]).attr('aria-expanded', 'false');\n $(ctrl.anchorTags[index]).wrap('<div style=\\\"display:inline-block;\\\" class=\\\"dropdown\\\"></div>');\n var linkText = angular.element(ctrl.anchorTags[index]).html();\n angular.element(ctrl.anchorTags[index]).html(linkText + \" <span class=\\\"caret\\\"></span> \");\n angular.element(popupData).insertAfter(ctrl.anchorTags[index]);\n } else {\n currentReleasePage = result.value[0];\n }\n } else {\n currentReleasePage = currentReleasePage[0];\n }\n if (caller === \"modalPopupCtrl.pageContent\") {\n if (popupData === '') {\n $(ctrl.anchorTags[index]).on(\"click\", function () {\n $rootScope.reloadPopUpOnLnkClk(currentReleasePage.Id);\n }\n );\n var buttonNewTab = window.document.createElement('a');\n angular.element(buttonNewTab).attr('href', '' + ctrl.docCenterUrl + '#/docHome/document/' + currentReleasePage.DocumentId +\n '/page/' + currentReleasePage.Id + '');\n angular.element(buttonNewTab).attr('target', '_blank');\n var spanNewTab = window.document.createElement('span');\n angular.element(buttonNewTab).append(' ');\n angular.element(buttonNewTab).append(spanNewTab);\n angular.element(buttonNewTab).insertAfter(ctrl.anchorTags[index]);\n }\n }\n else {\n $(ctrl.anchorTags[index]).on(\"click\", function () {\n if (popupData === '') {\n ctrl.changeState(currentReleasePage.DocumentId, currentReleasePage.Id, null);\n }\n });\n }\n $(ctrl.anchorTags[index]).removeAttr(\"class\");\n $(ctrl.anchorTags[index]).attr('style', 'cursor: pointer;');\n }\n });\n $(ctrl.anchorTags[index]).removeAttr('href');\n return;\n }\n tagParts = ctrl.anchorTags[index].getAttribute('href').split('/');\n isSamePage = ctrl.anchorTags[index].getAttribute('issamepage');\n pathHashCount = ctrl.anchorTags[index].getAttribute('isPathHavingHash');\n if (tagParts.length > 0) {\n ctrl.items = tagParts[tagParts.length - 1].split('#');\n // Check if the link is in the same page.\n if (currentStateLink[currentStateLink.length - 1] === ctrl.items[0] || isSamePage === \"true\") {\n if (ctrl.items.length > 1) {\n (function (anchorId) {\n $(ctrl.anchorTags[index]).on(\"click\", function () {\n ctrl.goToHeading(anchorId);\n });\n }(ctrl.items[1]));\n }\n $(ctrl.anchorTags[index]).removeAttr('issamepage');\n\n } else {\n var documentId, pageId, achId;\n documentId = tagParts[2];\n pageId = ctrl.items[0];\n achId = ctrl.items[1];\n if (pathHashCount && parseInt(pathHashCount, 10) > 0) {\n if (ctrl.items.length > parseInt(pathHashCount, 10) + 1) {\n achId = ctrl.items[ctrl.items.length - 1];\n var pageIdArray = ctrl.items.slice(0, ctrl.items.length - 1);\n pageId = pageIdArray.join('#');\n } else {\n pageId = ctrl.items.join('#');\n achId = null;\n }\n $(ctrl.anchorTags[index]).removeAttr('isPathHavingHash');\n }\n $(ctrl.anchorTags[index]).on(\"click\", function () {\n ctrl.changeState(documentId, pageId, achId);\n });\n }\n $(ctrl.anchorTags[index]).attr('style', 'cursor: pointer;');\n $(ctrl.anchorTags[index]).removeAttr(\"class\");\n $(ctrl.anchorTags[index]).removeAttr('href');\n }\n } else {\n $(ctrl.anchorTags[index]).attr('target', '_blank');\n }\n }\n });\n }", "function activateTag(tag) {\n //clear all tags in list of tag-active class\n var items = document.getElementsByClassName('tag-item');\n for(var i=0; i < items.length; i++) {\n items[i].classList.remove(\"tag-active\");\n }\n\n // set the selected tag's item to active\n var item = document.getElementById(tag + '-item');\n if(item) {\n item.classList.add(\"tag-active\");\n }\n}", "static get tag() {\n return \"rich-text-editor-link\";\n }", "function bindingArticleClick() {\n $('#rovat .content a').bind('click', function (event, ui) {\n document.getElementById(\"article-content\").src = this.dataset.url;\n });\n}", "function makeItClickable(){\n\n }", "function onTagsButtonTouched(e){\n\t// Only if the tag count is above 0\n\tif (media.tags.length) {\n\t\t// Load the tags view\n\t\tvar view = Alloy.createController(\"media/hashtags\", {\n\t\t\t\"tags\": media.tags\n\t\t}).getView();\n\t\n\t\taddViewToSections(view);\n\t} else {\n\t\tanimation.shake($.hashtagsButton);\n\t}\n}", "function handleLinkClick(srcElement,cid){\t\t\n\t\tvar href = srcElement.href; \n\t\tvar temp = cid.split(\"|\")\n\t\tvar windowId = temp[0]\n\t\tvar id = temp[1]\n\n\t\tchrome.runtime.getBackgroundPage(function(eventPage) {\n\t\t\teventPage.switchTab(windowId,id);\n\t\t});\n}", "function isOpenTag(params) {\r\n \r\n}", "function handleFeatureLinkClick(evt)\n{\n console.log('a.feature.link was clicked');\n //set the image src to the anchor's href value\n featureImage.src = featureLink.href;\n\n //make the image visible\n featureImage.classList.remove('hidden');\n\n //dont want to load the image in the page\n evt.preventDefault();\n}", "function TagMenu_initializeUI(newLinkStr) {\r\n var tagNames = new Array()\r\n var tagValues = new Array();\r\n \r\n var dom = dw.getDocumentDOM();\r\n\r\n // get the current selection\r\n var selNode, offsets;\r\n selNode = this.getSelectedTag();\r\n if (selNode) { //if selection is inside a tag, select the entire tag\r\n offsets = dw.nodeToOffsets(selNode);\r\n dw.setSelection(offsets[0],offsets[1]);\r\n }\r\n \r\n if (this.tagList.length == 1 && this.tagList[0] == \"A\") {\r\n\r\n // if no tag selection, ensure the selection is linkable\r\n if (!selNode) {\r\n selStr = dwscripts.trim(dwscripts.fixUpSelection(dom,false,true));\r\n if (selStr && !stringCanBeLink(selStr)) {\r\n offsets = dom.getSelection();\r\n dw.setSelection(offsets[1],offsets[1]); //move the insertion point after the selection\r\n selStr = \"\";\r\n }\r\n }\r\n\r\n // add a new link or a selection as the first item in the list\r\n if (selNode || !selStr) { //if sel is link, or no valid selection\r\n\r\n newLinkStr = (newLinkStr != null) ? newLinkStr : \"New Link\";\r\n\r\n //add generic new link item to menu\r\n tagNames.push(dwscripts.sprintf(MM.LABEL_CreateNewLink,newLinkStr));\r\n\t\t \r\n newLinkStr = dwscripts.entityNameDecode(newLinkStr);\r\n\t tagValues.push(\"createAtSelection+\"+newLinkStr);\r\n\r\n } else { //else selection could be converted to link, so add it\r\n var displayString = dwscripts.trim(selStr);\r\n displayString = displayString.replace(/\\s+/,\" \"); //replace all newlines and whitespace with a single space\r\n displayString = dwscripts.entityNameDecode(displayString);\r\n tagNames.push(MM.LABEL_SelectionLink+' \"' + displayString + '\"');\r\n tagValues.push(\"createAtSelection+\"+selStr);\r\n\r\n }\r\n }\r\n\r\n // add all other tags to menu\r\n var nodes = this.getTagElements();\r\n for (var i=0; i < nodes.length; i++) {\r\n\r\n tagNames.push(this.getNiceName(nodes[i], i));\r\n tagValues.push(nodes[i]);\r\n\r\n }\r\n \r\n // set the list control\r\n this.listControl = new ListControl(this.paramName); \r\n this.listControl.setAll(tagNames, tagValues);\r\n\r\n // if link currently selected, pick it in the list\r\n if (selNode) {\r\n this.pickValue(selNode);\r\n }\r\n}", "function linkTopic(a) {\n a .on(\"click\", click);\n //.on(\"mouseover\", mouseover)\n //.on(\"mouseout\", mouseout);\n}", "function update_utag_link(dsc) {\n if (dsc != '') {\n var omni_arr = dsc.split('|');\n // User Action Tracking for Global Navigation Menu.\n if (omni_arr[0] != '' && omni_arr[0] == 'global-nav' && omni_arr[1] != '') {\n omni_click_id = dsc;\n utag.link({\n \"event_name\": omni_arr[0],\n \"click_id\": omni_click_id\n });\n } else if (omni_arr[0] != '' && omni_arr[0] == 'social_share' && omni_arr[1] != '') {\n // User Action Tracking for Social Share.\n var omni_event_name = omni_arr[0];\n var omni_social_network = omni_arr[1];\n var omni_click_id = 'sharebar|' + omni_arr[1];\n utag.link({\n \"event_name\": omni_event_name,\n \"social_network\": omni_social_network,\n \"click_id\": omni_click_id\n });\n }\n }\n}", "function Permalink_evc_click(event) {\r\n //cancel_event(event);\r\n //var id = this.parentNode.parentNode.parentNode.parentNode.parentNode.id;\r\n \r\n}", "function addTagSearchTagListeners() {\n function redirectToTagPage(tag, datalist) {\n for (let dataTag of datalist.options) {\n if (dataTag.value.toUpperCase() === tag.toUpperCase()) {\n window.location.href = \"/tags/display/\" + encodeURIComponent(tag.toLowerCase());\n }\n }\n }\n\n try {\n const searchBar = document.getElementById(\"tag-search\");\n const datalist = document.getElementById(\"tag-results\");\n searchBar.addEventListener('input', (e) => {\n if (e.constructor.name !== 'InputEvent') {\n // then this is a selection, not user input\n redirectToTagPage(searchBar.value, datalist)\n }\n while (datalist.firstChild) {\n datalist.removeChild(datalist.firstChild);\n }\n const query = searchBar.value;\n if (query) {\n searchTags(query);\n }\n });\n searchBar.addEventListener('keyup', e => {\n if (e.key === 'Enter') {\n redirectToTagPage(searchBar.value, datalist);\n }\n })\n } catch (err) {\n //do nothing. Just to avoid errors if the correct page is not loaded\n }\n}", "function getClickTag() {\n return window.clickTag || 'http://www.google.com';\n }", "function construct_tag(tag_name){\n render_tag = '<li class=\"post__tag\"><a class=\"post__link post__tag_link\">' + tag_name + '</a> </li>'\n return render_tag\n}", "handleAddTag(cardId, text = '') {}", "function handleClick(e) {\n if (e.target.nodeName === \"A\") {\n e.preventDefault();\n console.log(\"markdown link click\")\n if (e.target.href) {\n const url = new URL(e.target.href);\n //if it is an internal link, push to history so page doesnt refresh\n if (url.hostname.indexOf(\".hotter.com\") > -1 || url.hostname === \"localhost\" || url.hostname.indexOf(\"hotter-amplience-poc.herokuapp.com\") > -1) {\n history.push(e.target.pathname);\n } else {\n //otherwise open new tab\n window.open(url.href, \"_blank\")\n }\n }\n }\n}", "handleLinkEvent(event, link) {\n if (this.renderer && this.renderer.handleLinkEvent) {\n this.renderer.handleLinkEvent(this.editorContext, event, link);\n }\n }", "function linkedInButton() {\n var s = s_gi(s_account);\n s.eVar2 = 'LinkedIn';\n s.events = 'event12';\n s.trackExternalLinks = false;\n s.linkTrackVars = 'eVar2,events';\n s.linkTrackEvents = 'event12';\n s.tl(this, 'o', s.eVar2);\n}", "function onLinkClicked(element) {\n const section = document.querySelector('#'+element.dataset.section);\n checkSectionsInView();\n scrollTO(section);\n}", "_onClickUrl(urlLink) {\n //Alert.alert(\"clicked\");\n Linking.openURL(\"http://\"+urlLink);\n \n }", "function onLinkRated() {\r\n\tvar taskIdx = selectedTaskIdx();\r\n\tvar search = getSearch(taskIdx, gCurrentSearch.query);\r\n\tif (search) {\r\n\t\tvar link = getLink(search, gCurrentSearch.url);\r\n\t\tif (link) {\r\n\t\t\tvar rating = this.id == \"helpful_button\" ? HELPFUL_RATING : UNHELPFUL_RATING;\r\n\t\t\taddLinkRated(taskIdx, search.query, link.url, link.title, rating, true);\r\n\t\t\tupdateSearchHistory();\r\n\t\t\tswitchToSearch();\r\n\t\t}\r\n\t}\r\n}", "function linkClick(link) {\n\t\tsubjectRead(subjects);\n\t\t$(links[link]).css(\"z-index\",\"1\");\n\t\t$(links[link]).css(\"opacity\",\"1\");\n\t\t$(link).css(\"background-color\",\"#8C6954\");\n\t\t$(link).css(\"color\",\"white\");\n\t\t$.each(links, function (key,value)\n\t\t{\n\t\t\tif (key!=link)\n\t\t\t{\n\t\t\t\t$(links[key]).css(\"z-index\",\"0\");\n\t\t\t\t$(links[key]).css(\"opacity\",\"0\");\n\t\t\t\t$(key).css('background-color','#59323C');\n\t\t\t\t$(key).css(\"color\",\"#F2EEB3\");\n\t\t\t}\n\t\t});\n\t}", "registerClick() {\n \n if(this.state.block_Highlight) { \n this.setState({\n block_Highlight:false, \n })\n saveVisitedAdaptation(\"Block_User\",\"NewsFeed_highlight\");\n }\n\n registerEvent('Clicked on '+this.props.name+\"'\\s profile link to visit their profile page\", 'from post '+this.props.index,(this.props.forTimeline?\"Timeline\":\"NewsFeed\")); \n }", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}", "function linkTopic(a) {\n a .on(\"click\", click)\n .on(\"mouseover\", mouseover)\n .on(\"mouseout\", mouseout);\n}" ]
[ "0.75356567", "0.74746776", "0.7072557", "0.7063431", "0.6959302", "0.67220116", "0.6701569", "0.6610266", "0.6605996", "0.65622306", "0.6502058", "0.6462321", "0.6444712", "0.64422756", "0.6355239", "0.63428026", "0.62632555", "0.6211025", "0.62032723", "0.61599153", "0.6150977", "0.6125956", "0.6093832", "0.6077782", "0.60681975", "0.606469", "0.6020979", "0.60185176", "0.59722984", "0.596988", "0.5949489", "0.5942249", "0.5934649", "0.59099776", "0.58780795", "0.5877005", "0.58345926", "0.5815383", "0.5796809", "0.5796582", "0.5796462", "0.57943773", "0.57918924", "0.5791136", "0.5761964", "0.5757175", "0.5730483", "0.5718558", "0.5712792", "0.5704693", "0.5701881", "0.5701301", "0.56997347", "0.56997293", "0.5697319", "0.5693732", "0.5689129", "0.5675776", "0.56471145", "0.56367", "0.5627162", "0.5623586", "0.56171", "0.5615436", "0.56139773", "0.5612796", "0.5612269", "0.560649", "0.5600769", "0.56007576", "0.55995023", "0.55978173", "0.5597218", "0.55958307", "0.5592317", "0.55764854", "0.5562823", "0.5562765", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154", "0.555154" ]
0.58167
37
gets called when the user clicks on the right triangle button next to each alert this loads the observable information for the alerts and allows the user to select one for filtering
function load_alert_observables(alert_uuid) { // have we already loaded this? var existing_dom_element = $("#alert_observables_" + alert_uuid); if (existing_dom_element.length != 0) { existing_dom_element.remove(); return; } $.ajax({ dataType: "html", url: 'observables', data: { alert_uuid: alert_uuid }, success: function(data, textStatus, jqXHR) { $('#alert_row_' + alert_uuid).after('<tr id="alert_observables_' + alert_uuid + '"><td colspan="6">' + data); }, error: function(jqXHR, textStatus, errorThrown) { alert("DOH: " + textStatus); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function afterAlertsLoad() {\n if (sessionStorage.getItem(\"search_all_selected_obj\") !== null) {\n var obj,\n index;\n obj = JSON.parse(sessionStorage.getItem(\"search_all_selected_obj\"));\n index = TableUtil.getTableIndexById('#tblAlerts', obj.Id);\n $(\"#tblAlerts\").bootstrapTable(\"check\", index);\n showEditDialog();\n sessionStorage.removeItem(\"search_all_selected_obj\");\n }\n }", "function alertLoad() {\n\t//alert('reloading alert page');\n\tfireAlerts.on('value', function(snap) {\n\t\t$('#inputEmail').val(snap.val().email);\n\t\t$('#checkEnergyOver').prop('checked',snap.val().dayKwhrFlg);\n\t\t$('#inputKwhrLimit').val(snap.val().dayKwhrLmt);\n\t\t$('#checkStandbyLow').prop('checked',snap.val().dayStbyFlg);\n\t\t$('#inputStbyLimit').val(snap.val().dayStbyLmt);\n\t\t$('#checkFault').prop('checked',snap.val().errFlg);\n\t\t$('#checkModeChanged').prop('checked',snap.val().modeChgFlg);\n\t\t$('#checkSPChanged').prop('checked',snap.val().SPChgFlg);\n\t\t$('#checkElementUse').prop('checked',snap.val().htrElmntFlg);\n\t});\n}", "handleSearchKeyword() {\n \n if (this.searchValue !== '') {\n getAlertList({\n searchKey: this.searchValue\n })\n .then(result => {\n // set @track alert variable with return alert list from server \n //this.alertList = result;\n if(result) {\n\n let currentData = [];\n \n result.forEach((row) => {\n \n /* \n * Creating the an empty object\n * To reslove \"TypeError: 'set' on proxy: trap returned falsish for property\"\n */\n \n let rowData = {};\n rowData.Id = row.Id;\n rowData.Name = row.Name;\n rowData.Alert_Date = row.Alert_Date__c;\n rowData.Primary_Entity_Number = row.Primary_Entity_Number__c;\n rowData.Status = row.Status__c;\n rowData.MoneyLaunderingRiskScore = row.Money_Laundering_Risk_Code__c;\n \n // Account related data\n if (row.Primary_Entity__c) {\n rowData.PrimaryEntityName = row.Primary_Entity__r.Name;\n \n }\n currentData.push(rowData);\n });\n \n this.alertList = currentData;\n }\n })\n .catch(error => {\n \n const event = new ShowToastEvent({\n title: 'Error',\n variant: 'error',\n message: error.body.message,\n });\n this.dispatchEvent(event);\n // reset alert var with null \n this.alertList = null;\n });\n } else {\n // fire toast event if input field is blank\n const event = new ShowToastEvent({\n variant: 'error',\n message: 'Search text missing..',\n });\n this.dispatchEvent(event);\n }\n}", "function listaAlertas(){\n\tvar lista = Widget.createController('listaAlertas').getView();\n\tlista.open();\n}", "onClickAlertSubscribe() {\n // TODO: Set user as watcher for this alert when API ready\n }", "onAlert(id = this.defaultId) {\n return this.subject.asObservable().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])(x => x && x.id === id));\n }", "onAlert(id = this.defaultId) {\n return this.subject.asObservable().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__[\"filter\"])(x => x && x.id === id));\n }", "function refreshFilterAlarmSummaryData(selectedAlarmLevel) {\r\n filterAlarmSummaryDataList = [];\r\n for (var index = 0; index < alarmSummaryDataList.length; index++) {\r\n if ((wemsAlarmSummaryVM.selectedAlarmLevel != wemsAlarmSummaryVM.alarmLevel.all)\r\n && (wemsAlarmSummaryVM.selectedAlarmLevel != alarmSummaryDataList[index].LevelCode)) {\r\n continue;\r\n }\r\n\r\n filterAlarmSummaryDataList.push(alarmSummaryDataList[index]);\r\n }\r\n\r\n showMoreAlarmSummaryData(true);\r\n }", "onAlert(id = this.defaultId) {\n return this.subject.asObservable().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__[\"filter\"])(x => x && x.id === id));\n }", "function selectedData(event) {\n displayProblems();\n}", "setAlertToday(){\n \n var aujourdhui = this.today.toLocaleDateString();\n this.eventsOftheday =[]; // vide le tableau des alertes avant chaque set\n \n for(var eventa of this.events){ // pour chaque date de debut d'event = a la date d'aujourdhui\n if( eventa.datestartevent == aujourdhui ){\n this.addAlertToday(eventa);\n \n }\n \n }\n \n }", "function viewDataArray() {\n log('viewDataArray');\n let alertText =\n 'Reviver ID: ' + activeDataItem.reviver_id +\n '\\nTarget: ' + activeDataItem.target +\n '\\nTime: ' + activeDataItem.time +\n '\\nLevel: ' + activeDataItem.level +\n '\\nChance: ' + activeDataItem.chance +\n '\\nCost: ' + activeDataItem.cost +\n '\\nSuccess: ' + activeDataItem.success +\n '\\nRS Start: ' + activeDataItem.rs_start +\n '\\nRS End: ' + activeDataItem.rs_end;\n\n alert(alertText);\n }", "alerts() {\r\n return this.request('GET', 'alerts')\r\n .then((data) => (!!data['alerts'] ? data['alerts'] : []).map(Alert.fromJSON));\r\n }", "function onChangeAlarmLevelHandler() {\r\n refreshFilterAlarmSummaryData();\r\n }", "_onFilterSelected(event) {\n this.filter = event.detail.filter;\n this.render();\n }", "filterRestaurants () {\n this.sendAction('filterInit', {\n price: this.get('price'),\n isOpen: this.get('isChecked')\n });\n }", "function onShowWemsAlarmSummaryModal() {\r\n showMoreAlarmSummaryData(true);\r\n }", "_list() {\n this._listPromise().then((json) => {\n this._alerts = json;\n this._render();\n this._openOnLoad();\n }).catch(errorMessage);\n }", "function handleFilterSelected() {\n $('main').on('change', '#filter', function(event) {\n store.filter = $(this).val()\n render();\n })\n}", "function updateAlertsList(){\n $( \"#traffic_alerts_list\" ).html(\"\");\n $.each(traffic.alerts, function( index, item ) {\n if ($.inArray(item.type, alertsType) < 0) {\n alertsType.push(item.type); \n }\n if (item.type == 'WEATHERHAZARD'){\n if ($.inArray(item.subtype, WEATHERHAZARD_SubType) < 0) {\n WEATHERHAZARD_SubType.push(item.subtype); \n } \n }\n });\n\n $.each(alertsType, function( index, item ) { \n if (item == 'WEATHERHAZARD'){\n $( \"#traffic_alerts_list\" ).append( \"<li data-to-show='\"+ item +\"'><a>\" + item + \"</a><ul id='traffic_alerts_weatherhazard_list' class='nav child_menu' style='display:block'></ul></li>\" );\n }else{\n $( \"#traffic_alerts_list\" ).append( \"<li data-to-show='\"+ item +\"'><a>\" + item + \"</a></li>\" );\n }\n });\n $('#traffic_alerts_list li').on( 'click', function () {\n specific_alert = $(this).attr('data-to-show');\n $('#title').html('Traffic Alerts <small>' + specific_alert + '</small>'); \n subtype_alert = \"NO_SUBTYPE\";\n showAlerts(true);\n updateMap();\n });\n\n $.each(WEATHERHAZARD_SubType, function( index, item ) {\n if (item.indexOf(\"HAZARD_ON_ROAD_\") < 0 && item.indexOf(\"HAZARD_ON_SHOULDER_\") < 0 && item.indexOf(\"HAZARD_WEATHER_\") < 0){\n if (item.trim() == \"\"){\n $( \"#traffic_alerts_weatherhazard_list\" ).append( \"<li data-to-show='\"+ item +\"'><a>NO_SUBTYPE</a></li>\" );\n }else{\n $( \"#traffic_alerts_weatherhazard_list\" ).append( \"<li data-to-show='\"+ item +\"'><a>\" + item.substring(0, 20) + \"</a></li>\" );\n }\n \n }else{\n if (item.indexOf(\"HAZARD_ON_ROAD_\") >= 0){\n var pos = \"HAZARD_ON_ROAD_\".length;\n var li_text = item.substring(pos,item.length);\n $( \"#traffic_alerts_weatherhazard_list\" ).append( \"<li data-to-show='\"+ item +\"'><a>\" + li_text + \"</a></li>\" );\n }\n if (item.indexOf(\"HAZARD_ON_SHOULDER_\") >= 0){\n var pos = \"HAZARD_ON_SHOULDER_\".length;\n var li_text = item.substring(pos,item.length);\n $( \"#traffic_alerts_weatherhazard_list\" ).append( \"<li data-to-show='\"+ item +\"'><a>\" + li_text + \"</a></li>\" );\n }\n if (item.indexOf(\"HAZARD_WEATHER_\") >= 0){\n var pos = \"HAZARD_WEATHER_\".length;\n var li_text = item.substring(pos,item.length);\n $( \"#traffic_alerts_weatherhazard_list\" ).append( \"<li data-to-show='\"+ item +\"'><a>\" + li_text + \"</a></li>\" );\n }\n }\n \n });\n\n $('#traffic_alerts_weatherhazard_list li').on( 'click', function () {\n specific_alert = \"WEATHERHAZARD\";\n subtype_alert = $(this).attr('data-to-show');\n $('#title').html('Traffic Alerts <small>' + subtype_alert +'</small>');\n showAlerts(true);\n updateMap();\n });\n \n }", "function getAlerts() {\n\t$.get(\"/load_charts/get-stats/?threshold=\"+threshold.toFixed(2), function (data){ \n\t\tvar alertJson = JSON.parse(data);\n\t\tupdateAlert(alertJson); \n\t\tupdateStats(alertJson); \n\t});\n}", "focus(){\n\n // pass stream of favorite\n // places to knockout observable\n this._filterSub =\n this._placesService\n .favorites()\n .subscribe(favorites => {\n this.places(favorites);\n });\n }", "function onLoad() {\r\n onRestore();\r\n $('release-notes').addEventListener('click', onVisitReleaseNotes, false)\r\n $('button-save').addEventListener('click', onSave, false);\r\n $('button-close').addEventListener('click', onClose, false);\r\n $('exclusion-filter-list-add').addEventListener('click', onFilterListAdd, false);\r\n $('exclusion-filter-list-remove').addEventListener('click', onFilterListRemove, false);\r\n $('exclusion-filter-list-remove-all').addEventListener('click', onFilterListRemoveAll, false);\r\n \r\n $('inclusion-filter-list-add').addEventListener('click', onFilterListAdd, false);\r\n $('inclusion-filter-list-remove').addEventListener('click', onFilterListRemove, false);\r\n $('inclusion-filter-list-remove-all').addEventListener('click', onFilterListRemoveAll, false);\r\n \r\n $('visit-extensions').addEventListener('click', onVisitExtension, false);\r\n \r\n exlusionDialog = new DialogController('exclusion-add-filter-dialog');\r\n exlusionDialog.addEventListener('click', onDialogOk);\r\n exlusionDialog.addEventListener('load', onDialogLoad);\r\n exlusionDialog.setTemplate({header: 'Filter Text', ok: 'Add'});\r\n exlusionDialog.init();\r\n \r\n inclusionDialog = new DialogController('inclusion-add-filter-dialog');\r\n inclusionDialog.addEventListener('click', onDialogOk);\r\n inclusionDialog.addEventListener('load', onDialogLoad);\r\n inclusionDialog.setTemplate({header: 'Filter Text', ok: 'Add'});\r\n inclusionDialog.init();\r\n}", "chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n }", "chooseData() {\n // ******* TODO: PART I *******\n //Changed the selected data when a user selects a different\n // menu item from the drop down.\n\n }", "function incidentsContentViewModel() {\r\n var self = this;\r\n self.loadIncident = function (data) {\r\n console.log(data);\r\n history.pushState(null, '', 'index.html?root=incident&id=' + data);\r\n oj.Router.sync();\r\n };\r\n\r\n self.getUrl = function () {\r\n var urlParams = config.url + 'alerts/';\r\n urlParams = urlParams + \"?loc=\" + rootViewModel.currentLocationID();\r\n urlParams = urlParams + \"&type=\" + self.alertType();\r\n urlParams = urlParams + \"&start=\" + self.start;\r\n urlParams = urlParams + \"&end=\" + self.end;\r\n return urlParams;\r\n };\r\n\r\n self.alertType = ko.observable('Temp');\r\n\r\n self.setAlertType = function (alertType) {\r\n console.log(alertType);\r\n self.alertType(alertType);\r\n self.loadData();\r\n };\r\n\r\n self.ready = ko.observable(false);\r\n var rootViewModel = ko.dataFor(document.getElementById('globalBody'));\r\n self.currentLocation = ko.observable();\r\n\r\n self.incidents = ko.observableArray();\r\n self.tempTotal = ko.observable(0);\r\n self.energyTotal = ko.observable(0);\r\n self.otherTotal = ko.observable(0);\r\n\r\n\r\n\r\n\r\n\r\n // self.prod = rootViewModel.prod();\r\n self.prod = true;\r\n\r\n\r\n\r\n /*Load Data*/\r\n self.loadData = function () {\r\n return new Promise(function (resolve, reject) {\r\n\r\n if (self.prod) {\r\n url = self.getUrl();\r\n console.log(url)\r\n } else {\r\n url = 'js/data/mock/incidents.json';\r\n }\r\n\r\n jsonData.fetchData(url).then(function (incidents) {\r\n self.incidents.removeAll();\r\n \r\n if(self.alertType()==='Temp'){\r\n self.tempTotal(incidents.length) \r\n }\r\n \r\n if(self.alertType()==='Energy'){\r\n self.energyTotal(incidents.length) \r\n }\r\n \r\n \r\n self.incidents(incidents);\r\n self.ready(true);\r\n resolve(true);\r\n }).fail(function (error) {\r\n console.log(error);\r\n resolve(false);\r\n });\r\n });\r\n\r\n };\r\n\r\n /*Location Change*/\r\n self.locationChange = ko.computed(function () {\r\n // self.currentLocation(rootViewModel.currentLocationID());\r\n // self.loadData();\r\n });\r\n\r\n self.start = moment().subtract(6, 'days');\r\n self.end = moment();\r\n self.dateText = ko.observable();\r\n\r\n\r\n\r\n self.handleAttached = function () {\r\n $(\"#reportrange\").daterangepicker({startDate: self.start,\r\n endDate: self.end,\r\n ranges: {\r\n 'Today': [moment(), moment()],\r\n 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],\r\n 'Last 7 Days': [moment().subtract(6, 'days'), moment()],\r\n 'Last 30 Days': [moment().subtract(29, 'days'), moment()],\r\n 'This Month': [moment().startOf('month'), moment().endOf('month')],\r\n 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]\r\n }\r\n }, self.datePicked);\r\n };\r\n\r\n // $('#reportrange span').html(self.start.format('MMMM D, YYYY') + ' - ' + self.end.format('MMMM D, YYYY'));\r\n\r\n self.datePicked = function (start, end) {\r\n // console.log(moment(start).unix(), moment(end).unix());\r\n self.start = start;\r\n self.end = end;\r\n self.dateText(self.start.format('MMMM D, YYYY') + ' - ' + self.end.format('MMMM D, YYYY'))\r\n self.loadData();\r\n };\r\n\r\n// self.datePicked(self.start, self.end);\r\n self.dateText(self.start.format('MMMM D, YYYY') + ' - ' + self.end.format('MMMM D, YYYY'))\r\n self.loadData();\r\n }", "handleReadAlert(alert) {\n }", "alertmanagers() {\r\n return this.request('GET', 'alertmanagers');\r\n }", "loadStaticActivity(e) {\n \n var myClick = document.getElementById('filterText'); \n myClick.value = e;\n myClick.addEventListener('change',function(){ \n this.store.set({ filter: e })\n }); \n myClick.dispatchEvent(new Event('change'));\n \n }", "function popup1() {\nalert(\"Filter text box provides the user to filter out the sessions which respond true for the corresponding user query for which the filter option is being run.\");\n}", "function onFilter() {\n \n if(store.fromDate === null || store.toDate === null) {\n return;\n }\n \n el.innerHTML = loader();\n \n store.headers = {\n name: 'Name',\n symbol: 'Symbol',\n avg_price: 'Avg Price',\n volume: 'volume',\n change: 'change %'\n }\n \n setTimeout(function() {\n el.innerHTML = null;\n document.getElementById('filter-message').innerHTML = _filters();\n _renderStocks()\n }, 1000)\n \n \n \n}", "function dataRequestFromFilters(filtObj){\n $(\"#filters\").on(\"change\", \"select\", function() {\n $(\".mdl-spinner\").addClass(\"is-active\");\n $.get(filtObj.url, function(data) {\n \n outputFilteredRows(data);\n })\n .always(function() {\n $(\".mdl-spinner\").removeClass(\"is-active\");\n });\n });\n}", "function filterHandler(){\n $(\"#filter-btn\").on(\"click\", function(){\n let selection = $(\"#sort\").val();\n if(selection === \"oldest\" || selection === \"newest\" || selection === \"rating\"){\n if(!getIds().length) return;\n let ids = getIds();\n $.get(\"/kimochis/filter\", \n {selection: selection, name: localStorage.getItem(\"inputText\")}, function(data){\n $(\"#main\").html(data);\n $(\"#more-btn\").attr({\"disabled\": false, \"hidden\": false});\n });\n }\n });\n}", "componentDidMount() {\n this.onShowPlaceholder()\n // add emitter event listener\n // filter and keep only the ones that are 'downloaded'\n Subscriptions.push(\n mrEmitter.addListener('onUpdateData', (updateData) => {\n // adding selected property to tableData\n let tempData = updateData.filter(this.filterDownloader)\n for (let cData of tempData) {\n cData.selected = false\n }\n this.setState({tableData: tempData})\n this.onShowPlaceholderTimeout = setTimeout(() => {\n this.onShowPlaceholder()\n }, 300)\n }),\n // close the toolbar\n mrEmitter.addListener('onCloseToolbar', () => this.onAllChecked('', false))\n )\n }", "function initToolSearch(e){\n\t\t\t//get toggle for sold or unsold listings\n\t\t\tlet toggleNum = 1;\n\t\t\tif(toggle === false){\n\t\t\t\ttoggleNum = - 1;\n\t\t\t}else{\n\t\t\t\ttoggleNum = 1;\n\t\t\t}\n\t\t\tlet searchVal = toolSearch.value.toLowerCase() || '';\n\t\t\ttableBody.innerHTML = '';\n\n\t\t\t//display table data of filtered tools. with event listeners for each element\n\t\t\ttoolData.then( (tools)=>{\n\t\t\ttools.filter( (tool)=>{\n\t\t\t\t//String of all the tool categories to search through for a match\n\t\t\t\tlet name = tool.name.toLowerCase();\n\t\t\t\tlet info = tool.description.toLowerCase();\n\t\t\t\tlet brand = tool.brand.toLowerCase();\n\t\t\t\tlet toolid = tool.id;\n\t\t\t\tlet tool_condition = tool.tool_condition.toLowerCase();\n\t\t\t\tlet toolsInfo = name + ' ' + info + ' ' + brand + ' ' + tool_condition + ' ' + toolid;\n\t\t\t\tif(searchVal !== \"\"){\n\t\t\t\t\treturn toolsInfo.match(searchVal);\n\t\t\t\t}\n\t\t\t\tconsole.log('no input text');\n\t\t\t\treturn tool;\n\t\t\t\t\n\t\t\t}).filter((tools)=>{\n\t\t\t\t//return only not sold tools\n\t\t\t\treturn tools.sold == toggleNum;\n\t\t\t}).map( (tool) => {\n\t\t\t\tif(tool.max_price === '0'){\n\t\t\t\t\ttoolMaxPrice = '';\n\t\t\t\t}else{\n\t\t\t\t\ttoolMaxPrice = ' - ' + tool.max_price;\n\t\t\t\t}\n\t\t\t\ttableBody.innerHTML += `\n\t\t\t\t\t\t\t\t\t\t<tr val=\"${tool.id}\" name=\"${tool.name}\">\n\t\t\t\t\t\t\t\t\t\t<td class=\"update_data\"> ${tool.name} </td>\n\t\t\t\t\t\t\t\t\t\t<td class=\"update_data\"> ${tool.brand} </td>\n\t\t\t\t\t\t\t\t\t\t<td class=\"update_data\"> ${tool.type} </td>\n\t\t\t\t\t\t\t\t\t\t<td class=\"update_data\"> ${tool.description} </td>\n\t\t\t\t\t\t\t\t\t\t<td class=\"update_data\"> ${tool.tool_condition} </td>\n\t\t\t\t\t\t\t\t\t\t<td class=\"update_data\"> ${tool.price} ${toolMaxPrice}</td>\n\t\t\t\t\t\t\t\t\t\t<td class=\"update_data\"> ${tool.id} </td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t`;\n\t\t\t});\n\t\t}).then(\n\t\t\tfunction(){\n\t\t\t\tfor (var i = update.length - 1; i >= 0; i--) {\n\t\t\t\t\tupdate[i].parentElement.addEventListener('dblclick', dblClickHandleUpdate);\n\t\t\t\t\t//update[i].parentElement.addEventListener('click', handleUpdate);\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}", "function employeesContentViewModel() {\n var self = this;\n var data = [{name: \"Have Sleep Problems\", shape: \"human\", count: 7, colour: \"#ed6647\"},\n {name: \"Sleep Well\", shape: \"human\", count: 3}];\n\n self.getColor = function (index) {\n return index === 0 ? '#ed6647' : '';\n };\n //self.dataProvider = ko.observableArray(data);\n self.dataProvider = new ArrayDataProvider(data, {keyAttributes: 'value'});\n\n self.handleNestedOpen = function () {\n document.querySelector('#outerDialog').open();\n };\n self.handleOpen = function (event) {\n var ui = event.detail;\n //AnimationUtils['slideIn'](ui.element).then(ui.endCallback);\n document.querySelector('#innerDialog').open();\n };\n self.handleOKClose = function () {\n document.querySelector('#outerDialog').close();\n };\n self.handleOKClose2 = function () {\n document.querySelector('#innerDialog').close();\n };\n\n\n self.fuelTypes = [{name: 'Bio-Diesel', abbr: 'BD'},\n {name: 'Compressed Natural Gas', abbr: 'CNG'},\n {name: 'Electric Charging', abbr: 'ELEC'},\n {name: 'Ethanol', abbr: 'E85'},\n {name: 'Hydrogen & Fuel Cell', abbr: 'HY'},\n {name: 'Liquefied Natural Gas', abbr: 'LNG'},\n {name: 'Liquefied Petroleum Gas', abbr: 'LPG'}\n ];\n\n //self.handleActivated = function (info) {\n self.cityVal = ko.observable('San Jose');\n self.chartType = ko.observable('pie');\n self.selectVal = ko.observableArray(['CA']);\n self.pieSeriesValue = ko.observableArray([]);\n self.groupsValue = ko.observableArray(['Fuel Types']);\n self.seriesValue = ko.observable();\n\n // provide list of states for use in the select pulldown\n self.States = [\n {label: 'ALABAMA', value: 'AL'},\n {label: 'ALASKA', value: 'AK'},\n {label: 'AMERICAN SAMOA', value: 'AS'},\n {label: 'ARIZONA', value: 'AZ'},\n {label: 'ARKANSAS', value: 'AR'},\n {label: 'CALIFORNIA', value: 'CA'},\n {label: 'COLORADO', value: 'CO'},\n {label: 'CONNECTICUT', value: 'CT'},\n {label: 'DELAWARE', value: 'DE'},\n {label: 'DISTRICT OF COLUMBIA', value: 'DC'},\n {label: 'FEDERATED STATES OF MICRONESIA', value: 'FM'},\n {label: 'FLORIDA', value: 'FL'},\n {label: 'GEORGIA', value: 'GA'},\n {label: 'GUAM', value: 'GU'},\n {label: 'HAWAII', value: 'HI'},\n {label: 'IDAHO', value: 'ID'},\n {label: 'ILLINOIS', value: 'IL'},\n {label: 'INDIANA', value: 'IN'},\n {label: 'IOWA', value: 'IA'},\n {label: 'KANSAS', value: 'KS'},\n {label: 'KENTUCKY', value: 'KY'},\n {label: 'LOUISIANA', value: 'LA'},\n {label: 'MAINE', value: 'ME'},\n {label: 'MARSHALL ISLANDS', value: 'MH'},\n {label: 'MARYLAND', value: 'MD'},\n {label: 'MASSACHUSETTS', value: 'MA'},\n {label: 'MICHIGAN', value: 'MI'},\n {label: 'MINNESOTA', value: 'MN'},\n {label: 'MISSISSIPPI', value: 'MS'},\n {label: 'MISSOURI', value: 'MO'},\n {label: 'MONTANA', value: 'MT'},\n {label: 'NEBRASKA', value: 'NE'},\n {label: 'NEVADA', value: 'NV'},\n {label: 'NEW HAMPSHIRE', value: 'NH'},\n {label: 'NEW JERSEY', value: 'NJ'},\n {label: 'NEW MEXICO', value: 'NM'},\n {label: 'NEW YORK', value: 'NY'},\n {label: 'NORTH CAROLINA', value: 'NC'},\n {label: 'NORTH DAKOTA', value: 'ND'},\n {label: 'NORTHERN MARIANA ISLANDS', value: 'MP'},\n {label: 'OHIO', value: 'OH'},\n {label: 'OKLAHOMA', value: 'OK'},\n {label: 'OREGON', value: 'OR'},\n {label: 'PALAU', value: 'PW'},\n {label: 'PENNSYLVANIA', value: 'PA'},\n {label: 'PUERTO RICO', value: 'PR'},\n {label: 'RHODE ISLAND', value: 'RI'},\n {label: 'SOUTH CAROLINA', value: 'SC'},\n {label: 'SOUTH DAKOTA', value: 'SD'},\n {label: 'TENNESSEE', value: 'TN'},\n {label: 'TEXAS', value: 'TX'},\n {label: 'UTAH', value: 'UT'},\n {label: 'VERMONT', value: 'VT'},\n {label: 'VIRGIN ISLANDS', value: 'VI'},\n {label: 'VIRGINIA', value: 'VA'},\n {label: 'WASHINGTON', value: 'WA'},\n {label: 'WEST VIRGINIA', value: 'WV'},\n {label: 'WISCONSIN', value: 'WI'},\n {label: 'WYOMING', value: 'WY'}\n ];\n\n self.getData = function () {\n // using a Promise to allow the chart to render only once the data is available.\n self.seriesValue(new Promise(function (resolve, reject) {\n var url = \"https://api.data.gov/nrel/alt-fuel-stations/v1/nearest.json?location=\" + self.cityVal() + \"+\" + self.selectVal() + \"&api_key=<your api key goes here>\"\n $.getJSON(url).then(function (data) {\n var fuels = data.station_counts.fuels;\n var seriesData = [];\n for (var prop in fuels) {\n if (fuels[prop].total > 0) {\n seriesData.push({name: getFuelName(prop), items: [fuels[prop].total]})\n }\n }\n resolve(seriesData);\n });\n }))\n };\n\n // get the long name of the fuel type from the abbreviate returned by the REST service\n var getFuelName = function (prop) {\n for (var i in fuelTypes) {\n if (fuelTypes[i].abbr === prop)\n return fuelTypes[i].name;\n }\n }\n //};\n\n\n self.handleAttached = function (info) {\n // once the DOM is available, call the getData to load defaults\n self.getData();\n };\n\n\n }", "beforeFirstRender() {\n // this._selectObserver = observe(() => {\n // const entries = Array.from(this.checklistModel.selectedEntries, entry => {\n // console.log(entry.item.name);\n // return entry.item.name;\n // });\n // this._selectedItemsText = entries.join(', ');\n // });\n }", "function selectHandler() {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) {\n var value = data.getValue(selectedItem.row, 0);\n openPopup(value);\n // console.log('The user selected - ' + value);\n }\n }", "function getAlert() {\n return randomSelect([true, false]);\n}", "function filterChange() {\n updateFilter();\n pullEvents();\n //put events in page\n}", "onResultSelected() {\n const result = document.activeElement;\n if (this.ux.results !== result.parentElement)\n return;\n this.publish(\"selectresult\", JSON.parse(result.dataset.d));\n }", "function xcustom_makeActionOnObjectSelection() {\r\n var currentSelectedObject = xcustom_getCurrentSelectedObject();\r\n if (null === currentSelectedObject) {\r\n // console.log('Nothing Selected...');\r\n xcustom_resetAndClosePanelSelectedObjectContent();\r\n $('#xcustom-div-right-panel').hide();\r\n return;\r\n }\r\n // console.log('The Selected Object Is : ', currentSelectedObject);\r\n xcustom_showSelectedObjectDataOnViewer(currentSelectedObject);\r\n}", "function alertContents() {\n\tif(httpRequest.readyState === 4) {\n\t\tif (httpRequest.status === 200) {\n\t\t\tJSONObj = JSON.parse(httpRequest.responseText);\n\t\t} else {\n\t\t\talert('There was a problem with the request.'); \n\t\t}\n\t}\n\tJSONObj = filter(JSONObj);\n\tgenerateGistList(JSONObj); \n}", "function OnSelect(sender: Object, e: RoutedEventArgs) {\n\t\t\ttry {\n\t\t\t\tSelectRow();\n\t\t\t\tDashboardTaskService.Current.CloseTask(runner);\n\t\t\t} catch (ex: Exception) {\n\t\t\t\tConfirmDialog.ShowErrorDialog(\"Script\", ex);\n\t\t\t}\n\t\t}", "selectProduct(select) {\n //get products by name\n this.productService.getProductByName(select.option.value).subscribe(data => {\n let product = data.payload.doc.data();\n product[`doc_id`] = data.payload.doc.id;\n //open selected product in modal\n this.openDialog(product);\n this.clearSearch();\n });\n }", "function loadPageDealAll(msg) {\n if(!cache.show_capped_alert) {\n return true;\n }\n cache.show_capped_alert = false;\n bootbox.alert({\n closeButton: false,\n message: 'No records are found for \"' + msg + '\".<br>Please click Ok to go to see the complete list (All).',\n title: 'Alert',\n callback: function () {\n var AllEle = $(\"#menu_wraper\").find('.item-list-detail:contains(\"All\"):first');\n AllEle.trigger('click');\n }\n });\n }", "function showStatus() {\n\n if ((reporteSeleccionado == 13) || (reporteSeleccionado == 14)) {\n\n if (banderas.banderaTodoSeleccionado == 0) {\n if (Calles.length == 0) {\n ngNotify.set('Seleccione al menos una calle', { type: 'error' });\n }\n else {\n modalStatus();\n }\n }\n else if (banderas.banderaTodoSeleccionado == 1) {\n modalStatus();\n }\n }\n }", "function filterResult() {\n\t//Add one event listener to the button group and then define what button was clicked depends on the event.target.id\n\t$('.btn-group').on('click', \t\t\t\t\t\t\n\tfunction(event){\n\t\tif (event.target.id === \"all\") {\n\t\t\t$(\".offline\").show(\"slow\");\n\t\t\t$(\".not-exist\").show(\"slow\");\n\t\t\t$(\".online\").show(\"slow\");\n\t\t\t\n\t\t}\n\t\telse if (event.target.id === \"online\") {\n\t\t\t$(\".offline\").hide(\"slow\");\n\t\t\t$(\".not-exist\").hide(\"slow\");\n\t\t\t$(\".online\").show(\"slow\");\n\t\t\t\n\t\t}\n\t\telse {\n\t\t\t$(\".not-exist\").hide(\"slow\");\n\t\t\t$(\".online\").hide(\"slow\");\n\t\t\t$(\".offline\").show(\"slow\");\n\t\t}\n\t});\t\n}", "function initAlerts($nyplAlerts, $rootScope, nyplAlertsService) {\n $nyplAlerts.getGlobalAlerts().then(function (data) {\n var alerts = $rootScope.alerts || data;\n $rootScope.alerts =\n nyplAlertsService.filterAlerts(alerts, {current: true});\n $nyplAlerts.alerts = $rootScope.alerts || data;\n }).catch(function (error) {\n throw error;\n });\n }", "function viewFilters() {\n let text = '';\n filterArray.forEach(item => (text = text + '\\n\\t' + item));\n let statusText = disabled ? 'disabled' : 'enabled';\n alert('Installed Filters (currently' + statusText + '):' + text);\n}", "function initFirstFilter(){\n var firstFilterWrap = getComponent('first-filter');\n var filterArrays = firstFilterWrap.getElementsByTagName('li');\n\n [].forEach.call(filterArrays,function (item) {\n item.addEventListener('click',selected)\n })\n\n function selected(e){\n if(this.firstElementChild.classList.contains('selected')){\n return;\n }\n removeSelected();\n console.log(e);\n this.firstElementChild.classList.add('selected');\n if(this.innerText === 'All'){\n window.firstFilterStatus = 0;\n }else if(this.innerText === 'Active'){\n window.firstFilterStatus = 1;\n }else{\n window.firstFilterStatus = 2;\n }\n update();\n }\n\n function removeSelected(){\n [].forEach.call(filterArrays,function (item) {\n if(item.firstElementChild.classList.contains('selected')){\n item.firstElementChild.classList.remove('selected');\n }\n })\n }\n}", "function bindSelect() {\n initializeTimeFunction();\n extent = brush.extent(); //data of selection\n userTimeData = [];\n\n extent.forEach(function (element) {\n var t = String(element.getTime() / 1000 * 1000);\n userTimeData.push(t);\n });\n\n if ($scope.fingerPrintsMode) {\n clearFingerprintHeatmap();\n $scope.showFingerprintHeatmap();\n document.getElementById(\"fingerPrints-mode\").classList.add('quickaction-selected');\n }\n\n if ($scope.radioHeatmapRSSMode) {\n clearFingerprintCoverage();\n $scope.showFingerprintCoverage();\n $scope.radioHeatmapRSSMode = true;\n if (typeof (Storage) !== \"undefined\" && localStorage) {\n localStorage.setItem('radioHeatmapRSSMode', 'YES');\n }\n $scope.anyService.radioHeatmapRSSMode = true;\n document.getElementById(\"radioHeatmapRSS-mode\").classList.add('quickaction-selected');\n }\n }", "constructor() {\n riot.observable(this);\n this.listenToSelectedUpdate();\n }", "function showSLASummary() {\n\tvar grid = View.panels.get('slaList');\n\tView.controllers.get(0).trigger('app:operation:express:sla:showSLASummaryPopUp',\n\t\t\tgrid.rows[grid.selectedRowIndex].row);\n}", "function filterTypeSelection(e){\n if(e.target.value === ''){\n getInventory()\n } else {\n axios.get(`/inventory/search/dept?dept=${e.target.value}`)\n .then(res => setItems(res.data))\n .catch(err => alert(err))\n }\n }", "function onShowDetail(element) {\r\n try {\r\n var dataId = jQuery(element).attr('data-id');\r\n\r\n g_currentOperation = dataId;\r\n\r\n if (!dataId || dataId.length <= 0) {\r\n dataId = WotpUtilityCommon.CurrentOperations.None;\r\n }\r\n\r\n //passing the filter info to load detail data\r\n loadDataDetail(dataId);\r\n\r\n } catch (e) {\r\n nlapiLogExecution('ERROR', 'Error during main onShowDetail', e.toString());\r\n }\r\n}", "function createAlert() {\n\tvar local_current_hash = 0;\n\n\tif ((local_current_hash = save_search()) != false) {\n\t\t// activation de l'alerte\n\t\tswitch_alert_from_search('', local_current_hash);\n\t\t$('#popupCreateAlert').popup('open');\n\t}\n\telse {\n\t\t$('#popupAlreadyExistsAlert').popup('open');\n\t}\n}", "function filterData(data) {\n var regionFilter = typeof(ClientContext)==='object' ? ClientContext.get('profile/region') : ALL_REGIONS;\n var soaIDFilter = typeof(ClientContext)==='object' ? ClientContext.get('/profile/soaId') : ALL_SOAID;\n var pageFilter = alertSelf.attr('data-alert-filter');\n\n var jsonObj = {};\n jsonObj['alerts'] = [];\n\n for (var i=0; i< data.alerts.length; i++) {\n var alertMsg = data.alerts[i];\n\n if ((isInRegion(alertMsg, regionFilter)|| isInSoiID(alertMsg, soaIDFilter))\n && isOnPage(alertMsg, pageFilter)\n && isOnTime(alertMsg))\n {\n jsonObj['alerts'].push({'message' : cleanUpRTEHtmlMarkup(alertMsg.message),\n 'backgroundColor' : alertMsg.backgroundColor,\n 'textColor' : alertMsg.textColor});\n }\n }\n\n return jsonObj;\n }", "function refreshProductsView() {\n let filteredProducts = filterByCountryName(products, countrySelect.value);\n filteredProducts = filterByName(filteredProducts, searchInput.value);\n filteredProducts = sortList(filteredProducts, sortSelect.value);\n filteredProducts = filterByRangeOfPrice(filteredProducts, priceRange.value);\n console.log(filterByRangeOfPrice(filteredProducts, priceRange.value));\n\n renderProducts(filteredProducts);\n}", "function _eventTableAllNotificationClicked(e)\n{\n\ttry\n\t{\n\t\tif (Alloy.Globals.currentWindow == \"winMyServices\" && (Alloy.Globals.currentWindow != null || Alloy.Globals.currentWindow != undefined))\n\t\t\tAlloy.Globals.arrWindows[Alloy.Globals.arrWindows.length - 1].close();\n\t\t\t\n\t\tvar nTypeId = e.row.nTypeId;\n\t\tif (nTypeId==\"5\"){\n\t\t\tTi.API.info('ASSOCIATED MESSAGE ROW: '+e.row.nTypeIdVal);\n\t\t\t\n\t\t\t/*var userid = Ti.App.Properties.getObject(\"LoginDetaisObj\");\n\t\t\t\tuserid = (Ti.App.Properties.getObject(\"LoginDetaisObj\") == null ? 0 : Ti.App.Properties.getObject(\"LoginDetaisObj\").userName);*/\n\t\t\t\t\n\t\t\thttpManager.markNotificationMessageAsRead(function(response){\n\t\t\t\t\tif (response=='1')\n\t\t\t\t\t\t$.tableviewAllNotifications.deleteRow(e.index);\n\t\t\t\t\tvar data = {\"response\":\"\", \n\t\t\t\t\t\t\t\t\"idToExpand\":e.row.nTypeIdVal, \n\t\t\t\t\t\t\t\t\"isNoRecord\":\"\" , \n\t\t\t\t\t\t\t\turl : \"\"};\n\t\t\t\t\tAlloy.Globals.openWindow(Alloy.createController(\"Services/MyServices/winMyServices\", data).getView());\n\t\t\t\t},e.row.messageId, (Ti.App.Properties.getObject(\"LoginDetaisObj\") == null ? 0 : Ti.App.Properties.getObject(\"LoginDetaisObj\").userName));\n\t\t}else{\n\t\t\tTi.API.info('WHY OTHER RECORDS CAME HERE... ONLY eSERVICES NOTIFICATION COMES HERE');\n\t\t\treturn;\n\t\t}\n\t\tsetTimeout(function(){$.viewNotificationMain.animate({opacity : 0,duration : 300}, function(e) {$.viewNotificationMain.visible = false;});},500);\n\t}\n\tcatch(e){Ti.API.info(' ############# ERROR IN eSERVICES TABLE NOTIFICATION CLICK ############## '+JSON.stringify(e));}\n}", "onGetAll() {\n console.log('getAll action triggered')\n }", "componentDidLoad() {\n this.getRenderedTabItems().filter(item => {\n if (item['active']) {\n this.dtmTabTitle = item['tabTitle'];\n this.emitAnalyticsData();\n }\n });\n }", "_refresh() {\r\n\t\tthis._lastUpdateCount = this._alertModel.getUpdateCount();\r\n\r\n\t\tthis._div.innerHTML = \"\";\r\n\t\tconst alerts = this._alertModel.getCurrentAlerts();\r\n\t\tfor(let i = 0; i < alerts.length; ++i) {\r\n\t\t\tthis._addAlert(alerts[i]);\r\n\t\t}\r\n\t}", "openOnwerFilter(){\n\n var selected = this.template.querySelector(\".selected-owner\");\n var optionsContainer = this.template.querySelector(\".options-container-owner\");\n var optionsList =this.template.querySelectorAll(\".option-owner\");\n selected.addEventListener(\"click\", () => {\n optionsContainer.classList.toggle(\"active\");\n }); \n //selected.addEventListener(\"click\", () => {\n //});\n\n /* optionsList.forEach(o => {\n o.addEventListener(\"click\", () => {\n selected.innerHTML = o.querySelector(\"label\").innerHTML;\n optionsContainer.classList.remove(\"active\");\n });\n });\n */\n }", "_handleClick()\n {\n Radio.channel('rodan').trigger(RODAN_EVENTS.EVENT__RESOURCELIST_SELECTED, {resourcelist: this.model});\n }", "setAlertCloseToday(){\n \n \n var aujourdhuiplus3 = this.todayplus3days.toLocaleDateString();\n\n this.eventsCloseOftheday =[]; // vide le tableau des alertesCloseToday avant chaque set\n \n for(var eventac of this.events){ // pour chaque date de debut d'event = a la date d'aujourdhuiplus3 jours\n if( eventac.datestartevent == aujourdhuiplus3 ){\n this.addAlertCloseToday(eventac);\n \n }\n \n }\n \n }", "function onChangeGoodList(){\n\t\t\t\n\t\t\tif ($(\"#goodsListPopupGrid\").data(\"kendoGrid\").select().length > 0){\n\t\t\t\tvar tr = $(\"#goodsListPopupGrid\").data(\"kendoGrid\").select().closest(\"tr\");\n \t\t\tvar dataItem = $(\"#goodsListPopupGrid\").data(\"kendoGrid\").dataItem(tr);\n \t\t\t\n \t\t\tvm.orderGoodsDetailSearch = dataItem;\n \t\t\t$(\"#goodsCodeAndNameCreExtNote\").text(vm.orderGoodsDetailSearch.goodsCode+\" \"+vm.orderGoodsDetailSearch.goodsName);\n\t\t\t\t\n \t\t\tvar grid = $(\"#goodsDetailGrid\").data(\"kendoGrid\");\t\n \t\t\tif(grid){\n \t\t\t\tgrid.dataSource.query({\n \t\t\t\t\tpage: 1,\n \t\t\t\t\tpageSize: 10\n \t\t\t\t});\n \t\t\t} else {\n \t\t\tfillDataTableGoodsDetailPopUp([]);\n \t\t\t}\n \t\t\t\n \t\t\tconsole.log(vm.orderGoodsDetailSearch.goodsName);\n\t\t\t}\n\t\t\t\n\t\t}", "handleSelection(event) {\n this.pollEverySec(this.interval);\n const eventData = event.detail;\n const fields = {\n Name: eventData.name,\n EventType: eventData.type,\n PrimaryPersonId: this.contactId,\n EventDate: new Date().toISOString()\n };\n this.showNewLifeEventPage(fields, \"new\");\n }", "function load() {\n if(vm.document._id !== -1) {\n backendService.getDocumentById(vm.document._id).success(function(data) {\n\n // got the data - preset the selection\n vm.document.title = data.title;\n vm.document.fileName = data.fileName;\n vm.document.amount = data.amount;\n vm.document.senders = data.senders;\n vm.document.tags = data.tags;\n vm.document.modified = data.modified;\n vm.document.created = data.created;\n\n vm.selectedSenders = data.senders;\n vm.selectedTags = data.tags;\n\n })\n .error( function(data, status, headers) {\n\n if(status === 403) {\n $rootScope.$emit('::authError::');\n return;\n }\n\n alert('Error: ' + data + '\\nHTTP-Status: ' + status);\n return $location.path('/');\n\n\n });\n } else {\n vm.selectedSenders = [];\n vm.selectedTags = [];\n }\n\n }", "initExtras() {\n this._extraService.getExtra().subscribe(response => {\n this.extras = response.extra;\n if (response.extra.length <= 0) {\n this.fatalError = true;\n this.loading = false;\n this.launchAlert('info', 'Sin Datos de RMUV', 'Al parecer no existen datos de la Remuneracion Unificada Vigente, por favor, Ingresarlos antes de continuar', '<a href=\"/extras\" target=\"blank\">Ingresar Ahora!!<a>', true, null, null, null, null, null);\n // alert('no existen los datos de RMUV... por favor ingresarlos antes de continuar con los registros de consumo');\n }\n else if (response.extra.length >= 1) {\n this.fatalError = false;\n this.loading = false;\n }\n }, error => {\n this.loading = false;\n console.log(error);\n this.errorCatched.description = error.toString();\n this.errorCatched.table = 'Extra';\n this.errorCatched.action = 'getExtras';\n this.errorCatched.title = 'Error en la Obtencion de Los datos Extras';\n this.errorCatched.zone = 'addRegister';\n this.errorCatched.code = this.errorCatched.zone + '-' + this.errorCatched.action + '-' + this.errorCatched.table;\n this.errorCatcherService.saveError(this.errorCatched).subscribe(response => {\n this.launchAlert('error', 'Error en la Carga', 'Se ha producido un error a la hora de cargar los datos de la RMUV' + response.Message, '<a href=\"/errores\" target=\"blank\">Ir a la Ventana de Errores de Sistema? <a>', true, null, null, null, null, null);\n });\n });\n }", "function initEventListener() {\n $scope.$on(vm.controllerId + '.data.filter', function (e, v) {\n vm.data.searchString = v;\n });\n $scope.$on(vm.controllerId + '.action.refresh', function (event, data) {\n getPage(_tableState);\n });\n $scope.$on(vm.controllerId + '.action.reload', function (e, v) {\n reload();\n });\n $scope.$on(vm.controllerId + '.action.F2', function (e, v) {\n console.log(checkQuyenUI('N'));\n if (checkQuyenUI('N')) {\n window.location.href = linkUrl + 'create';\n }\n });\n }", "handlesClick(){\n \n const selectedFieldsValueParam = this.selectedFieldsValue;\n const showComp = this.showScreen;\n this.hideObjectScreen=false;\n const isHideObjectScreen= this.hideObjectScreen;\n \n //console.log('Hi' +showComp);\n // console.log('selectedFieldsValueParam=='+this.selectedFieldsValue);\n // console.log('selectedFieldsValueParam= '+selectedFieldsValueParam);\n\n //show error if no rows have been selected\n if(selectedFieldsValueParam ===null || selectedFieldsValueParam===''){\n const evt = new ShowToastEvent({\n title: this._title,\n message: this.message,\n variant: this.variant,\n });\n this.dispatchEvent(evt);\n }\n else {\n //propage event to next component\n const evtCustomEvent = new CustomEvent('retreive', {\n detail: { selectedFieldsValueParam,showComp,isHideObjectScreen}\n });\n this.dispatchEvent(evtCustomEvent);\n }\n }", "onTriggerClick() {\n const me = this;\n\n if (me.pickerVisible) {\n me.hidePicker();\n } else {\n if (!me.readOnly && !me.disabled) {\n switch (me.triggerAction) {\n case this.constructor.queryAll:\n me.doFilter(null);\n break;\n\n case comboQueryLast:\n me.doFilter(me.lastQuery);\n break;\n\n default:\n me.doFilter(me.input.value);\n }\n }\n }\n }", "click(){\r\n if ( !this.isDisabled && !this.readnly ){\r\n this.getRef('input').focus();\r\n if ( this.filteredData.length ){\r\n this.isOpened = !this.isOpened;\r\n }\r\n }\r\n }", "function filterHandler() {\n\n // Available checkbox\n $('#Check0').change(function(){\n filter.available = this.checked;\n genericLoad();\n })\n\n // price range filter\n $('#confirm-filter').click(function() {\n var min = $('#min-filter').val();\n var max = $('#max-filter').val();\n\n if(($.isNumeric(min) || $.isNumeric(max)) && (min >= 0 && max >= 0)) {\n filter.minPrice = $.isNumeric(min)? min : filter.minPrice;\n filter.maxPrice = $.isNumeric(max)? max : filter.maxPrice;\n genericLoad();\n }\n else \n showNotificationBar(\"Per favore, inserisci dei valori positivi\");\n });\n\n // reset button\n $('#reset-filter').click(function() {\n\n filter.minPrice = 0;\n filter.maxPrice = Number.MAX_VALUE;\n genericLoad();\n\n });\n\n // review filter\n $(\"input[name='filter']\").change(function() {\n\n filter.starRating = $(this).val();\n genericLoad();\n\n });\n\n}", "function onSelect(event) {\r\n refresh(JSON.parse(event.data));\r\n}", "function filterListener(){\n $(\"#colorFilter\").change(function(){\n populateBikeList();\n });\n $(\"#statusFilter\").change(function(){\n populateBikeList();\n });\n }", "function bindExistingAlerts() {\n\t\t\tvar allAlertsCloseBtns$ = jContainer.find(\".container-ASWidgetAlert .close\");\n\t\t\tallAlertsCloseBtns$.unbind(\"click\").on(\"click\", function(event) {\n\t\t\t\t$(event.currentTarget).parents(\".container-ASWidgetAlert\").first().remove();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}", "function makeAlerts(){\n// put event listener for each selected tag\n var myp = document.querySelectorAll(\"#a2 p\");\n for(var i=0; i < myp.length; i++){//loop for the length of the myp array\n myp[i].addEventListener(\"click\",showNewAlert);//add a listener for every object in the arry\n }\n}", "function onReportDiagnosticPopupSeeAllBtnClick() {\r\n seeAllClicked = true;\r\n tau.closePopup();\r\n }", "function alerts (io) {\n\tio.of('/alert').on('connection', (USA) => {\n\t\tconsole.log(`United States ready to recieve alerts at ${USA.id}`);\n\n\t\talertEvent.on('alert', () => {\n\t\t\tfor (const msg of usaAlerts) {\n\t\t\t\tUSA.emit('alert', msg);\n\t\t\t}\n\t\t\tusaAlerts = [];\n\t\t});\n\n\t\tUSA.on('disconnect', () => console.log(`USA disconnected ${USA.id}`));\n\t});\n}", "constructor() {\n this.display = document.getElementById('displayRow'); //getting the tbody of our table\n this.notify = document.getElementById('notification'); //getting the div tag above table to show alerts\n }", "function callOnholdRes(d,s) {\n d = d.data;\n $(\"#onhold-open-popup .onholdres\").html(d.content_detail);\n $('#onhold-open-popup').modal('show');\n $('#onhold-open-popup button.btn').addClass('inactive');\n setTimeout(function() {\n modifyDropDown({selectorClass:'#onhold-open-popup .onholdres #onholdsection',searchAny:true,placeholder:'Search Reason'});\n },0);\n hideFullLoader('content_loader');\n //Added dropDown on change event\n $('#onhold-open-popup #onholdsection').on('change', function(){\n if($(this).children('option:selected').val() === 'Please select a reason:'){\n $('#onhold-open-popup button.btn').addClass('inactive');\n } else {\n $('#onhold-open-popup button.btn').removeClass('inactive');\n }\n });\n }", "handleLookupSelect(event) { \n this.selectedName = event.detail.Family; \n this.showoptions=false;\n \n }", "function handleSupp(ev) {\n console.log(contacts.filter((_) => _.id !== ev.detail.id ));\n setContacts(contacts.filter((_) => _.id !== ev.detail.id ));\n }", "function loadOffers() { // ohne alerts funktionierts nicht =( ... wieso??\n\t// reset selectedID (account could have been deleted in meantime)\n\t// selectedOffer = null;\n\tconnect(\"/hiwi/Provider/js/loadOffers\", \"\", handleLoadOffersResponse);\n}", "ngOnInit() {\r\n //this._auctionListService.getAuctionItems().subscribe(\r\n //data => this.auctionItems = data FOR FILTERING \r\n //)\r\n this.getAuctionItems();\r\n }", "function loadSuccess(ev) {\n if (ev) {\n removeAllEventsFromDisplay();\n cosmo.view.cal.itemRegistry = ev;\n }\n cosmo.view.cal.itemRegistry.each(appendLozenge);\n // Update the view\n updateEventsDisplay();\n }", "function getCategory(e) {\n filter(e.target.value); //filter function send which button we click\n if(e.target.value == \"all\"){\n bringFoods(); // bringFoods run when we click \"all button\" & form loaded\n }\n\n}", "function showEnsFilters() {\t\r\n\r\n}", "function buttonClick(){\n // Prevent the page from refreshing\n d3.event.preventDefault();\n // Create & display new table with filtered/searched data\n var filtered_table = tableData.filter(ufo_sighting => ufo_sighting.datetime===dateInputText.property(\"value\"))\n displayData(filtered_table);\n}", "function showGrowerList(e) {\n viewModel.set(\"selectedUserId\", e.view.params.userId);\n initList();\n }", "onTriggerClick() {\n const me = this;\n\n if (me.pickerVisible) {\n me.hidePicker();\n } else {\n if (!me.readOnly && !me.disabled) {\n switch (me.triggerAction) {\n case comboQueryAll:\n me.doFilter(null);\n break;\n case comboQueryLast:\n me.doFilter(me.lastQuery);\n break;\n default:\n me.doFilter(me.input.value);\n }\n }\n }\n }", "function alerts() {\n $(\"span.top-label.label.label-warning\").text(todoItemsData.length);\n $('.dropdown-alerts').empty();\n $.each(todoItemsData, (idx, item) => {\n let i = $('<i class=\"fa fa-tasks fa-fw\"></i>');\n let span = $('<span class=\"pull-right text-muted small\"></span>').text( daysLeft(item.date) + ' days left');\n let div = $('<div></div>').append(i).append(item.title).append(span);\n let a = $('<a href=\"#\"></a>')\n .click( () => {\n $('.card[data-todoid=\"' + item.item_id + '\"] .edit-btn').click();\n })\n .append(div);\n let li = $('<li></li>').append(a);\n let divider = $('<li class=\"divider\"></li>');\n $(\"ul.dropdown-menu.dropdown-alerts\").append(li).append(divider);\n });\n}", "function setFilterDisplayObj() {\n var postArray = ['categoryFilter', 'statusFilter', 'substatusFilter', 'typeFilter', 'subTypeFilter', 'venueFilter', 'lawtypeFilter'];\n var valKey = ['category', 'statuses', 'substatus', 'type', 'subtypes', 'venues', 'law-types'];\n var filterObj = {};\n _.each(postArray, function (val, index) {\n //get array of current valkey item from masterlist\n if (val == 'substatusFilter') {\n var array = extractSubStatus();\n } else if (val == 'subTypeFilter') {\n var array = extractSubTypes();\n } else {\n var array = angular.copy(self.viewModel.masterList[valKey[index]]);\n }\n\n var appliedFilters = [];\n //iterate over current selected filters\n\n var filterString = self.viewModel.filters[val].toString();\n _.forEach(filterString.split(','), function (id) {\n if (utils.isEmptyString(id)) { return; } //if filter id is all/stalled push as is\n if (id === \"all\") {\n appliedFilters.push(id);\n } else if (id === \"stalled\") {\n appliedFilters.push('');\n } else {\n // find object from array having the current id\n var appliedFilter = _.find(array, function (item) {\n return item.id === id;\n });\n\n if (utils.isEmptyVal(appliedFilter.name)) {\n appliedFilter.name = \"{Blank}\";\n }\n appliedFilters.push(appliedFilter.name);\n }\n });\n //set the filter obj\n // filterObj ={name:<filter name>,value:<applied filters>}\n filterObj[val] = {};\n filterObj[val].name = valKey[index].toUpperCase();\n filterObj[val].data = appliedFilters;\n });\n filterObj.orderby = {\n name: \"ORDERED BY\",\n data: [self.getSortByLabel(self.viewModel.filters.sortby)]\n };\n\n //US#5557 Added Include referredOut status in print with Yes/ No ....Start\n if (self.viewModel.filters.statusFilter == \"stalled\" || self.viewModel.filters.statusCase == \"Stalled\") {\n var includeReferredOutValue = self.viewModel.filters.includeReferredOut == 1 ? 'Yes' : '';\n filterObj.includeReferredOut = {\n name: \"Include Referred Out\",\n data: [includeReferredOutValue]\n };\n\n filterObj.statusCase = {\n name: \"Stalled\",\n data: [self.viewModel.filters.statusCase]\n };\n }\n\n var attorneys = self.allUsers[1].attorny;\n var staffs = self.allUsers[4].staffonly;\n var paralegals = self.allUsers[3].paralegal;\n if (utils.isNotEmptyVal(self.viewModel.filters.leadAttorney)) {\n var userObj = _.find(attorneys, function (user) {\n return user.uid == self.viewModel.filters.leadAttorney;\n });\n var userName = userObj.name + ' ' + userObj.lname;\n filterObj.leadAttorney = {\n name: 'Lead Attorney',\n data: [userName]\n };\n } else {\n filterObj.leadAttorney = {\n name: 'Lead Attorney',\n data: []\n };\n }\n\n if (utils.isNotEmptyVal(self.viewModel.filters.attorney)) {\n var userObj = _.find(attorneys, function (user) {\n return user.uid == self.viewModel.filters.attorney;\n });\n var userName = userObj.name + ' ' + userObj.lname;\n filterObj.attorney = {\n name: 'Attorney',\n data: [userName]\n };\n } else {\n filterObj.attorney = {\n name: 'Attorney',\n data: []\n };\n }\n\n if (utils.isNotEmptyVal(self.viewModel.filters.staff)) {\n var userObj = _.find(staffs, function (user) {\n return user.uid == self.viewModel.filters.staff;\n });\n var userName = userObj.name + ' ' + userObj.lname;\n filterObj.staff = {\n name: 'Staff',\n data: [userName]\n };\n } else {\n filterObj.staff = {\n name: 'Staff',\n data: []\n };\n }\n\n if (utils.isNotEmptyVal(self.viewModel.filters.paralegal)) {\n var userObj = _.find(paralegals, function (user) {\n return user.uid == self.viewModel.filters.paralegal;\n });\n var userName = userObj.name + ' ' + userObj.lname;\n filterObj.paralegal = {\n name: 'Paralegal',\n data: [userName]\n };\n } else {\n filterObj.paralegal = {\n name: 'Paralegal',\n data: []\n };\n }\n\n if (utils.isNotEmptyVal(self.viewModel.filters.doiEnd) && utils.isNotEmptyVal(self.viewModel.filters.doiStart)) {\n var start = moment.unix(self.viewModel.filters.doiStart).utc().format('MM/DD/YYYY');\n var end = moment.unix(self.viewModel.filters.doiEnd).utc().format('MM/DD/YYYY');\n filterObj.doi = {\n name: 'DOI Range',\n data: [start + ' - ' + end]\n };\n }\n return filterObj;\n }", "function showAlert(alert_id) {\n hideAlerts();\n $('#' + alert_id).show();\n }", "function showAlert(alert_id) {\n hideAlerts();\n $('#' + alert_id).show();\n }", "function setupAreaSelectionEventListener() {\n $(\"#area-dropdown .dropdown-menu li a\").click(function () {\n selectedArea = $(this).text();\n var selText = $(this).text();\n $(this).parents('.btn-group').find('.dropdown-toggle').html(selText + ' <span class=\"caret\"></span>');\n clearDoctorDetails();\n dataTable.rows().every(function (rowIdx, tableLoop, rowLoop) {\n var data = this.data();\n if (selText !== \"All Cities\" && data.area !== selText) {\n this.node().style.display = \"none\";\n } else if (selectedSpeciality == null || selectedSpeciality == data.speciality) {\n this.node().style.display = \"\";\n }\n });\n });\n}", "showResults(data) {\n\n const results = data.airports;\n\n console.log(results);\n\n let output = \"\";\n //The following for will print all the results in our table in the index.html \n //(saving in variable output)\n for (let index = 0; index < results.length; index++) {\n output += \"<tr>\"; //creating a table row element\n\n output += \"<td>\" + results[index].name + \"</td>\";\n output += \"<td>\" + results[index].iata + \"</td>\";\n output += \"<td>\" + results[index].state.type + \"</td>\";\n output += \"<td>\" + results[index].city + \"</td>\";\n output += \"<td>\" + results[index].state.name + \"</td>\";\n output += \"<td>\" + results[index].country.name + \"</td>\";\n\n output += \"</tr>\";\n }\n\n // console.log(output);\n\n // Notifying the number of airports found based on the query (in the div tag we get in constructor)\n this.notify.innerHTML = `\n <article class=\"message is-primary\">\n <div class=\"message-body\">\n Showing <span class=\"tag is-success\">${results.length}</span>\n Results for ${data.term.toUpperCase()}\n </div>\n </article> \n `;\n\n // TimeOut (It will show the alert for 7 seconds)\n setTimeout(() => {\n const currentAlertS = document.querySelector('.is-primary');\n\n if (currentAlertS) {\n\n currentAlertS.remove();\n }\n\n }, 7000);\n\n\n //putting the data got from restful API into the table\n this.display.innerHTML = output;\n }", "function getAlertAreas(){\n if($window.localStorage[\"authenticated\"] !== \"null\" && $window.localStorage[\"authenticated\"] === \"true\" && $window.localStorage[\"token\"] !== \"null\" && $window.localStorage[\"token\"]) {\n AlertArea_Service.setToken($window.localStorage[\"token\"]);\n var alertareas = AlertArea_Service.AlertAreas().get();\n alertareas.$promise.then(function() {\n removeAlertAreas();\n geofenceLayer = L.geoJson(alertareas, {\n style: function(feature) {\n return {\n color: '#3b9972',\n weight: 2,\n opacity: 0.6,\n fillOpacity: 0.1,\n pk: feature.properties.pk,\n /*Mark the polygon with it's database id*/\n objType: 'polygon'\n }}\n }).eachLayer(function(layer){alertareaLayer.addLayer(layer);});\n $scope.map.addLayer(alertareaLayer);\n $scope.legend.alertAreas = true;\n }, function(err) {\n try {\n $cordovaToast.showShortBottom(\"Alert areas could not be retrieved.\");\n } catch (err) {\n console.log(\"Alert areas could not be retrieved.\");\n }\n })\n }}" ]
[ "0.6027999", "0.5704662", "0.56729025", "0.5671811", "0.55752796", "0.55389655", "0.55389655", "0.55220586", "0.55215806", "0.5472647", "0.54531014", "0.544349", "0.5392448", "0.5316566", "0.5316141", "0.5280121", "0.5274039", "0.5268145", "0.5252321", "0.52098984", "0.52023536", "0.5186827", "0.51832294", "0.5160721", "0.5160721", "0.516", "0.51499045", "0.51406646", "0.5136927", "0.5116341", "0.51093304", "0.5071003", "0.5046768", "0.50401634", "0.50315094", "0.5020471", "0.50150204", "0.50143373", "0.50125945", "0.50103587", "0.5001244", "0.4995273", "0.498988", "0.49861866", "0.49836588", "0.49805188", "0.49763703", "0.49755692", "0.4967972", "0.49545512", "0.4953094", "0.49499846", "0.49472106", "0.4946808", "0.4946714", "0.49463934", "0.4945627", "0.4945369", "0.49423164", "0.49414644", "0.49384114", "0.49348313", "0.49320146", "0.49318388", "0.49252215", "0.49182466", "0.49168628", "0.49137244", "0.4913263", "0.49087465", "0.49078217", "0.4903647", "0.49028143", "0.4902472", "0.49015626", "0.49006084", "0.48998114", "0.48960343", "0.48898795", "0.48781595", "0.4857761", "0.48572773", "0.4856508", "0.4853823", "0.48504835", "0.4848138", "0.48449126", "0.48431608", "0.4840631", "0.48405215", "0.4833749", "0.48334733", "0.48285845", "0.48233977", "0.48233223", "0.4808477", "0.4808477", "0.47951692", "0.4794231", "0.47928625" ]
0.48475093
86
1) Generate random number 2) Give user ability to guess 3) If they are wrong guess again, maybe get a hint 4) IF they win say they won
function guessGame() { let randomNr = Math.floor(Math.random() * 11); console.log(randomNr); let guess; do { guess = prompt("Guess a number between 1 and 10"); console.log(guess, randomNr); if (randomNr > guess) { console.log("You guessed to low"); } else if (randomNr < guess) { console.log("You guessed too high"); } } while (guess != randomNr); console.log("You won!"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randomNumber() {\n\tif (getyx(y,x) =='Y3X23' || getyx(y,x) =='Y3X2') {\n\t\tvar randomNumber = (Math.floor(Math.random() * 5) + 1);\n\t\tvar bet = prompt('Please make a wager');\n\t\tvar guess = prompt('Please pick a number from 1 to 5');\n\t\t\tif(parseInt(guess) == randomNumber) {\n\t\t\talert('You just increased your score by ' + bet + ' !')\n\t\t\tscore += parseInt(bet);\n\t\t\tscoreCheck();\n\t\t}\n\t\telse {\n\t\t\talert('Sorry you just lost ' + bet + ' health points :(');\n\t\t\thealth -= parseInt(bet);\n\t\t\tscoreCheck();\n\t\t}\n\t}\n}", "function processValidGuess(guess) {\n if (guess < aRandomNumber) {\n $('.result-line').text(\"That is too low\");\n } else if (guess > aRandomNumber) {\n $('.result-line').text(\"That is too high\");\n } else {\n increaseWins();\n increaseMinMax();\n $('.result-line').text(\"BOOM! Click Reset to continue playing\");\n }\n }", "function provideHint(){\n\tvar guessesLeft = (5 - (arrayOfGuesses.length));\n\tvar hintArray = [winningNumber];\n\tfor (var i = 1; i < 2*guessesLeft; i++) {\n\t\tvar rand = generateWinningNumber();\n\t\thintArray.push(rand);\n\t}\n\tshuffle(hintArray);\n\tchangeAnn(\"One of these is the answer: \" + hintArray);\n}", "function guessing() {\n\tconst guess = Number(document.querySelector(\".guess\").value);\n\t// ----- Invalid input\n\tif (guess < 1 || guess > 20) {\n\t\tchangeText(\".number\", guess);\n\t\tchangeText(\n\t\t\t\".message\",\n\t\t\t\"Invalid value, please select number between 1 and 20\"\n\t\t);\n\t} // ----- Correct Guess\n\telse if (guess === randomNumber) {\n\t\tchangeText(\".number\", randomNumber);\n\t\tdocument.querySelector(\"body\").style.backgroundColor = \"green\";\n\t\tdocument.querySelector(\".number\").style.width = \"30rem\";\n\t\tscore++;\n\t\tchangeText(\".score\", score);\n\t\tchangeText(\".message\", \"You are Correct!\");\n\t\t//Validate that score is higher than highscore and, if true, set highscore\n\t\tscore > highscore ? (highscore = score) : highscore;\n\t\tchangeText(\".highscore\", highscore);\n\t} // ----- Low Guess\n\telse if (guess < randomNumber) {\n\t\tlowHighGuess(\"low\");\n\t} // ----- High Guess\n\telse if (guess > randomNumber) {\n\t\tlowHighGuess(\"high\");\n\t}\n}", "function checkGuess(guess) {\n // Write your code here\n if (guess == randomNumber){\n alert(\"You got it!\");\n }\n else {\n alert(\"Try again\");\n }\n }", "function enterAGuess(guessedNumbered){\n\n var differenceNum = Math.abs(guessedNumbered - randomNum);\n if (differenceNum == 0){\n \t//alert(\"You did it!\");\n \t$(\"h2\").text(\"You Won!\");\n } \n \telse if (differenceNum >= 50){\n \t\t$(\"h2\").text(\"Colder\");\n \t}\n else if (differenceNum >= 30){\n \t$(\"h2\").text(\"Cold\");\n }\n else if (differenceNum >=20){\n \t$(\"h2\").text(\"Hot\");\n }\n else if (differenceNum >=10){\n \t$(\"h2\").text(\"Hotter\");\n } \n /*---- counting the number of guesses */\n countTrackGuesses(guessedNumbered);\t\n }", "function processGuess() {\n var guess = document.getElementById(\"inputText\").value;\n var hint = document.getElementById(\"hintMessage\");\n hint.innerHTML = guess;\n var recent = document.getElementById(\"inputText\").value;\n recentGuess.innerHTML = guess;\n // If the userGuess is lower than the random number the h2 will tell the user their guess is too low.\n if (guess < rand) {\n hint.innerHTML = \"Hint: Your guess is too low, please try again.\"\n };\n // If the userGuess is higher than the random number the h2 will tell the user their guess is too high.\n if (guess > rand) {\n hint.innerHTML= \"Hint: Your guess is too high, please try again.\"\n };\n // If the user guess is equal to the random number the user wins!\n if (guess == rand) {\n hint.innerHTML= \"Congrats, victory is yours!\"\n };\n guess = document.getElementById(\"inputText\").value = \"\";\n}", "function guessLogic(guess){\n if (randomNum > guess){\n \tdocument.getElementById(\"userGuess\").innerText = guess;\n \tdocument.getElementById(\"statement\").innerText = \"Your last guess was\";\n \tdocument.getElementById(\"response\").innerText = \"That is too low\";\t\n }\n else if (randomNum < guess ){\n \t\tdocument.getElementById(\"userGuess\").innerText = guess;\n \t\tdocument.getElementById(\"statement\").innerText = \"Your last guess was\";\n \t\tdocument.getElementById(\"response\").innerText = \"That is too high\";\t\n }\n else{\n \t\twinner(guess)\n }\n}", "function letsGuess() {\n // sugenereuoti skaiciu nuo 1 iki 10 sveika skaiciu\n let randomNumber = Math.floor(Math.random() * 10) + 1;\n // console.log(\"randomNumber\", randomNumber);\n // paprasyti user input ir patikrtinti ar pataikyta\n let userNumber = prompt(\"Iveskite skaiciu\");\n // console.log(\"userNumber\", +userNumber);\n\n if (randomNumber === +userNumber) {\n console.log(\"Pataikete, sveikinimai\");\n } else {\n console.log(\"Neatspejote, bandykite dar karta. Kompiuteris spejo kad sptesit\", randomNumber);\n }\n}", "function checkGuess() {\n\n\tif (playersGuess==winningNumber) {\n\t\t\t$(\"#winner\").text(\"!!! IT'S YOU. YOU WON !!!\");\n\t\t\talert(\"WE HAVE A WINNER!!!\");\n\t\t\t//add some sick congratulatory elements\n\t} else {\n\t\t\tlowerOrHigher();\n\t}\n}", "function makeGuess() {\n if (hasGameEnded(guesses, secret)) {\n return;\n }\n if (isValidInput(guess)) {\n setStatus(\"\");\n console.log(\"secret: \" + secret);\n setGuesses(guesses.concat(guess));\n setGuess(\"\");\n setHints(hints.concat(getHint(secret, guess)));\n console.log(\"num guesses: \" + guesses.length);\n } else {\n console.log(\"bad input\");\n setStatus(\"A guess must be a 4-digit unique integer (1-9)\");\n }\n }", "function guessFunction(userNum, randomNum) {\n if (userNum === randomNum) {\n boom();\n lastGuessNumber.style.color = \"#1abc9c\";\n guessBtn.disabled = true;\n setRangeValue(minNum -= 10, maxNum += 10);\n } else if (userNum > randomNum) {\n guessText.innerText = \"That is too high\";\n lastGuessNumber.style.color = \"#ed5a64\";\n } else {\n guessText.innerText = \"That is too low\";\n lastGuessNumber.style.color = \"#ed5a64\";\n }\n}", "function guessingGame() {\n\tvar randomNumber = Math.ceil(20 * Math.random());\n\tvar guess = Number(prompt(\"Try a number between 1 and 20!\"));\n\tvar numTries = 1;\n\tif (guess === randomNumber) {\n\t\talert(\"Congratulations! You guessed correctly on the first try.\");\n\t}\n\twhile (guess !== randomNumber) {\n\t\tguess = Number(prompt(\"Try again.\"));\n\t\tnumTries++;\n\t\tif (guess === randomNumber) {\n\t\t\talert(\"Congratulations! It took you \" + numTries + \" tries.\");\n\t\t\treturn(guess);\n\t\t}\n\t}\t\n}", "function checkGuess(){\r\n guesstext=guesstext.toUpperCase();//country array is in upper case, so change guess to uppercase\r\n if(guesstext==answer){//if the guess was correct\r\n answer=pickAnswer();//find a new answer\r\n chances=3; score+=10; guess.value=\"\";//reset chances to 3, add 10 to score and clear guess input field\r\n alert(guesstext+\"! You're right!\");//congratulate the user\r\n }\r\n else{chances-=1; guess.value=\"\";//guess is not correct, subtract one chance and clear the input field\r\n if(chances>0){alert(\"Nope. Try again.\");}//if there are chances left, ask user to try again\r\n }\r\n showGui();// turns on the engine and updates info\r\n }", "function guess() {\n\n // WRITE YOUR EXERCISE 4 CODE HERE\n let number=Math.floor(Math.random()*999)+1;\n let attempts=0;\n let correct_answer = false;\n while (correct_answer==false) {\n let guess=prompt('enter your guess')\n if(guess>=1 && guess<=1000 && Number.isInteger(Number(guess))){\n console.log(\"1\");\n if (number==guess){\n attempts++;\n correct_answer=true;\n alert(\"Correct Answer!\")\n document.getElementById('guess-output').innerHTML=\"Number: \"+number+\"</br>Attempts: \"+attempts;\n }\n else if(guess>number){\n attempts++;\n alert(\"too high\")\n }\n else if(guess<number){\n attempts++;\n alert(\"too low\")\n }\n }\n }\n\n ////////////////// DO NOT MODIFY\n check('guess'); // DO NOT MODIFY\n ////////////////// DO NOT MODIFY\n}", "function provideHint(){\n\t//As the function generates random numbers, it is important to prevent the user from clicking the hint button more than once to see which number has not changed.\n if (hintNotGiven) {\n var hintArr = [];\n \n for(var i = 0; i < guesses; i++) {\n hintArr[i] = generateWinningNumber();\n }\n hintArr[Math.round(Math.random()*(guesses-1))] = winningNumber;\n\n $('.remaining').text(hintArr.join(\", \"));\n\n hintNotGiven = false;\n };\n}", "function provideHint(){\n\tvar hintarr = [winningNumber];\n\tfor (var i=numOfGuesses;i>0;i--){\n\t\thintarr.push(Math.ceil(Math.random()*100));\n\t}\n\thintarr=shuffle(hintarr);\n\t$(\"#message\").text(hintarr);\n\n}", "function checkGuess() {\n\t\tplayersGuessSubmission();\n\t\t//check win\n\t\tif (winningNumber === playersGuess) {\n\t\t\t$(\".thermometer\").html (\"\"+playersGuess+\"&deg\")\n\t\t\t$(\"#therm\").removeAttr('class');\n\t\t\t$(\"#therm\").addClass(\"thermometer scorching\");\n\t\t\t$(\".text\").append (\"<p style='color:white'>Scorching!!!</p>\")\n\t\t}\n\t\t//check errors\n\t\telse if (playersGuess > 100) {\n\t\t\t$(\".text\").append (\"<p style='color:white'>Remember between 1 - 100!</p>\")\n\t\t}\n\t\telse if (isNaN(playersGuess)) {\n\t\t\t$(\".text\").append (\"<p style='color:white'>Not a number</p>\")\n\t\t}\n\t\t//check and update\n\t\telse {\n\t\t\t$(\".thermometer\").html (\"\"+playersGuess+\"&deg\")\n\t\t\tWarmerOrColder(); \n\t\t}\n\t}", "function randomizer () {\n // convert the users number to an integer\n userGuess = document.getElementById('input').value\n userGuess = parseInt(userGuess)\n\n // generate random number between 1 and 6\n randomNumber = (Math.random() * 6) + 1\n randomNumber = parseInt(randomNumber)\n // compare users guess to random numbers\n if (userGuess === randomNumber) {\n document.getElementById('answer').innerHTML = 'you win!'\n }\n}", "function guessNumber() {\n console.log(\"our random number ==\" + randomNumber);\n let guess=parseFloat(inputValue.value);\n if(guess === \"\" || guess <= 0 || guess > 100 || isNaN(guess)){\n msg[0].innerHTML =\"Please enter a number between 1 and 100\";\n } \n else{\n tryChances();\n if(guess > randomNumber){\n msg[0].innerHTML =\"Number is too high\";\n }\n else if(guess < randomNumber){\n msg[0].innerHTML =\"Number is too low\";\n }\n else if(guess === randomNumber) {\n msg[0].innerHTML =\"You win\";\n btnGuess.disabled=true;\n return;\n }\n }\n}", "function guessNumber()\r\n{\t\r\n\r\n\r\n\tlet userInputInt = document.getElementById(\"userGuess\").value; //grabbing the input from the user and making it a number so it doesn't come out with NaN\r\n\t\r\n\t if (userInputInt == randomNumber)\r\n\t{\r\n\t\tdocument.getElementById(\"outPut\").innerHTML = \"YOU GOT IT!!\" //making an if statement that prints out the user got it if the input matches the random number\r\n\t\tdocument.getElementById(\"check\").disabled=true; //disabling the check button when the user gets it correct so it forces them to restart if they decide to\r\n\t}\r\n\r\n\telse if (userInputInt > randomNumber) //else if statement that shows if the input is greater than the random number\r\n\t{\r\n\t\tdocument.getElementById(\"outPut\").innerHTML = \"LOWER!!\"\r\n\t\r\n\t\tnumberOfGuesses-- //everytime the user guesses wrong the number of guesses decrease by 1\r\n\t\tdocument.getElementById(\"numberOfGuesses\").innerHTML = \"Number of Guesses: \" + numberOfGuesses; //changing the number of guesses displayed\r\n\t}\r\n\t\r\n\telse\r\n\t{\r\n\t\tdocument.getElementById(\"outPut\").innerHTML = \"HIGHER!!\"\r\n\t\tnumberOfGuesses-- \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//if the input number is lower the output displays a statement that tells the user to guess higher\r\n\t\tdocument.getElementById(\"numberOfGuesses\").innerHTML = \"Number of Guesses: \" + numberOfGuesses;\r\n\t}\r\n\r\n\t////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r\n\tif (numberOfGuesses == 0)\r\n\t{\r\n\t\tdocument.getElementById(\"check\").disabled=true; //disabling the button after the user runs out of guesses\r\n\t\tdocument.getElementById(\"outPut\").innerHTML = \"Out of Guesses..\";\r\n\t\tsetTimeout(numGuessSleep, 1000);\t\t\t\t\t\t\t\t\t\t\r\n\t\t\r\n\r\n\t}\r\n\r\n\t//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r\n\r\n\tif (userInputInt > 19) //if the user inputs a number greater than the greatest random number it will throw an alert and tell you cant type over 19 and it restarts\r\n\t{\r\n\t\talert(\"You can't type any number over 19\");\r\n\t\trestartGame();\r\n\t}\r\n\r\n\telse if (userInputInt == \"\") //if the user types no input it will display a sentence\r\n\t{\r\n\t\tdocument.getElementById(\"outPut\").innerHTML = \"Type something..\";\r\n\t\tnumberOfGuesses = 5; //without this the number of guesses will decrease \r\n\t\tdocument.getElementById(\"numberOfGuesses\").innerHTML = \"Number of Guesses: \" + numberOfGuesses;\r\n\r\n\t}\r\n\r\n\telse if (userInputInt < MIN) //if the user inputs a number less than the lowest possible number it also throws an alert and tells you cant type beow 1 and it restarts\r\n\t{\r\n\t\talert(\"You can't type any number below 1.\");\r\n\t\trestartGame(); //running the restart game function\r\n\t}\r\n\r\n\r\n}", "function guessing_game(guess) {\n var num = Math.ceil(Math.random() * 10);\n\n if (guess == num)\n alert('Good Work');\n else\n alert('Not matched, the number was ' + num);\n}", "function guessNumber() {\n let userNumber = parseInt(userInput.value);\n let text = \"\";\n\n if (userNumber > randomNumber && userNumber <= 100) {\n text = \"demasiado alto\";\n } else if (userNumber < randomNumber) {\n text = \"demasiado bajo\";\n } else if (userNumber === randomNumber) {\n text = \"has ganado campeona\";\n } else if (userNumber > 100 || userNumber === 0) {\n text = \"el número debe estar entre 1 y 100\";\n }\n\n counter();\n showFeedback(text);\n}", "function checkGuess(){\n \n // Increase the guess counter by 1\n counterGuess++;\n \n // get value from the input element\n var guessedNum = $numberInput.val();\n console.log(guessedNum);\n \n // test if value entered is valid\n var numIsValid = validateGuess(guessedNum, $messageOutput);\n \n // Check Guess against random number\n if(numIsValid === true){\n\tif(guessedNum > ranNum){\n\t\t$messageOutput.text('To high, try a lower number');\n\t}else if(guessedNum < ranNum){\n\t\t$messageOutput.text('To low, try a higher number');\t\n\t}else{\n\t\tendGame(counterGuess);\t\t\n\t}\n } \n\n} // end checkGuess function", "function guessing_game(guess) {\n // Get a random integer from 1 to 10 inclusive\n var x=Math.ceil(10*Math.random());\n if(x==guess)\n console.log(\"Good Work!\");\n else\n console.log(\"Not Matched!Value is \"+x);\n return x;\n \n}", "function checkguess() { \n\n// USER GUESS TAKEN FROM TEXT BOX, CONVERTED FROM A STRING AND STORED TO VAR\nvar userguess = parseInt(document.getElementById(\"input1\").value);\n\t\n// IF THE GUESS IS BIGGER \n\tif (userguess > randomnum) {\n\t\n//COUNT CLICKS VARIABLE CALLED ON AND ADDS +1 \n\t\t countClicks++;\n// RESULT \n result = \"Your guess of \" + userguess + \" is higher than the magic number. <br >You have had </b> \" + countClicks + \" </b>guesses so far.\";\n\t\t \n } \n\t\telse if (userguess < randomnum) {\n\t\t\t countClicks++;\n result =\"Your guess of \" + userguess + \" is lower than the magic number. <br >You have had </b> \" + countClicks + \" </b>guesses so far.\";\n\t\t \n } \n\t\telse {\n\t\t\tcountClicks++;\n result = \"Success, You win! You took </b> \" + countClicks + \" </b>guesses.\";\n\t\t\t\n } \n// SENDS THE RESULT TO THE DOM\n\t document.getElementById(\"result\").innerHTML = result;\n\t\n} //END OF FUNCTION - dont delete!", "function userGuess(){\n var input = parseInt($(\"#userGuess\").val());\n var feedback = [\"Congrats you won! Click New Game to start another game\", \"Please enter a number\", \"Pick a number btw 1-100\", \"Very Hot\", \"Hot\", \"Warm\", \"Cold\", \"Very Cold\", \"Cold as Vanilla Ice's career\"]\n if (input == random) {\n updateFeedback(feedback[0]);\n } else if (input >= 101 || input == 0) {\n $(\"#userGuess\").val(\"\");\n $(\"#count\").text(--i);\n updateFeedback(feedback[2]);\n } else if (random - 5 <= input && input <= random + 5) {\n updateFeedback(feedback[3]);\n } else if (random - 10 <= input && input <= random + 10) {\n updateFeedback(feedback[4]); \n } else if (random - 15 <= input && input <= random + 15) {\n updateFeedback(feedback[5]);\n } else if (random - 25 <= input && input <= random + 25) {\n updateFeedback(feedback[6]);\n } else if (random - 30 <= input && input <= random + 30) {\n updateFeedback(feedback[7]);\n } else if (isNaN(input)) {\n updateFeedback(feedback[1]);\n $(\"#userGuess\").val(\"\");\n $(\"#count\").text(--i);\n } else {\n updateFeedback(feedback[8]);\n }\n }", "function isGuessCorrect(randomNumber, answer) {\n //condition that checks to see if the number of guesses made by the user is still less than the total number of allowed guesses\n if (numberGuessed < numberOfGuessesAllowed) {\n //condition that checks if the guess is lesser than the goal\n if (answer > randomNumber) {\n setTimeout(function () {\n $(\"#guess\").html(`<h5 class=\"animated flash\">Guess too high. Guess Again </h5>`);\n }, 1000);\n }//condition that checks if the guess is greater than the goal\n if (answer < randomNumber) {\n setTimeout(function () {\n $(\"#guess\").html(`<h5 class=\"animated flash\">Guess too low. Guess Again </h5>`);\n }, 1000);\n }//condition that checks if the guess is the same as the goal\n if (answer === randomNumber) {\n //call back function that displays the end game result \n setTimeout(function () {\n $(\"body\").html(`<div class=\"jumbotron text-center\"><h1 class=\"text-success\">GAME WON!</h1></div>\n <button class=\"btn btn-primary mt-1 mb-1\" id=\"restartgame\">RESTART</button>`);\n $(\"#restartgame\").click(function () {\n location.reload();\n });\n }, 1000);\n }\n //call back function that displays the number of times the user has guessed as an animation on screen\n setTimeout(function () {\n $(\"#numberofguesses\").html(`<h5 class=\"animated flash\">Number of times guessed : ${numberGuessed}</h5>`);\n }, 1000);\n //callback function that displays the maximum number of guesses the user can make as an animation on screen\n setTimeout(function () {\n $(\"#maxnumberofguesses\").html(`<h5 class=\"animated flash\">Maximum guesses allowed : ${numberOfGuessesAllowed}</h5>`);\n }, 1000);\n }\n else {\n $(\"body\").html(`<div class=\"jumbotron text-center\">\n <h1 class=\"text-danger\">GAME OVER!</h1>\n </div>\n <button class=\"btn btn-primary mt-1 mb-1\" id=\"restartgame\">RESTART</button>`);\n $(\"#restartgame\").click(function () {\n location.reload();\n });\n }\n }", "function newGame() {\n\tnum = Math.round(Math.random() * 50);\n\tguess.placeholder=\"Make your first guess\";\n\tdocument.getElementById(\"output\").innerHTML=\"You have five attempts to guess my number between 1 and 50\";\n\treset.style.display=\"none\";\n}", "function check_guess() {\n \n count_timer();\n \n var guess_from_user = document.getElementById(\"number_guessed\").value; // this grabs the input from the user and stores it in the variable guess_from_user\n \n var output; // the result \n \n number_guesses_left--;\n \n number_of_guesses++;\n \n \n if (isNaN(guess_from_user) || guess_from_user < 1 || guess_from_user > 100)\n { \n output = \"Please enter a valid number\";\n } \n \n if (guess_from_user > random_number && guess_from_user > 0 && guess_from_user < 101)\n { \n output = \"You guessed to high, you have \" + number_guesses_left + \" left.\";\n \n }\n \n if (guess_from_user < random_number && guess_from_user > 0 && guess_from_user < 101)\n { \n output = \"You guessed to low, you have \" + number_guesses_left + \" left\";\n }\n \n if (guess_from_user == random_number) // if the user guesses correctly an alert box will appear\n {\n alert_box(\"Congratulations you guessed the number \" + random_number + \" correctly, it only took you \" + number_of_guesses + \" time(s), would you like to play again?\");\n }\n \n if (number_guesses_left == 0) // if the user does not guess within the amount of tries they lose\n {\n alert_box(\"You lose, the secret number was \" + random_number + \", would you like to play again?\");\n }\n \n \n document.getElementById(\"the_output\").innerHTML = output; // this displays the output based on what the user inputs regarding the loop above \n }", "function checkGuess(){\n\t\t// add code here\n\t\tif(playersGuess === winningNumber) {\n\t\t\t$('#domMessage').text('Good catch, YOU WIN!!!!');\n\t\t\t$('#domMessage').css({'font-size': '60px', 'font-weight': 'bold', 'text-align': 'center', 'margin': '0', 'color': 'white', 'font-family': 'palatino','background-color':'green'});\n\t\t\t$(\".guess\").hide();\n\t\t\t$(\"#guessmessage\").hide();\n\t\t\t$(\"#Hint\").hide();\n\t\t} \n\n\t\telse if(duplicateCheck(playersGuess)===true) {\n\t\t\t$('#domMessage').text('You already tried this number; input a different one ');\n\t\t\t$('#domMessage').css({'font-size': '50px', 'font-weight': 'bold', 'text-align': 'center', 'margin': '0', 'color': 'orange', 'font-family': 'palatino'});\n\t\t}\n\n\t\telse if(guessRemaining >=1) {\n\t\t\tguessRemaining--;\n\t\t\tattempts.push(playersGuess);\n\n\t\t\tif(guessRemaining===1) {\n\t\t\t\t$('#domMessage').text('Error. This is your last guess ! ');\n\t\t\t\t$('#domMessage').css({'font-size': '50px', 'font-weight': 'bold', 'text-align': 'center', 'margin': '0', 'color': 'orange', 'font-family': 'palatino'});\n\t\t\t\tguessMessage();\n\t\t\t} else if(guessRemaining>1){\n\t\t\t\t$('#domMessage').text('You have ' + guessRemaining + ' remaining guesses.');\n\t\t\t\t$('#domMessage').css({'font-size': '50px', 'font-weight': 'bold', 'text-align': 'center', 'margin': '0', 'color': 'black', 'font-family': 'palatino'});\n\t\t\t\tguessMessage();\n\t\t\t}\n\t\t}\n\n\t\telse if(guessRemaining===0) {\n\t\t\t$('#domMessage').text('GAME OVER. Reset if you want to give it another try.');\n\t\t\t$('#domMessage').css({'font-size': '60px', 'font-weight': 'bold', 'text-align': 'center', 'margin': '0', 'color': 'white', 'font-family': 'palatino','background-color':'red'});\n\t\t\t$(\".guess\").hide();\n\t\t\t$(\"#guessmessage\").hide();\n\t\t\t$(\"#Hint\").hide();\n\t\t}\n\t}", "function decideToGenerate() {\n if (numberOfGuesses === 1) {\n generateNumber();\n }\n}", "function usersGuess() {\n // to get the value entered by the user\n var inputGuess = document.getElementById('guessed-field').value;\n // to parse the user input\n var userInput = parseInt(inputGuess);\n // to check if the user input is an integer which is a value above 1 and below 45\n if (isNaN(userInput) || userInput < 1 || userInput > 45) {\n clearValue();\n // to display a text alert if the conditions are not met\n textBlink();\n displayInnerHtml('alert-text', 'Please enter a number between 1 & 45');\n return;\n }\n // to check if the user input is equal to the generated number\n if (generatedNumber === userInput) {\n // message display as animation\n textBlink();\n document.getElementById('background').style.background = \"url('../mind-game/images/youwon_mobile.png')\";\n document.getElementById('end-game').click();\n displayInnerHtml(\n 'popup-text',\n 'CONGRATS!! You guessed it right in try no' + ' ' + (5 - numberOfTry)\n ); \n }\n // to check if the user input is lesser than the generated number\n else if (generatedNumber > userInput) {\n numberOfTry -= 1;\n // to check if the number of guesses is equal to zero\n if (numberOfTry === 0) {\n // message display as animation\n textBlink();\n document.getElementById('end-game').click();\n displayInnerHtml(\n 'popup-text',\n 'The number was' +\n ' ' +\n generatedNumber +\n '.'\n );\n return;\n }\n // to display the number of chances left\n displayInnerHtml(\n 'chance-alert',\n 'You have' + ' ' + numberOfTry + ' ' + 'chances left'\n );\n displayInnerHtml(\n 'alert-text',\n 'UH OH!!! Enter a value higher than' + ' ' + userInput\n );\n // to return the textinput value to emptyfield\n clearValue();\n \n } else {\n numberOfTry -= 1;\n if (numberOfTry === 0) {\n textBlink();\n displayInnerHtml(\n 'alert-text',\n 'The number was' +\n ' ' +\n generatedNumber +\n '.'\n );\n return;\n }\n displayInnerHtml(\n 'chance-alert',\n 'You have' + ' ' + numberOfTry + ' ' + 'chances left'\n );\n displayInnerHtml(\n 'alert-text',\n 'UH OH!!! Enter a value lower than' + ' ' + userInput\n );\n // to return the textinput value to emptyfield\n clearValue();\n \n }\n}", "function checkNumber() {\n let userGuess = Number(guessField.value);\n //let inputType = typeof userGuess garaas oruulsan utga too esehiig shalganaa\n\n let l1, l2, l3, l4;\n l1 = (userGuess - (userGuess % 1000)) / 1000;\n l2 = ((userGuess % 1000) - (userGuess % 100)) / 100;\n l3 = ((userGuess % 100) - (userGuess % 10)) / 10;\n l4 = userGuess % 10;\n\n let a = 0,\n b = 0;\n if (random_1 == l1) a++;\n if (random_2 == l2) a++;\n if (random_3 == l3) a++;\n if (random_4 == l4) a++;\n\n if (l1 == random_2 || l1 == random_3 || l1 == random_4) b++;\n if (l2 == random_1 || l2 == random_3 || l2 == random_4) b++;\n if (l3 == random_2 || l3 == random_1 || l3 == random_4) b++;\n if (l4 == random_2 || l4 == random_3 || l4 == random_1) b++;\n\n status = document.createElement(\"p\");\n status.setAttribute(\"id\", \"p1\");\n status.textContent =\n l1 +\n \" \" +\n l2 +\n \" \" +\n l3 +\n \" \" +\n l4 +\n \" | a = \" +\n a +\n \" \" +\n \"b = \" +\n b +\n \" \";\n resultDiv.append(status);\n\n guessField.value = \"\";\n guessField.focus();\n\n if (a == 4) {\n game = document.createElement(\"label\");\n game.textContent = \"You won!!!\";\n game.style.backgroundColor = \"green\";\n resultDiv.append(game);\n setGameOver();\n }\n}", "function provideHint(){\n\tvar randNum1 = Math.ceil(Math.random() * 100);\n var randNum2 = Math.ceil(Math.random() * 100);\n var hintArray = [randNum1, randNum2, winningNumber].sort(function() { return .5 - Math.random(); });\n $('.hintMessage').text(\"Try one of these: [\" + hintArray.join(', ') + \"]\");\n}", "function numberguess() {\n x = Math.floor(Math.random() * 10) + 1; // returns a number between 1 and 10\n userResponse = prompt('Enter a Number between 1 and 10')\n\n if (x === userResponse) {\n alert('You guessed Correct')\n }\n else {\n alert('You guessed Wrong')\n }\n alert('Random Number was ' + x)\n\n}", "function getRandomCompared() {\n let userNumber = parseInt(input.value);\n if (randomNumberSelected === userNumber) {\n printResult(result, 'You win!! 🎉');\n } else if (userNumber > 100) {\n printResult(result, 'Can\\'t be bigger than 100');\n } else if (userNumber < 0) {\n printResult(result, 'Can\\'t be smaller than 0');\n } else if (randomNumberSelected < userNumber) {\n printResult(result, 'Too hight 🌡, try again');\n add1Counter();\n } else if (randomNumberSelected > userNumber) {\n printResult(result, 'Too short ☃, try again');\n add1Counter();\n } else {\n printResult(result, 'Please, enter a valid number');\n }\n}", "function checkGuess(){\n\tif(playersGuess === winningNumber){\n //$('#result').text(\"winner winner chicken dinner!\");\n return winner();\n }\n else {\n if(guesses.indexOf(playersGuess) === -1){\n guesses.push(playersGuess);\n guessMessage();\n }\n else{\n $('#result').text(\"Be more creative with your choices...\")\n } \n }\n}", "function guess(numberGenerated, totalGuess, max) {\n const numberGuessed = readline.question(`Guess the number: `);\n if(numberGuessed < 0 || numberGuessed > max) {\n console.log(`\\nplease guess the number between 0 and ${max}`);\n guess(numberGenerated, totalGuess, max);\n }\n if(numberGenerated == numberGuessed) {\n totalGuess++;\n console.log(`\n Booyah....! You guessed correctly..\n Number generated is : ${numberGenerated}\n Your guess is: ${numberGuessed}\n chances you took : ${totalGuess}\n `);\n process.exit();\n } else {\n console.log(`Oops..! Your guess is wrong..!\\n`);\n totalGuess++;\n guess(numberGenerated, totalGuess, max);\n }\n}", "function game(param1, param2) {\n if (param1 - Math.floor(param1) !== 0 || param2 - Math.floor(param2) !== 0)\n return;\n var random = Math.floor(Math.random() * (param2 - param1 + 1) + param1);\n var userAnswer = +prompt(\"Enter number\");\n while (random !== userAnswer) {\n console.log('Try again!');\n userAnswer = +prompt(\"Enter number\");\n }\n console.log('Gratz!');\n}", "function guesses() {\n \t\tuserGuess = parseInt($(\"#guess\").val());\n\n\t \tif (userGuess < randomNumber) {\n\t\t\t$(\".message\").text(\"Your guess is too low\");\n\n\t\t} else if (userGuess > randomNumber){\n\t\t\t$(\".message\").text(\"Your guess is too high\");\n\n\t\t} else if (userGuess === randomNumber){\n\t\t\t$(\".message\").text(\"You guessed correctly!\");\n\t\t\t$(\".message\").attr(\"class\", \"success\");\n\t\t} \n\t}", "function game() { \n const playerguess = document.getElementById(\"guess\").value;\n\n if (playerguess == luckynumber)\n {alert(\"omg you ARE the lucky winner, treat yourself to a drink in our newly renovated drinkroom!!\");\n }\n else if (playerguess == (luckynumber + 1))\n {alert(\"close, but yet so far!\");\n }\n else if (playerguess == (luckynumber - 1))\n {alert(\"close, but yet so far!\");\n }\n else \n {alert(\"you couldnt be more wrong! Maybe more luck next time\");}\n }", "function guessingGame() {\n var guessString = prompt(\"Please guess a number 1 through 5\");\n var guessNum = parseInt(guessString);\n var randomNum = Math.floor(Math.random() * 6);\n while (guessNum != randomNum) {\n if (guessNum < randomNum) {\n guessNum = prompt(\"Nope! Too low! Please guess another number.\");\n }\n else {\n guessNum = prompt(\"Nope! Too high! Please guess another number.\");\n }\n };\n\n alert(\"You're amazing! The number was \" + randomNum);\n }", "function againBtn() {\n\n document.querySelector('.guess').value = '';\n \n number = Math.trunc(Math.random() * 20 ) + 1; \n\n score = 20; \n\n displayMessage(\"Start guessing...\");\n\n UIscore(score); \n\n bgColor(\"#222\");\n\n document.querySelector('.number').textContent = \"?\";\n}", "function numberGuessGame() {\n\t\n//when they click the button it starts the function and creates a message that alerts the user as to what to do. It then allows the user to enter their guess. \n\tlet message =\n \"I'm thinking of a number between 1 and 100.\\n\" +\n \"Try to guess it!\\n\" +\n \"Please enter an integer between 1 and 100.\";\n//uses the JS math function to create a random number for the user to guess \n\tlet answer = 38;\n\t//grabs their \"guess\" and creates a variable from it\n let guess;\n\t//counter variable that will count the attempts. \n\t\tlet counter = 0;\n//post test loop which will go through until number is guessed. Will add up and end as soon as user guesses number. \n do {\n\t\t\t\tcounter ++;\n guess = parseInt(prompt(message));\n\t\t\t\n if (guess < answer) {\n message = guess +\n \" is too low. Please enter another number.\";\n }\n else if (guess > answer) {\n message = guess +\n \" is too high. Please enter another number.\";\n }\n } while (guess != answer);\n\t\n\t\t//Updates the message once the user has guessed the number.\n message = guess + \" is correct! It only took you \" + counter + \" attempts to guess it! Great job!\";\n \n\t//Displays the message.\n\tdocument.getElementById('answer').innerHTML = message;\n\t\n}", "function newGame() {\n inputValue.value = \"\";\n btnGuess.disabled=false;\n randomNumber = Math.floor(Math.random() * 100 + 1);\n count = 0;\n noOfTry.textContent = \"tries:\" + count;\n chance.innerHTML = \"Number of chances: 5\"; \n triesLeft=5;\n msg[0].textContent=\"Guess a number between 1 and 100\";\n}", "function guessingGame(){\n\nvar randomNumber = Math.floor(Math.random() * 10) + 1;\n//console.log(randomNumber);\nvar guess = prompt('guess a number between 1 and 10!');\nconsole.log(guess);\nif(guess=null){\n\treturn\n}\n\nwhile(randomNumber !=guess){\n\tif(randomNumber > guess){\n\t\talert('your guess is too low');\n\t\t} else{\n\t\t\talert('your guess is too high')\n\t\t}\n\t guess = prompt('Guess a number between 1 and 10!');\n}\nreturn alert('you are right!')}", "function provideHint(){\n\tfunction randomNumHintGen(){ //create random number each time function is called\n\t\treturn Math.floor(Math.random() * (100 - 1) + 1);\n\t}\n\tvar hintArray = [winningNumber];\n\tif (numGuesses === 1) { // one guess\n\t\tfor (var i = 0; i < 7; i++) {\n\t\t\thintArray.push(randomNumHintGen());\n\t\t}\n\t} else if (numGuesses === 2) { // two guesses\n\t\tfor (var i = 0; i < 5; i++) {\n\t\t\thintArray.push(randomNumHintGen());\n\t\t}\n\t} else if (numGuesses === 3) { // three guesses\n\t\tfor (var i = 0; i < 3; i++) {\n\t\t\thintArray.push(randomNumHintGen());\n\t\t}\n\t} else if (numGuesses === 4) { // four guesses\n\t\tfor (var i = 0; i < 1; i++) {\n\t\t\thintArray.push(randomNumHintGen());\n\t\t}\n\t}\n\treturn hintArray;\n}", "function randomNumberGame(){\n var random = Math.floor((Math.random() * 20) + 1);\n console.log('random number:', random); //this will print out the random number\n var number; //this is the user input\n var attempts = 0; //this will allow me to limit total attempts\n //Then use a 'while' loop to compare user input to the random number and generate a response accordingly.\n while (number !== random && attempts < 4) {\n number = parseInt(prompt('How many cups of coffee do I drink each day?'));\n console.log('user guess:', number);\n attempts ++; //counts attempts for each answer given in loop\n\n if (number < random) {\n alert('That\\'s not enough!');\n counter ++;\n } else if (number > random) {\n alert('I like my coffee, but that\\'s too much');\n counter ++;\n } else if (isNaN(number)) {\n alert('Please give a real number');\n counter ++;\n } else if (number === random) {\n alert('You got it! Best part of waking up...');\n correct ++;\n counter ++;\n } if (attempts === 4) {\n alert('sorry, out of tries');\n }\n }\n}", "function checkGuess() {\n event.preventDefault();\n\n var guessInput = document.getElementById( 'formInput' );\n var guessInputValue = formInput.value;\n\n var parsed = parseInt(guessInputValue);\n var verified = verifyInput( guessInputValue, minInput, maxInput );\n\n if ( verified === true ) {\n hideElement(errorMessageDisplay);\n \n showElement(lastGuessText);\n changeText(lastGuessText, \"Your last guess was\");\n\n showElement(guessDisplay);\n changeText(guessDisplay, guessInputValue);\n\n showElement(resultText);\n\n enableButton(resetButton);\n\n if ( parsed === solution ) {\n changeText(resultText, \"BOOM!\");\n win();\n } else if ( parsed > solution ) {\n changeText(resultText, \"That is too high!\");\n } else if ( parsed < solution ) {\n changeText(resultText, \"That is too low\");\n }\n }\n}", "function questionSix(){\n var randoNum = Math.floor(Math.random() * 10) + 1;\n var opportunities = 4;\n var robotVoice = 'Guess a integer from 1 to 10!';\n\n /*beggining of while loop checks the condition to see if there are any turns left. */\n while (opportunities > 0) {\n /*Lets the user know to guess an integer and how many chances are left.*/\n var userChoice = prompt(robotVoice + ' You have ' + opportunities + ' try\\'s to go.');\n /*Lets the out of the program if they select cancel.*/\n if (!userChoice){\n break;\n }\n // /**The Number() function converts the object\n // argument to a number that represents the object's value. */\n userChoice = Number(userChoice);\n console.log('userChoice is ' + userChoice);\n console.log('Random generator number is ' + randoNum);\n\n // /**check condition of input to random number selected */\n if (userChoice === randoNum) {\n alert('thats right you guessed the random number way to go!');\n /**I need help with this part I know I need it I just dont know why. */\n opportunities = 0;\n break;\n } else {\n /*Notfies user that they were wrong and take the input decides if\n * it was higher or lower than the random number in the if statements. */\n robotVoice = 'You were close, but no, try again.';\n if (userChoice < randoNum){\n robotVoice += ' Too Low!';\n }\n if (userChoice > randoNum) {\n robotVoice += ' Too High!';\n }\n /*This decrements the opportunities each time the user enters a try. */\n opportunities = opportunities - 1;\n console.log('guessCount is ' + opportunities);\n\n }\n }\n /*This line of code sits outside the loop so that if the user cancels or fails\n * to guess correct, then they are told what the answer is. */\n alert('The Random number Generator choose ' + randoNum + ' as it\\'s number .');\n\n}", "function guessWhat(result) {\nvar randomGuess = Math.floor(Math.random()*2);\nif (guessWhat ===0) {\n$(\"#guess-image\").html(\n \"<aziz-acharki-592558-unsplash.jpg>\"\n );\n}\n else { \n $(\"#guess-image\").html(\n \"daniel-pascoa-253357-unsplash.jpg>\"\n);\n } \n if ( result===randomGuess){\n wins++;\n $(\"#win-lose\").html(\"<h2>Winner!</h2>\");\n $(\"#wins\").html(\"<h3>\" + wins + \"</h3>\");\n }\n else {\n losses++;\n $(\"#win-lose\").html(\"<h2>Loser!</h2>\");\n $(\"#losses\").html(\"<h3>\" + losses + \"</h3>\");\n }\n}", "function guessing_game(guess) // no display\n {\n\n // Get a random integer from 1 to 10 inclusive\n console.log(\"matched or unmatched?\");\n var match, num;\n\n //for(var i = 0; i <= 10000; i++)\n //{\n num = Math.random() * 100; // Math.random() return a random number between 0 and 1\n num = Math.ceil(num); // used floor thus getting 1 among 10000 samples\n num = (num % 10) + 1; // to generate number between 1 and 10\n console.log(\"at i = \" + i + \", num = \" + num);\n //}\n\n if(guess === num)\n {\n return(\"Good Work\");\n }\n\n else\n {\n return(\"Not matched\");\n }\n\n }", "function guess() {\n var number = parseInt(document.getElementById(\"your-number\").value),\n randomNumber = Math.floor(Math.random() * 10);\n if (isNaN(number) || number < 1 || number > 10) {\n document.getElementById(\"guess-h3\").innerText = \"You Have To Select An Integer Number From 1 To 10\"\n } else {\n if(number === randomNumber) {\n document.getElementById(\"guess-h3\").innerText = \"Good Work\"\n }else {\n document.getElementById(\"guess-h3\").innerText = \"Not Matched\"\n }\n }\n clear();\n}", "function tryGuess() {\n\t\tsocket.cb_push(\"guess\", guess);\n\t\tsetGuess(\"\");\n\t\t//if (!util.gameOver(state.recorded, state.secret)) {\n\t\t//\tlet prev = state.recorded;\n\t//\t\tprev.push(guess);\n\t//\t\tsetState({secret: state.secret, warning: \"\", recorded: prev});\n\t//\t\tsetGuess(\"\");\n\t//\t}\n\t}", "function guessNumber(){\n var randomN = Math.floor(Math.random() * 10) + 1;\n var usersN = parseInt(document.getElementById(\"guessN\").value);\n if(randomN === usersN){\n alert(\"Good Work!\");\n } else {\n var notM = document.getElementById(\"text\");\n notM.innerHTML =\"Not matched. Try again!\";\n notM.style.color=\"coral\";\n }\n}", "function evaluateGuess(){ // Begin evaluateGuess\n // a) Compare the guess to the current number. If the guess is correct, return true, otherwise return false.\n if(Number(input.value) == currentNumber )\n {\n return true;\n }\n else\n {\n return false;\n }\n} // End of evaluateGuess", "function guess() {\n\n //3. grab the value from the user\n let userNum = document.getElementById(\"guessNumber\").value;\n //After the user enters a guess, the textbox is cleared. \n document.getElementById(\"guessNumber\").value = \"\";\n //save the result message\n let resultMessage = ''\n\n //4. compare with the value the comp picked\n //5. if comp's num > user's num, \"too low\"\n if (computerNum > userNum) {\n resultMessage = 'too low';\n //6. if comp's num < user's num, \"too high\"\n } else if (computerNum < userNum) {\n resultMessage = 'too high';\n //7. if comp's num === user's num, \"correct\"\n } else if (computerNum == userNum) {\n\n document.getElementById(\"resultArea\").innerHTML = `${userNum} is correct! You win! :)`\n document.getElementById(\"resultArea\").classList.add(\"alert-success\");\n document.getElementById(\"guessButton\").disabled = true;\n\n timeOut()\n\n return;\n }\n\n remainingGuess--;\n\n history.push(userNum)\n\n\n //8. show the result to the user\n document.getElementById(\"resultArea\").innerHTML = `Result is ${resultMessage}`;\n document.getElementById(\"historyArea\").innerHTML = `History of you guess: ${history}`;\n document.getElementById(\"remainGuess\").innerHTML = `${remainingGuess}`\n\n // 1. make only 5 chance\n // 3. if user win, or lose the guess button will be disabled\n if (history.length == 5) {\n document.getElementById(\"guessButton\").disabled = true;\n document.getElementById(\"resultArea\").innerHTML = `The result is ${computerNum}. You ran out of guess! You lose :(`;\n alert(\"You don't have any guess left\");\n timeOut();\n }\n}", "function checkWinLoss(){\n\tif(playerCounter==numToGuess){\n\t\twins++; \n\t\t$(\"#wins\").html(wins); \n\t\tresetNumbers(); \n\t\tgenerateNumbers(); \n\t}else if(playerCounter>numToGuess){\n\t\tlosses++; \n\t\t$(\"#losses\").html(losses); \n\t\tresetNumbers(); \n\t\tgenerateNumbers(); \n\t}\n}", "function checkGuess () {\n var isItRepeated = $guessed.includes($guess);\n if (isItRepeated === true) {\n alreadyGuessed = true;\n } else {\n alreadyGuessed = false;\n }\n }", "function check_guess(guess) {\n if (guess < correct_number) {\n turns += 1\n return \"That is too low\"\n } else if (guess > correct_number) {\n turns += 1\n return \"That is too high\"\n } else {\n turns += 1\n var current_min = $(\"#min\").val();\n var current_max = $(\"#max\").val();\n $(\"#min\").val(parseInt(current_min) - 10);\n $(\"#max\").val(parseInt(current_max) + 10);\n // clear guess input field\n $(\"#guess\").val(\"\")\n // set min-max, pick new number on new range, hide errors and messages and disable unneccessary buttons\n set_num();\n $(\"#error\").html(`That took you ${turns} turns.<br>It just got harder.<br>Minimum is 10 lower.<br>Maximum is 10 higher.`);\n $(\"#error\").show();\n // win message\n return \"BOOM!\"\n }\n}", "function guessNumber(){\nvar programNumber = Math.ceil(Math.random() * 10);\n var userNumber = prompt('Input the number between 1 and 10 inclusive');\n if (userNumber == programNumber)\n alert('Matched');\n else\n alert('Not matched');\n}", "function playGuessGame() {\r\n\r\n var chance = 0;\r\n var numToGuess = generateRandomNum();\r\n \r\n while (chance < 3) { // given 3 chances\r\n \r\n chance++;\r\n var userGuess = prompt(\"Your Guess: \"); // taking guess (input) from the user\r\n if (userGuess === numToGuess) {\r\n console.log(\"You're Right. You've Won!!\");\r\n }\r\n else {\r\n console.log(\"Try Again...\");\r\n }\r\n\r\n var playAgain = false;\r\n\r\n if (chance === 3) {\r\n var askUser = prompt(\"Do You Want To Play Again? (Yes/No)\");\r\n askUser = askUser.toLowerCase();\r\n \r\n if (askUser === \"yes\") {\r\n playAgain = true;\r\n chance = 0; // to reset the game\r\n }\r\n else if (askUser === \"no\") {\r\n playAgain = false;\r\n console.log(\"Thank You For Playing With Us Today!\");\r\n }\r\n }\r\n \r\n\r\n\r\n }\r\n\r\n}", "function question6() {\n var correctNumber = Math.floor(Math.random() * 30);\n var attempts = 4;\n while (attempts !== 0){\n\n var guessNumber = prompt('Let\\'s get serious. Guess a number from 1 to 50:');\n console.log('User input: ' + guessNumber);\n\n if (parseInt(guessNumber)){\n if (parseInt(guessNumber) === correctNumber){\n\n console.log(\"True!\");\n alert('Great job! You guess it with ' + (5 - attempts) + ' attempt(s)');\n correctAns++;\n break;\n } \n else if (parseInt(guessNumber) < correctNumber){\n \n console.log(parseInt(guessNumber) + ' lower than ' + correctNumber);\n attempts--;\n alert(\"Wrong...Go higher!\" + attempts + \" attempts left\");\n \n } \n else if (parseInt(guessNumber) > correctNumber){\n \n console.log(parseInt(guessNumber) + ' bigger that ' + correctNumber);\n attempts--; \n alert(\"Wrong...Go lower!\" + attempts + \" attempts left\");\n \n }\n \n }\n else alert('Wrong input! It should be a whole number');\n }\n\n if ((attempts === 0) && (guessNumber !== correctNumber)){\n\n alert('You wasted all your attempts...');\n }\n}", "function checkValueToGoal(){\n if(currentTotalCounter===randomizedChosenGoalNumber){\n winCounter++;\n $(\"#winCounter\").html(winCounter); \n restartGame();\n } else if(currentTotalCounter> randomizedChosenGoalNumber){\n loseCounter++;\n $(\"#loseCounter\").html(loseCounter);\n restartGame();\n }\n}", "function evaluateGuessOne(guess, randomNumber, min, max) {\n console.log(\"minumum number is: \" + min);\n console.log(\"max number is: \" + max);\n if(guess < min || guess > max) {\n console.error(\"Number is not in range\");\n highOrLow1.innerText = \"Out of range\";\n return alert(`Number must be between ${min} and ${max}`);\n } else if(isNaN(guess)){\n console.log(\"NOT A NUMBER\");\n displayGuess1.innerText = \"--\";\n highOrLow1.innerText = \"That's Not a Number...\";\n alert(\"Please enter a valid number\");\n } else if(guess < randomNumber) {\n console.log(\"Player 1: guess is to low: \" + guess);\n highOrLow1.innerText = \"that's to low\";\n } else if(guess > randomNumber) {\n console.log(\"Player 1: guess it to high: \" + guess);\n highOrLow1.innerText = \"that's to high\";\n } else {\n console.log(\"Correct Guess\");\n highOrLow1.innerText = \"BOOM!\";\n newWinnerCard(challenger1Name.value, challenger2Name.value, challenger1Name.value);\n // winnerName.innerText = challenger1Name.value;\n alterGamerRange(min, max);\n console.log(\"The new Minimum range is: \" + min);\n console.log(\"The new Maximum range is: \" + max);\n }\n }", "function compare(){\n feedback.classList.remove('warning');\n let num = Number(guessNum.value);\n let sd = 10;\n if ( num > random ) {\n if( Math.abs(num-random) <= sd ){\n feedback.innerHTML = \"Too high, But very close!\"\n } else {\n feedback.innerHTML = \"Too high!\"\n }\n } else if ( num < random ) {\n if( Math.abs(num-random) <= sd ){\n feedback.innerHTML = \"Too low, But very close!\"\n } else {\n feedback.innerHTML = \"Too low!\"\n }\n } else if ( num === random ) {\n feedback.innerHTML = \"Bingo!!!\";\n feedback.classList.add('bingo');\n again();\n };\n}", "function getHint() {\n cheating = true;\n var randomnumber=Math.floor(Math.random()*81);\n if (puzzleFull()) { alert(\"No more hints! Puzzle is full!\"); return false;}\n\n if (puzzle.charAt(randomnumber) == '0' && document.getElementById(randomnumber).value == '') {\n document.getElementById(randomnumber).value = puzzleS.charAt(randomnumber);\n } else {\n getHint();\n }\n}", "function guessMyNumber(n) {\n var upperbound =6;\n var rightNumber=randInt(upperbound);\n\n if (n > upperbound) {\n return \"Out of bounds! Please try a number between 0 and 5.\";\n }\n \n else if (n === rightNumber) {\n return \"You guessed my number!\";\n }\n return \"Nope! That wasn't it!\" + \"correct number: \" + rightNumber ;\n}", "function checkGuess() {\r\n var guess = document.getElementById('guess').value;\r\n\r\n if (!isNaN(guess)) {\r\n var guesses = document.getElementById('output');\r\n\r\n if (guess === randNum) guesses.value = guesses.value + \"\\r\" + \"You have guessed correctly! (\" + guess + \")\";\r\n else if (guess > randNum) guesses.value = guesses.value + \"\\r\" + \"You have guessed too high! (\" + guess + \")\";\r\n else guesses.value = guesses.value + \"\\r\" + \"You have guessed too low! (\" + guess + \")\";\r\n }\r\n else alert(\"Not an integer, try again.\");\r\n}", "function guessField(){\n // Store the input entered into the text field into a variable \"ans\" and immediately cast to int\n var ans = parseInt(document.getElementById(\"numberGuess\").elements[\"number\"].value);\n console.log(\"secret: \" + secret + \"\\nyour guess: \" + ans);\n\n do // Used a do-while, because we always want to this block to execute at least once\n {\n console.log(\"Entered while loop\\nsecret: \" + secret + \"\\nans: \" + ans + \"\\nguessed: \" + guessed);\n\n if(ans > secret){\n console.log(\"Your guess is too high\");\n write(\"result4\", ans + \" is too high. Guess again\");\n break;\n } else if (ans < secret){\n console.log(\"Your guess is too low\");\n write(\"result4\", ans + \" is too low. Guess again\");\n break;\n } else if (ans === secret){\n console.log(\"You guessed it!\");\n write(\"result4\", \"You correctly guessed the number \" + ans + \". A new number random number will be generated now\");\n alert(\"You correctly guessed the number \" + ans + \". A new number random number will be generated now\");\n secret = Math.floor(Math.random() * (MAX+1));\n console.log(\"New secret: \" + secret);\n guessed=true;\n } else { // If this else is reached, the input must be invalid. Prompt the user, and get a new guess.\n console.log(\"Invalid input. Enter a number\");\n write(\"result4\", \"Invalid input. Please enter a number between 0 and 5\");\n break;\n }\n } while(guessed === false);\n}", "function provideHint() {\n var diff = Math.abs(playersGuess - winningNumber);\n if (diff > 50) {\n return (\" Like whoa. Maybe try a different end of the spectrum.\")\n } else if (diff > 25) {\n return (\" You're a fair ways off.\")\n } else if (diff > 9) {\n return (\" Getting there!\")\n } else {\n return (\" So close!\")\n }\n }", "function userWinOrLose() {\n if (result > randomNum) {\n losses++;\n console.log(\"user lost\");\n // alert(\"You lost! Try again.\");\n initializeGame();\n }\n\n if (result === randomNum) {\n wins++;\n console.log(\"user won\");\n // alert(\"You won! Great job. Best out of 5?\");\n initializeGame();\n }\n}", "function sixthQuestion() {\n//sixth question\n var secretNum = 20;\n console.log('Value of secretNum: ', secretNum);\n\n// Evaluate whether the guess is too high or too low and give the user four attempts\n var attempt = 0;\n var maxAttempts = 4;\n while (attempt < maxAttempts) {\n var guessedNum = prompt('Guess my secret number.');\n guessedNum = parseInt(guessedNum);\n console.log('value of guessedNum: ', guessedNum);\n console.log('type of guessedNum: ', typeof guessedNum);\n\n if (guessedNum === secretNum) {\n alert('BULLSEYE. ', secretNum, ' was my secret Number!');\n attempt = maxAttempts; // exit loop\n tallyCorrect++;\n } else if (guessedNum < secretNum) {\n alert('Too low. Click OK and guess again.');\n console.log('Attempt #: ', attempt);\n } else if (guessedNum > secretNum) {\n alert('Too high. Click OK and guess again.');\n console.log('Attempt #: ', attempt);\n } else {\n alert('Rethink that choice.');\n console.log('Attempt #: ', attempt);\n }\n attempt++;\n }\n console.log('out of the loop');\n console.log('count: ' + tallyCorrect);\n}", "function generateRandNum() {\r\n var guesses = document.getElementById(\"output\");\r\n var clicked = false;\r\n\r\n document.getElementById('newGame').onclick = function() {\r\n clicked = !clicked;\r\n };\r\n document.getElementById('guess').addEventListener(\"keyup\", function(event) {\r\n event.preventDefault();\r\n if (event.keyCode === 13) document.getElementById('check').click();\r\n });\r\n\r\n if (clicked) {\r\n if (!confirm('Restart game with new number?')) return;\r\n }\r\n\r\n guesses.value = '';\r\n randNum = Math.floor(Math.random()*500);\r\n guesses.value = \"New number generated.\\n\"\r\n\r\n // hide number that has been generated\r\n document.getElementById('numToGuess').value = '';\r\n document.getElementById('showCheat').style.display = 'none';\r\n}", "function checkFinal(){\n \tplayersGuessSubmission(); \n \t//check errors\n \tif (playersGuess > 100) {\n\t\t\t$(\".text\").append (\"<p style='color:white'>Remember between 1 - 100!</p>\")\n\t\t}\n\t\telse if (isNaN(playersGuess)) {\n\t\t\t$(\".text\").append (\"<p style='color:white'>Not a number</p>\")\n\t\t}\n\n\t\telse {\n\t\t\tvar winStatus;\n\t\t\tif (winningNumber === playersGuess) {\n\t \t\twinStatus = \"VICTORY\"; \n \t\t}\n \t\telse {\n \t\t\twinStatus = \"Sorrow and Defeat\";\n \t\t}\n \t\tgameOver(winStatus);\n\t\t}\n }", "function setHiddenFields() {\n\n answer.value = (Math.floor((Math.random() * 10000))).toString();\n while (answer.value.length < 4) {\n answer.value = '0' + answer.value;\n }\n attempt.value = 0\n\n\n console.log('set ' + answer.value + ' - ' + (answer.value).length);\n ///Math.floor(Math.random()*1000,4);\n //add functionality to guess function here\n}", "function checkGuess(){ \n\t//var guessesRemaining = 5;\n\tif (isNaN(playersGuess) || playersGuess < 1 || playersGuess > 100) { // NaN, less than one, greater than 100\n\t\t$(\"#updates\").text(\"Invalid entry, try again\");\n\t} else {\n\t\tif (playersGuess === winningNumber) {\n\t\t\tyouWin();\n\t\t} else { \n\t\t\tif (guessArray.indexOf(playersGuess) !== -1) { // check if players guess is duplicate \n\t\t\t\t$(\"#updates\").text(\"You entered \" + playersGuess + \" already, guess again\"); \n\t\t\t} else {\n\t\t\t\tnumGuesses++; // increment guesses\n\t\t\t\tguessesRemaining--; // decrement guesses remaining\n\t\t\t\t$(\"p\").append(\"p\").text(\"You have \" + guessesRemaining + \" guesses left.\"); //remaining guesses countdown\n\t\t\t\tguessArray.push(playersGuess); // add guesses to array\n\t\t\t\tguessMessage(); \n\t\t\t\tif (numGuesses >= 5) {\n\t\t\t\t\tgameOver();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function playgame() {\n // generates a random number\n let ranNum = Math.floor(Math.random() * maxNum) + minNum;\n\n // alerts the min and max \n alert(\"I'm thinking of a number between \" + minNum + ' and ' + maxNum)\n\n //define the variable\n let guess = 0\n\n\n // runs game \n while (guess != maxTries) {\n // add one to the their the guesses so that the loop stops at 3\n guess += 1\n //ask user for their guess \n let userNumber = prompt('guess a number')\n //convert user input to a number\n userNumber = Number(userNumber)\n\n //checks the answer \n if (userNumber >= minNum && userNumber <= maxNum) {\n\n if (userNumber == ranNum) {\n guess = maxTries\n alert('that is correct')\n\n } else {\n alert('that is incorrect')\n }\n\n } else {\n alert('error:inavild')\n }\n\n }\n}", "function checkPlayerGuess() {\n if (!isPlayerWon && !isComputerWon) {\n if (inputLengthLarger()) {\n setTimeout(limitInputLength, 50);\n }\n let secret = playerGuess.value.toUpperCase().substring(0, 5);\n if (secret !== computerBase) {\n messageStatus = 'Wrong Word. Try another guess!';\n message.style.color = wrongColor;\n }\n } else {\n messageStatus = isComputerWon\n ? `Computer wins in ${count} turns`\n : `Human wins in ${count} turns`;\n message.style.color = rightColor;\n }\n}", "function checkUserGuess() {\n\tvar userGuess = parseInt($(\"#userGuess\").val()),\n\ttheDifference = Math.abs(newGameNumber - userGuess);\n\t\n\t\n\t\n\n\taddToList(userGuess);\n\n\tif (theDifference === 0)\n\t\twrite(\"You Got It!\");\n\telse if (theDifference <= 10)\n\t\twrite(\"On Fire\");\n\telse if (theDifference <= 25)\n\t\twrite(\"Hotter\");\n\telse if (theDifference <= 50)\n\t\twrite(\"Warm\");\n\telse if (theDifference <= 75)\n\t\twrite(\"Cold\");\n\telse if (theDifference <= 100)\n\t\twrite(\"Freezing\");\n\t\n\t\n}", "function startGame(){\n //generate random number by calling function and store it in variable\n randomNumber = generateRandomNumber(parseInt(maximumNumber));\n //generating random number for the number of guesses allowed;\n numberOfGuessesAllowed = Math.floor(Math.random() * 20) + 5;\n //calling function that will scroll the viewport to the game area\n scrollToGameScreen();\n //calling function that displays the message that prompts the user to guess the values\n displayMessageToPromptUserToGuessWithAnimation();\n //calling function that displays the input text field\n displayAnswerInputFieldWithAnimation();\n //calling function that displays the answer button\n displayAnswerButtonWithAnimation();\n }", "function inputGuess() {\n var currentGuess = \"000\";\n\tvar currentGuessArray = [];\n\tvar exactPlace = 0;\n var wrongPlace = 0;\n // Get the value of the input field with id=\"guessEntered\"\n currentGuess = pad(document.getElementById(\"guessEntered\").value,3);\n\t// Make current guess into array\n\tcurrentGuessArray = currentGuess.split(\"\");\n // Add the current guess to the end of the array of guesses\n\tarrayOfGuesses.push(currentGuess);\n\t// Calculate number of matches in exact place\n\texactPlace = (Number(combination[0] == currentGuessArray[0]) + Number(combination[1] == currentGuessArray[1]) + Number(combination[2] == currentGuessArray[2]));\n\twrongPlace = (Number(combination[0] == currentGuessArray[1]) + Number(combination[0] == currentGuessArray[2]) + Number(combination[1] == currentGuessArray[0]) + Number(combination[1] == currentGuessArray[2]) + Number(combination[2] == currentGuessArray[0]) + Number(combination[2] == currentGuessArray[1]));\n\t\n\t// If currentGuess is equal to the Target Number, end with Win else provide stats or end with Lose.\t\n switch(Number(currentGuess == combination) * 2 + \n\t\t(Number(guessesRemain != 1))) {\n case 0:\n\t\t\tguessesRemain--;\n\t\t\tguessListText = currentGuess.concat(\"&nbsp;&nbsp;\", \"<span class=\\\"exactplace\\\">\", exactPlace, \"</span>&nbsp;<span class=\\\"wrongplace\\\">\", wrongPlace, \"</span><br>\", guessListText);\n\t\t\tdocument.getElementById(\"response\").innerHTML = \"Sorry, you're out of guesses. The combination was \" + combination + \". Please refresh the page to try a new game.\";\n\t\t\tdocument.getElementById(\"guessList\").innerHTML = guessListText;\n\t\t\tbreak;\n\t\tcase 1:\n\t\t guessesRemain--;\n guessListText = currentGuess.concat(\"&nbsp;&nbsp;\", \"<span class=\\\"exactplace\\\">\", exactPlace, \"</span>&nbsp;<span class=\\\"wrongplace\\\">\", wrongPlace, \"</span><br>\", guessListText);\n\t document.getElementById(\"response\").innerHTML = \"Try again.\";\n document.getElementById(\"guessList\").innerHTML = guessListText;\n\t\t\tbreak;\n\t\tcase 2:\n\t\tcase 3:\n guessesRemain--;\n\t\t\tguessListText = currentGuess.concat(\"&nbsp;&nbsp;\", \"<span class=\\\"exactplace\\\">\", exactPlace, \"</span>&nbsp;<span class=\\\"wrongplace\\\">\", wrongPlace, \"</span><br>\", guessListText);\n\t\t\tdocument.getElementById(\"response\").innerHTML = \"You guessed it!\";\n\t\t\tdocument.getElementById(\"guessList\").innerHTML = guessListText;\n\t\t\tbreak;\n\t\tdefault:\n\t\t document.getElementById(\"response\").innerHTML = \"Wow. Something weird happened. Please notify the game designer.\";\n\t\t\tbreak;\n\t}\n\tdocument.getElementById(\"remaining\").innerHTML = \"Guesses remaining: \" + guessesRemain;\n}", "function PromptNumber(max_value) {\n\t// variables created inside of a function aren't available outside of it.\n\t// If you reuse a variable name from the global scope, only the locally defined\n\t// version will be available here.\n\t// It is best to keep global variables to a minimum and only use global variables when necessary.\n\tlet text, num;\n\t\n\t// Here we have a REPEAT UNTIL loop. The program will always go through the loop at least once.\n\t// We say that it is a bottom tested loop as it checks to see if it should loop at the bottom of the block.\n\tdo {\n\t\t// parseInt will change a string into a number.\n\t\ttext = prompt('What is your guess?');\n\t\tnum = parseInt(text);\n\t\t\n\t\tif (isNaN(num)) {\n\t\t\t// If you pass in something that isn't a number to parseInt, it \n\t\t\t// returns a special Not a Number code. If we got that just change\n\t\t\t// it to zero. We will use isNaN to detect a number parse error.\n\t\t\tnum = 0;\n\t\t\talert('\"' + text + '\" is not a number. Try again.');\n\t\t}\n\t\telse if (num < 1) {\n\t\t\talert(num.toString() + ' is too small for the given range. Try again.');\n\t\t}\n\t\telse if (num > max_value) {\n\t\t\talert(num.toString() + ' is too large for the given range. Try again.');\n\t\t}\t\t\n\t}\n\twhile (num < 1 || num > max_value)\n\t// && is the boolean and operator. It will be true when both checks are true and false otherwise.\n\t// || is the boolean or operator. It will be true when either check is true, and only false if both checks are.\n\t\n\t\n\t// To return a value back to the caller use the return statement. \n\treturn num;\n}", "function question6 (){\n\n var actualRetries = Math.floor(Math.random() * 10) + 1;\n console.log('Actual number of retries: ' + actualRetries);\n\n var el = document.getElementById('random-number');\n el.textContent = actualRetries;\n\n var guessedRetries = 0;\n var correctGuess = false;\n var numberOfGuesses = 0;\n\n //The initial prompt is kept separate from the follow up question to be more interactive\n\n guessedRetries = prompt('Can you guess the number of my retries to get all answers on the course quiz right? Please be courteous and limit your response to a number between 1 and 10.');\n\n while (numberOfGuesses < 4){\n console.log('Number of retries guessed: ' + guessedRetries);\n if (actualRetries < guessedRetries){\n guessedRetries = prompt('Number is lower than your guess. Try again!');\n } else if (actualRetries > guessedRetries){\n guessedRetries = prompt('Number is higher than your guess. Try again!');\n } else {\n correctGuess = true;\n break;\n }\n numberOfGuesses++;\n }\n\n //Keep track of number ofright answers. Set the alert message depending on the outcomme\n\n if (!correctGuess){\n alert('Sorry, you have exhausted the number of tries.');\n } else{\n alert('Awesome, you got it!');\n numberOfRightAnswers++;\n }\n\n}", "function checkGuess(playersGuess){\n\t//If the number hasn't already been tried, check to see if it is the winning number\n if (numbersTried.indexOf(playersGuess) == -1) {\n //If it is a winning number\n if(winningNumber==playersGuess) {\n $('.feedback').text(\"You won!\");\n $('.remaining').text(\"Congratulations!\")\n playerWon();\n }\n //If it is not a winning number, add it to array of tried numbers, and increment guesses \n else {\n $('.feedback').text(lowerOrHigher(winningNumber, playersGuess));\n\n numbersTried.push(playersGuess);\n //Have not given a hint for the current step\n hintNotGiven = true;\n\n guesses--;\n\n //Message to be printed for number of guesses remaining, and also determining if the user lost\n if (guesses > 1) {\n $('.remaining').text(guesses + \" Guesses remaining! Make it count!\")\n } else if (guesses == 1) {\n $('.remaining').text(guesses + \" Guess remaining! Make it count!\")\n } else {\n $('.feedback').text(\"You lost. Play again?\");\n $('.remaining').text(\"Game Over\")\n playerLost();\n };\n };\n} \n //If the user has already guessed this number\n else {\n $('.feedback').text(\"You have already guessed this number\");\n};\n\n}", "function checkNumGuess() {\n\tif(guesses === 0) {\n\t\talert(\"Sorry, you couldn't guess the word. Game Over!\");\n\t}\n}", "function checkGuess(){\n\tif (playersGuess === winningNumber) {\n\t\tmoveSection();\n\t\tchangeAnn(\"YOU WIN!\")\n\t\tfaceDance();\n\n\t} else {\n\t\tif (arrayOfGuesses.includes(playersGuess)) {\n\t\t\t$('#announcement').fadeOut('fast');\t\n\t\t\tchangeAnn(\"You already guessed that number\");\n\t\t} else {\n\t\t\tarrayOfGuesses.push(playersGuess);\n\t\t\tif (arrayOfGuesses.length === 5){\n\t\t\t\tchangeAnn(\"Game Over!\");\n\t\t\t\t$('#tryAgain').css('background', 'red');\n\t\t\t\tconsole.log(arrayOfGuesses);\n\n\t\t\t} else {\n\t\t\t\tlowerOrHigher();\n\t\t\t\tfaceWag();\n\t\t\t}\n\t\t}\n\t}\n}", "function randomGuess(num){\n\tnotGuessed = true;\n\tvar counter = 0;\n\twhile(notGuessed){\n\t\tcounter++;\n\t\tvar rand = Math.random() * array.length;\n\t\tif(array[rand] == num){\n\t\t\tnotGuessed = false;\n\t\t}\n\t}\n\treturn counter;\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 questionSix(){\n var myNum = 7;\n var turns = 4;\n\n\n var guess = parseInt(prompt('Hi! Do you think you can guess my favorite number? You have 4 attempts'));\n do{\n if (guess > myNum){\n turns--;\n alert('Too high, try again. You have ' + turns + ' remaining');\n guess = parseInt(prompt ('What is my number?'));\n } if (guess < myNum){\n turns--;\n alert('Too low, try again. You have ' + turns + ' remaining');\n guess =parseInt(prompt ('What is my number?'));\n } if (turns < 1) {\n alert('Hey ' + name + '! I said you were out of turns!');\n } if (guess === myNum){\n alert('OMG! You are right!');\n score++;\n }\n }\n while (guess !== myNum && turns >= 1);\n\n}", "function askIfPlayerWantsToPlay() {\n if (roundCount == 10) {\n alert(\"Sorry your turns are up\");\n } else {\n let tryAgain = prompt('You can try up to 10 times. Would you like to try to guess a number. Type \"yes\" or \"no\"');\n alert(tryAgain);\n if (tryAgain == \"no\") {\n alert(\"Quitting so soon? roundCount \" + roundCount);\n return;\n } else if (tryAgain != \"yes\") {\n alert('Please enter \"yes\" or \"no\"');\n } else {\n alert(\"Good Luck!\");\n }\n roundCount = roundCount++;\n validateUserInputIsNumber();\n }\n\n}", "function fullGuessNumber(){\n var userGuessNumber =prompt('Guess a number between 1-20, you\\'ll have 4 chances with this being your first :)');\n var attemptTries;\n // using parseInt() will turn whatever into a number or using Number()\n\n\n for(attemptTries = 0;attemptTries<4;attemptTries++){\n var userGuessedThisNumber = parseInt(userGuessNumber);\n if(attemptTries===3){\n userGuessNumber = prompt('Last chance! tip: it\\'s between 9 and 12 hehe');\n userGuessedThisNumber= parseInt(userGuessNumber);\n if(userGuessedThisNumber=== 11){\n alert('Wow you guessed it! Nice job!');\n userScore++;\n break;\n }else{\n alert('You failed all guesses,it was 11. oh well');\n break;\n }\n }\n if(userGuessedThisNumber === 11){\n alert('Wow you guessed it. Nice job!');\n userScore;\n break;\n }else if(userGuessedThisNumber< 11){\n userGuessNumber= prompt('Wrong Answer! A bit low try, again! Guess a number between 1-20');\n } else if(userGuessedThisNumber> 11){\n userGuessNumber= prompt('Wrong answer! A bit high, try again.Guess a number between 1-20');\n }else{\n userGuessNumber=prompt('Hey please put a correct choice, a number between 1-20! this counts as wrong. Try again.Guess a number between 1-20');\n\n }\n\n\n }\n}", "function isMatches(window) {\n var userNumber = window.prompt(\"Please enter a number between 1 to 10\", \"1\");\n var randomNumber = Math.floor(Math.random() * 10 + 1);\n var result;\n\n userNumber = parseInt(userNumber);\n\n if (userNumber === randomNumber) {\n result = \"Good Work\";\n } else {\n result = \"Not matched\";\n }\n\n return result;\n}", "function newGame(){\n\t\tsecretNumber = Math.floor(Math.random()*100) + 1; //Gernerates #\n\t\t//console.log('secretNumber', secretNumber); shows secret number in console.\n\n\t\tcounter = 0;\n\t\tdisplay.innerHTML = counter;\n\n\t\t$('.guessBox').html(''); //resets html and results\n\n\t\tdocument.getElementById('feedback').innerHTML = \"Make Your Guess!\";\n\n\t}", "function compareAndInform() {\n var resultSection = document.querySelector('.response');\n if (inputAsNumber() > max ) {\n resultSection.innerText = `Range Exceeded! You need to guess a number between ${min} and ${max}`;\n } else if (inputAsNumber() < min) {\n resultSection.innerText = `Range Exceeded! You need to guess a number between ${min} and ${max}`;\n } else if (inputAsNumber() < randomNumber) {\n resultSection.innerText = \"That is too low\";\n } else if (inputAsNumber() > randomNumber) {\n resultSection.innerText = \"That is too high\";\n } else if (inputAsNumber() === randomNumber) {\n resultSection.innerText = \"You guessed it!\"\n increaseValueOnWin();\n console.log(randomNumber);\n } else {\n resultSection.innerText = `You need to guess a NUMBER between ${min} and ${max}`;\n }\n}", "function hint()\n{ // Begin hint\n // a) Store the input value in the following variable.\n //REMEMBER, you will need casting as input values are\n //always strings\n guess = Number(input.value);\n\n // d) Compare guess to current number\n if( guess < currentNumber)\n { // if guess is less than currentNumber\n // e) Set the message text to say '{guess} is lower\n //than the secret number.' using string interpolation (templates)\n message.textContent = `${guess} is lower than the secret number.`;\n }\n else\n { // otherwise...\n // f) Set the message text to say '{guess} is higher than the secret number.' using string interpolation (templates)\n message.textContent = `${guess} is higher than the secret number.`;\n }\n\n // TAKE IT FURTHER: Don't keep this if it doesn't work!)\n // tf a) Using the math absolute function, find the difference\n // between the guess and the current number\n diff = Math.abs(guess - currentNumber);\n\n // tf b) Create a for loop that starts at 0, checks to see if\n //it's less than 100, and increments by 10\n for(var i=0; i<100; i+=10)\n { // Begin loop\n // tf c) if the diff is less than your loop initializer\n //variable (usually it's i) AND diff is NOT less than 5\n if(diff < i && diff > 5)\n { // if diff...\n // tf d) Set message with the following test:\n // `\\nYou are within ${i} of the secret number.`\n message.textContent = `\\nYou are within ${i} of the secret number.`;\n // tf e) Exit the loop if this condition is true\n break;\n } // ...end if\n } // End loop\n\n // tf f) If diff is less than 5\n if(diff < 5)\n { // Begin if\n // g) Append to the message text:\n // `\\nYou are within 5 of the secret number.`\n message.textContent += `\\nYou are within 5 of the secret number.`;\n } // End if\n // END OF TAKE IT FURTHER\n} // End hint", "function makeGuess(num){\n let min = 1\n let max = 5\n\n return num === (Math.floor(Math.random() * (max - min + 1)) + min)\n}", "function computerguess(Answer) {\n\n if (Answer === 'C') {\n say('Your number was ' + guessedNumber + '!\\n I guessed it in ' + amoutOfGuesses + ' tries.');\n\n } else {\n\n\n if (Answer === 'H') {\n firstArg = guessedNumber + 1\n amoutOfGuesses++;\n }\n if (Answer === 'L') {\n secondArg = guessedNumber - 1\n amoutOfGuesses++;\n }\n guessedNumber = getRandom(firstArg, secondArg);\n if (firstArg > secondArg) {\n say('I think you are trying to cheat.');\n startGame()\n }\n say('Is ' + guessedNumber + ' your number?');\n }\n}", "function newgame(){\n \t\tanwser = Math.floor((Math.random() * 100) + 1);\n\t\tcount = 0;\n\t\t$('#count').text(count);\n\t\t$('#feedback').text('Make your Guess!');\n\t\tguesses = [];\n\t\t$('#guessList').children().hide();\n\t}" ]
[ "0.79177094", "0.7891137", "0.7750411", "0.7650739", "0.7627652", "0.7563111", "0.754357", "0.75278264", "0.7454332", "0.74457943", "0.7437742", "0.7436417", "0.74299675", "0.742554", "0.74173", "0.7388835", "0.738245", "0.7381374", "0.73766744", "0.7343955", "0.73307776", "0.73286986", "0.73224187", "0.7311054", "0.7291837", "0.72886086", "0.72839445", "0.72775316", "0.72700065", "0.72294277", "0.721952", "0.7214035", "0.72095317", "0.71815735", "0.7171161", "0.7167147", "0.71575004", "0.71520954", "0.7151983", "0.7112796", "0.7108996", "0.7099386", "0.70870835", "0.7073245", "0.70555186", "0.70498013", "0.7047332", "0.7041257", "0.7039411", "0.7038683", "0.7037974", "0.7037932", "0.70373553", "0.703394", "0.7023878", "0.7006472", "0.7005588", "0.7001845", "0.6997528", "0.69942355", "0.6992071", "0.699187", "0.6985437", "0.69763315", "0.6972782", "0.6972701", "0.695206", "0.6939995", "0.6925095", "0.6922947", "0.6914909", "0.6908768", "0.6906665", "0.69047225", "0.6896488", "0.68886256", "0.68869036", "0.6884871", "0.6884611", "0.6881124", "0.6879684", "0.68789464", "0.6874477", "0.68733716", "0.6868224", "0.6866971", "0.6866567", "0.68595093", "0.68377954", "0.68254346", "0.68226", "0.68202996", "0.68193674", "0.6815948", "0.68158436", "0.68157315", "0.6813363", "0.6803754", "0.679871", "0.67968786" ]
0.6890487
75
There are two things needed to place a beacon: the position and a name TO DO: name will have to be unique. At this point, if there are two entries with the same name, it will return the first it finds (a) position: currently, the position is the PLAYER'S position when player places the marker block, so use 'self.position' (b) name: enter a name in quotation marks, like "beacon1" or "pool"
function beacon(me, beaconName){ //we place a marker at the position we want: box(blocks.beacon,1,2,1); //In the next lines, we build the beacon object: var loc = me.getLocation(); //the next line appends the beacon's name to the array that contains only the tag key (the name the player gives to the beacon) beaconNameArray.push(beaconName); //the position is returned as an object which has coordinates as properties (keys). We are extracting the properties x, y and z //and puting them in an array whic we call locx. Since I want the numbers to be easy to read, and extreme precision is not //important for this plugin, I also round the numbers var locx = [Math.round(loc.getX()),Math.round(loc.getY()),Math.round(loc.getZ())]; //The beacon object is then assembled and appended to the beaconArray array var beaconObj = {tag: beaconName, position: locx}; beaconArray.push(beaconObj); //finally, we display the result to the player, showing the name of the beacon and its coordinates. //TO DO: TAB list of beacons' names echo('You are at ' + beaconName + ' at position ' + locx[0] + ", " + locx[1] + ", " + locx[2]); /* these were used to debug: echo(beaconObj.tag + beaconObj.position); echo(beaconArray.length); echo(beaconArray[0]); echo(beaconNameArray[0]); */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getNewdidFromPos(position) {\n\t//flag ( \"getNewdidFromPos():: Started! Called for position: \" + position );\n\t//a=GM_getValue(myacc())\n\tvar allVillagePos = GM_getValue(myacc() + \"_allVillagePos2\").split(\",\");\n\t//flag ( \"getNewdidFromPos: allVillagePos=\"+allVillagePos+\";\");\n\tfor (var i = 0; i < allVillagePos.length; i++) {\n\t\tvar tt = allVillagePos[i].split(\":\");\n\t\tif ( tt[1] == position) {\n\t\t\treturn tt[0];\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn null;\n}", "function findBeacons() {\n\tvar room = \"\";\n\t/*[] values;\n\tfor(var i=0;i>10;i++) {*/\n\t\tBeacon.rangeForBeacons(\"B9407F30-F5F8-466E-AFF9-25556B57FE6D\")\n\t\t.then(function(beacons_found) {\n\t\t // $(\"#beacon-list\").empty();\n\t\t var maxRSSI = 100;\n\t\t for(beaconIndex in beacons_found) {\n\t\t var beacon = beacons_found[beaconIndex]; \n\t\t /* var beaconDiv = $(\"<div />\").html(\"Major: \" + beacon.major + \n\t\t \"; Minor: \" + beacon.minor + \n\t\t \"; RSSI: \" + (beacon.rssi*-1));\n\t\t\n\t\t $(\"#beacon-list\").append(beaconDiv);*/\n\t\t if(beacon.rssi*-1 < maxRSSI) {\n\t\t \t room = getRoomName(beacon.minor);\n\t\t \t maxRSSI = beacon.rssi*-1;\n\t\t }\n\t\t }\n\t\t $(\"#myLocation\").text(/*\"Ole Johan Dahls Hus\" + */room);\n\t\t if(room == \"\") {\n\t\t\t setOffline();\n\t\t }\n\t\t newLocation(room);\n\t\t})\n\t\t.fail(function() {\n\t\t alert(\"failed serching for beacons!\");\n\t\t setOffline();\n\t\t});\n\t//}\n}", "function searchObject(type){\n\tvar target;\n console.log(\"123\");\n\tif(type==\"beacon\"){\n\t\t target=beaconMap[document.getElementById('beaconSearch').value];\n\t}else{\n\t\t target=reporterMap[document.getElementById('reporterSearch').value];\n console.log(target);\n\t}\n\t toggleBounce(target.marker);\n map.panTo(target.getPosi(),3000);\n if(map.getZoom()<17){\n\t map.setZoom(17);\n\t}\n var date = new Date(target.time*1000);\n\t\n document.getElementById(\"beaconInfo\").innerHTML=\"<h3 class='InfoTitle'>Loggy: \"+target.mac+\"</h3>\"+\"<p class='InfoBody'>Latitude: \"+target.lat+\"<br>\"+\"Longitude: \"+target.lng+\"<br>Last Update: \"+date.getFullYear()+\"-\"+(date.getMonth()+1)+\"-\"+date.getDate()+\" \"+date.getHours()+\":\"+date.getMinutes()+\":\"+date.getSeconds()+\"</p>\";\n \n}", "function locate_iBeacons() {\n kony.print(\"--Start locate_iBeacons--\");\n if (beaconManager === null) {\n kony.print(\"--creating beaconManager--\");\n beaconManager = new com.kony.BeaconManager(monitoringCallback, rangingCallback, errorCallback);\n kony.print(\"--beaconManager = new com.kony.BeaconManager(monitoringCallback, rangingCallback, errorCallback)--\");\n beaconManager.setMonitoringStartedForRegionCallback(monitoringStartedForRegionCallback);\n kony.print(\"--beaconManager.setMonitoringStartedForRegionCallback(monitoringStartedForRegionCallback);--\");\n beaconManager.setAuthorizationStatusChangedCallback(authorizationStatusChangedCallback);\n }\n if (beaconManager.authorizationStatus() != \"BeaconManagerAuthorizationStatusAuthorized\") {\n kony.print(\"Unathorized to use location services\");\n }\n if (!beaconManager.isMonitoringAvailableForBeaconRegions()) {\n kony.print(\"Monitoring not available\");\n return;\n }\n if (!beaconManager.isRangingAvailableForBeaconRegions()) {\n kony.print(\"Ranging not available\");\n return;\n }\n var proximityUUID = \"CAD6ACBA-9D1C-4772-90AA-0FEEF6868D30\";\n var identifier = \"com.kone.LatestKMSDemo\"\n var beaconRegion = new com.kony.BeaconRegion(proximityUUID, null, null, identifier);\n beaconRegion.setNotifyEntryStateOnDisplay(true);\n beaconManager.startMonitoringBeaconRegion(beaconRegion);\n}", "findFriendIdByName( nameToSearch ) {\n let friendId = this.ItemNotFound;\n let list = this.state[this.townName];\n \n for( let indx=0; indx<list.length; ++indx ) {\n if( list[indx].name === nameToSearch ) {\n friendId = list[indx].id;\n break;\n }\n }\n return friendId;\n }", "function bringPlayer(playerName,playerLocation) {\n\tvar playersIndex = players.indexOf(playerName);\t\n\t//first check to see if playerName exists\n\tif(playersIndex!==-1) {\n\n\t\t//need to update the playersLocations to bring the player from other location to playerLocation\n\t\tif(isMoveAllowed(playerLocation)) {\n\t\t\tplayersLocations[playersIndex]=playerLocation;\n\t\t} else {\n\t\t\tconsole.log(playerName+\" cannot be placed there.\");\n\t\t}\n\t} else {\n\t\tconsole.log(playerName+\" does not exist!\");\n\t}\n}", "function assignName() {\n var locationNameHolder = scope.querySelectorAll(\"[data-vf-js-location-nearest-name]\");\n if (!locationNameHolder) {\n // exit: container not found\n return;\n }\n if (locationNameHolder.length == 0) {\n // exit: content not found\n return;\n }\n // console.log('assignName','pushing the active location to the dom')\n locationNameHolder[0].innerHTML = locationName;\n }", "function getLocCode() {\r\n\tplayerLocCode = playerDetails.locCode;\r\n}", "function FindSpawn(index){\n\tif(!index.search){\n\t\tlet a=Math.floor(Math.random()*sX);\n\t\tlet b=Math.floor(Math.random()*sY);\n\t\tif(grid[a][b]==0){\n\t\t\tindex.x=a;\n\t\t\tindex.y=b;\n\t\t\tindex.search=true;\n\t\t}\n\t}\n}", "function examine(word) {\n let lookAt = itemLookUp[word]\n if (player.location.inv.includes(word)) {\n console.log(lookAt.desc)\n }\n}", "async function getPlayerbasicDetailsByPosition(player_name, position_name){\n const all_player_with_same_name = await axios.get(`${api_domain}/players/search/${player_name}`, {\n params: {\n api_token: process.env.api_token,\n include: \"team.league, position\", \n },\n })\n return all_player_with_same_name.data.data.map((player_info) => {\n if(player_info != undefined && player_info.team != undefined && player_info.position != undefined)\n {\n const { player_id, fullname, image_path, position_id } = player_info;\n if(fullname.includes(player_name))\n {\n if( player_info.position.data.name == position_name)\n {\n const { name } = player_info.team.data;\n if(player_info.team.data.league != undefined)\n {\n const {id} = player_info.team.data.league.data;\n if(id == 271) \n {\n return {\n id: player_id,\n name: fullname,\n image: image_path,\n position: position_id,\n position_name: player_info.position.data.name,\n team_name: name, \n };\n }\n }\n }\n } \n }\n }); \n }", "searchByName( nameToSearch ) {\n let itemId = this.ItemNotFound;\n let list = this.state[this.townName];\n let nameToSearchLowerCase = nameToSearch.toLocaleLowerCase();\n let nameToSearchSplit = nameToSearchLowerCase.split(' ');\n let name0ToSearch = nameToSearchSplit[0];\n let name1ToSearch = nameToSearchSplit[1];\n \n \n for( let indx=0; indx<list.length; ++indx ) {\n let name = list[indx].name.toString().toLocaleLowerCase();\n let nameSplit= name.split(' ');\n let name0 = nameSplit[0];\n let name1 = nameSplit[1];\n \n if( name0ToSearch && name1ToSearch && nameToSearchLowerCase === name ) {\n itemId = list[indx].id;\n break;\n } else\n if( !name1ToSearch && name0ToSearch && (name0 === name0ToSearch || name1 === name0ToSearch) ) {\n itemId = list[indx].id;\n break;\n }\n }\n console.log('searchByName :',itemId);\n \n return itemId;\n }", "function Player(name, marker) {\n this.name = name\n this.marker = marker\n}", "function spanNewPlayer(name : String, info : NetworkMessageInfo){\n\tvar lastPlayer = false;\n\t//Remove items from spawn array\n\tplayerArray.Remove(info);\n\tplayerNameArray.Remove(name);\n\t\n\tif (playerArray.Count == 0){\n\t\tlastPlayer = true;\n\t}\n\t\n\tvar player = info.sender;\n\n\tDebug.Log(\"SPAWNING the player, since I am the server\");\n\tvar playerIsMole : boolean = false;\n\t\n\tfor (molePos in MolePosition){\n\t\tif (playerList.length+1 == molePos){\n\t\t\tplayerIsMole = true;\n\t\t}\n\t} \n\n\tnetworkView.RPC(\"initPlayer\", player, player);\n\tnetworkView.RPC(\"spawnPlayer\", RPCMode.All, player, playerIsMole, name, lastPlayer);\n}", "function get_npc(name) {\r\n\tvar npc = parent.G.maps[character.map].npcs.filter(npc => npc.id == name);\r\n\r\n\tif (npc.length > 0) {\r\n\t\treturn npc[0];\r\n\t}\r\n\r\n\treturn null;\r\n}", "function searchByName(name) {\n var testName = name.toLowerCase();\n if (testName===\"bar\"||\"bars\"||\"restaurant\"||\"restaurants\"||\"food\"||\"beer\") {\n var request = {\n location: pos,\n radius: '500',\n type: ['bar', 'restaurant']\n };\n service = new google.maps.places.PlacesService(map);\n service.nearbySearch(request, callback);\n } else {\n var request = {\n query: name,\n fields: ['photos', 'formatted_address', 'name', 'rating', 'opening_hours', 'geometry'],\n locationBias: {radius: 50, center: pos}\n };\n service = new google.maps.places.PlacesService(map);\n service.findPlaceFromQuery(request, callback);\n };\n}", "function get_npc(name) {\n var npc = parent.G.maps[character.map].npcs.filter(npc => npc.id == name);\n\n if (npc.length > 0) {\n return npc[0];\n }\n\n return null;\n}", "function find_closest_asset_address(player_enter_x, player_enter_z) {\n var closest_distance = 9999999;\n\n var closet_coor = null;\n\n // for each coordinate our coordinate map\n for (var i = 0; i < coordinate_map.length; i++) {\n var coor = coordinate_map[i]\n\n // determine the distance from that coordinate to the player enter position\n var distance = find_distance(player_enter_x, player_enter_z, coor.x, coor.z)\n\n // if this coordinate is closer set it as our closest\n if (distance < closest_distance) {\n closest_distance = distance\n closet_coor = coor;\n }\n }\n\n // return the address of the closest coordinate\n if (closet_coor != null) {\n return closet_coor.address\n } else {\n return \"\";\n }\n}", "function getBpFromName(name) {\n\tconsole.log(storyCardFaceUp);\n\tconsole.log(storyCardFaceUp.foe);\n\tconsole.log(name);\n\tfor (var i = 0; i < cardTypeList.length; i++) {\n\t\t// console.log(cardTypeList[i]);\n\t\t// console.log(name);\n\t\tif (cardTypeList[i].name === name)\n\t\t\tif (cardTypeList[i].hasOwnProperty('bp')) {\n\t\t\t if(storyCardFaceUp.foe === name) return cardTypeList[i].bonusbp;\n\t\t\t return cardTypeList[i].bp;\n\t\t\t}\n\t}\n\treturn \"card not found\";\n}", "function rangingCallback(beaconRegion, beacons) {\n kony.print(\"Beacons found for BeaconRegion: \", kony.type(beaconRegion), \" \", beaconRegion, \" Beacons: \", beacons);\n var beaconLabel = \"No beacons\";\n var proximityLabel = \"...\";\n if (beacons.length > 0) {\n beacon = beacons[0];\n proximityUUIDString = beacon.getProximityUUIDString();\n major = beacon.getMajor();\n minor = beacon.getMinor();\n beaconLabel = beacon.getProximityUUIDString() + \" \" + beacon.getMajor() + \" \" + beacon.getMinor();\n proximityLabel = beacon.getProximity();\n }\n if ((prevProximityUUIDString != proximityUUIDString) && (ksid != null)) {\n beaconUpdate();\n }\n}", "function getPlayerData(list, playerName) {\n for (let p = 0; p < list.length; p++) {\n const player = list[p];\n if (player.name === playerName) {\n return player;\n }\n }\n // console.log(\"Unable to find player \", playerName, \"in list:\\n\", list);\n}", "function getPlayerData(list, playerName) {\n for (let p = 0; p < list.length; p++) {\n const player = list[p];\n if (player.name === playerName) {\n return player;\n }\n }\n console.log(\"Unable to find player \", playerName, \"in list:\\n\", list);\n}", "addMarker(level, openings, itemObj, startPosX = -1, startPosY = -1) {\n let startPos = startPosX + startPosY;\n if (startPos >= 0 && openings.indexOf(startPos) === -1 && startPos < this.maze.length) {\n level[startPos] = itemObj;\n }\n else {\n let randomCell = Math.floor(Math.random() * openings.length);\n let addMarkerPosn = openings.splice(randomCell, 1)[0];\n level[addMarkerPosn] = itemObj;\n }\n }", "function updateMap(time){\n // console.log(\"----------------------------\");\n if(showBeacon){\n var position1 = JSON.parse(httpGet(beaconPosiSource)); //two dimensional JSON array\n // console.log(\"----------------------------\");\n var position = new ibeaconBeanGroup(position1).getAllBestLocations();\n\n // console.log(position1);\n \n // console.log(position);\n\n\t\tfor(var i=0;i<position.length;i++){\n\t\t\tif(typeof(beaconMap[position[i].mac])=='undefined'){\n\t\t\t\tbeaconMap[position[i].mac] = new beaconMarker(position[i]);\n\t\t\t\tbeaconMap[position[i].mac].setColor(colorBar[i%7]);\n console.log(\"beaconMap[position[i].mac])=='undefined'\");\n\t\t\t}else{\n\n\t\t\t\tif(!beaconMap[position[i].mac].equal(position[i])){\n\t\t\t\t\tbeaconMap[position[i].mac].setPosi(position[i]);\n console.log(position[i]);\n\t\t\t\t\tbeaconMap[position[i].mac].time=parseInt(position[i].time);\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n \n \n }\n window.setTimeout(\"updateMap(\"+time+\")\",time);\n}", "getEmptySpawn() {\n for (let mySpawnName in this.spawnNames) {\n let mySpawn = Game.spawns[this.spawnNames[mySpawnName]];\n if (mySpawn && mySpawn.energy < mySpawn.energyCapacity) {\n return mySpawn;\n }\n } \n return null;\n }", "map_attribute_name_to_buffer_name( name ) \n { \n return { object_space_pos: \"positions\" }[ name ]; // Use a simple lookup table.\n }", "function showMarker(name,address){\n var l = self.restaurantList().length;\n for(var i=0;i<l;i++){\n var rName = self.restaurantList()[i].restaurant.name;\n var position = self.restaurantList()[i].marker.marker.position;\n var rAddress = self.restaurantList()[i].restaurant.address;\n if(name === rName && address === rAddress){\n map.panTo(position);\n map.setZoom(15);\n populateInfoWindow(self.restaurantList()[i].marker.marker,\n largeInfowindow,\n self.restaurantList()[i].marker.content);\n self.restaurantList()[i].marker.marker.setAnimation(\n google.maps.Animation.BOUNCE);\n\n break;\n }\n }\n }", "function Awake (){\n\t//get the parent of the markers\n\tGlobe = transform.parent;\n\t//Just setting the name again, to make sure.\n\tboardObject = \"CountryBoard\";\n\t//When start, look for the plane\n\tBoard = GameObject.Find(boardObject);\n}", "function updateCoordinates(name) {\n name.position.y = floor(random(10, (width) / 10)) * 10;\n name.position.x = floor(random(10, (height) / 10)) * 10;\n }", "function insertRecordOfWhoWasSeen(){\n var data = {};\n data['name'] = $('#insertName').val();\n data['posX'] = clickedPositionX;\n data['posY'] = clickedPositionY;\n \n $.get('../insert',data);\n \n $('#insertModal').modal('hide');\n drawCircleOnMap(clickedPositionX, clickedPositionY, data['name'][0], 30, '#b8dbd3', 3500);\n }", "function Nearby(a,b,dist){\n var firebaseRef = __WEBPACK_IMPORTED_MODULE_0_firebase__[\"database\"]().ref(\"locations\");\n var markers = [];\n var geoFire = new __WEBPACK_IMPORTED_MODULE_1_geofire__(firebaseRef);\n var geoQuery = geoFire.query({\n center: [a,b],\n radius: dist\n });\n geoQuery.on(\"key_entered\", function(key, location, distance) {\n//console.log(key + \" entered query at \" + location + \" (\" + distance + \" km from center)\");\n var pos = {lat: location[0],lng:location[1]};\n var hash = getHash(location[0],location[1]);\n markers.push({position:pos,info:returnInfo(hash)});\n //markers.push(location.concat(getHash(location[0],location[1])));\n });\n\n return markers;\n}", "lookAround(currentPlayer, request, channel){\n let item = this.utils.resolveNamable(request, currentPlayer.inventory.items)\n //If there's an item\n if(item){\n channel.send(item.description).catch(err => {console.error(err);})\n }else{\n let position = this.maps[currentPlayer.position]\n if(position){\n let availableInteractions =''\n if(position.interactions){\n availableInteractions = this.utils.generateInteractionsListString(position.interactions.filter(interaction => {\n return !currentPlayer.interactionsDone.includes(interaction.name.name)\n }))\n }\n let itemList =''\n if(this.maps[currentPlayer.position].userItems.length > 0){\n itemList = 'Other items on the ground:\\n'\n this.maps[currentPlayer.position].userItems.forEach(currentItem => {\n itemList+=`${currentItem.name.name}\\n`\n })\n }\n let nearbyPlayers = this.utils.generateWhoString(this.who(currentPlayer, channel))\n channel.send(position.description+'\\n'+availableInteractions+'\\n'+nearbyPlayers+'\\n'+itemList).catch(err => {console.error(err);})\n }else{\n console.error('Current position '+currentPlayer.position);\n console.error(this.maps);\n }\n\n }\n //TODO: Add descriptions for the things that need a pass and the pass is owned by the player\n }", "map_attribute_name_to_buffer_name( name ) \n { \n return { object_space_pos: \"positions\" }[ name ]; // Use a simple lookup table.\n }", "function addSingleMaker(){\n\tmarker = new google.maps.Marker({\n\t\tposition:{\n\t\t\tlat: -41.295005,\n\t\t\tlng: 174.78362\n\t\t},\n\t\tmap: map,\n\t\tanimation: google.maps.Animation.DROP,\n\t\ticon: \"img/person.png\",\n\t\ttitle : \"Yoobee School of Design\",\n\t\tdescription: \"Description for Yoobee School of Design\"\n\t})\n}", "getPlayerByName(playerName) {\n return this.players.find((value) => {\n return (value._player.name === playerName);\n });\n }", "function getloc()\n{\n\n\tvar latlng = new google.maps.LatLng(shuttle.position.latitude, shuttle.position.longitude);\n geocoder.geocode({ latLng: latlng }, function(results, status){\n\t\tfor(ac in results[0].address_components)\n\t\t{\n\t\t\t//console.log(results[0].address_components[ac].types);\n\t\t\tif(results[0].address_components[ac].types == \"route\")\n\t\t\t{\n\t\t\t\t$(\"#currentstreet\").html(\"Street name: \" + results[0].address_components[ac].long_name);\n\t\t\t}\n\t\t}\n });\n\n\n}", "get(name){\n let gameId = this.list.findIndex(i => i.getName() === name.toLowerCase());\n return this.list[gameId];\n }", "function addMarker(map,info_friend,info_bulle){\n var marker = new google.maps.Marker({\n position: new google.maps.LatLng(info_friend.lat, info_friend.lng),\n label: \"\" + info_friend.name,\n map: map,\n title : \"Location of \" + info_friend.name\n });\n\n marker.addListener('click', function() {\n info_bulle.open(map, marker);\n });\n return marker;\n}", "function getInfo (name) {\n\tconsole.log(name);\n\tconst playerId = name.accountId;\n\tconsole.log(`Account ID: ${playerId}`);\n\tconst playerName = name.name;\n\tconsole.log(`Player name: ${playerName}`);\n\tconst summonerLevel = name.summonerLevel;\n\tconsole.log(`Player Level: ${summonerLevel}`);\n\tconst profileIcon = name.profileIconId;\n\tconsole.log(`Icon number: ${profileIcon}`);\n\trenderName(playerName, summonerLevel, profileIcon);\n\t$('.matches').html(`<h2>${playerName}'s last 3 matches`);\n\tgetRecentMatches(playerId, getMatchList);\n}", "function positionOf(symb, someBoard, player) {\n\n\t//print_board(someBoard);\n\n\tvar tempSq = {};\n\n\tfor ( var a = 0; a <= 11; a++) {\n\t\tfor (var b = 0; b <= 11; b++) {\n\n\t\t\tif (someBoard[a][b].symbol.includes(symb) && player === someBoard[a][b].player){\n\n\t\t\t\ttempSq.row = a;\n\t\t\t\ttempSq.col = b;\n\t\t\t\treturn tempSq;\n\t\t\t}\n\t\t}\n\t}\n\n}", "function findMarkerIndex(name) {\n //name 'SFO - San Fr...'\n return markers.findIndex(function (m) {\n return m.title === name;\n });\n}", "createPlayer() {\n let startWithBob = true;\n this.map.findObject('Player', (obj) => {\n if (obj.type === 'StartPosition') {\n if (obj.properties && obj.properties.hasOwnProperty('Start')) startWithBob = false;\n if (obj.name === 'Bob') {\n this.bob = new Bob(this, obj.x, obj.y);\n this.bob.depth = 100;\n this.game.Bob = this.bob;\n }\n if (obj.name === 'Flit') {\n this.flit = new Flit(this, obj.x, obj.y);\n this.flit.depth = 100;\n this.game.Flit = this.flit;\n }\n }\n });\n\n this.ActivePlayer = startWithBob ? this.game.Bob : this.game.Flit;\n this.cameras.main.startFollow(this.ActivePlayer);\n }", "getNewPosition() {\r\n this.newPosition = this.positionRandom();\r\n // Cree une fonction qui test avec marge les nouvelle position des bombs\r\n // Transformer et juste tester si une element avec une position similaire est deja sur la map \r\n return this.newPosition;\r\n }", "function prepEventMarker(){\n\tvar eventDetails = getEventData();\n\tvar location = eventDetails[0];\n\tvar title = eventDetails[1];\n\n\t//We need to be careful with the location. When we store it, the location name usually comes before the address\n\t//ie Vancouver Pizza: 225 Main St.\n\tvar locationSplit = location.split(':'); //This assumes a colon isn't used in an address (which I belive is safe to assume)\n\tif(locationSplit.length>1){ //The name was in there\n\t\tlocation = locationSplit[1]; //Set the location to just the address\n\t}\n\n\tconsole.log('Initing with: Title: ' + title + \" Loc: \" + location);\n\tinitEventData(title, location);\n}", "function winnerName() {\n if(winnerAddress === myAddress) {\n return \"Me\";\n }\n if(winnerAddress === oppAddress) {\n return \"Opponent\";\n }\n }", "function place(name, address, road){\n this.name = name;\n this.address = address;\n this.road = road;\n console.log(`${this.name} ${this.address} ${this.road}`);\n if (this.name == 'ctg'){\n this.name = 'Chittagong';\n }\n console.log(`${this.name} ${this.address} ${this.road}`);\n}", "function reportPosition() {\n var p = distanceWidget.get('position'),\n d = distanceWidget.get('distance'),\n name = $('input[name=name]');\n \n socket.send(JSON.stringify({\n 'action': 'update position',\n 'lat': p.lat(), \n 'lng': p.lng(), \n 'distance': d, \n 'name': name.val() \n }));\n}", "function mainMarker(x,y,name,i) {\n \n \n var marker = new google.maps.Marker({\n position: {lat: x, lng: y},\n map: map,\n label:(++i).toString(), \n \n title: name\n });\n markerArray.push(marker);\n }", "function playerBattedInMatchAtPos(playerId, matchNo, battingPos)\n{\n if (playerId == -1)\n return true;\n\n if (MATCHES_ARRAY[matchNo]['batsmanIDarray'][battingPos - 1] == playerId)\n return true;\n else\n return false;\n}", "function emitBeaconUpdate(id) {\n var ship = ships.shipGet(id)\n var out = {};\n\n out[id] = ship.spawnPoint;\n\n io.sockets.emit('shipbeaconstat', out);\n}", "function addSugar(name, x, y) {\n\tlocs.push([x, y]);\n\tnames.push(name);\n}", "function getSpawnPosition(source) {\n var positions = getSamplePositions(source.room, source.pos, 5),\n closest;\n positions = _.filter(positions, (position) => (Game.map.getTerrainAt(position) == 'plain'));\n closest = source.pos.findClosestByPath(positions);\n return closest;\n}", "function createBeacon() {\n\n // throws an error if the parameters are not valid\n var beaconRegion = new cordova.plugins.locationManager.BeaconRegion(identifier, uuid, major, minor);\n\n return beaconRegion; \n}", "function searchGameRoom(gamerooms,name){\n\tfor (var i = 0 ; i < gamerooms.length ; i++ ){\n\t\tif(gamerooms[i].name === name){\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}", "function findPlate(plate_name) {\n for(i = 0; i < ordered_plates.length; i++) {\n if (ordered_plates[i].name.localeCompare(plate_name) == 0) {\n return ordered_plates[i];\n }\n }\n }", "@wire(getRecord, { recordId: '$recordId', fields })\n loadBear({ error, data}){\n if(error){\n //Handle error\n } else if (data){\n //Get bear Data\n this.name = data.fields.Name.value;\n const Latitude = data.fields.Location__Latitude__s.value;\n const Longitude = data.fields.Location__Longitude__s.value;\n //Transformar bear data en map markers\n this.mapMarkers = [{\n location: {Latitude, Longitude},\n title: this.name,\n description: 'Coords: ' + {Latitude} + ', ' + {Longitude}\n }];\n }\n }", "function getSummonerName(){\n\n}", "findClosest(mapItem) {\n let closestNames = [];\n\n this.state.mapTextItems.forEach(mapTextItem => {\n if (mapItem.regionId === mapTextItem.regionId) {\n let xdif = Math.abs(mapItem.x - mapTextItem.x);\n let ydif = Math.abs(mapItem.y - mapTextItem.y);\n let distance = Math.sqrt(Math.pow(xdif, 2) + Math.pow(ydif, 2));\n closestNames.push({ text: mapTextItem.text, distance: distance });\n }\n });\n\n closestNames.sort(this.compare);\n return closestNames[0].text;\n }", "if(snakes[1].loc.dist(food.loc) === 0){\n food.pickLoc();\n snakes[1].addSegment();\n\n}", "function findVertex(name) {\n\t\tvar objects = alasql.databases[alasql.useid].objects;\n\t\tfor(var k in objects) {\n\t\t\tif(objects[k].name === name) {\n\t\t\t\treturn objects[k];\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}", "map_attribute_name_to_buffer_name( name ) // The shader will pull single entries out of the vertex arrays, by their data fields'\n { \n return { object_space_pos: \"positions\" }[ name ]; // Use a simple lookup table.\n }", "function animatePoint(name) {\n for (let item in points){\n if (points[item].title == name) {\n points[item].setAnimation(google.maps.Animation.BOUNCE);\n showForsquareInfo(\n points[item].getPosition().lat(),\n points[item].getPosition().lng(),\n points[item].getTitle()\n );\n //Makes the marker bounce only once\n setTimeout(function(){ points[item].setAnimation(null); }, 700);\n }\n }\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 itemByName (name) {\n return bot.inventory.items().filter(item => item.name === name)[0]\n}", "function findMarker(buffer, position) {\n var index;\n for (index = position; index < buffer.length; index++) {\n if ((buffer[index] == marker1) && (buffer[index + 1] == marker2))\n return index;\n }\n return -1;\n}", "who(currentPlayer, channel){\n let map = this.maps[currentPlayer.position]\n let nearbyPlayers = new Array()\n this.players.forEach(player => {\n if(player !== currentPlayer && player.position === currentPlayer.position){\n nearbyPlayers.push(player)\n }\n })\n return nearbyPlayers\n }", "function addmarkerforpeaks() {\n for (var i = 0; i < snowCaps.peaks.length; i++) {\n // Get the position from the location array.\n var position = snowCaps.peaks[i].position;\n var title = snowCaps.peaks[i].name;\n //console.log(title,position);\n // Create a marker per location, and put into markers array.\n var marker = new google.maps.Marker({\n position: position,\n title: title,\n map: map,\n icon: 'https://www.distancebetween.us/assets/img/apple-icon-60x60.png',\n animation: google.maps.Animation.DROP,\n });\n // Push the marker to our array of markers.\n markers.push(marker);\n }\n}", "function getPosFinder(pos){\n var posFinder = balloonpositionsarray[0].find(function(element) {\n return element == pos;\n });\n\n return posFinder;\n }", "function locationName () {\n place.className = 'current-location';\n document.getElementsByTagName('body')[0].appendChild(place);\n // place.innerHTML = loc.address_components[1].long_name + ', ' + loc.address_components[2].long_name;\n // check for errors and using previous manual location\n if (usingPrevious) {\n changeLink.innerText = 'change';\n changeLink.href = '#';\n changeLink.className = 'last-known';\n changeLink.addEventListener('click', function (e) {\n e.preventDefault();\n Tab.changeLocation();\n });\n place.innerHTML = loc.formatted_address +\n '<span class=\"last-known\">Using last known location</span> ';\n place.appendChild(changeLink);\n // console.log(changeLink)\n // TODO: add change location here\n } else {\n place.innerHTML = loc.formatted_address;\n }\n }", "function collectPlayer(name) {\n if (name === game.players[game.turn].name) {\n setDrawer(game);\n } \n else {\n setGuesser(name);\n }\n \n }", "born(x, y) {\n let l = createVector(x, y);\n let dna = new DNA();\n let name = this.makeid(8);\n console.log(name);\n this.creatures.push(new Creature(l, dna, name));\n }", "try_to_match_local(data_received){\n\t\tlet data = {'type':'try_to_match', 'id': this.guid, 'latitude': this.latitude, 'longitude': this.longitude}\n\t\tsend_msg(data)\n\t}", "function CurrentLocation() {\n Marker1=new google.maps.LatLng(clat, clng); addMarker(Marker1, \"Current Location\");\n }", "function getKey_(position) \n{\n return \"key-\"+ OsmMaps.position.coords.latitude.toFixed(4) + \"-\" + OsmMaps.position.coords.longitude.toFixed(4);\n}", "function markerPosition(position)\n{\n\tvar id = $('#'+position);\n\tif(turno)\n\t{\n\t\tif(isFull(position))\n\t\t{\n\t\t\tboard[position]=llenoA;\n\t\t\tnumJugadas1++;\n\t\t\tid.find('i').remove();\n\t\t\tid.append('<i class=\"fa fa-circle animated rubberBand \" aria-hidden=\"true\" style=\"color:#BC2A59;\"></i>');\n\t\t\t$('#mov1').text(numJugadas1);\n\t\t\tturno=false;\n\t\t\tif(isChampion(llenoA))\n\t\t\t{\n\t\t\t\tlocalStorage.setItem('ganador',$(\"#jugador1\").val());\n\t\t\t\tlocalStorage.setItem('perdedor',$(\"#jugador2\").val());\n\t\t\t\tlocalStorage.setItem('numJugadas', numJugadas1);\n\n\t \t\t\tswal({\n \t\t\t\ttitle: \"¡Felicidades \"+$(\"#jugador1\").val()+\" Ganaste!\",\n \t\t\t\timageUrl: \"img/goods.png\"\n \t\t\t});\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\talert(\"Esta posicion ya esta llena\");\n\t\t}\n\t}\n\telse\n\t{\n\t\tif(isFull(position))\n\t\t{\n\t\t\tboard[position]=llenoB;\n\t\t\tnumJugadas2++;\n\t\t\tid.find('i').remove();\n\t\t\tid.append('<i class=\"fa fa-heart animated rubberBand \" aria-hidden=\"true\" style=\"color:#2ABCA4;\"></i>');\n\t\t\t$('#mov2').text(numJugadas2);\n\t\t\tturno=true;\n\t\t\tif(isChampion(llenoB))\n\t\t\t{\n\t\t\t\tlocalStorage.setItem('ganador',$(\"#jugador2\").val());\n\t\t\t\tlocalStorage.setItem('perdedor',$(\"#jugador1\").val());\n\n\t\t\t\tlocalStorage.setItem('numJugadas',numJugadas2);\n\t\t\t\tswal({\n \t\t\t\ttitle: \"¡Felicidades \"+$(\"#jugador2\").val()+\" Ganaste!\",\n \t\t\t\timageUrl: \"img/goods.png\"\n \t\t\t});\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\talert(\"Esta posicion ya esta llena\");\n\t\t}\n\n\t}\n}", "function insertName1(){\n let playerSpan1 = $(`.Player1`)\n let playerInput1 = $(`input.button1`)\n \n playerInput1.on(`input`,function(){\n gameState.playerNames[0] = ($(this).val())\n playerSpan1.text(gameState.playerNames[0])\n return playerSpan1\n })\n}", "function Start () {\n\tUpperLaser = GameObject.Find(\"MapScript\");\n\t//LowerLaser = GameObject.Find(\"MapScript02\");\n\tFlameThrower = GameObject.Find(\"FlameThrower\");\n\tBeam = GameObject.Find(\"MapScriptB\");\n\tTrapSpawn = GameObject.Find(\"TrapSpawn\");\n\t//Saw = GameObject.Find(\"ChainSaw\");\n}", "openInfoWindow(marker, longName) {\n this.closeInfoWindow();\n this.state.infowindow.open(this.state.map, marker);\n marker.setAnimation(window.google.maps.Animation.BOUNCE);\n this.setState({\n 'prevmarker': marker\n });\n this.state.infowindow.setContent('Loading Data...');\n this.state.map.setCenter(marker.getPosition());\n this.state.map.panBy(0, -150);\n if(longName.includes(\"Eric\"))\n {\n this.getOurBF4MarkerInfo(marker, longName, 'Diabeeeeeeeeetus');\n }\n if (longName.includes(\"Violet\"))\n {\n this.getOurBF4MarkerInfo(marker, longName, 'djbobbysocks');\n }\n else{\n this.getMarkerInfo(marker, longName);\n }\n }", "function dropMarker(a, b, courtname){\n\tvar lat = a;\n\tvar lon = b;\n\tmyLatlng = new google.maps.LatLng(lat, lon);\n\tvar marker = new google.maps.Marker({\n\t\tposition: myLatlng,\n\t\tmap: map,\n\t\ttitle: courtname\n\t});\n\tmarker.setMap(map);\n}", "function geocodeCords(positionObject) {\n var geocoder = new google.maps.Geocoder;\n posLat = positionObject.lat;\n posLng = positionObject.lng;\n cordsPos = posLat + \", \" + posLng;\n // cordsPos = positionObject;\n geocoder.geocode({'location': positionObject}, function (results, status) {\n if (status === 'OK') {\n if (results[1]) {\n namePos = (results[1].formatted_address);\n locationInput.value = namePos;\n addMarker(positionObject);\n } else {\n window.alert('No results found');\n }\n } else {\n window.alert('Geocoder failed due to: ' + status);\n }\n });\n }", "function zControlBattleMapFollowGamer(position)\n{\n zObjectBattleMapLatLng[\"gamrLat\"] = position.coords.latitude;\n zObjectBattleMapLatLng[\"gamrLng\"] = position.coords.longitude;\n \n document.getElementById(\"map-info-crnt\").innerHTML = \"CRNT_LAT :{\" + zObjectBattleMapLatLng[\"crntLat\"] + \"}:CRNT_LNG :{\" + zObjectBattleMapLatLng[\"crntLng\"] + \"}:\";\n document.getElementById(\"map-info-gamr\").innerHTML = \"GAMR_LAT:{\" + zObjectBattleMapLatLng[\"gamrLat\"] + \"}:GAMR_LNG:{\" + zObjectBattleMapLatLng[\"gamrLng\"] + \"}:\";\n var date = new Date();\n document.getElementById(\"map-info-date\").innerHTML = \"DATE_TIME:{\" + date.getTime() + \"}:\";\n \n if(zObjectBattleMapLatLng[\"crntLat\"] != zObjectBattleMapLatLng[\"gamrLat\"]\n || zObjectBattleMapLatLng[\"crntLng\"] != zObjectBattleMapLatLng[\"gamrLng\"])\n {\n zObjectBattleMapGamer.setMap(null);\n \n var zObjectBattleMapCenterLatLng = new google.maps.LatLng(zObjectBattleMapLatLng[\"gamrLat\"], zObjectBattleMapLatLng[\"gamrLng\"]);\n zObjectBattleMap.setCenter(zObjectBattleMapCenterLatLng);\n \n zObjectBattleMapGamer = new google.maps.Marker(\n {\n position: zObjectBattleMapCenterLatLng,\n map: zObjectBattleMap,\n title: 'Hello World!'\n });\n \n zObjectBattleMapLatLng[\"crntLat\"] = zObjectBattleMapLatLng[\"gamrLat\"];\n zObjectBattleMapLatLng[\"crntLng\"] = zObjectBattleMapLatLng[\"gamrLng\"];\n }\n \n zControlHazardDistancetoGamer();\n \n zControlGamerMapStatus({\n\t code: 0, \n\t message: \"Good Map Status\",\n \ttimeofcoords: position.timestamp,\n \tmethod: \"zControlBattleMapFollowGamer\"\n\t});\n}", "function updateName1OnDOM() {\n db.ref('Names/player1').once('value', function (snapshot) {\n name = snapshot.val();\n if (name !== null) {\n var a = $('<h3>').html(name).addClass('center-block');\n $('.player1-name').empty().append(a);\n }\n });\n }", "function quickBooking(){\n var closest_restaurant;\n\n // Try HTML5 geolocation.\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition(function(position) {\n user_position = {\n lat: position.coords.latitude,\n lng: position.coords.longitude\n };\n }, \n function() {\n handleLocationError(true, infoWindow, map.getCenter());\n });\n } else {\n\n // Browser doesn't support Geolocation\n handleLocationError(false, infoWindow, map.getCenter());\n }\n\n // looks up restaurant coordinates in database and puts them in coordinateLookups callback variable.\n coordinateLookup(function(coordinateLookups){\n\n // create object containing users coords for comparison\n var origin = new google.maps.LatLng(user_position.lat,user_position.lng);\n\n // creates marker for each address in list of restaurant coordinates(coordinateLookups)\n // coordinateLookups also contains restaurant name\n coordinateLookups.forEach(function(lookup,element){\n\n // create object containing restaurantscoordinates for comparison\n var restaurant_location = new google.maps.LatLng(lookup.Longitude, lookup.Latitude);\n\n // if closest rstaurant to unser update closestRestaurant\n if (closestRestaurant(restaurant_location, origin)) {\n\n // updates the vueInstance variable of closestRestaurant\n vueInstance.closestRestaurant = lookup.Name;\n }\n }); \n\t\t \n\t // add booking to database (fuct. from entiresite.js)\n\t makeBooking('Quick');\n });\n }", "spawnPlayer() {\n return this._getLocationInArea('player_spawn')\n }", "function bmap(name,latt,long){\r\n if ((typeof latt==='undefined') || (typeof long==='undefined')) {return name;}\r\n return my_href(\"http://api.map.baidu.com/marker?location=\"+latt.toString()+\"%2C\"+long.toString()+\"&output=html&coord_type=gcj02&title=\"+name,name,\"bmap\");\r\n }", "function placeBid(string name, uint bid) payable {\n\n if (now-createdAt < duration){\n\n if (bid => highBidder){ // Consider the case when there is no bid ???\n highBidder = msg.sender; // ??\n // push bidder where bidder[i].bidder (address)\n bidders.push(msg.sender);\n HighBidChanged(msg.sender, name, bid);\n // biddersMapping[msg.sender].name = name;\n // biddersMapping[msg.sender].bidder = msg.sender; // address\n // biddersMapping[msg.sender].bid = bid;\n // biddersMapping[msg.sender].claimedEthers = false; // at the end of the bidding\n }\n } else {\n BidFailed (msg.value, name, bid )\n throw;\n }\n\n }", "function getAsteroidTarget(spawnLocation) {\n var closest = [0,0,0];\n var dist = 100;\n var temp = 0;\n for (t in station_centers) {\n temp = vec3.length(vec3.subtract(vec3.create(), vec3.fromValues(station_centers[t][0], station_centers[t][1],\n station_centers[t][2]), vec3.fromValues(spawnLocation[0], spawnLocation[1], spawnLocation[2])));\n if (temp < dist) {\n dist = temp;\n closest = station_centers[t];\n }\n }\n return closest;\n}", "get boatName() { \n return getFieldValue(this.wiredRecord.data, BOAT_NAME_FIELD);\n }", "function makeMarker(position, icon, name) {\n new google.maps.Marker({\n position: position,\n map: gmap,\n icon: icon,\n title: name\n });\n}", "function findOrigin(element) {\n if (element === startStation){\n return element\n }\n}", "getAddressField(telegram) {\n let values = telegram.getValues();\n\n return values.has('BLOCK1_A') ?\n values.get('BLOCK1_A') : null;\n }", "function getPosition(letra){\n let position = abd.indexOf(letra);\n return position;\n}", "function findForChar(val)\n{\n\n \n listTitle=[];\n listCoord=[];\n let flag = false;\n for(let x=0; x<locationTitle.length;x++)\n { \n if(locationTitle[x].toUpperCase().indexOf(val.toUpperCase())>-1)\n {\n listTitle[x]=locationTitle[x]; \n listCoord[x]=locationCoord[x];\n flag=true; \n }\n }\n \n}", "function getMockup(e, positionInfo) {\n return { \n index: e.index,\n name: e.label, \n x: rounder(e.x),\n y: rounder(e.y),\n color: e.color,\n shape: e.shape,\n size: rounder(e.size),\n realSize: rounder(e.realSize),\n facing: rounder(e.facing),\n layer: e.layer,\n statnames: e.settings.skillNames,\n position: positionInfo,\n guns: e.guns.map(function(gun) {\n return {\n offset: rounder(gun.offset),\n direction: rounder(gun.direction),\n length: rounder(gun.length),\n width: rounder(gun.width),\n aspect: rounder(gun.aspect),\n angle: rounder(gun.angle),\n };\n }),\n turrets: e.turrets.map(function(t) { \n let out = getMockup(t, {});\n out.sizeFactor = rounder(t.bound.size);\n out.offset = rounder(t.bound.offset);\n out.direction = rounder(t.bound.direction);\n out.layer = rounder(t.bound.layer);\n out.angle = rounder(t.bound.angle);\n return out;\n }),\n };\n }", "findTypedLetterByPosition(position) {\n let result = this.typedLetters.find(typedLetter => {\n return typedLetter.position.x === position.x && typedLetter.position.y === position.y;\n });\n\n if (typeof result === 'undefined') {\n result = null;\n }\n\n return result;\n }", "function insertMarkerToDB(location, name) {\n $.ajax({\n type: 'GET',\n url: '/MapPoint/create.json',\n data: {\n latitude: location.lat,\n longitude: location.lng,\n name: name\n },\n success: function(data) {\n //console.log('RESULT: ' + JSON.stringify(data));\n }\n });\n }", "function getParticipantObjByName(match, name) {\n var participants = match['participants'];\n var pids = match['participantIdentities'];\n var pid = -1;\n for(i = 0; i < pids.length; i++) {\n if(pids[i]['player']['summonerName'] == name) {\n pid = pids[i]['participantId'];\n break;\n }\n }\n return participants[pid-1];\n}", "function createMarker(r){\n self.showDiv(true);\n var position, lat, lng;\n lat = parseFloat(r.location.latitude);\n lng = parseFloat(r.location.longitude);\n position = new google.maps.LatLng(lat, lng);\n /*if(placeBounds.contains(position))\n {*/\n var marker = new google.maps.Marker({\n map: map,\n position: position,\n title: r.name,\n animation: google.maps.Animation.DROP,\n });\n bounds.extend(marker.getPosition());\n\n\n var contentString = '<div id=\"info_window\">' +\n '<img src=' + r.thumb + ' >' +\n '<h2>' + r.name + '</h2>' +\n '<p>' + r.location.address + '</p>' +\n '<p>Average cost for two: $' +\n r.average_cost_for_two + '</p>' +\n '<p class=\"rating\">Rating: ' +\n r.user_rating.aggregate_rating + '</p>' +\n '<a href=' + r.menu_url + '>' + 'Menu Url</a>';\n var address = r.location.address;\n\n var newMarker = {marker:marker, content:contentString};\n\n // Create an onclick event to open an infowindow at each marker.\n marker.addListener('click', function() {\n hideAnimation();\n marker.setAnimation(google.maps.Animation.BOUNCE);\n populateInfoWindow(this, largeInfowindow, contentString);\n });\n return newMarker;\n //}\n } // end of createMarker", "function Player1Name(value)//Sets the name of player 1 and adds to the list of potential winners if not already there.\n{\n model.player1.name=value;\n var index = model.winners.find(winners => winners.name == value)\n if(!index){model.winners.push({name:`${model.player1.name}`,wins:0})}\n}", "function onLocationFound(location){\n\n\t// Update the model with the coordinate pair for use later.\n\tapp.position = location;\n\n\t// If successful, find all nearby brunch locations at those coordinates.\n findNearbyBrunchLocations(location.coords);\n\n}" ]
[ "0.55945784", "0.55155414", "0.5372061", "0.53548574", "0.52936345", "0.5292482", "0.52400655", "0.52102", "0.5159438", "0.51353896", "0.51154304", "0.5113312", "0.51111436", "0.5110201", "0.5109417", "0.5098488", "0.50911343", "0.50832295", "0.5079928", "0.5076207", "0.5045602", "0.5038288", "0.5030733", "0.50182706", "0.5015086", "0.50018305", "0.4996816", "0.49821067", "0.49794316", "0.49780127", "0.49687204", "0.49633983", "0.49513766", "0.49499455", "0.49455753", "0.49244434", "0.49115518", "0.48922718", "0.48646355", "0.48593962", "0.48577052", "0.4855432", "0.4838728", "0.4838031", "0.4825128", "0.48249486", "0.48244342", "0.48162448", "0.48043308", "0.48003414", "0.47997946", "0.4796625", "0.47905025", "0.47849536", "0.47799447", "0.47776455", "0.4755562", "0.47546393", "0.47448108", "0.4740631", "0.4735003", "0.47313973", "0.47295067", "0.47244897", "0.47141165", "0.47077686", "0.47056884", "0.47052172", "0.47045252", "0.47029313", "0.47026756", "0.46973765", "0.46937048", "0.46884277", "0.4683101", "0.46794215", "0.46791098", "0.46743", "0.46722734", "0.4670856", "0.46664122", "0.46619037", "0.46610492", "0.46557167", "0.46547738", "0.46544635", "0.46508488", "0.46502376", "0.46471956", "0.46467066", "0.464512", "0.4644591", "0.46438715", "0.46402332", "0.46384144", "0.46374774", "0.46294704", "0.4627889", "0.46241114", "0.46236378" ]
0.7198466
0
this will guard against any duplicates the user inputs
function noDuplicatesinUserGuesses(userGuessesArr) { var checkDuplicatesArr = []; for (var i = 0; i < userGuessesArr.length; i++) { if (checkDuplicatesArr.indexOf(userGuessesArr[i]) === -1) { checkDuplicatesArr.push(userGuessesArr[i]); } } return checkDuplicatesArr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkIsDuplicatingInputs(numOfInputs) {\n const InputsArr = [];\n for (let i = 1; i <= numOfInputs; i++) {\n InputsArr.push(document.getElementById(`serial-${i}`).value + '-' + document.getElementById(`typeName-${i}`).value);\n }\n return InputsArr.length === new Set(InputsArr).size;\n }", "function uniqueInput(input){\n\t\tvar temp = 0;\n\t\tfor(m=0; m < guessedLetters.length; m++) {\n\t\t\tif (guessedLetters[m] === input){\n\t\t\t\ttemp++;\n\t\t\t\t// log(\"Temp count: \" + temp);\n\t\t\t}\n\t\t}\n\t\tif (temp === 0){\n\t\t\tuniqueLetter = true;\n\t\t\t// alert(\"First Time\");\n\t\t\treturn uniqueLetter;\n\t\t\tguessedLetters.push(input);\n\t\t}\n\t\telse if(temp !== 0){\n\t\t\tuniqueLetter = false;\n\t\t\t// alert(\"Please Pick a new letter that you have not used before.\");\n\t\t\treturn uniqueLetter;\n\t\t}\n\t}", "function duplicateChecker(input) {\r\n let duplicateSwitch = false;\r\n if (ul.children.length > 0) {\r\n for (let i = 0; i < ul.children.length; i++) {\r\n if (input.value === ul.children[i].children[0].textContent) {\r\n duplicateSwitch = true;\r\n break;\r\n };\r\n }\r\n }\r\n return duplicateSwitch;\r\n }", "function checkUserDuplicates(value) {\n if (!userInputsArray.includes(value)) {\n userInputsArray.push(value);\n\n return true;\n }\n\n return false;\n}", "function inputIsValid(){\n\tconsole.log(ul.children.length);\n\tif (input.value.length > 0)\n\t{\n\t\tfor (i = 0, len = ul.children.length; i < len; i++) {\t\t\t\n\t\t\t// <li><span>Notebook</span><button class=\"Delete\">Delete</li>\n\t\t\t// ul.children[i] = selected list item (textContent for above example = \"Notebook Delete\", so inspect span tag only)\n\t\t\t// ul.children[i].children[0] = span tag of the selected list item\t\t\t\n\t\t\tvar entry = ul.children[i].children[0].textContent.toLowerCase().trim();\n\t\t if (input.value.toLowerCase().trim() === entry) {\n\t\t \treturn false //don't add duplicate item\n\t\t\t}\n\t\t}\n\t\tconsole.log(\"isValid\");\n\t\treturn true;\n\t}\n\treturn false;\n}", "function DuplicateIn() {\n\n var formInvalid = false;\n $('#register_form input').each(function() {\n if ($(this).val() === '') {\n formInvalid = true;\n }\n });\n\n if (formInvalid)\n alert('One or Two fields are empty. Please fill up all fields');\n}", "function appendListIfInputValid(input) {\n // info: slice() slices the string and returns it starting from the given index\n // toUpperCase() converts a string to uppercase letters.\n // toLowerCase() converts a string to lowercase letters.\n input = input.charAt(0).toUpperCase() + input.slice(1).toLowerCase();\n\n // appends list array and returns true if no duplicate or empty values else returns false\n if (searchArrayForItem(list, input) == -1 && input != '') {\n list.push([input, 'noCheck']);\n return true;\n } else return false;\n}", "function addTokenGuard()\n {\n if(input.val() == '' || input.val() == undefined)\n return true;\n\n // If the value already exists in the list then dont add it\n var dirty = false;\n list.children('li').each(function() {\n if($(this).html() == input.val())\n dirty = true;\n });\n\n return dirty;\n }", "function manage_user_input(){\n let input = $(\"#user_input\").val().toUpperCase();\n if(input.length > 0 && !all_user_input.includes(input)){\n $(\"#game_message_p\").attr(\"hidden\",true);\n $(\"#user_input\").val(\"\");\n let isTarget = check_user_input(input);\n store_user_input(input,isTarget);\n } else {\n $(\"#game_message_p\")\n .text(\"Input too short (min length = 1) or you already tried this word.\")\n .attr(\"hidden\",false);\n }\n}", "function addTo() { \n//had to parseInt so that player choices were converted to integars to be compared with lottoArray latter - this takes userinput, coverts it to an integar and populates playerArray\n playerChoice = parseInt(document.getElementById(\"userinput\").value);\n //created to manage situations where the player may input a duplicate option (this disallows duplicates in the array)\n if (playerArray.length < 6 && playerArray.indexOf(playerChoice) === -1){\n playerArray.push(playerChoice); \n //highlights with an alert when the player has chosen all 6 numbers\n if(playerArray.length == 6){\n printNumbersPlayer()\n alert(\"you have now chosen your 6 numbers!\");\n }\n\n return false;\n }\n //this else statement posts an alert if a duplicate has been used\n else {\n alert(\"you have used a duplicate, try another number!\");\n return false;\n }\n }", "function checkDuplicatePicklistValues(arr) {\n\tvar len=arr.length;\n\tfor (var i=0; i<len; i++) {\n\t\tfor (var j=i+1; j<len; j++) {\n\t\t\tif (trim(arr[i]).toLowerCase() == trim(arr[j]).toLowerCase()) {\n\t\t\t\talert(alert_arr.LBL_DUPLICATE_FOUND+'\\''+trim(arr[i])+'\\'');\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}", "function checkUnique(input) {\n\t\t\ttableQueryService.checkUnique(scope.config.title.singular, input.key, input.tempValue)\n\t\t\t.then(function(data) {\n\t\t\t\tinput.error = null;\n\t\t\t\tinput.confirmed = true;\n\t\t\t\t// does not matter, is async so we can't return true or false here anyway\n\t\t\t\treturn;\n\t\t\t}, function(error) {\n\t\t\t\tif (error === \"ERROR: not unique\") {\n\t\t\t\t\tinput.error = \"Input must be unique\";\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tinput.error = null;\n\t\t\t\tscope.$emit('postErrorBanner', {message: error});\n\t\t\t});\n\t\t\t// just assume true, we will check again once submitted\n\t\t\treturn true;\n\t\t}", "function doubleEntryCheck(input1, input2) {\r\n return input1 === input2;\r\n}", "async function validateInput (input) {\n const seen = new Set()\n let count = 0\n for (c of input) {\n if (seen.has(c)) continue\n \n seen.add(c)\n if (++count > 2) throw new Error('Input must contain only two character types')\n }\n return [[...seen], input]\n}", "function add(animals, animal) {\n// takes an array of animals and an object representing a new animal\n // checks that the param animal Object has a name prop with a length > 0 && species prop with a length > 0\n // checks that the new animal has a UNIQUE name that doesn't already exist in the animals array\n \n // if user types something into the fields\n if (animal.name.length > 0 && animal.species.length > 0) {\n // loop to check to see if the name exists \n for (let i = 0; i < animals.length; i++) {\n if (animal.name === animals[i].name) {\n console.log (\"that animal exists\");\n return;\n } \n }\n animals.push(animal);\n }\n}", "checkUserInput() {\r\n const {\r\n drugId1, drugId2, sample, dataset,\r\n } = this.state;\r\n return drugId1 !== 'Any' || sample !== 'Any' || dataset !== 'Any' || drugId2 !== 'Any';\r\n }", "function isDuplicateEntry(wslId) {\r\n\t//alert(\"wslField = \" + wslField);\r\n\tvar wslIdList = getMainView().forms[0].elements[wslField];\r\n\t//alert(\"wslIdList = \" + wslIdList);\r\n\tvar duplicate = false;\r\n\t//alert(\"!wslIdList = \" + (!wslIdList));\r\n\tif(!wslIdList) return false;\r\n\t\r\n\t//alert(\"wslIdList.length = \" + wslIdList.length);\r\n\tif(wslIdList.length) {\r\n\t\t// there are more than one entry\r\n\t\tfor(var z=0; z<wslIdList.length; z++) {\r\n\t\t\t//alert(\"wslIdList[z].value = \" + wslIdList[z].value.toLowerCase() + \", wslId = \" + wslId.toLowerCase() + \", compare = \" + (wslIdList[z].value.toLowerCase() == wslId.toLowerCase()));\r\n\t\t\tif(wslIdList[z].value.toLowerCase() == wslId.toLowerCase()) {\r\n\t\t\t\tduplicate = true;\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t} else {\r\n\t\t//alert(\"wslIdList.value = \" + wslIdList.value.toLowerCase() + \", wslId = \" + wslId.toLowerCase() + \", compare = \" + (wslIdList.value.toLowerCase() == wslId.toLowerCase()));\r\n\t\tif(wslIdList.value.toLowerCase() == wslId.toLowerCase())\r\n\t\t\tduplicate = true;\r\n\t}\r\n\t\r\n\treturn duplicate;\r\n}", "static validateNupdate(input, output) {\r\n \r\n if (output[0].indexOf(input) === -1 && typeof input !== null && typeof input !== undefined) {\r\n output[0].push(input);\r\n }\r\n // console.log(output[0], input);\r\n return output;\r\n }", "function duplicateCheck(x) {\n\t\tfor(var i=0; i<attempts.length ; i++) {\n\t\t\tif(x===attempts[i]) {\n\t\t\t\tattempts.pop();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "function checkFieldUniqueInSameMatrix(ob) {\r\n\tvar countDupl = 0;\r\n\t$('#addMatrixPopup input.field_name_matrix').each(function(){\r\n\t\tif (ob.val() == $(this).val()) countDupl++;\r\n\t});\r\n\treturn (countDupl <= 1);\r\n}", "function checkDuplicates2(args) {\n return new Set(args).size !== args.length\n}", "function getInput() {\n var userInput = 0; // user input (initialization)\n var check = false; //flag (initialization)\n var message = 'Inserisci uno dei numeri visti in precedenza';\n\n userInput = parseInt(prompt(message));\n\n while (!check) {\n // input validation\n if (!checkInput(userInput)) {\n userInput = parseInt(\n prompt(\n 'Il numero inserito non è valido. Sono accettati solo numeri interi da 1 a 100'\n )\n );\n } else {\n // is the inpute a duplicate?\n if (!checkUserDuplicates(userInput)) {\n userInput = parseInt(prompt('Hai già inserito questo numero. Riprova'));\n } else {\n check = true;\n }\n }\n }\n\n return userInput;\n}", "function areThereDuplicates() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n}", "function removeDuplicates (input) {\n\t\t\tlet result = input.filter(function(item, pos) {\n\t\t\t\treturn input.indexOf(item) == pos;\n\t\t\t});\n\t\t\treturn result\n\t\t}", "function areThereDuplicates2() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n }", "function findDuplicate() {\n\n var modelsArray = [$scope.data.first, $scope.data.second, $scope.data.third, $scope.data.fourth];\n var filteringModelsArray = _.uniq(modelsArray);\n\n return filteringModelsArray.length === modelsArray.length;\n }", "function checkForDuplicates()\r\n\t{\r\n\tfor (i=0; i < activeClippings.length; i++)\r\n\t\t{\r\n\t\tif (newClipping == activeClippings[i].id) {i = allClippings.length; duplicate = true;}\r\n\t\t}\r\n\t}", "function checkInput(guess) {\n\t\tfor (var i = 1; i <= 4; i++) {\n\t\t\tvar inputnow = \"input\" + i;\n\t\t\t//console.log(inputnow);\n\t\t\tvar newNum = parseInt(document.getElementById(inputnow).value);\n\t\t\tconsole.log(newNum);\n\t\t\tif (isValid(newNum)) {\n\t\t\t\t\n\t\t\t\tif (checkNum(newNum, guess)) {\n\t\t\t\t\t// Good to go. \n\t\t\t\t} else {\n\t\t\t\t\tdocument.getElementById(\"message\").innerHTML = \"<p>\" + newNum + \"Is a duplicate number. Fix it</p>\";\n\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\t\n\t\t\t\tdocument.getElementById(\"message\").innerHTML = \"<p>Hey, you forgot to enter a number. You might do that before I just decide to keep your money and tell you to go away</p>\";\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t}\n\t}", "function isDuplicate(name,phone,twitter){\n\tvar isduplicate=false; \n\t\tfor(var i=0;i<addresslist.length; i++){ \n\t\t\tif(addresslist[i].name.toLowerCase()==name.toLowerCase() \n\t\t\t\t&& addresslist[i].phone.toLowerCase()==phone.toLowerCase()\n\t\t\t\t&& addresslist[i].twitter.toLowerCase()==twitter.toLowerCase()){ \n\t\t\t\tisduplicate=true; \n\t\t\t} \n\t\t} \n\treturn isduplicate; \n}", "function checkduplicate(text)\n{\n\tvar i = 0;\n\tvar len = groupStore.length;\n\twhile (i < len)\n\t{\n\t\tvar str = groupStore[i]._title;\n\t\tif(text.toLowerCase()==str.toLowerCase())\n\t\t{\n\t\t\tdocument.getElementById('errorgroup').innerHTML=\"This category name already exists.\";\n\t\t\treturn true;\n\t\t}\n\t\ti++;\n\t}\n\treturn false;\n}", "function addNew(){\n let name = document.getElementById(\"name\").value;\n let major = document.getElementById(\"major\").value;\n console.log(`You have submitted ${name} with a major of ${major}`);\n\n\n // here we add validation\n if(name&&major){\n if(!hasDuplicate(name,major)){\n clearError();\n addRow(name, major);\n } else {\n displayDuplicateError();\n }\n } else {\n console.log(\"no name or major\")\n displayError();\n }\n}", "function savePass(){\n event.preventDefault();\n let alreadyInserted = false;\n //loop through your username array to check\n for (let i = 0; i < password.length; i++) {\n if (password[i] === document.getElementById(\"pass\").value) {\n alreadyInserted = true;\n }\n }\n\n //if the username is not in the array, insert it\n if (!alreadyInserted) {\n // console.log(\"test\")\n password.push(document.getElementById(\"pass\").value);\n }\n}", "function EntryCheckForNumbers() {\r\n let userEntry ; \r\n do {userEntry = +prompt('attention please - only Numbers');} \r\n while (userEntry !== +userEntry || userEntry === 0); \r\n console.log ('Thank you very much');\r\n return userEntry;\r\n}", "function checkIfAdded(inputValue) {\n var arrayLength = tagArray.length;\n for (var i = 0; i < arrayLength; i++) {\n if (tagArray[i] == inputValue) {\n errorMessage.text(\"Tag already added\");\n errorMessage.css(\"display\", \"block\");\n return true;\n }\n }\n }", "function areThereDuplicates2(){\n return new Set(arguments).size !== arguments.length\n}", "function areThereDuplicates() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n}", "function areThereDuplicates() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n}", "function areThereDuplicates() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n}", "function areThereDuplicates() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n}", "function areThereDuplicates() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n}", "function areThereDuplicates() {\n let collection = {}\n for(let val in arguments){\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1\n }\n for(let key in collection){\n if(collection[key] > 1) return true\n }\n return false;\n}", "function handleSaveUrl() {\n inputValue = input.value;\n let checkUrl = arrWithUrl.includes(inputValue);\n if(checkUrl) {\n showModal();\n modalContent.textContent = \"You have already saved this url\"; \n } else {\n arrWithUrl.push(inputValue);\n setLocalStorage(arrWithUrl);\n createUrlItem(inputValue);\n }\n form.reset();\n}", "function validateNamesUnique() {\n var i = 0;\n while (vm.paramsForm.hasOwnProperty('name_' + i)){\n var modelValue = vm.paramsForm['name_' + i].$modelValue;\n vm.paramsForm['name_' + i].$setValidity(\n 'unique',\n vm.parametersList.isNameUnique(modelValue)\n );\n i++;\n }\n }", "function areThereDuplicates() {\n // console.log(arguments)\n let counter = {};\n for (let i=0; i< arguments.length; i++){\n // counter[arguments[i]] = ++counter[arguments[i]] || 1;\n if (counter[arguments[i]]) return true;\n counter[arguments[i]] = 1;\n // console.log(counter)\n\n }\n return false;\n}", "function checkDuplicatedNames() {\n\n for(var i = 0; i < productTable.length; i++)\n {\n if(productName.value == productTable[i].name) \n {\n productName.classList.add(\"is-invalid\");\n productName.classList.remove(\"is-valid\");\n\n PNameAlert.classList.add(\"d-block\");\n PNameAlert.classList.remove(\"d-none\");\n\n PNameAlert.innerHTML = \"Product Name Already Exists\";\n\n addBtn.disabled = true;\n } \n }\n}", "function insertNum(){\r\n var win = true;\r\n for (var i = 0; i < numbers.length; i++) {\r\n userList[i] = Number(prompt(\"Inserisci il \"+ (i+1) +\"° numero\"));\r\n if (userList[i] === numbers[i]) {\r\n win *= true;\r\n }\r\n else{\r\n win = false;\r\n }\r\n }\r\n return win;\r\n}", "function getValue(input){\n //if our dot array operators2 includes(includes basically check a value)..if value u r checking is within operators2, it will return true, if not, it will return false..last value=inputs.length-1\n if(operators2.includes(inputs[inputs.length-1]===true && input===\".\")){\n console.log(\"Duplicat '.' \");\n }\n //if very first number is exactly = 1\n else if(inputs.length===1 && operators1.includes(input)===false){\n //add value to inputs array..inputs=array..input=this.id that we will be adding..so basically is checking if it is a number\n inputs.push(input); \n }\n //if last thing was not an operator, go ahead and add that input to the array\n //if last character was not an operator, add operator to the array\n else if(operators1.includes(inputs[inputs.length-1])===false){\n inputs.push(input);\n }\n //check to add a number..convert string to number\n //if input includes,of how we r getting id, convert string to number..if it includes that input..if that is true..\n else if(nums.includes(Number(input))){\n //push input to end of array?\n inputs.push(input);\n }\n //update function will update value at end of our list\n update();\n }", "function findDuplicateCharacters(input) {\n}", "inNoOfShare() {\n var flag = true;\n var Noofshares = read.question(\"Enter how many shares you have \");\n while (flag) {\n\n if (!isNaN(Noofshares)) {//for validate full name\n flag = false;\n } else {\n var Noofshares = read.question(\"Wrong input !!!...Please enter No of shares in integer \");\n }\n }\n return Noofshares;\n }", "function hasElementsWithUniqueNames() {\n let duplicates = findDuplicates(inputsSelectsTextareas, 'name', 'formAncestorID')\n // Radio buttons have duplicate names.\n .filter(field => field.type !== 'radio');\n let problemFields = duplicates.map(field => stringifyElement(field));\n // Deduplicate items with same tagName and id.\n problemFields = [...new Set(problemFields)];\n if (problemFields.length) {\n const item = {\n // description: 'Autocomplete values must be valid.',\n details: 'Found fields in the same form with duplicate <code>name</code> attributes:<br>• ' +\n `${problemFields.join('<br>• ')}`,\n learnMore: 'Learn more: <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#htmlattrdefname\">The input element name attribute</a>',\n title: 'Fields in the same form must have unique <code>name</code> values.',\n type: 'error',\n };\n items.push(item);\n }\n}", "function validateInput(){\n\tvar api_key_input = $('#api-key-input');\n\tvar search_input = $('#summoner-name-input');\n \tif (!isEmpty(search_input) && !isEmpty(api_key_input)){\n\t\tvar selected = getSelectedOption();\n\t\t//alert(empty_checker + ' | ' + selected);\n\t\tif (selected == 'summary'){\n\t\t\tsearchSummonerStatsSummary();\n\t\t} else {\n\t\t\tsearchSummonerStatsRanked();\n\t\t}\n\t}\n}", "function areThereDuplicates() {\n if (arguments.length < 2) return false;\n const counter = {};\n for (let i = 0; i < arguments.length; i++) {\n if (counter[arguments[i]]) {\n return true;\n } else {\n counter[arguments[i]] = 1;\n }\n }\n return false;\n}", "function userInput(){ \n everythingOk = false; \n while(everythingOk === false){\n // answer = inputLength(); \n upCaseRslt = upCase();\n lcase = lowCase(); \n numAnsr = numOpt();\n symbolAnswer = simbl(); \n if(upCaseRslt === false && lcase === false && numAnsr === false && symbolAnswer === false){\n alert(\"at least one option must be checked in order to create password\"); \n }else{ \n everythingOk = true; \n } \n } \n }", "function oneOfEach(sentence) {\n let unique = [];\n sentence = sentence.split('');\n for(let i = 0; i < sentence.length; i++) {\n if(!unique.includes(sentence[i])) {\n unique.push(sentence[i]);\n }\n }\n let newSentence = unique.join('');\n return $('<li>').text('No duplicates: ' + newSentence).appendTo('#outputs');\n}", "function clickedScore() {\n if (playerInitals.includes(nameSubmit.value)) {\n alert(\"That inital already exist\");\n } else if (\n nameSubmit.value === \"\" ||\n nameSubmit.value === null ||\n nameSubmit.value === undefined\n ) {\n alert(\"Please enter valid initals\");\n } else {\n playerInitals.push(nameSubmit.value);\n playerScores.push(score);\n setLS();\n matchHS();\n viewHS();\n }\n}", "handleSubmit(event) {\n event.preventDefault();\n let symbol = event.target[0].value.trim();\n if (symbol === '') {\n alert('The input box was empty.');\n } else if (this.state.stockSymbols.includes(symbol.toUpperCase())) {\n alert('This stock symbol has already been entered.');\n } else if (!this.state.validSymbols.includes(symbol.toUpperCase())) {\n alert('That isn\\'t a valid stock symbol.');\n } else {\n let newSymbols = this.state.stockSymbols.slice();\n newSymbols.push(symbol.toUpperCase());\n this.setState({stockSymbols: newSymbols});\n }\n }", "function duplicateCheck() {\n if(duplicateInput.checked) {\n if (lengthInput.value.trim() <= 10) {\n return(true)\n }\n else {\n dupErrorString.textContent = \"You can only remove duplicates for a password of 10 or fewer characters\"\n return(false)\n }\n }\n else {\n return(true)\n }\n}", "addSong(selectedSong){\r\n let newItem = this.userBand + \" - \" + selectedSong;\r\n //prevents adding of duplicate songs\r\n this.userSetlist.indexOf(newItem) === -1 ? this.userSetlist.push(newItem) : console.log(\"This song is already in the list\");\r\n }", "function readInput() {\n clear(\"comparingDiv\")\n\n input1 = document.getElementById(\"searchbox1\").value;\n input2 = document.getElementById(\"searchbox2\").value;\n\n var list = educationInterface.getIDs();\n\n if (!list.includes(input1) || !list.includes(input2)) \n comparingDiv.appendChild(document.createTextNode(\"Invalid input. Please check that both field contain valid ids.\"));\n else \n createComparisionTables(input1.toString(), input2.toString());\n\n return false;\n}", "inStockName() {\n var name = read.question(\"Enter the name of stock \");\n var flag = true;\n while (flag) {//for validating inputs\n\n if (isNaN(name)) {//for validate the name \n flag = false;\n } else {\n var name = read.question(\"Wrong input !!!...Please enter correct name of Stack \");\n }\n }\n return name;\n }", "function duplicateChars(letter) {\n if (correctGuesses.includes(letter) || wrongGuesses.includes(letter)) {\n warning = \"YOU ALREADY GUESSED THAT LETTER!\";\n warningElement.innerHTML = warning;\n }\n}", "function duplicateFinder(word, inputValueArr, currentKey) {\n console.log(\"word, inputValueArr, currentKey\", word, inputValueArr, currentKey);\n\n for (let i = 0; i < inputValueArr.length; i++) {\n //exclude checking the current index while finding duplicates.\n //This is done because the current index is where the {word} is saved. So we should check only with other objects in array.\n if (currentKey != i && word === inputValueArr[i]) {\n return true;\n }\n\n }\n return false;\n}", "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}", "addEntry() {\n let candidateName = this.state.newEntryName\n let temp = this.state.pieData\n let newId = this.generateId()\n\n //Avoiding empty labels\n if(candidateName === ''){\n alert(\"Please insert an entry name\")\n } \n else{\n\n //Ensuring that the label is unique by going through all labels in pie data..\n for(var i = 0; i < temp.length; i++){\n\n //If not unique, the user is asked to enter a new entry, and the input box is reset. \n if(temp[i].label === candidateName){\n alert(\"This entry already exists. Please enter a unique entry name.\");\n document.getElementById('newEntry').value = '';\n return\n }\n }\n\n //If there are no errors, the entry object is pushed into pieData.\n temp.push({id: newId, label: candidateName, value: '0', votes: 0});\n this.setState({\n pieData: temp,\n newEntryName: ''\n })\n //Reset the data from the input\n document.getElementById('newEntry').value = '';\n }\n }", "function combinedArray() {\n var userName = prompt(\"Please enter a name\", \"Enter name here\");\n var nameSearch = allNames.lastIndexOf(userName);\n if (nameSearch > 0) {\n alert(\"Your name is in the array\")\n }\n else {\n alert(\"Your name is NOT in the array\")\n }\n}", "function areThereDuplicates() {\n let freqCounter = {};\n for(let i = 0; i < arguments.length; i++){\n if(freqCounter[arguments[i]]){\n return true;\n } else {\n freqCounter[arguments[i]] = true;\n }\n }\n return false;\n}", "function validateUnique(threeArray){\n for(var i = 0; i < threeArray.length; i ++){\n for(var v = 0; v < lastItemsSeen.length; v++){\n if(threeArray[i].product === lastItemsSeen[v].product){\n \n return false;\n \n }\n }\n return true;\n }\n}", "function userInput() {\n checkedUpper = window.confirm('Do you want Upper Case Letters?');\n checkedLower = window.confirm('Do you want Lower Case Letters?');\n checkedNumbers = window.confirm('Do you want Numbers?');\n checkedSpecial = window.confirm('Do you want Special Characters?');\n if (!checkedUpper && !checkedLower && !checkedNumbers && !checkedSpecial) {\n alert(\"Must choose at least one\");\n userInput();\n }\n}", "function areThereDuplicates() {\n let collection = {};\n for (let val in arguments) {\n collection[arguments[val]] = (collection[arguments[val]] || 0) + 1;\n }\n for (let key in collection) {\n if (collection[key] > 1) return true;\n }\n return false;\n}", "function checkUserInput(){\n\t\t//check if title name is inputted\n\t\tif (!$(element).find('input[id=edit_title_name]').val()){\n\t\t\talert (\"Please input the test's title name\");\t\t\n\t\t\treturn false;\n\t\t}\n\t\t//check if test type is selected\n\t\tif (!$('#edit_test_type').val()){\n\t\t\talert (\"Please choose the test type\");\t\t\n\t\t\treturn false;\n\t\t}\n\t\t//check if total question number is inputted correctly\n\t\tif ( isNaN($(element).find('input[id=edit_total_question]').val()) || !isPositiveInteger($(element).find('input[id=edit_total_question]').val()) ){\n\t\t\talert (\"Please input correct number in total main question number\");\t\t\n\t\t\treturn false;\n\t\t}\n\t\t//check in each question set...\n\t\tnGroups = $(element).find('input[id=edit_total_question]').val();\n\t\tfor (var i=1;i<=nGroups;i++){\n\t\t\t//check if sub question number is inputted correctly\n\t\t\tif (isNaN($(element).find('input[id=edit_total_sub_question_' + i + ']').val()) || !isPositiveInteger($(element).find('input[id=edit_total_sub_question_' + i + ']').val()) ){\n\t\t\t\talert (\"Please input correct number in total sub question number for Q\" + i);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t//check in each question...\n\t\t\tvar total_sub_question = $(element).find('input[id=edit_total_sub_question_' + i + ']').val();\n\t\t\tfor (var j=1;j<=total_sub_question;j++){\n\t\t\t\t//check question content or picture is inputted\n\t\t\t\tif (!$(element).find('input[name=question' + i + '\\\\.'+ j + ']').val() && !$(element).find('input[name=question' + i + '\\\\.'+ j + '_pic]').val()){\n\t\t\t\t\talert (\"Please input a question content or picture on Q\" + i + \".\" + j);\n\t\t\t\t\treturn false;\t\t\t\t\n\t\t\t\t}\n\t\t\t\t//check learning object link and name are inputted.\n\t\t\t\tif (!$(element).find('input[name=lo' + i + '\\\\.' + j + '_link]').val() && $(element).find('input[name=lo' + i + '\\\\.' + j + '_link]').length > 0){\n\t\t\t\t\tif (j==1) {}\n\t\t\t\t\telse {\n\t\t\t\t\t\talert (\"Please input learning object link for Q\" + i + '.' + j);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (!$(element).find('input[name=lo' + i + '\\\\.' + j + '_name]').val() && $(element).find('input[name=lo' + i + '\\\\.' + j + '_name]').length > 0){\n\t\t\t\t\tif (j==1) {}\n\t\t\t\t\telse {\n\t\t\t\t\t\talert (\"Please input learning object name for Q\" + i + '.' + j);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//variable to check for checkbox (correct answer)\n\t\t\t\tvar isChecked = false;\t\n\t\t\t\t//check for each answer...\n\t\t\t\tfor (var k=1;k<=4;k++){\n\t\t\t\t\t//check answer content is inputted\n\t\t\t\t\tif (!$(element).find('input[name=answer' + i + '\\\\.'+ j + '_'+ k + ']').val()){\n\t\t\t\t\t\talert (\"Please input an answer for Q\" + i + \".\" + j);\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t//check if one of checkboxes is selected \n\t\t\t\t\tif ( $(element).find('input[id=answer' + i + '\\\\.'+ j + '_'+ k + '_cb]').is(':checked')){\n\t\t\t\t\t\tisChecked = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//if no checkbox is selected\n\t\t\t\tif (!isChecked){\n\t\t\t\t\talert (\"Please select one correct answer in Q\" + i + \".\" + j);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\t\t\n }\n\t\treturn true;\n\t}", "function checkInput(){\n if(isNaN(userGuess)) {\n alert(\"Please enter a number from 1 - 100!\");\n } else if(userGuess === \" \") {\n alert(\"Well, you have to input a number\");\n } else if (userGuess < 0 || userGuess > 100) {\n alert(\"Plese enter a number from 1 - 100!\");\n } else {\n comparisonAmount();\n console.log(\"User guess = \" + userGuess);\n $('#userGuess').val('');\n guessCount++;\n setCount(guessCount);\n $('ul#guessList').append(\"<li>\" + userGuess + \"</li>\");\n }\n}", "checkIfUnique(name, value, signal) {\n if (name === 'password' || name === 'confirmPassword') return;\n return this.getAll(signal)\n .then(users => {\n return users.find(user => user[name] === value)\n })\n .then(user => {\n let message = '';\n if (user !== undefined){\n message = `This ${name} has already been used.`; \n } \n return this.setError(name, message); \n });\n }", "function checkDuplicate()\n {\n var found = false;\n for (var i = 0; i < $scope.list.length; i++)\n {\n if ($scope.list[i].item == $scope.item)\n {\n found = true;\n }\n }\n return found;\n }", "function areThereDuplicates() {\n let args = [...arguments];\n const argsList = {}\n for(let i = 0; i< args.length; i++){\n let currentArg = args[i];\n argsList[currentArg] ? argsList[currentArg] += 1: argsList[currentArg] = 1\n }\n for (let two in argsList) {\n if (argsList[two] > 1) {\n return true;\n }\n }\n return false;\n}", "handleSubmit(e) {\n e.preventDefault();\n let firstValue, secondValue;\n const [firstInput, secondInput] = e.target.elements;\n firstValue = firstInput.value.trim().split(' ').join('');\n secondValue = secondInput.value.trim().split(' ').join('');\n\n this.checkValues(firstValue,secondValue);\n\n firstInput.value = '' ;\n secondInput.value = '' ;\n firstInput.focus();\n\n }", "function checkEntry() {\n while (typeof sticksToRemove !== \"number\" ||\n Math.trunc(sticksToRemove) !== sticksToRemove ||\n sticksToRemove < 1 ||\n sticksToRemove > Math.min(3, stickCount)) {\n sticksToRemove = parseInt(prompt(\"Invalid entry. \" + players[0] + \", how many sticks do you want to remove? (1-3)\"));\n }\n}", "function checkDupe(data,x){\n\n if(idArray.includes(data[x][0])){\n return false;\n } else { return true; }\n\n}", "function areThereDuplicatesBonus(...args) {\n args.sort();\n let j = 1;\n let i = 0;\n while(j !== args.length){\n if(args[j] !== args[i]){\n i++;\n j++;\n } else {\n return true;\n }\n }\n return false;\n}", "function areThereDuplicates() {\n return new Set(arguments).size !== arguments.length;\n }", "function areThereDuplicates() {\n return new Set(arguments).size !== arguments.length;\n }", "function validateSkillSelections(){\n // if there are errors clear them here, we'll replace them if they aren't fixed\n $('.skills_section .validation_error').remove();\n var $skills = $(\".skill_selector\");\n var result = true;\n console.log(`Starting skill validation. Result: ${result}`);\n for(let j = 0; j < $skills.length; j++){\n for(let i = $skills.length - 1; i > j; i--){\n if( $($skills[j]).val() === $($skills[i]).val()){\n // Two skills are the same, fire an error message\n console.log(\"two skills are the same!!!!\");\n result = false;\n let skillType = $skills[j].id.slice(0, $skills[j].id.lastIndexOf(\"_\"));\n if ($(`.skills_section .${skillType}_error`).length < 1){\n insertValidationError(`.${skillType}_list`, skillType, \"You cannot choose the same skill more than once\"); \n }\n }\n }\n }\n console.log(`Ending skill validation. Result: ${result}`);\n return result;\n }", "function checkGuess () {\n var isItRepeated = $guessed.includes($guess);\n if (isItRepeated === true) {\n alreadyGuessed = true;\n } else {\n alreadyGuessed = false;\n }\n }", "addStudent(newStudent) {\n let foundDuplicates = studentsFullList.filter(student => {\n return student.name.includes(newStudent.name) == true || student.email.includes(newStudent.email) == true\n });\n if (foundDuplicates.length > 0) {\n console.log(`Student already added`);\n } else {\n studentsFullList.push(newStudent);\n }\n return {\n newStudent,\n studentsFullList\n }\n }", "function isValid(guess) {\n return !hasDuplicates(guess)\n}", "function validateUsers(e) {\n let username = e.target.name.value;\n let pin = e.target.pin.value;\n console.log(username, pin);\n let x = sortedUsers.find((user) => user.username === username);\n if (x != undefined) {\n x.pin === pin ? exitSignIn(x) : alert(\"incorrect password\");\n } else {\n console.log(\"at else Existing User\");\n alert(\"invalid input, try again\");\n }\n }", "function theGuess(userInput) {\n //if the user guessed correctly....\n if (userInput === theLetter) {\n winCounter++;\n lettersGuessed.length = 0;\n guessesRemaining = 8;\n newLetter();\n printWin();\n printLetters();\n printGuesses();\n winCheck();\n //if the user guessed incorrectly and that letter has not already been guessed....\n } else if (lettersGuessed.includes(userInput) === false) {\n console.log(`User entered ${userInput}`);\n lettersGuessed.push(userInput);\n guessesRemaining--;\n printGuesses();\n printLetters();\n }\n gameCheck();\n}", "function checkInputField(event) {\n if (event.keyCode == 13 && players.length < maxPlayerNumber) {\n AddPlayer();\n }\n}", "function validActivityInput(){\n let activity = [];\n const activityError = \"<p class='activityWarning'>At least one activity must be selected</p>\";\n $('.activities label input').each((index, element) => {\n activity.push(element.checked);\n })\n if (activity.indexOf(true) === -1 && $('.activityWarning').length === 0){\n $('.activities').after(activityError);\n }\n if (activity.indexOf(true) !== -1 && $('.activityWarning').length > 0){\n $('.activityWarning').remove();\n }\n}", "function checkInput(name,key)\n{\n if (name.match(/^\\s*$/)) //checks that roomane is not empty/contain only whitespace\n {\n window.alert(\"Room Name Can't Be Empty\");\n return false;\n }\n else if (key.match(/^\\s*$/)) //check that room key is not empty/contain only whitespace\n {\n window.alert(\"Room Key Can't Be Empty\");\n return false;\n }\n else\n {\n return true;\n }\n}", "function playersGuessSubmission() {\n playersGuess = $(\"#guessInput\").val();\n \n $(\"#yourGuess\").text(\"Your guess was \" + playersGuess + \".\");\n \n \t$(\"#guessInput\").val(\"\").focus();\n if (checkGuess()==false){\n $(\"#compare\").text(lowerOrHigher());\n if (guessHistory.indexOf(playersGuess)!== -1){\n \t\t$(\"#yourGuess\").append(\" You've tried that before!\"); \t\t \n \t\t}\n \t}\n \tguessHistory.push(playersGuess);\n \t\n}", "function uniqueValues(value) {\n if (arr1.includes(value) && arr2.includes(value)) {\n console.log(\"dupe\") \n } else {\n return value;\n }\n }", "validateAnItem(item) {\n let errors = [];\n if (_.find(this.state.items, {sequenceName: item.sequenceName})) {\n errors.push(\"There's already a sequence with this name\");\n }\n if (_.find(this.state.items, {sequence: item.sequence})) {\n errors.push(\"There's already another entry for this sequence\");\n }\n if (item.sequenceName === \"\") {\n errors.push(\"Name is required\");\n }\n if (item.sequenceDescription === \"\") {\n errors.push(\"Description is required\");\n }\n if (item.sequence === \"\") {\n errors.push(\"Sequence is required\");\n } \n // We only need the first occurance of a non-allowed letter, so .search makes sense here\n let nonDNA = item[\"sequence\"].search(/[^ATCG]/g);\n if (nonDNA !== -1) {\n errors.push(`Non-DNA character found at position ${nonDNA}`);\n }\n return errors;\n }", "function duplicateInputFieldMessage(fieldName) {\n return \"There can be only one input field named \\\"\".concat(fieldName, \"\\\".\");\n}", "checkDupe() {\n let occurrences = this.props.occurrences;\n let habit = this.state.currentHabit;\n let time = JSON.parse(JSON.stringify(this.state.habitTime));\n let quantity = this.state.quantity;\n let found = false;\n\n occurrences.forEach(item => {\n if (item.timestamp.slice(0, 10) === time.slice(0, 10)) {\n found = true;\n }\n });\n\n if (found) {\n alert('Please make any updates to existing logs by updating your table');\n } else {\n this.props.logHabit(habit, time, quantity);\n }\n }", "function checkIndivDupe() {\n var firstInstance = true;\n var dupeCount = 0;\n \n var validUserRows = validUserSheet.getLastRow() + 1;\n for (var row = 1; row < validUserRows; row++) {\n if (validUserSheet.getRange(row, 6).getValue() == userEmail) {\n if (firstInstance) {\n isIndivDupe = true;\n //get original batch ID\n origBatchId = validUserSheet.getRange(row, 2).getValue();\n origUID = validUserSheet.getRange(row, 3).getValue();\n origUserFirst = validUserSheet.getRange(row, 4).getValue();\n origUserLast = validUserSheet.getRange(row, 5).getValue();\n origUserEmail = validUserSheet.getRange(row, 6).getValue();\n origUserOrg = validUserSheet.getRange(row, 7).getValue();\n firstInstance = false;\n }\n //increment duplicate count\n dupeCount++;\n }\n }\n \n Logger.log('This a duplicate 1: ' + isIndivDupe);\n Logger.log('The original Batch ID is: ' + origBatchId);\n \n if (isIndivDupe) {\n //get info about original submission using original batch ID\n \n var logSheetRows = logSheet.getLastRow() + 1;\n for (var logRow = 1; logRow < logSheetRows; logRow++) {\n if (logSheet.getRange(logRow, 3).getValue() == origBatchId) {\n origRespFirst = logSheet.getRange(logRow, 4).getValue();\n origRespLast = logSheet.getRange(logRow, 5).getValue();\n origRespName = origRespFirst + ' ' + origRespLast;\n origRespEmail = logSheet.getRange(logRow, 6).getValue();\n origTime = logSheet.getRange(logRow, 1).getValue();\n origTime = Utilities.formatDate(origTime, ss.getSpreadsheetTimeZone(), \"M/d/yy 'at' h:mm a\");\n }\n }\n \n }\n \n }", "function checkDuplicates(args) {\n const check = {}\n\n for (let val of args) {\n check[val] = (check[val] || 0) + 1\n }\n\n for (let key in check) {\n if (check[key] > 1) return true\n }\n\n return false\n}", "function isDuplicates (alphabet) {\n let array = [];\n for (let i = 0; i < alphabet.length; i++) {\n if (array.includes (alphabet[i])) {\n return true;\n }\n array.push (alphabet[i]);\n }\n return false;\n }", "function chkAns(){\n\tif(usrGss % 1 !== 0){\n\t\t//feedback when your user uses only text chars not number\n\t\t$(\"#newFdbk\").text(\"please input only numbers\");\n\t\treturn true;\n\t}\n\tif(usrGss < 0 || usrGss > 101){\n\t\t//feedback to the user if they use numbers beyond 100 o negative numbers\n\t\t$(\"#newFdbk\").text('Try a number between 0 and 100');\n\t\treturn true;\n\t}\n\tif(gssHsty.length > 0){\n\t\t$.each(gssHsty,function(guess,value){//loop through the entire guess history array to look for any number that has been repated by the user guess\n\t\t\tif(usrGss == value){//compare the equality of each value in the array\n\t\t\t\tgssed = true;//set taht guessed value to true\n\t\t\t}\n\t\t}); \n\t}\n\tif(gssed){//here we evaluate the guessed number previusly found as a repeated number input by the user\n\t\tgssed = false;\n\t\t//if the user repeats any number, they will get this feedback\n\t\t$(\"#newFdbk\").text('You already used this number');\n\t\treturn true;\n\t}\nreturn false;\n}", "submitWord(event) {\n event.preventDefault();\n let word = document.getElementById('inputBox').value.toLowerCase();\n document.getElementById('inputBox').value = '';\n if(/^[a-zA-Z]+$/.test(word)) {\n let submittedWords = this.state.submittedWords;\n if (!submittedWords.includes(word)) {\n answer(word);\n }\n }\n }", "function isDuplicate(str) {\n for (i = 0; i < guessesSoFarArray.length; i++) {\n if (str === guessesSoFarArray[i]) {\n return true;\n } else { }\n } // end of for loop\n return false;\n} // end of isDuplicate()", "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}" ]
[ "0.6776648", "0.67727125", "0.66299736", "0.64909345", "0.62932765", "0.62074447", "0.61125845", "0.61001307", "0.6071562", "0.6062199", "0.6048642", "0.5961513", "0.59330827", "0.59151876", "0.5910981", "0.5858354", "0.58479273", "0.58370197", "0.5829865", "0.58098704", "0.57894814", "0.577449", "0.5748707", "0.5742362", "0.5735819", "0.572044", "0.5695264", "0.5693701", "0.5689143", "0.56772125", "0.5675341", "0.56751996", "0.56732976", "0.5665424", "0.5658478", "0.5655355", "0.5655355", "0.5655355", "0.5655355", "0.5655355", "0.5655355", "0.5650393", "0.56454456", "0.5632972", "0.5629295", "0.56286573", "0.56095225", "0.5609218", "0.56085", "0.5604083", "0.5599149", "0.559753", "0.5587143", "0.55821866", "0.5578315", "0.5575688", "0.5560459", "0.5558458", "0.5557009", "0.5556425", "0.55512094", "0.5547732", "0.5547191", "0.55363953", "0.553545", "0.55337113", "0.5528192", "0.5524857", "0.5522517", "0.55121654", "0.5494889", "0.5481663", "0.54797167", "0.5478386", "0.5476596", "0.5470685", "0.5467913", "0.5466791", "0.54597807", "0.54597807", "0.54582435", "0.5456269", "0.5444514", "0.54408574", "0.543818", "0.54371667", "0.5437087", "0.5437069", "0.5435257", "0.54322916", "0.54293406", "0.5428722", "0.54264706", "0.542628", "0.542251", "0.5415247", "0.5413435", "0.54026014", "0.54004085", "0.5400377", "0.5399994" ]
0.0
-1
displays the word at end of game
function displayWord(hangmanWord) { var showWord = ""; for (var i = 0; i < hangmanWord.correctLettersGuessed.length; i++) { showWord += hangmanWord.correctLettersGuessed[i].letterGuessed; } return showWord; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function DisplayWord() {\n\tvar wordToPrint : String;\n\tvar hWord : GameObject;\n\t//var offset : float;\n\tswitch(this.kana) {\n\t\tcase \"a\":\n\t\t\twordToPrint = \"あ り\";\n\t\tbreak;\n\t\t\n\t\tcase \"i\":\n\t\t\twordToPrint = \"い な ず ま\";\n\t\tbreak;\n\t\t\n\t\tcase \"u\":\n\t\t\twordToPrint = \"う さ ぎ\";\n\t\tbreak;\n\t\t\t\t\t\n\t\tcase \"e\":\n\t\t\twordToPrint = \"え ん\";\n\t\tbreak;\n\t\t\t\n\t\tcase \"o\":\n\t\t\twordToPrint = \"お す\";\n\t\tbreak;\n\t\t\t\n\t\tcase \"ka\":\n\t\t\twordToPrint = \"か た な\";\n\t\tbreak;\n\t\t\t\n\t\tcase \"ki\":\n\t\t\twordToPrint = \"き り か ぶ\";\n\t\tbreak;\n\t\t\t\n\t\tcase \"ku\":\n\t\t\twordToPrint = \"く さ り\";\n\t\tbreak;\n\t\t\t\n\t\tcase \"ke\":\n\t\t\twordToPrint = \"け る\";\n\t\tbreak;\n\t\t\t\n\t\tcase \"ko\":\n\t\t\twordToPrint = \"こ ぶ し\";\n\t\tbreak;\n\t\t\n\t\tdefault:\n\t\t\t;\n\t\t\t\t\n\t}\n\t//hWord = Instantiate(this.word, this.player.transform.position, Quaternion.identity);\n\t//offset = .005 * wordToPrint.Length;\n\thWord = Instantiate(this.word, new Vector3(0.45, 0.6, -8), Quaternion.identity);\n\thWord.guiText.text = wordToPrint;\n}", "function dashes(){\r\n document.getElementById('word').innerHTML = '';\r\n for (var i = 0; i < guesses.length; i++)\r\n document.getElementById('word').innerHTML += guesses[i] + ' ';\r\n document.getElementById('start').style.visibility = \"hidden\";\r\n}", "function handleText() {\n if (index < text.length) {\n id(\"output\").innerText = \"\";\n let curWord = text[index];\n id(\"output\").innerText = curWord;\n index++;\n } else {\n endGame();\n }\n }", "function showWord(word) {\n var i;\n for (i = 0; i < word.length; i ++) {\n process.stdout.write(word[i]);\n }\n playAgain();\n}", "function displayNextWordFor(objectName){\n\tvar obj = HangMan[objectName];\n\tHangMan.gameReady = true;\n\tobj.word = obj.words[Math.floor(Math.random() * obj.words.length)].toLowerCase();\n\tobj.lives = 10;\n\tobj.guesses = [];\n\tobj.trueg = [];\n\tfor ( i = 0 ; i < obj.word.length ; i++ ){obj.trueg.push('0')};\n\tobj.falseg = [];\n\tloadObject(objectName);\n}", "function displayWord(word, words, firstRound) {\n\t\tconsole.log(\"currWord: \" + word);\n\t\tdocument.getElementById(\"currWord\").innerHTML = word;\n\t\tvar currChar = 0;\n\n\t\tvar wordLength = word.length;\n\n\t\t$('#currWord').on('click', function() {\n\t\t\tif (firstRound) {\n\t\t\t\t$('#typeDummy').toggleClass('highlight');\n\t\t\t}\n\t\t})\n\n\t\t//when the user types a key\n\t\tdocument.onkeypress = function(evt) {\n\t\t\tif (!gameOver) {\n\t\t\t\tif (evt.keyCode == 8) {\n\t\t\t\t \tevt.preventDefault();\n\t\t\t\t}\t\t\n\t\t\t evt = evt || window.event;\n\t\t\t var charCode = evt.which || evt.keyCode;\n\t\t\t var charTyped = String.fromCharCode(charCode);\n\n\t\t\t if ((charCode == 39) || (charCode <= 122 && charCode >= 97)) {\n\t\t\t\t if (charCode == word.charCodeAt(currChar)) {\n\t\t\t\t \tcurrChar++;\n\t\t\t\t \tdocument.getElementById(\"currWord\").innerHTML = \"<span class='typed'>\"\n\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t + word.substring(0,currChar) + \"</span>\"\n\t\t\t\t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t + word.substring(currChar, wordLength);\n\t\t\t\t } else {\n\t\t\t\t \tmistakeCount++;\n\t\t\t\t \tif (mistakeCount < 8) {\n\t\t\t\t\t \t$(\"#misses\").html( $(\"#misses\").html() + \"X\" );\n\t\t\t\t \t} else {\n\t\t\t\t \t\t$(\"#misses\").html(mistakeCount);\n\t\t\t\t \t}\n\t\t\t\t }\n\t\t \t}\n\n\t\t \t//once the user has fully typed the word\n\t\t\t if (currChar == wordLength) {\n\t\t\t \tif (firstRound) {\n\t\t\t \t\tstartGame();\n\t\t\t \t} else {\n\t\t\t \t\twordCount++;\n\t\t\t \t\trando = words[Math.floor(Math.random() * words.length)];\n\t\t\t \t\tdisplayWord(rando, words, false);\n\t\t\t \t}\n\t\t\t }\n\t\t }\n\t\t};\n\t}", "function final(any) {\n element.wordGuess.textContent = string[any]; // will show win or lose string property\n sound[any].play(); //will play win or lose sound\n score[any]++; //will increment win or lose score\n update(); \n setTimeout(function () { //timer so that you can enjoy the music and strings\n reset();\n }, 2000);\n }", "function displayWord(myword, desc){\r\n let display = \"\";\r\n for(let i = 0; i < myword.length; i++){\r\n if(i != myword.length - 1){\r\n display += myword.charAt(i) + \" \";\r\n } else {\r\n display += myword.charAt(i);\r\n }\r\n }\r\n document.getElementById(\"display\").innerHTML = display;\r\n document.getElementById(\"desc\").innerHTML = desc;\r\n}", "function Display(){\n document.getElementById(\"wins\").textContent = countWins;\n document.getElementById(\"dispWord\").textContent = dispWord;\n document.getElementById(\"guessesLeft\").textContent = 12 - countGuesses;\n document.getElementById(\"lettersGuessed\").textContent = lettersGuessed;\n console.log(\"Random word is: \" + guessWord);\n}", "function endWord() {\n var stringDisplay = \"\"\n globalList.forEach(function(item){\n stringDisplay += item\n document.querySelector(\"#applyGuess\").innerHTML = stringDisplay.toUpperCase()\n document.querySelector(\"#endWord\").innerHTML = \"Word Was:\"\n })\n}", "function reveal(guess) {\n for (var z = 0; z < word.length; z++) {\n if (word[z] == guess) {\n context.fillText(word[z], (100 + (z * 20)), 490);\n lettersRemaining--;\n console.log(\"reveal: \" + lettersRemaining);\n }\n }\n }", "function showWord(words)\r\n{\r\n\t//generate random array index\r\n\tconst randIndex=Math.floor(Math.random() * words.length);\r\n\t//output random word\r\n\tcurrentWord.innerHTML=words[randIndex];\r\n}", "function showword(words){\n const randindex = Math.floor(Math.random() * words.length);\n\n //output random word\n currentword.innerHTML = words[randindex];\n}", "function displayLetter(myword, letter, word){ // by jaguar\r\n let display = \"\";\r\n let mywordarr = myword.split(\"\")\r\n for(let i = 0; i < myword.length; i++){\r\n if(i != myword.length){\r\n if(letter === word.charAt(i)){\r\n display = display + letter + \" \";\r\n mywordarr[i] = letter\r\n } else {\r\n display += myword.charAt(i) + \" \";\r\n }\r\n } else {\r\n display += myword.charAt(i);\r\n }\r\n }\r\n displayed = mywordarr.join(\"\")\r\n document.getElementById(\"display\").innerHTML = display;\r\n checkWincondition(display, word)\r\n}", "function updateDisplay(wordArray, midGame) {\n // let wordJoin = wordArray.join(\" \");\n document.getElementById(\"guess-word\").innerHTML = wordArray.join(\" \");\n if (midGame !== undefined) {\n document.getElementById(\"letters-guessed\").innerHTML = \"Letters guessed: \" + midGame.join(\", \");\n document.getElementById(\"guess-remain\").innerHTML = \"Guesses left: \" + parseInt(numGuesses - midGame.length);\n document.getElementById(\"hangman-graphic\").innerHTML = hangdood[midGame.length];\n }\n else {\n document.getElementById(\"letters-guessed\").innerHTML = \"Letters guessed: \";\n document.getElementById(\"guess-remain\").innerHTML = \"Guesses left: \" + numGuesses;\n }\n }", "function renderNewWord() {\n\n // random word generator\n var random = Math.floor(Math.random() * wordLength.length);\n\n // get a random word and clear the string display\n let word = wordLength[random];\n wordDisplayString.innerHTML = \"\";\n\n // for each character in the word array create a 1 char span\n word.split(\"\").forEach(character => {\n const characterSpan = document.createElement(\"span\");\n characterSpan.innerText = character;\n wordDisplayString.appendChild(characterSpan);\n })\n\n // set input to null and focus it\n wordInput.value = null;\n wordInput.focus();\n }", "function showWord(words) {\r\n const randIndex = Math.floor(Math.random() * words.length);\r\n currentWord.innerHTML = words[randIndex];\r\n }", "displayWordInfo() {\r\n this.displayHangman();\r\n this.displayLives();\r\n this.displayLetters();\r\n this.displayLettersToGuess();\r\n }", "function showWord(words) {\n const randIndex = Math.floor(Math.random() * words.length);\n currentWord.innerHTML = words[randIndex];\n}", "function displayNextLevel() {\r\n getWord(level);\r\n encryptGameWord();\r\n writeEncryptedWord();\r\n writeGameInfo();\r\n toggleGameElements();\r\n startTimer(80);\r\n $(\"#user-word\").focus();\r\n }", "function renderGame() {\n // Set a random word\n randomNumber = Math.floor(Math.random() * 21); \n currentWord = wordArray[randomNumber][0];\n console.log(\"currentWord\", currentWord);\n\n if (currentWord.length < 8) {\n guessesLeft = currentWord.length + 3;\n // console.log(\"guessesLeft\", guessesLeft);\n } else {\n guessesLeft = 8;\n }\n\n lettersGuessed = [];\n // console.log(\"lettersGuessed\", lettersGuessed);\n dashArr = [];\n\n\n\n\n splitArr = currentWord.toLowerCase().split('');\n // console.log(\"splitArr\", splitArr);\n\n // Check the length of word and render dashes\n // Check for spaces\n splitArr.map(index => {\n if (index === \" \") {\n dashArr.push(' ');\n }\n\n else {\n dashArr.push('-');\n }\n })\n\n // console.log(\"dashArr\", dashArr);\n\n displayWord = dashArr.join('');\n\n // console.log(\"displayWord\", displayWord);\n\n document.querySelector(\"#display-word\").innerHTML = displayWord.toUpperCase();\n document.querySelector(\"#display-wins\").innerHTML = wins;\n document.querySelector(\"#display-losses\").innerHTML = losses;\n document.querySelector(\"#display-guesses-left\").innerHTML = guessesLeft;\n document.querySelector(\"#display-image\").src = \"./assets/images/finnandjake.png\";\n document.querySelector(\"#display-letters-guessed\").innerHTML = lettersGuessed;\n document.querySelector(\"#instructions\").innerHTML = \"Guess A Letter To Get Started!\" ;\n\n\n\n}", "function endWin(word) {\n console.log(\"You win. The word was:\");\n showWord(word);\n}", "function hangman(){\n var x = word.length;\n var y = x-1;\n var spaces = 0;\n while (x>0){\n numChar++;\n var letter = word.substring(y,x);\n if(letter === \" \"){\n document.getElementById('letter'+x).innerHTML = \"&nbsp;\";\n document.getElementById('letter'+x).style.visibility = \"hidden\";\n document.getElementById('letter'+x).style.display = \"block\";\n document.getElementById('underline'+x).style.display = \"block\";\n spaces++;\n }\n else{\n document.getElementById('letter'+x).innerHTML = letter;\n document.getElementById('letter'+x).style.visibility = \"hidden\";\n document.getElementById('underline'+x).style.display = \"block\"; \n document.getElementById('underline'+x).style.borderBottom = \"3px solid white\";\n }\n x--;\n y--;\n }\n wordLength = word.length - spaces;\n document.getElementById('gamePage').style.display = \"block\";\n\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 showText() {\n $(\"#textDisplay\").empty();\n $(\"#instructions\").empty();\n randomWords = [];\n for (var i = 0; i < wordCount; i++) {\n var ranWord = wordList[Math.floor(Math.random() * wordList.length)];\n if (wordList[wordList.length - 1] !== ranWord || wordList[wordList.length - 1] === undefined) {\n randomWords.push(ranWord);\n }\n }\n randomWords.forEach(function(word){\n $(\"#textDisplay\").append($(\"<span>\",{\"text\": word + \" \",\"class\":\"word\"}));\n });\n textDisplay.firstChild.classList.add(\"highlightedWord\")\n }", "function showWord(words) {\n // Generate random array index\n const randIndex = Math.floor(Math.random() * words.length);\n // Output the random word\n currentWord.innerHTML = words[randIndex];\n}", "function currentWordDisplay() {\n var activeCharacterDisplay = document.querySelector(\"#activeCharacterDisplay\");\n activeCharacterDisplay.textContent = answerArray.join(\" \");\n}", "function showWord(words){\r\n// generate random array index//\r\nconst randIndex =math.floor(math.random() * words.length);\r\n// output random words//\r\ncurrentWord.innerHTML = words[randIndex];\r\n}", "function right() {\r\n //if guess is correct\r\n //keep checking if to see if there is another space for the same letter\r\n for (var j = 0; j < underScore.length; j++) {\r\n if (word[j] === guess) {\r\n underScore[j] = guess;\r\n var blank = \"<p>\" + underScore.join(\" \") + \"</p>\";\r\n document.getElementById(\"blank\").innerHTML = blank;\r\n }\r\n //hide and show you win div\r\n if (underScore.join(\"\") === word) {\r\n winMessage.show();\r\n direct.hide();\r\n }\r\n }\r\n}", "function displayLetters(guess){\n\t\tfor (var i=0;i<randomWord.length;i++){\n\t\t\tif (guess == randomWord[i]){\n\t\t\t\t$(\"#\"+randomWord[i]).html(guess);\n\t\t\t\tcounter += 1;\n\t\t\tif (counter == randomWord.length){\n\t\t\t\tdisplayImage();\n\t\t\t\tdisplayWins();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}", "function showWord() {\r\n // Generate random index\r\n const randIndex = Math.floor(Math.random() * 274918);\r\n // Output a random word\r\n setTimeout(() => {currentWord.innerHTML = words[0][randIndex]}, 200)\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 lose() {\n gameEnd.css('display', 'block');\n endParagraph.html(`Being eaten alive by the bugs probably hurt. You gathered ${points} ${points == 1 ? 'point' : 'points'} before that happened.`);\n}", "function underline(){\r\n\r\n underscore = [];\r\n for(let i=0;i<theWord.length;i++){\r\n underscore.push('_');\r\n }\r\n document.getElementById('wordToGuess').textContent= underscore.join(\" \");\r\n\r\n document.getElementById('lives').textContent=guesslift;\r\n}", "playAnotherRound() {\n this.displayGuess();\n console.log(this.displayedWord);\n console.log(\"\");\n\n this.playRound();\n }", "function showGameOver() {\n textSize(32);\n textAlign(CENTER, CENTER);\n var gameOverText = \"GAME OVER\\n\";\n gameOverText += \"you ded.\"\n text(gameOverText, width / 2, 50);\n}", "function showWord(words){\r\n //Generate random array Index\r\n const randIndex=Math.floor(Math.random()*words.length);\r\n //Output random word\r\n currentWord.innerHTML=words[randIndex];\r\n}", "function showWord(words){\n // generate random Array Index\n const randIndex = Math.floor(Math.random() * words.length);\n // output random word\n currentWord.innerHTML = words[randIndex].toUpperCase();\n \n}", "function showWord(words){\r\n const randIndex = Math.floor(Math.random()*words.length);\r\n currentWord.innerHTML = words[randIndex];\r\n}", "function showWord(words) {\n // Generate random array index\n const randIndex = Math.floor(Math.random() * words.length);\n // Output random word\n currentWord.innerHTML = words[randIndex];\n}", "function print(){\n\tdocument.getElementById(\"game-count\").innerHTML = gameCount;\n\tdocument.getElementById(\"win-count\").innerHTML = winCount;\n\tdocument.getElementById(\"loss-count\").innerHTML = lossCount;\n\tdocument.getElementById(\"guess-remaining\").innerHTML = guessesRemaining;\n\tdocument.getElementById(\"word\").innerHTML = currentWord.join(\" \");\n\tdocument.getElementById(\"letter-guessed\").innerHTML = lettersGuessed.join(\" \");\n}", "function final() {\n character.say(\"Good, thank you!\")\n var win = Scene.createTextBillboard(0, 5, 3);\n win.setText(\"Awesome job!\");\n }", "function answerCheck() {\n\tgameWordDisplay = \"\"; \n\n//loops through the game word \nfor (var i = 0; i < gameWord.length; i++) {\n\n\t//check the letters guessed by the user agains each position of the game word\n\tif (guessedLetters.includes(gameWord.charAt(i))) {\n\n\t\t//if the letter is there, displays it at the position\n\t\tgameWordDisplay += gameWord.charAt(i);\n\t\t//if not, replaces the display with _ _ _\n\t} else {\n\t\tgameWordDisplay += \"_\";\n\n\t}\n}\n}", "function showWord(letter) {\n\n console.log(chosenWord);\n // Check if current letter exists\n for (var i = 0; i < chosenWord.length; i++) {\n // If the letter exists, display it on screen\n if (chosenWord[i].toLowerCase() === letter) {\n hideWord[i] = letter;\n hidden.innerHTML = hideWord.join(\"\");\n }\n }\n\n // If the letter doesn't exist, decrement the guess counter\n if (!chosenWord.includes(letter)) {\n startingGuesses--;\n guesses.innerHTML = startingGuesses;\n\n // If there are no remaining guesses, show the word on screen\n if (startingGuesses === 0) {\n losses++;\n alert(\"game over\");\n hidden.innerHTML = chosenWord;\n //gameInitalLoad();\n }\n // If all of the letters have been guessed, increment wins by 1\n else if (!hideWord.includes(\"-\") && guesses > 0) {\n wins++;\n var showWins = document.getElementById(\"wins\");\n showWins.innerHTML = wins;\n }\n }\n}", "function updateDisplay() {\n\n document.getElementById(\"totalWins\").innerText = wins;\n document.getElementById(\"totalLosses\").innerText = losses;\n\n // Display how much of the word we've already guessed on screen.\n var guessWordText = \"\";\n for (var i = 0; i < guessWord.length; i++) {\n guessWordText += guessWord[i];\n }\n\n //\n document.getElementById(\"currentWord\").innerText = guessWordText;\n document.getElementById(\"lifePoints\").innerText = lifePoints;\n document.getElementById(\"guessedLetters\").innerText = guessedLetters;\n}", "displayLetters() {\r\n let wordHidden = \"\\n\";\r\n for (let i = 0; i < this.text.length; i++) {\r\n if (this.lettersToGuess.includes(this.text.charAt(i))) {\r\n wordHidden += HangmanUtils.symbol;\r\n }\r\n else {\r\n wordHidden += this.text.charAt(i);\r\n }\r\n wordHidden += \" \";\r\n }\r\n console.log(wordHidden);\r\n }", "function displayGame() {\n getAnimal();\n animalType.innerHTML = gameAnimalType;\n animalToGuess.innerHTML = handleGameWord(gameAnimalExample);\n document.getElementById(\"guess\").focus();\n document.getElementById(\"guess\").select();\n wordWrapper.classList.remove(\"vis-hidden\");\n }", "function newGame() {\n gameStart = true\n clearOut();\n ransomdomize();\n createSpan();\n \n //console.log(chosenWord); //CHEAT -- GET THE ANSWERS IN CONCOLE\n \n}", "function clock() {\n timeElapsed = timeElapsed + letterTime;\n if (!flipped) {\n lettersShow = lettersShow + 1;\n flipped = (lettersShow >= currentWord.length)\n }else{\n if ( ((wordTime - timeElapsed)/letterTime) < currentWord.length ) {\n lettersShow = lettersShow - 1;\n \n if (lettersShow == 0) {\n flipped = false;\n timeElapsed = 0;\n changeWord();\n }\n }\n }\n\n $('#anim-text').text(function(i,t) {\n return currentWord.substr(0,lettersShow);\n })\n }", "function printToPage(randomWord) {\n myWord = randomWord.word;\n // concatenate array to Str for printing on one line\n var myStr = '';\n console.log(myWord);\n for (var i = 0; i < myWord.length; i++){\n if (correctGuesses.includes(myWord[i])) {\n myStr += (\" \" + myWord[i] + \" \");\n }\n else {\n myStr += (\" _ \");\n }\n };\n console.log('\\n' + myStr + '\\n');\n if (correctGuesses.length == myWord.length) {\n console.log(\"GG bro\");\n }\n else {\n promptUser();\n };\n \n}", "function draw() {\n if (lives <= 0) {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n ctx.font = \"60px Arial\";\n ctx.fillStyle = \"red\";\n ctx.fillText(\"Game Over\", position, canvas.height / 2);\n return;\n }\n\n /* user type in the word that is being display */\n\n let typeWord = wordInput.value.toLowerCase();\n ctx.clearRect(0, 0, 400, 400);\n movingBackground();\n wordFalls();\n score();\n lifeLine();\n if (typeWord === wordArr[randomIndex]) {\n projectile();\n }\n window.requestAnimationFrame(draw);\n }", "function renderGame() {\n // If there are still more words in the array, set the display and write it to the page\n if (currentIndex <= (secretWords.length - 1)) {\n secretWord = secretWords[currentIndex];\n display = repeatChar(secretWord.length, '_');\n tries = 0;\n document.querySelector(\"#progress\").innerHTML = \"Guess the bread: \" + display;\n document.querySelector(\"#wins\").innerHTML = \"Total Wins: \" + wins;\n }\n // If the supply of breads has been exhausted, render the end game screen.\n else {\n document.querySelector(\"#progress\").innerHTML = \"Game Over!\";\n document.querySelector(\"#results\").innerHTML = \"Refresh the page to play again.\";\n document.querySelector(\"#wins\").innerHTML = \"Total Wins: \" + wins;\n }\n}", "function showWord(words){\n\n //Generate randow array index\n const randIndex = Math.floor(Math.random() *words.length);\n //Output random word\n currentWord.innerHTML=words[randIndex];\n}", "function game() {\n //hide words\n //$(\".fiveWords\").hide(); //removed because the letters need to show when new game starts\n \n //move words --alec\n myMove(\"1\");\n myMove(\"2\");\n myMove(\"3\");\n myMove(\"4\");\n myMove(\"5\");\n \n}", "function displayEndScreen() {\n //display image\n image(imgEndScreen, 0, 0, windowWidth, windowWidth * 0.4);\n //Set text size in push-pop\n push();\n textSize(19);\n //If player hits zero kids, display this\n if (player.sentence === 0) {\n text(\"It took you only \" + player.timeSpent + \" hours and you did it \\nwithout bumping into children! \\nAmazing job, Hieronymous! Back to \\nloitering!\", 0 + windowWidth / 20, windowWidth / 5);\n //If player hits less than three kids, display this\n } else if (player.sentence < 107) {\n text(\"It took you only \" + player.timeSpent + \" hours \\nand you only added \" + player.sentence + \" days \\n to your community service!\", 0 + windowWidth / 20, windowWidth / 5);\n } else {\n //otherwise, display this message\n text(\"It took you \" + player.timeSpent + \" hours... \\n...but holy crap Hieronymous you added \" + player.sentence + \" days \\nto your community service. Embarrassing.\", 0 + windowWidth / 20, windowWidth / 5);\n }\n pop();\n\n}", "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 showNewWord(){\n// document.getElementById(\"wordToType\").innerHTML=\" \";\n $(\"#wordBox\").val(\"\");\n// $(\"#wordToType\").html(words[index][0]);\n if (words.length === alreadyUsed.length){\n endGame();\n }\n console.log(\"choosing word\");\n chooseWord();\n document.getElementById(\"wordToType\").innerHTML= words[index][0];\n\n }", "function startGame(){\r\n\t \r\n\t let dumDumDum = [];\r\n\t for( iii=0; iii < randomWord.length ; iii++){\t\t\t\r\n\t\t\tdumDumDum.push(\"_\");\r\n\t } \r\n\t// Change the game textcontents to starting values\r\n\tdocument.querySelector(\".the_word\").innerHTML =\"The word: \"+dumDumDum+\" \";\r\n\tdocument.querySelector(\".guesses\").innerHTML =\"Guesses: \";\r\n\tdocument.querySelector(\".guesses_left\").innerHTML =\"Wrong guesses left: \"+livesLeft+\" \"; \t \r\n }", "drawSecretWord() {\n ctx.clearRect(0,canvas.height-40,canvas.width,40)\n GAME.secretWord.includes(PLAYER.guess) ? PLAYER.guessStatus = true : PLAYER.guessStatus = false\n for (let i = 0; i < GAME.secretWord.length; i++) {\n const element = GAME.secretWord[i];\n if(str_replace(from,to,element) === PLAYER.guess) {\n PLAYER.guessStatus = true\n GAME.answerArray[i] = element\n }\n let x = (canvas.width - ((GAME.secretWord.length * 24) + ((GAME.secretWord.length - 1) * 4))) + (i * (24 + 4))\n ctx.beginPath()\n ctx.font = \"32px calibri\"\n ctx.fillText(GAME.answerArray[i], x, canvas.height - 6)\n ctx.closePath()\n }\n }", "function displayGameOver() {\n push();\n textAlign(CENTER,CENTER);\n textSize(60);\n fill(0,0,0);\n stroke(255,0,0);\n textFont(fontGame);\n text(\"Your artistic experience is terminated \\n sorry Warhol \\n \\n REFRESH to play again :)\",width/2,height/2);\n pop();\n}", "function startGame() {\n // Randomly selecting a word from our array\n wordUsedForGame = hangManWordChoices[Math.floor(Math.random() * hangManWordChoices.length)];\n // creating a new word object with the random word\n wordConstructed = new Word(wordUsedForGame);\n // calling the renderWord function to push the letters into the word\n wordConstructed.renderWord();\n\n console.log(\"\\n\");\n console.log(\"Guess The Word. You have 7 chances to get it Right!!!\");\n console.log(\" Hint: The Words are computer Languages \\n\");\n\n // Displaying the dashes based on the word selected using the Word display function \n // they will be dashes because the guessed is set to false\n console.log(wordConstructed.display());\n console.log(\"\\n\");\n\n // calling askLetters to run the game\n askLetters();\n\n\n}", "function startGame() {\n wrongGuesses = ' ';\n allGuesses = \"\";\n currentDisplay = [];\n //Randomly selects a word from the array wordList\n wordString = (wordList[Math.floor(Math.random() * wordList.length)]).toUpperCase(); \n // Put the selected word into an array\n word = wordString.split(''); \n guessRemain = wordString.length; \n for (var i = 0; i < guessRemain; i++){\n currentDisplay[i] = \"_\"; \n //displays the game\n }\n displayGame(); \n }", "function startGame() {\n renderNewWord();\n startBar();\n }", "function wordplay() {\n librarycall()\n play = new Word(choice);\n plays = 10\n alphaArr = [\"a\", \"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n omegaArr = []\n console.log(play.fullDisplay());\n console.log(\"Tries left = \" + plays);\n testletter()\n}", "function stepWord() {\n word++;\n syllable = 0;\n process.stdout.write(\" \");\n}", "function start()\n{\ndocument.getElementById(\"two\").style.marginTop=\"20%\";\n\nvar x = Math.floor((Math.random() * 25) + 1); // to display the fist word and this word will change after every 3 second...\n\ndocument.getElementById(\"two\").innerHTML =obj.spellings[x].word;\n\nsetInterval(function() {game()},4000); // changing word after every 3 se....\n}", "function endLose(word) {\n console.log(\"You lose. The word was:\");\n showWord(word);\n}", "function draw() {\n\n noStroke();\n fill(255);\n var extraSpace = 0;//The words have its own length , so it needs to be offset to the right \n // i MEANS THE FIRST LETTER OF THE sentence \n\n for (let i = 0; i < words.length; i++) {\n // appearing over time...\n //note that canvas Is loading 60 times per second which means if the first letter is 1 then when francount reaches and goes beyond 1*100 the first word get pirnted \n\n if (frameCount > i * 100) {\n var wordMarginLeft = 30 * i; //The distance of each word is 30 // letters got print with the distance of 30 \n \n if (i > 0) {\n extraSpace = extraSpace + words[i - 1].length * 13; //we need to add extra space in letters and it's caculated by the length of the letters\n }\n fill(255);\n text(words[i], wordMarginLeft + extraSpace, 20);\n }\n }\n \n \n}", "function drawHangman() {\n}", "function updateDisplay() {\n document.getElementById(\"totalWins\").innerText = wins;\n document.getElementById(\"currentWord\").innerText = \"\";\n\n for (let i = 0; i < guessingWord.length; i++) {\n document.getElementById(\"currentWord\").innerText += guessingWord[i];\n }\n document.getElementById(\"remainingGuesses\").innerText = remainingGuesses;\n document.getElementById(\"guessedLetters\").innerText = guessedLetters;\n if (remainingGuesses <= 0) {\n document.getElementById(\"gameover-image\").style.cssText = \"display: block\";\n document.getElementById(\"pressKeyTryAgain\").style.cssText =\n \"display: block\";\n hasFinished = true;\n }\n}", "function gameStart() {\n resetCounters();\n generateRandomWord();\n hideTheWord(); \n document.getElementById(\"guesses\").innerHTML = guessesLeft;\n // Make variable to track letters to be guessed\n var lettersLeft = randWord.length;\n console.log(randWord);\n\n setupKeyLogging();\n \n document.getElementById(\"wins\").innerHTML = wins;\n \n \n\n\n removeHandler(); \n}", "function writeWord(){\n var letterOrDash = \"\";\n var allLettersGuessed = true;\n\n for(var i=0; i<randWord.length; i++){\n if(guesses.includes(randWord.charAt(i))){\n letterOrDash += randWord.charAt(i) + \" \";\n }\n else{\n letterOrDash += \"_ \";\n allLettersGuessed = false;\n }\n\n document.getElementById(\"writeWord\").innerHTML = letterOrDash;\n }\n\n if (allLettersGuessed === true){\n win++;\n endGame(true);\n\n }\n}", "function display1()\n\t{\n\t\tdocument.getElementById(\"score\").innerHTML = Underscores.join(' ');\n\t\tdocument.getElementById(\"left\").innerHTML =(\"you have \" + guessesleft + \" guesses left\");\n\t\tdocument.getElementById(\"lettersguessed\").innerHTML = wrongguess;\n\t}", "function showWord(words){\n //get random index of array\n const randIndex = Math.floor(Math.random() * words.length);\n //Output random word\n currentWord.innerHTML = words[randIndex];\n}", "function show(){\n\tconsole.log(\"Wins \" + wins);\n\tconsole.log(\"Losses \" + losses);\n\tconsole.log(\"Guesses left \" + guessLeft);\n\tconsole.log(newWord.displayValue());\n\tconsole.log(letterArray);\n}", "function refresh(){\n\t\n\t// clears upper text are\n\tdocument.getElementById(\"hangmanTextUpper\").textContent = \"\";\n\t\n\t// displays the current state of hiddenLetters\n\tfor(var i = 0; i < randomWord.length; i++){\n\n\t\tdocument.getElementById(\"hangmanTextUpper\").textContent += hiddenLetters[i];\n\n\t}\n}", "function textOnScreen() {\n createP('Refresh The Page To Reset');\n createP('Press W to Remove Obstacles');\n createP('Press Q To Increase Number of Obstacles');\n }", "showMatchedLetter(letter){\r\n $(letter).addClass('show');\r\n // display the char of the corresponding letters check if game is won\r\n }", "function showVariables(word, found, pActual, score, time){\n wordText.destroy();\n wordFoundText.destroy();\n //palabraActualText.destroy();\n\n scorePalabrasText.destroy();\n\n timerTextPalabras.destroy();\n\n wordText = game.add.text(rectBGwords.x + rectBGwords.width/2, 150 + rectBGwords.y + rectBGwords.height/2, addSpaces(word, pActual), {\n fontSize: '20pt',\n font: font_time\n });\n //wordText.fixedToCamera = true;\n wordText.anchor.setTo(0.5, 0.5);\n wordText.stroke = '#000000';\n wordText.strokeThickness = 8;\n wordText.fill = '#ffffff';\n\n wordFoundText = game.add.text(150, 70, found, {\n fontSize: '20pt',\n font: font_time\n });\n wordFoundText.fixedToCamera = true;\n wordFoundText.anchor.setTo(0.5, 0.5);\n wordFoundText.stroke = '#000000';\n wordFoundText.strokeThickness = 8;\n wordFoundText.fill = '#ffffff';\n\n //palabraActualText = game.add.text(30, 90, \"Palabra actual: \" + pActual, {fill:'#000000'});\n //palabraActualText.fixedToCamera = true;\n // We don't want to show the answer\n \n timerTextPalabras = game.add.text(STAGE_WIDTH - 70, 50, String(time).padStart(2, \"0\"), {\n fontSize: '20pt',\n font: font_time\n });\n timerTextPalabras.fixedToCamera = true;\n timerTextPalabras.anchor.setTo(0.5, 0);\n timerTextPalabras.stroke = '#000000';\n timerTextPalabras.strokeThickness = 8;\n timerTextPalabras.fill = '#ffffff';\n\n\n scorePalabrasText = game.add.text(STAGE_WIDTH/2, 50, score, {\n fontSize: '20pt',\n font: font_time\n });\n scorePalabrasText.fixedToCamera = true;\n scorePalabrasText.anchor.setTo(0.5, 0);\n scorePalabrasText.stroke = '#000000';\n scorePalabrasText.strokeThickness = 8;\n scorePalabrasText.fill = '#ffffff';\n\n}", "function showWord() {\n wordCounter++;\n $('#meaning').val('').focus();\n $('#lemma').html(word.lemma);\n $('#triesAmt').html(wordCounter);\n\n setTimeout(function () { $('#hint').html('*****'); }, 500);\n}", "function endGame() {\n setShouldStart(false)\n setWordCount(countWords(text))\n }", "function displaySelectedWord() {\n word.innerHTML = `\n ${selectedWord\n .split('')\n .map(\n letter => `\n <span class=\"letter\">\n ${correctLetters.includes(letter) ? letter : '' }\n </span>\n `\n )\n .join('')\n }\n `;\n // TO check -> console.log(word.innerText);\n // To chack -> console.log(wordText);\n const wordText = word.innerText.replace(/\\n/g, '');\n if(wordText === selectedWord) {\n message.innerText = 'You Won!';\n popup.style.display = 'flex';\n }\n}", "function renderEndGameText() {\n gameBackground.zIndex = 45;\n sortZindex(gameScreen);\n longBoard.visible = true;\n endText.visible = true;\n endText.speed = END_TEXT_SPEED;\n endGameSelected = true;\n}", "function displayWord() {\n wordElement.innerHTML = \n `${selectedWord\n .split('')\n .map(letter =>\n `<span class='letter'>\n ${correctLetters.includes(letter) ? letter : ''}\n </span>`\n ).join('')}`;\n \n //console.log(wordElement.innerText);\n \n //Remove New Line Character \n const innerWord = wordElement.innerText.replace(/\\n/g, '')\n //console.log(innerWord); \n\n if (innerWord === selectedWord) {\n finalMessage.innerText = 'You Won!';\n popUp.style.display = 'flex';\n }\n}", "function displayWord(array){\n word = array[Math.floor(Math.random() * array.length)];\n var display = document.getElementById(\"display\");\n display.innerText = word;\n}", "function gameOver() {\n background(0);\n fill(255, 0, 0);\n textFont(myFont, 80);\n textAlign(CENTER);\n text(\"LOSER\", 400, 200);\n textSize(32);\n text(\"HAVING DRANK ALL THE WATER, OR ATTEMPTED TO SHARE IT,\", 400, 270);\n text(\"YOU HAVE DONE THE WRONG THING!\", 400, 285);\n text(\"THE DUTIFUL THING WOULD HAVE BEEN TO GIVE IT\", 400, 300);\n text(\" TO THE DYING PERSON FIRST.\", 400, 315);\n text(\"BETTER LUCK NEXT TIME.\", 400, 330);\n textSize(40);\n text(\"REFRESH THE PAGE TO PLAY AGAIN\", 400, 485);\n}", "startGame() {\r\n $(\"#overlay\").hide();\r\n this.activePhrase = this.getRandomPhrase();\r\n this.activePhrase.addPhraseToDisplay();\r\n }", "function showTheWord() {\n // get random word then store it in the global var theWord\n theWord = getRandomWord().split(''); // make it into array\n\n // place underscore referencing the number of letters\n for (var i = 0; i < theWord.length; i++) {\n $(\"#letterHolder\").append($(\"<span class='theWord' data-letter=\" + theWord[i] + \">_</span>\"));\n }\n }", "function showGameOver() {\n gameSound.pause();\n textSize(60);\n textAlign(CENTER,CENTER);\n fill(243,231,45);\n var gameOverText = \"GAME OVER\\n\";\n gameOverText += \"You caught \" + snitchEaten + \" snitch\\n\";\n gameOverText += \"before you died.\"\n text(gameOverText,width/2,height/2);\n}", "function startGame()\n{\n\t//selects random word\n\ttargetWord = wordBank[Math.floor(Math.random()* wordBank.length)];\n\ttargetWordArray = targetWord.split(\"\");\n\t//transforms word to an array of dashes\n\tfor(i=0; i<targetWord.length; i++)\n\t{\n\t\tdisplayWord.push(\" _ \");\n\t}\n\n\tdocument.getElementById(\"array-box\").innerHTML = displayWord.join(\"\");\n\tdocument.getElementById(\"instruction-box\").innerHTML = \"press any key to guess a letter\";\n\tdocument.getElementById(\"wins\").innerHTML = \"Wins: \" + wins;\n\tdocument.getElementById(\"losses\").innerHTML = \"Losses: \" + losses;\n\tdocument.getElementById(\"remaining-guesses\").innerHTML = \"Guesses Remaing: \" + remainingGuesses;\n\tdocument.getElementById(\"letters-guessed-box\").innerHTML = \"Letters Guessed: \" + wrongLetters;\n}", "function bugTimer() {\nfood = false;\n\nvar wordz = \"YOU HAVE EATEN \" + hungry.full + \" BUGS\" ;\n\nif (hungry.full >=10) {\n wordz+=\"\\n YOU WIN\";\n\n} else {\n wordz+=\"\\n YOU LOSE\";\n}\n words = wordz;\n}", "function newWord(){\n var wordBank = [\"susie\", \"transmogrifier\", \"spacemanspiff\",\"gross\", \"calvinball\", \"stupendousman\", \"tracerbullet\", \"toboggan\", \"duplicator\", \"misswormwood\", \"hamsterhuey\", \"gooeykablooie\"];\n console.log(wordIndex)\n console.log(wordBank.length)\n if(wordIndex >= wordBank.length){\n //changed message board background color to blue\n document.getElementById(\"message-board\").style.backgroundColor = \"#3dbaec\"\n updateField(\"message-text\", \"Aww shucks, we're all out of words <br> You got \"+wins+\" out of \"+wordBank.length+\" right!\");\n return;\n }\n currentWord=wordBank[wordIndex];\n wordDisplay.innerHTML = createDisplay(currentWord);\n //changed message board background color to blue\n document.getElementById(\"message-board\").style.backgroundColor = \"#3dbaec\"\n //upddate message board\n updateField(\"message-text\", \"Next Word!\")\n //resetting parameters\n guessedArray = [\"\"];\n updateLettersGuessedField();\n guessesLeft = 6\n updateField(\"guesses-left\",guessesLeft);\n lettersCorrect = 0;\n //reset stopGame\n stopGame = false; \n}", "function wordGame(){\n\n questions=['Famoso barrio electronico de Tokio','Provincia de catalunya','Se usa en la pesca','Mamifero marino con aspecto amigable','Arma comun usada en la epoca medieval',\n 'Pais del sudeste asiatico','Felino de cuatro patas','Lugar donde pasar la noche','Causa fiebre','Mamifero comun en Africa','Ataque suicida de los pilotos japoneses','Satelite de la tierra',\n 'Planeta cercano al sol del sitema solar','Que hace daño o es perjudicial.','Se usa pra hacer fuego','Mamifero nativo de Malasia e Indonesia','Monumento del antiguo Egypto','Se elabora a partir de leche quajada',\n 'Lectura de composiciones poeticas','Tambien conocida como Russia Asiatica','Herramienta electrica usada en tareas de bricolaje','Criatura mitologica con forma de caballo blanco',\n 'Contiene lava','Reproductor de audio portatil','Instrumento musical de percusion','Web dedicada a compartir videos','Ciencia que estudia los animales']\n \n anwsers=['akihabara','barcelona','cebo','delfin','espada','filipinas','gepardo','hotel','Infeccion','jirafa','kamikaze','luna','Mercurio','nocivo','leña','oranguntan','piramide','queso','recital',\n 'siberia','taladro','unicornio','Volcan','walkman','xilofono','youtube','zoologia']\n \n letters=[\"A\",\"B\",\"C\",\"D\",\"E\",\"F\",\"G\",\"H\",\"I\",\"J\",\"K\",\"L\",\"M\",\"N\",\"Ñ\",\"O\",\"P\",\"Q\",\"R\",\"S\",\"T\",\"U\",\"V\",\"W\",\"X\",\"Y\",\"Z\"]\n\n for(let i=0;i<letters.length;i++){//asi se restarura el color de cada letra asi como su fundo azul\n document.getElementById(letters[i]).style.background=\"#014B94\";\n document.getElementById(letters[i]).style.color=\"white\";\n }\n\n document.getElementById(\"showPregunta\").innerHTML=\"\";\n document.getElementById(\"Respuesta\").innerHTML=\"\";\n document.getElementById(\"nombreJugador\").innerHTML=\"\";\n document.getElementById(\"aciertos\").innerHTML=\"\";\n document.getElementById(\"fallos\").innerHTML=\"\";\n document.getElementById(\"showValue\").innerHTML=\"\";\n failed=0;\n correct=0;\n questionsNav=0;\n totalQuestions=27;//nos sirve para saber cuando no quedan preguntas y se ha acabado el juego;\n \n\n playerName = prompt('Cual es tu nombre ?')\n document.getElementById(\"nombreJugador\").innerHTML=playerName\n alert(\"Empezamos!\")\n questionShow();\n}", "function beginGame() {\n//reset variables\n guesses = 10\n wrong = []\n output = []\n//choose random word from array of words\n\tword = wordList[Math.floor(Math.random() * wordList.length)]\n//break up word string into characters and store in letters array\n\tletters = word.split('')\n\t// console.log(letters)\n\t// console.log(word)\n//determine length of word to use in loops\n\twordLength = letters.length\n//for loop to generate underscores\n\tfor(var i = 0; i < wordLength; i++) {\n\t\toutput.push('_')\n\t}\n\t// console.log(output)\n//put new content in word, guesses, win, ad loss divs \n document.getElementById('wordDiv').innerHTML = output.join(' ')\n document.getElementById('winDiv').innerHTML = wins\n document.getElementById('loseDiv').innerHTML = losses\n document.getElementById('guessesDiv').innerHTML = guesses\n}", "function startGame() {\n // generates a random word form the randon word array\n document.getElementById(\"message\").innerHTML = \" \";\n randomNumber = Math.floor(Math.random(randomWord) * randomWord.length);\n hiddenWord = randomWord[randomNumber];\n answerArray = [\"\"]\n for (var i = 0; i < hiddenWord.length; i++) {\n answerArray[i] = \"_\" ;\n }\n document.getElementById(\"answer\").innerHTML = answerArray.join(\" \");\n guess = 10;\n document.getElementById(\"numofguess\").innerHTML = guess + \" guesses left\";\n document.getElementById(\"winner\").innerHTML = \"\";\n lettersUsed = [];\n}", "function newWord() {\n $('#word_hint').html(words[Math.floor((Math.random() * words.length))]);\n resetTimer();\n vrtionary.ultimateClear();\n vrtionary.setTeamTime(30);\n}", "gameOver() {\n this.ctx.font = \"50px serif\";\n this.ctx.fillText(\"Game Over\", 300, 90);\n }", "function playGame() {\n //get random secret word\n secretWord = (hangmanWords[Math.floor(Math.random() * hangmanWords.length)]).toUpperCase();\n //make secret word into an array\n secretWordArray = secretWord.split(\"\");\n\n //get number of letters to replace with underscores\n underscores = secretWord.length;\n for (var i = 0; i < underscores; i++) {\n underscoreArray[i] = \"_\";\n }\n $(\"#secretWordOutput\").text(underscoreArray.join(\" \"));\n $(\"#wrongGuessesOutput\").hide();\n }", "function showWord(words) {\n //a variable to grab a number math.foor to round down, math.random to RNG, words.length for length of words array\n //Generate random array index\n const randIndex = Math.floor(Math.random() * words.length);\n // Output random word\n //We initialized currentWord at start of JS file and use innerHTML to grab value from html h2\n currentWord.innerHTML = words[randIndex];\n}", "function getPrintWord() {\n var randomWord = possibleWords[(Math.floor(Math.random() * possibleWords.length))];\n //document.getElementById(\"currentPlanet\").innerHTML = randomWord;\n document.getElementById(\"currentPlanet\").innerHTML = \"\";\n for (var i = 0; i < randomWord.length; i++) {\n document.getElementById(\"currentPlanet\").innerHTML += '<element id=\"letter' + i + '\">';\n document.getElementById(\"letter\" + i).innerHTML = \"_ \";\n }\n return randomWord;\n}" ]
[ "0.735485", "0.7281575", "0.72742707", "0.7265616", "0.7172165", "0.7069368", "0.70655465", "0.70403314", "0.7035831", "0.70275617", "0.7018534", "0.69981015", "0.69899875", "0.697977", "0.69433796", "0.6937526", "0.6928103", "0.6922864", "0.69144416", "0.6908628", "0.6903575", "0.6901666", "0.68898153", "0.68832606", "0.68733126", "0.6861113", "0.6852572", "0.6834979", "0.6834087", "0.6833765", "0.6826422", "0.68052906", "0.68024933", "0.6799191", "0.67861027", "0.6775891", "0.67629296", "0.6755508", "0.6754186", "0.6751982", "0.67414206", "0.67362714", "0.673457", "0.6723202", "0.6716667", "0.67103976", "0.6705182", "0.66994", "0.6698914", "0.6689129", "0.66857684", "0.6685386", "0.6683297", "0.6676819", "0.667315", "0.66730005", "0.6659709", "0.6650039", "0.66466266", "0.6637581", "0.6634507", "0.66265446", "0.66251063", "0.6612768", "0.66101176", "0.66087776", "0.66068274", "0.6602084", "0.65974504", "0.6594455", "0.65825164", "0.6578371", "0.65782714", "0.65733844", "0.6572039", "0.65711343", "0.6570692", "0.65695727", "0.656581", "0.6565796", "0.6553978", "0.65452373", "0.65439034", "0.65426886", "0.65384567", "0.6532182", "0.6526582", "0.65257335", "0.6515874", "0.65133", "0.65033925", "0.6503321", "0.64992535", "0.64943904", "0.64875805", "0.6487421", "0.6485651", "0.6470109", "0.64676327", "0.6467127" ]
0.6786421
34
Desenha LOOP Infinito while (1)
function draw() { background(0,0,0); vitorioso(); if(!(placarPlayerUm >= 10 || placarPlayerDois >=10)){ jogo(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loopInfinito() {\n while (true) { }\n}", "function loop() {\r\n}", "function loop() {\r\n // if (is_loop) {\r\n setTimeout(manage_loop, manager.interval);\r\n // is_loop = false;\r\n // }\r\n }", "function cambiarEstiloAuto() {\n let contador = 0;\n while(contador < 10){\n cambiarEstilo();\n contador++;\n }\n}", "loop() {}", "loop() {}", "function infinteLoop() {\n while (true) {\n }\n}", "function executarLooping() {\n moverFundo()\n moverHelicopteroInimigo()\n moverCaminhao()\n moverJogador()\n moverAliado()\n detectarColisoes()\n mostrarPlacar()\n atualizarEnergia()\n}", "function infiniteLoop() {\n while (true) {\n console.log('loop');\n }\n }", "function jogar(){\r\n //o jogo continuará até que alguém destrua completamente os navios do adversário\r\n //testa após cada jogada se o número de pontos foi atingido\r\n while (true){\r\n jogadorJoga();\r\n console.log(\"O computador tem \"+naviosComputador);\r\n if (pontosJogador == naviosComputador){\r\n console.log(nome+\" ganhou! Parabéns!\");\r\n break;\r\n }\r\n else {\r\n computadorJoga();\r\n if (pontosComputador == naviosJogador){\r\n console.log(\"Computador ganhou! Tente novamente, \"+nome);\r\n break;\r\n }\r\n };\r\n }\r\n}", "function loop() {\n moveFundo();\n moveJogador();\n moveInimigo1();\n moveInimigo2();\n moveInimigo3();\n moveInimigo4();\n moveEstrela();\n colisao();\n placar();\n energia();\n }", "noLoop() {\r\n\t\t\tthis.looping = false;\r\n\t\t}", "function startLoop(){\n\n // console.log('[LOOP]');\n\n INGAME = true;\n\n // cancel on late-join\n loop.stop();\n\n loop.resume();\n}", "function startLoop(){\n\n // console.log('[LOOP]');\n\n INGAME = true;\n\n // cancel on late-join\n loop.stop();\n\n loop.resume();\n}", "function cambio(){\n\n\t// for(var i=0; i<10; i++){\n\t// \tconsole.debug('hola '+i);\n\t// }\n\tvar i=0;\n\twhile(i<10){\n\t\tconsole.debug('hola '+i);\n\t\ti++;\n\t}\n}", "function contadorWhile1() {\n // Cria o contador (fora do while)\n let contador = 1;\n\n // Enquanto o valor (contador) for menor que 5\n while (contador <= 5) {\n\n // Mostra o valor na tela\n document.querySelector('#contadorW1').innerHTML += contador + \", \";\n\n // Incrementa o contador (dentro do bloco)\n contador++;\n // contador = contador + 1;\n // contador += 1;\n }\n}", "function whileLoop(n){\nwhile ( 0 < n ){\n console.log(--n);\n}\nif (n <= 1 ){\nreturn 'done';\n }\n}", "function cicloWhile() {\n\n while (confirm(\"Desea Continuar?\")) {\n alert(\"THis is a cycle while\")\n }\n}", "function startLoop() {\n\tisrunnning = true;\n}", "function doWhileLoop(x)\n{\n x--;\n do \n {\n console.log(\"I run once regardless\");\n } while(x-- > 0);\n}", "function infiniteLoop() {\r\n while (true) {\r\n }\r\n}", "function main(){\r\n\tcur_t = 0\r\n\tkill_step = poisson(kill_step);\r\n\tcount_step = 0;\r\n\t//do {\r\n\tvar times = setInterval(function(){\r\n\t\tif (cur_t == steps) clearInterval(times);\r\n\r\n\t\tvar temp = couple_logistic_possison(pop, params, steps);\r\n\t\tif (count_step == kill_step){\r\n\t\t\tcata(kill_percentage, pop);\r\n\t\t\tkill_step = poisson(kill_step);\r\n\t\t\tcount_step = 0;\r\n\t\t}\r\n\r\n\t\tshow_graphics(temp);\r\n\r\n\t\tcur_t += 1;\r\n\t\tcount_step += 1;\r\n\t\treturn temp;\r\n\t\t}, 35);\r\n\t//} while (cur_t < steps)\t\r\n}", "function mainLoop( ) {\n\n\n let segundos = 5;\n let tiempo = segundos * 1000;\n\n\n console.log('Intervalo de '+ segundos );\n console.log('Perioodo: ');\n\n\n REALTIME.actualizarREALTIME( );\n\n setInterval((tiempo) => {\n console.log('-------------------------------------------------------');\n console.log('Intervalo de REALTIME '+ segundos );\n console.log('PERIODO');\n REALTIME.actualizarREALTIME( );\n }, tiempo )\n\n}", "function loopForever() {\n while (true) { }\n}", "function checkLoop() {\n if (config.loopState) {\n loop();\n } else {\n noLoop();\n }\n }", "function infiniteLoop() {\n while (true) {\n }\n}", "function infiniteLoop() {\n while (true) {\n }\n}", "function infiniteLoop() {\n while (true) {\n }\n}", "function infiniteLoop() {\n while (true) {\n }\n}", "function contadorWhile2() {\n // Cria o contador (fora do while)\n let contador = 1;\n\n // Guarda o número informado na tela\n const numeroInformado = document.querySelector('#numInformadoW2').value;\n\n // Enquanto o contador for menor que o número informado na tela\n while (contador <= numeroInformado) {\n // Mostra o valor na tela\n document.querySelector('#contadorW2').innerHTML += contador + \", \";\n\n // Incrementa o contador (dentro do bloco)\n contador++;\n }\n}", "function loopDetect() {\n \n}", "loop() {\n let stop = false;\n while (!stop) {\n //Creates a thread for every single agent\n Object.values(this.agents).forEach(agent => {\n if (!this.problem.goalTest(this.data)) {\n // aqui el agente recibe las persepciones\n agent.receive(this.problem.perceptionForAgent(this.getData(), agent.getID()));\n //guarda el accion\n let action = agent.send();\n this.actions.push({ agentID: agent.getID(), action });\n //actuliza el problema\n this.problem.update(this.data, action, agent.getID());\n //mira si termino el problema\n if (this.problem.goalTest(this.data)) {\n stop = true;\n } else {\n if (this.callbacks.onTurn)\n //es un callback que muestra la posicion en la que esta callbacks\n this.callbacks.onTurn({ actions: this.getActions(), data: this.data });\n }\n }\n });\n }\n this.finishAll();\n }", "function hello(){\n\nlet angka = 1;\nwhile(angka <= 5){\nconsole.log(\"hai\" + \" \" + angka + \"x\");\nangka++;\n }\n}", "function generalLoop(){\r\n\r\n\tif ((new Date()).getTime() - timeObj < 3 ) {\t\t\r\n\t\treturn;\t\t\r\n\t}//fi\r\n\tif (currentState == 3) {\r\n\t\tupdateDisplay();\r\n\t\ttimeObj = (new Date()).getTime();\r\n\t}//fi\r\n\r\n\t\r\n\r\n}//end listener\t", "function intWhile (){\n var i = 2000;\n while (i <= 5280){\n console.log(i);\n i++;\n }\n}", "function PrintI(){\n var num = 2000;\n while(num < 5281){\n console.log(num);\n num++;\n }\n}", "function loops6 () {\n console.log('#6 Logging 1 to 1000 with a do...while loop: ');\n var i = 1;\n do {\n console.log(i);\n i++;\n } while (i < 1001);\n}", "function testWhileLoop() {\n var counter = 0;\n while (counter <= 10) {\n console.log(counter);\n counter++;\n }\n}", "function devilLoop(){\n GMvariables.devil = setInterval(() => {\n changePositionOfElement()\n if(GMvariables.live<1){\n deviElementHide();\n clearInterval(GMvariables.devil);\n }\n }, GMvariables.interval);\n // console.log(\"from loop = \" + interval);\n}", "function get_data_loop()\r\n{\r\n if(!ansvers){\r\n \tget_data();\r\n \tansvers = 1;\r\n }\r\n \tsetTimeout(\"get_data_loop()\",10000);\r\n}", "function infiniteLoop() {\n while (true) { }\n}", "function whileLoop(x)\n{\n while (x>0)\n {\n console.log(x--);\n }\n \n return \"done\";\n}", "function a2() {\n let i = 9; // Variablen-Initialisierung. Name i, Typ number, Wert 9.\n do { /* do-while-Schleife --> Wird auf jeden Fall einmal die Anweisungen im Rumpf ausführen,\n bevor die Bediengung auf true überprüft wird und den Rumpf weiter ausführt und dies dann genau so lange, bis die Bediengung false wird. */\n console.log(i); // Konsolenausgabe der lokalen Variable i.\n i = i - 1; // Der Variablen i wird ein neuer Wert zugewiesen: Und zwar ihr eigener minus Eins.\n } while (i > 0); // Schleifenbedingung: \"Solange die Variable i größer als 0 ist, dann führe die Anweisungen im Rumpf aus.\"\n}", "function loop() {\n if (!avatar.dead) {\n //obtener propiedades de elementos\n bcr.getBCR(playground, adventurer, ip, life);\n //aumentar distancia e imprimirla\n distCounter++;\n printDist(distCounter, previousDistance, dist);\n //salto personaje\n avatar.jumping(joystick, adventurer);\n //controlar que no pase del piso\n avatar.checkFloor(bcr.plgrBCR, groundHeight, adventurer);\n adventurer.style.top = avatar.y + \"px\";\n //chequear colisiones\n\n if (avatar.collision(bcr.advtBCR, bcr.impBCR)) {\n if (avatar.life > 0) {\n avatar.hurt(life);\n //console.log(avatar.life);\n myID = requestAnimationFrame(loop);\n } else {\n avatar.death(adventurer);\n ip.style.animationIterationCount = \"1\";\n if (distCounter > previousDistance) {\n previousDistance = distCounter;\n }\n front.style.background=\"url('../img/end.png')\";\n inicio.style.display = \"inline\";\n setTimeout(() => {\n front.style.display=\"inline\";\n }, 2000);\n cancelAnimationFrame(myID);\n }\n } else {\n if (bcr.impBCR.left < 145) {\n speed *= 0.99;\n ip.style.animation = \"anRB 0.8s steps(8) infinite, anR 4s steps(400) infinite\";\n }\n myID = requestAnimationFrame(loop);\n }\n }\n }", "function loops4 () {\n console.log('#5 Logging 1 to 1000 with a while loop: ');\n var i = 1;\n while (i < 1001) {\n console.log(i);\n i++;\n }\n}", "function loop() {\n if( DateForCycle.getTime() < beginTime ) {\n\n \n bigDay ^= true;\n setDate(DateForCycle, function(){\n commit(function() {\n if(bigDay) {\n commit(setNextDay);\n } else {\n setNextDay();\n\n }\n })\n });\n } else {\n exec('git remote add origin '+rep+' && git push -u origin master -f', function(){\n });\n\n }\n }", "function whileDemo([n]) {\r\n let health = 100;\r\n while (health > 0) { // its not depend on counter\r\n \r\n // walk\r\n // take damage\r\n // headshot\r\n }\r\n}", "_setupLoop () {\n this._time = 0\n this._loop()\n }", "function startLoop() {\n\tconsole.log(maxi);\n\tconsole.log(index);\n if(index==maxi){\n return;\n }\n else{\n //setInterval(5000);\n setInterval( doSomething(), iFrequency ); // run\n startLoop();\n\t}\n\n }", "function loop (n) {\n while (n > 0) {\n console.log(n)\n n--\n }\n}", "startLoop () {\n\t this.loop = true;\n\n\t while (this.loop) {\n\t switch (this.state) {\n\t case GET_INFO:\n\t this.getInfo();\n\t break;\n\t case GET_PAYLOAD_LENGTH_16:\n\t this.getPayloadLength16();\n\t break;\n\t case GET_PAYLOAD_LENGTH_64:\n\t this.getPayloadLength64();\n\t break;\n\t case GET_MASK:\n\t this.getMask();\n\t break;\n\t case GET_DATA:\n\t this.getData();\n\t break;\n\t default: // `INFLATING`\n\t this.loop = false;\n\t }\n\t }\n\t }", "function loop ( start, test, updt, body ) {\r\n let val = start;\r\n while (test(val)) {\r\n body (val)\r\n val = updt (val)\r\n } \r\n}", "function stopLoop() {\n\tisrunnning = false;\n\tconsole.log('stop loop');\n}", "function bannerLoop()\n\t{\n\t\tsetTimeout(showBanner, interval * 1000);\n\t}", "function Inicio() {\n var bandera = true;\n\n while (bandera == true) {\n var respuesta = 0;\n\n //Mensajes de alerta para ingresar datos\n var nombre = prompt(\"Ingrese su nombre, por favor\");\n var edad = IngresoEdad(\"usted\");\n\n if (edad >= 18) {\n var casado = IngresoEstadoCivil();\n var edad_conyuge = 0;\n var numeroHijos = 0;\n valorPropiedad = 0;\n\n if (\"SI\" == casado.toUpperCase()) {\n edad_conyuge = IngresoEdad(\"su conyuge\");\n }\n\n if (TieneHijos()) {\n numeroHijos = CantidadHijos();\n }\n\n var salario = ValorSalario();\n var propiedad = IngresoPropiedad();\n\n debugger;\n\n if (\"SI\" == propiedad.toUpperCase()) {\n var valorPropiedad = ValorPropiedad();\n }\n } else {\n alert(\"La persona a asegurar tiene que ser mayor de edad\");\n }\n\n datos.push(\n new Registro(\n nombre,\n edad,\n casado,\n edad_conyuge,\n numeroHijos,\n salario,\n valorPropiedad\n )\n );\n\n bandera = Continuar();\n }\n\n for (let entry of datos) {\n var recargo_total = CalculoRecargo(entry);\n var total = precio_base + recargo_total;\n alert(\"Para el asegurado \" + entry.nombre);\n alert(\"El recargo total sera de: \" + recargo_total);\n alert(\"El valor de la cotización sera de: \" + total);\n }\n\n}", "onClickRun() {\n\t\tlet tmp = true;\n\t\twhile (tmp == true) {\n\t\t\ttmp = this.cycle();\n\t\t}\n\t}", "function imprimir() {\n for (var i = 0; i<8000; i++){\n console.log(\"Imprimio\");\n }\n}", "function doWhileLoop(array) {\n \tvar i = 0; // sets variable i equal to zero as a start ?\n\n// function that adds '1' to the 'i' variable each time it's ran\nfunction incrementVariable() {\n \t\ti = i + 1;\n \t}\n\n\tdo { // will run following body AT LEAST once.\n\n\t\t// console.log('array.length = ' + array.length + ' and i = ' + i); // WHAT THE HECK DOES THIS MEAN\n // console.log(\"DID THIS WORK?!\"); // update: I actually don't even need the console.log part\n\t\tarray = array.slice(1); // removes the first element in an array\n\t\tincrementVariable(); // function that adds '1' to the 'i' variable each time it's ran (function set above)\n\t} while (array.length > 0 && i < 5); // while the length of the array is greater than zero AND less than 5\n\n\treturn array;\n}", "function start() {\n isGameActive = true;\n\n var l = 0;\n do {\n setTimeout(function () {\n calculateNextGeneration();\n }, 1000 * l);\n l++;\n console.log(l);\n }\n while (l < 1000);\n\n}", "startLoop () {\n this.loop = true;\n\n while (this.loop) {\n switch (this.state) {\n case GET_INFO:\n this.getInfo();\n break;\n case GET_PAYLOAD_LENGTH_16:\n this.getPayloadLength16();\n break;\n case GET_PAYLOAD_LENGTH_64:\n this.getPayloadLength64();\n break;\n case GET_MASK:\n this.getMask();\n break;\n case GET_DATA:\n this.getData();\n break;\n default: // `INFLATING`\n this.loop = false;\n }\n }\n }", "function controlLoop(){\r\n refreshData();\r\n setInterval(refreshData,10000);\r\n}", "function stopLoop()\n{\n\twindow.clearInterval(loop);\t\n}", "function stop(){\n noLoop();\n}", "function intervalFunction(){\n\t//If loopFlag == 1 then last execution actually executed something. If is 0 then last execution didn't execute anything, stop the program.\n\t//stopPressed and error are check flags for the stop button or internal errors\n\tif(loopFlag == 1 && stopPressed == 0 && expControl.error == 0){\n loop();\n\t\tif(loopFlag == 1 && stopPressed == 0 && expControl.error == 0){\n\t\t\tsetTimeout(intervalFunction,speed);\n\t\t\treturn;\n\t\t}\n\t}\n\tstop();\n}", "function pauseLoopArticles() {\n if (onAutoLooping) {\n clearInterval(loop_interval);\n isLooping = false;\n }\n }", "function loopData() {\n\n}", "function loop() {\n inquirer\n .prompt([\n {\n type: \"confirm\",\n message: \"Would you like to add another employee?\",\n name: \"loop\",\n },\n ])\n .then((res) => {\n if (res.loop) {\n init();\n } else {\n printHTML();\n return;\n }\n });\n}", "async function Stopper() {\r\n while (true){\r\n await sleep(1000);\r\n if(MS ===5 && S ===9) {\r\n M = increment(M, 1000);\r\n S = 0;\r\n MS = 0;\r\n } else if(S === 9){\r\n S = 0;\r\n MS = increment(MS,5);\r\n } else {\r\n S = increment(S,9);\r\n }\r\n $(\"#Time\").text(\"Time: \"+M+\":\"+MS+\"\"+S) ;\r\n }\r\n\r\n}", "function SLOOP(state) {\n state.loop = state.stack.pop();\n\n if (exports.DEBUG) {\n console.log(state.step, 'SLOOP[]', state.loop);\n }\n }", "function loop(){\n Jobs.getAndDraw();\n setTimeout(function(){loop()}, 30000)\n }", "startLoop () {\n\t this._loop = true;\n\n\t while (this._loop) {\n\t switch (this._state) {\n\t case GET_INFO:\n\t this.getInfo();\n\t break;\n\t case GET_PAYLOAD_LENGTH_16:\n\t this.getPayloadLength16();\n\t break;\n\t case GET_PAYLOAD_LENGTH_64:\n\t this.getPayloadLength64();\n\t break;\n\t case GET_MASK:\n\t this.getMask();\n\t break;\n\t case GET_DATA:\n\t this.getData();\n\t break;\n\t default: // `INFLATING`\n\t this._loop = false;\n\t }\n\t }\n\t }", "function myLoop () { // create a loop function\n setTimeout(function () { // call a 3s setTimeout when the loop is called\n console.log('hello'); // your code here\n i++; // increment the counter\n if (i < 10) { // if the counter < 10, call the loop function\n myLoop(); // .. again which will trigger another \n } // .. setTimeout()\n }, 1000)\n}", "_stopLoop() { this._isRunning = false; }", "function loop_over() {\n\t\n\t\tif(finished) { // konec\n\t\t\tcount_result();\n\t\t\treturn;\n\t\t}\n\t\t\t\n\t\t$('#arrow').css({\"display\":\"none\"});\n\t\tdir = range(37,40); // vygeneruj smer sipky\n\t\t\n\t\tif(dir == 38)\n\t\t\t$('#arrow').text(\"↑\");\n\t\telse if(dir == 37)\n\t\t\t$('#arrow').text(\"←\");\n\t\telse if(dir == 40)\n\t\t\t$('#arrow').text(\"↓\");\n\t\telse\n\t\t\t$('#arrow').text(\"→\");\n\n\t\tsetTimeout(function() {\n\t\t\t$('#arrow').css({\"display\":\"block\"});\n\t\t\tloop();\n\t\t},0);\n\t}", "function printWithWhile(){\n\tvar printwhile = 2000;\n\n\twhile(printwhile <= 5280){\n\t\tconsole.log(printwhile);\n\t\tprintwhile++;\n\t}\n\n}", "function TaskLoop() {\n\t\n}", "function mainLoop()\n {\n\t\tmainLoopCounter++;\n if (Graph.instance.nodes.get(state.sourceId).b == 0) {\n state.current_step = STEP_FINISHED; //so that we display finished, not mainloop when done\n that.stopFastForward();\n \n logger.log(\"Finished with a min cost of \"+ minCost);\n\n }\n else\n {\n logger.log(\"Not finished, starting search for augmentation cycle \");\n state.show_residual_graph = true;\n state.current_step = STEP_FINDSHORTESTPATH; \n\t\t\n }\n }", "function mainLoop () {\n // Hard coded insturction count that each loop runs.\n let insCount = 5\n c8.DELAY = Math.max(0, c8.DELAY - 1)\n while (insCount > 0) {\n const { MEM, PC } = c8\n // Move instruction offset.\n const ins = getIns(MEM[PC] << 8 | MEM[PC + 1])\n try {\n // Perform operation according to instruction.\n ops[ins[0]](ins, c8, view)\n } catch (err) { warning(err, ins, c8) }\n insCount--\n }\n window.requestAnimationFrame(mainLoop)\n }", "function mainLoop() {\n // check if the user is drawing and emit xy coords to be pushed into line history on the back end\n if (mouse.click && mouse.move && mouse.pos_prev) {\n // send line to to the server\n client.emit('draw_line', { line: [mouse.pos, mouse.pos_prev] });\n mouse.move = false;\n }\n if (erase) { //user1 erases -> server gets message -> updates client state for all users\n client.emit('erase_board', { message: 'Client to server: User x erased the board' });\n erase = false;\n }\n //if not drawing, assign values to pos_prev to begin the drawing process\n mouse.pos_prev = { x: mouse.pos.x, y: mouse.pos.y };\n setTimeout(mainLoop, 25); //recursive loop every 25ms\n }", "loop() {\n\t\tif( game.paused ) {\n\t\t\tdisplay.clearScreen();\n\t\t\tgame.draw();\n\t\t\treturn;\n\t\t}\n\n\t\tif( !game.nc || ( game.nc && display.frame % 3 === 0 ) ) {\n\t\t\tgame.update();\n\t\t\tdisplay.clearScreen();\n\t\t\tgame.draw();\n\t\t\treturn;\n\t\t}\n\t}", "loop() {\r\n\t\t\tthis.looping = true;\r\n\t\t\tthis.playing = true;\r\n\t\t}", "function alive()\n{\n\tconsole.log(\"Loop\");\n\tswitch(state)\n\t{\n\t\tcase 0:\n\t\t\tconsole.log(\"Stopped\");\n\t\t\t//stop();\n\t\tbreak;\n\t\t\n\t\tcase 1:\n\t\t\tif (busy == 0)\n\t\t\t{\n\t\t\t\tconsole.log(\"Swimming\");\n\t\t\t\tswim();\n\t\t\t}\n\t\tbreak;\n\t\t\n\t\tcase 2:\n\t\t\t//NOT Implemented\n\t\t\tfollow();\n\t\tbreak;\n\t\t\n\t\tcase 3:\n\t\t\t//NOT Implemented\n\t\t\tavoid();\n\t\tbreak;\n\t\t\n\t\tcase 4:\n\t\t\t//NOT Implemented\n\t\t\tfeed();\n\t\tbreak;\n\t\t\n\t\tcase 5:\n\t\t\t//DoNothingCozManual!!!!\n\t\tbreak;\n\t\t\n\t\tdefault:\n\t\t\tstate = 1;\n\t}\n}", "function mainLoop() {\n\n\t\tvar timeChecker = setInterval(function() {\n\n\t\t\tstate.videoPlayer.update();\n\t\t\t// Forced update of time. Required for Safari.\n\t\t\ttime = state.videoPlayer.currentTime;\n\n\t\t\t// console.log('time:', time);\n\t\t\t_.each(popUpProblemTimer, function(obj) {\n\t\t\t\tif (time >= obj.start && time < obj.end) {\n\t\t\t\t\t// console.log(obj);\n\t\t\t\t\tvideoActions.actionFunction(time, obj);\n\t\t\t\t} else {\n\t\t\t\t\tvideoActions.actionFunction(time, null);\n\t\t\t\t}\n\t\t\t})\n\t\t}, 500);\n\n\t}", "function loopArticles() {\n if (onAutoLooping) {\n loop_interval = setInterval(nextArticle, settings.interval);\n isLooping = true;\n }\n }", "function startLoop() {\r\n document.getElementById('tagtitle').innerHTML=title[currentTitle];\r\n x= description[currentTitle];\r\n // alert(x);\r\n if(myInterval > 0) clearInterval(myInterval); // stop\r\n myInterval = setInterval( \"changeContent()\", iFrequency ); // run\r\n }", "function ciblerMonstre(){\n choisie=false;\n while (choisie=false){\n butGob.onclick= function(){\n cibleMonstre=\"Gobelin\";\n vieMonCible=vieGob;\n choisie=true;\n }\n butDef.onclick= function(){\n cibleMonstre=\"Dragon\";\n vieMonCible=vieDra;\n choisie=true;\n }\n butSpe.onclick= function(){\n cibleMonstre=\"Fantôme\";\n vieMonCible=vieFan;\n choisie=true;\n }\n }\n}", "function myLoop() { // create a loop function\n setTimeout(function () { // call a 3s setTimeout when the loop is called\n console.log(globulCounter); // your code here\n\n if (globulCounter < stockArrayBy80.length) { // if the counter < 10, call the loop function\n getStockAllPriceGoogle(stockArrayBy80[globulCounter]);\n myLoop(); // .. again which will trigger another\n } // .. setTimeout()\n globulCounter++; // increment the counter\n }, 3000)\n}", "function loopMain() {\n if(!lock && !animation1 && !animation2){\n lock = true;\n $.get(\"phps/refreshlugares.php\",function(responseText,status){\n try{\n if(status==\"success\"){\n res = JSON.parse(responseText);\n res.forEach(function (lugar) {\n switch (lugar.idLugares) {\n case \"1\":\n if(ocupado1!=parseInt(lugar.ocupado))\n ocupar1();\n break;\n case \"2\":\n if(ocupado2!=parseInt(lugar.ocupado))\n ocupar2();\n break;\n }\n });\n }else{\n alert(status);\n }\n }catch(e){\n alert(e);\n }\n lock = false;\n });\n }\n}", "function veggieWhileLooper( veggies ) {\r\n\r\n var i = 0;\r\n\r\n while ( i < veggies.length ) {\r\n\r\n console.log( myVeggies[i] );\r\n i++;\r\n }\r\n}", "function countdown(num){\r\n\r\n while(num > 1)\r\n{\r\n console.log(num);\r\n num = num - 4;\r\n}\r\n\r\n}", "function Steady() {\n// var i;\n// for (i = 0; i<4; i++) {} => Boucle servant dans le cas où l'on veut ajouter 4 cartes de suite pour la banque\n while (bank_score[0] < player_score[0]) {\n var para = document.getElementById('BC');\n var img = document.createElement('img');\n var path = randomOne(bank_score, bank_cards, \"texte1\");\n img.src = path;\n para.appendChild(img);\n }\n Score_Text_Display(bank_score,player_score);\n}", "startLoop () {\n this._loop = true;\n\n do {\n switch (this._state) {\n case GET_INFO:\n this.getInfo();\n break;\n case GET_PAYLOAD_LENGTH_16:\n this.getPayloadLength16();\n break;\n case GET_PAYLOAD_LENGTH_64:\n this.getPayloadLength64();\n break;\n case GET_MASK:\n this.getMask();\n break;\n case GET_DATA:\n this.getData();\n break;\n default: // `INFLATING`\n this._loop = false;\n }\n } while (this._loop);\n }", "agregarNuevo(){\n let esta = false;\n let cont = 0;\n \n while(!esta){\n cont++;\n const fil = Math.floor(Math.random() * this.size);\n const col = Math.floor(Math.random() * this.size);\n\n if(this.getCelda(fil,col)==null){\n esta = true;\n const val = Math.floor(Math.random() * 6)+1;\n if(val>=0 && val<5)\n this.setCeldaEfecto(2,fil,col); // 3 chances de 4 de que toque 2\n else\n this.setCeldaEfecto(4,fil,col); // 3 chances de 4 de que toque 4\n }\n\n //conta\n if(cont==1000) esta = true;\n\n }\n\n }", "function meshLoop(self)\n{\n debug(\"MESHA\")\n meshReap(self);\n meshSeen(self);\n meshElect(self);\n meshPing(self);\n debug(\"MESHZ\")\n setTimeout(function(){meshLoop(self)}, 25*1000);\n}", "startLoop () {\n this._loop = true;\n\n while (this._loop) {\n switch (this._state) {\n case GET_INFO:\n this.getInfo();\n break;\n case GET_PAYLOAD_LENGTH_16:\n this.getPayloadLength16();\n break;\n case GET_PAYLOAD_LENGTH_64:\n this.getPayloadLength64();\n break;\n case GET_MASK:\n this.getMask();\n break;\n case GET_DATA:\n this.getData();\n break;\n default: // `INFLATING`\n this._loop = false;\n }\n }\n }", "function executeAll() {\r\n //wykonaj wszystkie kroki do konca\r\n while (!finished) processStep();\r\n prepareScreen5();\r\n}", "function game_loop()\n{\n\t// If frog made it across safely\n\tif(frog.lane == 0 && is_safe_cross()) {\t\n\t\tcrossed_safely();\n\t}\n\t\n\t// If frog is dead\n\tif(is_collision() || is_in_water() || is_out_of_bounds() || is_out_of_time() || !is_safe_cross() ) {\n\t\tlives--;\n\t\treset_frog();\n\t} \n\n\t// If player has zero frogs left (aka game over)\n\tif(lives == 0) {\n\t\tgame_over();\n\t}\n}", "async function imagerollFunction() {\n while (counter < imageArray.length && roll) {\n image.src = imageArray[counter][0];\n image.alt = imageArray[counter][1];\n p.innerText = imageArray[counter][1];\n counter++;\n await sleep(4000);\n }\n}", "function credits_loop() {\n \t\tdo_fade();\n \t\tdraw_backDrop();\n \t\tdraw_scroller();\t\t\t\t\t\t\t\n \t\tendScreenTimer--;\t\t\t\t\t\t\t\t// Countdown the timer.\n \t\tif (endScreenTimer==0) end();\t\t\t\t\t\t\t\t// If it gets to zero, end the credits!\n \t\telse if (creditsLoopOn) requestAnimFrame( credits_loop );\t// ... otherwise if the demo is continuing, go to the next frame.\n \t}", "function intGoNext(){\n goNext(0);\n }", "async function mainLoop() {\n\n\tdrawBoard(currentlyDisplayedCards);\n\twhile (!gameEnded) {\n\t\tlet eventSet = await getEvent(pastEvents);\n\t\tawait handleEvent(eventSet); // handle the event that was just added\n\t}\n}" ]
[ "0.8160807", "0.72183514", "0.7165397", "0.7162067", "0.7156095", "0.7156095", "0.7044727", "0.70299995", "0.6846243", "0.6711894", "0.67076546", "0.6599778", "0.6598126", "0.6598126", "0.6571005", "0.65352774", "0.65262204", "0.65159464", "0.64951324", "0.6481465", "0.64783376", "0.6473284", "0.6438391", "0.6430326", "0.639981", "0.6398046", "0.6398046", "0.6398046", "0.6398046", "0.6393591", "0.63869596", "0.6380344", "0.63610125", "0.63506585", "0.63312525", "0.63259953", "0.6319324", "0.6289687", "0.6285144", "0.62818795", "0.62785584", "0.62716115", "0.62659293", "0.6251036", "0.62390774", "0.6221712", "0.62015903", "0.6161554", "0.6140686", "0.6129205", "0.6124348", "0.6118781", "0.6115037", "0.6111677", "0.6096505", "0.60886776", "0.60726875", "0.5995147", "0.5988208", "0.59531593", "0.59524", "0.59482086", "0.5921281", "0.5910011", "0.590931", "0.58867294", "0.58782476", "0.5871007", "0.5864027", "0.58625406", "0.58618015", "0.5859982", "0.58347696", "0.58102745", "0.58041954", "0.5793302", "0.57902044", "0.57886213", "0.57851595", "0.577214", "0.5763079", "0.5756939", "0.5749172", "0.57324266", "0.57304627", "0.5727801", "0.57264566", "0.57239676", "0.57230157", "0.57207936", "0.5715495", "0.57148415", "0.5707496", "0.5696988", "0.5687366", "0.56810415", "0.56787235", "0.5677128", "0.5677077", "0.56732804", "0.56719077" ]
0.0
-1
funcion para que mueva la ventana de sitio y evitar que el usuario click en si
function esquivarUsuario() { //obtenemos la hora actual var ahora = new Date(); //calculamos las nuevas coordenadas var x = ahora.getMilliseconds(); var y = x / 2; //desplazamos la ventana // window.moveTo(x, y); //movemos el div var ventana = document.getElementById('myModal'); ventana.style.position = "absolute"; ventana.style.left = x + "px"; ventana.style.top = y + "px"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ClickGerarElite() {\n GeraElite();\n AtualizaGeral();\n}", "function ClickGerarAleatorioElite() {\n GeraAleatorioElite();\n AtualizaGeral();\n}", "function ClickHabilidadeEspecial() {\n // TODO da pra melhorar.\n AtualizaGeral();\n}", "function ClickGastarFeitico() {\n AtualizaGeral();\n}", "function do_click(reserva) {\n\tvar v = document.getElementById(reserva);\n\tif (v.alt != 2) {\n\t\tif (fila == 0) { // Comprobacion de que es la primera fila que se\n\t\t\t\t\t\t\t// escoje\n\t\t\tfila = parseInt(reserva / 100);\n\t\t\tif (v.alt == 0) {\n\t\t\t\tv.src = 'images/butacas/iconoLibre.ico';\n\t\t\t\tv.alt = 1;\n\t\t\t\tsetSeat(reserva);\n\t\t\t} else if (v.alt == 1) {\n\t\t\t\tv.src = 'images/butacas/iconoElegido.ico';\n\t\t\t\tv.alt = 0;\n\t\t\t\tdeleteSeat(reserva);\n\t\t\t}\n\t\t} else if (parseInt(reserva / 100) == fila) {\n\t\t\tif (v.alt == 0) {\n\t\t\t\tif (contador < 10) {\n\t\t\t\t\tv.src = 'images/butacas/iconoLibre.ico';\n\t\t\t\t\tv.alt = 1;\n\t\t\t\t\tsetSeat(reserva);\n\t\t\t\t} else\n\t\t\t\t\talert(\"No se puede comprar mas de 10 entradas\");\n\t\t\t} else if (v.alt == 1) {\n\t\t\t\tv.src = 'images/butacas/iconoElegido.ico';\n\t\t\t\tv.alt = 0;\n\t\t\t\tdeleteSeat(reserva);\n\t\t\t}\n\t\t} else\n\t\t\talert(\"Las entradas deben pertenecer a la misma fila\");\n\t}\n}", "function ClickDescansar(valor) {\n // Cura letal e nao letal.\n EntradasAdicionarFerimentos(-PersonagemNivel(), false);\n EntradasAdicionarFerimentos(-PersonagemNivel(), true);\n EntradasRenovaSlotsFeiticos();\n AtualizaGeralSemLerEntradas();\n AtualizaGeral();\n}", "function ClickGerarPontosDeVida(modo) {\n GeraPontosDeVida(modo);\n AtualizaGeral();\n}", "function asignarEventos() {\n _.click(function() {\n\n });\n}", "function calificar(){\n//comprobar si ya está vinculado para abrir una pagina emergente y un menú para seleccionar la ruta a calificar\n//if(vincular()=true)\n//open window\n//Al dar clic en el boton de calificar se debe cerrar la ventana emergente y mandar calificacion\n//<botton title=\"Calificar\" onclick=\"enviarCalificacion()\">\n}", "function onClick(e) {\n let cantSalvo = tableroSalvo.querySelectorAll(\".active\").length;\n let ajeno = tableroNaves.querySelectorAll(\".hit\").length + tableroNaves.querySelectorAll(\".fail\").length;\n let propio = tableroSalvo.querySelectorAll(\".hit\").length + tableroSalvo.querySelectorAll(\".fail\").length;\n\n if(e.target.classList.contains(\"active\")) {\n e.target.classList.remove(\"active\");\n cantSalvo--;\n } else if(cantSalvo < 5) {\n e.target.classList.add(\"active\");\n cantSalvo++;\n }\n\n if (cantSalvo < 5 || app.turnos(propio, ajeno)) {\n document.querySelector(\".btnShot\").setAttribute(\"disabled\", \"true\");\n } else {\n document.querySelector(\".btnShot\").removeAttribute(\"disabled\");\n }\n}", "function ClickEstilo(nome_estilo, id_select_secundario) {\n var select_secundario = Dom(id_select_secundario);\n if (nome_estilo == 'uma_arma' || nome_estilo == 'arma_escudo' || nome_estilo == 'arma_dupla' || nome_estilo == 'rajada' || nome_estilo == 'tiro_rapido') {\n select_secundario.disabled = true;\n } else if (nome_estilo == 'duas_armas') {\n select_secundario.disabled = false;\n } else {\n Mensagem(Traduz('Nome de estilo invalido') + ': ' + Traduz(nome_estilo));\n }\n AtualizaGeral();\n}", "function ClickGerarComum() {\n GeraComum();\n AtualizaGeral();\n}", "function logo_click() {\n if (pasos.paso1.aseguradoraSeleccionada != null && pasos.paso1.aseguradoraSeleccionada.id == pasos.paso1.listaAseguradoras[$(this).index()].id) {\n componentes.progreso.porcentaje = 0;\n componentes.progreso.barra.css({width: '0px'});\n pasos.paso1.aseguradoraSeleccionada = null;\n $(this).removeClass(\"seleccionada\");\n componentes.pasos.paso1.numero_siniestro.prop('readonly', true);\n } else {\n if (pasos.paso1.aseguradoraSeleccionada == null) {\n componentes.progreso.porcentaje = 5;\n componentes.progreso.barra.css({width: '5%'});\n }\n pasos.paso1.aseguradoraSeleccionada = pasos.paso1.listaAseguradoras[$(this).index()];\n $.get('http://localhost:8080/ReForms_Provider/wr/perito/buscarPeritoPorAseguradora/' + pasos.paso1.aseguradoraSeleccionada.id, respuesta_buscarPeritoPorAseguradora, 'json');\n $(this).siblings(\".seleccionada\").removeClass(\"seleccionada\");\n $(this).addClass(\"seleccionada\");\n componentes.pasos.paso1.numero_siniestro.prop('readonly', false);\n }\n componentes.pasos.paso1.numero_siniestro.val('').focus();\n componentes.pasos.paso1.numero_siniestro.keyup();\n }", "function tzimhoniClick()\n\t\t{\n\t\tif (tzimhoniClickStatus==true){\n\t\t\tthis.instruction_txt.text=\"לחץ על רכיב שתרצה לדעת עליו יותר\";\n\t\t\tthis.tivoni_fade.visible=1;\n\t\t\tthis.heraion_fade.visible=1;\n\t\t\tthis.kasher_fade.visible=1;\n\t\t\tthis.tzimhoni_fade.visible=0;\n\t\t\ttzimhoniClickStatus=false;\n\t\t\ttivoniClickStatus=true;\n\t\t\tkasherClickStatus=true;\n\t\t\theraionClickStatus=true;\n\t\t\tthis.tamago.alpha=1;\n\t\t\tthis.tivoni.mouseEnabled=false;\n\t\t\tthis.heraion.mouseEnabled=false;\n\t\t\tthis.kasher.mouseEnabled=false;\n\t\t\tthis.unagi.mouseEnabled=false;\n\t\t\tthis.tobiko.mouseEnabled=false;\n\t\t\tthis.tuna.mouseEnabled=false;\n\t\t\tthis.surimi.mouseEnabled=false;\n\t\t\tthis.palamida.mouseEnabled=false;\n\t\t\tthis.salmon.mouseEnabled=false;\n\t\t\tthis.skin.mouseEnabled=false;\n\t\t\tthis.ekora.mouseEnabled=false;\n\t\t}\n\t\telse{\n\t\t\tthis.instruction_txt.text=\"לחץ לבחירת המאפיין\";\n\t\t\tthis.tivoni_fade.visible=0;\n\t\t\tthis.heraion_fade.visible=0;\n\t\t\tthis.kasher_fade.visible=0;\n\t\t\tthis.tzimhoni_fade.visible=0;\n\t\t\ttzimhoniClickStatus=true;\n\t\t\ttivoniClickStatus=true;\n\t\t\tkasherClickStatus=true;\n\t\t\theraionClickStatus=true;\n\t\t\tthis.tivoni.mouseEnabled=true;\n\t\t\tthis.heraion.mouseEnabled=true;\n\t\t\tthis.kasher.mouseEnabled=true;\n\t\t\tthis.unagi.mouseEnabled=true;\n\t\t\tthis.tobiko.mouseEnabled=true;\n\t\t\tthis.tuna.mouseEnabled=true;\n\t\t\tthis.surimi.mouseEnabled=true;\n\t\t\tthis.palamida.mouseEnabled=true;\n\t\t\tthis.salmon.mouseEnabled=true;\n\t\t\tthis.skin.mouseEnabled=true;\n\t\t\tthis.ekora.mouseEnabled=true;\n\t\t}\n\t\t\n\t\t}", "function avvisaUtente() { // senza argomento\n alert('Ciao utente, ti sto avvisando');\n}", "function click(cuadrado) {\n\n // Función que nos permite activar el timer\n function activaTiempo(){\n tiempoJuego = setInterval(actualizaTiempo, 1000)\n tiempoActivo = true\n }\n \n // obtenemos el id del cuadrado\n let idActual = cuadrado.id\n // Si el tiempo no ha sido activado lo activamos\n if (!tiempoActivo) activaTiempo()\n // Si el juego ya ha terminado nos salimos\n if (juegoAcabado) return\n // Si el cuadrado ha sido chequeado o contiene una bandera nos salimos\n if (cuadrado.classList.contains('chequeado') || cuadrado.classList.contains('bandera')) return\n // Si contiene una bomba simplemente acaba el juego\n if (cuadrado.classList.contains('bomba')) {\n gameOver(cuadrado)\n } \n // En caso contrario lo descubrimos y colocamos el valor que contiene en el data que sera visible\n else {\n let total = cuadrado.getAttribute('data')\n if (total !=0) {\n cuadrado.classList.add('chequeado')\n if (total == 1) cuadrado.classList.add('uno')\n if (total == 2) cuadrado.classList.add('dos')\n if (total == 3) cuadrado.classList.add('tres')\n if (total == 4) cuadrado.classList.add('cuatro')\n if (total == 5) cuadrado.classList.add('cinco')\n if (total == 6) cuadrado.classList.add('seis')\n if (total == 7) cuadrado.classList.add('siete')\n if (total == 8) cuadrado.classList.add('ocho')\n cuadrado.innerHTML = total\n return\n }\n // Solo llegamos a este caso si el cuadrado es un cuadrado que permite expandirse \n chequeaCuadrado(cuadrado, idActual)\n }\n cuadrado.classList.add('chequeado')\n}", "function escucha_users(){\n\t/*Activo la seleccion de usuarios para modificarlos, se selecciona el usuario de la lista que\n\tse muestra en la pag users.php*/\n\tvar x=document.getElementsByTagName(\"article\");/*selecciono todos los usuarios ya qye se encuentran\n\tdentro de article*/\n\tfor(var z=0; z<x.length; z++){/*recorro el total de elemtos que se dara la capacidad de resaltar al\n\t\tser seleccionados mediante un click*/\n\t\tx[z].onclick=function(){//activo el evento del click\n\t\t\t/*La funcion siguiente desmarca todo los articles antes de seleccionar nuevamente a un elemento*/\n\t\t\tlimpiar(\"article\");\n\t\t\t$(this).css({'border':'3px solid #f39c12'});\n\t\t\tvar y=$(this).find(\"input\");\n\t\t\tconfUsers[indice]=y.val();\n\t\t\tconsole.log(confUsers[indice]);\n\t\t\t/* indice++; Comento esta linea dado que solo se puede modificar un usuario, y se deja para \n\t\t\tun uso posterior, cuando se requiera modificar o seleccionar a mas de un elemento, que se\n\t\t\talmacene en el arreglo de confUser los id que identifican al elemento*/\n\t\t\tsessionStorage.setItem(\"conf\", confUsers[indice]);\n\t\t};\n\t}\n}", "function ClickGerarAleatorioComum() {\n GeraAleatorioComum();\n AtualizaGeral();\n}", "function noweKonto(){\r\n clicked = true;\r\n}", "function iniciarCocina() {\n $(\".servirPedido\").click(servirPedido);\n \n checkForOrders();\n}", "function informationAcoout(){\n let btn = document.querySelector(\"#cont-menu > #user\");\n if(localStorage.getItem(\"user\")){\n btn.onclick = (e)=>{\n if(localStorage.getItem(\"user\")){\n location.replace(\"/login/informacioncuenta\");\n }else{\n urlCreateAccount();\n }\n }\n }else{\n urlCreateAccount();\n }\n}", "function ClickDesfazer() {\n gEntradas = JSON.parse(gEstado.Restaura());\n AtualizaGeralSemLerEntradas();\n}", "function ClickVisao(modo) {\n // Loop para esconder tudo.\n for (var j = 0; j < tabelas_visoes[modo].esconder.classes.length; ++j) {\n var divs_esconder = DomsPorClasse(tabelas_visoes[modo].esconder.classes[j]);\n for (var i = 0; i < divs_esconder.length; ++i) {\n divs_esconder[i].style.display = 'none';\n }\n }\n for (var i = 0; i < tabelas_visoes[modo].esconder.elementos.length; ++i) {\n var divs_combate = Dom(tabelas_visoes[modo].esconder.elementos[i]);\n divs_combate.style.display = 'none';\n }\n // Loop para mostrar.\n for (var j = 0; j < tabelas_visoes[modo].mostrar.classes.length; ++j) {\n var divs_mostrar = DomsPorClasse(tabelas_visoes[modo].mostrar.classes[j]);\n for (var i = 0; i < divs_mostrar.length; ++i) {\n divs_mostrar[i].style.display = 'block';\n }\n }\n for (var i = 0; i < tabelas_visoes[modo].mostrar.elementos.length; ++i) {\n var divs_combate = Dom(tabelas_visoes[modo].mostrar.elementos[i]);\n divs_combate.style.display = 'block';\n }\n gEntradas.modo_visao = modo;\n AtualizaGeralSemLerEntradas();\n}", "function verify() {\n //verifica en que pagina se encuentra, dependiendo de la pagina, su respectiva verificacion\n\n\n\n $(\"#altaProductoBoton\").on(\"click\", verificarAltaProducto);\n $(\"#altaCategoriaBoton\").on(\"click\", verificarAltaCategoria);\n $(\"#bajaProductoBoton\").on(\"click\", verificarBajaProducto);\n $(\"#modificarproductoBoton\").on(\"click\", verficiarModificarProducto);\n $(\"#modificarProductoConfirmBoton\").on(\"click\", verficiarModificarConfirmProducto);\n\n\n}", "function clickAssess() {\n\t$.trigger(\"clickAssess\");\n}", "siguienteNivel() {\n this.subNivel = 0;\n this.iluminarSecuencia();\n this.agregarEventosClick();\n }", "function ClickSalvar() {\n AtualizaGeral(); // garante o preenchimento do personagem com tudo que ta na planilha.\n var nome = gPersonagem.nome.length > 0 ? gPersonagem.nome : 'saved_entradas';\n if (nome == '--') {\n Mensagem('Nome \"--\" não é válido.');\n return;\n }\n HabilitaOverlay();\n SalvaNoArmazem(nome, JSON.stringify(gEntradas), function() {\n CarregaPersonagens();\n DesabilitaOverlay();\n Mensagem(Traduz('Personagem') + ' \"' + nome + '\" ' + Traduz('salvo com sucesso.'));\n });\n}", "function ClickVisualizacaoModoMestre() {\n gEntradas.modo_mestre = Dom('input-modo-mestre').checked;\n AtualizaGeralSemLerEntradas();\n}", "function checkUser(){\n //console.log('check user started');\n cumputerTurn = false;\n if(userClicked == true){\n \n }\n}", "function ClickAdicionarEscudo() {\n gEntradas.escudos.push({ chave: 'nenhum', obra_prima: false, bonus: 0 });\n AtualizaGeralSemLerEntradas();\n}", "function clickEnCasilla(x, y) {\n if (miPartida.tableroGirado) {\n x = 7 - x;\n y = 7 - y;\n }\n\n let blanca = esBlanca(miPartida.tablero[x][y]);\n let negra = esNegra(miPartida.tablero[x][y]);\n\n if (!miPartida.hayPiezaSelec) {\n if (miPartida.turno && blanca || !miPartida.turno && negra)\n realizarSeleccionPieza(x, y);\n } else {\n if (esMovValido(x, y)) {\n if (siPeonPromociona(x))\n modalPromocionPeon(x, y);\n else {\n enviarMovimiento(x, y, null);\n realizarMovimientoYComprobaciones(x, y, false);\n }\n } else {\n // Si la pieza pulsada no es la que estaba seleccionada, selecciono la nueva\n if (x !== miPartida.piezaSelec.x || y !== miPartida.piezaSelec.y) {\n // Compruebo que este pulsando una pieza y que sea de mi color\n if (miPartida.turno && blanca || !miPartida.turno && negra) {\n eliminarEstiloMovPosibles();\n realizarSeleccionPieza(x, y);\n }\n } else { // Si la pieza pulsada es la que estaba seleccionada, la deselecciono\n eliminarEstiloMovPosibles();\n deseleccionarPieza();\n }\n }\n }\n}", "function iniciar() {\n cuerpoTablaUsuario = document.getElementById('cuerpoTablaUsuario'); \n divRespuesta = document.getElementById('divRespuesta');\n var botonAlta = document.getElementById('botonAlta');\n botonAlta.addEventListener('click', altaUsuario); \n}", "function IniciarEventos(){\n\t$('#guardar').click(guardardatos)\n\t$('#cancelar').click(function(){window.history.back()})\n\tshowmessage()\n}", "function escucha_Permisos(){\n\t/*Activo la seleccion de usuarios para modificarlos, se selecciona el usuario de la lista que\n\tse muestra en la pag users.php*/\n\tvar x=document.getElementsByClassName(\"work_data\");/*selecciono todos los usuarios ya qye se encuentran\n\tdentro de article*/\n\tfor(var z=0; z<x.length; z++){/*recorro el total de elemtos que se dara la capacidad de resaltar al\n\t\tser seleccionados mediante un click*/\n\t\tx[z].onclick=function(){//activo el evento del click\n\t\t\tif($(this).find(\"input\").val()!=0){/*Encuentro el input con el valor de id de permiso*/\n\t\t\t\t/*La funcion siguiente desmarca todo los articles antes de seleccionar nuevamente a un elemento*/\n\t\t\t\tlimpiar(\".work_data\");\n\t\t\t\t$(this).css({'border':'3px solid #f39c12'});\n\t\t\t\tvar y=$(this).find(\"input\");/*Encuentro el input con el valor de id de permiso*/\n\t\t\t\tconfUsers[indice]=y.val();/*Obtengo el valor del input \"idPermiso\" y lo almaceno*/\n\t\t\t\tconsole.log(confUsers[indice]);\n\t\t\t\t/* indice++; Comento esta linea dado que solo se puede modificar un usuario, y se deja para \n\t\t\t\tun uso posterior, cuando se requiera modificar o seleccionar a mas de un elemento, que se\n\t\t\t\talmacene en el arreglo de confUser los id que identifican al elemento*/\n\t\t\t\tsessionStorage.setItem(\"confp\", confUsers[indice]);\n\t\t\t}\n\t\t};\n\t}\n}", "clickCheckOutOolongTea() {\n this.clickElem(this.btnCheckOutOolongTea);\n }", "function CambiarVista(){\r\n\tvar user = firebase.auth().currentUser;\r\n\tif (user) {\r\n\t console.log(\"seccion iniciada\");\r\n\t //MOVER LA FUNCION ADDUSER_INFO() ACA\r\n\t setTimeout(function(){\r\n window.location.href=\"index.html\";\r\n }, 3000);\r\n\t} else {\r\n\t alert(\"nadie ha iniciado seccion, R\");\r\n\t return;\r\n\t}\r\n}", "async function click(_event) {\n let vorschau = document.getElementById(\"vorschau\");\n clickCount += 1;\n let target = _event.currentTarget;\n let index = Number(target.dataset.index);\n document.getElementById(\"vorschau\").style.display = \"block\";\n let meineDaten = await konvertiereJSONinEinObjekt(url);\n if (clickCount == 1) {\n auswahlBroetchenTop = meineDaten.broetchenTop[index];\n auswahl = auswahlBroetchenTop;\n key = \"BrötchenTop: \";\n document.getElementById(\"auswahlFenster\").innerHTML = \"\";\n auswahlMoeglichkeiten(meineDaten.broetchenBottom);\n let bildVorschau = document.createElement(\"img\");\n bildVorschau.src = auswahl.bild;\n vorschau.appendChild(bildVorschau);\n }\n if (clickCount == 2) {\n möglichkeit.innerHTML = \"Pattie\";\n auswahlBroetchenBottom = meineDaten.broetchenBottom[index];\n auswahl = auswahlBroetchenBottom;\n key = \"BrötchenBottom: \";\n document.getElementById(\"auswahlFenster\").innerHTML = \"\";\n auswahlMoeglichkeiten(meineDaten.patties);\n let bildVorschau = document.createElement(\"img\");\n bildVorschau.src = auswahl.bild;\n vorschau.appendChild(bildVorschau);\n }\n if (clickCount == 3) {\n möglichkeit.innerHTML = \"Soße\";\n auswahlPattie = meineDaten.patties[index];\n auswahl = auswahlPattie;\n key = \"Pattie: \";\n document.getElementById(\"auswahlFenster\").innerHTML = \"\";\n auswahlMoeglichkeiten(meineDaten.sossen);\n let bildVorschau = document.createElement(\"img\");\n bildVorschau.src = auswahl.bild;\n vorschau.appendChild(bildVorschau);\n }\n if (clickCount == 4) {\n möglichkeit.style.display = \"none\";\n auswahlSosse = meineDaten.sossen[index];\n auswahl = auswahlSosse;\n key = \"Sosse: \";\n sessionStorage.setItem(key, JSON.stringify(auswahl));\n document.getElementById(\"auswahlFenster\").innerHTML = \"\";\n document.getElementById(\"vorschau\").style.display = \"none\";\n document.location.href = \"burger.html\";\n }\n // Aufgabe 1b) Speichere die Auswahlmöglichkeit im Browser-Cache\n sessionStorage.setItem(key, JSON.stringify(auswahl));\n }", "function hold_btn_Click(eventObject) {\r\n var userRole = cordys.getNodeText(GetPoUserMasterCompleteObjectModel.getData(), \".//*[local-name()='USER_ROLE']\", \"\", \"\");\r\n var callID = \"\";\r\n var currentRow = caseTbl.getCheckedRows();\r\n callID = callId[currentRow[0].index].getValue();\r\n if (userRole == \"StakeHolderMaker\") {\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='callId']\", callID);\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='action']\", 'HOLD');\r\n HoldReleaseDecisionOnCaseModel.reset();\r\n if (!HoldReleaseDecisionOnCaseModel.soapFaultOccurred) {\r\n if (callID != \"\") {\r\n xo__xElementbarButton__1_Click();\r\n application.notify(\"The case is held successfully\");\r\n hold_btn.hide();\r\n } else\r\n application.notify(\"Please select the case\");\r\n } else {\r\n application.notify(\"Holding failed. Please Contact the admin\");\r\n }\r\n } else if (userRole == \"ADMIN\" || userRole == \"VendorManager\") {\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='callId']\", callID);\r\n cordys.setNodeText(HoldReleaseDecisionOnCaseModel.getMethodRequest(), \".//*[local-name()='action']\", 'HOLD');\r\n HoldReleaseDecisionOnCaseModel.reset();\r\n if (!HoldReleaseDecisionOnCaseModel.soapFaultOccurred) {\r\n if (callID != \"\") {\r\n xo__xElementbarButton__1_Click();\r\n application.notify(\"The case is held successfully\");\r\n hold_btn.hide();\r\n } else\r\n application.notify(\"Please select the case\");\r\n } else {\r\n application.notify(\"Holding failed. Please Contact the admin\");\r\n }\r\n }\r\n}", "function inicio() {\n $(\"#cerrarSesion\").click(cerrarSesion);\n datosUser();\n itemsGuardados();\n}", "function mostrarAsignarNivel(){ // Cuando toque el boton \"asignar nivel\" voy a ver la seccion (Asignar nivel a alumnos)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n document.querySelector(\"#divMostrarTablaXDocente\").innerHTML = \"\"; //limpio tabla por posible interaccion anterior\r\n document.querySelector(\"#homeDocente\").style.display = \"block\"; //Habilito division docente\r\n document.querySelector(\"#divAsignarNivel\").style.display = \"block\"; // muestro asignar nivel\r\n document.querySelector(\"#bodyHome\").style.display = \"none\"; //Oculto body bienvenida\r\n document.querySelector(\"#divPlantearEje\").style.display = \"none\"; // oculto plantear ejercicios a alumnos\r\n document.querySelector(\"#divDevoluciones\").style.display = \"none\"; // oculto redactar devoluciones a tareas\r\n document.querySelector(\"#divEstadisticas\").style.display = \"none\"; // oculto visualizar estadisticas\r\n}", "function klikKlar() {\n document.querySelector(\"#knap\").addEventListener(\"click\", visResultat);\n}", "function ocultarLoginRegistro() {\n /* Oculta uno de los Divs: Login o Registro, según cuál link se haya clickeado */\n var clickeado = $(this).attr(\"alt\");\n var itemClickeado = $(\"#\" + \"div\" + clickeado);\n itemClickeado.removeClass(\"hidden\").siblings(\"div\").addClass(\"hidden\");\n $(\"#txt\" + clickeado + \"Nombre\").focus();\n $(\"#div\" + clickeado + \"Mensaje\").html(\"\");\n }", "function iniciarJuego() {\n\n\n //se determina el tiempo en milisegundos para ir cambiando\n setInterval(function() {\n segTranscurridos += 1;\n document.getElementById('cronometro').innerHTML = \"Tiempo: \" + segTranscurridos;\n }, 1000);\n\n\n\n //mando llamar la funcion para dibujar solo las minas\n dibujarMinas(ancho, alto, 'bombas');\n campoJuego = crearCampoJuego(ancho, alto, numMinas);\n\n var botonsitos = document.getElementsByName('botonsitos');\n\n for (var i = 0; i < botonsitos.length; i++) {\n document.getElementById(botonsitos[i].id).onclick = posicionactual;\n }\n segTranscurridos = 0;\n}", "function mouseClicked() {\n if (mouseY >= 620 && mouseY <= 720 && mouseX >= 1040 && mouseX <= 1280) {\n aanvalActie = false;\n aanvalKnopStatus = false;\n beweegActie = false;\n beweegKnopStatus = false;\n beurtVeranderen();\n veranderKleur(donkerblauw,wit);\n veranderKleur(lichtblauw,wit);\n }\n}", "function ocultable_click() {\n if (!edicion) {\n $(this).siblings('.ocultable-contenido').slideToggle();\n $(this).parent('.ocultable').siblings('.ocultable').children('.ocultable-contenido').slideUp()();\n }\n }", "function conocerEvento(e)\n{\n\n\tvar evento = e || window.event;\n\n\t\t//document.getElementById(\"evento\").value = e.type;\n\n // console.log(\"evento\");\n // console.log(e);\n\n if(evento.type == \"click\")\n {\n\n //console.log(\"nombre del click\");\n //console.log(evento.path[0].id);\n\n var nombreclick=evento.path[0].id;\n\n\n //continuar\n if(nombreclick.substr(0,10) == \"continuar\")\n {\n //alert(\"click\");\n //var id=nombreclick.substr(7);\n //console.log(\"comienza valor\");\n //console.log(nombreclick.substr(8));\n //alert(\"empezo entreno\");\n\n //id_plan = document.getElementById(\"codigoplan\").value;\n //console.log(id_sesion);\n //almacenarlocal('id_plan', id_plan);\n //una();\n\n }\n\n\n\n\n }\n\n\n // switch(evento.type) {\n // case 'mouseover':\n // this.style.borderColor = 'black';\n // break;\n // case 'mouseout':\n // this.style.borderColor = 'silver';\n // break;\n // }\n\n}", "function asignarEventoClickAprendiz(idAprendiz,identificacion,nombreCompleto,idFicha,idDetalleEstado,contador){\r\n\r\n\t$(\"#btnModificarAprendiz\"+contador).click(function(){\r\n\r\n\t\tlimpiarFormulario(\"formModificarAprendiz\");\r\n\t\t\r\n\t\t$(\"#txtIdAprendiz\").val(idAprendiz);\r\n\t\t\r\n\t\t$(\"#txtIdentificacionAprendizMod\").val(identificacion);\r\n\t\t$(\"#txtNombreCompletoAprendizMod\").val(nombreCompleto);\r\n\t\t$(\"#selectFichaAprendizMod\").val(idFicha);\r\n\t\t$(\"#selectDetalleEstadoAprendizMod\").val(idDetalleEstado);\r\n\t\t\r\n\t});\r\n}", "function changeUserStatut() {\n $('.sidebar').on('click', '.user-login li a', function(e) {\n e.preventDefault();\n var statut = $(this).find('span').text();\n currentStatut = $('.user-login button span').text();\n $('.user-login button span').text(statut);\n if (statut == 'Busy') {\n $('.user-login button i:not(.fa)').removeClass().addClass('busy');\n }\n if (statut == 'Invisible') {\n $('.user-login button i:not(.fa)').removeClass().addClass('turquoise');\n }\n if (statut == 'Away') {\n $('.user-login button i:not(.fa)').removeClass().addClass('away');\n }\n });\n}", "function posarBoleta(e) {\r\n// console.log(\"has clicat el \"+ e.target.getAttribute('id'));\r\n if (numDeClics==0) {\r\n //si guanya\r\n if (e.target.getAttribute('id')==aleatorio) {\r\n resultat(\"guany\", \"Felicitats :)\");\r\n // resultat(\"Felicitats :)\");\r\n //si perd\r\n }else{\r\n // resultat(\"Torna a provar! :S\");\r\n resultat(\"perd\", \"Torna a provar! :S\");\r\n\r\n }\r\n numDeClics=numDeClics+1;\r\n }\r\n}", "function cambiarEstado(e) {\r\n e.preventDefault();\r\n var contadore = 0;\r\n if (e.target.classList.contains('mes-Mesa') || e.target.classList.contains('mes-Mesa-circular')) {\r\n if (e.target.classList.contains('activo')) {\r\n e.target.classList.remove('activo');\r\n } else {\r\n for (var x = 0; x < reserva.children.length; x++) {\r\n if (reserva.children[x].classList.contains('activo')) {\r\n contadore++;\r\n }\r\n }\r\n if (contadore === 0 && !e.target.classList.contains('reservado')) {\r\n e.target.classList.add('activo');\r\n } else {\r\n Swal.fire({\r\n icon: 'error',\r\n title: 'No puede reservar mas de una mesa ni reservar una ocupada',\r\n text: 'Error'\r\n });\r\n }\r\n }\r\n }\r\n}", "creanOnClick() {\n\n var currentAssignmentType = AssignmentReactiveVars.CurrentAssignmentType.get();\n\n switch (currentAssignmentType) {\n case AssignmentType.USERTOTASK:\n console.error(\"Template.assignmentCalendar.events.click .creneau\", \"User can't normally click on this kind of element when in userToTask\");\n return;\n break;\n case AssignmentType.TASKTOUSER: //only display users that have at least one availability matching the selected time slot\n break;\n }\n }", "function verAcuerdoEspecialBonificaciones(id)\n{\nif(document.getElementById(\"divDatosAcuerdoEspecialBonificaciones\"+id).style.display==\"block\")\n {\n document.getElementById(\"divDatosAcuerdoEspecialBonificaciones\"+id).style.display=\"none\";\n document.getElementById(\"buttonVerDatosAcuerdoEspecialBonificaciones\"+id).innerHTML=\"Ver\";\n }\nelse\n {\n var requerimiento = new RequerimientoGet();\n requerimiento.setURL(\"acuerdobonificaciones/seleccionaracuerdo/ajax/datosAcuerdoBonificaciones.php\");\n requerimiento.addParametro(\"id\",id);\n requerimiento.addListener(respuestaVerDatosAcuerdoEspecialBonificaciones);\n requerimiento.ejecutar();\n }\n\n}", "elegirColor(ev){\n console.log(ev);\n //capturamos el color que presiona el usuario\n const nombreColor = ev.target.dataset.color;\n //convertimos a numero el color que selecciona el usuario\n const numeroColor = this.transformarColorANumero(nombreColor);\n //iluminamos el color que apreto el usuario\n this.iluminarColor(nombreColor);\n //comprobacion de lo que presiona el usuario, si elige bien, se incrementa el subnivel\n if (numeroColor === this.secuencia[this.subnivel]) {\n this.subnivel++;\n //comprobamos si el subnivel es igual al nivel en que esta el usuario, si es asi, incrementamos el nivel\n if (this.subnivel === this.nivel) {\n this.nivel++;\n //eliminamos los eventos click que ya ocurrieron\n this.eliminarEventosClick();\n if (this.nivel === (ULTIMO_NIVEL +1)) {\n this.ganarJuego();\n\n } else {\n setTimeout(this.siguienteNivel,1500);\n }\n } \n } else {\n //PIERDE\n this.perderJuego();\n }\n \n }", "function mostrarDevoluciones(){ // Cuando toque el boton \"devoluciones\" voy a ver la seccion (hacer devoluciones)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n document.querySelector(\"#homeDocente\").style.display = \"block\"; // habilito division docente\r\n document.querySelector(\"#bodyHome\").style.display = \"none\"; // oculto body bienvenida\r\n document.querySelector(\"#divAsignarNivel\").style.display = \"none\"; // oculto plantear ejercicios a alumnos\r\n document.querySelector(\"#divPlantearEje\").style.display = \"none\"; // oculto plantear tarea\r\n document.querySelector(\"#divEntregas\").style.display = \"none\"; // oculto tabla\r\n document.querySelector(\"#divDevoluciones\").style.display = \"block\"; // muestro redactar devoluciones a tareas\r\n document.querySelector(\"#divEstadisticas\").style.display = \"none\"; // oculto visualizar estadisticas\r\n}", "metodoClick(){\n console.log(\"diste click\")\n }", "function logNewsClickForUser(user_id, news_id, user_ip) {\n client.request('logNewsClickForUser', [user_id, news_id, user_ip], function(err, error, response) {\n if (err) throw err;\n });\n }", "function fAppMeteo() {\n $(\"#bokm\").click(fAffMeteo);\n}", "function sitClick(sitID) {\n \n currentSituation = findSituationByID(sitID);\n refreshRateIndicator();\n refreshSituationButtons();\n refreshSpiritQuotes();\n refreshSpiritIcon();\n refreshUnderstanding();\n \n}", "function _attivaIsola(){\r\n\t\t\t$('.isola').each(function(){\r\n\t\t\t\tif($(this).is('[id^=\"isola'+isolaIndex+'\"]')){\r\n\t\t\t\t\t$(this).addClass('attiva').removeClass('spenta');\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$(this).removeClass('attiva').addClass('spenta');\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\t$('.testo-isola#t'+isolaIndex).addClass('presente');\r\n\r\n\t\t\tclicking = true;\r\n\t\t}", "function mostrarEstDocente(){ // Cuando toque el boton \"estadisticas\" voy a ver la seccion (ver estadisticas)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n document.querySelector(\"#homeDocente\").style.display = \"block\"; //Habilito division docente\r\n document.querySelector(\"#bodyHome\").style.display = \"none\"; //Oculto body bienvenida\r\n document.querySelector(\"#divAsignarNivel\").style.display = \"none\"; // oculto plantear ejercicios a alumnos\r\n document.querySelector(\"#divPlantearEje\").style.display = \"none\"; // oculto plantear tarea\r\n document.querySelector(\"#divDevoluciones\").style.display = \"none\"; // oculto redactar devoluciones a tareas\r\n document.querySelector(\"#divEstadisticas\").style.display = \"block\"; // muestro visualizar estadisticas\r\n generarListaAlumnos();\r\n}", "function ActivarAyudaContextual(bDevolverExitoEjecucion)\r\n{\r\n\tif (bARQAyudasContActivas)\r\n\t\tquitarIconoAyudasCont();\r\n\telse\r\n\t\tponerIconoAyudasCont();\t\t\r\n}", "function triggerEvent(event, id) {\n\n event.addEventListener('click', function (e) {\n if (event.id == \"fallevent\") {\n document.getElementById(\"patient!@!local\").classList.add('rotate-fall');\n }\n if (event.id == \"normalevent\") {\n document.getElementById(\"patient!@!local\").classList.remove('rotate-fall');\n }\n fetch(`/${event.id}?username=${id}`, {\n method: 'POST'\n }).then(function (response) {\n response.json().then(function (json) {\n\n responseString = response.status + \" - \" + response.statusText;\n if (response.ok)\n return toastr[\"success\"](json.text, responseString);\n\n else if (response.status != 401)\n return toastr[\"warning\"](json.text, responseString);\n\n else\n throw new Error(responseString);\n });\n })\n .catch(function (error) {\n toastr.error(error, {\n timeOut: 10000\n });\n });\n });\n}", "function theClick() {\r\n console.log('inicia')\r\n dataNodes()\r\n dataElements()\r\n backEnd()\r\n}", "function cargarEvento(){\n\t\n\tif(document.readyState==\"interactive\"){\n\t\tdocument.getElementById(\"id_enviar\").addEventListener(\"click\",peticionAlta,false);\n\t}\n}", "clickHandler(evt) {\n if (evt.target.classList.contains('fa-check')) {\n gameApp.eventHandler(evt);\n }\n\n if (evt.target.classList.contains('assignment') || evt.target.parentElement.classList.contains('assignment')) {\n gameApp.activateContract(evt);\n }\n\n if (evt.target.classList.contains('loc')) {\n gameApp.addLoc();\n }\n\n if (evt.target.classList.contains('nav-button')) {\n let elem = evt.target;\n gameApp.gameView.changeMenue(elem);\n }\n }", "function iniciar(){ \r\n\tvar botonBuscar = document.getElementById( \"botonBuscar\" ); \r\n\tbotonBuscar.addEventListener( \"click\" , botonPresionado, false ); \r\n} // fin de la función iniciar ", "function verReservasClick(opcion){\r\n let container;\r\n let container2;\r\n let almacenados;\r\n \r\n switch (opcion)\r\n {\r\n \r\n case \"crucero\": \r\n //// Cruceros \r\n container = document.querySelector('#crucerosReservados');\r\n removeAllChildNodes(container);\r\n almacenados = JSON.parse(sessionStorage.getItem(\"pasajesCruceros\"));\r\n \r\n //Recorro lo que viene del JSON e inserto DIV con cada objeto almacenado\r\n \r\n for (const objeto of almacenados)\r\n {\r\n contenedor2 = document.createElement(\"div\");\r\n contenedor2.innerHTML = `<h4>${objeto.nombre}</h4>\r\n <h5> Reservado por: ${objeto.reservadoPor}</h5>\r\n <h5> Cantidad de personas: ${objeto.cantidad}</h5>\r\n <h5> $ ${objeto.precio}</h5>`;\r\n document.body.appendChild(contenedor2);\r\n document.getElementById(\"crucerosReservados\").appendChild(contenedor2);\r\n }\r\n break;\r\n \r\n \r\n case \"aereo\":\r\n ///// Aereos\r\n container = document.querySelector('#aereosReservados');\r\n removeAllChildNodes(container);\r\n almacenados = JSON.parse(sessionStorage.getItem(\"pasajesAereos\"));\r\n \r\n //Recorro lo que viene del JSON e inserto DIV con cada objeto almacenado\r\n \r\n for (const objeto of almacenados)\r\n {\r\n contenedor2 = document.createElement(\"div\");\r\n contenedor2.innerHTML = `<h4>${objeto.nombre}</h4>\r\n <h5> Reservado por: ${objeto.reservadoPor}</h5>\r\n <h5> Cantidad de personas: ${objeto.cantidad}</h5>\r\n <h5> $ ${objeto.precio}</h5>`;\r\n document.body.appendChild(contenedor2);\r\n document.getElementById(\"aereosReservados\").appendChild(contenedor2);\r\n }\r\n break;\r\n \r\n case \"auto\": \r\n //// AUTOS\r\n \r\n container = document.querySelector('#autosReservados');\r\n removeAllChildNodes(container);\r\n almacenados = JSON.parse(sessionStorage.getItem(\"autosReservados\"));\r\n \r\n //Recorro lo que viene del JSON e inserto DIV con cada objeto almacenado\r\n \r\n for (const objeto of almacenados)\r\n {\r\n contenedor2 = document.createElement(\"div\");\r\n contenedor2.innerHTML = `<h4>${objeto.nombre}</h4>\r\n <h5> Reservado por: ${objeto.reservadoPor}</h5>\r\n <h5> Cantidad de días: ${objeto.cantidad}</h5>\r\n <h5> ${objeto.seguro}</h5>\r\n <h5> $ ${objeto.precio}</h5>`;\r\n document.body.appendChild(contenedor2);\r\n document.getElementById(\"autosReservados\").appendChild(contenedor2);\r\n }\r\n \r\n break;\r\n \r\n default:\r\n break;\r\n }\r\n \r\n }", "function constroiEventos(){}", "function cambioDePagina(xhttp) {\r\n let paginaAnterior = document.getElementById(\"paginaAnterior\");\r\n\r\n let paginaSiguiente = document.getElementById(\"paginaSiguiente\");\r\n\r\n paginaAnterior.addEventListener(\"click\", function() {\r\n if (xhttp.info.prev) {\r\n traerPersonaje(xhttp.info.prev, insertarCartas);\r\n\r\n } else {\r\n alert(\"No hay paginas antes de esta\")\r\n }\r\n });\r\n paginaSiguiente.addEventListener(\"click\", function() {\r\n if (xhttp.info.next) {\r\n traerPersonaje(xhttp.info.next, insertarCartas);\r\n\r\n } else {\r\n alert(\"No hay paginas despues de esta\")\r\n }\r\n\r\n });\r\n}", "function onyeshaYaliyomo(kiungo, e, rangi, id) {\n e.preventDefault();\n let viungo, yaliyomo;\n viungo = document.getElementsByClassName(\"kiungo\");\n yaliyomo = document.getElementsByClassName(\"yaliyomo\");\n\n // ficha 'yaliyomo' zote kabla ya yote\n for (let index = 0; index < yaliyomo.length; index++) {\n const element = yaliyomo[index];\n element.style.display = \"none\";\n }\n\n // Ondoa darasa la 'hai' kwenye viungo vyote\n for (let index = 0; index < viungo.length; index++) {\n const kiungo = viungo[index];\n kiungo.className = kiungo.className.replace(\" hai\", \"\");\n kiungo.style.backgroundColor = \"transparent\";\n }\n\n // Onyesha kiungo hai na Yaliyomo yake\n kiungo.className += \" hai\";\n kiungo.style.backgroundColor = rangi;\n let yaliyomoHai = document.getElementById(id);\n let seksheni = document.getElementById(\"tabu-kurasa-nzima\");\n yaliyomoHai.style.display = \"block\";\n // yaliyomoHai.style.backgroundColor = rangi;\n seksheni.style.backgroundColor = rangi;\n}", "function addEventsEntrega(){\r\n let btnsEntrega = document.querySelectorAll(\".entrega\"); \r\n for(let i=0; i<btnsEntrega.length; i++){\r\n const element = btnsEntrega[i];\r\n element.addEventListener(\"click\", realizarEntrega);\r\n }\r\n}", "function asignarEventoClickPregunta(idPregunta,nombre,idDetalleTipoFormacion,idDetalleEstado,contador){\r\n\r\n\t$(\"#btnModificarPregunta\"+contador).click(function(){\r\n\r\n\t\tlimpiarFormulario(\"formModificarPregunta\");\r\n\r\n\t\t$(\"#txtIdPregunta\").val(idPregunta);\r\n\t\t$(\"#txtNombrePreguntaMod\").val(nombre);\r\n\t\t$(\"#selectDetalleTipoFormacionPreguntaMod\").val(idDetalleTipoFormacion);\r\n\t\t$(\"#selectDetalleEstadoPreguntaMod\").val(idDetalleEstado);\r\n\t});\r\n}", "click_Homescreen_TVShows(){\n this.Homescreen_TVShows.waitForExist();\n this.Homescreen_TVShows.click();\n }", "pageClicked(event)\n {\n let trigger = this.$refs.trigger ? this.$refs.trigger : this.$el;\n\n if (! this.hasUserAttention() || trigger === event.target) return;\n\n trigger.contains(event.target) ? null : this.lostUserAttention();\n }", "function verAcuerdoBonificaciones(id)\n{\nif(document.getElementById(\"divDatosAcuerdoBonificaciones\"+id).style.display==\"block\")\n {\n document.getElementById(\"divDatosAcuerdoBonificaciones\"+id).style.display=\"none\";\n document.getElementById(\"buttonVerDatosAcuerdoBonificaciones\"+id).innerHTML=\"Ver\";\n }\nelse\n {\n var requerimiento = new RequerimientoGet();\n requerimiento.setURL(\"acuerdobonificaciones/seleccionaracuerdo/ajax/datosAcuerdoBonificaciones.php\");\n requerimiento.addParametro(\"id\",id);\n requerimiento.addListener(respuestaVerDatosAcuerdoBonificaciones);\n requerimiento.ejecutar();\n }\n\n}", "function verificaClique(verifyClick) {\n if (verifyClick == \"btn btnCronometro\") {\n document.querySelector('.btn.btnPausar').disabled = false;\n document.querySelector('.btn.btnCronometro').disabled = true;\n } else if ((verifyClick == \"btn btnPausar\")) {\n document.querySelector('.btn.btnCronometro').disabled = false;\n document.querySelector('.btn.btnPausar').disabled = true;\n } else if (verifyClick == \"btn btnZerar\") {\n document.querySelector('.btn.btnCronometro').disabled = false;\n document.querySelector('.btn.btnPausar').disabled = false;\n clearInterval(intervalo);\n document.querySelector('.marcaTempo').innerHTML = '';\n hr.style.display = 'none';\n min.style.display = 'none';\n divisao1.style.display = 'none';\n divisao2.style.display = 'none';\n }\n}", "function gestion_actividades(objetoDOM){\r\n //Este bucle determina el nombre del formulario actual (padre del elemento al que se ha dado click)\r\n do\r\n obj = objetoDOM.parentNode;//Se recorren los padres del elemento clickeado\r\n while(obj.tagName !== \"FORM\");//Se detiene hasta que encuentra un FORM, esto por medio de las propiedades del DOM directamente\r\n \r\n //Variable anónima que guarda el nombre del formulario como un string\r\n nombreFormularioActual = \"\";\r\n nombreFormularioActual = obj.name;\r\n \r\n //variable que guarda el value del hidden actividad del form actual en forma de string\r\n actividad = \"\";\r\n tipo_consulta = \"\";\r\n url = \"\";\r\n objParametros = {};\r\n \r\n actividad = $('#' + nombreFormularioActual + ' #actividad').val();//Primero se busca dentro del formulario que haga match con el id del form actual cualquier elemento con id #actividad, después se le saca el value con jQuey\r\n boton = $(objetoDOM).attr('id');//Se obtiene el id del botón pulsado por medio jQuery. Para que funcione, el elemento debe mandar su contexto (this) como parametro en la invocación del evento onclick.\r\n \r\n console.log(actividad);\r\n console.log(boton);\r\n \r\n //Dependiedo del botón pulsado será el tipo de consulta \r\n switch(boton){\r\n case \"btn_detalles_actividad\":{//Si es el de detalles\r\n url = 'view/Administradores/itz_detalles_actividad.php';\r\n tipo_consulta = \"detalles_actividad\";\r\n objParametros = {\r\n 'actividad' : actividad,//Ya fue declarada y asignadaanteriormente\r\n 'tipo_consulta' : tipo_consulta//Es necesario este parámetro porque en el servidor hay un switch que decide qué hacer de acuerdo al tipo de consulta\r\n };\r\n break;\r\n }//END CASE\r\n case \"btn_alumnos_inscritos\":{\r\n \turl = 'view/Administradores/itz_alumnos_inscritos_actividad.php';\r\n tipo_consulta = \"alumnos_actividad\";\r\n objParametros = {\r\n 'actividad' : actividad,\r\n 'tipo_consulta' : tipo_consulta\r\n };\r\n break;\r\n }//END CASE\r\n case \"btn_modificar_actividad\":{\r\n url = \"view/Administradores/itz_modificar_actividad.php\";\r\n tipo_consulta = \"modificar_actividad\";\r\n objParametros = {\r\n 'actividad' : actividad,\r\n 'tipo_consulta' : tipo_consulta\r\n };\r\n break;\r\n }//END CASE\r\n case \"btn_confirmar_eliminar\":{\r\n url = \"view/Administradores/itz_eliminar_actividad.php\";\r\n tipo_consulta = \"eliminar_actividad\";\r\n objParametros = {\r\n 'actividad' : actividad,\r\n 'tipo_consulta' : tipo_consulta\r\n };\r\n \r\n //cadena = \"<script> vex.defaultOptions.className = 'vex-theme-wireframe'; vex.dialog.open({ message: \" + \"'Estás a punto de ELIMINAR esta Actividad Complementaria ¿Deseas Continuar?', input: \" + '\"<input name=' + \"'user'\" + \"type='hidden'\" + \"placeholder='Pon El usuario acá'\" + 'required/><input name=' + \"'pass' type='hidden'\" + \"placeholder='Pon la contraseña acá' required/>\" + '\",' + 'buttons: [$.extend({}, vex.dialog.buttons.YES, {text: \"Continuar\"}), $.extend({}, vex.dialog.buttons.NO, {text: \"Cancelar\"})] }); </script>';\r\n console.log(cadena);\r\n $(\"#sub_contenido\").html(cadena);\r\n /*\r\n url = \"view/Administradores/itz_eliminar_actividad\";\r\n tipo_consulta = \"eliminar_actividad\";\r\n objParametros = {\r\n 'actividad' : actividad,\r\n 'tipo_consulta' : tipo_consulta\r\n };*/\r\n break;\r\n }//END CASE\r\n }//END SWITCH\r\n \r\n //Se pone un gif mientras se realizan las operaciones AJAX\r\n crear_loading_subcontenido();\r\n //$(\"#sub_contenido\").html(\"<center><figure><img src='view/img/loading.gif' width='30%' height='30%'/><figurecaption>Espere por favor...</figurecaption></figure></center>\");\r\n \r\n $.ajax({\r\n type: 'POST',\r\n url: url,//Obtenida de la que está a nivel de función\r\n data: objParametros,//Obtenida de la que está a nivel de función\r\n success: function(respuesta){//Respuesta es lo que pone PHP en pantalla, prácticamente es traer al PHP si la consulta fue successfuly\r\n $(\"#contenido\").html(respuesta);\r\n }//END SUCCESS\r\n });//END AJAX\r\n}//END FUNCTION", "function acceder(usuario){\n console.log(`2. ${usuario} Ahora puedes acceder`)\n entrar();\n}", "function clickHandler(e) {\n // cleanup the event handlers\n yesbutton.removeEventListener('click', clickHandler);\n nobutton.removeEventListener('click', clickHandler);\n\n // Hide the dialog\n screen.classList.remove('visible');\n\n // Call the appropriate callback, if it is defined\n if (e.target === yesbutton) {\n if (yescallback)\n yescallback();\n }\n else {\n if (nocallback)\n nocallback();\n }\n\n // And if there are pending permission requests, trigger the next one\n if (pending.length > 0) {\n var request = pending.shift();\n window.setTimeout(function() {\n requestPermission(request.message,\n request.yescallback,\n request.nocallback);\n }, 0);\n }\n }", "function gps_permitirConsulta() {\n if (!consultando) {\n gps_pausarAutoConsultaAuto();\n gps_bloquearComponente(\"btn_consulta\", false);\n } else {\n gps_bloquearComponente(\"btn_consulta\", true);\n }\n}", "function clickBotonMeGusta(selectorDivMeGusta, listID, itemID) {\n var meGusta = false;\n var textoBotonLike = $(selectorDivMeGusta + \" .botonLike\").text();\n if (textoBotonLike != \"\") {\n if (textoBotonLike == \"Me gusta\") { meGusta = true; }\n\n SP.SOD.executeFunc(\"sp.js\", \"SP.ClientContext\", function () { \n var aContextObject = new SP.ClientContext(_spPageContextInfo.webServerRelativeUrl);\n SP.SOD.executeFunc('reputation.js', 'Microsoft.Office.Server.ReputationModel.Reputation', function () {\n Microsoft.Office.Server.ReputationModel.Reputation.setLike(aContextObject, listID.substring(1, 37), itemID, meGusta);\n\n aContextObject.executeQueryAsync(\n function () {\n obtenerCantidadMeGustaItem(selectorDivMeGusta, listID, itemID);\n }, function (sender, args) {\n });\n });\n });\n }\n}", "clickCheckOutGreenTea() {\n this.clickElem(this.btnCheckOutGreenTea);\n }", "function suivant(){\n if(active==\"idee\"){\n reunion_open();\n }else if (active==\"reunion\") {\n travail_open();\n }else if (active==\"travail\") {\n deploiement_open();\n }\n }", "function miniaturaClick(elemento) {\n var miniatura = 0;\n //esto determinara que parametro mandar a la funcion controles();\n for (var i = 0; i < cantidadElementos; i++) {\n if (elemento == posicionesMiniaturas[i]) {\n miniatura = i;\n }\n }\n //aqui se le pasa a controles(); el numero de veces que se moveran las imagenes asi como la dirección (derecha o izquierda)\n var cantidad = 0;\n if (elementoActivo < miniatura) {\n for (var i = elementoActivo; elementoActivo < miniatura; i++) {\n cantidad = cantidad + 1;\n controles(\"derechaSlider\", cantidad, \"click\");\n }\n } else {\n for (var i = elementoActivo; miniatura < elementoActivo ; i++) {\n cantidad = cantidad + 1;\n controles(\"izquierdaSlider\", cantidad, \"click\");\n }\n }\n}", "function eventsAction() {\n // Despliega la seccion de detalle de información del proyecto\n $('.projectInformation')\n .unbind('click')\n .on('click', function () {\n $('.invoice__section-finder').css({ top: '-100%' });\n $('.projectfinder').removeClass('open');\n\n let rotate = $(this).attr('class').indexOf('rotate180');\n if (rotate >= 0) {\n $('.invoice__section-details').css({\n top: '-100%',\n bottom: '100%',\n });\n $(this).removeClass('rotate180');\n } else {\n $('.invoice__section-details').css({\n top: '32px',\n bottom: '0px',\n });\n $(this).addClass('rotate180');\n }\n });\n\n // Despliega la sección de seleccion de proyecto y cliente\n $('.projectfinder')\n .unbind('click')\n .on('click', function () {\n $('.invoice__section-details').css({\n top: '-100%',\n bottom: '100%',\n });\n $('.projectInformation').removeClass('rotate180');\n\n let open = $(this).attr('class').indexOf('open');\n if (open >= 0) {\n $('.invoice__section-finder').css({ top: '-100%' });\n $(this).removeClass('open');\n } else {\n $('.invoice__section-finder').css({ top: '32px' });\n $(this).addClass('open');\n }\n });\n\n // Despliega y contrae las columnas de viaje y prueba\n $('.showColumns')\n .unbind('click')\n .on('click', function () {\n let rotate = $(this).attr('class').indexOf('rotate180');\n viewStatus = rotate >= 0 ? 'E' : 'C';\n expandCollapseSection();\n });\n\n // Despliega y contrae el menu de opciones de secciones\n $('.invoice_controlPanel .addSection')\n .unbind('click')\n .on('click', function () {\n $('.menu-sections').slideDown('slow');\n $('.menu-sections').on('mouseleave', function () {\n $(this).slideUp('slow');\n sectionShowHide();\n });\n });\n\n // muestra en la cotización la seccion seleccionada\n $('.menu-sections ul li')\n .unbind('click')\n .on('click', function () {\n let item = $(this).attr('data-option');\n glbSec = $(this).attr('data-option');\n $(this).hide();\n\n $(`#SC${item}`).show();\n });\n\n // Despliega y contrae el listado de projectos\n $('.invoice_controlPanel .toImport')\n .unbind('click')\n .on('click', function () {\n let pos = $(this).offset();\n $('.import-sections')\n .slideDown('slow')\n .css({ top: '30px', left: pos.left + 'px' })\n .on('mouseleave', function () {\n $(this).slideUp('slow');\n });\n\n fillProjectsAttached();\n });\n\n // Despliega la lista de productos para agregar a la cotización\n $('.invoice__box-table .invoice_button')\n .unbind('click')\n .on('click', function () {\n let item = $(this).parents('tbody').attr('id');\n glbSec = item.substring(3,2); // jjr\n showListProducts(item);\n });\n \n // Elimina la sección de la cotización\n $('.removeSection')\n .unbind('click')\n .on('click', function () {\n let id = $(this);\n let section = id.parents('tbody');\n section.hide().find('tr.budgetRow').remove();\n sectionShowHide();\n });\n\n // Guarda version actual\n $('.version__button .toSaveBudget')\n .unbind('click')\n .on('click', function () {\n let boton = $(this).html();\n let nRows = $(\n '.invoice__box-table table tbody tr.budgetRow'\n ).length;\n if (nRows > 0) {\n let pjtId = $('.version_current').attr('data-project');\n glbpjtid=pjtId;\n let verId = $('.version_current').attr('data-version');\n let discount = parseFloat($('#insuDesctoPrc').text()) / 100;\n\n if (verId != undefined){\n modalLoading('S');\n let par = `\n [{\n \"pjtId\" : \"${pjtId}\",\n \"verId\" : \"${verId}\",\n \"discount\" : \"${discount}\",\n \"action\" : \"${interfase}\"\n }]`;\n console.log('SaveBudget',par);\n var pagina = 'ProjectPlans/SaveBudget';\n var tipo = 'html';\n var selector = putsaveBudget;\n fillField(pagina, par, tipo, selector);\n } else{\n alert('No tienes una version creada, ' + \n 'debes crear en el modulo de cotizaciones');\n }\n }\n });\n\n // Guarda nueva version del presupuesto\n $('.version__button .toSaveBudgetAs')\n .unbind('click')\n .on('click', function () {\n let boton = $(this).html();\n let nRows = $(\n '.invoice__box-table table tbody tr.budgetRow'\n ).length;\n if (nRows > 0) {\n let pjtId = $('.version_current').attr('data-project');\n glbpjtid=pjtId;\n // let verCurr = $('.sidebar__versions .version__list ul li:first').attr('data-code');\n let verCurr = lastVersionFinder();\n let vr = parseInt(verCurr.substring(1, 10));\n\n let verNext = 'R' + refil(vr + 1, 4);\n let discount = parseFloat($('#insuDesctoPrc').text()) / 100;\n let lastmov = moment().format(\"YYYY-MM-DD HH:mm:ss\"); //agregado por jjr\n //console.log('FECHA- ', lastmov);\n if (vr != undefined){ //agregado por jjr\n modalLoading('S');\n let par = `\n [{\n \"pjtId\" : \"${pjtId}\",\n \"verCode\" : \"${verNext}\",\n \"discount\" : \"${discount}\",\n \"lastmov\" : \"${lastmov}\"\n }]`;\n\n var pagina = 'ProjectPlans/SaveBudgetAs';\n var tipo = 'html';\n var selector = putSaveBudgetAs;\n fillField(pagina, par, tipo, selector);\n } else{\n alert('No tienes una version creada, ' + \n 'debes crear en el modulo de cotizaciones');\n }\n }\n });\n\n // Edita los datos del proyecto\n $('#btnEditProject')\n .unbind('click')\n .on('click', function () {\n let pjtId = $('.projectInformation').attr('data-project');\n editProject(pjtId);\n });\n\n // Agrega nueva cotización\n $('.toSave')\n .unbind('click')\n .on('click', function () {\n let pjtId = $('.version_current').attr('data-project');\n let verId = $('.version_current').attr('data-version');\n promoteProject(pjtId, verId);\n });\n // Imprime la cotización en pantalla\n $('.toPrint')\n .unbind('click')\n .on('click', function () {\n let verId = $('.version_current').attr('data-version');\n printBudget(verId);\n });\n\n // Busca los elementos que coincidan con lo escrito el input de cliente y poyecto\n $('.inputSearch')\n .unbind('keyup')\n .on('keyup', function () {\n let id = $(this);\n let obj = id.parents('.finder__box').attr('id');\n let txt = id.val().toUpperCase();\n sel_items(txt, obj);\n });\n\n $('.cleanInput')\n .unbind('click')\n .on('click', function () {\n let id = $(this).parents('.finder__box').children('.invoiceInput');\n id.val('');\n id.trigger('keyup');\n });\n\n // Limpiar la pantalla\n $('#newQuote')\n .unbind('click')\n .on('click', function () {\n window.location = 'ProjectDetails';\n });\n\n // Abre el modal de comentarios\n $('.sidebar__comments .toComment')\n .unbind('click')\n .on('click', function () {\n showModalComments();\n });\n\n expandCollapseSection();\n}", "function ClickAbrir() {\n var nome = ValorSelecionado(Dom('select-personagens'));\n if (nome == '--') {\n Mensagem('Nome \"--\" não é válido.');\n return;\n }\n var eh_local = false;\n if (nome.indexOf('local_') == 0) {\n eh_local = true;\n nome = nome.substr(6);\n } else {\n nome = nome.substr(5);\n }\n var handler = {\n nome: nome,\n f: function(dado) {\n if (nome in dado) {\n gEntradas = JSON.parse(dado[nome]);\n CorrigePericias();\n AtualizaGeralSemLerEntradas();\n SelecionaValor('--', Dom('select-personagens'));\n Mensagem(Traduz('Personagem') + ' \"' + nome + '\" ' + Traduz('carregado com sucesso.'));\n } else {\n Mensagem(Traduz('Não encontrei personagem com nome') + ' \"' + nome + '\"');\n }\n DesabilitaOverlay();\n },\n };\n HabilitaOverlay();\n AbreDoArmazem(nome, eh_local, handler.f);\n}", "function iniciar(){\n\t\n\tvar btnOkAlerta = document.getElementById(\"okalerta\");\n\tvar btnWarning = document.getElementById(\"okwarning\");\n\tvar btnSucess = document.getElementById(\"oksucess\");\n\n\tbtnOkAlerta.addEventListener(\"click\", function(e){\n\t\te.target.parentNode.parentNode.classList.remove(\"active\");\n\t}, false);\n\tbtnWarning.addEventListener(\"click\", function(e){\n\t\te.target.parentNode.parentNode.classList.remove(\"active\");\n\t}, false);\n\tbtnSucess.addEventListener(\"click\", function(e){\n\t\t\te.target.parentNode.parentNode.classList.remove(\"active\");\n\t}, false);\n\n\tvar btnEnviar = document.getElementById(\"enviar\");\n\tbtnEnviar.addEventListener(\"click\", procesarRecarga, false);\n}", "function voltarEtapa3() {\n msgTratamentoEtapa4.innerHTML = \"\";\n //recebendo H3 e setando nela o texto com o nome do cliente\n var tituloDaEtapa = document.querySelector(\"#tituloDaEtapa\");\n tituloDaEtapa.textContent = \"3º Etapa - Colaborador\";\n\n document.getElementById('selecionarPacotes').style.display = 'none'; //desabilita a etapa 4\n document.getElementById('selecionarFuncionarios').style.display = ''; //habilita a etapa 3\n }", "function iniciar(){\n\t\t\tdocument.getElementById(\"enviar\").addEventListener('click',validar,false);\n\t\t}", "function habilitarEntradas(){\n //evento del movimiento del mouse\n document.addEventListener('mousemove',function(evt){\n raton.x=evt.pageX-canvas.offsetLeft - 6;\n raton.y=evt.pageY-canvas.offsetTop - 28;\n },false);\n\n //evento del click del mouse\n document.addEventListener('mouseup', function(evt){\n ultimaliberacion=evt.which;\n },false);\n //evento del soltar el click del mouse \n canvas.addEventListener('mousedown',function(evt){\n evt.preventDefault();\n ultinaPresion=evt.which;\n },false);\n}", "function checkJawabanUntukuser(e){\n\t//hapus tombol cek berhasilan\n\tcekKeberhasilan.classList.add('d-none');\n\t//tampilkan tombol loading\n\tbtn_loading.classList.add('d-block');\n\t//menunggu 3 detik\n\tsetTimeout(function(){\n\t//tarik kembali jendela browser\n\twindow.scrollTo(0,0);\n\t//cek jawaban ketika ada jawaban yang di pilih salah \n\tselainPilihanbenar.forEach(function(jawabanSoalketikaSalah){\n\t//jika jawaban ada yang salah tampilkan info kesalahan\n\tif(jawabanSoalketikaSalah.checked){\n\t//berikan info dan pengertian jawaban pada user\n\tinfo_jawaban.forEach(function(tampilkanInfo){\n\ttampilkanInfo.classList.add('d-block');\n\t});\n\t//berikan info kesalahan kepada user\n\tinfo_salah.classList.add('d-block');\n\t\t}\n});\n\t\t\n\t//cek jawaban ketika benar\n\tjawaban.forEach(function(jawabanSoal){\n\t//jika jawaban benar semua tampilkan info\n\tif(jawabanSoal.checked){\n\t//berikan info dan pengertian jawaban pada user\n\tinfo_jawaban.forEach(function(tampilkanInfo){\n\ttampilkanInfo.classList.add('d-block');\n\t});\n\t//berikan info benar kepada user\n\tinfo_benar.classList.add('d-block');\n\t//jika selain ada jawaban yang salah\n\t }else if(jawabanSoal.checked || jawabanSoal.checked == false){\n\t //hapus info benar kepada user dan berikan kesalahan jawaban salah\n\tinfo_benar.classList.remove('d-block');\n\t }\t\n\t });\n\t//hilangkan tombol loading\n\tbtn_loading.classList.remove('d-block');\n\t}, 3000);\n}", "function ClickGerarResumo() {\n AtualizaGeral(); // garante o preenchimento do personagem com tudo que ta na planilha.\n var input = Dom(\"resumo-personagem-2\");\n input.value = GeraResumo();\n input.focus();\n input.select();\n}", "function template_eventosFavoritos() {\n\t$(\".btnBotones.estrella\").unbind();\n\t$(\".btnBotones.estrella\").each(function(){\n\t\tvar elemento = $(this);\n\t\t\n\t\t$(this).on({\n\t\t\tclick: function() {\n\t\t\t\tvar tempUrl = \"\";\n\t\t\t\tvar datos;\n\t\t\t\t\n\t\t\t\tif (typeof elemento.attr(\"data-inmueble\") !== 'undefined') {\n\t\t\t\t\ttempUrl = \"lib_php/updFavoritoInmueble.php\";\n\t\t\t\t\tdatos = {\n\t\t\t\t\t\tid: elemento.attr(\"data-id\"),\n\t\t\t\t\t\tinmueble: elemento.attr(\"data-inmueble\")\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\ttempUrl = \"lib_php/updFavoritoDesarrollo.php\";\n\t\t\t\t\tdatos = {\n\t\t\t\t\t\tid: elemento.attr(\"data-id\"),\n\t\t\t\t\t\tdesarrollo: elemento.attr(\"data-desarrollo\")\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$.ajax({\n\t\t\t\t\turl: tempUrl,\n\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\tdata: datos\n\t\t\t\t}).always(function(respuesta_json){\n\t\t\t\t\tif (respuesta_json.isExito == 1) {\n\t\t\t\t\t\tif (parseInt(respuesta_json.id) == 0)\n\t\t\t\t\t\t\telemento.removeClass(\"activo\");\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\telemento.addClass(\"activo\");\n\t\t\t\t\t\telemento.attr(\"data-id\", respuesta_json.id);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t$(\"#template_alertPersonalizado td\").text(\"Inicia sesión o regístrate para agregar tus inmuebles/desarrollos favoritos.\");\n\t\t\t\t\t\ttemplate_alertPersonalizado();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t});\n}", "function acceder(){\r\n limpiarMensajesError()//Limpio todos los mensajes de error cada vez que corro la funcion\r\n let nombreUsuario = document.querySelector(\"#txtUsuario\").value ;\r\n let clave = document.querySelector(\"#txtClave\").value;\r\n let acceso = comprobarAcceso (nombreUsuario, clave);\r\n let perfil = \"\"; //variable para capturar perfil del usuario ingresado\r\n let i = 0;\r\n while(i < usuarios.length){\r\n const element = usuarios[i].nombreUsuario.toLowerCase();\r\n if(element === nombreUsuario.toLowerCase()){\r\n perfil = usuarios[i].perfil;\r\n usuarioLoggeado = usuarios[i].nombreUsuario;\r\n }\r\n i++\r\n }\r\n //Cuando acceso es true \r\n if(acceso){\r\n if(perfil === \"alumno\"){\r\n alumnoIngreso();\r\n }else if(perfil === \"docente\"){\r\n docenteIngreso();\r\n }\r\n }\r\n}", "function handleClick() {\n Swal.fire({\n title: '¡Atencion!',\n text: '¿ Esta seguro que desea continuar ?',\n icon: 'info',\n confirmButtonText: 'Si',\n confirmButtonColor: '#00afe1',\n cancelButtonText: 'Cancelar',\n showCancelButton: true,\n allowEnterKey: true,\n allowEscapeKey: false,\n allowOutsideClick: false,\n stopKeydownPropagation: true\n }).then((result) => {\n if (result.isConfirmed) {\n Swal.fire({\n icon: 'success',\n title: 'Gracias por confiar en Glavic!',\n text: 'Estas a un paso de finalizar tu pedido. Te pedimos que valides tus datos en el siguiente formulario para confirmar tu pedido.',\n confirmButtonText: 'Ok',\n confirmButtonColor: '#00afe1',\n });\n } else if (result.isDenied) {\n Swal.fire({\n icon: 'error',\n title: 'Ups!',\n text: 'Algo no salio como esperabamos, vuelva a intentar la operacion',\n timer: 1500\n });\n }\n })\n }", "function activarHerramientaPerfil() {\n console.log(\"Activar herramienta perfil\");\n\n crearYCargarCapaLineaPerfil();\n activarControlDibujo();\n\n\n}", "function ejecutaAccion(elemt, type, proyect ){\n\tactividadPrevia = true;\n\tborradoMultiple = false;\n\tcambiandoCategoria = false;\n\t\n\tif(!$(\"#tipoIdentificacion\").length){\n\t\t if( $(elemt).closest(\"div\").text().indexOf(\"Frente\") != (-1)) {\n\t\t\t\t$(\".cred_image:eq(0) input.custumStlFileUploadPreview\").trigger(\"click\");\n\t\t\t\t//$(\".cred_image:eq(0)\").addClass(\"opacity\"); \n\t\t\t}\n\t\t\t\t\n\t\t if( $(elemt).closest(\"div\").text().indexOf(\"Reverso\") != (-1)) {\n\t\t\t\t$(\".cred_image:eq(1) input.custumStlFileUploadPreview\").trigger(\"click\");\n\t\t\t\t//$(\".cred_image:eq(1)\").addClass(\"opacity\");\n\t\t\t} \n\t\t if( $(elemt).closest(\"div\").text().indexOf(\"Pasaporte\") != (-1)) {\n\t\t\t\t console.log($(elemt).closest(\"div\").text());\n\t\t\t\t$(\".cred_image:eq(2) input.custumStlFileUploadPreview\").trigger(\"click\");\n\t\t\t\t//$(\".cred_image:eq(2)\").addClass(\"opacity\");\n\t\t } \n\t}\n\t\n \n if($(elemt).closest(\"form\").find(\"select\").attr(\"id\") != \"type_loan\"){\n \t$(elemt).closest(\"form\").find(\"select\").val(type);\n \t$(elemt).closest(\"form\").find(\"select\").change();\n \t$(elemt).closest(\"form\").find(\"select\").blur();\n \t$(elemt).closest(\"form\").find(\".custumStlFileUploadPreview input\").trigger(\"click\");\n }\n if($(elemt).closest(\"form\").find(\"select\").attr(\"id\") == \"type_loan\" ){\n \tcambiarArchivo(type, \"#file_compIncome\", \"#rubroIngresos\");\t\n }\n \n if($(elemt).closest(\"#listCredFm2\").length ){\n \tconsole.log(\"ya entro a tipoIdentificacion\");\n \t cambiarArchivo(type, \"#file_credIdentificacion\", \"#rubroTipoIdentificacion\");\n \t//$(element).closest(\"frm_loan\").find(\".btn_comprobante[tipodoc='\"+type+\"']\");\n }\n\n}", "function _ventanaPlanCuentas718(e) {\n\tif (e.type == \"keydown\" && e.which == 119 || e.type == 'click') {\n\t\t_ventanaDatos({\n\t\t\ttitulo: \"VENTANA CUENTA MAYOR\",\n\t\t\tcolumnas: [\"LLAVE_MAE\", \"NOMBRE_MAE\"],\n\t\t\tdata: $_planCuentas718,\n\t\t\tcallback_esc: () => { validarCtaTercero718() },\n\t\t\tcallback: (data) => {\n\t\t\t\tlet caja = e.currentTarget.id;\n\t\t\t\tif (caja == 'ctaingrTercer_718') {\n\t\t\t\t\tSAL718.MAESTROS.LLAVE_MAE = data.LLAVE_MAE; SAL718.MAESTROS.NOMBRE_MAE = data.NOMBRE_MAE;\n\t\t\t\t\t$('#ctaingrTercer_718').val(data.LLAVE_MAE.toString().trim())\n\t\t\t\t\t$('#ctaDescripTercer_718').val(data.NOMBRE_MAE.toString().trim())\n\t\t\t\t\tvalidarTercero718();\n\t\t\t\t} else {\n\t\t\t\t\tswitch ($_USUA_GLOBAL[0].PUC) {\n\t\t\t\t\t\tcase '1': document.getElementById('codPuc_718').value = data.LLAVE_MAE + ' ' + data.NOMBRE_MAE; break;\n\t\t\t\t\t\tcase '2': document.getElementById('codCoop_718').value = data.LLAVE_MAE + ' ' + data.NOMBRE_MAE; break;\n\t\t\t\t\t\tcase '3': document.getElementById('codPuc_718').value = data.LLAVE_MAE + ' ' + data.NOMBRE_MAE; break;\n\t\t\t\t\t\tcase '4': document.getElementById('codOficial_718').value = data.LLAVE_MAE + ' ' + data.NOMBRE_MAE; break;\n\t\t\t\t\t\tcase '6': document.getElementById('codPuc_718').value = data.LLAVE_MAE + ' ' + data.NOMBRE_MAE; break;\n\t\t\t\t\t\tdefault: document.getElementById('codPuc_718').value = SAL718.MAESTROS.LLAVE_MAE + ' ' + data.NOMBRE_MAE; break;\n\t\t\t\t\t}\n\t\t\t\t\tvalidarDivision718();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}", "function selectButton(e){\n \t//A Player vamos agregando en el array las Posicion(o seas el Turno de los Players)\n \tvar currentPlayer = listPlayers[turno];\n \tif(hasPositionByButton(e)){\n\t \tcurrentPlayer.addNewPosition(e);\n\t \t//Que imprima en el input el turno que le toca\n\t \tsetTurnOnView();\n\t \t//Para Dibujar en el Button\n\t \tdrawButton(e);\n\t \t//Para Validar si hay un ganador\n\t \tValidateWinner(currentPlayer); \t\n\t //Cambiamos el Turno, al que le toca\n\t changeTurn();\n\t }\n }", "function setTunnetutMouseAction() {\n let tunnetut = document.getElementsByClassName(\"tunnettu sana\");\n if (tunnetut != undefined && tunnetut != null && tunnetut.length > 0) {\n for (let el of tunnetut) {\n el.onclick = mouseClickActScopePreserver(el);\n }\n }\n\n let tunnetut2 = document.getElementsByClassName(\"tunnettu sana vinkki\");\n if (tunnetut2 != undefined && tunnetut2 != null && tunnetut2.length > 0) {\n for (let el of tunnetut2) {\n el.onclick = mouseClickActScopePreserver(el);\n }\n }\n\n let tunnetut4 = document.getElementsByClassName(\"tunnettu vinkki sana\");\n if (tunnetut4 != undefined && tunnetut4 != null && tunnetut4.length > 0) {\n for (let el of tunnetut4) {\n el.onclick = mouseClickActScopePreserver(el);\n }\n }\n\n let tunnetut3 = document.getElementsByClassName(\"fade-in tunnettu sana\");\n if (tunnetut3 != undefined && tunnetut3 != null && tunnetut3.length > 0) {\n for (let el of tunnetut3) {\n el.onclick = mouseClickActScopePreserver(el);\n }\n }\n\n return true;\n}", "function falso(v) {\n\n boton.disabled = false;\n\n boton.addEventListener(\"click\", function () {\n isNotTrue(v);\n\n boton.style.display = \"none\";\n });\n\n}" ]
[ "0.6638013", "0.661474", "0.65913135", "0.6577645", "0.6461949", "0.6403069", "0.6400792", "0.6325191", "0.6247681", "0.6090469", "0.60621065", "0.60539836", "0.605245", "0.6049288", "0.5998921", "0.598902", "0.5986557", "0.59647393", "0.59558606", "0.5948739", "0.5946089", "0.5931384", "0.5916781", "0.5911943", "0.5903223", "0.5897843", "0.5892306", "0.5878854", "0.5878372", "0.58614826", "0.58452827", "0.5843552", "0.58341545", "0.5784019", "0.5780395", "0.5774039", "0.5752498", "0.57515126", "0.5739782", "0.57374597", "0.57363254", "0.5730283", "0.572686", "0.5700673", "0.56957746", "0.5689789", "0.5689136", "0.5681209", "0.5667153", "0.5660764", "0.56602544", "0.5658503", "0.5653845", "0.56520134", "0.5648936", "0.56480515", "0.56332034", "0.5631394", "0.56283313", "0.5616808", "0.5610146", "0.56046194", "0.5601499", "0.559757", "0.5592332", "0.55889535", "0.55826914", "0.557403", "0.55605423", "0.55584306", "0.55490834", "0.5549048", "0.5536302", "0.55354655", "0.553206", "0.55304146", "0.55271566", "0.55239534", "0.55183774", "0.55069304", "0.550687", "0.5505898", "0.5499376", "0.5498902", "0.5495835", "0.5490609", "0.54902965", "0.5484413", "0.5482401", "0.54818577", "0.5481819", "0.54809994", "0.54805374", "0.5478793", "0.5476378", "0.5474274", "0.5471262", "0.54669434", "0.5466828", "0.5466264", "0.54656214" ]
0.0
-1
funcion que muestra un mensaje cuando se pulsa no
function mostrarMensaje() { //mostramos un mensaje alert("¡Nos sorprende tu respuesta!"); //cerramos la ventana window.close(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onMessageArrived(message) {\n console.log(message.payloadString);\n mentrada=message.payloadString;\n document.getElementById(\"tanto\").innerHTML=mentrada;\n\tc=1+1;\n if (mentrada == \"0\"){\n\t\talert(\"No hay alimento en el dispensador\");\n\t}\n\n }", "function msgPerdeu() {\n swal({\n title: \"Perdeste!\",\n type: \"error\",\n timer: 3000,\n showConfirmButton: false\n });\n bloqueioBoneco();\n }", "function imprimir(mensaje){\n console.log(mensaje);\n}", "function imprimir(mensaje){\n console.log(mensaje);\n}", "function imprimir(mensaje){\n console.log(mensaje);\n}", "function clearSuccessMessage() {\n\n }", "function mensajes(respuesta){\n\n\t\t\t\tvar foo = respuesta;\n\n\t\t\t\t\tswitch (foo) {\n\n\t\t\t\t\t\tcase \"no_exite_session\":\n\t\t\t\t\t\t//============================caso 1 NO EXISTE SESSION==================//\n\t\t\t\t\t\tswal(\n\t\t\t\t\t\t\t\t'Antes de comprar Inicia tu Session en la Pagina?',\n\t\t\t\t\t\t\t\t'Recuerda si no tienes cuenta en la pagina puedes registrarte?',\n\t\t\t\t\t\t\t\t'question'\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\tbreak;\n\n\n\t\t\t\t\t\tcase \"saldo_insuficiente\":\n\t\t\t\t\t\t//==============CASO 2 SALDO INSUFICIENTE=======================//\n\n\t\t\t\t\t\tswal({\n\t\t\t\t\t\t\ttype: 'error',\n\t\t\t\t\t\t\ttitle: 'Oops...',\n\t\t\t\t\t\t\ttext: 'Tu saldo es insuficiente para poder realizar la trasaccion, recarga tu monedero e intenta de nuevo',\n\t\t\t\t\t\t\tfooter: 'Puedes recargas tu saldo con nostros mas informacion en nuestras redes sociales'\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak;\n\n\n\n\t\t\t\t\t}\n\t\t\t}", "inviaMessaggio(){\n if(this.messaggioInputUtente != ''){\n this.contacts[this.contattoAttivo].messages.push({\n date: dayjs().format('YYYY/MM/DD HH:MM:SS'),\n text: this.messaggioInputUtente,\n status: 'sent',\n stileMessaggio: 'message-sent'});\n this.messaggioInputUtente = '';\n setTimeout(()=>{\n this.contacts[this.contattoAttivo].messages.push({\n date: dayjs().format('YYYY/MM/DD HH:MM:SS'),\n text: 'ok',\n status: 'received',\n stileMessaggio: 'message-received'});\n }, 1000);\n }\n }", "function sucesso(msg) {\n \t$.notify({\n \tmessage: msg\n\n },{\n type: 'success',\n timer: 1000\n });\n}", "function sucesso(msg) {\n \t$.notify({\n \tmessage: msg\n\n },{\n type: 'success',\n timer: 1000\n });\n}", "function mensajeOk(mensaje) {\n $(\"#mensaje\").html(\"\");\n $(\"#mensaje\").append(mensaje);\n mostrarMensaje(\"mensaje\");\n ocultaMensaje(\"mensaje\");\n}", "function sent() {\n console.info(\"Fine processo d'invio notizie\")\n}", "function mensaje (){\n console.log('mensaje de la funcion');\n}", "function imprimeMensaje() {\r\n console.log('Hola soy una funcion!');\r\n}", "function mensajeBienvenida() {\n console.log(\"Bienvenido a Fabrega!\")\n console.log(\"Ingrese código de artículo a comprar: \")\n console.log(\"0001-Televisor\\n0002-Computadora\\n0003-Heladera\")\n}", "function pulsaTecla(e){\n\tif(getOpcionInterfaz('correccion_rapida') && comprueba_pregunta()) preguntaRespondida();\n\treturn false;\n}", "function mensaje(mje){\n //creo un div para contener el mensaje\n const div = document.createElement('div');\n //le asigno una clase para su visualizacion\n div.className = `alerta alert alert-warning mensaje`;\n //le agrego un mensaje\n div.appendChild(document.createTextNode(mje));\n //identifico y asigno el objeto contenenedor del div\n const contenedor = document.querySelector('.contenedor');\n //identifico y asigno el objeto para posicionar el mensaje encima del mismo\n const areaSig = document.querySelector('#card'); \n //\n //agregar el div creado al elemento contenedor\n contenedor.insertBefore(div, areaSig);\n // Remover el mensaje de alerta\n //quitar el elemento despues de 2 segundos\n setTimeout(function() {\n document.querySelector('.alerta').remove();\n }, 2000);\n \n}", "mostra_successo(msg) {\n\t\tvar contenuto = document.getElementById(\"contenuto\");\n\t\twhile ( contenuto.firstChild != null) {\n\t\t\tcontenuto.removeChild(contenuto.firstChild);\n\t\t}\n\t\t$(\"#contenuto\").append(msg);\n\t\t\n\t}", "async function valiMess(event){\n event.preventDefault(); //dont refresh any way\n let mes = document.getElementById('mes').value.trim()\n document.getElementById('mes').value = ''\n if(mes === \"\"){\n alert(\"message required\")\n event.preventDefault()\n return\n }\n\n document.getElementById(\"det\").style.visibility = \"visible\"\n await fetch(\"/addMessage?mess=\"+mes, {method: \"post\"})\n .then(res => res.json())\n .then(response => {\n for (let i in response) {\n if(response[i] === \"disconnected\")\n stopIntervalAndReturn()\n else if(response[i] === \"message required\"){\n alert(\"message required\")\n return\n }\n\n document.getElementById(\"det\").innerText = response[i]\n }\n })\n .catch(err => (console.log(err.message)))\n\n checkNewMessage()\n }", "function message(retorno){\n\n if(retorno[0] == 'msg'){\n let msg = $('<div/>').addClass('alert alert-'+retorno[1]+' alert-dismissible fadeshow col-md-12');\n msg.append($('<button/>').addClass('close').attr('data-dismiss', 'alert').html('&times'))\n msg.attr('align', 'center').append('<h3>'+retorno[2]+'</h3>');\n msg.css('box-shadow', '2px 2px 3px #000');\n\n $('#dinamic').find('div #msg').remove();\n $('#cadastrarProduto, #estoque, #editEstoque, #editarProduto, #cadastrarMarca, #cadastrarCategoria, #vendaPainelTable').\n parent().prepend($('<div/>').attr('id', 'msg').addClass('row mb-5').html(msg));\n }\n}", "function Mensajes(mensaje) {\n if (mensaje == 'Transaccion realizada correctamente')\n $().toastmessage('showSuccessToast', mensaje);\n else\n $().toastmessage('showErrorToast', mensaje);\n}", "function showMessageMittente(text){\r\n\tif(text == \"\")\r\n\t\treturn;\r\n\r\n\tif(lastSender == IS_LAST_NON_SPECIFICATO || lastSender != IS_LAST_MITTENTE){\r\n\t\tlastSender = IS_LAST_MITTENTE;\r\n\t\tchangeLastSender();\r\n\t}\r\n\r\n\tshowMessage(text);\r\n}", "function BasariMesaj( text){\n\t text = jQuery.trim(text); \n\t var dil = \"Tebrikler !\";\n\t if( strcmp( er.lang, \"en\" ) == 0 )\n\t dil = \"Congratulations !\";\n\t if( $(\".msgGrowl-container\").find(\".msgGrowl\").length <= 1 ){ \n\t $.msgGrowl ({\n\t element: $('body').parent(),\n\t type: 'success', //$(this).attr ('data-type') // info success warning error\n\t title: dil,\n\t text: text.charAt(0).toUpperCase() + text.slice(1) // capitialize first character\n\t });\n\t }\n\t }", "function mensaje(){\n\n\talert(\"Mensaje de Bienvenida\");\n}", "function message(ar) {\n\tif(ar==1){\n\t document.getElementById('successMsg').innerHTML +=\n\t \"<div id='snackbar' class=''>Projekt wurde genehmigt!</div>\";\n\t}\n\telse{\n\t\tdocument.getElementById('successMsg').innerHTML +=\n\t\t\t \"<div id='snackbar' class=''>Projekt wurde abgelehnt!</div>\";\n\t}\n\t var element = 'snackbar';\n\t $(function(){\n\t\t\t$(function(){\n\t\t\t\t$('#'+element).addClass('animated slideInUp');\n\t document.getElementById(\"snackbar\").style.visibility = \"visible\";\n\t\t\t\t$('#'+element).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){\n\t\t\t\t\t$('#'+element).removeClass('animated slideInUp');\n\t\t\t\t\t$(function(){\n\t\t\t\t\t\t$('#'+element).addClass('animated slideOutDown delay-3s');\n\t\t\t\t\t\t$('#'+element).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){\n\t\t\t\t\t\t\t$('#'+element).removeClass('animated slideOutDown delay-3s');\n\t\t\t\t\t\t\t$('#'+element).remove();\t\n\t\t\t\t\t\t});\n\t\t\t\t\t});\t\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t}", "function showComingMsg(data) {\r\n addMsg(data, \"someone-else\");\r\n}", "function nack() {\n Twibble.messages.unshift(message);\n Twibble.sendMessage();\n }", "function noop() {\n console.warn('Hermes messaging is not supported.');\n }", "function probando(req, res) {\n res.status(200).send({ message: 'Probando desde del controladaor Message.' });\n}", "function message(msg) {\n var status = document.getElementById('status');\n status.textContent = msg;\n setTimeout(function() {\n status.textContent = '';\n }, 1500);\n}", "TheMessage(msg) {\n return;\n }", "function ack() {\n Twibble.sendMessage();\n }", "mostrarSaludo(mensaje){\n\t\treturn mensaje;\t\n\t}", "function mensajemodal(mensaje, titulo = \"ATENCIÓN\") {\r\n swal({\r\n title: titulo,\r\n text: mensaje\r\n },\r\n function () {\r\n swal.close();\r\n $interval.cancel(interval);\r\n });\r\n var interval = $interval(function () {\r\n swal.close();\r\n $interval.cancel(interval);\r\n }, 3000);\r\n }", "function mensajemodal(mensaje, titulo = \"ATENCIÓN\") {\r\n swal({\r\n title: titulo,\r\n text: mensaje\r\n },\r\n function () {\r\n swal.close();\r\n $interval.cancel(interval);\r\n });\r\n var interval = $interval(function () {\r\n swal.close();\r\n $interval.cancel(interval);\r\n }, 3000);\r\n }", "function envoiMessage(mess) {\r\n // On recupere le message\r\n var message = document.getElementById('message').value;\r\n\r\n // On appelle l'evenement se trouvant sur le serveur pour qu'il enregistre le message et qu'il l'envoie a tous les autres clients connectes (sauf nous)\r\n socket.emit('nouveauMessage', { 'pseudo' : pseudo, 'message' : message });\r\n\r\n // On affiche directement notre message dans notre page\r\n document.getElementById('tchat').innerHTML += '<div class=\"line\"><b>'+pseudo+'</b> : '+message+'</div>';\r\n\r\n // On vide le formulaire\r\n document.getElementById('message').value = '';\r\n\r\n // On retourne false pour pas que le formulaire n'actualise pas la page\r\n return false;\r\n}", "function msg() {\r\n\t\tsetTimeout(function () {\r\n\t\t\tif(message !== lastMessage) {\r\n\t\t\t\t//client.sendMessage(chanObj, message);\r\n\t\t\t\tchanObj.send(message);\r\n\t\t\t\tlastMessage = message;\r\n\t\t\t}\r\n\t\t\tmsg();\r\n\t\t}, 100);\r\n\t}", "function setMsg(msg) {\n\tif (msg != \"\") {\n\t\t$('#signal-msg').html(msg).fadeOut(1000);\n\t\treturn true;\n\t}\n\treturn false;\n}", "static messageNoData() {\n //\n noDataMessage.style.display = 'block';\n }", "function noThanks () { \n console.log (\"OK, maybe another day. Bye!\"); \n}", "function saludo3(mensaje){\n console.log(`Hola buen dia 3 ${mensaje}`);\n }", "function emitirAviso(mensagem, id, tempo){\n let snackbar = document.getElementById(id);\n snackbar.innerHTML = mensagem;\n snackbar.className = \"show\";\n setTimeout(function(){snackbar.className = snackbar.className.replace(\"show\", \"\"); }, tempo);\n}", "function inviaMessaggioUtente(){\n var text_user=($('.send').val());\n if (text_user) { //la dicitura cosi senza condizione, stà a dire text_user=0\n templateMsg = $(\".template-message .new-message\").clone()\n templateMsg.find(\".text-message\").text(text_user);\n templateMsg.find(\".time-message\").text(ora);\n templateMsg.addClass(\"sendbyUser\");\n $(\".conversation\").append(templateMsg);\n $(\".send\").val(\"\");\n setTimeout(stampaMessaggioCpu, 2000);\n\n var pixelScroll=$('.containChat')[0].scrollHeight;\n $(\".containChat\").scrollTop(pixelScroll);\n }\n }", "function nota(op,msg,time){\n if(time == undefined)time = 5000;\n var n = noty({text:msg,maxVisible: 1,type:op,killer:true,timeout:time,layout: 'center'});\n}", "function setSucessMessageWithFade(message){\n setSucessMessage(message);\n setTimeout(function() {\n setSucessMessage('');\n }, 3000);\n }", "function chatbotResponse() {\n botMessage = \"Introduzca la respuesta correcta por favor\"; //the default message\n\n if (lastUserMessage === \"si\" || lastUserMessage === \"Si\") {\n botMessage = \"Perfecto\";\n }\n\n if (counter === 0) {\n counter = 1;\n botMessage =\n \"Soy tu asesor DAP legal, ¿Quieres que te ayude a formalizar un préstamo?\";\n }\n}", "function OnSuccessCallMaladie(data, status, jqXHR) {\n\t\t\tnotif(\"success\", \"Brief envoyé avec <strong>succès</strong> !\");\n\t\t}", "HandleMessage( msg ) {\n return false;\n }", "function checkMessages() {\n messageBackground({\n action: 'check messages'\n });\n}", "function quitarMensaje() {\n document.getElementsByTagName('span')[0].textContent = \"\";\n clearInterval(cuentaAtras);\n }", "function functionNexMessage(){\n if(messageQueue.length == 0) return;\n\n $(\"#messageArea\").prepend(messageQueue[0]);\n $(messageQueue[0]).fadeIn();\n $(messageQueue[0]).animate({bottom:'0px'},1000);\n\n messageQueue[0].messageTimeout = setTimeout(function () {\n $.when($(messageQueue[0]).fadeOut(500))\n .done(function() {\n $(messageQueue[0]).remove();\n messageQueue.splice(0, 1);\n functionNexMessage();\n\n });\n }, messageLength);\n\n\n\n}", "function AnimateMessage() {\n var domain_message = $(\"div.waiting_message\");\n var is_detect = true;\n domain_message.fadeToggle(700);\n if(!domain_message.length) {\n is_detect = false;\n return;\n }\n console.log(is_detect);\n setTimeout(arguments.callee, 700);\n }", "limpiarMensaje() {\n const alerta = document.querySelector('.alert');\n\n if (alerta) {\n alerta.remove();\n }\n }", "function printErrorMessage(msg){\r\n\t\t console.log(\"in printmessage() message received: \"+msg);\r\n\t\t if(msg != \"\")\r\n\t\t\t setTimeout(printErrorMessage,7000,\"\");\r\n\t\t $(viewLeavesMessage_id).text(msg);\r\n\t\t \r\n\t }", "function mostrarAyuda(msg) {\n $.notify({\n message: msg\n }, {\n type: 'info',\n delay: 3000,\n placement: {\n align: 'center'\n },\n z_index: 99999,\n });\n}", "function getWelcomeMessage(){\n g.msgNo = 0;\n serverRequest(getParams(\"none\"),false);\n}", "function addMesaj(mesaj,disappear)\r\n { \r\n \r\n mesaj[0].id=\"mesaj\";\r\n \tmesaj[0].innerHTML=mesaj.innerHTML;\r\n \tdocument.body.appendChild(mesaj[0]);\r\n\r\n \tvar MessageDisapears=setTimeout(function(){\r\n if(disappear)\r\n { \r\n console.log(disappear);\r\n var m=document.getElementById(\"mesaj\");\r\n document.body.removeChild(m);\r\n }\r\n \t},joc.getMsgDisappears());\r\n }", "function ok() {\n timer();\n var msgCopy = $(\"#template .msgpc\").clone();\n msgCopy.find(\".txt\").text(\"ok\");\n msgCopy.find(\".time\").text(timer);\n $(\"#chatwindow .chatsbox.active .chatbox\").prepend(msgCopy);\n }", "function sendMessage() {\n sendNewMessage({ dsText: valueInput.trim(), usuario: getUsuarioLogado() });\n setValueInput('');\n }", "function messageFailureHandler() {\n console.log(\"Message send failed.\");\n sendMessage();\n}", "function messageFailureHandler() {\n console.log(\"Message send failed.\");\n}", "function messageFailureHandler() {\n console.log(\"Message send failed.\");\n}", "function afficherErreur(message) {\n $('#manitouAlertes').html('<i class=\"fa fa-exclamation-triangle\"></i>' + message).removeClass('manitouAlerteSucces').addClass('manitouAlerteErreur').show().delay(4000).hide(400);\n }", "function showMessage(msg){\n $(message).append('<div>'+msg+'</div>');\n runClean(3000);\n}", "showAlertAcessoParticipante(sucess_error,mensagem){\n if(sucess_error==='success'){\n const div = document.createElement('div')\n div.id = 'message'\n div.innerHTML = `\n <div class=\"container text-center mx-auto my-auto\" style=\"padding: 5px;\">\n <div id=\"inner-message\" class=\"alert alert-primary text-center\">\n <div class=\"\" style=\"width:11%!important;float:right\">\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>\n </div>\n <p>${mensagem}</p>\n </div>\n </div>\n `\n document.getElementById(this.divsIDs.header).insertBefore(div,document.getElementById(this.divsIDs.funciWrapper))\n }\n if(sucess_error==='error'){\n const div = document.createElement('div')\n div.id = 'message'\n div.innerHTML = `\n <div class=\"container text-center mx-auto\" style=\"padding: 5px;\">\n <div id=\"inner-message\" class=\"alert alert-danger text-center\">\n <div class=\"\" style=\"width:11%!important;float:right\">\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>\n </div>\n <p>${mensagem}</p>\n </div>\n </div>\n `\n document.getElementById(this.divsIDs.header).insertBefore(div,document.getElementById(this.divsIDs.funciWrapper))\n }\n setTimeout(() => {\n document.getElementById('message').remove()\n }, 3000);\n }", "function sendMessage(){\n //Gets the message that will be sent to the server and put it into variable\n var msgToSend = g.messageBox.value.trim()\n \n //Checks whethers it is null, does not want to send empty string\n if(msgToSend != \"\"){\n //Stops the script from updating every 5 seconds, makes it synchronous,\n //then sends messages and finally makes it asynchronous again.\n clearInterval(g.updateInterval);\n serverRequest(getParams(msgToSend),false);\n g.updateInterval = setInterval(getMessages, 5000); \n g.messageBox.value = \"\"; //clear message box\n }\n}", "function messageNoHousehold() {\n addMessage('You aren\\'t a registered member of a household. Click \"Household\" on the navigation menu to create or join a household.', 'error');\n}", "_msgCallback(err) {\n if (err) {\n console.log(err);\n // TODO: Handle it by showing a prompt\n }\n\n // Re-enable message composer\n this.setState({\n busy: false\n });\n }", "function test(message) {\n return 0;\n}", "function HataMesaj( text){\n\t text = jQuery.trim(text); \n\t var dil = \"Hata !\";\n\t if( strcmp( er.lang, \"en\" ) == 0 )\n\t dil = \"Error !\";\n\t if( $(\".msgGrowl-container\").find(\".msgGrowl\").length <= 1 ){ \n\t $.msgGrowl ({\n\t element: $('body').parent(),\n\t type: 'error', //$(this).attr ('data-type') // info success warning error\n\t title: dil,\n\t text: text.charAt(0).toUpperCase() + text.slice(1) // capitialize first character\n\t });\n\t }\n\t }", "function sendMessage(){}", "function failedsent() {\n console.error(\"Invio delle notizie non riuscito!\")\n $(\"#formerr\").fadeIn(750);\n $(\"#infomsg\").text(\"Invio delle notizie non riuscito!\");\n $(\"#formerr\").delay(3000).fadeOut(2000);\n}", "function obtenerMensaje1(campo){\n\tvar mensaje = \"\";\n switch(campo){\n case 'idproraz': mensaje = \"Si modific&oacute; alg&uacuten campo de este m&oacute;dulo debe justificar.\";\n\tbreak;\n\t}\n\treturn mensaje; \n\t\n}", "function alertNotificar(texto, tipo){\n PNotify.removeAll()\n new PNotify({\n title: 'Mensaje de Información',\n text: texto,\n type: tipo,\n hide: true,\n delay: 7000,\n styling: 'bootstrap3',\n addclass: ''\n });\n }", "function showMessageDestinatario(text){\r\n\tif(text == \"\")\r\n\t\treturn;\r\n\r\n\tif(lastSender == IS_LAST_NON_SPECIFICATO || lastSender != IS_LAST_DESTINATARIO){\r\n\t\tlastSender = IS_LAST_DESTINATARIO;\r\n\t\tchangeLastSender();\r\n\t}\r\n\r\n\tshowMessage(text);\r\n}", "function notif(message, success){\n success = (typeof success !== 'undefined') ? success : true;\n $('<div class=\"alert alert-' + ((success)?'success':'danger') +'\">' + message + '</div>')\n .prependTo(\"body\")\n .fadeIn('fast')\n .delay(5000)\n .fadeOut('fast')\n .queue(function(){$(this).remove()});\n}", "function checkMessage(inputMsg) {\n if(inputMsg == undefined){\n return \"\";\n }\n else{\n return inputMsg;\n }\n }", "function notyMessage(statue) {\n $.noty.defaults.killer = true; //closes existing notys\n noty({\n text: 'Congratulations, you found <span class = \"emph\">' + statue.name + '</span>. <span class = \"close\">X</span> ',\n layout: 'topCenter',\n closeWith: ['click'],\n type: 'success'\n });\n}", "registeredMsg() {\n return 'You are already regsitered!';\n }", "function ClearStatusMsg() \n {\n\n SetStatusMsg(\"StatusMsg\", \"\");\n }", "function mensagem(texto) {\n $(\"#erro p\").text(texto).addClass('alert-danger').addClass('alert');\n\n if (texto)\n $(\"#erro\").show(\"slow\");\n else\n $(\"#erro\").hide(\"slow\");\n\n setTimeout(function () {\n $(\"#erro\").hide('slow');\n }, 3000);\n}", "function limpaMensagens() {\n $rootScope.messages.length = 0;\n }", "function process_event(event){\n // Capturamos los datos del que genera el evento y el mensaje\n var senderID = event.sender.id;\n var message = event.message;\n \n // Si en el evento existe un mensaje de tipo texto\n if(message.text){\n console.log('=========MENSAJE DE ============')\n console.log('Mensaje de ' + senderID);\n console.log('mensaje: ' + message.text);\n\n if(message.text === 'Integrantes'){\n enviar_texto(senderID, {\n \"text\": '-Flores Olegua Johan Rafael 1910082' + ' ' +'-Pozo Aquino Erick Junior 1316534' + ' ' +'-Arroyo Caseres Juan Carlos ',\n })\n }\n if(message.text === 'integrantes'){\n enviar_texto(senderID, {\n \"text\": '-Flores Olegua Johan Rafael 1910082' + ' ' +'-Pozo Aquino Erick Junior 1316534' + ' ' +'-Arroyo Caseres Juan Carlos ',\n })\n }\n}\n \n // Enviamos el mensaje mediante SendAPI\n //enviar_texto(senderID, response);\n }", "function notifyFail(msg) {\n const notifcns = document.querySelector('#notifications');\n if (notifcns) notifcns.remove();\n document.querySelector('nav .notifications .counter').textContent = ' ! '; // note U+2005 ¼ em spaces\n const notificationsHtml = `<div id=\"notifications\">${msg}</div>`;\n document.querySelector('nav .notifications').insertAdjacentHTML('beforeend', notificationsHtml);\n document.querySelector('nav .notifications').classList.remove('hide');\n }", "function displayMessage(msg) {\r\n $('#msg').bind(\"DOMSubtreeModified\", function () {\r\n window.setTimeout(function () {\r\n $(\".alert\").fadeTo(500, 0).slideUp(500, function () {\r\n $(this).remove();\r\n document.getElementById(\"msg\").classList.toggle(\"frente\");\r\n });\r\n }, 2500);\r\n });\r\n // Acrescenta classe à DIV para ficar à frente da DIV branca-transparente\r\n document.getElementById(\"msg\").classList.toggle(\"frente\");\r\n // Insere os dados da mensagem de alerta na DIV e exibe a mensagem\r\n $('#msg').html('<div class=\"alert alert-danger\">' + msg + '</div>');\r\n}", "function piman_send_message(msg,error){\n msg = '<span>' + msg + '</span>';\n\n $(window).scrollTop($('body').position().top)\n\n $(\"#notifications_content\").html(msg)\n .addClass(error ? 'error' : 'success');\n\n $(\"#notifications\")\n .toggle()\n .delay(5000).fadeOut()\n .click(function(){$(this).stop(true,true).fadeOut()});\n\n}", "_ackSendMessageHandler(json){\n\t if (json.user !== CooperativeEditorParticipants.userName ){\n \t\t\tthis.domHost.playTTS(json.user);\n \t\t}\n\n \t\tthis.push('messages', {\"user\": json.user, \"message\": json.message, \"time\": json.time});\n \t\tthis.domHost.playSound(\"sendMessage\", json.effect, json.position);\n \t\t\n \t\tthis.isTyping = false;\n }", "function ChatMessage() {\n if (document.getElementById(\"chatSend\").value.trim() != \"\") {\n var ChatMsg = document.getElementById(\"chatSend\");\n ChatUser(ChatMsg.value);\n //ChatAdmin(\"Please wait\");\n // var blMsg = SendNewMsg(ChatMsg.value);\n // if (blMsg) {\n // cntMsg = cntMsg + 1;\n // }\n //alert(\"End\");\n\n // var blMsg = CallSendMsg(cntMsg);\n // if (blMsg) {\n // cntMsg = cntMsg + 1;\n // }\n var blMsg = ShowAdminMessage(ChatMsg.value);\n if (blMsg) {\n cntMsg = cntMsg + 1;\n }\n\n //ChatSuggestions(\"test2\");\n ChatMsg.value = \"\";\n return false;\n }\n}", "function _noconn()\n\t{\n\t\tUTILS.msgbox(\"You do not have a good enough signal to complete the request. Please try again later.\", \"No Connection\");\n\t}", "function Fnc_BuscarInformacionHogar(s, e) {\n\n if (txtIdentidad.GetText() != \"\" || txtHogar.GetText() != \"\") {\n var NumHogar = (txtHogar.GetText() == \"\") ? 0 : txtHogar.GetText()\n if (txtIdentidad.GetText() != \"\") {\n if (txtIdentidad.GetText().length != 13) {\n $(\".warning\").hide()\n $(\"body\").waitMe(\"hide\")\n $(\"#Error_text\").text(\"error dede de ingresar un numero de identidad valido\")\n $(\".error\").show()\n return 0;\n }\n }\n Fnc_PeticionInformacionHogarSuspender(NumHogar, txtIdentidad.GetText())\n\n } else {\n $(\".warning\").hide()\n $(\"body\").waitMe(\"hide\")\n $(\"#Error_text\").text(\"error no debe de haber campos vacios\")\n $(\".error\").show()\n }\n\n}", "_createMessage() {\n let messageArr = ['абонент', 'абонента', 'абонентов'];\n\n function createMessage(number, startWord) {\n let endMessage = null;\n let startMessage = (number === 1) ? startWord : (startWord + \"o\");\n\n if(number === 1) {\n endMessage = messageArr[0];\n } else if (number == 12\n || number == 13\n || number == 14) {\n\n endMessage = messageArr[2];\n } else if( number.toString()[number.toString().length - 1] === '2'\n || number.toString()[number.toString().length - 1] === '3'\n || number.toString()[number.toString().length - 1] === '4') {\n\n endMessage = messageArr[1];\n } else {\n endMessage = messageArr[2];\n }\n\n return startMessage + \" \" + number + \" \" + endMessage;\n }\n\n noty({\n text: createMessage( (this._correctData.length), 'Загружен'),\n type: 'success',\n timeout: '3000'\n });\n\n if(this._inCorrectData.length) {\n noty({\n text: createMessage( (this._inCorrectData.length - 1), 'Не загружен'),\n type: 'error',\n timeout: '3000'\n });\n }\n }", "limparMsgAlert() {\n divMsg.innerHTML = \"\";\n\n\n }", "function congratsMessage(){\n\tif (matchedCards.length === 16){\n\t\tsetTimeout(function(){\n\t\t\ttoggleModal();\n\t\t\t},1000);\n\t\tstopTimer();\n\t}\n}", "function callbackValidation(msg){\n swal({\n title: msg,\n text: 'por favor revise sus datos',\n imageUrl: '../assets/img/callback/missing.png',\n imageHeight: 90,\n animation: true,\n confirmButtonColor: '#4fa7f3'\n })\n}", "function warn(msg){\n\t\t\n\t\tflashCount = 0;\n\t\t\n\t\tif ( null == msg ){\t\n\t\t\tfaultMsg=\"The inverter has faulted!\"; \n\t\t\t$(\"#alarmMessage\").html(\"The inverter has faulted!\");\n\t\t} else {\n\t\t\tfaultMsg=msg;\n\t\t\t$(\"#alarmMessage\").html(\"FAULTS:\"+msg);\n\t\t}\n\n\t\t$(\"#alarm\").show();\n\t\tif ( !booFault ) {\n\t\t\tbooFault = true;\n\t\t\tscreenFlash();\n\t\t\tsoundAlarm();\n\t\t}\n\t\t\n\n\t}", "function mensaje(){\n\treturn 'Hola Mundo JavaScript';\n}", "function onSendMessage(){\n var msg = document.getElementById(\"usermsg\").value;\n if(msg == \"\") alert(\"assicurati di inserire il testo da inviare\");\n else {\n if(sex == \"lui\")\n msg = \"newMsg \" + name + \": <div style='background-color:lightblue;display:inline-block;box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);border-radius: 5px'>\" + document.getElementById(\"usermsg\").value + \"</div>\";\n\telse\n msg = \"newMsg \" + name + \": <div style='background-color:pink;display:inline-block;box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);border-radius: 5px'>\" + document.getElementById(\"usermsg\").value + \"</div>\";\n //alert(msg);\n connection.send(msg);\n document.getElementById(\"usermsg\").value=\"\";\n }\n}", "function testingMSGS(){\n \n}", "function mensaje(){\r\n document.write(\"Holissss\");\r\n document.write(\"*************\")\r\n}", "function submitMsg() {\n // only submit messages\n if(ctrl.inputMsg.length > 0) {\n SocketService.submitMsg(ctrl.inputMsg);\n\n // empty the message box\n ctrl.inputMsg = '';\n }\n }", "function removeMSG(msg) {\n setTimeout(function () {\n var Idx = msg.Msg;\n var isConf = !!msg.UID;\n\n var message = document.getElementById(isConf ? \"conf-\" + msg.UID + \"-\" + Idx : \"priv-\" + Idx);\n\n if (message){\n message.innerHTML = \"\";\n }\n }, 100);\n }" ]
[ "0.66921383", "0.6573976", "0.65367085", "0.65140164", "0.65140164", "0.6327588", "0.6315882", "0.6301805", "0.62942123", "0.62942123", "0.6260059", "0.6259319", "0.6250487", "0.62083673", "0.61987877", "0.6191728", "0.6167637", "0.6163977", "0.61625004", "0.6136166", "0.6130755", "0.6086186", "0.6079344", "0.6074803", "0.6069491", "0.6065948", "0.606437", "0.6053416", "0.60196537", "0.6005237", "0.5983749", "0.59741026", "0.5973919", "0.5956883", "0.5956883", "0.59453595", "0.59440964", "0.5941953", "0.59386414", "0.5929799", "0.5926472", "0.5922072", "0.5917555", "0.5902072", "0.5900526", "0.5878665", "0.5878582", "0.5849199", "0.5839673", "0.58336496", "0.5808393", "0.5801673", "0.5801113", "0.5800586", "0.5796849", "0.5792307", "0.5791454", "0.5777531", "0.57702833", "0.5768341", "0.5764947", "0.5764947", "0.5759434", "0.57561857", "0.5753459", "0.57506657", "0.5747095", "0.57368934", "0.57321477", "0.5729462", "0.57266605", "0.5724488", "0.57235736", "0.5722605", "0.57117665", "0.5710674", "0.5708178", "0.5706992", "0.570278", "0.5701467", "0.5696774", "0.5696125", "0.5694877", "0.56889725", "0.5688284", "0.5679259", "0.56764454", "0.56750274", "0.56735367", "0.56675375", "0.5659007", "0.56483006", "0.5647845", "0.56452954", "0.5641751", "0.56394124", "0.5638543", "0.56367475", "0.5634493", "0.5625873", "0.5621411" ]
0.0
-1
Call WebUSB API to send response.bin to device
function sendToken2Device (unlockToken) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function RequestUSBDevice() { \n await navigator.usb.requestDevice({ filters: [{}] });\n}", "async function SendBlyncUSB30ControlCommand(deviceInfo, byRedValue, byGreenValue, byBlueValue, byLightControl, byMusicControl_1, byMusicControl_2) {\n\n try {\n var device = deviceInfo.device;\n\n await device.open();\n //await device.reset();\n\n if (device.configuration === null) {\n await device.selectConfiguration(1);\n }\n\n\t\tawait device.claimInterface(0);\n\t\t\n abyBlyncUsb30ReportBuffer[0] = byRedValue;\n abyBlyncUsb30ReportBuffer[1] = byBlueValue;\n abyBlyncUsb30ReportBuffer[2] = byGreenValue;\n abyBlyncUsb30ReportBuffer[3] = byLightControl;\n abyBlyncUsb30ReportBuffer[4] = byMusicControl_1;\n abyBlyncUsb30ReportBuffer[5] = byMusicControl_2;\n abyBlyncUsb30ReportBuffer[6] = 0xFF;\n abyBlyncUsb30ReportBuffer[7] = 0x22;\n\n var result = await device.controlTransferOut( \n {\n requestType: 'class',\n recipient: 'interface',\n request: 0x09,\n value: 0x0200,\n index: 0x0000\n },\n abyBlyncUsb30ReportBuffer);\n\n await device.close();\n } catch (e) {\n console.log(\"Exception: \" + e);\n }\n}", "respondToArduino(command){\n BluetoothSerial.write(command)\n .then((res) => {\n console.log(res, command)\n })\n .catch((err) => console.log(err.message))\n }", "requestUsb() {\n return new Observable(observer => {\n navigator.usb.requestDevice({ filters: [] })\n .then((result) => {\n this.vendorId = result.vendorId;\n this.productId = result.productId;\n return observer.next(result);\n }).catch(error => {\n return observer.error(error);\n });\n });\n }", "async function uBitOpenDevice(device, callback) {\n const transport = new DAPjs.WebUSB(device)\n const target = new DAPjs.DAPLink(transport)\n let buffer=\"\" // Buffer of accumulated messages\n const parser = /([^.:]*)\\.*([^:]+|):(.*)/ // Parser to identify time-series format (graph:info or graph.series:info)\n \n target.on(DAPjs.DAPLink.EVENT_SERIAL_DATA, data => {\n buffer += data;\n let firstNewline = buffer.indexOf(\"\\n\")\n while(firstNewline>=0) {\n let messageToNewline = buffer.slice(0,firstNewline)\n let now = new Date() \n // Deal with line\n // If it's a graph/series format, break it into parts\n let parseResult = parser.exec(messageToNewline)\n if(parseResult) {\n let graph = parseResult[1]\n let series = parseResult[2]\n let data = parseResult[3]\n let callbackType = \"graph-event\"\n // If data is numeric, it's a data message and should be sent as numbers\n if(!isNaN(data)) {\n callbackType = \"graph-data\"\n data = parseFloat(data)\n }\n // Build and send the bundle\n let dataBundle = {\n time: now,\n graph: graph, \n series: series, \n data: data\n }\n callback(callbackType, device, dataBundle)\n } else {\n // Not a graph format. Send it as a console bundle\n let dataBundle = {time: now, data: messageToNewline}\n callback(\"console\", device, dataBundle)\n }\n buffer = buffer.slice(firstNewline+1) // Advance to after newline\n firstNewline = buffer.indexOf(\"\\n\") // See if there's more data\n }\n });\n await target.connect();\n await target.setSerialBaudrate(115200)\n //await target.disconnect();\n device.target = target; // Store the target in the device object (needed for write)\n device.callback = callback // Store the callback for the device\n callback(\"connected\", device, null) \n target.startSerialRead()\n return Promise.resolve()\n}", "async send_cmd(cmd, options={}) {\n const data = options.data;\n const textDecode = (options.textDecode !== undefined ? !!options.textDecode : true);\n const sleepOverride = (parseInt(options.sleepOverride) || 10);\n const cmdIndex = (parseInt(options.cmdIndex) || 0);\n\n if (!this.device || !this.device.opened) {\n this.log(\"error: device not connected.\\n\", \"red\");\n this.log(\"Use button to connect to a supported programmer.\\n\", \"red\");\n return Promise.reject(\"error: device not opened\");\n }\n\n const opts = {\n requestType: \"vendor\",\n recipient: \"device\",\n request: 250,\n value: this.CMD_LUT[cmd],\n index: cmdIndex\n };\n\n // transfer data out\n const res = data\n ? await this.device.controlTransferOut(opts, data)\n : await this.device.controlTransferOut(opts);\n\n // sleep for a bit to give the USB device some processing time leeway\n await (() => new Promise(resolve => setTimeout(resolve, sleepOverride)))();\n\n return this.device.controlTransferIn({\n requestType: \"vendor\",\n recipient: \"device\",\n request: 249,\n value: 0x70,\n index: 0x81\n }, 64).then(result => {\n return textDecode\n ? (new TextDecoder()).decode(result.data)\n : result.data.buffer;\n });\n }", "function sendCompleted(usbEvent) {\n\tif (chrome.runtime.lastError) {\n\t\tconsole.error(\"sendCompleted Error:\", chrome.runtime.lastError.message);\n\t}\n\n\tif (usbEvent) {\n\t\tif (usbEvent.data) {\n\t\t\tvar buf = new Uint8Array(usbEvent.data);\n\t\t\tconsole.log(\"sendCompleted Buffer:\", usbEvent.data.byteLength, buf);\n\t\t}\n\t\tif (usbEvent.resultCode !== 0) {\n\t\t\tchangeState(state.connected);\n\t\t\terrorln(\"Error writing to device: \" + chrome.runtime.lastError.message);\n\t\t}\n\t}\n}", "async getRequestDeviceInfo() {\n const outputReportID = 0x01;\n const subcommand = [0x02];\n const data = [\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n ...subcommand,\n ];\n await this.device.sendReport(outputReportID, new Uint8Array(data));\n\n return new Promise((resolve) => {\n const onDeviceInfo = ({ detail: deviceInfo }) => {\n this.removeEventListener('deviceinfo', onDeviceInfo);\n delete deviceInfo._raw;\n delete deviceInfo._hex;\n resolve(deviceInfo);\n };\n this.addEventListener('deviceinfo', onDeviceInfo);\n });\n }", "function send(data) {\n\n if(MODE == MODES.TEST) {\n ws.send(data);\n } else if(MODE == MODES.BLUETOOH) {\n\n var data = new Uint8Array(1);\n data[0] = data;\n\n ble.write(id, serviceId, serviceName, data.buffer, function() {\n console.log(\"ble -> sendSucess\");\n }, function(err) {\n console.log(\"ble -> sendFailure : \" + JSON.stringify(err));\n });\n\n }\n\n}", "function readRHUSB() {\n port.write(\"PA\\r\\n\");\n}", "function processDeviceCommand(request, response) {\n\t\n\tvar deviceIP = request.headers[\"tuyapi-ip\"]\n\tvar deviceID = request.headers[\"tuyapi-devid\"]\n\tvar localKey = request.headers[\"tuyapi-localkey\"]\n\tvar command = request.headers[\"tuyapi-command\"] \n\n\t//var respMsg = \"deviceCommand sending to deviceID: \" + deviceID + \" Command: \" + command;\n\tvar respMsg = \"deviceCommand sending to IP: \" + deviceIP + \" Command: \" + command;\n\tconsole.log(respMsg);\n\n\tvar device = new TuyaDevice({\n\t //ip: deviceIP,\n\t id: deviceID,\n\t key: localKey\n\t , issueGetOnConnect: false\n\t});\n\n\tdevice.on('error', error => {\n\t\tconsole.log('Error!', error);\n\t});\n\n\t(async () => {\n\t\tawait device.find();\t \n\n\t\tawait device.connect();\t \n\t\tconsole.log('Connected to device!');\n\t\tlet status = await device.get();\t \n\t\tconsole.log(`Current status: ${status}.`);\t\n\t\tswitch(command) {\n\t\t\tcase \"off\":\t\n\t\t\t\tconsole.log('Setting to false!');\n\t\t\t\tawait device.set({set: false});\n\t\t\tbreak\n\t\t\tcase \"on\":\n\t\t\t\tconsole.log('Setting to true!');\n\t\t\t\tawait device.set({set: true});\n\t\t\tbreak\n\t\t\tcase \"status\":\t\n\t\t\t\tconsole.log('Received status request!');\n\t\t\tbreak\n\t\t}\n\t\tstatus = await device.get(); \t\t \n\t\tconsole.log(`New status: ${status}.`);\t \n\t\tdevice.disconnect();\n\n\t\ttry{\n\t\t\tconsole.log(\"Sending Status to SmartThings:\" +status);\t\n\t\t\tresponse.setHeader(\"tuyapi-onoff\", status);\n\t\t\tresponse.setHeader(\"cmd-response\", status);\n\t\t\tresponse.end();\n\t\t\tconsole.log(\"Status sent to SmartThings:\" +status);\t\n\t\t}catch (err){\n\t\t\tconsole.log(\"Error:\" +err);\t\n\t\t}\n\t})();\t\n}", "function bleSend() {\n /* check if the device is connected if true send file*/\n let encoder = new TextEncoder('utf-8');\n\n if(isConnected){\n /* send an erase command so that the file gets started fresh */\n RX_characteristic.writeValue(encoder.encode(\"erase\"));\n for(let a = 0; a<3000; a++){\n console.log(\"\")\n }\n /* get the contents of the editor that is in use */\n let editorContents = editor.getValue();\n /* send the contents to the device */\n //split the editor contents into newlines.\n temp = editorContents.split(/\\n/);\n for(let i=0; i<temp.length; i++ )\n {\n //console.log(temp[i]);\n RX_characteristic.writeValue(encoder.encode(temp[i]));\n // delay to allow the device to handle the write\n for(let a = 0; a<2500; a++){\n console.log(\"\")\n }\n }\n alert(\"File Uploaded!\")\n }else{\n const x = document.getElementById('console');\n alert(\"MicroTrynkit device not connected. Please pair it first.\");\n }\n //disconnect required for the device, device sees the disconnect then reboots which causes the code to run\n bledevice.gatt.disconnect();\n}", "function sendCommand(cmd) {\n\tvar command = [0, cmd];\n\tvar info = {\n\t\tdirection: 'out',\n\t\tendpoint: 2,\n\t\tdata: new Uint8Array(command).buffer\n\t};\n\n\tchrome.usb.interruptTransfer(mp_device, info, sendCompleted);\n}", "function onEvent(usbEvent) {\n\tconsole.log(\"onEvent\");\n\tif (usbEvent.resultCode) {\n\t\tif (usbEvent.resultCode == USB_ERROR_TRANSFER_FAILED) {\n\t\t\t// Device is connected but we failed to send data.\n\t\t\tchangeState(state.connected);\n\t\t} else if (usbEvent.resultCode == USB_ERROR_DEVICE_DISCONNECTED) {\n\t\t\tchangeState(state.disconnected);\n\t\t}\n\t\tconsole.log(chrome.runtime.lastError.message + \"(code: \" + usbEvent.resultCode + \") [onEvent]\");\n\t\treturn;\n\t}\n\n\tvar dv = new DataView(usbEvent.data);\n\tvar len = dv.getUint8(0);\n\tvar cmd = dv.getUint8(1);\n\n\tswitch (cmd) {\n\t\tcase CMD_DEBUG:\n\t\t{\n\t\t\tvar msg = \"\";\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tmsg += String.fromCharCode(dv.getUint8(i+2));\n\t\t\t}\n\t\t\tmessageln(\"<b>debug:</b> '\" + msg + \"'\");\n\t\t\tbreak;\n\t\t}\n\t\tcase CMD_PING:\n\t\t\tmessageln(\"<b>ping</b>\");\n\t\t\tbreak;\n\t\tcase CMD_VERSION:\n\t\t{\n\t\t\tvar version = \"\" + dv.getUint8(2) + \".\" + dv.getUint8(3);\n\t\t\tmessageln(\"<b>command:</b> Version \" + version);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\terrorln(\"unknown command\");\n\t\t\tbreak;\n\t}\n\n\tchrome.usb.interruptTransfer(mp_device, in_transfer, onEvent);\n}", "async function findUSBDevice(event) {\n // STEP 1A: Auto-Select first port\n if (event.type == 'AutoConnect' || event.type == 'Reconnect') {\n // ports = await getPorts()\n //STEP 1A: GetPorts - Automatic at initialization\n // -Enumerate all attached devices\n // -Check for permission based on vendorID & productID\n devices = await navigator.usb.getDevices();\n ports = devices.map((device) => new serial.Port(device)); //return port\n\n if (ports.length == 0) {\n port.statustext_connect =\n 'NO USB DEVICE automatically found on page load';\n console.log(port.statustext_connect);\n } else {\n var statustext = '';\n if (event.type == 'AutoConnect') {\n statustext = 'AUTO-CONNECTED USB DEVICE ON PAGE LOAD!';\n } else if (event.type == 'Reconnect') {\n statustext = 'RECONNECTED USB DEVICE!';\n }\n port = ports[0];\n try {\n await port.connect();\n } catch (error) {\n console.log(error);\n }\n port.statustext_connect = statustext;\n console.log(port.statustext_connect);\n\n //Hide manual connect button upon successful connect\n document.querySelector('button[id=connectusb]').style.display = 'none';\n }\n }\n\n // STEP 1B: User connects to Port\n if (\n event.type == 'pointerup' ||\n event.type == 'touchend' ||\n event.type == 'mouseup'\n ) {\n event.preventDefault(); //prevents additional downstream call of click listener\n try {\n //STEP 1B: RequestPorts - User based\n // -Get device list based on Arduino filter\n // -Look for user activation to select device\n const filters = [\n { vendorId: 0x2341, productId: 0x8036 },\n { vendorId: 0x2341, productId: 0x8037 },\n { vendorId: 0x2341, productId: 0x804d },\n { vendorId: 0x2341, productId: 0x804e },\n { vendorId: 0x2341, productId: 0x804f },\n { vendorId: 0x2341, productId: 0x8050 },\n ];\n\n device = await navigator.usb.requestDevice({ filters: filters });\n port = new serial.Port(device); //return port\n\n await port.connect();\n\n port.statustext_connect = 'USB DEVICE CONNECTED BY USER ACTION!';\n console.log(port.statustext_connect);\n\n //Hide manual connect button upon successful connect\n document.querySelector('button[id=connectusb]').style.display = 'none';\n } catch (error) {\n console.log(error);\n }\n waitforClick.next(1);\n }\n} //FUNCTION findUSBDevice", "function bleConsole(value){\n const y = document.getElementById('serial')\n /* check if the device is connected if true send file*/\n if(isConnected){\n /* need to read the value of the TX_char\n * may need some kind of loop or trigger to watch if new data comes in????\n * not sure what I want to implement for this yet....\n */\n // y.innerText = TX_characteristic.readValue(); TODO does not work\n }else{\n const x = document.getElementById('console');\n x.style.display =\"none\";\n alert(\"MicroTrynkit device not connected. Please pair it first.\");\n }\n\n}", "writeLoginControl(data) {\n var arrData = [17,16,0,1,1,];\n const data_send = this.toUTF8Array(data);\n console.log('writeLoginControl_1',data_send);\n for (var i = 0; i < data_send.length; i++) {\n arrData.push(data_send[i]);\n }\n arrData[2] = arrData.length + 1;\n arrData[arrData.length] = this.calCheckSum(arrData);\n\n console.log('writeLoginControl_2',arrData, this.byteToHexString(arrData));\n\n BleManager.writeWithoutResponse(this.props.mymac, 'fff0', 'fff5',arrData)\n .then(() => {\n console.log('--writeLoginControl successfully: ',arrData);\n })\n .catch((error) => {\n console.log('--writeLoginControl failed ',error);\n });\n }", "function onData(d){\n var frame,\n generatedData,\n response;\n\n frame = TBus.parse(d);\n\n if(!frame.valid){\n console.log(\"Invalid frame received.\");\n return;\n }\n\n if(!Devices[frame.receiver[0]]){\n console.log(\"Device is not supported.\");\n }\n\n generatedData = Devices[frame.receiver[0]].randomData();\n response = TBus.prepareCommand(frame.sender, frame.receiver, generatedData);\n\n setTimeout(function(){\n /*\n var one,\n two;\n\n one = new Buffer(response.slice(0,5));\n two = new Buffer(response.slice(5,response.length));\n serialPort.write(one);\n setTimeout(function(){\n serialPort.write(two);\n },110);\n */\n serialPort.write(response);\n },0);\n}", "enumerate_devices() {\n const filters = {filters: [\n {vendorId: 0x16D0}\n ]};\n\n if (!this.usb) {\n this.log(\"error: WebUSB not supported\\n\", \"red\");\n return;\n }\n\n this.usb.requestDevice(filters)\n .then(dev => this.connect_device(dev))\n .catch(error => {\n if (String(error) === \"SecurityError: Must be handling a user gesture to show a permission request.\") {\n this.log(\"Please click 'Connect Device' on the left toolbar.\", \"black\");\n } else if (String(error) === \"NotFoundError: No device selected.\") {\n this.log(\"Please select a WebUSB device.\", \"red\");\n } else {\n this.log(String(error));\n this.log(\"error: unable to enumerate USB device list\");\n }\n });\n }", "function bluetooth(){\n\n if (!navigator.bluetooth) {\n return alert('Web Bluetooth API is not available in this browser. Please use chrome.');\n }\n const z = document.getElementById('debugger');\n const y = document.getElementById('serial')\n\n if (z.style.display ===\"none\"){\n z.style.display = \"block\";\n }else{\n }\n \n z.innerHTML= z.innerHTML + \"\\n\"+ ('Requesting Bluetooth Devices');\n navigator.bluetooth.requestDevice({\n filters:[{\n name: 'MicroTrynkit',\n }],\n optionalServices: [service]\n })\n .then(device=>{\n z.innerHTML = z.innerHTML + \"\\n\"+ (\"Connected to: \");\n z.innerHTML= z.innerHTML +\"\\n\"+ (\">Name:\" + device.name);\n z.innerHTML= z.innerHTML + \"\\n\"+ (\">id:\" + device.id);\n isConnected = 1;\n bledevice = device;\n return device.gatt.connect();\n })\n .then(server=>{\n bleserver = server;\n return server.getPrimaryService(service);\n })\n .then(service => {\n return service.getCharacteristic(RX_char)\n .then(characteristic => {\n console.log(characteristic);\n RX_characteristic = characteristic;\n return service.getCharacteristic(TX_char);\n })\n })\n .then(characteristic => {\n console.log(characteristic);\n TX_characteristic = characteristic;\n /* add an event listener to the TX characteristic */\n TX_characteristic.addEventListener('valueUpdate', handleValueUpdated);\n console.log(TX_characteristic.readValue());\n })\n .then( value =>{\n /* try to read from the device and print to console */\n // y.innerText = value.getUint8(0);\n // console.log(value.getUint8(0));\n })\n .catch(error=> {\n z.innerHTML= z.innerHTML + \"\\n\"+ (error);\n });\n}", "function ble_transmit_cmd(cmd) {\n if(cmd == 0){\n for(var i = 0; i < g_rawcode_length/2; i = i + 1){\n uiProgressBar(g_rawcode_length/2, i+1);\n\n var tx_data = [];\n\n /*\n for(var j = 0; j < 2; j = j + 1){\n tx_data[j] = 0xff & (i >> (8*(1-j)));\n }\n */\n //CMD\n tx_data[0] = 0;\n //index\n tx_data[1] = i & 0xff;\n\n\n for(var j = 0; j < 2; j = j + 1){\n tx_data[2+j] = 0xff & ((g_rawcode_length/2) >> (8*(1-j)));\n }\n\n //freq(0:38k, 1;40k)\n tx_data[4] = 0;\n //Format(0:unknown, 1:NEC, 2:SONY...)\n tx_data[5] = 1;\n\n //Number of Frame\n for(var j = 0; j < 2; j = j + 1){\n tx_data[6+j] = 0xff & (g_rawcode_length >> (8*(1-j)));\n }\n\n //Data0\n for(var j = 0; j < 4; j = j + 1){\n tx_data[8+j] = 0xff & ((g_rawcode[i*2] / g_ir_margin) >> (8*(3-j)));\n }\n\n //Data1\n for(var j = 0; j < 4; j = j + 1){\n tx_data[12+j] = 0xff & ((g_rawcode[i*2 + 1] / g_ir_margin) >> (8*(3-j)));\n }\n\n //Transmit\n window.cmdCharacteristic.writeValue(new Uint8Array(tx_data)).catch(error => {\n uiDebugMessage(\"liffWriteLoadMatrix\");\n uiStatusError(makeErrorMsg(error), false);\n });\n }\n }else{\n window.cmdCharacteristic.writeValue(new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])).catch(error => {\n uiDebugMessage(\"liffWriteLoadMatrix - Req\");\n uiStatusError(makeErrorMsg(error), false);\n });\n }\n}", "async function upload( cmd_array, fastspeed = true){\n let fullflag = false\n \n if(cmd_array.length>1){\n fullflag = Boolean(parseInt(cmd_array[1]))\n }\n\n if(fastspeed){\n await blxConnectionFast()\n if(blxErrMsg) return\n }\n\n for(;;){ // Unlock Device (locked in FAST mode)\n await blxDeviceCmd('v', 5000) // Get virtual Disk Dir\n if (blxErrMsg) break\n\n if(fullflag === true){ // After 1.st true BLE cmd bec. of deviceMAC\n await blStore.remove(blxIDs.deviceMAC + '_data.edt')\n await blStore.remove(blxIDs.deviceMAC + '_data.edt.old')\n }\n \n await calcMem(true) // With adjust\n if(blxErrMsg) break\n\n terminalPrint('Available Data (Bytes): Total: ' + blxDataMem.total + ', New: ' + blxDataMem.incnew)\n\n if(blxUserCB) {\n if(fullflag) blxUserCB('UPLOAD',blxDataMem.total,'FULL') \n else blxUserCB('UPLOAD',blxDataMem.incnew,'INC') \n }\n \n await updateFile('data.edt', fullflag)\n if(blxErrMsg) break\n\n await updateFile('data.edt.old', fullflag)\n //if(blxErrMsg) break // not needed\n\n break \n } // for\n\n if(fastspeed){ // With NO data, direct CF->CS might raise GATT ERROR\n await blxConnectionSlow()\n }\n }", "function request(value) {\n\t// Init variables\n\tlet src;\n\tlet cmd;\n\n\tswitch (value) {\n\t\tcase 'motor-values' : {\n\t\t\tsrc = 'DIA';\n\t\t\tcmd = [ 0xB8, 0x12, 0xF1, 0x03, 0x22, 0x40, 0x00 ];\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault : return;\n\t}\n\n\tbus.data.send({\n\t\tsrc : src,\n\t\tdst : 'DME',\n\t\tmsg : cmd,\n\t});\n}", "async request() {\n let options = {\n filters: [\n {\n name: \"balenaBLE\"\n }\n ],\n optionalServices: [0xfff0, 0xfff1]\n };\n if (navigator.bluetooth == undefined) {\n alert(\"Sorry, Your device does not support Web BLE!\");\n return;\n }\n this.device = await navigator.bluetooth.requestDevice(options);\n if (!this.device) {\n throw \"No device selected\";\n }\n this.device.addEventListener(\"gattserverdisconnected\", this.onDisconnected);\n }", "async function writepumpdurationtoBLE(num){\n console.log('Attempting bluetooth write')\n var arrInt8 = toBytesInt16(num)\n ble.twrite_pumpduration=performance.now()\n try{\n await ble.writepumpdurationcharacteristic.writeValue(arrInt8)\n var textstr = 'wrote ble val >> ' + num + ', byte values ' + arrInt8\n console.log(textstr)\n ble.statustext = textstr\n // \n //wdm(textstr)\n }\n catch(error) {\n var textstr = 'Could not write pump duration to ble device'\n console.log(textstr)\n ble.statustext = ble.statustext + \"<br>\" + textstr\n \n }\n}", "function sendSerialData() {\n\t\tif (isLoaded()) {\n\t\t\t// Beggining and ending patterns that signify port has responded\n\t\t\t// chr(2) and chr(13) surround data on a Mettler Toledo Scale\n\t\t\tqz.setSerialBegin(chr(2));\n\t\t\tqz.setSerialEnd(chr(13));\n\t\t\t// Baud rate, data bits, stop bits, parity, flow control\n\t\t\t// \"9600\", \"7\", \"1\", \"even\", \"none\" = Default for Mettler Toledo Scale\n\t\t\tqz.setSerialProperties(\"9600\", \"7\", \"1\", \"even\", \"none\");\n\t\t\t// Send raw commands to the specified port.\n\t\t\t// W = weight on Mettler Toledo Scale\n\t\t\tqz.send(document.getElementById(\"port_name\").value, \"\\nW\\n\");\n\t\t\t\n\t\t\t// Automatically called when \"qz.send()\" is finished waiting for \n\t\t\t// a valid message starting with the value supplied for setSerialBegin()\n\t\t\t// and ending with with the value supplied for setSerialEnd()\n\t\t\twindow['qzSerialReturned'] = function(portName, data) {\n\t\t\t\tif (qz.getException()) {\n\t\t\t\t\talert(\"Could not send data:\\n\\t\" + qz.getException().getLocalizedMessage());\n\t\t\t\t\tqz.clearException(); \n\t\t\t\t} else {\n\t\t\t\t\tif (data == null || data == \"\") { // Test for blank data\n\t\t\t\t\t\talert(\"No data was returned.\")\n\t\t\t\t\t} else if (data.indexOf(\"?\") !=-1) { // Test for bad data\n\t\t\t\t\t\talert(\"Device not ready. Please wait.\")\n\t\t\t\t\t} else { // Display good data\n\t\t\t\t\t\talert(\"Port [\" + portName + \"] returned data:\\n\\t\" + data);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}", "function getWeMoData() {\n var wemoHeaders = { \n \"Content-Type\": \"application/json\", \n \"SOAPACTION\": \"urn:Belkin:service:basicevent:1#GetBinaryState\",\n };\n var wemoState = '<?xml version=\"1.0\" encoding=\"<utf-8\"?>>' + \n '<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/>' +\n \"<s:Body>\" + \n '<u:GetBinaryState xmlns:u=\"urn:Belkin:service:basicevent:1>' + \n \"<BinaryState>1</BinaryState>\" + \n \"</u:GetBinaryState>\" + \n \"</s:Body>\" + \n \"</s:Envelope>\"\n var wemoOptions =\n {\n \"method\" : \"post\",\n \"headers\" : wemoHeaders,\n \"muteHttpExceptions\": true,\n \"payload\" : wemoState,\n };\n\n var ddnsDevices = [ \"WemoXmas\", \"WemoGazebo\" ];\n props.setProperty( \"weNum\", ddnsDevices.length ); \n \n for (var i = 0; i < ddnsDevices.length; i++) {\n var response = UrlFetchApp.fetch(getSecureVal(ddnsDevices[i], \"URL\") + \"/upnp/control/basicevent1\").getContentText();\n Logger.log(response);\n var wemoJson = JSON.parse(response);\n state = wemoJSON.BinaryState;\n props.setProperties( \"we\" + String(i), state ); \n /* send to ATT M2X*/\n var streams = [ \"we0\", \"we1\", \"we2\", \"we3\" ];\n sendDataATT(ddnsDevices[i], streams);\n logProps(streams);\n }\n \n}", "function OpenAVR(device)\n{\n if (device.deviceDescriptor.idVendor != kAtmel ||\n device.deviceDescriptor.idProduct != kEVK1101)\n {\n return; // (not our device)\n }\n\n try {\n device.open();\n device.interfaces[0].claim();\n // find first unused input >= 2\n for (var i=2; ; ++i) {\n if (i < avrs.length && avrs[i]) continue;\n avrs[i] = device;\n device.avrNum = i;\n var endIn = device.interfaces[0].endpoints[0];\n var endOut = device.interfaces[0].endpoints[1];\n endIn.avrNum = i;\n endOut.avrNum = i;\n endIn.transferType = usb.LIBUSB_TRANSFER_TYPE_BULK;\n endOut.transferType = usb.LIBUSB_TRANSFER_TYPE_BULK;\n endIn.timeout = 1000;\n endOut.timeout = 1000;\n // (must install handlers before we start polling)\n endIn.on('data', HandleData);\n endIn.on('error', HandleError);\n endOut.on('error', HandleError);\n endIn.startPoll(4, 256);\n\n // add member function to send command to AVR\n device.SendCmd = SendCmd;\n // send initial command to get AVR serial number and software version\n device.SendCmd(\"a.ser;b.ver\\n\");\n break;\n }\n }\n catch (err) {\n Log('Error opening AVR device');\n }\n}", "function sendCommand(device_id, command) {\n\tnew Ajax.Request(\"/controls/sendCommand\", { \n\t\tmethod: \"get\", \n\t\tparameters: { \n\t\t\t\"device_id\": device_id,\n\t\t\t\"command\": command,\n\t\t}\n\t});\t\n}", "function send (token, deviceId, payload, cb) {\n\trequest.post({\n\t\turl,\n\t\tbody: Buffer.concat([new Buffer(deviceId, 'hex'), payload]),\n\t\theaders: {\n\t\t\t'Content-Type': 'application/octet-stream',\n\t\t\t'Authorization': 'Token ' + token,\n\t\t},\n\t}, (err, httpResponse, body) => {\n\t\tif (err) return cb(err)\n\n\t\tif (httpResponse.statusCode !== 200) {\n\t\t\treturn cb('Error in ConCaVa (' + httpResponse.statusMessage + '): ' + body)\n\t\t}\n\n\t\tcb()\n\t})\n}", "function setupUSBEventHandlers(result) {\n\tconsole.log('App was granted the \"usbDevices\" permission.');\n\tchrome.usb.findDevices(device_info, function(devices) {\n\t\tconsole.log('Found ' + devices.length + ' devices.');\n\t\tif (!devices || !devices.length) {\n\t\t\treturn;\n\t\t}\n\t\tmp_device = devices[0];\n\t\tchrome.usb.interruptTransfer(mp_device, in_transfer, onEvent);\n\n\t\tchangeState(state.ready);\n\t});\n}", "function controlHSDevice(device,action,value,cbfunc){\n var options = {\n hostname: hsserver,\n path: '/jsonapi.asp?action=' + action + '&id=' + device + '&value=' + value,\n port: hsport,\n headers: {\n 'Authorization': auth\n }\n };\n\n http.get(options, function(response) {\n var body = '';\n response.on('data', function(d) {body += d;});\n response.on('end', function() {cbfunc(JSON.parse(body));});\n\t response.on(\"error\",function(e){console.log(\"Got error: \" + e.message); });\n }); \n}", "function controlHSDevice(device,action,value,cbfunc){\n var options = {\n hostname: hsserver,\n path: '/jsonapi.asp?action=' + action + '&id=' + device + '&value=' + value,\n port: hsport,\n headers: {\n 'Authorization': auth\n }\n };\n\n http.get(options, function(response) {\n var body = '';\n response.on('data', function(d) {body += d;});\n response.on('end', function() {cbfunc(JSON.parse(body));});\n\t response.on(\"error\",function(e){log(\"Got error: \" + e.message); });\n }); \n}", "update() {\n\t\tthis.dev.controlTransfer(0xb2, 0x06, 0, 0, 128).then((status) => {\n\t\t\tif(status.length != 128) {\n\t\t\t\treturn this.error(`Status size error. Received: ${status.length}`);\n\t\t\t}\n\t\t\tthis.parseStatus(status);\n\t\t});\n\t}", "function sendToSerial(data){\n var objFromBuffer = JSON.parse(data);\n console.log(\"sending to serial: \", objFromBuffer.data);\n if(objFromBuffer.data !== undefined){\n myPort.write(objFromBuffer.data); \n }\n}", "function respond(){\n\t\t\t\t\t// flush HTTP response\n\t\t\t\t\tvar bin = responsePacket.serialize();\n\t\t\t\t\t//sys.puts( utils.hex(bin) );\n\t\t\t\t\t//sys.puts( sys.inspect(responsePacket) );\n\t\t\t\t\tres.writeHead( 200, {\n\t\t\t\t\t\t'Content-Type': 'application/x-amf',\n\t\t\t\t\t\t'Content-Length': bin.length \n\t\t\t\t\t} );\n\t\t\t\t\tres.write( bin, \"binary\" );\n\t\t\t\t\tres.end();\n\t\t\t\t}", "function WebUSBSerialCommunicator (params) {\n var self = this;\n\n self.debugMode = false;\n if(typeof params !== \"undefined\" &&\n params !== null &&\n typeof params.debug === \"boolean\") {\n self.debugMode = params.debug;\n }\n\n if(typeof params !== \"undefined\" &&\n params !== null &&\n typeof params.device === \"object\") {\n if (params.device.vendorId === FTDI_USB_VENDOR_ID && params.device.productId === FTDI_USB_PRODUCT_ID) {\n this.serial = new WebFTDIUSBSerialPort({\n device: params.device,\n debug: self.debugMode\n });\n } else if (params.device.vendorId === NATIVE_USB_VENDOR_ID && params.device.productId === NATIVE_USB_PRODUCT_ID) {\n this.serial = new WebNativeUSBSerialPort({\n device: params.device,\n debug: self.debugMode\n });\n } else {\n throw new Error(\"Device's vendor ID and product ID do not match a TappyUSB\");\n }\n } else if (typeof params !== \"undefined\" &&\n params !== null &&\n typeof params.serial === \"object\"){\n // this is just for testing and should not be used\n this.serial = params.serial;\n } else {\n throw new Error(\"Must specify a TappyUSB device\");\n }\n\n this.isConnecting = false;\n this.hasAttached = false;\n this.disconnectImmediately = false;\n this.disconnectCb = function() {};\n\n this.dataReceivedCallback = function(bytes) {\n\n };\n this.errorCallback = function(data) {\n\n };\n this.readCallback = function(buff) {\n self.dataReceivedCallback(new Uint8Array(buff));\n };\n }", "writeLoginSetting(data) {\n var arrData = [17,32,0,1,1,];\n const data_send = this.toUTF8Array(data);\n console.log('writeLoginSetting_1',data_send);\n for (var i =0; i < data_send.length; i++) {\n arrData.push(data_send[i]);\n }\n arrData[2] = arrData.length + 1;\n arrData[arrData.length] = this.calCheckSum(arrData);\n\n console.log('writeLoginSetting_2',arrData, this.byteToHexString(arrData));\n\n BleManager.writeWithoutResponse(this.props.mymac, 'fff0', 'fff5',arrData)\n .then(() => {\n console.log('--writeLoginSetting successfully: ',arrData);\n })\n .catch((error) => {\n console.log('--writeLoginSetting failed ',error);\n });\n }", "function sendToSerial(data) {\n console.log(\"sending to serial: \" + data);\n port.write(data);\n}", "function HandleResponse(avrNum, responseID, msg)\n{\n switch (responseID) {\n case 'a': // a = get serial number\n var avr;\n avrs[avrNum].avrSN = msg; // save s/n in device object\n for (var i=0; i<avrSN.length; ++i) {\n if (msg == avrSN[i]) {\n avr = 'AVR' + i;\n if (avrNum < 2 || !avrs[avrNum]) {\n if (avrs[i] != avrs[avrNum]) {\n Log(avr, 'INTERNAL ERROR');\n } else {\n // could get here if we got a \"ser\" response\n // from an already identified AVR\n return avrNum; // (nothing to do)\n }\n } else {\n if (avrs[i]) {\n if (avrs[i] != avrs[avrNum]) {\n Log(avr, 'ERROR! Already exists!');\n }\n } else {\n ++foundAVRs;\n }\n // change the number of this AVR\n avrs[i] = avrs[avrNum];\n avrs[i].avrNum = i;\n avrs[i].interfaces[0].endpoints[0].avrNum = i;\n avrs[i].interfaces[0].endpoints[1].avrNum = i;\n avrs[avrNum] = null;\n avrOK[i] = 1;\n avrOK[avrNum] = 0;\n avrNum = i;\n }\n break;\n }\n }\n if (avr) {\n // enable watchdog timer\n avrs[avrNum].SendCmd('c.wdt 1\\n');\n if (avrNum == 0) {\n // enable pull-ups for limit switches\n avrs[avrNum].SendCmd('c.pa0-' + (kNumLimit-1) + ' ' +\n Array(kNumLimit+1).join('+') + '\\n');\n // set polarity of motor on sigals\n avrs[avrNum].SendCmd('c.m0 on +;m1 on +;m2 on +\\n');\n // turn on motors\n avrs[avrNum].SendCmd('c.m0 on 1;m1 on 1;m2 on 1\\n');\n }\n Log(avr, 'attached (s/n', msg + ')');\n } else {\n avrs[avrNum].SendCmd('z.wdt 0\\n'); // disable watchdog on unknown AVR\n Log('Unknown AVR'+avrNum, '(s/n', msg + ')');\n }\n break;\n\n case 'b': // b = log this response\n Log('AVR'+avrNum, msg);\n break;\n\n case 'c': // c = ignore this response\n break;\n\n case 'd': // d = (currently not used)\n break;\n\n case 'e': // e = manual AVR command\n Log('[AVR'+avrNum+']', msg);\n break;\n\n case 'f': { // f = motor speeds\n if (msg.length >= 8 && msg.substr(0,1) == 'm') {\n var n = msg.substr(1,1); // motor number\n var a = msg.split(' ');\n for (var i=0; i<a.length; ++i) {\n switch (a[i].substr(0,4)) {\n case \"SPD=\":\n motorSpd[n] = Number(a[i].substr(4));\n motorDir[n] = a[i].substr(4,1) == '-' ? 1 : 0;\n break;\n case \"POS=\":\n motorPos[n] = Number(a[i].substr(4));\n break;\n }\n }\n if (n==2) {\n // log a message if any of the motors turned on or off\n var changed = 0;\n for (var i=0; i<3; ++i) {\n if (!motorSpd[i] != !motorRunning[i]) {\n changed = 1;\n motorRunning[i] = motorSpd[i];\n }\n }\n if (changed) {\n var running = [];\n for (var i=0; i<3; ++i) {\n if (motorRunning[i]) running.push(i);\n }\n if (running.length) {\n LogToFile(\"Motors running:\", running.join(' '));\n } else {\n LogToFile(\"Motors stopped\");\n }\n }\n // inform clients periodically of current motor speeds\n if (fullPoll) {\n var newSpd = motorSpd.join(' ');\n if (lastSpd != newSpd) {\n PushData('E ' + newSpd);\n lastSpd = newSpd;\n }\n }\n }\n }\n } break;\n\n case 'g': { // g = poll limit switches\n var j = msg.indexOf('VAL=');\n if (j < 0 || msg.length - j < kNumLimit) {\n avrs[0].SendCmd(\"c.halt\\n\");\n Log(\"Poll error. Motors halted\");\n // safety fallback: assume we hit the limits\n for (var k=0; k<kNumLimit; ++k) {\n limitSwitch[k] = kHitLimit;\n }\n } else {\n for (var k=0; k<kNumLimit; ++k) {\n if (msg.substr(j+4+k, 1) == kNotLimit) {\n limitSwitch[k] = kNotLimit;\n } else {\n limitSwitch[k] = kHitLimit;\n var mot = Math.floor(k / 2);\n if (!motorSpd[mot]) continue;\n var isBottom = ((k & 0x01) == kBotLimit);\n if (isBottom) {\n // allow positive motor speed when at bottom limit\n if (motorSpd[mot] > 0) continue;\n } else {\n // allow negative motor speed when at top limit\n if (motorSpd[mot] < 0) continue;\n }\n avrs[0].SendCmd(\"c.m\" + mot + \" halt\\n\");\n var which = isBottom ? \"lower\" : \"upper\";\n Log(\"M\" + mot + \" halted! (hit \" + which + \" limit switch)\");\n }\n }\n }\n } break;\n\n case 'z': // z = disable watchdog timer\n // forget about the unknown AVR\n avrs[avrNum].interfaces[0].endpoints[0].device = avrs[avrNum];\n avrs[avrNum].interfaces[0].endpoints[0].on('end', HandleEnd);\n avrs[avrNum].interfaces[0].endpoints[0].stopPoll();\n avrs[avrNum] = null;\n break;\n\n default:\n Log('AVR'+avrNum, 'Unknown response:', msg);\n break;\n }\n return avrNum;\n}", "async function blxDeviceCmd (cmd, timeout_ms = DEV_TIMEOUT_MS) { // case dep.\n if (blxCmdBusy === true) {\n console.warn('*** BLX BUSY (Since ' + (Date.now() - blxCmdBusy_t0).toFixed(0) + ' msec) ***')\n return\n }\n\n if (full_connected_flag !== true) {\n if (NUS_device === undefined) {\n blxErrMsg = 'ERROR(DeviceCmd): Not Connected!'\n return\n } else {\n await blxConnectNus(0, 1) // Reconnect with SCAN\n if (blxErrMsg) return\n }\n }\n\n blxCmdBusy = true\n blxCmdLast = cmd\n blxCmdBusy_t0 = Date.now()\n await bleSendData(cmd)\n await wait_blx(timeout_ms)\n blxCmdBusy = false\n }", "function send2LMviaBT(value) { //value is an arry of bytes\r\n //let encoder = new TextEncoder('utf-8');\r\n mDebugMsg1(1,'Setting Characteristic User Description...');\r\n gattCharacteristic.writeValue(value)\r\n .then(_ => {\r\n \t mDebugMsg1(1,'> Characteristic User Description changed to: ' + value);\r\n })\r\n .catch(error => {\r\n\t\t//todo9: userfriendly message\r\n \t mDebugMsg1(1,'Argh! ' + error);\r\n });\r\n\r\n\r\n }", "async function requestBarcodePrinter() {\n console.log(navigator)\n navigator.usb &&\n navigator.usb\n .requestDevice({\n filters: [\n {\n vendorId: 5380,\n // classCode: 0xff, // vendor-specific\n // protocolCode: 0x01,\n },\n ],\n })\n .then(selectedDevice => {\n setBarcodePrinter(selectedDevice)\n })\n .catch(errorInfo => {\n console.log(errorInfo)\n // message.error(i18n.t`Cannot find label printer`)\n })\n }", "_sendData() {\n\n }", "function sendData() {\n // convert the value to an ASCII string before sending it:\n serialPort.write(brightness.toString());\n console.log('Sending ' + brightness + ' out the serial port');\n }", "function raspiWrite(component, value){\t\n\tconst data = {\n\t\tValue: value\n\t};\n\n\tconst option = {\n\t\tmethod: 'POST',\n\t\tbody: JSON.stringify(data), \n\t\theaders:{\n\t\t\t'Content-Type': 'application/json'\n\t\t}\n\t}\n\tfetch('/raspi/' + component, option)\n\t.then(console.log(\"LED actualizado\"));\n}", "function sendRequest(sensorType, isSensorOn, dataByte) {\n var newRequest = new XMLHttpRequest();\n newRequest.open(\"POST\", `http://${window.location.host}/pi_data`, true);\n newRequest.setRequestHeader(\"Content-Type\", \"application/json\");\n newRequest.send(\n JSON.stringify({\n sensor: sensorType,\n isSensorOn: isSensorOn,\n mode: dataByte,\n })\n );\n}", "function trans_appbin(idx) {\n let btdev = btdevs[idx];\n let seq = btdev.wrtseq;\n\n showProgress(idx);\n\n if (seq >= mrbbin.byteLength / mrb_chunk_size) {\n btdev.wrtseq = -1;\n let buf = [0x07, 0x70, 0x61, 0x73, 0x73, 0x00];\n btdev.bt.write(\"WriteApp\", buf);\n console.log(\"Transfer completed. idx=\" + idx);\n return;\n }\n\n // var binbuf = [0x06, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n // binbuf[1] = Math.floor(seq / 256);\n // binbuf[2] = seq % 256;\n btdev.binbuf[1] = Math.floor(seq / 256);\n btdev.binbuf[2] = seq % 256;\n\n for (var i=0; i<mrb_chunk_size; i++) {\n // binbuf[mrb_chunk_start + i] = mrbbin[seq * mrb_chunk_size + i];\n btdev.binbuf[mrb_chunk_start + i] = mrbbin[seq * mrb_chunk_size + i];\n }\n // btdev.bt.write(\"WriteApp\", binbuf);\n btdev.bt.write(\"WriteApp\", btdev.binbuf);\n // document.getElementById(\"bin\").innerHTML = seq + \": \" + mrbbuf;\n // console.log(idx + \": \" + seq + \": \" + binbuf);\n console.log(idx + \": \" + seq + \": \" + btdev.binbuf);\n}", "function SendCmd(cmd)\n{\n try {\n this.interfaces[0].endpoints[1].transfer(cmd, function(error) {\n if (error) {\n Log('AVR'+this.avrNum, 'send error');\n ForgetAVR(this);\n }\n });\n }\n catch (err) {\n Log('AVR'+this.avrNum, 'send exception');\n ForgetAVR(this);\n }\n}", "bus_rx(data) { this.send('bus-rx', data); }", "function onSendInterval() {\n let content = JSON.stringify({A0: analogRead(A0)});\n console.log('Send: ' + content);\n var options = {\n host: SMARTTHINGS_HOST,\n port: SMARTTHINGS_PORT,\n path:'/',\n method:'POST',\n headers: { \"Content-Type\":\"application/json\", \"Content-Length\":content.length }\n };\n http.request(options, (res) => {\n let allData = \"\";\n res.on('data', function(data) { allData += data; });\n res.on('close', function(data) { console.log(\"Closed: \" + allData); }); \n }).end(content);\n}", "function sendData() {\n // convert the value to an ASCII string before sending it:\n myPort.write(brightness.toString());\n console.log('Sending ' + brightness + ' out the serial port');\n // increment brightness by 10 points. Rollover if > 255:\n if (brightness < 255) {\n brightness+= 10;\n } else {\n brightness = 0;\n }\n }", "function processDeviceCommand(request, response) {\r\n\tvar command = request.headers[\"tplink-command\"]\r\n\tvar deviceIP = request.headers[\"tplink-iot-ip\"]\r\n\tvar respMsg = \"deviceCommand sending to IP: \" + deviceIP + \" Command: \" + command\r\n\tconsole.log(respMsg)\r\n\tvar action = request.headers[\"action\"]\r\n\tresponse.setHeader(\"action\", action)\r\n\tvar socket = net.connect(9999, deviceIP)\r\n\tsocket.setKeepAlive(false)\r\n\tsocket.setTimeout(6000)\r\n\tsocket.on('connect', () => {\r\n\t\tsocket.write(TcpEncrypt(command))\r\n\t})\r\n\tsocket.on('data', (data) => {\r\n\t\tsocket.end()\r\n\t\tdata = decrypt(data.slice(4)).toString('ascii')\r\n\t\tresponse.setHeader(\"cmd-response\", data)\r\n\t\tresponse.end()\r\n\t\tvar respMsg = \"Command Response sent to SmartThings\"\r\n\t\tconsole.log(respMsg)\r\n\t}).on('timeout', () => {\r\n\t\tresponse.setHeader(\"cmd-response\", \"TcpTimeout\")\r\n\t\tresponse.end()\r\n\t\tsocket.end()\r\n\t\tvar respMsg = new Date() + \"\\n#### TCP Timeout in deviceCommand for IP: \" + deviceIP + \" ,command: \" + command\r\n\t\tconsole.log(respMsg)\r\n\t\tlogResponse(respMsg)\r\n\t}).on('error', (err) => {\r\n\t\tsocket.end()\r\n\t\tvar respMsg = new Date() + \"\\n#### Socket Error in deviceCommand for IP: \" + deviceIP + \" ,command: \" + command\r\n\t\tconsole.log(respMsg)\r\n\t\tlogResponse(respMsg)\r\n\t})\r\n}", "OLDsendFirmware(data) {\n console.log('[3] bleTransport: TODO sendFirmware(data)');\n console.log('[3] bleTransport: data =', data);\n return Promise.resolve();\n /*TODO\n this._emitInitializeEvent(ObjectType.DATA);\n return this.getFirmwareState(data)\n .then(state => {\n this._debug(`Sending firmware: ${state.toString()}`);\n const objects = state.remainingObjects;\n if (state.hasResumablePartialObject) {\n const object = state.remainingPartialObject;\n return this._resumeWriteObject(object, ObjectType.DATA, state.offset, state.crc32).then(progress =>\n this._createAndWriteObjects(objects, ObjectType.DATA, progress.offset, progress.crc32));\n }\n return this._createAndWriteObjects(objects, ObjectType.DATA, state.offset, state.crc32);\n });\n */\n }", "sendSendSerialPortsMessageToServer() {\n var message = {};\n this.sendMessageToServer('sendSerialPorts', message);\n }", "async enableSimpleHIDMode() {\n const outputReportID = 0x01;\n const subcommand = [0x03, 0x3f];\n const data = [\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n ...subcommand,\n ];\n await this.device.sendReport(outputReportID, new Uint8Array(data));\n }", "readFromDevice() {\n this.device.transferIn(5, 64).then(result => {\n const decoder = new TextDecoder();\n this.rstring += decoder.decode(result.data);\n // do a quick JSON smoketest (should do better with decoder/streaming)\n const startIdx = this.rstring.indexOf('{');\n if(startIdx > 0) this.rstring = this.rstring.substring(startIdx);\n const endIdx = this.rstring.indexOf('}');\n if(endIdx > -1) {\n const parseStr = this.rstring.substring(0, endIdx+1);\n this.rstring = this.rstring.substring(endIdx+1);\n try {\n const msg = JSON.parse(parseStr);\n this._handleMessage(msg);\n // this.dispatchEvent(new CustomEvent('ek-event', {detail:msg}), {bubbles: true});\n } catch(e) {\n console.log(\"NOT JSON:\",parseStr);\n }\n this.rstring = \"\";\n }\n this.readFromDevice();\n })\n .catch(error => { \n console.log(error);\n this.emitMessage(this.device.serialNumber, \"\");\n this.emitDisconnected(this.device.serialNumber);\n this.device = null;\n this.rstring = \"\";\n });\n }", "function arduinoTest() {\n return request;\n}", "function cerial() {\n getPortInfo()\n .then( (portDetails) => handleSensor(portDetails))\n .catch((error) => console.log(error));\n // port.write('ROBOT PLEASE RESPOND\\n');\n // The parser will emit any string response\n}", "function sendData(blob) {\n\n\t// sends data to flask url /upload_sound as a post with data blob - in format for wav file, hopefully. it is a promise\n\tfetch(\"/upload_sound\", {\n\tmethod: \"post\",\n\tbody: blob\n\t});\n}", "function requestDevStatus() {\n if(mConnectedToDev) {\n return;\n }\n\n mNbReqStatusRetry++;\n if(mNbReqStatusRetry >= 6) {\n logger.warn('[ctrl-test] Request device status without response. Stop!');\n return;\n }\n\n devComm.sendStatusReportReq(SelectedGW);\n\n setTimeout(requestDevStatus, 5*1000);\n\n }", "async sendBinaryRequest(path, params) {\n if (LibraryUtils.getLogLevel() >= 2) console.log(\"sendBinaryRequest(\" + path + \", \" + JSON.stringify(params) + \")\");\n \n // load wasm module\n await LibraryUtils.loadKeysModule();\n \n // serialize params\n let paramsBin = MoneroUtils.jsonToBinary(params);\n \n try {\n \n // send http request\n let resp = await HttpClient.request({\n method: \"POST\",\n uri: this.getUri() + '/' + path,\n username: this.getUsername(),\n password: this.getPassword(),\n body: paramsBin,\n rejectUnauthorized: this.config.rejectUnauthorized,\n requestApi: GenUtils.isFirefox() ? \"xhr\" : \"fetch\"\n });\n \n // validate response\n MoneroRpcConnection.validateHttpResponse(resp);\n \n // process response\n resp = resp.body;\n if (!(resp instanceof Uint8Array)) {\n console.error(\"resp is not uint8array\");\n console.error(resp);\n }\n if (resp.error) throw new MoneroRpcError(resp.error.message, resp.error.code, path, params);\n return resp;\n } catch (err) {\n if (err instanceof MoneroRpcError) throw err;\n else throw new MoneroRpcError(err, undefined, path, params);\n }\n }", "function transmitAudioHexBytes(audioBlob) {\n\tvar myReader = new FileReaderSync(); // FIX - Firefox does not support\n\t\t\t\t\t\t\t\t\t\t\t// FileReader()\n\tvar arrayBuffer = myReader.readAsArrayBuffer(audioBlob);\n\tvar binaryHexData = buildMessage(\"DATA\", \"\");\n\tvar view = new DataView(arrayBuffer);\n\tvar viewLen = view.byteLength;\n\tfor (var i = 0; i < viewLen; binaryHexData += (\"00\" + view.getUint8(i++)\n\t\t\t.toString(16)).substr(-2).toUpperCase())\n\t\t;\n\tconsole.log(\"socketSend@main \" + binaryHexData.length);\n\twsSnd.send(binaryHexData);\n}", "function chromeAppMessageHandler(response) {\n console.debug(response);\n switch (response.responder) {\n case \"list\":\n const list_html = generateDropDownList(response.data);\n document.querySelector(\"#device-select\").innerHTML = list_html;\n document.querySelector(\"#device-select\").dispatchEvent(change_event);\n break;\n case \"connect\":\n device_connected = true;\n $(\"#connect\")\n .removeClass(\"btn-outline-success\")\n .addClass(\"btn-outline-danger\")\n .text(\"Disconnect\");\n document.querySelector(\"#baudrate\").setAttribute(\"disabled\", \"disabled\");\n document\n .querySelector(\"#device-select\")\n .setAttribute(\"disabled\", \"disabled\");\n break;\n case \"disconnect\":\n // TODO(kammce): Actually evaluate that the device has connected properly\n device_connected = false;\n table_init = false;\n telemetry_raw = \"\\r\\n\";\n $(\"#connect\")\n .addClass(\"btn-outline-success\")\n .removeClass(\"btn-outline-danger\")\n .text(\"Connect\");\n document.querySelector(\"#baudrate\").removeAttribute(\"disabled\");\n document.querySelector(\"#device-select\").removeAttribute(\"disabled\");\n $(\"#refresh\").click();\n break;\n case \"update\":\n break;\n case \"read\":\n term.write(response.data.replace(/\\n/g, \"\\r\\n\"));\n break;\n default:\n console.warn(\"Unknown response\");\n break;\n }\n}", "_pingDevice () {\n this._ble.read(\n BoostBLE.service,\n BoostBLE.characteristic,\n false\n );\n }", "sendFormatDataResponsePDU() {\n\n const bufs = Buffer.from(this.content + '\\x00', 'ucs2');\n\n this.send(new type.Component({\n msgType: new type.UInt16Le(data.ClipPDUMsgType.CB_FORMAT_DATA_RESPONSE),\n msgFlags: new type.UInt16Le(0x01),\n dataLen: new type.UInt32Le(bufs.length),\n requestedFormatData: new type.BinaryString(bufs, { readLength: new type.CallableValue(bufs.length) })\n }));\n\n }", "function HandleData(data)\n{\n var avrNum = this.avrNum;\n if (avrNum == null) {\n Log('Data from unknown device!');\n return;\n }\n var str = data.toString();\n // wait for null at end of string\n var j = str.indexOf('\\0');\n if (j > -1) str = str.substr(0, j); // remove null\n // process each response separately\n var lines = str.split(\"\\n\");\n var id;\n for (j=0; j<lines.length; ++j) {\n var str = lines[j];\n if (!str.length) continue;\n if (str.length >= 4 && str.substr(1,1) == '.') {\n id = str.substr(0,1);\n str = str.substr(2);\n }\n if (id != 'e') {\n if (str.substr(0,2) != 'OK') {\n Log('AVR'+avrNum, 'Bad response:', str);\n continue;\n }\n str = str.substr(3);\n }\n // ignore truncated responses (may happen at startup if commands\n // were sent before AVR was fully initialized)\n if (!id) continue;\n avrOK[avrNum] = 1;\n avrNum = HandleResponse(avrNum, id, str);\n }\n}", "function appxsendfilehandler(x) {\r\n if (appxIsLocalReady()) {\r\n switch (x.messagepart) {\r\n case -1:\r\n var msgfilenamedata = [];\r\n var filepath = appx_session.currsendfile.filename;\r\n appxClearStatusMsgText();\r\n appxSetStatusText(\"Saving File...\");\r\n appx_session.currsendfile.filedata = [];\r\n setTimeout(function setTimeout1() {\r\n //send client file path length\r\n var ms = {\r\n cmd: 'appxmessage',\r\n args: hton32(filepath.length),\r\n handler: 'appxsendfilehandler',\r\n data: null\r\n };\r\n appx_session.ws.send(JSON.stringify(ms));\r\n //send client file path\r\n for (var vi = 0; vi < filepath.length; vi++) {\r\n msgfilenamedata.push(filepath.charCodeAt(vi));\r\n }\r\n var ms = {\r\n cmd: 'appxmessage',\r\n args: msgfilenamedata,\r\n handler: 'appxsendfilehandler',\r\n data: null\r\n };\r\n appx_session.ws.send(JSON.stringify(ms));\r\n //send client status EOF\r\n var ms = {\r\n cmd: 'appxmessage',\r\n args: [3, 1],\r\n handler: 'appxsendfilehandler',\r\n data: null\r\n };\r\n appx_session.ws.send(JSON.stringify(ms));\r\n appxClearStatusMsgText();\r\n appxSetStatusText(\"File Download Complete...\");\r\n setTimeout(function setTimeout2() {\r\n if ($(\"#appx-status-msg\").html() === \"File Download Complete...\") {\r\n appxClearStatusMsgText();\r\n }\r\n }, 1000);\r\n }, appx_session.currsendfile.blocksreceived * 1); //end setTimeout\r\n\r\n break;\r\n case 3:\r\n appx_session.currsendfile.filename = x.data.filename;\r\n appx_session.currsendfile.guid = Math.floor((Math.random() * 1000000) + 1);\r\n appx_session.currsendfile.filedatareceived = 0;\r\n appx_session.currsendfile.blocksreceived = 0;\r\n appx_session.currsendfile.datalengthneeded = x.data.datalength;\r\n if (appx_session.currsendfile.filename.indexOf(\"$(\") > -1) {\r\n appx_session.currsendfile.filename = appx_session.parseOption(appx_session.currsendfile.filename);\r\n }\r\n else {\r\n appx_session.currsendfile.filename = appx_session.currsendfile.filename;\r\n }\r\n if (appx_session.currsendfile.filename.indexOf(\"/\") == -1 && appx_session.currsendfile.filename.indexOf(\"\\\\\") == -1) {\r\n appx_session.currsendfile.filename = appx_session.parseOption(\"$(userHome)\" + appx_session.fileseparatorchar + appx_session.currsendfile.filename);\r\n }\r\n appxClearStatusMsgText();\r\n appxSetStatusText(\"Creating File: \" + appx_session.currsendfile.filename);\r\n appx_session.currsendfile.filecreated = false;\r\n CreateFile(appx_session.currsendfile);\r\n break;\r\n case 5:\r\n appx_session.currsendfile.blocksreceived += 1;\r\n appx_session.currsendfile.filedatareceived += x.data.length;\r\n appxClearStatusMsgText();\r\n appxSetStatusText(\"File Downloading... Received: \" + appx_session.currsendfile.filedatareceived + \" Bytes of \" + appx_session.currsendfile.datalengthneeded.toString() + \" Needed\");\r\n AppendFile(x.data);\r\n break;\r\n\r\n default:\r\n //append data to file via local connector\r\n break;\r\n }\r\n }\r\n else {\r\n //send client status EOF\r\n if (x.messagepart != -1) {\r\n var ms = {\r\n cmd: 'appxmessage',\r\n args: [0, 0],\r\n handler: 'appxsendfilehandler',\r\n data: null\r\n };\r\n appx_session.ws.send(JSON.stringify(ms));\r\n }\r\n }\r\n}", "function readSerialData(data) {\n console.log(data.toString());\n sendit({method: 'data', data: data.toString()});\n}", "function performPowerActionResponse(stack, name, responses, status) {\n const dev = stack.dev;\n const action = dev.powerAction;\n delete dev.powerAction;\n if (obj.amtDevices[dev.nodeid] == null) return; // Device no longer exists, ignore this response.\n if (status != 200) return;\n\n // If this is Intel AMT 10 or higher and we are trying to wake the device, send an OS wake.\n // This will wake the device from \"Modern Standby\".\n if ((action == 2) && (dev.aquired.majorver > 9)) {\n try { dev.amtstack.RequestOSPowerStateChange(2, function (stack, name, response, status) { }); } catch (ex) { }\n }\n }", "async function sendPicture() {\n const req = {\n imagebytes: bas64,\n }\n alert('Enviado com sucesso');\n }", "async function enableBloodPressure() {\n const command = hexToBase64(\"55 aa 04 02 01 f8\");\n // console.log(\"TCL: enableBloodPressure -> command\", command)\n const didWrite = await Bluetooth.writeToDevice(command);\n // console.log(\"TCL: enableBloodPressure -> didWrite\", didWrite)\n return didWrite;\n}", "function transferByte(b) {\n\treturn new Promise((resolve, reject) => {\n\t\tlet txBuff = new Buffer([reverseByte(b)]);\n\t\tlet rxBuff = new Buffer(1);\n\t\tRPIO.spiTransfer(txBuff, rxBuff, 1);\n resolve(reverseByte(rxBuff[0]));\n\t});\n}", "function fx000(res) {\n global.clog(\"[ss_reqHan][fx000][SENT]\");\n res.writeHead(200, { \"Content-Type\": \"audio/wav\" }); \n var sendingfile = fs.readFileSync(views.sfx() + '/fx000.wav');\n res.write(sendingfile);\n res.end();\n}", "async function requestBLEDevice(){\n let result = Promise.resolve()\n if (ble.connected == false){\n console.log('Requesting ble device...')\n wdm('Requesting bluetooth device list')\n // let options = {filters: [ {name: ble.name}, {services:[ ble.customserviceUUID ]} ]}\n let options = {filters: [ {namePrefix: ble.namePrefix}, {services:[ ble.customserviceUUID ]} ]}\n\n try{\n device = await navigator.bluetooth.requestDevice(options)\n console.log(\"found a device\",device)\n console.log(device.name)\n console.log(device.uuids)\n var textstr = \"found a device name: \" + device.name + \"<br>\" + \"id: \" + device.id\n ble.statustext = textstr\n \n ble.device=device\n ble.device.addEventListener('gattserverdisconnected',onDisconnectedBLE)\n }\n catch(error){\n if (ble.connected == false){\n var textstr = 'Still waiting for user to select device'\n console.log(textstr)\n ble.statustext = ble.statustext + \"<br>\" + textstr\n \n return error\n }\n }\n }\n return result\n}", "inbound(count, obj) {\n console.log(`vat-http.inbound (from browser) ${count}`, obj);\n const p = Promise.resolve(handler[obj.type](obj));\n p.then(\n res => D(commandDevice).sendResponse(count, false, harden(res)),\n rej => D(commandDevice).sendResponse(count, true, harden(rej)),\n );\n }", "function send_button_state(hex_state) {\n $.ajax({\n url: \"webpower/set/\" + hex_state,\n success: function() {\n console.log(\"sent: \" + hex_state)\n },\n });\n }", "actuateBell(req, res) {\n const keyValuePairs = req.body.split('|') || [''];\n const command = getUltralightCommand(keyValuePairs[0]);\n const deviceId = 'bell' + req.params.id;\n const result = keyValuePairs[0] + '| ' + command;\n\n if (IoTDevices.notFound(deviceId)) {\n return res.status(404).send(result + NOT_OK);\n } else if (IoTDevices.isUnknownCommand('bell', command)) {\n return res.status(422).send(result + NOT_OK);\n }\n\n // Update device state\n IoTDevices.actuateDevice(deviceId, command);\n return res.status(200).send(result + OK);\n }", "send(msg) {\n if (this.connectionId < 0) {\n throw 'Invalid connection';\n }\n chrome.serial.send(this.connectionId, str2ab(msg), function () {\n });\n }", "function sendPost(data, callback) {\nvar options = {\n host: 'ws.audioscrobbler.com',\n path: '/2.0/',\n method: 'POST',\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Content-Length': data.length\n }\n }\n , doPOST = http.request(options, function(request) {\n var reqReturn = ''\n request.setEncoding('utf8')\n request.on('data', function(chunk) {\n reqReturn += chunk\n })\n request.on('end', function() {\n // console.log('[POST RESPONSE] : ' + reqReturn)\n if (typeof(callback) == 'function')\n callback(reqReturn)\n })\n }).on('error', function(err) {\n // TODO\n })\ndoPOST.write(data)\ndoPOST.end()\n}", "function sendPostResponse() {\n\t\t\t\t\t\n\t\t\t\t\tvar delaySend = false;\n\t\t\t\t\t// build appropriate response\n\t\t\t\t\tswitch(command) {\n\t\t\t\t\t\tcase 'end':\n\t\t\t\t\t\tcase 'continue':\n\t\t\t\t\t\t\tutils.info('server : Building \"continue\" response');\n\t\t\t\t\t\tcase 'start':\n\t\t\t\t\t\t\tmessage = {Op:'ok', id:deviceId};\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\n\t\t\t\t\t\tcase 'device_ready':\n\t\t\t\t\t\t\tutils.info('server : Building \"device_ready\" response:');\n\t\t\t\t\t\t\tvar task = device.taskGroup.getNextTest();\n\t\t\t\t\t\t\tif(task) {\n\t\t\t\t\t\t\t\tutils.info('\\tSending next task: ' + task);\n\t\t\t\t\t\t\t\tmessage = {Op:'ok', test:task};\n\t\t\t\t\t\t\t} else { // no more tasks, report\n\n\t\t\t\t\t\t\t\tutils.info('server : Is test done: ' + clientConnection.isTestDone);\n\t\t\t\t\t\t\t\tif(!clientConnection.isTestDone) {\n\t\t\t\t\t\t\t\t\tutils.info('server : setting istestdone to true');\n\t\t\t\t\t\t\t\t\tclientConnection.isTestDone = true;\n\t\t\t\t\t\t\t\t\tclientConnection.reporter.createReport();\n\t\t\t\t\t\t\t\t\tif(File.exists(path.join(END_GAME_LOCATION, 'Code', 'Main.js'))) {\n\t\t\t\t\t\t\t\t\t\tutils.info('\\tSending EndGame');\n\t\t\t\t\t\t\t\t\t\tmessage = {Op:'ok', test:'/' + END_GAME_LOCATION};\n\t\t\t\t\t\t\t\t\t\tbreak;\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\tutils.info('is the next test ready?',\n\t\t\t\t\t\t\t\t clientConnection.isNextTestReady);\n\t\t\t\t\t\t\t\tif(clientConnection.isNextTestReady) {\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tclientConnection.isTestDone = false;\n\t\t\t\t\t\t\t\t\tclientConnection.isNextTestReady = false;\n\t\t\t\t\t\t\t\t\tdevice.taskGroup.restart();\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tutils.info('\\tNo more tasks.');\n\t\t\t\t\t\t\t\t\tmessage = {Op:'nada'};\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'sdk_social_test_start':\n\t\t\t\t\t\t\tutils.info('Adding US Social test set');\n\t\t\t\t\t\t\tdevice.addToTaskGroup(AUTO_SDK_SOCIAL_TEST_LOC);\n\t\t\t\t\t\t\tmessage = {Op:'ok'};\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'social_test_start':\n\t\t\t\t\t\t\tutils.info('setting tests to social_test_start');\n\t\t\t\t\t\t\tdevice.setTaskGroup('Social_Tests', AUTO_SOCIAL_TEST_LOC);\n\t\t\t\t\t\t\tmessage = {Op:'ok'};\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'task_finished':\n\t\t\t\t\t\tcase 'log_start':\n\t\t\t\t\t\t\tmessage = {Op:'ok'};\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'log_end':\n\t\t\t\t\t\t\t// hold off on sending response if previous messages\n\t\t\t\t\t\t\t// have yet to be received\n\t\t\t\t\t\t\tif(clientConnection.isLogFinished()) {\n\t\t\t\t\t\t\t\tmessage = {Op:'ok'};\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// if previous message never gets resent, we need to send\n\t\t\t\t\t\t\t\t// the response after a timeout\n\t\t\t\t\t\t\t\tif(delaySend === false) {\n\t\t\t\t\t\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t\t\t\t\t\tif(clientConnection.isDelayedResponseSet() === true) {\n\t\t\t\t\t\t\t\t\t\t\tutils.info('Did not receive all past messages in 2 minutes --> sending response (' + deviceId + ')');\n\t\t\t\t\t\t\t\t\t\t\tclientConnection.flush();\n\t\t\t\t\t\t\t\t\t\t\tclientConnection.sendDelayedResponse();\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}, 120000);\n\t\t\t\t\t\t\t\t\tdelaySend = true;\n\t\t\t\t\t\t\t\t\tclientConnection.setDelayedResponse(response);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tmessage = '';\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\tif(!delaySend) {\n\t\t\t\t\t\tsendResponse(200, message);\n\t\t\t\t\t}\n\n\t\t\t\t}", "function transmit(fullBuffer) {\n\twsSnd.send(\"<DATALENGTH>\" + fullBuffer.length + \"</DATALENGTH>\");\n\tvar siz = 2048;\n\tvar idx, tmpBuf;\n\tfor (idx = 0; idx <= fullBuffer.length; idx += siz) {\n\t\ttmpBuf = fullBuffer.slice(idx, idx + siz);\n\t\twsSnd.send(tmpBuf);\n\t}\n\tif (idx != fullBuffer.length) {\n\t\ttmpBuf = fullBuffer.slice(idx, fullBuffer.length);\n\t\twsSnd.send(tmpBuf);\n\t}\n\twsSnd.send(\"<END></END>\");\n\tconsole.log(\"TRANSMIT START\");\n}", "function btn_OnTouch() {\n bt.Connect(\"SerialBT\");\n}", "XXX_start_dfu(program_mode , image_size_packet) { //see sendStartPacket\n return new Promise((resolve, reject) => {\n var BAprogram_mode = Buffer.alloc( 1, [ (program_mode & 0x000000ff) ]);\n console.log(\"Sending 'START DFU' command\");\n this._send_control_data(/*DfuOpcodesBle.START_DFU*/ 0x01, BAprogram_mode) // 0x01 0x04\n .then( () => this._send_packet_data(image_size_packet) )\n .then( () => this.waitForControlNotify( /*this.get_received_response, true, 10.0, 'response for START DFU'*/) )\n .then( () => {/*console.log('$%#&%#&%#%#%#');*/ resolve() }) ////WTFWTFWTF\n //TODO .then( () => this._clear_received_response() )\n });\n }", "function systemCommandResponseCallback(error, stdout, stderr)\n {\n var responseString =\n 'stdout: ' + pipeToString(stdout)\n + 'stderr: ' + pipeToString(stderr)\n + 'error: ' + error;\n\n \t// Write the response and close the request\n\t\tserverResponse.writeHead(200, { \"Content-Type\": \"text/plain\" });\n\t\tserverResponse.end(\"RPi RESPONSE:\\n\" + responseString);\n serverResponse.end();\n }", "async postAPI(url, values) {\n\t\tthis.log.debug('Post API called for : ' + url + ' and values : ' + JSON.stringify(values));\n\t\ttry {\n\t\t\tconst result = axios.post(url, values)\n\t\t\t\t.then((response) => {\n\t\t\t\t\treturn response.data;\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.log.error('Sending command to WLED device + ' + url + ' failed with error ' + error);\n\t\t\t\t\treturn error;\n\t\t\t\t});\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tthis.log.error(error);\n\t\t}\n\t}", "function onRequest(request, response){\r\n\tvar command = request.headers[\"command\"]\r\n\tvar deviceIP = request.headers[\"tplink-iot-ip\"]\r\n\tvar cmdRcvd = \"\\n\\r\" + new Date() + \"\\r\\nIP: \" + deviceIP + \" sent command \" + command\r\n\tconsole.log(\" \")\r\n\tconsole.log(cmdRcvd)\r\n\tswitch(command) {\r\n\t\t//---- (BridgeDH - Poll for Server APP ------------------\r\n\t\tcase \"pollServer\":\r\n\t\t\tresponse.setHeader(\"cmd-response\", \"ok\")\r\n\t\t\tresponse.end()\r\n\t\t\tvar respMsg = \"Server Poll response sent to SmartThings\"\r\n\t\t\tconsole.log(respMsg)\r\n\t\tbreak\r\n\r\n\t\t//---- TP-Link Device Command ---------------------------\r\n\t\tcase \"deviceCommand\":\r\n\t\t\t//----- Simulated power data Selection ----------------------\r\n\t\t\tvar command = request.headers[\"tplink-command\"]\r\n\t\t\tvar action = request.headers[\"action\"]\r\n\t\t\tif (action == \"onWatts\") {\r\n\t\t\t\tresponse.setHeader(\"action\", \"energyMeterResponse\")\r\n\t\t\t\tresponse.setHeader(\"cmd-response\", onWatts)\r\n\t\t\t\tresponse.end()\r\n\t\t\t} else if (action == \"offWatts\") {\r\n\t\t\t\tresponse.setHeader(\"action\", \"energyMeterResponse\")\r\n\t\t\t\tresponse.setHeader(\"cmd-response\", offWatts)\r\n\t\t\t\tresponse.end()\r\n\t\t\t} else {\r\n\t\t\t//----- Real data ----------------------\r\n\t\t\t\tprocessDeviceCommand(request, response)\r\n\t\t\t}\r\n\t\t\tbreak\r\n\t\r\n\t\t//---- Energy Meter Simulated Data Return ---------------\r\n\t\tcase \"emeterCmd\":\r\n\t\t\tvar action = request.headers[\"action\"]\r\n\t\t\tvar engrCmd = action.substring(0,3)\r\nconsole.log(\"engrCmd = \" + engrCmd)\r\n\t\t\tvar engrData = action.substring(3)\r\nconsole.log(\"engrData = \" + engrData)\r\n\t\t\tif (engrCmd == \"Con\") {\r\n\t\t\t\tresponse.setHeader(\"action\", \"useTodayResponse\")\r\n\t\t\t} else {\r\n\t\t\t\tresponse.setHeader(\"action\", \"engrStatsResponse\")\r\n\t\t\t}\r\n\t\t\tvar respData = \"\"\r\n\t\t\tswitch(engrData) {\r\n\t\t\t\tcase \"DecWatts\":\r\n\t\t\t\t\trespData = DecWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"DecMWatts\":\r\n\t\t\t\t\trespData = DecMWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"JanWatts\":\r\n\t\t\t\t\trespData = JanWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"JanMWatts\":\r\n\t\t\t\t\trespData = JanMWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"FebWatts\":\r\n\t\t\t\t\trespData = FebWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"FebMWatts\":\r\n\t\t\t\t\trespData = FebMWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"MarWatts\":\r\n\t\t\t\t\trespData = MarWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"MarMWatts\":\r\n\t\t\t\t\trespData = MarMWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"Day1Watts\":\r\n\t\t\t\t\trespData = Day1Watts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"Day1MWatts\":\r\n\t\t\t\t\trespData = Day1MWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"Day2Watts\":\r\n\t\t\t\t\trespData = Day2Watts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"Day2MWatts\":\r\n\t\t\t\t\trespData = Day2MWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"Day3Watts\":\r\n\t\t\t\t\trespData = Day3Watts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tcase \"Day3MWatts\":\r\n\t\t\t\t\trespData = Day3MWatts\r\n\t\t\t\t\tbreak\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tbreak\r\n\t\t\t}\r\nconsole.log(respData)\r\n\t\t\tresponse.setHeader(\"cmd-response\", respData)\r\n\t\t\tresponse.end()\r\n\t\t\tbreak\r\n\t\tdefault:\r\n\t\t\tresponse.setHeader(\"cmd-response\", \"InvalidHubCmd\")\r\n\t\t\tresponse.end()\r\n\t\t\tvar respMsg = \"#### Invalid Command ####\"\r\n\t\t\tvar respMsg = new Date() + \"\\n\\r#### Invalid Command from IP\" + deviceIP + \" ####\\n\\r\"\r\n\t\t\tconsole.log(respMsg)\r\n\t\t\tlogResponse(respMsg)\r\n\t}\r\n}", "start() {\n let constraints = {\n video: {\n facingMode: 'user',\n height: { min: 360, ideal: 720, max: 1080 },\n deviceId: localStorage.getItem('deviceId')\n },\n audio: true\n };\n\n // navigator.mediaDevices.enumerateDevices()\n // .then(dd=> { \n // dd.map(device => {\n // if (device.kind == 'videoinput' && device.label == DEVICE) {\n // constraints.video.deviceId = device.deviceId;\n // }\n // })\n // }) \n\n // navigator.usb.requestDevice({filters:[]})\n // .then(selectedDevice => {\n // device = selectedDevice;\n // console.log('selectedDevice', device, selectedDevice);\n // return device.open(); // Begin a session.\n // })\n // .then(() => {\n // console.log('daada', device.selectConfiguration);\n // device.selectConfiguration(1)}) // Select configuration #1 for the device.\n // .then(() => {\n // console.log('daada', device.claimInterface);\n // device.claimInterface(0)}) // Request exclusive control over interface #2.\n // .then(() => {\n // console.log('daada', device.controlTransferOut);\n // device.controlTransferOut({\n // requestType: 'class',\n // recipient: 'interface',\n // request: 0x22,\n // value: 0x01,\n // index: 0x02})}) // Ready to receive data\n // .then(() => {\n // console.log('dedde', device);\n // device.transferIn(5, 64)\n // }) // Waiting for 64 bytes of data from endpoint #5.\n // .then(result => {\n // let decoder = new TextDecoder();\n // console.log('decoder', decoder, result);\n // console.log('Received: ' + decoder.decode(result.data));\n // })\n // .catch(error => { console.log('this.error', error); });\n console.log('constraints', constraints)\n\n setTimeout(() => {\n // constraints.video.deviceId = localStorage.getItem('deviceId');\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then((stream) => {\n this.stream = stream;\n this.emit('stream', stream);\n })\n .catch((err) => {\n if (err instanceof DOMException) {\n alert('Cannot open webcam and/or microphone');\n } else {\n console.log(err);\n }\n });\n }, 3000)\n\n return this;\n }", "function connectviaBT() {\r\n\t// initialize bluetooth and setup an event listener\r\n\t//todo: refactor name mWebSocket_InitAsync\r\n\tdocument.getElementById( \"idStatus\").innerHTML=\"Connecting via BT\";\r\n\t//returns data from BT as Uint8Array [1..20]\r\n\t//Todo: write what this does in a comment is this the Ternary Operator? (variable = (condition) ? expressionTrue : expressionFalse)\r\n\treturn (bluetoothDeviceDetected ? Promise.resolve() : getDeviceInfo() && isWebBluetoothEnabled())\r\n\t.then(connectGATT) //todo:@FC please explain what is happening here\r\n\t.then(_ => {\r\n\t\tconsole.log('Evaluating signal of interest...')\r\n\t\treturn gattCharacteristic.readValue()\t//receiving data from BT - Uint8Array [1..20]\r\n\t})\r\n\t.catch(error => {\r\n\t\tconsole.log('Waiting to start reading: ' + error)\r\n\t})\r\n}", "function performAdvancedPowerActionResponse(stack, name, responses, status) {\n const dev = stack.dev;\n const action = dev.powerAction;\n delete dev.powerAction;\n if (obj.amtDevices[dev.nodeid] == null) return; // Device no longer exists, ignore this response.\n if (status != 200) return;\n if ((responses['AMT_BootSettingData'] == null) || (responses['AMT_BootSettingData'].response == null)) return;\n var bootSettingData = responses['AMT_BootSettingData'].response;\n\n // Clean up parameters\n bootSettingData['ConfigurationDataReset'] = false;\n delete bootSettingData['WinREBootEnabled'];\n delete bootSettingData['UEFILocalPBABootEnabled'];\n delete bootSettingData['UEFIHTTPSBootEnabled'];\n delete bootSettingData['SecureBootControlEnabled'];\n delete bootSettingData['BootguardStatus'];\n delete bootSettingData['OptionsCleared'];\n delete bootSettingData['BIOSLastStatus'];\n delete bootSettingData['UefiBootParametersArray'];\n delete bootSettingData['RPEEnabled'];\n delete bootSettingData['RSEPassword']\n\n // Ready boot parameters\n bootSettingData['BIOSSetup'] = ((action >= 11) && (action <= 14));\n bootSettingData['UseSOL'] = ((action >= 13) && (action <= 14));\n if ((action == 11) || (action == 13)) { dev.powerAction = 2; } // Power on\n if ((action == 12) || (action == 14)) { dev.powerAction = 10; } // Reset\n\n // Set boot parameters\n dev.amtstack.Put('AMT_BootSettingData', bootSettingData, function (stack, name, response, status, tag) {\n const dev = stack.dev;\n if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error\n // Set boot config\n dev.amtstack.SetBootConfigRole(1, function (stack, name, response, status, tag) {\n const dev = stack.dev;\n if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error\n // Set boot order\n dev.amtstack.CIM_BootConfigSetting_ChangeBootOrder(null, function (stack, name, response, status) {\n const dev = stack.dev;\n if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error\n // Perform power action\n try { dev.amtstack.RequestPowerStateChange(dev.powerAction, performPowerActionResponse); } catch (ex) { }\n }, 0, 1);\n }, 0, 1);\n }, 0, 1);\n }", "function SendPortSync() {\n}", "function webRtcSendOffer(clientName, offerValue) {\r\n\tif (typeof thisPeersName != \"string\") {\r\n\t\tconsole.log(\"Please set peer name before calling this function\");\r\n\t\treturn;\r\n\t}\r\n\t\r\n var xhttp = new XMLHttpRequest();\r\n\txhttp.onreadystatechange = function() {\r\n\t\tif (xhttp.readyState == 4 && xhttp.status == 200) {\r\n \r\n //see if there is a client asking to connect\r\n if (typeof xhttp.responseText == \"string\" && xhttp.responseText.length > 0) {\r\n ;\r\n }\r\n \r\n\t\t}\r\n\t};\r\n var full = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: ''); \r\n \r\n\t//xhttp.open(\"GET\", \"http://\" + window.location.host + \"/ioInterface?command=getOtsValues\", true);\r\n var message = {messageType: 'offer', offer: offerValue};\r\n var url = full + \"/webrtc?command=writeMessage&clientName=\" + thisPeersName + \"&destinationName=\" + clientName + \"&message=\" + btoa(JSON.stringify(message));\r\n \r\n //console.log(url.length, url);\r\n xhttp.open(\"GET\", url, true);\r\n\txhttp.send();\t \r\n}", "sendMakeBetShan2(_chipbet) {\n cc.NGWlog(\"Vua dat cuoc =\" + _chipbet);\n var data = {\n evt: \"bm\",\n M: _chipbet\n };\n this.sendDataGame(JSON.stringify(data));\n }", "function IoTHubGetDeviceInfo(deviceId, iothubname) {\n console.log(\"Getting Device Info : \" + deviceId);\n $('#IoTHub_Busy_Indicator').css('display', 'flex');\n $.ajax({\n type: \"GET\",\n url: '/home/IoTHubGetDeviceInfo',\n data: { deviceId: deviceId },\n success: function (response) {\n $('#deviceConnectionState').html(response.connectionState);\n\n if (response.connectionState == \"Disconnected\") {\n $('#deviceConnectionState').css(\"color\", 'red');\n }\n else {\n $('#deviceConnectionState').css(\"color\", 'blue');\n }\n $('#deviceModelId').html(response.deviceModelId);\n $('#deviceConnectionString').html(\"HostName=\" + iothubname + \";DeviceId=\" + response.deviceId + \";SharedAccessKey=\" + response.symmetricKey);\n $('#deviceKey').html(response.symmetricKey);\n\n DisableButton($('#btnDeviceTwin'), false);\n\n if (response.deviceModelId != null && response.deviceModelId.length > 0) {\n DisableButton($('#btnDeviceModelIdCopy'), false);\n }\n else\n {\n DisableButton($('#btnDeviceModelIdCopy'), true);\n }\n\n if (response.symmetricKey.length > 0) {\n DisableButton($('#btnDeviceConnectionStringCopy'), false);\n DisableButton($('#btnDeviceKeyCopy'), false);\n }\n else {\n DisableButton($('#btnDeviceConnectionStringCopy'), true);\n DisableButton($('#btnDeviceKeyCopy'), true);\n }\n\n //$('#btnDeviceModelIdCopy').prop('disabled', true);\n return true;\n },\n error: function (jqXHR) {\n // clear all fields\n IoTHubModalClear();\n alert(\" Status: \" + jqXHR.status + \" \" + jqXHR.responseText);\n return false;\n }\n });\n $('#IoTHub_Busy_Indicator').hide();\n\n}", "function callAPI(req,res,handleResponse){\n var host = 'www.blueworkslive.com';\n var username = 'xxxx';\n var password = 'yyyy';\n var path = '/api/Auth';\n var headers = {\n 'Authorization': 'Basic ' + new Buffer(username+':'+password).toString('base64'),\n };\n var options = {\n host: host,\n path: path,\n method: 'GET',\n headers: headers\n };\n var bwlResData = {};\n console.log('BwlApiCall: Request '+options.method+' https://'+options.host+options.path);\n var bwlRequest = https.request(options, function(bwlResponse) {\n\tconsole.log(\"BwlApiCall: Response status=\"+bwlResponse.statusCode);\n\tbwlResData.status = bwlResponse.statusCode; // statusCode >= 200 and < 300 is OK\n\tbwlResData.headers = bwlResponse.headers;\n\tvar bufferData = [];\n\tbwlResponse.on('data', function(data) {\n\t bufferData.push(data);\n console.info('BwlApiCall: Response data received');\n\t});\n\tbwlResponse.on('end', function() {\n console.info('BwlApiCall: completed, calling callback');\n\t bwlResData.data = Buffer.concat(bufferData);\n\t handleResponse(req, res, bwlResData);\n });\n });\n/* if ((reqData.method == \"post\" || reqData.method == \"put\") && reqData.senddata) {\n console.log(reqData.method+' sending data: '+reqData.senddata);\n bwlRequest.write(reqData.senddata);\n } */\n bwlRequest.end();\n bwlRequest.on('error', function(e){\n console.error('BwlApiCall: REQUEST-ERROR '+e);\n });\n}", "function sendConvertRAIDType(cardchar) {\n\t//collect data from web UI\n\tvar NewRAIDType = document.getElementById(\"RAIDType\"+cardchar).selectedIndex - 1;\n\tvar GUID = $(\"#GUID\"+cardchar).html();\n\n\t//store the command which is in progress\n\t$(\"#cardProgCmd\"+cardchar).html(JS_CONVERT_RAID_TYPE_REQ);\n\n\t//console.log(\"Convert GUID = \"+GUID);\n\n\t//disable \"Convert\" button\n\t$(\"#confirmConvertRAIDType\"+cardchar).prop(\"disabled\", true);\n\n\t//send command\n\tConvertRAIDType(GUID, NewRAIDType);\n}", "async function blxSendBinblock (data, fname, syncflag, mem_addr) {\n let txlen_total = data.length\n let tx_pos = 0\n const time0 = Date.now() - 1000\n let tw_old = time0\n let tw_new // Working Time fuer Fortschritt\n let sblk_len = (max_ble_blocklen - 2) & 0xFFFC // Initial MAX Size Block, but Multi of 4\n\n if (data.length > 1000) { // Mehr als 1k Daten UND File: -> FAST\n\n if(fname === undefined){\n // Might bee too fast for Download to CPU Memory, set to slow with .cf 15 or greater!!!\n if(con_memfast_speed < 15)\n terminalPrint(\"*** WARNING: Memory Connection Speed: \" + con_memfast_speed ) \n const os = con_fast_speed // temporaer mit MEMORY Speed\n con_fast_speed = con_memfast_speed\n await blxConnectionFast()\n con_fast_speed = os\n }else{\n await blxConnectionFast()\n } \n if (blxErrMsg) return\n // console.log(\"Fast OK\");\n }\n if(fname!== undefined) await blxDeviceCmd('P' + (syncflag ? '!' : '') + ':' + fname, 5000) // P wie PUT\n else {\n {\n let wadr = mem_addr\n let wsize = txlen_total\n const sector_size = 4096 // Fix fuer nrF52\n // Sektoren in einzeln Loeschen, da langsam\n while(wsize>0){\n await blxDeviceCmd('K:' + wadr + ' ' + 1 , 5000) \n if (blxErrMsg) return\n wadr+=sector_size\n wsize-=sector_size\n }\n }\n await blxDeviceCmd('I:' + mem_addr, 5000) // I wie Internal\n }\n if (blxErrMsg) return\n\n try {\n for (;;) {\n let blen = txlen_total // Blocklen\n if (blen > sblk_len ) blen = sblk_len\n const bdata = new Uint8Array(blen + 2)\n bdata[0] = blen\n bdata[1] = BB_BLE_BINBLK_IN // Binary Data\n // Aufgabe: data[tx_pos] an bdata[2] kopieren\n const datablock = data.subarray(tx_pos, tx_pos + blen)\n bdata.set(datablock, 2) // Copies datablock into bdata\n\n await NUS_data_chara_write.writeValue(bdata.buffer)\n\n // console.log(bdata);\n txlen_total -= blen\n tx_pos += blen\n if (!txlen_total) {\n const dtime = Date.now() - time0\n terminalPrint('Transfer OK (' + dtime / 1000 + ' sec, ' + ((data.length / dtime * 1000).toFixed(0)) + ' Bytes/sec)')\n break\n }\n tw_new = Date.now()\n if (tw_new - tw_old > 1000) { // Alle Sekunde Fortschritt\n tw_old = tw_new\n terminalPrint(((tx_pos * 100) / data.length).toFixed(0) + '% / ' + tx_pos + ' Bytes')\n }\n }\n } catch (error) {\n if (full_connected_flag === false) blxErrMsg = 'ERROR: Connection lost'\n else blxErrMsg = 'ERROR: Transfer ' + error\n return\n }\n\n await blxDeviceCmd('L', 5000) // Close\n\n if (blxErrMsg) return\n if (data.length > 1000) { // Mehr als 1k Daten: -> Wieder SLOW\n await blxConnectionSlow()\n }\n }", "function processData(buffer) {\n console.log(\"Status: \"+status);\n console.log('Read message: \"' + buffer + '\"');\n if (buffer.toString() == 'Ok!' && status == 0 && type !=1) {\n //Emepzamos el envio\n rqMsg = '';\n\n while ((pxInd < w * h) && (rqMsg.length < 256 - 12)) { //Bytes disponibles\n rqMsg += data[hexInd];\n pxInd += 4;\n hexInd++;\n }\n\n if (pxInd >= w * h) status++; \n\n const arr = new Uint16Array(2);\n\n buffIndCalc = (rqMsg.length + 12) / 2;\n const buffInd = Buffer.alloc(2);\n buffInd.writeUInt16LE(buffIndCalc);\n\n dSizeCalc += buffIndCalc;\n\n const dSize = Buffer.alloc(3);\n dSize.writeUInt16LE(dSizeCalc, 0, 3)\n\n\n var bufferToSend = Buffer.concat([Buffer.from('L', 'ascii'), buffInd, dSize, Buffer.from(rqMsg, 'hex')]);\n console.log(\"Buffer to send1: \" + bufferToSend.toString('hex'));\n\n\n epdCharacteristic.write(bufferToSend, function(err, bytesWritten) {\n if (err) console.log(err);\n console.log(\"wrote: L\");\n });\n } else if (buffer.toString() == 'Ok!' && status == 0 && type == 1) {\n //Emepzamos el envio pantalla a color\n rqMsg = '';\n\n while ((pxInd < w * h) && (rqMsg.length < 256 - 12)) { //Bytes disponibles\n rqMsg += data[hexInd];\n pxInd += 2; //cada pixel son 2 bits, por eso para cada hex tenemos avanzar 2 pixeles.\n hexInd++;\n }\n if (pxInd >= w * h) status++;\n\n const arr = new Uint16Array(2);\n\n buffIndCalc = (rqMsg.length + 12) / 2;\n const buffInd = Buffer.alloc(2);\n buffInd.writeUInt16LE(buffIndCalc);\n\n dSizeCalc += buffIndCalc;\n\n const dSize = Buffer.alloc(3);\n dSize.writeUInt16LE(dSizeCalc, 0, 3);\n\n\n var bufferToSend = Buffer.concat([Buffer.from('L', 'ascii'), buffInd, dSize, Buffer.from(rqMsg, 'hex')]);\n console.log(\"Buffer to send info: dSizeCalc\"+dSizeCalc+\" buffIndCalc: \"+buffIndCalc+\" pxInd: \"+pxInd);\n console.log(\"Buffer to send2: \" + bufferToSend.toString('hex'));\n\n\n epdCharacteristic.write(bufferToSend, function(err, bytesWritten) {\n if (err) console.log(err);\n console.log(\"wrote: L\");\n });\n } else if (buffer.toString() == 'Ok!' && status == 1 && type != 1) {\n //Hacemos el Show\n epdCharacteristic.write(Buffer.from('S', 'ascii'), function(err, bytesWritten) {\n if (err) console.log(err);\n console.log(\"wrote: S\");\n });\n status = 4;\n console.log(\"Desconectamos....\");\n clearTimeout(timeout);\n screenDisconect(false);\n return response.send({\n message: 'Success at updating the device: ' + macaddress,\n });\n } else if (buffer.toString() == 'Ok!' && status == 1 && type == 1) {\n //Hacemos el Next\n\n pxInd =0;\n hexInd = 0;\n\n epdCharacteristic.write(Buffer.from('N', 'ascii'), function(err, bytesWritten) {\n if (err) console.log(err);\n console.log(\"wrote: N\"); \n });\n status = 2;\n } else if (buffer.toString() == 'Ok!' && status == 2 && type == 1) {\n //Hacemos el Load del Next\n //let dataNext = req.body.dataNext;\n //Emepzamos el envio\n rqMsg = '';\n\n while ((pxInd < w * h) && (rqMsg.length < 256 - 12)) { //Bytes disponibles\n rqMsg += dataNext[hexInd];\n pxInd += 4; //en caso de rojo, cada pixel es un bit.\n hexInd++;\n }\n if (pxInd >= w * h) status = 3;\n\n const arr = new Uint16Array(2);\n\n buffIndCalc = (rqMsg.length + 12) / 2;\n const buffInd = Buffer.alloc(2);\n buffInd.writeUInt16LE(buffIndCalc);\n\n dSizeCalc += buffIndCalc;\n\n const dSize = Buffer.alloc(3);\n dSize.writeUInt16LE(dSizeCalc, 0, 3)\n\n\n var bufferToSend = Buffer.concat([Buffer.from('L', 'ascii'), buffInd, dSize, Buffer.from(rqMsg, 'hex')]);\n console.log(\"N_Buffer to send3: \" + bufferToSend.toString('hex'));\n\n\n epdCharacteristic.write(bufferToSend, function(err, bytesWritten) {\n if (err) console.log(err);\n console.log(\"wrote: L\");\n });\n } else if (buffer.toString() == 'Ok!' && status == 3 && type == 1) {\n console.log(\"Finalizamos...\");\n //Hacemos el Show\n epdCharacteristic.write(Buffer.from('S', 'ascii'), function(err, bytesWritten) {\n if (err) console.log(err);\n console.log(\"wrote: S\");\n });\n status = 4;\n console.log(\"Desconectamos....\");\n clearTimeout(timeout);\n screenDisconect(false);\n return response.send({\n message: 'Success at updating the device: ' + macaddress,\n });\n }\n trytoread();\n }", "function setDeviceEnabledBand() {\n\tconsole.log('info: setDeviceEnabledBand() is called.');\n\n\t// Get csrf_token\n\tvar api = '/';\n\tvar url = 'http://' + document.apiform.address.value + api;\n\tupdateMessage(url, '', 'Connecting...', '');\n\n\tvar xhr = new XMLHttpRequest();\n\txhr.open('GET', url, false);\n\txhr.withCredentials = true;\n\txhr.onerror = function(e) {\n\t\tupdateMessage(url, xhr.statusText, 'Error: Cannot access.', '');\n\t};\n\txhr.send(null);\n\n\tif (xhr.status === 200) {\n\t\tvar str = xhr.responseText;\n\t\tvar csrf_token = str.match(/<meta name=\"csrf_token\" content=\"([A-Za-z0-9]+)\">/i);\n\t\tcsrf_token = csrf_token[1];\n\t\tif (csrf_token != null) {\n\t\t\tupdateMessage(url, xhr.statusText, 'Success to get a token: ' + csrf_token, '');\n\t\t} else {\n\t\t\tupdateMessage(url, xhr.statusText, 'Error: Fail to get the token.', '');\n\t\t\treturn -1;\n\t\t}\n\n\t\t// Login\n\t\tapi = '/api/user/login';\n\t\turl = 'http://' + document.apiform.address.value + api;\n\t\tupdateMessage(url, '', 'Connecting...', '');\n\n\t\txhr.open('POST', url, false);\n\t\txhr.onerror = function(e) {\n\t\t\tupdateMessage(url, xhr.statusText, 'Error: Cannot access.', '');\n\t\t};\n\n\t\t// Generate credential\n\t\tvar username = 'admin';\n\t\tvar password = document.apiform.password.value;\n\t\tvar password_hash = encryptSHA256(username + encryptSHA256(password) + csrf_token);\n\n\t\tvar login_params = '';\n\t\tlogin_params += '<!--?xml version=\"1.0\" encoding=\"UTF-8\"?-->\\r';\n\t\tlogin_params += '<request>\\r';\n\t\tlogin_params += '<Username>' + username + '</Username>\\r';\n\t\tlogin_params += '<Password>' + password_hash + '</Password>\\r';\n\t\tlogin_params += '<password_type>4</password_type>\\r';\n\t\tlogin_params += '</request>\\r';\n\t\tconsole.log(login_params);\n\n\t\txhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\t\txhr.setRequestHeader('__RequestVerificationToken', csrf_token);\n\t\txhr.send(login_params);\n\n\t\t// Login Result\n\t\tif (xhr.status === 200) {\n\t\t\t\n\t\t\tvar error_code = xhr.responseText.match(/<code>([0-9]+)<\\/code>/i);\n\t\t\tif (error_code == null) {\n\t\t\t\tupdateMessage(url, xhr.statusText, 'Login Successful!', xhr.responseText);\n\n\t\t\t\t// Set LTE Bands\n\t\t\t\tapi = '/api/net/net-mode';\n\t\t\t\turl = 'http://' + document.apiform.address.value + api;\n\t\t\t\tupdateMessage(url, '', 'Connecting...', '')\n\t\t\t\ttoken = xhr.getResponseHeader('__RequestVerificationTokenOne');\n\t\t\t\txhr.open('POST', url, true);\n\t\t\t\txhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');\n\t\t\t\txhr.setRequestHeader('__RequestVerificationToken', token);\n\t\t\t\txhr.onload = function(e) {\n\t\t\t\t\terror_code = xhr.responseText.match(/<code>([0-9]+)<\\/code>/i);\n\t\t\t\t\tconsole.log(error_code);\n\t\t\t\t\tif (error_code == null) {\n\t\t\t\t\t\tupdateMessage(url, xhr.statusText, 'Change Successful!', xhr.responseText);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tupdateMessage(url, xhr.statusText, 'Error: ' + ERRORS[error_code[1]], xhr.responseText);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\txhr.onerror = function(e) {\n\t\t\t\t\tupdateMessage(url, xhr.statusText, 'Error: Check Parameters.', '')\n\t\t\t\t};\n\t\t\t\txhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=\"UTF-8\"');\n\t\t\t\tconsole.log(document.apiform.reqparams.value);\n\t\t\t\txhr.send(document.apiform.reqparams.value);\n\n\t\t\t} else {\n\t\t\t\tupdateMessage(url, xhr.statusText, 'Error: ' + ERRORS[error_code[1]], xhr.responseText);\n\t\t\t}\n\t\t\t\n\t\t} else {\n\t\t\tupdateMessage(url, xhr.statusText, 'Error: Cannot access.', xhr.responseText);\n\t\t}\n\n\t} else {\n\t\tupdateMessage(url, xhr.statusText, 'Error: Check the address or your browser status (Cross-Origin Resource Sharing).', '')\n\t}\n}", "async send() {\n const onComplete = this.props.navigation.state.params.onComplete;\n try {\n let done = await this.props.wire.send();\n\n if (!done) {\n return;\n }\n\n if (onComplete) onComplete();\n this.props.navigation.goBack();\n } catch (e) {\n if (!e || e.message !== 'E_CANCELLED') {\n console.error('Wire/send()', e);\n\n Alert.alert(\n 'There was a problem sending wire',\n (e && e.message) || 'Unknown internal error',\n [{ text: 'OK' }],\n { cancelable: false }\n );\n }\n }\n }", "function onOpen() {\n console.log('Port Open');\n console.log(`Baud Rate: ${port.options.baudRate}`);\n const outString = String.fromCharCode(output);\n console.log(`Sent:\\t\\t${outString}`);\n port.write(outString);\n}" ]
[ "0.6560741", "0.6358267", "0.63325894", "0.61360186", "0.6115113", "0.60801035", "0.6074475", "0.60720617", "0.6020907", "0.58643204", "0.5797482", "0.57846606", "0.57151884", "0.57029116", "0.56599176", "0.5598955", "0.55791366", "0.55470836", "0.55214137", "0.54890126", "0.54794246", "0.5467407", "0.5458962", "0.54161745", "0.5398611", "0.5372667", "0.53533864", "0.5348324", "0.532022", "0.5315319", "0.5274399", "0.52686507", "0.52545553", "0.52516514", "0.5248442", "0.5238125", "0.52163774", "0.521211", "0.5209181", "0.51974756", "0.5196469", "0.51837546", "0.5177954", "0.516178", "0.51512545", "0.5147174", "0.5141254", "0.5138159", "0.5130048", "0.5121737", "0.51207095", "0.51155424", "0.5093415", "0.50916004", "0.5079893", "0.507947", "0.5044861", "0.50287235", "0.50232357", "0.5014572", "0.5011383", "0.50094104", "0.50059235", "0.49870503", "0.49651325", "0.49646312", "0.4957968", "0.49397355", "0.49355248", "0.4933031", "0.49305695", "0.49214342", "0.49206194", "0.49155226", "0.4906333", "0.49052852", "0.49001572", "0.4897377", "0.48950967", "0.48870608", "0.48804173", "0.4879315", "0.4852489", "0.48491997", "0.4846404", "0.48336947", "0.48326552", "0.48210114", "0.48195332", "0.48153195", "0.4812433", "0.48043644", "0.4793943", "0.47933307", "0.4783341", "0.47805634", "0.47763786", "0.47715887", "0.47614968", "0.47608984", "0.47510663" ]
0.0
-1
Call WebUSB API to get challenge.bin from device
function getChallenge () { //Fake data var randomData = []; var bytes = new Uint8Array(4); for (var i=4; i--; ) { let longRandomNumber = Math.floor(Math.random() * 1000000000); bytes[i] = longRandomNumber & (255); longRandomNumber = longRandomNumber >> 8 } randomData.push(bytes); console.log(randomData); var blob = new Blob(randomData); blob["lastModifiedDate"] = ""; blob["name"] = "challenge.bin"; var fakeF = blob; console.log(fakeF); return fakeF; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function RequestUSBDevice() { \n await navigator.usb.requestDevice({ filters: [{}] });\n}", "async getRequestDeviceInfo() {\n const outputReportID = 0x01;\n const subcommand = [0x02];\n const data = [\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n ...subcommand,\n ];\n await this.device.sendReport(outputReportID, new Uint8Array(data));\n\n return new Promise((resolve) => {\n const onDeviceInfo = ({ detail: deviceInfo }) => {\n this.removeEventListener('deviceinfo', onDeviceInfo);\n delete deviceInfo._raw;\n delete deviceInfo._hex;\n resolve(deviceInfo);\n };\n this.addEventListener('deviceinfo', onDeviceInfo);\n });\n }", "function readRHUSB() {\n port.write(\"PA\\r\\n\");\n}", "function bluetooth(){\n\n if (!navigator.bluetooth) {\n return alert('Web Bluetooth API is not available in this browser. Please use chrome.');\n }\n const z = document.getElementById('debugger');\n const y = document.getElementById('serial')\n\n if (z.style.display ===\"none\"){\n z.style.display = \"block\";\n }else{\n }\n \n z.innerHTML= z.innerHTML + \"\\n\"+ ('Requesting Bluetooth Devices');\n navigator.bluetooth.requestDevice({\n filters:[{\n name: 'MicroTrynkit',\n }],\n optionalServices: [service]\n })\n .then(device=>{\n z.innerHTML = z.innerHTML + \"\\n\"+ (\"Connected to: \");\n z.innerHTML= z.innerHTML +\"\\n\"+ (\">Name:\" + device.name);\n z.innerHTML= z.innerHTML + \"\\n\"+ (\">id:\" + device.id);\n isConnected = 1;\n bledevice = device;\n return device.gatt.connect();\n })\n .then(server=>{\n bleserver = server;\n return server.getPrimaryService(service);\n })\n .then(service => {\n return service.getCharacteristic(RX_char)\n .then(characteristic => {\n console.log(characteristic);\n RX_characteristic = characteristic;\n return service.getCharacteristic(TX_char);\n })\n })\n .then(characteristic => {\n console.log(characteristic);\n TX_characteristic = characteristic;\n /* add an event listener to the TX characteristic */\n TX_characteristic.addEventListener('valueUpdate', handleValueUpdated);\n console.log(TX_characteristic.readValue());\n })\n .then( value =>{\n /* try to read from the device and print to console */\n // y.innerText = value.getUint8(0);\n // console.log(value.getUint8(0));\n })\n .catch(error=> {\n z.innerHTML= z.innerHTML + \"\\n\"+ (error);\n });\n}", "requestUsb() {\n return new Observable(observer => {\n navigator.usb.requestDevice({ filters: [] })\n .then((result) => {\n this.vendorId = result.vendorId;\n this.productId = result.productId;\n return observer.next(result);\n }).catch(error => {\n return observer.error(error);\n });\n });\n }", "async function uBitOpenDevice(device, callback) {\n const transport = new DAPjs.WebUSB(device)\n const target = new DAPjs.DAPLink(transport)\n let buffer=\"\" // Buffer of accumulated messages\n const parser = /([^.:]*)\\.*([^:]+|):(.*)/ // Parser to identify time-series format (graph:info or graph.series:info)\n \n target.on(DAPjs.DAPLink.EVENT_SERIAL_DATA, data => {\n buffer += data;\n let firstNewline = buffer.indexOf(\"\\n\")\n while(firstNewline>=0) {\n let messageToNewline = buffer.slice(0,firstNewline)\n let now = new Date() \n // Deal with line\n // If it's a graph/series format, break it into parts\n let parseResult = parser.exec(messageToNewline)\n if(parseResult) {\n let graph = parseResult[1]\n let series = parseResult[2]\n let data = parseResult[3]\n let callbackType = \"graph-event\"\n // If data is numeric, it's a data message and should be sent as numbers\n if(!isNaN(data)) {\n callbackType = \"graph-data\"\n data = parseFloat(data)\n }\n // Build and send the bundle\n let dataBundle = {\n time: now,\n graph: graph, \n series: series, \n data: data\n }\n callback(callbackType, device, dataBundle)\n } else {\n // Not a graph format. Send it as a console bundle\n let dataBundle = {time: now, data: messageToNewline}\n callback(\"console\", device, dataBundle)\n }\n buffer = buffer.slice(firstNewline+1) // Advance to after newline\n firstNewline = buffer.indexOf(\"\\n\") // See if there's more data\n }\n });\n await target.connect();\n await target.setSerialBaudrate(115200)\n //await target.disconnect();\n device.target = target; // Store the target in the device object (needed for write)\n device.callback = callback // Store the callback for the device\n callback(\"connected\", device, null) \n target.startSerialRead()\n return Promise.resolve()\n}", "async request() {\n let options = {\n filters: [\n {\n name: \"balenaBLE\"\n }\n ],\n optionalServices: [0xfff0, 0xfff1]\n };\n if (navigator.bluetooth == undefined) {\n alert(\"Sorry, Your device does not support Web BLE!\");\n return;\n }\n this.device = await navigator.bluetooth.requestDevice(options);\n if (!this.device) {\n throw \"No device selected\";\n }\n this.device.addEventListener(\"gattserverdisconnected\", this.onDisconnected);\n }", "async function SendBlyncUSB30ControlCommand(deviceInfo, byRedValue, byGreenValue, byBlueValue, byLightControl, byMusicControl_1, byMusicControl_2) {\n\n try {\n var device = deviceInfo.device;\n\n await device.open();\n //await device.reset();\n\n if (device.configuration === null) {\n await device.selectConfiguration(1);\n }\n\n\t\tawait device.claimInterface(0);\n\t\t\n abyBlyncUsb30ReportBuffer[0] = byRedValue;\n abyBlyncUsb30ReportBuffer[1] = byBlueValue;\n abyBlyncUsb30ReportBuffer[2] = byGreenValue;\n abyBlyncUsb30ReportBuffer[3] = byLightControl;\n abyBlyncUsb30ReportBuffer[4] = byMusicControl_1;\n abyBlyncUsb30ReportBuffer[5] = byMusicControl_2;\n abyBlyncUsb30ReportBuffer[6] = 0xFF;\n abyBlyncUsb30ReportBuffer[7] = 0x22;\n\n var result = await device.controlTransferOut( \n {\n requestType: 'class',\n recipient: 'interface',\n request: 0x09,\n value: 0x0200,\n index: 0x0000\n },\n abyBlyncUsb30ReportBuffer);\n\n await device.close();\n } catch (e) {\n console.log(\"Exception: \" + e);\n }\n}", "respondToArduino(command){\n BluetoothSerial.write(command)\n .then((res) => {\n console.log(res, command)\n })\n .catch((err) => console.log(err.message))\n }", "function bleConsole(value){\n const y = document.getElementById('serial')\n /* check if the device is connected if true send file*/\n if(isConnected){\n /* need to read the value of the TX_char\n * may need some kind of loop or trigger to watch if new data comes in????\n * not sure what I want to implement for this yet....\n */\n // y.innerText = TX_characteristic.readValue(); TODO does not work\n }else{\n const x = document.getElementById('console');\n x.style.display =\"none\";\n alert(\"MicroTrynkit device not connected. Please pair it first.\");\n }\n\n}", "enumerate_devices() {\n const filters = {filters: [\n {vendorId: 0x16D0}\n ]};\n\n if (!this.usb) {\n this.log(\"error: WebUSB not supported\\n\", \"red\");\n return;\n }\n\n this.usb.requestDevice(filters)\n .then(dev => this.connect_device(dev))\n .catch(error => {\n if (String(error) === \"SecurityError: Must be handling a user gesture to show a permission request.\") {\n this.log(\"Please click 'Connect Device' on the left toolbar.\", \"black\");\n } else if (String(error) === \"NotFoundError: No device selected.\") {\n this.log(\"Please select a WebUSB device.\", \"red\");\n } else {\n this.log(String(error));\n this.log(\"error: unable to enumerate USB device list\");\n }\n });\n }", "async function findUSBDevice(event) {\n // STEP 1A: Auto-Select first port\n if (event.type == 'AutoConnect' || event.type == 'Reconnect') {\n // ports = await getPorts()\n //STEP 1A: GetPorts - Automatic at initialization\n // -Enumerate all attached devices\n // -Check for permission based on vendorID & productID\n devices = await navigator.usb.getDevices();\n ports = devices.map((device) => new serial.Port(device)); //return port\n\n if (ports.length == 0) {\n port.statustext_connect =\n 'NO USB DEVICE automatically found on page load';\n console.log(port.statustext_connect);\n } else {\n var statustext = '';\n if (event.type == 'AutoConnect') {\n statustext = 'AUTO-CONNECTED USB DEVICE ON PAGE LOAD!';\n } else if (event.type == 'Reconnect') {\n statustext = 'RECONNECTED USB DEVICE!';\n }\n port = ports[0];\n try {\n await port.connect();\n } catch (error) {\n console.log(error);\n }\n port.statustext_connect = statustext;\n console.log(port.statustext_connect);\n\n //Hide manual connect button upon successful connect\n document.querySelector('button[id=connectusb]').style.display = 'none';\n }\n }\n\n // STEP 1B: User connects to Port\n if (\n event.type == 'pointerup' ||\n event.type == 'touchend' ||\n event.type == 'mouseup'\n ) {\n event.preventDefault(); //prevents additional downstream call of click listener\n try {\n //STEP 1B: RequestPorts - User based\n // -Get device list based on Arduino filter\n // -Look for user activation to select device\n const filters = [\n { vendorId: 0x2341, productId: 0x8036 },\n { vendorId: 0x2341, productId: 0x8037 },\n { vendorId: 0x2341, productId: 0x804d },\n { vendorId: 0x2341, productId: 0x804e },\n { vendorId: 0x2341, productId: 0x804f },\n { vendorId: 0x2341, productId: 0x8050 },\n ];\n\n device = await navigator.usb.requestDevice({ filters: filters });\n port = new serial.Port(device); //return port\n\n await port.connect();\n\n port.statustext_connect = 'USB DEVICE CONNECTED BY USER ACTION!';\n console.log(port.statustext_connect);\n\n //Hide manual connect button upon successful connect\n document.querySelector('button[id=connectusb]').style.display = 'none';\n } catch (error) {\n console.log(error);\n }\n waitforClick.next(1);\n }\n} //FUNCTION findUSBDevice", "function connectviaBT() {\r\n\t// initialize bluetooth and setup an event listener\r\n\t//todo: refactor name mWebSocket_InitAsync\r\n\tdocument.getElementById( \"idStatus\").innerHTML=\"Connecting via BT\";\r\n\t//returns data from BT as Uint8Array [1..20]\r\n\t//Todo: write what this does in a comment is this the Ternary Operator? (variable = (condition) ? expressionTrue : expressionFalse)\r\n\treturn (bluetoothDeviceDetected ? Promise.resolve() : getDeviceInfo() && isWebBluetoothEnabled())\r\n\t.then(connectGATT) //todo:@FC please explain what is happening here\r\n\t.then(_ => {\r\n\t\tconsole.log('Evaluating signal of interest...')\r\n\t\treturn gattCharacteristic.readValue()\t//receiving data from BT - Uint8Array [1..20]\r\n\t})\r\n\t.catch(error => {\r\n\t\tconsole.log('Waiting to start reading: ' + error)\r\n\t})\r\n}", "function getdevice (dev, callback)\n{\n if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null)\n {\n if (typeof (dev) === 'undefined' || dev === null || dev.length < 1) dev = '-13';\n webphone_api.plhandler.GetDevice(dev, callback);\n }\n}", "function controlHSDevice(device,action,value,cbfunc){\n var options = {\n hostname: hsserver,\n path: '/jsonapi.asp?action=' + action + '&id=' + device + '&value=' + value,\n port: hsport,\n headers: {\n 'Authorization': auth\n }\n };\n\n http.get(options, function(response) {\n var body = '';\n response.on('data', function(d) {body += d;});\n response.on('end', function() {cbfunc(JSON.parse(body));});\n\t response.on(\"error\",function(e){console.log(\"Got error: \" + e.message); });\n }); \n}", "function controlHSDevice(device,action,value,cbfunc){\n var options = {\n hostname: hsserver,\n path: '/jsonapi.asp?action=' + action + '&id=' + device + '&value=' + value,\n port: hsport,\n headers: {\n 'Authorization': auth\n }\n };\n\n http.get(options, function(response) {\n var body = '';\n response.on('data', function(d) {body += d;});\n response.on('end', function() {cbfunc(JSON.parse(body));});\n\t response.on(\"error\",function(e){log(\"Got error: \" + e.message); });\n }); \n}", "function getWeMoData() {\n var wemoHeaders = { \n \"Content-Type\": \"application/json\", \n \"SOAPACTION\": \"urn:Belkin:service:basicevent:1#GetBinaryState\",\n };\n var wemoState = '<?xml version=\"1.0\" encoding=\"<utf-8\"?>>' + \n '<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/>' +\n \"<s:Body>\" + \n '<u:GetBinaryState xmlns:u=\"urn:Belkin:service:basicevent:1>' + \n \"<BinaryState>1</BinaryState>\" + \n \"</u:GetBinaryState>\" + \n \"</s:Body>\" + \n \"</s:Envelope>\"\n var wemoOptions =\n {\n \"method\" : \"post\",\n \"headers\" : wemoHeaders,\n \"muteHttpExceptions\": true,\n \"payload\" : wemoState,\n };\n\n var ddnsDevices = [ \"WemoXmas\", \"WemoGazebo\" ];\n props.setProperty( \"weNum\", ddnsDevices.length ); \n \n for (var i = 0; i < ddnsDevices.length; i++) {\n var response = UrlFetchApp.fetch(getSecureVal(ddnsDevices[i], \"URL\") + \"/upnp/control/basicevent1\").getContentText();\n Logger.log(response);\n var wemoJson = JSON.parse(response);\n state = wemoJSON.BinaryState;\n props.setProperties( \"we\" + String(i), state ); \n /* send to ATT M2X*/\n var streams = [ \"we0\", \"we1\", \"we2\", \"we3\" ];\n sendDataATT(ddnsDevices[i], streams);\n logProps(streams);\n }\n \n}", "async send_cmd(cmd, options={}) {\n const data = options.data;\n const textDecode = (options.textDecode !== undefined ? !!options.textDecode : true);\n const sleepOverride = (parseInt(options.sleepOverride) || 10);\n const cmdIndex = (parseInt(options.cmdIndex) || 0);\n\n if (!this.device || !this.device.opened) {\n this.log(\"error: device not connected.\\n\", \"red\");\n this.log(\"Use button to connect to a supported programmer.\\n\", \"red\");\n return Promise.reject(\"error: device not opened\");\n }\n\n const opts = {\n requestType: \"vendor\",\n recipient: \"device\",\n request: 250,\n value: this.CMD_LUT[cmd],\n index: cmdIndex\n };\n\n // transfer data out\n const res = data\n ? await this.device.controlTransferOut(opts, data)\n : await this.device.controlTransferOut(opts);\n\n // sleep for a bit to give the USB device some processing time leeway\n await (() => new Promise(resolve => setTimeout(resolve, sleepOverride)))();\n\n return this.device.controlTransferIn({\n requestType: \"vendor\",\n recipient: \"device\",\n request: 249,\n value: 0x70,\n index: 0x81\n }, 64).then(result => {\n return textDecode\n ? (new TextDecoder()).decode(result.data)\n : result.data.buffer;\n });\n }", "async function requestBLEDevice(){\n let result = Promise.resolve()\n if (ble.connected == false){\n console.log('Requesting ble device...')\n wdm('Requesting bluetooth device list')\n // let options = {filters: [ {name: ble.name}, {services:[ ble.customserviceUUID ]} ]}\n let options = {filters: [ {namePrefix: ble.namePrefix}, {services:[ ble.customserviceUUID ]} ]}\n\n try{\n device = await navigator.bluetooth.requestDevice(options)\n console.log(\"found a device\",device)\n console.log(device.name)\n console.log(device.uuids)\n var textstr = \"found a device name: \" + device.name + \"<br>\" + \"id: \" + device.id\n ble.statustext = textstr\n \n ble.device=device\n ble.device.addEventListener('gattserverdisconnected',onDisconnectedBLE)\n }\n catch(error){\n if (ble.connected == false){\n var textstr = 'Still waiting for user to select device'\n console.log(textstr)\n ble.statustext = ble.statustext + \"<br>\" + textstr\n \n return error\n }\n }\n }\n return result\n}", "getHardware (cb) {\n\t\tvar self = this\n\n\t\tif (!this.started)\n\t\t{\n\t\t\treturn cb('Connection to MD-DM not started')\n\t\t}\n\n\t\tif (!this.device.connected)\n\t\t{\n\t\t\treturn cb('Not currently connected to MD-DM')\n\t\t}\n\n\t\tthis._connection.exec('SHOWHW', function (err, response) {\n\t\t\tself._logger.verbose(`SHOWHW response: ${response}`)\n\n\t\t\ttry\n\t\t\t{\n\t\t\t\tcb(err, TelnetOutputParser.parseHardware(response))\n\t\t\t}\n\t\t\tcatch (e)\n\t\t\t{\n\t\t\t\tself._logger.warn(`Failed to parse response: ${response}`)\n\t\t\t\tcb(`Failed to parse response: ${e} / ${e.stack}`)\n\t\t\t}\n\t\t})\n\t}", "function request(value) {\n\t// Init variables\n\tlet src;\n\tlet cmd;\n\n\tswitch (value) {\n\t\tcase 'motor-values' : {\n\t\t\tsrc = 'DIA';\n\t\t\tcmd = [ 0xB8, 0x12, 0xF1, 0x03, 0x22, 0x40, 0x00 ];\n\t\t\tbreak;\n\t\t}\n\n\t\tdefault : return;\n\t}\n\n\tbus.data.send({\n\t\tsrc : src,\n\t\tdst : 'DME',\n\t\tmsg : cmd,\n\t});\n}", "function OpenAVR(device)\n{\n if (device.deviceDescriptor.idVendor != kAtmel ||\n device.deviceDescriptor.idProduct != kEVK1101)\n {\n return; // (not our device)\n }\n\n try {\n device.open();\n device.interfaces[0].claim();\n // find first unused input >= 2\n for (var i=2; ; ++i) {\n if (i < avrs.length && avrs[i]) continue;\n avrs[i] = device;\n device.avrNum = i;\n var endIn = device.interfaces[0].endpoints[0];\n var endOut = device.interfaces[0].endpoints[1];\n endIn.avrNum = i;\n endOut.avrNum = i;\n endIn.transferType = usb.LIBUSB_TRANSFER_TYPE_BULK;\n endOut.transferType = usb.LIBUSB_TRANSFER_TYPE_BULK;\n endIn.timeout = 1000;\n endOut.timeout = 1000;\n // (must install handlers before we start polling)\n endIn.on('data', HandleData);\n endIn.on('error', HandleError);\n endOut.on('error', HandleError);\n endIn.startPoll(4, 256);\n\n // add member function to send command to AVR\n device.SendCmd = SendCmd;\n // send initial command to get AVR serial number and software version\n device.SendCmd(\"a.ser;b.ver\\n\");\n break;\n }\n }\n catch (err) {\n Log('Error opening AVR device');\n }\n}", "writeLoginControl(data) {\n var arrData = [17,16,0,1,1,];\n const data_send = this.toUTF8Array(data);\n console.log('writeLoginControl_1',data_send);\n for (var i = 0; i < data_send.length; i++) {\n arrData.push(data_send[i]);\n }\n arrData[2] = arrData.length + 1;\n arrData[arrData.length] = this.calCheckSum(arrData);\n\n console.log('writeLoginControl_2',arrData, this.byteToHexString(arrData));\n\n BleManager.writeWithoutResponse(this.props.mymac, 'fff0', 'fff5',arrData)\n .then(() => {\n console.log('--writeLoginControl successfully: ',arrData);\n })\n .catch((error) => {\n console.log('--writeLoginControl failed ',error);\n });\n }", "readFromDevice() {\n this.device.transferIn(5, 64).then(result => {\n const decoder = new TextDecoder();\n this.rstring += decoder.decode(result.data);\n // do a quick JSON smoketest (should do better with decoder/streaming)\n const startIdx = this.rstring.indexOf('{');\n if(startIdx > 0) this.rstring = this.rstring.substring(startIdx);\n const endIdx = this.rstring.indexOf('}');\n if(endIdx > -1) {\n const parseStr = this.rstring.substring(0, endIdx+1);\n this.rstring = this.rstring.substring(endIdx+1);\n try {\n const msg = JSON.parse(parseStr);\n this._handleMessage(msg);\n // this.dispatchEvent(new CustomEvent('ek-event', {detail:msg}), {bubbles: true});\n } catch(e) {\n console.log(\"NOT JSON:\",parseStr);\n }\n this.rstring = \"\";\n }\n this.readFromDevice();\n })\n .catch(error => { \n console.log(error);\n this.emitMessage(this.device.serialNumber, \"\");\n this.emitDisconnected(this.device.serialNumber);\n this.device = null;\n this.rstring = \"\";\n });\n }", "async getBatteryLevel() {\n const outputReportID = 0x01;\n const subCommand = [0x50];\n const data = [\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n ...subCommand,\n ];\n await this.device.sendReport(outputReportID, new Uint8Array(data));\n\n return new Promise((resolve) => {\n const onBatteryLevel = ({ detail: batteryLevel }) => {\n this.removeEventListener('batterylevel', onBatteryLevel);\n delete batteryLevel._raw;\n delete batteryLevel._hex;\n resolve(batteryLevel);\n };\n this.addEventListener('batterylevel', onBatteryLevel);\n });\n }", "async getDeviceDetails() {\n return this.digestClient\n .fetch(\n `http://${this.dahua_host}/cgi-bin/magicBox.cgi?action=getSystemInfo`\n )\n .then((r) => r.text())\n .then((text) => {\n const deviceDetails = text\n .trim()\n .split('\\n')\n .reduce((obj, str) => {\n const [key, val] = str.split('=');\n obj[key] = val.trim();\n return obj;\n }, {});\n return deviceDetails;\n });\n }", "async function readComms() {\n await transferByte(0x99);\n let readLen = await transferByte(0x00);\n if (readLen) {\n let rxBuff = Buffer.alloc(readLen, 0, 'binary');\n for(let ri = 0; ri < readLen; ri++) {\n let rx = await transferByte(0x00);\n rxBuff[ri] = rx;\n }\n return rxBuff;\n }\n return null;\n}", "get_card_id_ex() {\n return new Promise((resolve, reject) => {\n\n let on_frame = (frame) => {\n // remove_listener();//remove to resever for next time \n switch (frame.type) {\n case CODE.ERR_HEADER: /* No card */\n\n let err_code = frame.buffer[1];\n if (err_code == CODE.NO_CARD) {\n resolve({ is_available: false, uid_len: 0, uid: '' });\n } else {\n reject(frame);\n }\n break;\n case CODE.RESPONSE_HEADER:/*have card */\n let uid_len = frame.buffer[5];\n let resp = {\n is_available: true\n };\n if (this.buffer.length >= (CODE.PACKET_LENGTH + uid_len)) {\n let uid_buffer = new Buffer.alloc(uid_len);\n frame.buffer.copy(uid_buffer, 0, 7, 7 + uid_len);\n resp.uid_len = uid_len;\n resp.uid = util.to_hex_string(uid_buffer);\n resolve(resp);\n }\n else {\n reject('invalid resp');\n }\n break;\n default:\n reject('invalid resp');\n break;\n }\n };\n this.once('frame', on_frame);//onetime fire\n\n //GET_CARD_ID_EX (0x2C) : Use this function for cards with UID longer than 4 byte\n this.send_command(\"55 2C AA 00 00 00 DA\");\n });\n }", "function bleSend() {\n /* check if the device is connected if true send file*/\n let encoder = new TextEncoder('utf-8');\n\n if(isConnected){\n /* send an erase command so that the file gets started fresh */\n RX_characteristic.writeValue(encoder.encode(\"erase\"));\n for(let a = 0; a<3000; a++){\n console.log(\"\")\n }\n /* get the contents of the editor that is in use */\n let editorContents = editor.getValue();\n /* send the contents to the device */\n //split the editor contents into newlines.\n temp = editorContents.split(/\\n/);\n for(let i=0; i<temp.length; i++ )\n {\n //console.log(temp[i]);\n RX_characteristic.writeValue(encoder.encode(temp[i]));\n // delay to allow the device to handle the write\n for(let a = 0; a<2500; a++){\n console.log(\"\")\n }\n }\n alert(\"File Uploaded!\")\n }else{\n const x = document.getElementById('console');\n alert(\"MicroTrynkit device not connected. Please pair it first.\");\n }\n //disconnect required for the device, device sees the disconnect then reboots which causes the code to run\n bledevice.gatt.disconnect();\n}", "function tuyaDeviceUpgradeSilentGet( params ){\n\treturn // XXX empty return means no update\n\treturn {\n\t\t\"url\": \"http://tuyaus.com/ota/tuya-sonoff.bin\",\n\t\t\"type\": 0,\n\t\t\"size\": \"478491\",\n\t\t\"md5\": \"79e9748319d7ad888f2deff16a87a296\",\n\t\t\"version\": \"1.1.0\",\n\t}\n}", "get WiiU() {}", "function ble_transmit_cmd(cmd) {\n if(cmd == 0){\n for(var i = 0; i < g_rawcode_length/2; i = i + 1){\n uiProgressBar(g_rawcode_length/2, i+1);\n\n var tx_data = [];\n\n /*\n for(var j = 0; j < 2; j = j + 1){\n tx_data[j] = 0xff & (i >> (8*(1-j)));\n }\n */\n //CMD\n tx_data[0] = 0;\n //index\n tx_data[1] = i & 0xff;\n\n\n for(var j = 0; j < 2; j = j + 1){\n tx_data[2+j] = 0xff & ((g_rawcode_length/2) >> (8*(1-j)));\n }\n\n //freq(0:38k, 1;40k)\n tx_data[4] = 0;\n //Format(0:unknown, 1:NEC, 2:SONY...)\n tx_data[5] = 1;\n\n //Number of Frame\n for(var j = 0; j < 2; j = j + 1){\n tx_data[6+j] = 0xff & (g_rawcode_length >> (8*(1-j)));\n }\n\n //Data0\n for(var j = 0; j < 4; j = j + 1){\n tx_data[8+j] = 0xff & ((g_rawcode[i*2] / g_ir_margin) >> (8*(3-j)));\n }\n\n //Data1\n for(var j = 0; j < 4; j = j + 1){\n tx_data[12+j] = 0xff & ((g_rawcode[i*2 + 1] / g_ir_margin) >> (8*(3-j)));\n }\n\n //Transmit\n window.cmdCharacteristic.writeValue(new Uint8Array(tx_data)).catch(error => {\n uiDebugMessage(\"liffWriteLoadMatrix\");\n uiStatusError(makeErrorMsg(error), false);\n });\n }\n }else{\n window.cmdCharacteristic.writeValue(new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])).catch(error => {\n uiDebugMessage(\"liffWriteLoadMatrix - Req\");\n uiStatusError(makeErrorMsg(error), false);\n });\n }\n}", "start() {\n let constraints = {\n video: {\n facingMode: 'user',\n height: { min: 360, ideal: 720, max: 1080 },\n deviceId: localStorage.getItem('deviceId')\n },\n audio: true\n };\n\n // navigator.mediaDevices.enumerateDevices()\n // .then(dd=> { \n // dd.map(device => {\n // if (device.kind == 'videoinput' && device.label == DEVICE) {\n // constraints.video.deviceId = device.deviceId;\n // }\n // })\n // }) \n\n // navigator.usb.requestDevice({filters:[]})\n // .then(selectedDevice => {\n // device = selectedDevice;\n // console.log('selectedDevice', device, selectedDevice);\n // return device.open(); // Begin a session.\n // })\n // .then(() => {\n // console.log('daada', device.selectConfiguration);\n // device.selectConfiguration(1)}) // Select configuration #1 for the device.\n // .then(() => {\n // console.log('daada', device.claimInterface);\n // device.claimInterface(0)}) // Request exclusive control over interface #2.\n // .then(() => {\n // console.log('daada', device.controlTransferOut);\n // device.controlTransferOut({\n // requestType: 'class',\n // recipient: 'interface',\n // request: 0x22,\n // value: 0x01,\n // index: 0x02})}) // Ready to receive data\n // .then(() => {\n // console.log('dedde', device);\n // device.transferIn(5, 64)\n // }) // Waiting for 64 bytes of data from endpoint #5.\n // .then(result => {\n // let decoder = new TextDecoder();\n // console.log('decoder', decoder, result);\n // console.log('Received: ' + decoder.decode(result.data));\n // })\n // .catch(error => { console.log('this.error', error); });\n console.log('constraints', constraints)\n\n setTimeout(() => {\n // constraints.video.deviceId = localStorage.getItem('deviceId');\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then((stream) => {\n this.stream = stream;\n this.emit('stream', stream);\n })\n .catch((err) => {\n if (err instanceof DOMException) {\n alert('Cannot open webcam and/or microphone');\n } else {\n console.log(err);\n }\n });\n }, 3000)\n\n return this;\n }", "function _htob (hex) {\n if (hex) {\n if (typeof hex !== 'string') {\n throw new TypeError('Expected input to be a string')\n }\n\n if ((hex.length % 2) !== 0) {\n throw new RangeError('Expected string to be an even number of characters')\n }\n\n var view = new Uint8Array(hex.length / 2)\n\n for (var i = 0; i < hex.length; i += 2) {\n view[i / 2] = parseInt(hex.substring(i, i + 2), 16)\n }\n\n return view\n } else {\n return null;\n }\n}", "async enableSimpleHIDMode() {\n const outputReportID = 0x01;\n const subcommand = [0x03, 0x3f];\n const data = [\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n 0x00,\n ...subcommand,\n ];\n await this.device.sendReport(outputReportID, new Uint8Array(data));\n }", "function getDeviceCapability()\r\n{\r\n\txrxDeviceConfigGetDeviceCapabilities( \"http://127.0.0.1\", getDeviceCapabilities_success, getDeviceCapatilities_failure, null);\r\n}", "getStatus() {\n return new Promise((resolve, reject) => {\n // send hex code for getting the status of power,rgb,warm\n send(this.ip, hexToArray(\"81:8a:8b:96\"), (data, err) => {\n if (err)\n reject(err)\n else {\n if(data) {\n const status = [];\n for(let i = 0; i < data.length; i+=2){\n status.push(data[i].concat(data[i+1]))\n }\n const power = status[2] === \"23\" ? \"on\" : \"off\"\n \n const rgb = status.slice(6,9).map((el) => parseInt(el, 16));\n \n const warm = parseInt(status[9], 16)\n const out = {\"power\" : power, \"rgb\" : rgb, \"warm\" : warm}\n resolve(out)\n }\n }\n });\n })\n }", "getDeviceID(): Promise<string> {\n return HyperTrack.getDeviceID();\n }", "function send2LMviaBT(value) { //value is an arry of bytes\r\n //let encoder = new TextEncoder('utf-8');\r\n mDebugMsg1(1,'Setting Characteristic User Description...');\r\n gattCharacteristic.writeValue(value)\r\n .then(_ => {\r\n \t mDebugMsg1(1,'> Characteristic User Description changed to: ' + value);\r\n })\r\n .catch(error => {\r\n\t\t//todo9: userfriendly message\r\n \t mDebugMsg1(1,'Argh! ' + error);\r\n });\r\n\r\n\r\n }", "function arduinoTest() {\n return request;\n}", "function read(){\n\t\t\t\n\t\t\tvar deferred = $q.defer();\n\t\t\tserial.read(\n\t\t\t\tfunction success(data){\n\t\t\t\t\tvar byteArray = new Uint8Array(data);\n\t\t\t\t\tdeferred.resolve( UtilsService.byteArrayToString(byteArray) );\n\t\t\t\t},\n\t\t\t\tfunction error(){\n\t\t\t\t\tdeferred.reject(new Error());\n\t\t\t\t}\n\t\t\t);\n\t\t\t\n\t\t\treturn deferred.promise;\n\t\t\t\n\t\t}", "function getCCDA(url,uid,callback){\n var options = {\n host: api_domain,\n path: url+'?api_key='+api_key+'&uid='+uid,\n port: api_port\n}\n//Get the bindaas api\nvar request = http.request(options, function (res) {\n var data = '';\n res.on('data', function (chunk) {\n data += chunk;\n });\n res.on('end', function () {\n callback(data);\n });\n });\n request.on('error', function (e) {\n console.log(e.message);\n console.log(\"please check that your bindaas API is succesfully set up\");\n });\n request.end();\n}", "readHydrawiseStatus(){\n const cmd = hydrawise_url_status + \"api_key=\" + this.config.hydrawise_apikey;\n\n // execute only if apikey is defined in config page\n if (this.config.hydrawise_apikey!=undefined){\n this.log.info(\"send: \"+cmd);\n //request(cmd, function (error, response, body){\n request(cmd, (error, response, body) => {\n\n if (!error && response.statusCode == 200) {\n // parse JSON response from Hydrawise controller\n var obj = JSON.parse(body);\n // read device config\n hc6.nextpoll = parseInt(obj.nextpoll);\n hc6.time = parseInt(obj.time);\n hc6.message = obj.message;\n this.log.info(\"nextpoll=\"+hc6.nextpoll+\" time=\"+hc6.time+\" message=\"+hc6.message);\n \n // read all configured sensors\n for (let i=0; i<=1; i++){\n // if sensor is configured\n if (obj.sensors[i]!=null){\n hc6.sensors[i].input = parseInt(obj.sensors[i].input);\n hc6.sensors[i].type = parseInt(obj.sensors[i].type);\n hc6.sensors[i].mode = parseInt(obj.sensors[i].mode);\n hc6.sensors[i].timer = parseInt(obj.sensors[i].timer);\n hc6.sensors[i].offtimer = parseInt(obj.sensors[i].offtimer);\n // read all related relays\n for (let j=0; j<=5; j++){\n // if relay is configured\n if (obj.sensors[i].relays[j]!=null){\n hc6.sensors[i].relays[j]=obj.sensors[i].relays[j].id\n }\n };\n }\n this.log.info(\"sensor\"+i+\": input=\"+hc6.sensors[i].input+\" type=\"+hc6.sensors[i].type+\n \" mode=\"+hc6.sensors[i].mode+ \" timer=\"+hc6.sensors[i].timer+\" offtimer=\"+hc6.sensors[i].offtimer+\n \" relay0=\"+hc6.sensors[i].relays[0]+\" relay1=\"+hc6.sensors[i].relays[1]+\" relay2=\"+hc6.sensors[i].relays[2]+\n \" relay3=\"+hc6.sensors[i].relays[3]+\" relay4=\"+hc6.sensors[i].relays[4]+\" relay5=\"+hc6.sensors[i].relays[5]);\n }\n\n // read all configured relays\n for (let i=0; i<=5; i++){\n if (obj.relays[i]!=null){\n hc6.relays[i].relay_id = parseInt(obj.relays[i].relay_id);\n hc6.relays[i].name = obj.relays[i].name;\n hc6.relays[i].relay = parseInt(obj.relays[i].relay);\n hc6.relays[i].type = parseInt(obj.relays[i].type);\n hc6.relays[i].time = parseInt(obj.relays[i].time);\n hc6.relays[i].run = parseInt(obj.relays[i].run);\n hc6.relays[i].period = parseInt(obj.relays[i].period);\n hc6.relays[i].timestr = obj.relays[i].timestr;\n }\n else{\n hc6.relays[i].relay_id = 0;\n hc6.relays[i].name = \"\";\n hc6.relays[i].relay = 0;\n hc6.relays[i].type = 0;\n hc6.relays[i].time = 0;\n hc6.relays[i].run = 0;\n hc6.relays[i].period = 0;\n hc6.relays[i].timestr = \"\";\n }\n this.log.info(\"relay\"+i+\": relay_id=\"+hc6.relays[i].relay_id+\" name=\"+hc6.relays[i].name+\n \" relay=\"+hc6.relays[i].relay+\" type=\"+hc6.relays[i].type+\" time=\"+hc6.relays[i].time+\n \" run=\"+hc6.relays[i].run+\" period=\"+hc6.relays[i].period+\" timestr=\"+hc6.relays[i].timestr);\n }\n }\n })\n }\n }", "function getBufferRequest(opt, callback){\n\n\topt.host = \"cloud.cadexchanger.com\";\n\topt.protocol = \"https:\";\n\topt.path = \"/api/v1\" + opt.path;\n\n\tconst tmpFile = fs.createWriteStream(\"tmp.file\");\n\tconst req = https.get(opt, (res) => {\n\t\tres.pipe(tmpFile);\n\n\t\ttmpFile.on('finish', () => {\n\t\t\t//tmpFile.close();\n\t\t\tcallback(fs.readFileSync(\"tmp.file\"));\n\t\t\tfs.unlink(\"tmp.file\", ()=>{});\n\t\t});\n\t});\n}", "function readSerialData(data) {\n console.log(data.toString());\n sendit({method: 'data', data: data.toString()});\n}", "function getDevicePromise(device) {\n return fetch(\n `https://www-bd.fnal.gov/cgi-bin/acl.pl?acl=~kissel/acl/mshow.acl+${device}+/device_index`\n )\n .then(res => res.text())\n .then(text => {\n return text;\n })\n .then(parseDeviceIndex);\n}", "function decode()\n{\n\tget_ui_vals();\n\n\n\tif (typeof hex_opt === 'undefined')\n\t{\n\t\thex_opt = 0;\n\t}\n\n\n\n\tif (rate == 0)\n\t{\n\t\treturn;\n\t}\n\n\tspb = sample_rate / rate; \t\t// Calculate the number of Samples Per Bit.\n\n\ttry\n\t{\n\t\tspb_hs = sample_rate / high_rate;\n\t}\n\tcatch(e)\n\t{\n\t\tspb_hs = sample_rate / 2000000;\n\t}\n\n\tm = spb / 10; \t\t\t\t\t// Margin = 1 tenth of a bit time (expresed in number of samples)\n\tm_hs = spb_hs / 10;\n\n\tvar t = trs_get_first(ch);\n\n\tchannel_color = get_ch_light_color(ch);\n\n\twhile (trs_is_not_last(ch) && (stop == false))\n\t{\n\t if (abort_requested() == true)\t\t// Allow the user to abort this script\n\t\t{\n\t\t\treturn false;\n\t\t}\n\n\t\tswitch (state)\n\t\t{\n\t\t\tcase GET_SOF:\n\n\t\t\t\twhile ((t.val != 0) && trs_is_not_last(ch))\t\t// Search for SOF\n\t\t\t\t{\n\t\t\t\t\tt = trs_get_next(ch);\n\t\t\t\t}\n\n\t\t\t\ts = t.sample + (spb * 0.5); \t\t// Position our reader on the middle of first bit\n\n\t\t\t\tbit_sampler_ini(ch,spb /2, spb); \t// Initialize the bit sampler (to be able tu use \"bit_sampler_next()\")\n\t\t\t\tbit_sampler_next(ch); \t\t\t\t// Read and skip the start bit\n\n\t\t\t\tdec_item_new(ch,t.sample,t.sample + spb - m); \t// Add the start bit item\n\t\t\t\tdec_item_add_pre_text(\"Start of Frame\");\n\t\t\t\tdec_item_add_pre_text(\"Start\");\n\t\t\t\tdec_item_add_pre_text(\"SOF\");\n\t\t\t\tdec_item_add_pre_text(\"S\");\n\n\t\t\t\tpkt_start(\"CAN\");\n\t\t\t\tpkt_add_item(-1, -1, \"SOF\", \"\", dark_colors.blue, channel_color);\n\n\t\t\t\tbits = [];\n\t\t\t\trb = 0;\n\t\t\t\tframe_length_in_sample = 0;\n\t\t\t\tb = 0; sb = 0;\n\t\t\t\tbit_pos = [];\n\t\t\t\tide_mode = false;\n\t\t\t\tdata_size = 0;\n\t\t\t\tbits.push(0); \t\t// Add the start bit to the bits table\n\t\t\t\tbit_pos.push(s); \t// Add its position\n\t\t\t\tb++;\n\t\t\t\trb++;\n\t\t\t\tframe_length_in_sample += spb;\n\t\t\t\tlast_bit = 0;\n\t\t\t\tstate = GET_ID;\n\t\t\t\trtr_mode = false;\n\t\t\t\tide_mode = false;\n\t\t\t\tedl_mode = false;\n\t\t\t\tpotential_overload = true; \t// This *may* be the beginning of an overload frame\n\n\t\t\tbreak;\n\n\t\t\tcase GET_ID:\n\n\t\t\t\twhile (true) \t// Read bits until we break\n\t\t\t\t{\n\t\t\t\t\tif (abort_requested() == true)\t// Allow the user to abort this script\n\t\t\t\t\t{\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(edl_mode && (((b==35)&&ide_mode) || ((b==16)&&!ide_mode)) )\n\t\t\t\t\t{\n\t\t\t\t\t\tbit_sampler_ini(ch,spb_hs / 2, spb_hs); \t// use High speed since now\n\t\t\t\t\t\tbit_sampler_next(ch);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (sb == 4)\n\t\t\t\t\t{\n\n\t\t\t\t\t\tstuffing_ok = check_stuffing();\t\t// Stuffed bit\n\t\t\t\t\t\tif (stuffing_ok == false) break; \t// Break on the first stuffing error\n\t\t\t\t\t\tsb = 0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tbits[b] = bit_sampler_next(ch);\t\t// Regular bit\n\t\t\t\t\t\tif( (last_bit == 1)&&(bits[b] == 0) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(edl_mode && (((b>35)&&ide_mode) || ((b>16)&&!ide_mode)) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttrs_tmp = trs_get_prev(ch);\n\t\t\t\t\t\t\t\tframe_length_in_sample = trs_tmp.sample - s + spb_hs/2;\n\t\t\t\t\t\t\t\tbit_pos.push(trs_tmp.sample + spb_hs/2); \t\t// Store the position of that bit\n\t\t\t\t\t\t\t\tdec_item_add_sample_point(ch, trs_tmp.sample + spb_hs/2, DRAW_POINT);\n\t\t\t\t\t\t\t\tbit_sampler_ini(ch,spb_hs / 2, spb_hs);\n\t\t\t\t\t\t\t\tbit_sampler_next(ch);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttrs_tmp = trs_get_prev(ch);\n\t\t\t\t\t\t\t\tframe_length_in_sample = trs_tmp.sample - s + spb/2;\n\t\t\t\t\t\t\t\tbit_pos.push(trs_tmp.sample + spb/2); \t\t// Store the position of that bit\n\t\t\t\t\t\t\t\tdec_item_add_sample_point(ch, trs_tmp.sample + spb/2, DRAW_POINT);\n\t\t\t\t\t\t\t\tbit_sampler_ini(ch,spb / 2, spb);\n\t\t\t\t\t\t\t\tbit_sampler_next(ch);\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{\n\t\t\t\t\t\t\tbit_pos.push(s + frame_length_in_sample); \t\t// Store the position of that bit\n\t\t\t\t\t\t\tdec_item_add_sample_point(ch, s + frame_length_in_sample, DRAW_POINT);\n\t\t\t\t\t\t}\n\n\n\n\t\t\t\t\t\tif (bits[b] == last_bit)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsb++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsb = 0;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlast_bit = bits[b];\n\t\t\t\t\t\tb++;\n\t\t\t\t\t}\n\n\t\t\t\t\trb++;\n\t\t\t\t\tif(edl_mode && (((b>35)&&ide_mode) || ((b>16)&&!ide_mode)) )\n\t\t\t\t\t\tframe_length_in_sample += spb_hs;\n\t\t\t\t\telse\n\t\t\t\t\t\tframe_length_in_sample += spb;\n\n\n\t\t\t\t\tif(edl_mode && (((b==36)&&ide_mode) || ((b==17)&&!ide_mode)) )\n\t\t\t\t\t{\n\t\t\t\t\t\tbit_sampler_next(ch);\n\t\t\t\t\t\tframe_length_in_sample += spb_hs;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ((b == 14) && (bits[13] == 1))\n\t\t\t\t\t{\n\t\t\t\t\t\tide_mode = true;\n\t\t\t\t\t\trtr_mode = false; \t// Reset rtr, will be checked at bit 32\n\t\t\t\t\t}\n\n\t\t\t\t\tif (ide_mode)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ((b == 33) && (bits[32] == 1))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trtr_mode = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((b == 34) && (bits[33] == 1))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tedl_mode = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif ((b == 13) && (bits[12] == 1))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\trtr_mode = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ((b == 15) && (bits[14] == 1))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tedl_mode = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(edl_mode)\n\t\t\t\t\t{\n\t\t\t\t\t\tif ((ide_mode == true) && (b == 41))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ((ide_mode == false) && (b == 22))\n\t\t\t\t\t\t{\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\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif ((ide_mode == true) && (b == 39))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ((ide_mode == false) && (b == 19))\n\t\t\t\t\t\t{\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\n\t\t\t\tif (stuffing_ok == false)\n\t\t\t\t{\n\t\t\t\t\tt = trs_go_after(ch, bit_pos[b - 1] + (10.5 * spb));\n\t\t\t\t\tset_progress(100 * t.sample / n_samples);\n\t\t\t\t\tstate = GET_SOF;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif(edl_mode) //if it's CAN-FD\n\t\t\t\t{\n\t\t\t\t\t// Check if we are in normal or extended ID mode\n\t\t\t\t\tif (ide_mode == false)\t \t// Normal frame\n\t\t\t\t\t{\n\t\t\t\t\t\tval = 0;\t\t\t\t// Calculate the value of the ID\n\n\t\t\t\t\t\tfor (c = 1; c < 12; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdec_item_new(ch,bit_pos[1] - (0.5 * spb) + m, bit_pos[11] + (0.5 * spb) - m); \t\t// Add the ID item\n\t\t\t\t\t\tdec_item_add_pre_text(\"IDENTIFIER: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"ID: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"ID\");\n\t\t\t\t\t\tdec_item_add_data(val);\n\n\t\t\t\t\t\tif (hex_opt > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar tmp_val = (val >> 8);\n\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_val);\n\t\t\t\t\t\t\ttmp_val = (val & 0xFF);\n\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_val);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"ID\", int_to_str_hex(val), dark_colors.green, channel_color);\n\t\t\t\t\t\tpkt_start(\"Frame Type\");\n\n\t\t\t\t\t\tdec_item_new(ch,bit_pos[12] - (0.5 * spb) + m, bit_pos[12] + (0.5 * spb) - m); \t// Add the RTR bit\n\n\t\t\t\t\t\tif (rtr_mode == true)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"RTR FRAME\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"RTR\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"R\");\n\t\t\t\t\t\t\tpkt_add_item(-1, -1, \"RTR = 1\", \"RTR FRAME\", dark_colors.green, channel_color, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"DATA FRAME\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"DATA\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"D\");\n\t\t\t\t\t\t\tpkt_add_item(-1, -1, \"RTR = 0\", \"DATA FRAME\", dark_colors.green, channel_color, true);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[13] - (0.5 * spb) + m, bit_pos[13] + (0.5 * spb) - m);\n\t\t\t\t\t\tdec_item_add_pre_text(\"BASE FRAME FORMAT\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"BASE FRAME\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"BASE\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"B\");\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"IDE = 0\",\"BASE FRAME FORMAT\", dark_colors.green, channel_color, true);\n\t\t\t\t\t\tpkt_end();\n\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[14] - (0.5 * spb) + m, bit_pos[14] + (0.5 * spb) - m);\n\t\t\t\t\t\tdec_item_add_pre_text(\"Extended Data Length\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"EDL\");\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[15] - (0.5 * spb) + m, bit_pos[15] + (0.5 * spb) - m);\n\t\t\t\t\t\tdec_item_add_pre_text(\"r0\");\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[16] - (0.5 * spb) + m, bit_pos[16] + (0.5 * spb) - m);\n\t\t\t\t\t\tdec_item_add_pre_text(\"Bit Rate Switch\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"BRS\");\n\t\t\t\t\t\tif(!edl_mode)\n\t\t\t\t\t\t\tdec_item_new(ch, bit_pos[17] - (0.5 * spb) + m, bit_pos[17] + (0.5 * spb) - m);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdec_item_new(ch, bit_pos[17] - (0.5 * spb_hs) + m_hs, bit_pos[17] + (0.5 * spb_hs) - m_hs);\n\t\t\t\t\t\tdec_item_add_pre_text(\"Error State Indicator)\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"ESI\");\n\t\t\t\t\t\tval = 0;\n\n\t\t\t\t\t\tfor (c = 18; c < 22; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdata_size = val;\n\n\t\t\t\t\t\tif(edl_mode)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tswitch (val)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0x9 : data_size = 12; crc_len=17; break;\n\t\t\t\t\t\t\tcase 0xA : data_size = 16; crc_len=17; break;\n\t\t\t\t\t\t\tcase 0xB : data_size = 20; crc_len=21; break;\n\t\t\t\t\t\t\tcase 0xC : data_size = 24; crc_len=21; break;\n\t\t\t\t\t\t\tcase 0xD : data_size = 32; crc_len=21; break;\n\t\t\t\t\t\t\tcase 0xE : data_size = 48; crc_len=21; break;\n\t\t\t\t\t\t\tcase 0xF : data_size = 64; crc_len=21; break;\n\t\t\t\t\t\t\tdefault : break;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(!edl_mode)\n\t\t\t\t\t\t\tdec_item_new(ch,bit_pos[18] - (0.5 * spb) + m, bit_pos[21] + (0.5 * spb) - m); \t// Add the DLC item\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdec_item_new(ch,bit_pos[18] - (0.5 * spb_hs) + m_hs, bit_pos[21] + (0.5 * spb_hs) - m_hs); \t// Add the DLC item\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LENGTH CODE: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LENGTH: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LEN: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DLC: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"L:\");\n\t\t\t\t\t\tdec_item_add_data(val);\n\n\n\n\t\t\t\t\t\tif (hex_opt > 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, val);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"DLC\", int_to_str_hex(val), dark_colors.orange, channel_color, true);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tval = 0;\n\n\t\t\t\t\t\tfor (c = 1; c < 12; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (c = 14; c < 32; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdec_item_new(ch,bit_pos[1] - (0.5 * spb) + m, bit_pos[31] + (0.5 * spb) - m); \t// Add the EID item\n\t\t\t\t\t\tdec_item_add_pre_text(\"EXTENDED IDENTIFIER: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"EID: \");\n\t\t\t\t\t\tdec_item_add_data(val);\n\n\t\t\t\t\t\tif (hex_opt > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar tmp_val = val;\n\n\t\t\t\t\t\t\tfor (var i = 0; i < 4; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar tmp_byte = (tmp_val & 0xFF);\n\t\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_byte);\n\t\t\t\t\t\t\t\ttmp_val = (tmp_val - tmp_byte) / 256;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"EID\", int_to_str_hex(val), dark_colors.violet, channel_color);\n\t\t\t\t\t\tpkt_start(\"Frame Type\");\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[32] - (0.5 * spb) + m, bit_pos[32] + (0.5 * spb) - m); // Add the RTR bit\n\n\t\t\t\t\t\tif (rtr_mode == true)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"RTR FRAME\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"RTR\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"R\");\n\t\t\t\t\t\t\tpkt_add_item(-1, -1, \"RTR = 1\", \"RTR FRAME\", dark_colors.violet, channel_color, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"DATA FRAME\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"DATA\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"D\");\n\t\t\t\t\t\t\tpkt_add_item(-1, -1, \"RTR = 0\", \"DATA FRAME\", dark_colors.violet, channel_color, true);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[33] - (0.5 * spb) + m, bit_pos[33] + (0.5 * spb) - m);\n\t\t\t\t\t\tdec_item_add_pre_text(\"Extended Data Length\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"EDL\");\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[34] - (0.5 * spb) + m, bit_pos[34] + (0.5 * spb) - m);\n\t\t\t\t\t\tdec_item_add_pre_text(\"r0\");\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[35] - (0.5 * spb) + m, bit_pos[35] + (0.5 * spb) - m);\n\t\t\t\t\t\tdec_item_add_pre_text(\"Bit Rate Switch\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"BRS\");\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[36] - (0.5 * spb_hs) + m_hs, bit_pos[36] + (0.5 * spb_hs) - m_hs);\n\t\t\t\t\t\tdec_item_add_pre_text(\"Error State Indicator)\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"ESI\");\n\n\t\t\t\t\t\tpkt_add_item(0, 0, \"IDE = 1\", \"EXTENDED FRAME FORMAT\", dark_colors.violet, channel_color, true);\n\t\t\t\t\t\tpkt_end();\n\n\t\t\t\t\t\tval = 0;\n\n\t\t\t\t\t\tfor (c = 37; c < 41; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdata_size = val;\n\n\t\t\t\t\t\tif(edl_mode)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tswitch (val)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0x9 : data_size = 12; crc_len=17; break;\n\t\t\t\t\t\t\tcase 0xA : data_size = 16; crc_len=17; break;\n\t\t\t\t\t\t\tcase 0xB : data_size = 20; crc_len=21; break;\n\t\t\t\t\t\t\tcase 0xC : data_size = 24; crc_len=21; break;\n\t\t\t\t\t\t\tcase 0xD : data_size = 32; crc_len=21; break;\n\t\t\t\t\t\t\tcase 0xE : data_size = 48; crc_len=21; break;\n\t\t\t\t\t\t\tcase 0xF : data_size = 64; crc_len=21; break;\n\t\t\t\t\t\t\tdefault : break;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(!edl_mode)\n\t\t\t\t\t\t\tdec_item_new(ch,bit_pos[37] - (0.5 * spb) + m, bit_pos[40] + (0.5 * spb) - m); \t// Add the DLC item\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tdec_item_new(ch,bit_pos[37] - (0.5 * spb_hs) + m_hs, bit_pos[40] + (0.5 * spb_hs) - m_hs); \t// Add the DLC item\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LENGTH CODE: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LENGTH: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LEN: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DLC: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"L:\");\n\t\t\t\t\t\tdec_item_add_data(val);\n\n\t\t\t\t\t\tif (hex_opt > 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, val);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpkt_add_item(t.sample, t.sample + spb - m, \"DLC\", int_to_str_hex(val), dark_colors.orange, channel_color,true);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Check if we are in normal or extended ID mode\n\t\t\t\t\tif (ide_mode == false)\t \t// Normal frame\n\t\t\t\t\t{\n\t\t\t\t\t\tval = 0;\t\t\t\t// Calculate the value of the ID\n\n\t\t\t\t\t\tfor (c = 1; c < 12; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdec_item_new(ch,bit_pos[1] - (0.5 * spb) + m, bit_pos[11] + (0.5 * spb) - m); \t\t// Add the ID item\n\t\t\t\t\t\tdec_item_add_pre_text(\"IDENTIFIER: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"ID: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"ID\");\n\t\t\t\t\t\tdec_item_add_data(val);\n\n\t\t\t\t\t\tif (hex_opt > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar tmp_val = (val >> 8);\n\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_val);\n\t\t\t\t\t\t\ttmp_val = (val & 0xFF);\n\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_val);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"ID\", int_to_str_hex(val), dark_colors.green, channel_color);\n\t\t\t\t\t\tpkt_start(\"Frame Type\");\n\n\t\t\t\t\t\tdec_item_new(ch,bit_pos[12] - (0.5 * spb) + m, bit_pos[12] + (0.5 * spb) - m); \t// Add the RTR bit\n\n\t\t\t\t\t\tif (rtr_mode == true)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"RTR FRAME\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"RTR\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"R\");\n\t\t\t\t\t\t\tpkt_add_item(-1, -1, \"RTR = 1\", \"RTR FRAME\", dark_colors.green, channel_color, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"DATA FRAME\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"DATA\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"D\");\n\t\t\t\t\t\t\tpkt_add_item(-1, -1, \"RTR = 0\", \"DATA FRAME\", dark_colors.green, channel_color, true);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[13] - (0.5 * spb) + m, bit_pos[13] + (0.5 * spb) - m); \t// Add the IDE bit\n\t\t\t\t\t\tdec_item_add_pre_text(\"BASE FRAME FORMAT\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"BASE FRAME\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"BASE\");\n\t\t\t\t\t\tdec_item_add_pre_text(\"B\");\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"IDE = 0\",\"BASE FRAME FORMAT\", dark_colors.green, channel_color, true);\n\t\t\t\t\t\tpkt_end();\n\n\t\t\t\t\t\tval = 0;\n\n\t\t\t\t\t\tfor (c = 15; c < 19; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdata_size = val;\n\n\t\t\t\t\t\tdec_item_new(ch,bit_pos[15] - (0.5 * spb) + m, bit_pos[18] + (0.5 * spb) - m); \t// Add the DLC item\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LENGTH CODE: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LENGTH: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LEN: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DLC: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"L:\");\n\t\t\t\t\t\tdec_item_add_data(val);\n\n\t\t\t\t\t\tif (hex_opt > 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, val);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"DLC\", int_to_str_hex(val), dark_colors.orange, channel_color, true);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tval = 0;\n\n\t\t\t\t\t\tfor (c = 1; c < 12; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (c = 14; c < 32; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdec_item_new(ch,bit_pos[1] - (0.5 * spb) + m, bit_pos[31] + (0.5 * spb) - m); \t// Add the EID item\n\t\t\t\t\t\tdec_item_add_pre_text(\"EXTENDED IDENTIFIER: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"EID: \");\n\t\t\t\t\t\tdec_item_add_data(val);\n\n\t\t\t\t\t\tif (hex_opt > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar tmp_val = val;\n\n\t\t\t\t\t\t\tfor (var i = 0; i < 4; i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvar tmp_byte = (tmp_val & 0xFF);\n\t\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_byte);\n\t\t\t\t\t\t\t\ttmp_val = (tmp_val - tmp_byte) / 256;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"EID\", int_to_str_hex(val), dark_colors.violet, channel_color);\n\t\t\t\t\t\tpkt_start(\"Frame Type\");\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[32] - (0.5 * spb) + m, bit_pos[32] + (0.5 * spb) - m); // Add the RTR bit\n\n\t\t\t\t\t\tif (rtr_mode == true)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"RTR FRAME\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"RTR\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"R\");\n\t\t\t\t\t\t\tpkt_add_item(-1, -1, \"RTR = 1\", \"RTR FRAME\", dark_colors.violet, channel_color, true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"DATA FRAME\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"DATA\");\n\t\t\t\t\t\t\tdec_item_add_pre_text(\"D\");\n\t\t\t\t\t\t\tpkt_add_item(-1, -1, \"RTR = 0\", \"DATA FRAME\", dark_colors.violet, channel_color, true);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpkt_add_item(0, 0, \"IDE = 1\", \"EXTENDED FRAME FORMAT\", dark_colors.violet, channel_color, true);\n\t\t\t\t\t\tpkt_end();\n\n\t\t\t\t\t\tval = 0;\n\n\t\t\t\t\t\tfor (c = 35; c < 39; c++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tval = (val * 2) + bits[c];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdata_size = val;\n\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[35] - (0.5 * spb) + m, bit_pos[38] + (0.5 * spb) - m); \t// Add the DLC item\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LENGTH CODE: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LENGTH: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DATA LEN: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"DLC: \");\n\t\t\t\t\t\tdec_item_add_pre_text(\"L:\");\n\t\t\t\t\t\tdec_item_add_data(val);\n\n\t\t\t\t\t\tif (hex_opt > 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\thex_add_byte(ch, -1, -1, val);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tpkt_add_item(t.sample, t.sample + spb - m, \"DLC\", int_to_str_hex(val), dark_colors.orange, channel_color,true);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (rtr_mode == false)\n\t\t\t\t{\n\t\t\t\t\tstate = GET_DATA;\n\t\t\t\t}\n\t\t\t\telse\t// Skip the data in case of RTR frame\n\t\t\t\t{\n\t\t\t\t\tstate = GET_CRC;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase GET_DATA:\n\t\t\t\tdb = 0;\n\t\t\t\tif(edl_mode)\n\t\t\t\t{\n\t\t\t\t\tbit_sampler_ini(ch,spb_hs /2, spb_hs); \t// use High speed since now\n\t\t\t\t}\n\n\t\t\t\twhile (db < (data_size * 8)) \t// Read data bits\n\t\t\t\t{\n\t\t\t\t\tif (sb == 4)\n\t\t\t\t\t{\n\t\t\t\t\t\tstuffing_ok = check_stuffing();\t\t// Stuffed bit\n\n\t\t\t\t\t\tif (stuffing_ok == false)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tsb = 0;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tbits[b] = bit_sampler_next(ch);\t\t// Regular bitif( (last_bit == 1)&&(bits[b] == 0) )\n\t\t\t\t\t\tif( (last_bit == 1)&&(bits[b] == 0) )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(edl_mode)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttrs_tmp = trs_get_prev(ch);\n\t\t\t\t\t\t\t\tframe_length_in_sample = trs_tmp.sample - s + spb_hs/2;\n\t\t\t\t\t\t\t\tbit_pos.push(trs_tmp.sample + spb_hs/2); \t\t// Store the position of that bit\n\t\t\t\t\t\t\t\tdec_item_add_sample_point(ch, trs_tmp.sample + spb_hs/2, DRAW_POINT);\n\t\t\t\t\t\t\t\tbit_sampler_ini(ch,spb_hs / 2, spb_hs);\n\t\t\t\t\t\t\t\tbit_sampler_next(ch);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttrs_tmp = trs_get_prev(ch);\n\t\t\t\t\t\t\t\tframe_length_in_sample = trs_tmp.sample - s + spb/2;\n\t\t\t\t\t\t\t\tbit_pos.push(trs_tmp.sample + spb/2); \t\t// Store the position of that bit\n\t\t\t\t\t\t\t\tdec_item_add_sample_point(ch, trs_tmp.sample + spb/2, DRAW_POINT);\n\t\t\t\t\t\t\t\tbit_sampler_ini(ch,spb / 2, spb);\n\t\t\t\t\t\t\t\tbit_sampler_next(ch);\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{\n\t\t\t\t\t\t\tbit_pos.push(s + frame_length_in_sample); \t\t// Store the position of that bit\n\t\t\t\t\t\t\tdec_item_add_sample_point(ch, s + frame_length_in_sample, DRAW_POINT);\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\tif (bits[b] == last_bit)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsb++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tsb = 0;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlast_bit = bits[b];\n\t\t\t\t\t\tb++;\n\t\t\t\t\t\tdb++;\n\t\t\t\t\t}\n\n\t\t\t\t\trb++;\n\t\t\t\t\tif(!edl_mode)\n\t\t\t\t\t\tframe_length_in_sample += spb;\n\t\t\t\t\telse\n\t\t\t\t\t\tframe_length_in_sample += spb_hs;\n\n\t\t\t\t}\n\n\t\t\t\tif (stuffing_ok == false)\n\t\t\t\t{\n\t\t\t\t\tt = trs_go_after(ch,bit_pos[b - 1] + (10.5 * spb));\n\t\t\t\t\tset_progress(100 * t.sample / n_samples);\n\t\t\t\t\tstate = GET_SOF;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tb -= (data_size * 8);\t// Now interpret those bits as bytes\n\t\t\t\tpkt_data = \"\";\n\n\t\t\t\tfor (i = 0; i < data_size; i++)\n\t\t\t\t{\n\t\t\t\t\tval = 0;\n\n\t\t\t\t\tfor (c = 0; c < 8; c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tval = (val * 2) + bits[b + (i * 8) + c];\n\t\t\t\t\t}\n\t\t\t\t\tif(!edl_mode)\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[b + (i * 8)] - (0.5 * spb) + m, bit_pos[b + (i * 8) + 7] + (0.5 * spb) - m); \t// Add the ID item\n\t\t\t\t\telse\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[b + (i * 8)] - (0.5 * spb_hs) + m_hs, bit_pos[b + (i * 8) + 7] + (0.5 * spb_hs) - m_hs); \t// Add the ID item\n\t\t\t\t\tdec_item_add_pre_text(\"DATA: \");\n\t\t\t\t\tdec_item_add_pre_text(\"D: \");\n\t\t\t\t\tdec_item_add_pre_text(\"D \");\n\t\t\t\t\tdec_item_add_data(val);\n\t\t\t\t\thex_add_byte(ch, -1, -1, val);\n\n\t\t\t\t\tpkt_data += int_to_str_hex(val) + \" \";\n\t\t\t\t}\n\n\t\t\t\tif(!edl_mode)\n\t\t\t\t\tpkt_add_item(bit_pos[b] - (0.5 * spb), bit_pos[b + ((data_size - 1) * 8) + 7] + (0.5 * spb), \"DATA\", pkt_data, dark_colors.gray, channel_color);\n\t\t\t\telse\n\t\t\t\t\tpkt_add_item(bit_pos[b] - (0.5 * spb_hs), bit_pos[b + ((data_size - 1) * 8) + 7] + (0.5 * spb_hs), \"DATA\", pkt_data, dark_colors.gray, channel_color);\n\n\t\t\t\tb += (data_size * 8);\n\t\t\t\tstate = GET_CRC;\n\n\t\t\t\t// TO DO:\n\t\t\t\t// correct all start and end samples\n\t\t\t\t// add packet for CRC, and error frames\n\t\t\t\t// add the packet stop\n\t\t\tbreak;\n\n\t\t\tcase GET_CRC:\n\t\t\t\tvar nbr_stf_b = 0;\n\t\t\t\tdb = 0;\n\t\t\t\tif(edl_mode)\n\t\t\t\t{\n\t\t\t\t\tbit_sampler_ini(ch,spb_hs /2, spb_hs); \t// use High speed since now\n\n\t\t\t\t\twhile (db-nbr_stf_b < crc_len) //read crc bits\n\t\t\t\t\t{\n\t\t\t\t\t\tif (db % 5 ==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbit_sampler_next(ch);\n\t\t\t\t\t\t\tdec_item_add_sample_point(ch, s + frame_length_in_sample, DRAW_CROSS);\n\t\t\t\t\t\t\tdb++;\n\t\t\t\t\t\t\tnbr_stf_b++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbits[b] = bit_sampler_next(ch);\t // Regular bit\n\t\t\t\t\t\t\tif( (last_bit == 1)&&(bits[b] == 0) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttrs_tmp = trs_get_prev(ch);\n\t\t\t\t\t\t\t\tframe_length_in_sample = trs_tmp.sample - s + spb_hs/2;\n\t\t\t\t\t\t\t\tbit_pos.push(trs_tmp.sample + spb_hs/2); \t\t// Store the position of that bit\n\t\t\t\t\t\t\t\tdec_item_add_sample_point(ch, trs_tmp.sample + spb_hs/2, DRAW_POINT);\n\t\t\t\t\t\t\t\tbit_sampler_ini(ch,spb_hs / 2, spb_hs);\n\t\t\t\t\t\t\t\tbit_sampler_next(ch);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbit_pos.push(s + frame_length_in_sample); \t\t// Store the position of that bit\n\t\t\t\t\t\t\t\tdec_item_add_sample_point(ch, s + frame_length_in_sample, DRAW_POINT);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlast_bit = bits[b];\n\n\t\t\t\t\t\t\tb++;\n\t\t\t\t\t\t\tdb++;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\trb++;\n\t\t\t\t\t\tframe_length_in_sample += spb_hs;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (stuffing_ok == false)\n\t\t\t\t\t{\n\t\t\t\t\t\tt = trs_go_after(ch, bit_pos[b - 1] + (10.5 * spb));\n\t\t\t\t\t\tset_progress(100 * t.sample / n_samples);\n\t\t\t\t\t\tstate = GET_SOF;\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tval = 0;\n\t\t\t\t\tb -= crc_len;\n\n\t\t\t\t\tfor (c = 0; c < crc_len; c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tval = (val * 2) + bits[b + c];\n\t\t\t\t\t}\n\n\t\t\t\t\tcrc_rg = 0;\t\t// Now calculate our own crc to compare\n\n\n\t\t\t\t\tfor (c = 1; c < b; c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcrc_nxt = bits[c] ^ ((crc_rg >> (crc_len)) & 0x1);\n\t\t\t\t\t\tcrc_rg = crc_rg << 1;\n\n\t\t\t\t\t\tif (crc_nxt == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (crc_len==17)\n\t\t\t\t\t\t\t\tcrc_rg ^= 0x3685B;\n\t\t\t\t\t\t\telse if (crc_len==21)\n\t\t\t\t\t\t\t\tcrc_rg ^= 0x302898;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (crc_len==17)\n\t\t\t\t\t\t\tcrc_rg &= 0x1ffff;\n\t\t\t\t\t\telse if (crc_len==21)\n\t\t\t\t\t\t\tcrc_rg &= 0x1fffff\n\t\t\t\t\t}\n\n\t\t\t\t\tdec_item_new(ch, bit_pos[b] - (0.5 * spb_hs) + m_hs, bit_pos[b + crc_len-1] + (0.5 * spb_hs) - m_hs); \t// Add the ID item\n\t\t\t\t\tdec_item_add_pre_text(\"CRC : \");\n\t\t\t\t\tdec_item_add_pre_text(\"CRC \");\n\t\t\t\t\tdec_item_add_pre_text(\"CRC\");\n\t\t\t\t\tdec_item_add_data(val);\n\n\t\t\t\t\tif (hex_opt > 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar tmp_val = (val >> 8);\n\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_val);\n\t\t\t\t\t\ttmp_val = (val & 0xFF);\n\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_val);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (val == crc_rg)\n\t\t\t\t\t{\n\t\t\t\t\t\tdec_item_add_post_text(\" OK\");\n\t\t\t\t\t\tdec_item_add_post_text(\" OK\");\n\t\t\t\t\t\tdec_item_add_post_text(\"\");\n\t\t\t\t\t\tpkt_add_item(-1, -1 ,\"CRC\", int_to_str_hex(val) + \" OK\", dark_colors.yellow, channel_color);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdec_item_add_post_text(\" WRONG, Should be: \" + int_to_str_hex(crc_rg));\n\t\t\t\t\t\tdec_item_add_post_text(\" WRONG!\");\n\t\t\t\t\t\tdec_item_add_post_text(\"E!\");\n\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"CRC\", int_to_str_hex(val) + \"(WRONG)\", dark_colors.red, channel_color);\n\n\t\t\t\t\t\tpkt_start(\"CRC ERROR\");\n\t\t\t\t\t\tpkt_add_item(0, 0, \"CRC (captured)\",int_to_str_hex(val), dark_colors.red, channel_color);\n\t\t\t\t\t\tpkt_add_item(0, 0, \"CRC (calculated)\", int_to_str_hex(crc_rg), dark_colors.red, channel_color);\n\t\t\t\t\t\tpkt_end();\n\n\t\t\t\t\t\tdec_item_add_post_text(\"!\");\n\t\t\t\t\t}\n\n\t\t\t\t\tb += crc_len-1;\n\t\t\t\t\tbit_pos[b] += spb;\n\t\t\t\t\tstate = GET_ACK;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\twhile (db < 16) //read crc bits\n\t\t\t\t\t{\n\t\t\t\t\t\tif (sb == 4)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tstuffing_ok = check_stuffing();\t\t// Stuffed bit\n\n\t\t\t\t\t\t\tif (stuffing_ok == false)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsb = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tbits[b] = bit_sampler_next(ch);\t // Regular bit\n\t\t\t\t\t\t\tif( (last_bit == 1)&&(bits[b] == 0) )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttrs_tmp = trs_get_prev(ch);\n\t\t\t\t\t\t\t\tframe_length_in_sample = trs_tmp.sample - s + spb/2;\n\t\t\t\t\t\t\t\tbit_pos.push(trs_tmp.sample + spb/2); \t\t// Store the position of that bit\n\t\t\t\t\t\t\t\tdec_item_add_sample_point(ch, trs_tmp.sample + spb/2, DRAW_POINT);\n\t\t\t\t\t\t\t\tbit_sampler_ini(ch,spb / 2, spb);\n\t\t\t\t\t\t\t\tbit_sampler_next(ch);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbit_pos.push(s + frame_length_in_sample); \t\t// Store the position of that bit\n\t\t\t\t\t\t\t\tdec_item_add_sample_point(ch, s + frame_length_in_sample, DRAW_POINT);\n\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t\tif (bits[b] == last_bit)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tsb++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tsb = 0;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tlast_bit = bits[b];\n\t\t\t\t\t\t\tb++;\n\t\t\t\t\t\t\tdb++;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\trb++;\n\t\t\t\t\t\tif(!edl_mode)\n\t\t\t\t\t\t\tframe_length_in_sample += spb;\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tframe_length_in_sample += spb_hs;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (stuffing_ok == false)\n\t\t\t\t\t{\n\t\t\t\t\t\tt = trs_go_after(ch, bit_pos[b - 1] + (10.5 * spb));\n\t\t\t\t\t\tset_progress(100 * t.sample / n_samples);\n\t\t\t\t\t\tstate = GET_SOF;\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tval = 0;\n\t\t\t\t\tb -= 16;\n\n\t\t\t\t\tfor (c = 0; c < 15; c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tval = (val * 2) + bits[b + c];\n\t\t\t\t\t}\n\n\t\t\t\t\tcrc_rg = 0;\t\t// Now calculate our own crc to compare\n\n\t\t\t\t\tfor (c = 0; c < b; c++)\n\t\t\t\t\t{\n\t\t\t\t\t\tcrc_nxt = bits[c] ^ ((crc_rg >> 14) & 0x1);\n\t\t\t\t\t\tcrc_rg = crc_rg << 1;\n\n\t\t\t\t\t\tif (crc_nxt == 1)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcrc_rg ^= 0x4599;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcrc_rg &= 0x7fff;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!edl_mode)\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[b] - (0.5 * spb) + m, bit_pos[b + 14] + (0.5 * spb) - m); \t// Add the ID item\n\t\t\t\t\telse\n\t\t\t\t\t\tdec_item_new(ch, bit_pos[b] - (0.5 * spb_hs) + m_hs, bit_pos[b + 14] + (0.5 * spb_hs) - m_hs); \t// Add the ID item\n\t\t\t\t\tdec_item_add_pre_text(\"CRC : \");\n\t\t\t\t\tdec_item_add_pre_text(\"CRC \");\n\t\t\t\t\tdec_item_add_pre_text(\"CRC\");\n\t\t\t\t\tdec_item_add_data(val);\n\n\t\t\t\t\tif (hex_opt > 1)\n\t\t\t\t\t{\n\t\t\t\t\t\tvar tmp_val = (val >> 8);\n\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_val);\n\t\t\t\t\t\ttmp_val = (val & 0xFF);\n\t\t\t\t\t\thex_add_byte(ch, -1, -1, tmp_val);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (val == crc_rg)\n\t\t\t\t\t{\n\t\t\t\t\t\tdec_item_add_post_text(\" OK\");\n\t\t\t\t\t\tdec_item_add_post_text(\" OK\");\n\t\t\t\t\t\tdec_item_add_post_text(\"\");\n\t\t\t\t\t\tpkt_add_item(-1, -1 ,\"CRC\", int_to_str_hex(val) + \" OK\", dark_colors.yellow, channel_color);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tdec_item_add_post_text(\" WRONG, Should be: \" + int_to_str_hex(crc_rg));\n\t\t\t\t\t\tdec_item_add_post_text(\" WRONG!\");\n\t\t\t\t\t\tdec_item_add_post_text(\"E!\");\n\n\t\t\t\t\t\tpkt_add_item(-1, -1, \"CRC\", int_to_str_hex(val) + \"(WRONG)\", dark_colors.red, channel_color);\n\n\t\t\t\t\t\tpkt_start(\"CRC ERROR\");\n\t\t\t\t\t\tpkt_add_item(0, 0, \"CRC (captured)\",int_to_str_hex(val), dark_colors.red, channel_color);\n\t\t\t\t\t\tpkt_add_item(0, 0, \"CRC (calculated)\", int_to_str_hex(crc_rg), dark_colors.red, channel_color);\n\t\t\t\t\t\tpkt_end();\n\n\t\t\t\t\t\tdec_item_add_post_text(\"!\");\n\t\t\t\t\t}\n\n\t\t\t\t\tb += 15;\n\t\t\t\t\tstate = GET_ACK;\n\t\t\t\t}\n\t\t\tbreak;\n\n\t\t\tcase GET_ACK: \t// and the EOF too.\n\t\t\t\tbit_pos[b] -= spb;// CRC delimiter\n\t\t\t\tack_chk = bit_sampler_next(ch);\n\t\t\t\tbit_sampler_next(ch); \t// ACK delimiter\n\n\t\t\t\tif(!edl_mode)\n\t\t\t\t\tdec_item_new(ch,bit_pos[b] + (1.5 * spb) + m, bit_pos[b] + (3.5 * spb) - m); \t// Add the ACK item\n\t\t\t\telse\n\t\t\t\t\tdec_item_new(ch,bit_pos[b] + (2.5 * spb_hs) + m, bit_pos[b] + (2.5 * spb_hs) + 2*spb - m); \t// Add the ACK item\n\n\t\t\t\tif(ack_chk == 1)\n\t\t\t\t{\n\t\t\t\t\tdec_item_add_pre_text(\"NO ACK\");\n\t\t\t\t\tdec_item_add_pre_text(\"NACK\");\n\t\t\t\t\tdec_item_add_pre_text(\"!A\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdec_item_add_pre_text(\"ACK\");\n\t\t\t\t\tdec_item_add_pre_text(\"ACK\");\n\t\t\t\t\tdec_item_add_pre_text(\"A\");\n\t\t\t\t}\n\t\t\t\tpkt_add_item(-1, -1, \"ACK\", ack_chk.toString(10), dark_colors.black, channel_color);\n\t\t\t\teof_chk = 0;\n\t\t\t\tfor (c = 0; c < 7; c++)\n\t\t\t\t{\n\t\t\t\t\teof_chk += bit_sampler_next(ch);\n\t\t\t\t}\n\n\t\t\t\tif(!edl_mode)\n\t\t\t\t\tdec_item_new(ch, bit_pos[b] + (3.5 * spb) + m, bit_pos[b] + (10.5 * spb) - m); \t// Add the EOF item\n\t\t\t\telse\n\t\t\t\t\tdec_item_new(ch, bit_pos[b] + (2.5 * spb_hs) + 2*spb - m, bit_pos[b] + (2.5 * spb_hs) + 9*spb - m); \t// Add the EOF item\n\n\t\t\t\tif (eof_chk == 7)\n\t\t\t\t{\n\t\t\t\t\tdec_item_add_pre_text(\"END OF FRAME OK\");\n\t\t\t\t\tdec_item_add_pre_text(\"EOF OK\");\n\t\t\t\t\tdec_item_add_pre_text(\"EOF\");\n\t\t\t\t\tdec_item_add_pre_text(\"E\");\n\t\t\t\t\tpkt_add_item(-1, -1, \"EOF\", \"\", dark_colors.blue, channel_color);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdec_item_add_pre_text(\"END OF FRAME ERR\");\n\t\t\t\t\tdec_item_add_pre_text(\"EOF ERR!\");\n\t\t\t\t\tdec_item_add_pre_text(\"!EOF!\");\n\t\t\t\t\tdec_item_add_pre_text(\"!E!\");\n\t\t\t\t\tdec_item_add_pre_text(\"!\");\n\t\t\t\t\tpkt_add_item(-1, -1, \"EOF\",\"MISSING!\", dark_colors.red, channel_color);\n\t\t\t\t}\n\n\t\t\t\tpkt_end();\n\n\t\t\t\tt = trs_go_after(ch, bit_pos[b] + (10.5 * spb));\n\t\t\t\tset_progress(100 * t.sample / n_samples);\n\t\t\t\tstate = GET_SOF;\n\t\t\t\t//dec_item_new(ch, bit_pos[0] - (0.5 * spb) + m, bit_pos[b] + (0.5 * spb) - m); \t//<=========================DEBUG ALL THE FRAME\n\t\t\tbreak;\n\t\t}\n\t}\n}", "function sendCompleted(usbEvent) {\n\tif (chrome.runtime.lastError) {\n\t\tconsole.error(\"sendCompleted Error:\", chrome.runtime.lastError.message);\n\t}\n\n\tif (usbEvent) {\n\t\tif (usbEvent.data) {\n\t\t\tvar buf = new Uint8Array(usbEvent.data);\n\t\t\tconsole.log(\"sendCompleted Buffer:\", usbEvent.data.byteLength, buf);\n\t\t}\n\t\tif (usbEvent.resultCode !== 0) {\n\t\t\tchangeState(state.connected);\n\t\t\terrorln(\"Error writing to device: \" + chrome.runtime.lastError.message);\n\t\t}\n\t}\n}", "getPower() {\n console.log('getPower called');\n\n return this.getLampResURI()\n .then(response => {\n return response.power.value;\n });\n }", "function getvolume(dev, callback)\n{\n if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null)\n {\n if (typeof (dev) === 'undefined' || dev === null || dev.length < 1) dev = '-15';\n webphone_api.plhandler.GetVolume(dev, callback);\n }\n}", "function getBzData(uri, method) {\n var dfd = $.Deferred();\n\n // defer get binary\n var request = new XMLHttpRequest();\n request.onload = function () {\n // Process the response\n if (request.status >= 200 && request.status < 300) {\n // If successful\n console.log('request-received');\n\n var bytes = bz2.decompress(new Uint8Array(request.response));\n var jsonObj = JSON.parse(utfDecoder.decode(bytes));\n dfd.resolve(jsonObj);\n } else {\n // If failed\n dfd.reject({\n status: request.status,\n statusText: request.statusText\n });\n }\n }\n request.open('GET', uri, true);\n request.responseType = \"arraybuffer\";\n request.send();\n\n return dfd.promise();\n }", "function getHumidity(){\n execFile('./scripts/humidity', ['hum'], (error, stdout, stderr) => {\n if (error) {\n console.error('stderr', stderr);\n throw error;\n }\n console.log('hum: ' + stdout);\n readData.hum = stdout\n })\n}", "function onEvent(usbEvent) {\n\tconsole.log(\"onEvent\");\n\tif (usbEvent.resultCode) {\n\t\tif (usbEvent.resultCode == USB_ERROR_TRANSFER_FAILED) {\n\t\t\t// Device is connected but we failed to send data.\n\t\t\tchangeState(state.connected);\n\t\t} else if (usbEvent.resultCode == USB_ERROR_DEVICE_DISCONNECTED) {\n\t\t\tchangeState(state.disconnected);\n\t\t}\n\t\tconsole.log(chrome.runtime.lastError.message + \"(code: \" + usbEvent.resultCode + \") [onEvent]\");\n\t\treturn;\n\t}\n\n\tvar dv = new DataView(usbEvent.data);\n\tvar len = dv.getUint8(0);\n\tvar cmd = dv.getUint8(1);\n\n\tswitch (cmd) {\n\t\tcase CMD_DEBUG:\n\t\t{\n\t\t\tvar msg = \"\";\n\t\t\tfor (var i = 0; i < len; i++) {\n\t\t\t\tmsg += String.fromCharCode(dv.getUint8(i+2));\n\t\t\t}\n\t\t\tmessageln(\"<b>debug:</b> '\" + msg + \"'\");\n\t\t\tbreak;\n\t\t}\n\t\tcase CMD_PING:\n\t\t\tmessageln(\"<b>ping</b>\");\n\t\t\tbreak;\n\t\tcase CMD_VERSION:\n\t\t{\n\t\t\tvar version = \"\" + dv.getUint8(2) + \".\" + dv.getUint8(3);\n\t\t\tmessageln(\"<b>command:</b> Version \" + version);\n\t\t\tbreak;\n\t\t}\n\t\tdefault:\n\t\t\terrorln(\"unknown command\");\n\t\t\tbreak;\n\t}\n\n\tchrome.usb.interruptTransfer(mp_device, in_transfer, onEvent);\n}", "async function enableBloodPressure() {\n const command = hexToBase64(\"55 aa 04 02 01 f8\");\n // console.log(\"TCL: enableBloodPressure -> command\", command)\n const didWrite = await Bluetooth.writeToDevice(command);\n // console.log(\"TCL: enableBloodPressure -> didWrite\", didWrite)\n return didWrite;\n}", "_pingDevice () {\n this._ble.read(\n BoostBLE.service,\n BoostBLE.characteristic,\n false\n );\n }", "RetrieveBeaconBlock(blockHash = '', verbosity = '1') {}", "async function requestBarcodePrinter() {\n console.log(navigator)\n navigator.usb &&\n navigator.usb\n .requestDevice({\n filters: [\n {\n vendorId: 5380,\n // classCode: 0xff, // vendor-specific\n // protocolCode: 0x01,\n },\n ],\n })\n .then(selectedDevice => {\n setBarcodePrinter(selectedDevice)\n })\n .catch(errorInfo => {\n console.log(errorInfo)\n // message.error(i18n.t`Cannot find label printer`)\n })\n }", "async GetValueBytes(id, command) {\n var packet = new DpsPacket(id, DpsConstants.sender, command, [0,0,0,0,0,0,0,0]);\n var result = await this.PacketIO(packet);\n if ((result && (result.sender != id || result.command != command)) || result == null) return null;\n else return result.data;\n }", "scan (){\n this.comm.getDeviceList().then(result => {\n this.runtime.emit(this.runtime.constructor.PERIPHERAL_LIST_UPDATE, result);\n });\n }", "scan (){\n this.comm.getDeviceList().then(result => {\n this.runtime.emit(this.runtime.constructor.PERIPHERAL_LIST_UPDATE, result);\n });\n }", "scan (){\n this.comm.getDeviceList().then(result => {\n this.runtime.emit(this.runtime.constructor.PERIPHERAL_LIST_UPDATE, result);\n });\n }", "scan (){\n this.comm.getDeviceList().then(result => {\n this.runtime.emit(this.runtime.constructor.PERIPHERAL_LIST_UPDATE, result);\n });\n }", "XXX_start_dfu(program_mode , image_size_packet) { //see sendStartPacket\n return new Promise((resolve, reject) => {\n var BAprogram_mode = Buffer.alloc( 1, [ (program_mode & 0x000000ff) ]);\n console.log(\"Sending 'START DFU' command\");\n this._send_control_data(/*DfuOpcodesBle.START_DFU*/ 0x01, BAprogram_mode) // 0x01 0x04\n .then( () => this._send_packet_data(image_size_packet) )\n .then( () => this.waitForControlNotify( /*this.get_received_response, true, 10.0, 'response for START DFU'*/) )\n .then( () => {/*console.log('$%#&%#&%#%#%#');*/ resolve() }) ////WTFWTFWTF\n //TODO .then( () => this._clear_received_response() )\n });\n }", "async function op5(numero, quantidade) {\n\t\n\tvar ubereats = await tools.curl('https://cn-phx2.cfe.uber.com/rt/silk-screen/submit-form', `{\"formContainerAnswer\":{\"formAnswer\":{\"flowType\":\"INITIAL\",\"screenAnswers\":[{\"screenType\":\"PHONE_NUMBER_INITIAL\",\"fieldAnswers\":[{\"fieldType\":\"PHONE_COUNTRY_CODE\",\"phoneCountryCode\":\"55\"},{\"fieldType\":\"PHONE_NUMBER\",\"phoneNumber\":\"${numero}\"},{\"fieldType\":\"THIRD_PARTY_CLIENT_ID\",\"thirdPartyClientID\":\"\"}]}],\"firstPartyClientID\":\"\"}}}`, {\n\t\t'Host': 'cn-phx2.cfe.uber.com',\n\t\t'x-uber-client-name': 'eats',\n\t\t'x-uber-device': 'android',\n\t\t'x-uber-device-language': 'pt_BR',\n\t\t'x-uber-client-version': '1.277.10005',\n\t\t'accept': 'application/json',\n\t\t'content-type': 'application/json; charset=UTF-8',\n\t\t'user-agent': 'okhttp/3.12.0-uber2'\n\t\t}, 'POST').then((res) => {\n\t\t\tif (res.body.match(/SIGN_IN/i)) {\n\t\t\t\t\n\t\t\t\tif (spam.enviados == 0) {\n\t\t\t\t\tb1.start(quantidade, 0, {\n\t\t\t\t\t\tenviados: spam.enviados\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tspam.enviados++\n\t\t\t\tspam.status = 1\n\t\t\t\tb1.update(spam.enviados, {\n\t\t\t\t\tenviados: spam.enviados\n\t\t\t\t});\n\t\t\t\t// console.log('Sucesso » [ Numero: %s, Enviados: %s, Retorno: SMS enviado com sucesso. ] #ServerMP'.success, numero, spam.enviados);\n\t\t\t} else if (res.body.match(/SMS_OTP_TOO_MANY_REQUESTS/i)) {\n\t\t\t\tconsole.clear();\n\t\t\t\tprocess.exit(console.log('Falhou » [ Excesso de tentativas, tente novamente em breve. ] #ServerMP'.error));\n\t\t\t} else if (res.body.match(/BANNED/)) {\n\t\t\t\tconsole.clear();\n\t\t\t\tprocess.exit(console.log('Falhou » [ Numero inserido está com conta desativada. ] #ServerMP'.error));\n\t\t\t} else {\n\t\t\t\tconsole.clear();\n\t\t\t\tprocess.exit(console.log('Falhou » [ Ocorreu um error desconhecido. ] #ServerMP'.error));\n\t\t\t}\n\t});\n\t\n\t// Verificar se o spam ja foi finalizado.\n\tif (quantidade == spam.enviados) {\n\t\tb1.start(quantidade, quantidade, {\n\t\t\tenviados: spam.enviados\n\t\t});\n\t\tprocess.exit(console.log('\\n\\nAtaque finalizado! #ServerMP'.help));\n\t} else {\n\t\top5(numero, quantidade);\n\t}\n\t\n}", "async function writepumpdurationtoBLE(num){\n console.log('Attempting bluetooth write')\n var arrInt8 = toBytesInt16(num)\n ble.twrite_pumpduration=performance.now()\n try{\n await ble.writepumpdurationcharacteristic.writeValue(arrInt8)\n var textstr = 'wrote ble val >> ' + num + ', byte values ' + arrInt8\n console.log(textstr)\n ble.statustext = textstr\n // \n //wdm(textstr)\n }\n catch(error) {\n var textstr = 'Could not write pump duration to ble device'\n console.log(textstr)\n ble.statustext = ble.statustext + \"<br>\" + textstr\n \n }\n}", "function cerial() {\n getPortInfo()\n .then( (portDetails) => handleSensor(portDetails))\n .catch((error) => console.log(error));\n // port.write('ROBOT PLEASE RESPOND\\n');\n // The parser will emit any string response\n}", "function get24HBTCData() {\r\n\tvar result;\r\n\tvar request = new XMLHttpRequest();\r\n\trequest.open('GET',\r\n\t\t'https://min-api.cryptocompare.com/data/v2/histohour?fsym=BTC&tsym=USD&limit=24&api_key=45419ed9fb65b31861ccb009765d97bb619e9eccedc722044457d066cbfb0a8b', false)\r\n\trequest.send(null);\r\n\tresult = JSON.parse(request.responseText);\r\n\treturn result;\r\n}", "function getHSDevices(filter,cbfunc){\n var options = {\n hostname: hsserver,\n path: '/jsonapi.asp?action=getdevices&filter='+filter+'&verbose=yes',\n port: hsport,\n headers: {\n 'Authorization': auth\n }\n };\n\n http.get(options, function(response) {\n var body = '';\n response.on('data', function(d) {body += d;});\n response.on('end', function() {cbfunc(JSON.parse(body));});\n\t response.on(\"error\",function(e){log(\"Got error: \" + e.message); });\n });\n}", "function Bus_Phase(decoder_items) // 65001-65006\n{\n var str = \"\";\n switch (data_nb)\n {\n case 0 :\n {\n start_item = decoder_items.start_sample_index;\n multi_byte_value = hex_value;\n skip_item = true;\n break;\n }\n case 1 :\n {\n multi_byte_value += (hex_value<<8);\n ScanaStudio.dec_item_new(decoder_items.channel_index,start_item, decoder_items.end_sample_index);\n ScanaStudio.dec_item_add_content(\"Line-Line AC RMS Voltage : \" + (multi_byte_value.toString().replace(/(\\d)(?=(\\d{3})+\\b)/g,'$1 ')) + \" V\");\n ScanaStudio.dec_item_add_content((multi_byte_value.toString().replace(/(\\d)(?=(\\d{3})+\\b)/g,'$1 ')) + \" V\");\n ScanaStudio.dec_item_end();\n // Packet View\n ScanaStudio.packet_view_add_packet(false,\n decoder_items.channel_index,\n start_item,\n decoder_items.end_sample_index,\n \"Data\",\n (\"Line-Line Voltage : \" + (multi_byte_value.toString().replace(/(\\d)(?=(\\d{3})+\\b)/g,'$1 ')) + \" V\"),\n ScanaStudio.PacketColors.Data.Title,\n ScanaStudio.PacketColors.Data.Content);\n skip_item = true;\n break;\n }\n case 2 :\n {\n start_item = decoder_items.start_sample_index;\n multi_byte_value = hex_value;\n skip_item = true;\n break;\n }\n case 3 :\n {\n multi_byte_value += (hex_value<<8);\n ScanaStudio.dec_item_new(decoder_items.channel_index,start_item, decoder_items.end_sample_index);\n ScanaStudio.dec_item_add_content(\"Line-Neutral AC RMS Voltage : \" + (multi_byte_value.toString().replace(/(\\d)(?=(\\d{3})+\\b)/g,'$1 ')) + \" V\");\n ScanaStudio.dec_item_add_content((multi_byte_value.toString().replace(/(\\d)(?=(\\d{3})+\\b)/g,'$1 ')) + \" V\");\n ScanaStudio.dec_item_end();\n // Packet View\n ScanaStudio.packet_view_add_packet(false,\n decoder_items.channel_index,\n start_item,\n decoder_items.end_sample_index,\n \"Data\",\n (\"Line-Neutral Voltage : \" + (multi_byte_value.toString().replace(/(\\d)(?=(\\d{3})+\\b)/g,'$1 ')) + \" V\"),\n ScanaStudio.PacketColors.Data.Title,\n ScanaStudio.PacketColors.Data.Content);\n skip_item = true;\n break;\n }\n case 4 :\n {\n start_item = decoder_items.start_sample_index;\n multi_byte_value = hex_value;\n skip_item = true;\n break;\n }\n case 5 :\n {\n multi_byte_value += (hex_value<<8);\n multi_byte_value = Math.floor(multi_byte_value/128);\n ScanaStudio.dec_item_new(decoder_items.channel_index,start_item, decoder_items.end_sample_index);\n ScanaStudio.dec_item_add_content(\"AC Frequency : \" + multi_byte_value + \"Hz\");\n ScanaStudio.dec_item_add_content(multi_byte_value + \" kWh\");\n ScanaStudio.dec_item_end();\n // Packet View\n ScanaStudio.packet_view_add_packet(false,\n decoder_items.channel_index,\n start_item,\n decoder_items.end_sample_index,\n \"Data\",\n (\"AC Frequency : \" + multi_byte_value + \"Hz\"),\n ScanaStudio.PacketColors.Data.Title,\n ScanaStudio.PacketColors.Data.Content);\n skip_item = true;\n break;\n }\n default :\n {\n packet_title = \"Filled Data\";\n if (hex_value == 255)\n {\n item_content = \"Filled with 0xFF\";\n }\n else\n {\n item_content = \"0x\" + pad(hex_value.toString(16),2) + \", should be 0xFF\";\n types_title = ScanaStudio.PacketColors.Error.Title;\n types_content = ScanaStudio.PacketColors.Error.Content;\n }\n break;\n }\n }//end switch (data_nb)\n}//end function Bus_Phase_C", "function proprietary_fast_packet (decoder_items) //126720/130816/130817/130818/130819/130820/130821/130824/130827/130828/130831/130832/130834/130835/130836/130837/130838/130839/130840/130842/130843/130845/130847/130850/130851/130856/130880/130881/130944\n{\n var str = \"\";\n switch (fast_packet_byte)\n {\n case 1 :\n {\n start_item = decoder_items.start_sample_index;\n multi_byte_value = hex_value;\n skip_item = true;\n break;\n }\n case 2 :\n {\n var manufacturer_code = multi_byte_value + (((hex_value>>5)&0x7)<<8);\n var reserved = (hex_value>>3)&0x3;\n var industry_code = hex_value&0x7;\n end_item = decoder_items.start_sample_index + (decoder_items.end_sample_index - decoder_items.start_sample_index)/8*3;\n str = LOOKUP_MANUFACTURER(manufacturer_code);\n ScanaStudio.dec_item_new(decoder_items.channel_index, start_item, end_item);\n ScanaStudio.dec_item_add_content(\"Manufacturer Code : \" + str);\n ScanaStudio.dec_item_add_content(\"\" + str);\n ScanaStudio.dec_item_add_content(str);\n ScanaStudio.dec_item_end();\n // Packet View\n ScanaStudio.packet_view_add_packet(false,\n decoder_items.channel_index,\n start_item,\n end_item,\n \"Fast Packet Data\",\n (\"Manufacturer Code : \" + str),\n ScanaStudio.PacketColors.Data.Title,\n ScanaStudio.PacketColors.Data.Content);\n start_item = end_item;\n end_item = decoder_items.start_sample_index + (decoder_items.end_sample_index - decoder_items.start_sample_index)/8*5;\n ScanaStudio.dec_item_new(decoder_items.channel_index, start_item, end_item);\n ScanaStudio.dec_item_add_content(\"Reserved : 0x\" + pad(reserved.toString(16),1));\n ScanaStudio.dec_item_add_content(\"Reserved\");\n ScanaStudio.dec_item_end();\n // Packet View\n ScanaStudio.packet_view_add_packet(false,\n decoder_items.channel_index,\n start_item,\n end_item,\n \"Fast Packet Data\",\n (\"Reserved : 0x\" + pad(reserved.toString(16),1)),\n ScanaStudio.PacketColors.Data.Title,\n ScanaStudio.PacketColors.Data.Content);\n str = LOOKUP_INDUSTRY_CODE(industry_code);\n ScanaStudio.dec_item_new(decoder_items.channel_index, end_item, decoder_items.end_sample_index);\n ScanaStudio.dec_item_add_content(\"Industry Code : \" + str);\n ScanaStudio.dec_item_add_content(str);\n ScanaStudio.dec_item_end();\n // Packet View\n ScanaStudio.packet_view_add_packet(false,\n decoder_items.channel_index,\n end_item,\n decoder_items.end_sample_index,\n \"Fast Packet Data\",\n (\"Industry Code : \" + str),\n ScanaStudio.PacketColors.Data.Title,\n ScanaStudio.PacketColors.Data.Content);\n skip_item = true;\n break;\n }\n default :\n {\n packet_title = \"Byte n°\" + fast_packet_byte;\n item_content = \"0x\" + pad(hex_value.toString(16),2);\n break;\n }\n }\n}", "loadSample(url, name, callback)\n {\n let request = new XMLHttpRequest();\n request.open('GET', url, true);\n request.responseType = 'arraybuffer';\n request.onload = function()\n {\n let audioData = request.response;\n drummachineInst.audioContext.decodeAudioData(audioData, function(buffer)\n {\n callback(buffer,name);\n });\n };\n request.send();\n }", "function GetDeviceIP(){\n showBackgroundImage('wait_message');\n getContent('','/cgi-bin/setup.cgi?GetDeviceIP','function:ShowGetDeviceIP');\n}", "function BYB_GetBalance() { \n var bybrequest = {\n \"id\" : \"BYB\",\n \"name\" : \"Bybit\",\n \"apikey\" : '•••••••••',\n \"secret\" : '•••••••••',\n \"command\" : \"/open-api/wallet/fund/records\",\n // \"uri\" : \"https://api.bybit.com\",\n \"uri\" : \"api-testnet.bybit.com\",\n \"apiversion\" : \"/v1/\",\n \"method\" : \"get\",\n \"payload\" : \"\"\n }; \n\n var response = BYB_PrivateRequest(bybrequest);\n Logger.log( JSON.parse(UrlFetchApp.fetch(response.uri, response.params)) );\n}", "function processDeviceCommand(request, response) {\n\t\n\tvar deviceIP = request.headers[\"tuyapi-ip\"]\n\tvar deviceID = request.headers[\"tuyapi-devid\"]\n\tvar localKey = request.headers[\"tuyapi-localkey\"]\n\tvar command = request.headers[\"tuyapi-command\"] \n\n\t//var respMsg = \"deviceCommand sending to deviceID: \" + deviceID + \" Command: \" + command;\n\tvar respMsg = \"deviceCommand sending to IP: \" + deviceIP + \" Command: \" + command;\n\tconsole.log(respMsg);\n\n\tvar device = new TuyaDevice({\n\t //ip: deviceIP,\n\t id: deviceID,\n\t key: localKey\n\t , issueGetOnConnect: false\n\t});\n\n\tdevice.on('error', error => {\n\t\tconsole.log('Error!', error);\n\t});\n\n\t(async () => {\n\t\tawait device.find();\t \n\n\t\tawait device.connect();\t \n\t\tconsole.log('Connected to device!');\n\t\tlet status = await device.get();\t \n\t\tconsole.log(`Current status: ${status}.`);\t\n\t\tswitch(command) {\n\t\t\tcase \"off\":\t\n\t\t\t\tconsole.log('Setting to false!');\n\t\t\t\tawait device.set({set: false});\n\t\t\tbreak\n\t\t\tcase \"on\":\n\t\t\t\tconsole.log('Setting to true!');\n\t\t\t\tawait device.set({set: true});\n\t\t\tbreak\n\t\t\tcase \"status\":\t\n\t\t\t\tconsole.log('Received status request!');\n\t\t\tbreak\n\t\t}\n\t\tstatus = await device.get(); \t\t \n\t\tconsole.log(`New status: ${status}.`);\t \n\t\tdevice.disconnect();\n\n\t\ttry{\n\t\t\tconsole.log(\"Sending Status to SmartThings:\" +status);\t\n\t\t\tresponse.setHeader(\"tuyapi-onoff\", status);\n\t\t\tresponse.setHeader(\"cmd-response\", status);\n\t\t\tresponse.end();\n\t\t\tconsole.log(\"Status sent to SmartThings:\" +status);\t\n\t\t}catch (err){\n\t\t\tconsole.log(\"Error:\" +err);\t\n\t\t}\n\t})();\t\n}", "prepare() {\n if (!navigator.bluetooth) {\n this.log_.warn('Bluetooth Web support is not available!');\n return;\n } else if (this.prepared) {\n return;\n }\n\n this.log_.debug('Preparing Bluetooth LowEnergy support...');\n this.devices_.prepare();\n\n this.prepared = true;\n }", "function RadioController() {\n\n var TUNER = {'vendorId': 0x0bda, 'productId': 0x2838};\n var SAMPLE_RATE = 2048000;\n var BUFS_PER_SEC = 5;\n var SAMPLES_PER_BUF = Math.floor(SAMPLE_RATE / BUFS_PER_SEC);\n var NULL_FUNC = function(){};\n var STATE = {\n OFF: 0,\n STARTING: 1,\n PLAYING: 2,\n STOPPING: 3,\n CHG_FREQ: 4,\n SCANNING: 5\n };\n var SUBSTATE = {\n USB: 1,\n TUNER: 2,\n ALL_ON: 3,\n TUNING: 4,\n PLAYING: 5\n };\n\n var decoder = new Worker('decode-worker.js');\n var player = new Player();\n var state = new State(STATE.OFF);\n var requestingBlocks = 0;\n var playingBlocks = 0;\n var frequency = 88500000;\n var stereo = true;\n var stereoEnabled = true;\n var errorHandler;\n var tuner;\n var connection;\n var ui;\n\n /**\n * Starts playing the radio.\n * @param {Function=} opt_callback A function to call when the radio\n * starts playing.\n */\n function start(opt_callback) {\n if (state.state == STATE.OFF) {\n state = new State(STATE.STARTING, SUBSTATE.USB, opt_callback);\n chrome.permissions.request(\n {'permissions': [{'usbDevices': [TUNER]}]},\n function(res) {\n if (!res) {\n state = new State(STATE.OFF);\n throwError('This app has no permission to access the USB ports.');\n } else {\n processState();\n }\n });\n } else if (state.state == STATE.STOPPING || state.state == STATE.STARTING) {\n state = new State(STATE.STARTING, state.substate, opt_callback);\n }\n }\n\n /**\n * Stops playing the radio.\n * @param {Function=} opt_callback A function to call after the radio\n * stops playing.\n */\n function stop(opt_callback) {\n if (state.state == STATE.OFF) {\n opt_callback && opt_callback();\n } else if (state.state == STATE.STARTING || state.state == STATE.STOPPING) {\n state = new State(STATE.STOPPING, state.substate, opt_callback);\n } else if (state.state != STATE.STOPPING) {\n state = new State(STATE.STOPPING, SUBSTATE.ALL_ON, opt_callback);\n }\n }\n\n /**\n * Tunes to another frequency.\n * @param {number} freq The new frequency in Hz.\n */\n function setFrequency(freq) {\n if (state.state == STATE.PLAYING || state.state == STATE.CHG_FREQ\n || state.state == STATE.SCANNING) {\n state = new State(STATE.CHG_FREQ, null, freq);\n } else {\n frequency = freq;\n ui && ui.update();\n }\n }\n\n /**\n * Returns the currently tuned frequency.\n * @return {number} The current frequency in Hz.\n */\n function getFrequency() {\n return frequency;\n }\n\n /**\n * Searches a given frequency band for a station, starting at the\n * current frequency.\n * @param {number} min The minimum frequency, in Hz.\n * @param {number} max The maximum frequency, in Hz.\n * @param {number} step The step between stations, in Hz. The step's sign\n * determines the scanning direction.\n */\n function scan(min, max, step) {\n if (state.state == STATE.PLAYING || state.state == STATE.SCANNING) {\n var param = {\n min: min,\n max: max,\n step: step,\n start: frequency\n };\n state = new State(STATE.SCANNING, SUBSTATE.TUNING, param);\n }\n }\n\n /**\n * Returns whether the radio is doing a frequency scan.\n * @return {boolean} Whether the radio is doing a frequency scan.\n */\n function isScanning() {\n return state.state == STATE.SCANNING;\n }\n\n /**\n * Returns whether the radio is currently playing.\n * @param {boolean} Whether the radio is currently playing.\n */\n function isPlaying() {\n return state.state != STATE.OFF && state.state != STATE.STOPPING;\n }\n\n /**\n * Returns whether the radio is currently stopping.\n * @param {boolean} Whether the radio is currently stopping.\n */\n function isStopping() {\n return state.state == STATE.STOPPING;\n }\n\n /**\n * Returns whether a stereo signal is being decoded.\n * @param {boolean} Whether a stereo signal is being decoded.\n */\n function isStereo() {\n return stereo;\n }\n\n /**\n * Enables or disables stereo decoding.\n * @param {boolean} enable Whether stereo decoding should be enabled.\n */\n function enableStereo(enable) {\n stereoEnabled = enable;\n ui && ui.update();\n }\n\n /**\n * Returns whether stereo decoding is enabled.\n * @return {boolean} Whether stereo decoding is enabled.\n */\n function isStereoEnabled() {\n return stereoEnabled;\n }\n\n /**\n * Saves a reference to the current user interface controller.\n * @param {Object} iface The controller. Must have an update() method.\n */\n function setInterface(iface) {\n ui = iface;\n }\n\n /**\n * Sets a function to be called when there is an error.\n * @param {Function} handler The function to call. Its only parameter\n * is the error message.\n */\n function setOnError(handler) {\n errorHandler = handler;\n }\n\n /**\n * Handles an error.\n * @param {string} msg The error message.\n */\n function throwError(msg) {\n if (errorHandler) {\n errorHandler(msg);\n } else {\n throw msg;\n }\n }\n\n /**\n * Starts the decoding pipeline.\n */\n function startPipeline() {\n // In this way we read one block while we decode and play another.\n if (state.state == STATE.PLAYING) {\n processState();\n }\n processState();\n }\n\n /**\n * Performs the appropriate action according to the current state.\n */\n function processState() {\n if (state.state == STATE.STARTING) {\n if (state.substate == SUBSTATE.USB) {\n state = new State(STATE.STARTING, SUBSTATE.TUNER, state.param);\n chrome.usb.findDevices(TUNER,\n function(conns) {\n if (conns.length == 0) {\n state = new State(STATE.OFF);\n throwError('USB tuner device not found. The Radio Receiver ' +\n 'app needs an RTL2832U-based DVB-T dongle ' +\n '(with an R820T tuner chip) to work.');\n } else {\n connection = conns[0];\n processState();\n }\n });\n } else if (state.substate == SUBSTATE.TUNER) {\n state = new State(STATE.STARTING, SUBSTATE.ALL_ON, state.param);\n tuner = new RTL2832U(connection);\n tuner.setOnError(throwError);\n tuner.open(function() {\n tuner.setSampleRate(SAMPLE_RATE, function(rate) {\n tuner.setCenterFrequency(frequency, function() {\n processState();\n })})});\n } else if (state.substate == SUBSTATE.ALL_ON) {\n var cb = state.param;\n state = new State(STATE.PLAYING);\n tuner.resetBuffer(function() {\n cb && cb();\n ui && ui.update();\n startPipeline();\n });\n }\n } else if (state.state == STATE.PLAYING) {\n ++requestingBlocks;\n tuner.readSamples(SAMPLES_PER_BUF, function(data) {\n --requestingBlocks;\n if (state.state == STATE.PLAYING) {\n if (playingBlocks <= 2) {\n ++playingBlocks;\n decoder.postMessage([data, stereoEnabled]);\n }\n }\n processState();\n });\n } else if (state.state == STATE.CHG_FREQ) {\n if (requestingBlocks > 0) {\n return;\n }\n frequency = state.param;\n ui && ui.update();\n tuner.setCenterFrequency(frequency, function() {\n tuner.resetBuffer(function() {\n state = new State(STATE.PLAYING);\n startPipeline();\n })});\n } else if (state.state == STATE.SCANNING) {\n if (requestingBlocks > 0) {\n return;\n }\n var param = state.param;\n if (state.substate == SUBSTATE.TUNING) {\n frequency += param.step;\n if (frequency > param.max) {\n frequency = param.min;\n } else if (frequency < param.min) {\n frequency = param.max;\n }\n ui && ui.update();\n state = new State(STATE.SCANNING, SUBSTATE.PLAYING, param);\n tuner.setCenterFrequency(frequency, function() {\n tuner.resetBuffer(processState);\n });\n } else if (state.substate == SUBSTATE.PLAYING) {\n if (frequency == param.start) {\n state = new State(STATE.PLAYING);\n startPipeline();\n return;\n }\n state = new State(STATE.SCANNING, SUBSTATE.TUNING, param);\n var scanData = {\n 'scanning': true,\n 'frequency': frequency\n };\n ++requestingBlocks;\n tuner.readSamples(SAMPLES_PER_BUF, function(data) {\n --requestingBlocks;\n if (state.state == STATE.SCANNING) {\n ++playingBlocks;\n decoder.postMessage([data, stereoEnabled, scanData]);\n }\n processState();\n });\n }\n } else if (state.state == STATE.STOPPING) {\n if (state.substate == SUBSTATE.ALL_ON) {\n if (requestingBlocks > 0) {\n return;\n }\n state = new State(STATE.STOPPING, SUBSTATE.TUNER, state.param);\n ui && ui.update();\n tuner.close(function() {\n processState();\n });\n } else if (state.substate == SUBSTATE.TUNER) {\n state = new State(STATE.STOPPING, SUBSTATE.USB, state.param);\n chrome.usb.closeDevice(connection, function() {\n processState();\n });\n } else if (state.substate == SUBSTATE.USB) {\n var cb = state.param;\n state = new State(STATE.OFF);\n cb && cb();\n ui && ui.update();\n }\n }\n }\n\n /**\n * Receives the sound from the demodulator and plays it.\n * @param {Event} msg The data sent by the demodulator.\n */\n decoder.onmessage = function(msg) {\n --playingBlocks;\n var newStereo = !!msg.data[1];\n if (newStereo != stereo) {\n stereo = newStereo;\n ui && ui.update();\n }\n player.play(msg.data[0], msg.data[1]);\n if (state.state == STATE.SCANNING && msg.data[2] && msg.data[2]['scanning']) {\n if (overload(msg.data[0]) < 0.075) {\n setFrequency(msg.data[2].frequency);\n }\n }\n };\n\n /**\n * Calculates the proportion of samples above maximum amplitude.\n * @param {Samples} samples The audio stream.\n * @param {number} The proportion of samples above the maximum amplitude.\n */\n function overload(samples) {\n var count = 0;\n for (var i = 0; i < samples.data.length; ++i) {\n if (samples.data[i] > 1 || samples.data[i] < -1) {\n ++count;\n }\n }\n return count / samples.data.length;\n }\n\n /**\n * Constructs a state object.\n * @param {number} state The state.\n * @param {number=} opt_substate The sub-state.\n * @param {*=} opt_param The state's parameter.\n */\n function State(state, opt_substate, opt_param) {\n return {\n state: state,\n substate: opt_substate,\n param: opt_param\n };\n }\n\n return {\n start: start,\n stop: stop,\n setFrequency: setFrequency,\n getFrequency: getFrequency,\n scan: scan,\n isScanning: isScanning,\n isPlaying: isPlaying,\n isStopping: isStopping,\n isStereo: isStereo,\n enableStereo: enableStereo,\n isStereoEnabled: isStereoEnabled,\n setInterface: setInterface,\n setOnError: setOnError\n };\n}", "function FindAVRs()\n{\n var devs = usb.getDeviceList();\n for (var i=0; i<devs.length; ++i) {\n OpenAVR(devs[i]);\n }\n}", "writeLoginSetting(data) {\n var arrData = [17,32,0,1,1,];\n const data_send = this.toUTF8Array(data);\n console.log('writeLoginSetting_1',data_send);\n for (var i =0; i < data_send.length; i++) {\n arrData.push(data_send[i]);\n }\n arrData[2] = arrData.length + 1;\n arrData[arrData.length] = this.calCheckSum(arrData);\n\n console.log('writeLoginSetting_2',arrData, this.byteToHexString(arrData));\n\n BleManager.writeWithoutResponse(this.props.mymac, 'fff0', 'fff5',arrData)\n .then(() => {\n console.log('--writeLoginSetting successfully: ',arrData);\n })\n .catch((error) => {\n console.log('--writeLoginSetting failed ',error);\n });\n }", "function makeRequest(){\n var mediaRequest = {\n responseType: http$RESPONSETYPE_BINARY,\n parser: CadmiumMediaStream$_parseHeaderBoxes,\n url: _self.downloadUrls[cdn.id],\n cdn: cdn,\n track: track,\n stream: _self,\n offset: 0,\n length: _actualHeaderSize || _estimateHeaderSize(contentProfile),\n diagCaption: type + '-' + bitrate + '-hdr',\n cacheBuster: true\n };\n playback.httpPlayback.download(mediaRequest, processResponse);\n }", "async sendBinaryRequest(path, params) {\n if (LibraryUtils.getLogLevel() >= 2) console.log(\"sendBinaryRequest(\" + path + \", \" + JSON.stringify(params) + \")\");\n \n // load wasm module\n await LibraryUtils.loadKeysModule();\n \n // serialize params\n let paramsBin = MoneroUtils.jsonToBinary(params);\n \n try {\n \n // send http request\n let resp = await HttpClient.request({\n method: \"POST\",\n uri: this.getUri() + '/' + path,\n username: this.getUsername(),\n password: this.getPassword(),\n body: paramsBin,\n rejectUnauthorized: this.config.rejectUnauthorized,\n requestApi: GenUtils.isFirefox() ? \"xhr\" : \"fetch\"\n });\n \n // validate response\n MoneroRpcConnection.validateHttpResponse(resp);\n \n // process response\n resp = resp.body;\n if (!(resp instanceof Uint8Array)) {\n console.error(\"resp is not uint8array\");\n console.error(resp);\n }\n if (resp.error) throw new MoneroRpcError(resp.error.message, resp.error.code, path, params);\n return resp;\n } catch (err) {\n if (err instanceof MoneroRpcError) throw err;\n else throw new MoneroRpcError(err, undefined, path, params);\n }\n }", "async getData() {\n\t\t//first we have to find out all the gateways we have to query\n\t\tvar that = this;\n\t\tlet web3 = new Web3(new Web3.providers.HttpProvider(\"https://rinkeby.infura.io\"));\n\t\tlet mphr = new web3.eth.Contract(JSON.parse(mphrABI));\n\t\tmphr.options.address = this.props.profile.mphr;\n\n\t\tmphr.methods.returnGateways().call({}, function (error, result) {\n\t\t\tif(error) { throw (error); }\n\t\t\tfor(var i = 0; i < result.length; i++) {\n\t\t\t\tlet hex = result[i].toString();//force conversion\n\t\t\t\tlet gateway = '';\n\t\t\t\tfor (var j = 0; (j < hex.length && hex.substr(j, 2) !== '00'); j += 2) {\n\t\t\t\t\tgateway += String.fromCharCode(parseInt(hex.substr(j, 2), 16));\n\t\t\t\t}\n\t\t\t\tthat.request(gateway.slice(1), that.props.profile.id, \"all\");\n\t\t\t}\n\t\t});\n\t}", "requestGetDeviceName() {\n if (!this.connected) { return; }\n this.writeMessage(MESSAGE_TYPE_GET_DEVICE_NAME, new Uint8Array(0));\n }", "async WebGetBinaryStructures(url) {\n var r = await this._BaseWebRequest(url, \"arraybuffer\", \"GET\", null);\n var decoder = new DeltaBinaryStructuresDecoder(new DataView(r));\n decoder.Decode();\n return decoder;\n }", "async function findDevice() {\n const device = await liff.bluetooth.requestDevice().catch(e => {\n flashSDKError(e);\n onScreenLog(`ERROR on requestDevice: ${e}`);\n throw e;\n });\n // onScreenLog('detect: ' + device.id);\n\n try {\n if (!deviceUUIDSet.has(device.id)) {\n deviceUUIDSet.add(device.id);\n addDeviceToList(device);\n } else {\n // TODO: Maybe this is unofficial hack > device.rssi\n document.querySelector(`#${device.id} .rssi`).innerText = device.rssi;\n }\n\n checkAvailablityAndDo(() => setTimeout(findDevice, 100));\n } catch (e) {\n onScreenLog(`ERROR on findDevice: ${e}\\n${e.stack}`);\n }\n}", "async function upload( cmd_array, fastspeed = true){\n let fullflag = false\n \n if(cmd_array.length>1){\n fullflag = Boolean(parseInt(cmd_array[1]))\n }\n\n if(fastspeed){\n await blxConnectionFast()\n if(blxErrMsg) return\n }\n\n for(;;){ // Unlock Device (locked in FAST mode)\n await blxDeviceCmd('v', 5000) // Get virtual Disk Dir\n if (blxErrMsg) break\n\n if(fullflag === true){ // After 1.st true BLE cmd bec. of deviceMAC\n await blStore.remove(blxIDs.deviceMAC + '_data.edt')\n await blStore.remove(blxIDs.deviceMAC + '_data.edt.old')\n }\n \n await calcMem(true) // With adjust\n if(blxErrMsg) break\n\n terminalPrint('Available Data (Bytes): Total: ' + blxDataMem.total + ', New: ' + blxDataMem.incnew)\n\n if(blxUserCB) {\n if(fullflag) blxUserCB('UPLOAD',blxDataMem.total,'FULL') \n else blxUserCB('UPLOAD',blxDataMem.incnew,'INC') \n }\n \n await updateFile('data.edt', fullflag)\n if(blxErrMsg) break\n\n await updateFile('data.edt.old', fullflag)\n //if(blxErrMsg) break // not needed\n\n break \n } // for\n\n if(fastspeed){ // With NO data, direct CF->CS might raise GATT ERROR\n await blxConnectionSlow()\n }\n }", "async function findDevice() {\n const device = await liff.bluetooth.requestDevice().catch(e => {\n flashSDKError(e);\n onScreenLog(`ERROR on requestDevice: ${e}`);\n throw e;\n });\n // onScreenLog('detect: ' + device.id);\n\n try {\n if (!deviceUUIDSet.has(device.id)) {\n deviceUUIDSet.add(device.id);\n addDeviceToList(device);\n } else {\n // TODO: Maybe this is unofficial hack > device.rssi\n document.querySelector(`#${device.id} .rssi`).innerText = device.rssi;\n }\n\n checkAvailablityAndDo(() => setTimeout(findDevice, 100));\n } catch (e) {\n onScreenLog(`ERROR on findDevice: ${e}\\n${e.stack}`);\n }\n}", "function trackerRequest() {\n const buff = Buffer.alloc(16);\n buff.writeUInt32BE(0x417, 0);\n buff.writeUInt32BE(0x27101980, 4);\n buff.writeUInt32BE(0, 8);\n crypto.randomBytes(4).copy(buff, 12);\n return (buff);\n}", "function calculateChallengeResponse(challenge, adminkey) {\n var objAlg =\n Windows.Security.Cryptography.Core.SymmetricKeyAlgorithmProvider\n .openAlgorithm(\n Windows.Security.Cryptography.Core.SymmetricAlgorithmNames\n .tripleDesCbc);\n\n var symetricKey = objAlg.createSymmetricKey(adminkey);\n var buffEncrypted =\n Windows.Security.Cryptography.Core.CryptographicEngine.encrypt(\n symetricKey,\n challenge,\n null);\n\n return buffEncrypted;\n }", "function getConvolver () {\n const ajax = new window.XMLHttpRequest()\n\n ajax.open('GET', convolverUrl, true)\n\n ajax.responseType = 'arraybuffer'\n\n ajax.onload = function () {\n const audioData = ajax.response\n\n audioCtx.decodeAudioData(audioData, function (buffer) {\n soundSource = audioCtx.createBufferSource()\n convolver.buffer = buffer\n }, function (e) { console.log('Error with decoding audio data' + e.err) })\n\n soundSource.connect(audioCtx.destination)\n soundSource.loop = true\n soundSource.start()\n }\n\n ajax.send()\n }", "function getdevicelist (dev, callback)\n{\n if (typeof (webphone_api.plhandler) !== 'undefined' && webphone_api.plhandler !== null)\n {\n if (typeof (dev) === 'undefined' || dev === null || dev.length < 1) dev = '-12';\n webphone_api.plhandler.GetDeviceList(dev, callback);\n }\n}", "function Decoder(bytes, port) {\n // Decode an uplink message from a buffer\n // (array) of bytes to an object of fields.\n var decoded = {};\n\n if (! (port === 3))\n return null;\n\n // see catena-message-port3-format.md\n // i is used as the index into the message. Start with the flag byte.\n // note that there's no discriminator.\n // test vectors are also available there.\n var i = 0;\n // fetch the bitmap.\n var flags = bytes[i++];\n\n if (flags & 0x1) {\n // set Vraw to a uint16, and increment pointer\n var Vraw = (bytes[i] << 8) + bytes[i + 1];\n i += 2;\n // interpret uint16 as an int16 instead.\n if (Vraw & 0x8000)\n Vraw += -0x10000;\n // scale and save in result.\n decoded.Vbat = Vraw / 4096.0;\n }\n\n if (flags & 0x2) {\n var Vraw = (bytes[i] << 8) + bytes[i + 1];\n i += 2;\n if (Vraw & 0x8000)\n Vraw += -0x10000;\n decoded.VDD = Vraw / 4096.0;\n }\n\n if (flags & 0x4) {\n var iBoot = bytes[i];\n i += 1;\n decoded.boot = iBoot;\n }\n\n if (flags & 0x8) {\n // we have temp, pressure, RH\n var tRaw = (bytes[i] << 8) + bytes[i + 1];\n if (tRaw & 0x8000)\n tRaw = -0x10000 + tRaw;\n i += 2;\n var rhRaw = (bytes[i] << 8) + bytes[i + 1];\n i += 2;\n\n decoded.t = tRaw / 256;\n decoded.rh = rhRaw / 65535.0 * 100;\n decoded.tDew = dewpoint(decoded.t, decoded.rh);\n decoded.tHeatIndexC = CalculateHeatIndexCelsius(decoded.t, decoded.rh);\n }\n\n if (flags & 0x10) {\n // we have light irradiance info\n var irradiance = {};\n decoded.irradiance = irradiance;\n\n var lightRaw = (bytes[i] << 8) + bytes[i + 1];\n i += 2;\n irradiance.IR = lightRaw;\n\n lightRaw = (bytes[i] << 8) + bytes[i + 1];\n i += 2;\n irradiance.White = lightRaw;\n\n lightRaw = (bytes[i] << 8) + bytes[i + 1];\n i += 2;\n irradiance.UV = lightRaw;\n }\n\n if (flags & 0x20) {\n var Vraw = (bytes[i] << 8) + bytes[i + 1];\n i += 2;\n if (Vraw & 0x8000)\n Vraw += -0x10000;\n decoded.Vbus = Vraw / 4096.0;\n }\n\n // at this point, decoded has the real values.\n return decoded;\n}", "function callAPI(req,res,handleResponse){\n var host = 'www.blueworkslive.com';\n var username = 'xxxx';\n var password = 'yyyy';\n var path = '/api/Auth';\n var headers = {\n 'Authorization': 'Basic ' + new Buffer(username+':'+password).toString('base64'),\n };\n var options = {\n host: host,\n path: path,\n method: 'GET',\n headers: headers\n };\n var bwlResData = {};\n console.log('BwlApiCall: Request '+options.method+' https://'+options.host+options.path);\n var bwlRequest = https.request(options, function(bwlResponse) {\n\tconsole.log(\"BwlApiCall: Response status=\"+bwlResponse.statusCode);\n\tbwlResData.status = bwlResponse.statusCode; // statusCode >= 200 and < 300 is OK\n\tbwlResData.headers = bwlResponse.headers;\n\tvar bufferData = [];\n\tbwlResponse.on('data', function(data) {\n\t bufferData.push(data);\n console.info('BwlApiCall: Response data received');\n\t});\n\tbwlResponse.on('end', function() {\n console.info('BwlApiCall: completed, calling callback');\n\t bwlResData.data = Buffer.concat(bufferData);\n\t handleResponse(req, res, bwlResData);\n });\n });\n/* if ((reqData.method == \"post\" || reqData.method == \"put\") && reqData.senddata) {\n console.log(reqData.method+' sending data: '+reqData.senddata);\n bwlRequest.write(reqData.senddata);\n } */\n bwlRequest.end();\n bwlRequest.on('error', function(e){\n console.error('BwlApiCall: REQUEST-ERROR '+e);\n });\n}", "retrieveDevice(req, res) {\n res.json({ message: \"Device\", data: req.device });\n }", "getDeviceDescription(deviceId, callback, retryCounter) {\n let ip;\n if (!retryCounter) retryCounter = 0;\n if (retryCounter > 2) {\n return callback && callback(new Error('timeout on response'));\n }\n if (deviceId.includes('#')) {\n if (!this.knownDevices[deviceId] || !this.knownDevices[deviceId].ip) {\n return callback && callback('device unknown');\n }\n ip = this.knownDevices[deviceId].ip;\n }\n else ip = deviceId;\n this.logger && this.logger('CoAP device description request for ' + deviceId + ' to ' + ip + '(' + retryCounter + ')');\n let retryTimeout = null;\n try {\n const req = coap.request({\n host: ip,\n //port: 5683,\n method: 'GET',\n pathname: '/cit/d'\n });\n\n retryTimeout = setTimeout(() => {\n this.getDeviceDescription(deviceId, callback, ++retryCounter);\n callback = null;\n }, 2000);\n req.on('response', (res) => {\n clearTimeout(retryTimeout);\n const options = {};\n res.options.forEach((opt) => {\n if (!options[opt.name]) {\n options[opt.name] = opt.value;\n }\n else {\n options[opt.name] += '/' + opt.value;\n }\n });\n this.logger && this.logger('CoAP response: ' + JSON.stringify(options));\n\n const deviceId = this.initDevice(options, res.rsinfo);\n if (!deviceId) return;\n\n let payload = res.payload.toString();\n if (!payload.length) {\n this.logger && this.logger('CoAP payload empty: ' + JSON.stringify(options));\n return;\n }\n try {\n\n if (payload.indexOf('`') !== -1) {\n this.logger && this.logger(payload);\n payload = payload.substr(0, payload.lastIndexOf('`'));\n this.logger && this.logger('CoAP payload cutted: ' + payload.indexOf('`'));\n }\n\n payload = JSON.parse(payload);\n }\n catch (err) {\n this.emit('error', err + ' (res) for JSON ' + payload);\n return;\n }\n this.logger && this.logger('Device description received: ' + JSON.stringify(options) + ' / ' + JSON.stringify(payload));\n if (req.rsinfo) {\n this.knownDevices[deviceId].ip = req.rsinfo.address;\n this.knownDevices[deviceId].port = req.rsinfo.port;\n }\n this.knownDevices[deviceId].description = payload;\n callback && callback(null, deviceId, payload, this.knownDevices[deviceId].ip);\n callback = null;\n });\n req.on('error', (error) => {\n // console.log(error);\n this.emit('error', error);\n });\n req.end();\n }\n catch (e) {\n if (retryTimeout) clearTimeout(retryTimeout);\n callback && callback(e);\n callback = null;\n }\n }", "buildModemInterface() {\n return new Promise((resolve, reject) => {\n this.log(`starting modem interface on port ${this.uri} @ ${this.baud_rate}`);\n let serial_port = new SerialPort(this.uri, {\n baudRate: this.baud_rate\n });\n serial_port.on('open', () => {\n resolve(serial_port);\n });\n serial_port.on('error', (err) => {\n reject(err);\n });\n serial_port.on('data', (data) => {\n // buffer the received data\n this.response_buffer += data.toString();\n // check if the response code exists in our buffered data\n this.response_codes.forEach((code) => {\n if (this.response_buffer.toUpperCase().indexOf(code) > -1) {\n this.handleModemResponse({\n data: this.response_buffer.replace(code, '').trim(), \n code: code\n });\n this.response_buffer = '';\n }\n })\n });\n return serial_port;\n });\n }", "function send(data) {\n\n if(MODE == MODES.TEST) {\n ws.send(data);\n } else if(MODE == MODES.BLUETOOH) {\n\n var data = new Uint8Array(1);\n data[0] = data;\n\n ble.write(id, serviceId, serviceName, data.buffer, function() {\n console.log(\"ble -> sendSucess\");\n }, function(err) {\n console.log(\"ble -> sendFailure : \" + JSON.stringify(err));\n });\n\n }\n\n}", "sendMakeBetShan2(_chipbet) {\n cc.NGWlog(\"Vua dat cuoc =\" + _chipbet);\n var data = {\n evt: \"bm\",\n M: _chipbet\n };\n this.sendDataGame(JSON.stringify(data));\n }", "async function requestBlockchainInfo() {\n return instance\n .get(\"/tuichain/get_info/\")\n .then((response) => {\n return response.data;\n })\n .catch((error) => {\n console.log(error);\n return false;\n });\n}", "async function main(){\n\nvar password=\"pengshu\";\n\nvar oneBranchAccount=await web3.eth.personal.newAccount(password);\nconsole.log(\"one branch\",oneBranchAccount);\n\n\nlet unlock;\n\ntry{\n unlock=await web3.eth.personal.unlockAccount(oneBranchAccount,password);}\ncatch(e){}\n console.log(\"one branch unlock\",unlock);\n \n\nvar message=\"I am the flash\";\nlet signature;\ntry{\n signature=await web3.eth.sign(message,oneBranchAccount);\n}catch(e){}\nconsole.log(\"signature one branch:\",signature);\n\nlet verfication;\ntry {\n verification= await web3.eth.personal.ecRecover(message,signature);\n}catch(e){console.log(e);}\nconsole.log(verfication);\n}", "function expressGETBuffer(){\r\n GenerateRandom(currentBuffer);\r\n app.get('/api/buffer',(req,res) =>{\r\n res.json({\r\n arduino: currentBufferArduino,\r\n dummy: currentBuffer\r\n });\r\n });\r\n //console.log(\"2a. GET to Server\");\r\n}" ]
[ "0.62603414", "0.61711174", "0.5881223", "0.564345", "0.56137395", "0.55299354", "0.55139816", "0.54276687", "0.5425389", "0.54120064", "0.5388707", "0.5372538", "0.5353609", "0.52452624", "0.5164182", "0.5159718", "0.51450515", "0.5111828", "0.50875866", "0.50299066", "0.5017245", "0.5015613", "0.5009962", "0.49845383", "0.4967775", "0.49572152", "0.49328268", "0.490959", "0.49065247", "0.49061036", "0.4898304", "0.48861286", "0.48633265", "0.4846188", "0.48459402", "0.4840834", "0.48395976", "0.4835315", "0.48112178", "0.48053154", "0.48034617", "0.48031434", "0.47910246", "0.47796413", "0.47674897", "0.47664085", "0.47617304", "0.47569618", "0.47550553", "0.4753095", "0.4738177", "0.47369456", "0.47227266", "0.4701544", "0.46987933", "0.46952343", "0.46905077", "0.4672594", "0.4667461", "0.4667461", "0.4667461", "0.4667461", "0.46638697", "0.46624896", "0.4659649", "0.46527052", "0.46497568", "0.46369988", "0.46349", "0.46331975", "0.46291536", "0.462668", "0.462538", "0.46245086", "0.46235523", "0.4622976", "0.4619396", "0.46140537", "0.46073154", "0.46071523", "0.46060756", "0.46002516", "0.45992893", "0.45923156", "0.45920658", "0.45915735", "0.45895246", "0.45890766", "0.45868373", "0.45754632", "0.45679644", "0.45636854", "0.4562336", "0.4561162", "0.45568252", "0.45534855", "0.45517433", "0.45452705", "0.45442167", "0.45425543" ]
0.46860376
57
document.getElementById(password) . innerHTML = text;
function getRandome (max) { return max[Math.floor(Math.random() * max.length )]; console.log(Math.random()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function WritePassword(passwordText) {\n document.getElementById(\"password\").textContent = passwordText;\n\n}", "function writePassword() {\n document.querySelector(\"#password\").innerHTML = password;\n\n }", "function userInput(password) {\n document.getElementById(\"password\").textContent = password;\n}", "function UserInput(passwordText) {\n document.getElementById(\"password\").textContent = passwordText;\n}", "function showPassword(displayPassword) {\n document.getElementById(\"password\").textContent = displayPassword;\n}", "function writePassword(pass) {\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = pass;\n\n}", "function writePassword() {\n generatePassword()\n var passwordText = document.querySelector(\"#password\");\n passwordText.textContent = password\n\n}", "function writePassword(password) {\n\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function UserInput(pd) {\n document.getElementById(\"password\").textContent = pd;\n}", "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n\n}", "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n\n}", "function writePassword() {\n\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\n}", "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n}", "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n}", "function writePassword() {\n \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");//id selector = html line 22 \n\n passwordText.value = password;\n\n \n}", "function passwordWriter() {\n let passwordText = document.querySelector(\"#password\");\n passwordText.value = password; \n}", "function writePassword() {\nvar password = generatePassword();\nvar passwordText = document.querySelector(\"#password\");\n\npasswordText.value = password;\n}", "function UserInput(output) {\n document.getElementById(\"password\").passwordText = output;\n}", "function UserInput(ps) {\n document.getElementById(\"password\").textContent = ps;\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n passwordText.innerHTML = password;\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n passwordText.value = password;\n document.getElementById(\"password\").innerHTML = password;\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\n passwordText.value = displayPassword;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n\n\n passwordText.value = password;\n \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 = generatePasswordContent();\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 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 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 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 passwordText = document.querySelector(\"#password\");\n\n passwordText.value = newGeneratedPassword; \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 var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n\n passwordText.value = password;\n\n}", "function writePassword(password) {\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 inputPassword(e) {\n document.getElementById(\"password\").textContent = e;\n}", "function writePassword() {\n\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n passwordText.value = password;\n\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() {\r\n var password = generatePassword();\r\n var passwordText = document.querySelector(\"#password\");\r\n\r\n passwordText.value = password;\r\n \r\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\npasswordText.value = password;\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 passwordText.value = password\n}", "function writePassword() {\n \n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\n\n\n\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n //\n \n\n passwordText.value = password;\n \n}", "function userInput(finalPassword) {\n document.getElementById(\"password\").textContent = finalPassword;\n}", "function writePassword(generatedPassword) {\n console.log(\"Generated Password: \" + generatedPassword);\n var newPassword = document.querySelector(\"#password\");\n newPassword.innerText = generatedPassword;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\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\n\n}", "function writePassword() {\n var password = newPassword\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\n passwordText.value = password;\n\n}", "function writePassword() {\n var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \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\n}", "function writePassword() {\n var password = generatePW();\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 \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 var password = generatePassword()\n //alert(password);\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 var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n\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 var password = generatePassword();\n var passwordText = document.querySelector(\"#password\");\n \n \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 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 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 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 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 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}" ]
[ "0.88116086", "0.8573077", "0.83758783", "0.8321781", "0.8316973", "0.8254185", "0.8232729", "0.82186484", "0.8214353", "0.8212168", "0.819865", "0.8196123", "0.8187172", "0.8187172", "0.8183191", "0.8169886", "0.8150967", "0.8148606", "0.81402886", "0.8140272", "0.8134589", "0.8122994", "0.81045556", "0.8101793", "0.80988085", "0.80980366", "0.8088884", "0.8088884", "0.8082781", "0.80786", "0.8076784", "0.8076784", "0.8076784", "0.8076784", "0.8076784", "0.8076784", "0.8076784", "0.8076784", "0.8076784", "0.8070179", "0.8069889", "0.8069889", "0.80694634", "0.80694634", "0.8069265", "0.80647326", "0.8053474", "0.80493176", "0.8047731", "0.80427104", "0.8042438", "0.80414104", "0.80412495", "0.8040781", "0.80385023", "0.80376345", "0.80363023", "0.8034796", "0.8034796", "0.8034653", "0.80321735", "0.80321735", "0.8029755", "0.8026497", "0.802625", "0.80240834", "0.8021983", "0.8021983", "0.8020465", "0.8016834", "0.8014387", "0.8014282", "0.80101067", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173", "0.8009173" ]
0.0
-1
Setup canvas based on the video input
function setup_canvases() { canvas.width = video_element.scrollWidth; canvas.height = video_element.scrollHeight; output_element.width = video_element.scrollWidth; output_element.height = video_element.scrollHeight; console.log("Canvas size is " + video_element.scrollWidth + " x " + video_element.scrollHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setupCanvas() {\n\t\tconst {video, elements} = this;\n\n\t\tconst virtualCanvas = elements.virtualCanvas = document.createElement('canvas');\n\n\t\tthis.context = elements.canvas.getContext('2d');\n\t\tthis.virtualContext = virtualCanvas.getContext('2d');\n\n\t\telements.canvas.width = virtualCanvas.width = video.videoWidth;\n\t\telements.canvas.height = virtualCanvas.height = video.videoHeight;\n\t}", "canvasApp() {\n this.context = this.canvas.getContext(\"2d\");\n this.videoLoop();\n }", "function makeCanvases() {\n w = _this.media.videoWidth;\n h = _this.media.videoHeight;\n \n // create a canvas to display the color-changed video, and a div to hold the canvas\n var candiv = document.createElement('div');\n candiv.style.position = 'absolute';\n _mediaHolder.appendChild(candiv);\n candiv.style.top = _media.offsetTop + 'px'; // so that the canvas will appear over the video\n candiv.style.left = _media.offsetLeft + 'px';\n _colorCanvas = document.createElement('canvas');\n _colorCanvas.style.display = 'none';\n _colorCanvas.width = w;\n _colorCanvas.height = h;\n candiv.appendChild(_colorCanvas);\n \n _colctx = _colorCanvas.getContext('2d');\n options.colorCanvas = _colorCanvas;\n \n // create a buffer canvas to hold each frame for processing\n // note that it just \"floats\" and is never appended to the document\n _bufferCanvas = document.createElement('canvas');\n _bufferCanvas.style.display = 'none';\n _bufferCanvas.width = w;\n _bufferCanvas.height = h;\n _bufctx = _bufferCanvas.getContext('2d');\n options.bufferCanvas = _bufferCanvas;\n console.log('The variable bufctx is ' + _bufctx);\n \n \n if (_coloring === \"color-no-change\"){\n return;\n }\n else if (_coloring === \"blackwhite\"){\n _media.addEventListener('play', function(){\n var framecounter = 0;\n console.log('Playing. The variable bufctx is ' + _bufctx);\n options.redrawID = makeBW(_media, _bufctx, _colctx, w, h, framecounter);\n });\n }\n else if (_coloring === \"sepia\"){\n _media.addEventListener('play', function(){\n var framecounter = 0;\n options.redrawID = makeSepia(_media, _bufctx, _colctx, w, h, framecounter);\n });\n }\n else if (_coloring === \"custom\"){\n _media.addEventListener('play', function(){\n var framecounter = 0;\n options.redrawID = adjustColor(_media, _bufctx, _colctx, w, h, framecounter, _redAdd, _greenAdd, _blueAdd);\n });\n }\n }", "constructor() {\n super();\n /**\n * video source file or stream\n * @type {string}\n * @private\n */\n this._source = '';\n\n /**\n * use camera\n * @type {boolean}\n * @private\n */\n this._useCamera = false;\n\n /**\n * is component ready\n * @type {boolean}\n */\n this.isReady = false;\n\n /**\n * is video playing\n * @type {boolean}\n */\n this.isPlaying = false;\n\n /**\n * width of scaled video\n * @type {int}\n */\n this.videoScaledWidth = 0;\n\n /**\n * height of scaled video\n * @type {int}\n */\n this.videoScaledHeight = 0;\n\n /**\n * how the video is scaled\n * @type {string}\n * @default letterbox\n */\n this.videoScaleMode = 'contain';\n\n /**\n * what type of data comes back with frame data event\n * @type {string}\n * @default imagedataurl\n */\n this.frameDataMode = 'none';\n\n /**\n * determines whether to use the canvas element for display instead of the video element\n * @type {boolean}\n * @default false\n */\n this.useCanvasForDisplay = false;\n\n /**\n * canvas filter function (manipulate pixels)\n * @type {method}\n * @default 0 ms\n */\n this.canvasFilter = this.canvasFilter ? this.canvasFilter : null;\n\n /**\n * refresh interval when using the canvas for display\n * @type {int}\n * @default 0 ms\n */\n this.canvasRefreshInterval = 0;\n\n /**\n * video element\n * @type {HTMLElement}\n * @private\n */\n this.videoElement = null;\n\n /**\n * camera sources list\n * @type {Array}\n */\n this.cameraSources = [];\n\n /**\n * canvas element\n * @type {Canvas}\n * @private\n */\n this.canvasElement = null;\n\n /**\n * component shadow root\n * @type {ShadowRoot}\n * @private\n */\n this.root = null;\n\n /**\n * interval timer to draw frame redraws\n * @type {int}\n * @private\n */\n this.tick = null;\n\n /**\n * canvas context\n * @type {CanvasContext}\n * @private\n */\n this.canvasctx = null;\n\n /**\n * has the canvas context been overridden from the outside?\n * @type {boolean}\n * @private\n */\n this._canvasOverride = false;\n\n /**\n * width of component\n * @type {int}\n * @default 0\n */\n this.width = 0;\n\n /**\n * height of component\n * @type {int}\n * @default 0\n */\n this.height = 0;\n\n /**\n * left offset for letterbox of video\n * @type {int}\n * @default 0\n */\n this.letterBoxLeft = 0;\n\n /**\n * top offset for letterbox of video\n * @type {int}\n * @default 0\n */\n this.letterBoxTop = 0;\n\n /**\n * aspect ratio of video\n * @type {number}\n */\n this.aspectRatio = 0;\n\n /**\n * render scale for canvas frame data\n * best used when grabbing frame data at a different size than the shown video\n * @attribute canvasScale\n * @type {float}\n * @default 1.0\n */\n this.canvasScale = 1.0;\n\n /**\n * visible area bounding box\n * whether letterboxed or cropped, will report visible video area\n * does not include positioning in element, so if letterboxing, x and y will be reported as 0\n * @type {{x: number, y: number, width: number, height: number}}\n */\n this.visibleVideoRect = { x: 0, y: 0, width: 0, height: 0 };\n\n this.template = `\n <style>\n ccwc-video {\n display: inline-block;\n background-color: black;\n position: relative;\n overflow: hidden;\n }\n \n ccwc-video > canvas {\n position: absolute;\n }\n \n ccwc-video > video {\n position: absolute;\n }\n </style>\n\n <video autoplay=\"true\"></video>\n <canvas></canvas>`;\n }", "async function populateVideo() {\n // We grab the feed off the user's webcam\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { width: 1280, height: 720 },\n });\n\n // We set the object to be the stream\n video.srcObject = stream; // usually when dealing with video files we use video.src = 'videoName.mp4'\n await video.play();\n\n // size the canvases to be the same size as the video\n console.log(video.videoWidth, video.videoHeight);\n\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n\n faceCanvas.width = video.videoWidth;\n faceCanvas.height = video.videoHeight;\n}", "function paintToCanvas() {\n // you will find that the canvas height is bigger than the current window size even though its size is set to 640*480\n // because the width of the canvas is set to 100% which means it will take 100% of the space availabe of its parent container (photobooth)\n // Since the width of the photobooth is appx 1330px \n // the canvas will also take width of 1330px\n // since the width is 1330px the height will be 999px in order to maintain the aspect ratio (640*480)\n // the canvas is taking aspect ratio from our defined size (i.e 640 * 480)\n // therefore you can change the aspect ratio by changing the width and height of the canvas\n // if you remove the width 100% from its css , it will regain the size of 640*480\n\n // width and height = 640 * 480 \n // because the resolution we get from the video feed is by default 640*480 and is pre-defined by the system webcam\n // setting canvas width and height = 640*480\n const width = video.videoWidth;\n const height = video.videoHeight;\n [canvas.width, canvas.height] = [width, height];\n\n // the video playing in the canvas is not a actual video\n // but rather a image showing every few millisecond (giving us a video like visual)\n // So every 16ms the image captured from the video feed will be pasted/drawed on the canvas.\n // So we can say our video on canvas is showing 1 frame every 16 milliseconds\n return setInterval(() => {\n // ctx.drawImage will draw the image captured from the video feed\n // 0,0 are the x and y coordinate of the top left corner of the canvas\n // it will indicate that from which point the image drawing will start\n // width and height is of the destination contex(canvas)\n ctx.drawImage(video, 0, 0, width, height);\n\n // FROM HERE AFTERWARDS pixels MEANS VARIABLE\n\n // ctx.getImageData will give the data of the image(from the video playing on the canvas) \n // pixels will store the image data in form of array of rgb values for individual pixels\n let pixels = ctx.getImageData(0, 0, width, height);\n\n // Rendering different effects for the pixels\n // Every image captured from the video feed every 16ms will go through these function everytime\n // The pixels returned by these function will have different rgb values as compared to the original pixels\n\n // This is for red filter\n // pixels = redEffect(pixels);\n\n // This is for rgbSplit(tiktok) filter\n // pixels = rgbSplit(pixels);\n\n // This is for green screen\n pixels = greenScreen(pixels);\n\n // globalAlpha will determine how transparent will be the filters (0 - fully transparent, 1-opaque)\n // ctx.globalAlpha = 0.8\n\n // this will put the modified pixels back into the canvas\n // thus showing the filter on the video\n ctx.putImageData(pixels, 0, 0)\n }, 16);\n}", "function drawCameraIntoCanvas() {\n // Draw the video element into the canvas\n ctx.drawImage(video, 0, 0, pageContent.offsetWidth, pageContent.offsetHeight);\n ctx.fillStyle = '#000000';\n ctx.fillRect(0, 0, pageContent.offsetWidth, pageContent.offsetHeight);\n ctx.lineWidth = 5;\n ctx.fillStyle = '#00FFFF';\n ctx.strokeStyle = '#00FFFF';\n\n // We can call both functions to draw all keypoints and the skeletons\n drawKeypoints();\n drawSkeleton();\n window.requestAnimationFrame(drawCameraIntoCanvas);\n}", "function installcanvas () {\n\n // if there's an iframe\n var iframe = document.getElementById('tool_content');\n if (iframe) {\n \t\taddEventListener(\"message\", installfromiframe('#content', 'about:blank', ''), false);\n } \n \n // multiple videos as per\n // https://canvas.harvard.edu/courses/340/wiki/supplemental-materials-for-lab-1-reporter-gene-analysis-using-transgenic-animals?module_item_id=630 \n else {\n\n // video locations that may need a click to access \n var containers = [].slice.call(document.getElementsByClassName('instructure_file_link_holder'));\n containers = containers.concat([].slice.call(document.getElementsByClassName('instructure_inline_media_comment')));\n // known video locations\n var matches = document.body.innerHTML.match(/me_flash_\\d_container/g);\n\n // if any known videos exist, launch those\n if (matches) {\n\n // loop through all known videos\n for (var i = 0; i < matches.length; i++) {\n\n // pull out the video number\n matches[i] = matches[i].replace(/\\D/g, \"\");\n\n // parameters for the videoplayer\n var parameter = {};\n\n // only supporting mp4 at the moment\n parameter.audio = false;\n\n // set number for video classes \n parameter.number = matches[i];\n\n // get source for available video\n parameter.source = document.getElementById('mep_' + matches[i]).childNodes[0].childNodes[0].childNodes[1].src + '?1';\n if (parameter.source) {\n\n // get locally stored data \n var hist = JSON.parse(localStorage.getItem(parameter.source));\n if (hist) {\n parameter.time = hist.time;\n }\n\n // prepare new container\n var container = $('<div/>');\n\n // maximize player's width\n container.css('margin', '10px 0 0 0');\n container.css('padding', '0');\n container.css('width', '100%');\n parameter.playing = false;\n\n // find if the video is playing\n if ($('#mep_' + matches[i]).find('.mejs-pause')[0]){\n parameter.playing = true;\n }\n\n // replace old container with new\n $('#mep_' + matches[i]).replaceWith(container);\n\n // install player\n install(container, parameter);\n }\n }\n }\n\n // click on all possible video containers, watch if things change\n if (containers.length != 0) {\n\n // watch for changes for each container\n for(var i = 0; i < containers.length; i++) {\n\n // use mutation observer as per \n // https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver\n var observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n\n // see if changes are to the child of the container\n if (mutation.type === 'childList') {\n\n // look through each child\n Array.prototype.forEach.call(mutation.target.children, function (child) {\n\n // match (only once per video) -- same code as if (matches) branch\n matches = document.body.innerHTML.match(/me_flash_\\d_container/g);\n if (matches) {\n for (var i = 0; i < matches.length; i++) {\n matches[i] = matches[i].replace(/\\D/g, '');\n\n // parameters for the videoplayer\n var parameter = {};\n parameter.audio = false;\n\n // set number for video classes \n parameter.number = matches[i];\n\n // get source for available video\n parameter.source = document.getElementById('mep_' + matches[i]).childNodes[0].childNodes[0].childNodes[1].src + '?1';\n if (parameter.source) {\n\n // get locally stored data for time\n var hist = JSON.parse(localStorage.getItem(parameter.source));\n if (hist) {\n parameter.time = hist.time;\n }\n\n // prepare new container\n var container = $('<div/>');\n\n // maximize player's width\n container.css('margin', '10px 0 0 0');\n container.css('padding', '0');\n container.css('width', '100%');\n\n // replace old container with new\n $('#mep_' + matches[i]).replaceWith(container);\n\n parameter.playing = false;\n\n // install player\n install(container, parameter);\n }\n }\n }\n });\n }\n });\n });\n\n // actually start observing\n observer.observe(containers[i], {\n childList: true,\n characterData: true,\n subtree: true\n });\n }\n\n // simulate click, waits for link to appear\n $('.media_comment_thumbnail').click(); \n } \n\n // no possible video containers, apologize\n else {\n apologize();\n }\n }\n}", "function init() {\n\t\tconsole.log('init');\n\t\t// Put event listeners into place\n\t\t// Notice that in this specific case handlers are loaded on the onload event\n\t\twindow.addEventListener(\n\t\t\t'DOMContentLoaded',\n\t\t\tfunction() {\n\t\t\t\t// Grab elements, create settings, etc.\n\t\t\t\tvar canvas = document.getElementById('canvas');\n\t\t\t\tvar context = canvas.getContext('2d');\n\t\t\t\t// context.transform(3,0,0,1,canvas.width,canvas.heigth);\n\t\t\t\tvar video = document.getElementById('video');\n\t\t\t\tvar mediaConfig = {\n\t\t\t\t\tvideo: true\n\t\t\t\t};\n\t\t\t\tvar errBack = function(e) {\n\t\t\t\t\tconsole.log('An error has occurred!', e);\n\t\t\t\t};\n\n\t\t\t\tlet aspectRatio = 2;\n\n\t\t\t\t// Put video listeners into place\n\t\t\t\tif (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n\t\t\t\t\tnavigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {\n\t\t\t\t\t\taspectRatio = stream.getVideoTracks()[0].getSettings().aspectRatio;\n\t\t\t\t\t\tdocument.getElementById('video-spinner').style.display = 'block';\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Trigger photo take\n\t\t\t\tdocument.getElementById('snap').addEventListener('click', function() {\n\t\t\t\t\tdocument.getElementsByClassName('canvas-container')[0].style.visibility = 'visible';\n\t\t\t\t\tlet heigth = 480;\n\n\t\t\t\t\tcontext.save();\n\t\t\t\t\tcontext.translate(480 * aspectRatio, 0);\n\t\t\t\t\tcontext.scale(-1, 1);\n\t\t\t\t\tcontext.drawImage(video, 0, 0, aspectRatio * heigth, heigth);\n\t\t\t\t\tcontext.restore();\n\t\t\t\t\tstate.photoSnapped = true; // photo has been taken\n\t\t\t\t});\n\n\t\t\t\t// Trigger when upload button is pressed\n\t\t\t\tif (document.getElementById('upload'))\n\t\t\t\t\tdocument.getElementById('upload').addEventListener('click', () => {\n\t\t\t\t\t\tdocument.getElementById('video-spinner').style.display = 'block';\n\t\t\t\t\t\t// uploadImage();\n\t\t\t\t\t\tselectImage();\n\t\t\t\t\t});\n\n\t\t\t\tif (document.getElementById('upload_search'))\n\t\t\t\t\tdocument.getElementById('upload_search').addEventListener('click', () => {\n\t\t\t\t\t\tdocument.getElementById('video-spinner').style.display = 'block';\n\t\t\t\t\t\t// searchImage();\n\t\t\t\t\t});\n\t\t\t},\n\t\t\tfalse\n\t\t);\n\t}", "function drawCameraIntoCanvas() {\n // Draw the video element into the canvas\n ctx.drawImage(video, 0, 0, 640, 480);\n // We can call both functions to draw all keypoints and the skeletons\n drawKeypoints();\n drawSkeleton();\n window.requestAnimationFrame(drawCameraIntoCanvas);\n}", "function startVideo(){\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n canvas.getContext('2d').\n drawImage(video, 0, 0, canvas.width, canvas.height);\n $scope.sendPicture();\n}", "function paintToCanvas() {\n // We need to make sure canvas and video are the same width/height\n const width = video.videoWidth;\n const height = video.videoHeight;\n canvas.width = width;\n canvas.height = height;\n\n // Every couple seconds, take image from webcam and put it onto canvas\n return setInterval(() => {\n // drawImage: pass it an image/video and it will place it on the canvas\n ctx.drawImage(video, 0, 0, width, height);\n\n // Take pixels out\n let pixels = ctx.getImageData(0, 0, width, height); // huge array of pixels\n\n // Play around with pixels\n switch (this.className) {\n case 'red':\n pixels = redEffect(pixels);\n break;\n case 'split':\n ctx.globalAlpha = 0.1;\n pixels = rgbSplit(pixels);\n break;\n case 'green':\n pixels = greenScreen(pixels);\n }\n\n // Put pixels back into canvas\n ctx.putImageData(pixels, 0, 0);\n }, 16);\n}", "function drawCameraIntoCanvas() {\n // Draw the video element into the canvas\n drawKeypoints();\n window.requestAnimationFrame(drawCameraIntoCanvas);\n}", "function currentFrameCanvas(){\n let video = document.getElementById(\"video_id\");\n canvas = document.getElementById('screenShot');\n canvas.width = width;\n canvas.height = height;\n canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);\n}", "function drawCameraIntoCanvas() {\n\n // draw the video element into the canvas\n ctx.drawImage(video, 0, 0, video.width, video.height);\n \n if (body) {\n // draw circle for left and right Eye\n const leftWrist = body.getBodyPart(bodyParts.leftWrist);\n const rightWrist = body.getBodyPart(bodyParts.rightWrist);\n\n\n\n // draw left Eye\n ctx.beginPath();\n ctx.arc(leftWrist.position.x, leftWrist.position.y, 5, 0, 2 * Math.PI);\n ctx.fillStyle = 'white';\n ctx.fill();\n\n // draw right Eye\n ctx.beginPath();\n ctx.arc(rightWrist.position.x, rightWrist.position.y, 5, 0, 2 * Math.PI);\n ctx.fillStyle = 'white';\n ctx.fill();\n\n\n ctx.beginPath();\n ctx.moveTo(leftWrist.position.x,leftWrist.position.y);\n ctx.lineTo(rightWrist.position.x,rightWrist.position.y, 150);\n ctx.lineWidth = 10;\n ctx.strokeStyle = 'white';\n ctx.stroke();\n }\n requestAnimationFrame(drawCameraIntoCanvas);\n}", "function createCanvas() {\n // console.log(parseInt(pixelByPixel.value));\n selectedFrameData = null;\n selectedFrameData = {};\n layerCount = 0;\n framesArray = [],\n currentFrame = 0,\n playbackRunning = false,\n playbackInterval = null,\n unsavedFrame = false;\n removeListeners();\n resetFrames();\n resetLayers();\n resetSelectionState();\n addDisplayFrame(0);\n setCurrentFrame(0);\n initCanvas(\"2d\", parseInt(pixelByPixel.value));\n}", "function paintToCanvas() {\n // get the width and height of the actual live feed video\n const width = video.videoWidth;\n const height = video.videoHeight;\n\n // set canvas width and height to be the same as the live feed video\n canvas.width = width;\n canvas.height = height;\n\n // every 16ms, take the image from the webcam and put it into the canvas\n return setInterval(() => {\n ctx.drawImage(video, 0, 0, width, height);\n\n // take the pixels out\n let pixels = ctx.getImageData(0, 0, width, height);\n\n // mess with them\n // pixels = redEffect(pixels);\n\n // pixels = redSplit(pixels);\n // ctx.globalAlpha = 0.8;\n\n pixels = greenScreen(pixels);\n\n // put them back\n ctx.putImageData(pixels, 0, 0);\n }, 16);\n}", "function initPreview() {\n\t\n\t//clear the canvas first\n\tcanvasPreviewContext.clearRect(0, 0, canvasPreview.width, canvasPreview.height);\n\t\n\t//what file type are we dealing with\n\tif (fileType == \"VIDEO\") {\n\t\t\n\t\tsampleWidth = 50;\n\t\tsampleHeight = Math.floor((9/16)*sampleWidth);\n\t\tvideoArea.width = sampleWidth;\n\t\tvideoArea.height = sampleHeight;\n\t\t\n\t\t//reset size of the canvas\n\t\tcanvasPreview.width = sampleWidth;\n\t\tcanvasPreview.height = sampleHeight;\n\t\tpreviewArea.style.width = sampleWidth + \"px\";\n\t\tpreviewArea.style.height = sampleHeight + \"px\";\n\t\t\n\t\t//set the video in the videoArea so it starts playing\n\t\tvideoArea.type = file.type;\n\t\tvideoArea.src = fileURL;\n\t\t\n\t\t//set fileWidth\n\t\tfileWidth = sampleWidth;\n\t\tfileHeight = sampleHeight;\n\t\t\n\t\t//make a sample first\n\t\t/*canvasPreviewContext.drawImage(videoArea, 0, 0, videoArea.width, videoArea.height);*/\n\t\t\n\t\t//initBuffers();\n\t\t\n\t\t\n\t\t/*document.onclick = function() {\n\t\t\tinitCubes();\n\t\t}*/\n\t\t\n\t\t//keep updating cubes based on the options\n\t\t//startUpdateCubesInterval();\n\t\tsetTimeout(initPlanes, 2000);\n\t\tstartUpdatePlanesInterval();\n\t\tstopUpdateCubesInterval();\n\t\t\n\t\t//keep rendering the screen based on mouse/camera position\n\t\tstartThreeInterval();\n\n\t\t\n\t} else if (fileType == \"IMAGE\") {\n\t\t\n\t\t\n\t\tsampleWidth = 30;\n\t\tsampleHeight = Math.floor((9/16)*sampleWidth);\n\t\t\n\t\t//load the image data and display in the preview\n\t\tvar img = new Image();\n\t\timg.onload = function() {\n\n\t\t\t//get the image dimensions so we can drawImage at the right aspect ratio\n\t\t\tsetNewFileDimensions(img);\n\t\t\t\n\t\t\t//draw the image onto the canvas\n\t\t canvasPreviewContext.drawImage(img, 0, 0, fileWidth, fileHeight);\n\t\t\t\n\t\t\t//initBuffers();\n\t\t\tinitCubes();\n\t\t\t//initPlanes();\n\t\t\t\n\t\t\t//keep updating cubes based on the options\n\t\t\tstartUpdateCubesInterval();\n\t\t\tstopUpdatePlanesInterval();\n\t\t\t\n\t\t\t//keep rendering the screen based on mouse/camera position\n\t\t\tstartThreeInterval();\n\n\t\t}\n\t\t\n\t\t//set the src of our new file\n\t\timg.src = fileURL;\n\t\t\n\t\t//we should clear the video tag\n\t\tvideoArea.type = \"\";\n\t\tvideoArea.src = \"\";\n\t\tvideoArea.pause();\n\t\t\n\t\t//we should stop sampling the video if its there\n\t\tstopSamplingVideo();\n\t\t\n\t}\n\t\n}", "function FrameInitalizer(canvas, form, video, options) {\n //Opt parse.\n options = options || {};\n this.drawFrame = options.override_frame_draw || this._drawFrame\n this.drawImage = options.override_image_draw || this._drawImage\n this.drawPolygons = options.override_polygon_draw || this._drawPolygons\n //I might add a string to the OnChange functions that says where they were called from.\n //I could also add stuff like OnClear or whatever, not really sure I wanna go for that.\n //A return a reference to the previous state?\n //You shouldn't need these unless you do web worker stuff anyways.\n this.onImageChange = options.on_image_change_functor || (function(self) {\n return; //self.drawFrame() //Do nothing, if they want to draw on every update, let them set this.\n });\n this.onPolygonChange = options.on_polygon_change_functor || (function(self) {\n return; //self.drawFrame(); //Do nothing, if they want to draw on every update, let them set this.\n });\n this.source = options.source || null;\n this.number_of_frames = options.number_of_frames || 1;\n //Mandatory positional args.\n this.canvas = canvas;\n this.form = form;\n this.video = video; //video element;\n this.frames = [new _FrameTracker(0)];\n this.frame_index = 0;\n this.updateFrameList(1);\n }", "function initialize() {\n // Create a canvas element to which we will copy video.\n canvas = document.createElement('canvas');\n var webcamDimensions = webcam.getDimensions();\n canvas.width = webcamDimensions.width;\n canvas.height = webcamDimensions.height;\n\n // We need a context for the canvas in order to copy to it.\n context = canvas.getContext('2d');\n\n // create an AR Marker detector using the canvas as the data source\n detector = ardetector.create( canvas );\n\n // Create an AR View for displaying the augmented reality scene\n view = arview.create( webcam.getDimensions(), canvas );\n\n // Set the ARView camera projection matrix according to the detector\n view.setCameraMatrix( detector.getCameraMatrix(10,1000) );\n\n // Place the arview's GL canvas into the DOM.\n document.getElementById(\"application\").appendChild( view.glCanvas );\n }", "function setup() {\n createCanvas(640, 480, P2D); // canvas has same dimensions as my webcam\n background(0);\n stroke(0, 255, 0);\n noFill();\n\n // make sure the framerate is the same between sending and receiving\n frameRate(30);\n\n // Set to true to turn on logging for the webrtc client\n WebRTCPeerClient.setDebug(true);\n\n // To connect to server over public internet pass the ngrok address\n // See https://github.com/lisajamhoury/WebRTC-Simple-Peer-Examples#to-run-signal-server-online-with-ngrok\n WebRTCPeerClient.initSocketClient('https://XXXXXXXX.ngrok.io/');\n\n // Start the peer client\n WebRTCPeerClient.initPeerClient();\n\n // start your video\n // your webcam will always appear below the canvas\n myVideo = createCapture(VIDEO);\n myVideo.size(width, height);\n myVideo.hide();\n\n ////// HOW TO DEFINE OTHER PERSON'S VIDEO? //////\n // otherVideo = createCapture(VIDEO);\n // otherVideo.size(width, height);\n\n}", "function paintToCanvas() { //to display webcame live in a specified canvas with videos actual height and width\n\n const width = video.videoWidth; //getting actual height and width of video\n const height = video.videoHeight;\n canvas.width = width; //setting the canvas width and height accordingly \n canvas.height = height;\n return setInterval(() => { //by setintertval method we are drawing the recieved video's image in after every 16milli sec \n ctx.drawImage(video, 0, 0, width, height); //here we are drawing the image recieved in canvas\n let pixels = ctx.getImageData(0, 0, width, height) //here we are getting the canvas image to make some effect\n // console.log(pixels)\n // debugger;\n // pixels = redeffect(pixels) //here redeffect is called\n // console.log(hola);\n pixels = rgbsplit(pixels) // we are calling rgb split to make some changes in the pixels thats is the image we get from canvas\n ctx.globalAlpha=0.8; \n // pixels = greenscreen(pixels)\n ctx.putImageData(pixels, 0, 0); //after we get the changed pixels we put it back in the canvas\n }, 16);\n}", "function setup() {\n createCanvas(640, 480);\n video = select(\"video\") || createCapture(VIDEO);\n video.size(width, height);\n\n const poseNet = ml5.poseNet(video, { flipHorizontal: true }, () => {\n select(\"#status\").hide();\n });\n\n poseNet.on(\"pose\", (newPoses) => {\n poses = newPoses;\n });\n\n // Hide the video element, and just show the canvas\n video.hide();\n}", "function ytInject() {\n injectStyle();\n injectCanvas();\n injectButton();\n\n $(window).resize(function() {\n var main = $('#vt-main-div').get(0);\n var canvas = $('#vt-canvas').get(0);\n\n main.style.height = $('.video-stream').height();\n main.style.width = $('.video-stream').width();\n $('#vt-canvas').height($('vt-main-div').height());\n $('#vt-canvas').width($('vt-main-div').width());\n\n //Scale the canvas to achieve proper resolution\n canvas.width=$('#vt-main-div').width()*window.devicePixelRatio;\n canvas.height=$('#vt-main-div').height()*window.devicePixelRatio;\n canvas.style.width=$('#vt-main-div').width() + \"px\";\n canvas.style.height=$('#vt-main-div').height() + \"px\";\n });\n}", "setup(canvas) {\n this.engine.renderer.setup(canvas);\n this.start();\n }", "function start() {\n if (initialized)\n return;\n\n let myCanvas = document.getElementById(\"canvas\");\n myCanvas.classList.toggle(\"hide\");\n\n let button = document.getElementById(\"webcamButton\");\n button.classList.add(\"hide\");\n\n window.ctx = myCanvas.getContext('2d', {alpha: false});\n\n var mycamvas = new camvas(window.ctx, processFrame);\n initialized = true;\n}", "function drawVedio() {\n setTimeout(() => {\n canvas.getContext(\"2d\").drawImage(video, 0, 0, 100, 100);\n drawVedio();\n }, 0);\n }", "function setupMotionDetection() {\n md_canvas = document.getElementById('mdCanvas');\n test_canvas = document.getElementById('testCanvas');\n md_canvas.width = vid_width;\n md_canvas.height = vid_height;\n}", "function prepareCanvas() {\n canvas = window._canvas = new fabric.Canvas('canvas');\n canvas.backgroundColor = '#ffffff';\n canvas.isDrawingMode = 1;\n canvas.freeDrawingBrush.color = \"black\";\n canvas.freeDrawingBrush.width = 1;\n canvas.renderAll();\n //setup listeners \n canvas.on('mouse:up', function(e) {\n getFrame();\n mousePressed = false\n });\n canvas.on('mouse:down', function(e) {\n mousePressed = true\n });\n canvas.on('mouse:move', function(e) {\n recordCoor(e)\n });\n}", "function setupCanvas() {\n// setup everything else\n\tconsole.log(\"Setting up canvas...\")\n\tcanvas = document.getElementById(\"drone-sim-canvas\");\n\twindow.addEventListener(\"keyup\", keyFunctionUp, false);\n\twindow.addEventListener(\"keydown\", keyFunctionDown, false);\n\twindow.onresize = doResize;\n\tcanvas.width = window.innerWidth-16;\n\tcanvas.height = window.innerHeight-200;\n\tconsole.log(\"Done.\")\n}", "function setup() {\n createCanvas(windowWidth, windowHeight);\n capture = createCapture(VIDEO);\n capture.size(windowWidth, windowHeight);\n capture.hide();\n background(255, 0, 200);\n}", "function setup() {\n // setup canvas: target\n canvas = createCanvas(640, 480, WEBGL);\n canvas.id('p5canvas');\n background(51);\n\n // setup webcam: source\n video = createCapture(VIDEO);\n video.size(width, height);\n video.id('p5video'); // giving an ID to the video to link to seriously\n video.hide();\n\n // switch between modes\n createP(\"To start, press 'a' for blur or 's' for vignette.\");\n\n // adjust blur\n createP('Adjust Blur');\n blurSlider = createSlider(0, 1, 0.5, 0.01);\n blurSlider.id('blur-slider');\n\n // adjust vignette strength\n createP('Adjust Vignette');\n vignetteSlider = createSlider(0, 100, 50);\n vignetteSlider.id('vignette-slider');\n\n\n // Call Seriously function inside the variable: seriously\n seriously = new Seriously(); // create an object called seriously\n\n // Source: webcam, target: canvas\n src = seriously.source('#p5video');\n target = seriously.target('#p5canvas');\n\n keyReleased();\n\n seriously.go();\n\n\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}", "function render(){\n var canvas = $('#canvas')[0];\n var context = canvas.getContext('2d');\n var video = $('#camera')[0];\n\n // copy camera frame from video to canvas so lines can be drawn on\n try{\n context.drawImage(video, 0, 0, video.width, video.height);\n }\n catch(error){\n if(error.name != \"NS_ERROR_NOT_AVAILABLE\"){\n throw error;\n }\n }\n\n // save original canvas\n var subcanvas = $('#binary')[0];\n var subcontext = subcanvas.getContext('2d');\n subcontext.drawImage(canvas, canvas.width/4, canvas.height*3/8, canvas.width/2, canvas.height/4, 0, 0, subcanvas.width, subcanvas.height);\n\n // remaining detection\n process(subcanvas);\n\n // flip horizontally\n context.setTransform(1, 0, 0, 1, 0, 0);\n context.translate(canvas.width, 0);\n context.scale(-1, 1);\n\n // draw line\n context.lineWidth = 1;\n context.strokeStyle = 'green';\n context.beginPath();\n context.moveTo(canvas.width/4, canvas.height/2);\n context.lineTo(canvas.width*3/4, canvas.height/2);\n context.moveTo(canvas.width/2, canvas.height*3/8);\n context.lineTo(canvas.width/2, canvas.height*5/8);\n context.stroke();\n\n context.strokeStyle = 'blue';\n context.beginPath();\n context.moveTo(canvas.width*1/4, canvas.height*3/8);\n context.lineTo(canvas.width*3/4, canvas.height*3/8);\n context.lineTo(canvas.width*3/4, canvas.height*5/8);\n context.lineTo(canvas.width*1/4, canvas.height*5/8);\n context.closePath();\n context.stroke();\n\n requestAnimationFrame(render);\n }", "initialiseCanvas(){\n let canvas = document.querySelector(\".genetic-art .canvas_container .result\");\n canvas.width = this.modelData.width;\n canvas.height = this.modelData.height;\n }", "function setCanvas(){\n _canvas = document.getElementById('canvas');\n _stage = _canvas.getContext('2d');\n _canvas.width = _puzzleWidth;\n _canvas.height = _puzzleHeight;\n}", "async function setupCamera() {\n const video = document.getElementById('video');\n const canvas = document.getElementById('canvas');\n if (!video || !canvas) return null;\n\n let msg = '';\n log('Setting up camera');\n // setup webcam. note that navigator.mediaDevices requires that page is accessed via https\n if (!navigator.mediaDevices) {\n log('Camera Error: access not supported');\n return null;\n }\n let stream;\n const constraints = {\n audio: false,\n video: { facingMode: 'user', resizeMode: 'crop-and-scale' },\n };\n if (window.innerWidth > window.innerHeight) constraints.video.width = { ideal: window.innerWidth };\n else constraints.video.height = { ideal: window.innerHeight };\n try {\n stream = await navigator.mediaDevices.getUserMedia(constraints);\n } catch (err) {\n if (err.name === 'PermissionDeniedError' || err.name === 'NotAllowedError') msg = 'camera permission denied';\n else if (err.name === 'SourceUnavailableError') msg = 'camera not available';\n log(`Camera Error: ${msg}: ${err.message || err}`);\n return null;\n }\n // @ts-ignore\n if (stream) video.srcObject = stream;\n else {\n log('Camera Error: stream empty');\n return null;\n }\n const track = stream.getVideoTracks()[0];\n const settings = track.getSettings();\n if (settings.deviceId) delete settings.deviceId;\n if (settings.groupId) delete settings.groupId;\n if (settings.aspectRatio) settings.aspectRatio = Math.trunc(100 * settings.aspectRatio) / 100;\n log(`Camera active: ${track.label}`); // ${str(constraints)}\n log(`Camera settings: ${str(settings)}`);\n canvas.addEventListener('click', () => {\n // @ts-ignore\n if (video && video.readyState >= 2) {\n // @ts-ignore\n if (video.paused) {\n // @ts-ignore\n video.play();\n detectVideo(video, canvas);\n } else {\n // @ts-ignore\n video.pause();\n }\n }\n // @ts-ignore\n log(`Camera state: ${video.paused ? 'paused' : 'playing'}`);\n });\n return new Promise((resolve) => {\n video.onloadeddata = async () => {\n // @ts-ignore\n canvas.width = video.videoWidth;\n // @ts-ignore\n canvas.height = video.videoHeight;\n // @ts-ignore\n video.play();\n detectVideo(video, canvas);\n resolve(true);\n };\n });\n}", "function setup() {\n createCanvas(1280, 480); // Create a display window\n img = loadImage('lk.jpg'); // Load the image\n capture = createCapture(VIDEO); // Get the capture video\n capture.id(\"video_elemyent\"); // Set the video Id\n capture.size(640, 480); // Define video size to 640x480\n capture.hide() // Hide the streaning video\n faceapi = ml5.faceApi(capture, faceReady);\n}", "function setup() {\n let canvasDiv = document.getElementById('animation');\n canvasWidth = canvasDiv.offsetWidth;\n canvasHeight = canvasDiv.offsetHeight;\n pipesAmount = Math.floor(canvasHeight / (minPipeHeight + 1));\n pipesWidth = canvasWidth / (pipesAmount + 1);\n // Creates canvas\n let canvas = createCanvas(canvasWidth, canvasHeight);\n // Declares the parent div of the canvas\n canvas.parent('animation');\n}", "function setCanvas(){\r\n _canvas = document.getElementById('canvas');\r\n _stage = _canvas.getContext('2d');\r\n _canvas.width = _puzzleWidth;\r\n _canvas.height = _puzzleHeight;\r\n _canvas.style.border = \"1px solid black\";\r\n}", "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 }", "drawScreen () {\n if(this.video1.canplaythrough && this.video2.canplaythrough) {\n this.context.putImageData(this.video1.context.getImageData(0,0, 320, 180), 0, 0);\n this.context.putImageData(this.video2.context.getImageData(0,0, 320, 180), 0, 0);\n this.context.drawImage(this.video2.canvas, 0, 0);\n this.context.drawImage(this.video1.canvas, 0, 0);\n // let frame1 = this.video2.context.getImageData(0,0, 320, 180);\n // this.context.putImageData(frame1, 0, 0);\n }\n }", "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 }", "_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 }", "initializeCanvas(){\n\t\tconsole.log(`======] Init Canvas [======`, this.state);\n\n\t\tif(this.state.device.width && this.state.device.height){\n\t\t\tthis.canvas = document.createElement('canvas');\n\t\t\tthis.canvas.id = 'screen-canvas';\n\t\t\tthis.canvas.width = this.state.device.width/2;\n\t\t\tthis.canvas.height = this.state.device.height/2;\n\t\t\tthis.canvas.style = 'margin: 50px; border: 1px solid black; cursor: pointer;';\n\t\t\tthis.canvas.onmouseover = this.cursorOver.bind(this);\n\t\t\tthis.canvas.onmouseout = this.cursorOut.bind(this);\n\t\t\tthis.canvas.onmousedown = this.interactStart.bind(this);\n\t\t\tthis.canvas.onmousemove = this.interactMove.bind(this);\n\t\t\tthis.canvas.onmouseup = this.interactEnd.bind(this);\n\t\t\tthis.canvas.onmousewheel = this.mouseWheel.bind(this);\n\t\t\tdocument.body.onkeydown = this.keyDown.bind(this);\n\t\t\tdocument.body.onkeyup = this.keyUp.bind(this);\n\n\t\t\tdocument.getElementById('screen-container').appendChild(this.canvas)\n\t\t\tthis.ctx = this.canvas.getContext('2d');\n\t\t}else{\n\t\t\talert(`Device resolution failed to be detected`);\n\t\t}\n\t}", "function setup() {\n createCanvas(800, 600);\n pixelDensity(1); //for retina displays\n capture = createCapture(VIDEO);\n capture.size(width / vScale, height / vScale);\n capture.hide();\n\n\n}", "function createCanvasZone(canvas,ctx,video){\r\n \r\n var BtnZone = document.createElement('div');\r\n BtnZone.id=\"canvasBtnZone\";\r\n \r\n var clear_btn = document.createElement('input');\r\n clear_btn.type = \"button\";\r\n clear_btn.id = 'clearCanvas';\r\n clear_btn.className = \"canvas_btn\";\r\n clear_btn.value='Clear';\r\n clear_btn.onclick=function(){clearArea(ctx)};\r\n \r\n var close_btn = document.createElement('input');\r\n close_btn.type = \"button\";\r\n close_btn.className = \"canvas_btn\";\r\n close_btn.id = 'closeCanvas';\r\n close_btn.value='Close';\r\n close_btn.onclick=function(){BtnZone.remove();};\r\n \r\n\r\n \r\n var send_btn = document.createElement('input');\r\n send_btn.type = \"button\";\r\n send_btn.id = 'sendscreenShot';\r\n send_btn.className = \"canvas_btn\";\r\n send_btn.value='Send screenshot';\r\n send_btn.onclick=function(){sendScreenshot()};\r\n \r\n \r\n $('#CanvasZone').append(BtnZone);\r\n $('#canvasBtnZone').append(clear_btn);\r\n $('#canvasBtnZone').append(close_btn);\r\n $('#canvasBtnZone').append(send_btn); \r\n $('#canvasBtnZone').append(canvas); \r\n \r\n InitThis(ratio,canvas,video);\r\n}", "function takePhoto (e) {\nlet ctx = outputCanvas.getContext('2d')\nctx.drawImage(inputVideo,0,0)\n}", "function initCanvas(width, height){}", "function setup()\n{\n const maxWidth = Math.min(windowWidth, windowHeight);\n pixelDensity(1);\n outputWidth = maxWidth;\n outputHeight = maxWidth * 0.75; // 4:3\n\n createCanvas(outputWidth, outputHeight);\n\n // webcam capture\n videoInput = createCapture(VIDEO);\n videoInput.size(outputWidth, outputHeight);\n videoInput.hide();\n\n // select filter\n const sel = createSelect();\n const selectList = ['Donal trump', 'Dog Filter', 'billgate', 'pikachu']; // list of filters\n sel.option('Select Filter', -1); // Default no filter\n for (let i = 0; i < selectList.length; i++)\n {\n sel.option(selectList[i], i);\n }\n sel.changed(applyFilter);\n\n // tracker\n faceTracker = new clm.tracker();\n faceTracker.init();\n faceTracker.start(videoInput.elt);\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 }", "init() {\n if (this.canvas.getContext) {\n this.start();\n } else {\n canvas.textContent = 'Sorry canvas not suport';\n }\n }", "function adaptElements() {\n const rect = document.body.getBoundingClientRect();\n const screenWidth = rect.width;\n const screenHeight = rect.height;\n const videoWidth = video.videoWidth;\n const videoHeight = video.videoHeight;\n const widthRatio = videoWidth / screenWidth;\n const heightRatio = videoHeight / screenHeight;\n const ratio = Math.min(widthRatio, heightRatio);\n // set image size and offset\n imageWidth = Math.floor(ratio * screenWidth + 0.5);\n imageHeight = Math.floor(ratio * screenHeight + 0.5);\n videoX = Math.max(0, Math.floor(0.5 * (videoWidth - imageWidth) + 0.5));\n videoY = Math.max(0, Math.floor(0.5 * (videoHeight - imageHeight) + 0.5));\n // adapt canvas size to input video size\n canvas.width = imageWidth;\n canvas.height = imageHeight;\n // adapt canvas size to screen\n image.width = screenWidth;\n image.height = screenHeight;\n // calculate video screen size and offset\n const videoScreenWidth = Math.floor(videoWidth / ratio + 0.5);\n const videoScreenHeight = Math.floor(videoHeight / ratio + 0.5);\n const videoScreenX = Math.floor(videoX / ratio + 0.5);\n const videoScreenY = Math.floor(videoY / ratio + 0.5);\n // resize and position video an screen\n video.width = videoScreenWidth;\n video.height = videoScreenHeight;\n video.style.left = `${-videoScreenX}px`;\n video.style.top = `${-videoScreenY}px`;\n // show live video\n resetVideo();\n }", "static init(canvas){\r\n\r\n\r\n\t}", "function playVideo(videoTimeline) {\n\n const timelineNode = videoTimeline.next\n const video = videoTimeline.data.videoCore\n const videoEndTime = videoTimeline.data.metadata.endTime\n \n loop = () => {\n if (!window.currentlyPlaying) {\n return\n }\n\n if (videoEndTime < video.currentTime + 0.01) {\n /* Pausing the current video if necessary */\n video.pause()\n\n if (timelineNode) {\n\n /* Setting the current switch value */\n if (timelineNode.data.metadata.ratio == 'fit') {\n window.currentRatio = 'fit'\n document.querySelector('.toogle-fit').click()\n } else if (timelineNode.data.metadata.ratio == 'strech') {\n window.currentRatio = 'strech'\n document.querySelector('.toogle-strech').click()\n }\n\n /* Starting next video from the beginning */\n timelineNode.data.videoCore.currentTime = timelineNode.data.metadata.startTime\n\n /* Updating the window.currentVideoSelectedForPlayback variable */\n window.currentVideoSelectedForPlayback = timelineNode\n\n /* Playing the next frame */\n playVideo(timelineNode)\n }\n } else {\n /* Updating the UI */\n renderUIAfterFrameChange(videoTimeline)\n\n /* Drawing at 30fps (1000 / 30 = 33,3333..)*/\n setTimeout(loop, 33.3333333) \n }\n }\n\n alpha1 = canvas.width * video.videoHeight / canvas.height - video.videoWidth\n alpha2 = video.videoWidth * canvas.height / canvas.width - video.videoHeight\n\n if (alpha1 < alpha2) {\n canvas.width = video.videoWidth + alpha1\n canvas.height = video.videoHeight\n } else {\n canvas.width = video.videoWidth\n canvas.height = video.videoHeight + alpha2\n }\n \n loop()\n video.play()\n}", "function gStart() {\n\n // PREVENT DOUBLE CLICK FROM SELECTING THE CANVAS:\n\n var noSelectHTML = \"\"\n + \" <style type='text/css'>\"\n + \" canvas {\"\n + \" -webkit-touch-callout: none;\"\n + \" -webkit-user-select: none;\"\n + \" -khtml-user-select: none;\"\n + \" -moz-user-select: none;\"\n + \" -ms-user-select: none;\"\n + \" user-select: none;\"\n + \" outline: none;\"\n + \" -webkit-tap-highlight-color: rgba(255, 255, 255, 0);\"\n + \" }\"\n + \" </style>\"\n ;\n var headElement = document.getElementsByTagName('head')[0];\n headElement.innerHTML = noSelectHTML + headElement.innerHTML;\n\n // ADD VIEWER ELEMENTS TO DOCUMENT\n\n var viewerHTML = \"\"\n\n + \" <canvas id='video_analysis_canvas' tabindex=1 width=480 height=360\"\n + \" style='z-index:1;position:absolute;left:400;top:-20;'>\"\n + \" </canvas>\"\n\n + \" <canvas id='slide' tabindex=1\"\n + \" style='z-index:1;position:absolute;left:0;top:0;'>\"\n + \" </canvas>\"\n +\n (isShowingRenderer\n ?\n \" <div id='scene_div' tabindex=1\"\n + \" style='z-index:1;position:absolute;left:0;top:0;'>\"\n + \" </div>\"\n :\n \" <!!div id='scene_div' tabindex=1\"\n + \" style='z-index:1;position:absolute;left:0;top:0;'>\"\n + \" <!!/div>\"\n )\n\n + \" <canvas id='webgl_canvas' tabindex=1\"\n + \" style='z-index:1;position:absolute;left:0;top:0;'>\"\n + \" </canvas>\"\n\n + \" <canvas id='sketch_canvas' tabindex=1\"\n + \" style='z-index:1;position:absolute;left:0;top:0;'>\"\n + \" </canvas>\"\n\n + \" <canvas id='video_canvas' tabindex=1\"\n + \" style='z-index:1;position:absolute;left:0;top:0;'>\"\n + \" </canvas>\"\n\n + \" <canvas id='events_canvas' tabindex=1\"\n + \" style='z-index:1;position:absolute;left:0;top:0;'>\"\n + \" </canvas>\"\n\n + \" <canvas id='background' color='\" + backgroundColor + \"'></canvas>\"\n + \" <div id='code'\"\n + \" style='z-index:1;position:absolute;left:0;top:0;'>\"\n + \" </div>\"\n\n// + \" <input id='soundfileinput' type='file' style='visibility:hidden' /> </input>\"\n ;\n window.bodyElement = document.getElementsByTagName('body')[0];\n bodyElement.innerHTML = '<div id=\"root_div\">' + viewerHTML + bodyElement.innerHTML + '</div>';\n bodyElement.style.color = blackBackgroundColor;\n\n // SET ALL THE SCREEN-FILLING ELEMENTS TO THE SIZE OF THE SCREEN.\n\n slide.width = width();\n sketch_canvas.width = width();\n events_canvas.width = width();\n\n slide.height = height();\n sketch_canvas.height = height();\n events_canvas.height = height();\n\n background.width = width();\n background.height = height();\n background.style.backgroundColor = backgroundColor;\n\n // INITIALIZE THE SKETCH CANVAS\n\n sketch_canvas.animate = function(elapsed) { sketchPage.animate(elapsed); }\n sketch_canvas.overlay = function() { sketchPage.overlay(); }\n sketch_canvas.setup = function() {\n window.onbeforeunload = function(e) { sketchBook.onbeforeunload(e); }\n setPage(0);\n }\n\n events_canvas.keyDown = function(key) { e2s(); sketchPage.keyDown(key); }\n events_canvas.keyUp = function(key) { e2s(); sketchPage.keyUp(key); }\n events_canvas.mouseDown = function(x, y, z) { e2s(); sketchPage.mouseDown(x, y, z); }\n events_canvas.mouseDrag = function(x, y, z) { e2s(); sketchPage.mouseDrag(x, y, z); }\n events_canvas.mouseMove = function(x, y, z) { e2s(); sketchPage.mouseMove(x, y, z); }\n events_canvas.mouseUp = function(x, y, z) { e2s(); sketchPage.mouseUp (x, y, z); }\n\n fourStart();\n\n if (window['scene_div'] !== undefined) {\n scene_div.width = width();\n scene_div.height = height();\n var sceneElement = document.getElementById('scene_div');\n sceneElement.appendChild(renderer.domElement);\n }\n\n // SET SIZE OF WEBGL CANVAS\n\n webgl_canvas.width = width();\n webgl_canvas.height = height();\n\n // START WEBGL MODELER\n\n if (isPhone()) {\n sketchPadding *= 2;\n }\n\n lightTracker = new LightTracker(video_analysis_canvas);\n\n window.ctScene = new CT.Scene(webgl_canvas);\n ctScene.setLight(0, [ 1, 1, 1]);\n ctScene.setLight(1, [-1,-1,-1], [.1, .05, 0]);\n ctScene.setFOV(isPhone() ? PI / 2.5 : PI / 6);\n\n initCTPath();\n\n // START ALL CANVASES RUNNING\n\n var c = document.getElementsByTagName(\"canvas\");\n\n initEventHandlers(events_canvas);\n initSketchCanvas();\n\n // SET SIZE OF VIDEO CANVAS\n\n video_canvas.width = width();\n video_canvas.height = height();\n\n // server = new Server();\n // socket = server.connectSocket();\n\n midi = new Midi();\n\n document.title = 'Chalktalk';\n }", "function init(options) {\n\t\t// sanity check\n\t\tif (!options) {\n\t\t\tthrow 'No options object provided';\n\t\t}\n\n\t\t// incoming options with defaults\n\t\tvideo = options.video || document.createElement('video');\n\t\tmotionCanvas = options.motionCanvas || document.createElement('canvas');\n\t\tcaptureIntervalTime = options.captureIntervalTime || 100;\n\t\tcaptureWidth = options.captureWidth || 640;\n\t\tcaptureHeight = options.captureHeight || 480;\n\t\tdiffWidth = options.diffWidth || 64;\n\t\tdiffHeight = options.diffHeight || 48;\n\t\tpixelDiffThreshold = options.pixelDiffThreshold || 32;\n\t\tscoreThreshold = options.scoreThreshold || 16;\n\t\tincludeMotionBox = options.includeMotionBox || false;\n\t\tincludeMotionPixels = options.includeMotionPixels || false;\n\n\t\t// callbacks\n\t\tinitSuccessCallback = options.initSuccessCallback || function() {};\n\t\tinitErrorCallback = options.initErrorCallback || function() {};\n\t\tstartCompleteCallback = options.startCompleteCallback || function() {};\n\t\tcaptureCallback = options.captureCallback || function() {};\n\n\t\t// non-configurable\n\t\tcaptureCanvas = document.createElement('canvas');\n\t\tdiffCanvas = document.createElement('canvas');\n\t\tisReadyToDiff = false;\n\n\t\t// prep video\n\t\tvideo.autoplay = true;\n\n\t\t// prep capture canvas\n\t\tcaptureCanvas.width = captureWidth;\n\t\tcaptureCanvas.height = captureHeight;\n\t\tcaptureContext = captureCanvas.getContext('2d');\n\n\t\t// prep diff canvas\n\t\tdiffCanvas.width = diffWidth;\n\t\tdiffCanvas.height = diffHeight;\n\t\tdiffContext = diffCanvas.getContext('2d');\n\n\t\t// prep motion canvas\n\t\tmotionCanvas.width = diffWidth;\n\t\tmotionCanvas.height = diffHeight;\n\t\tmotionContext = motionCanvas.getContext('2d');\n\n\t\trequestWebcam();\n\t}", "initCanvas() { \n\t\tthis.canvas = document.getElementById(\"canvas\");\n\t\tthis.canvas.width = this.level.getNumBlocksRow * Block.SIZE + (2 * Sprite.SIDE_LR_WIDTH);\n\t\tthis.canvas.height = this.level.getNumBlocksColumn * Block.SIZE + (3 * Sprite.SIDE_TMD_HEIGHT) + Sprite.PANEL_HEIGHT;\n\t\tthis.ctx = this.canvas.getContext(\"2d\");\t\n\t}", "constructor(sourceCanvas, resultCanvas) {\n this.source = sourceCanvas.getContext(\"2d\")\n this.result = resultCanvas.getContext(\"2d\")\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}", "_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 Init() {\n // Get context handles\n CanvasHandle = document.getElementById(\"canvas\");\n CanvasHandle.width = ratioX * scale;\n CanvasHandle.height = ratioY * scale;\n ContextHandle = CanvasHandle.getContext(\"2d\");\n CanvasWidth = ContextHandle.canvas.clientWidth;\n CanvasHeight = ContextHandle.canvas.clientHeight;\n\n // Create an image backbuffer\n BackCanvasHandle = document.createElement(\"canvas\");\n BackContextHandle = BackCanvasHandle.getContext(\"2d\");\n BackCanvasHandle.width = CanvasWidth;\n BackCanvasHandle.height = CanvasHeight;\n\n // Set line style\n BackContextHandle.lineCap = \"butt\";\n BackContextHandle.lineJoin = \"round\";\n\n // Get the canvas center\n CenterX = CanvasWidth / 2;\n CenterY = CanvasHeight / 2;\n Camera = {x:0, y:0, z:1};\n}", "set canvas(c){\n this._canvas = c ;\n if (c){\n this._context = c.getContext('2d') ;\n }\n }", "function startVideo() {\n navigator.getUserMedia(\n { \n video: \n {\n //the ideal part is imp, it helps to get 16:9 ratio also\n height : { ideal : window.innerHeight } ,\n width : { ideal : window.innerWidth }\n } \n } ,\n stream => video.srcObject = stream,\n err => console.error(err)\n ) \n}", "function initVideo() {\n log_d(\"Initializing the video subsystem\");\n\n var setVideoDev = function (devs) {\n log_d(\"Got video capture devices: \" + JSON.stringify(devs));\n var dev = '';\n $.each(devs, function (k, v) {\n dev = k;\n $('#webcamsSelect').append($('<option value=\"' + k + '\">' + v + '</option> '));\n });\n if (dev) {\n log_d(\"Using video capture device: \" + JSON.stringify(devs[dev]));\n window.configuredDevice = dev;\n service.setVideoCaptureDevice(CDO.createResponder(startLocalPreview), dev);\n } else {\n log_e(\"None video capture devices installed.\");\n }\n };\n log_d(\"Getting video capture devices\");\n service.getVideoCaptureDeviceNames(CDO.createResponder(setVideoDev));\n\n}", "function demo(vid) {\n\tvar video = vid;\n\tvar demo = this;\n\tvar width = 640, height = 480;//can also use video.offsetHeight/video.offsetWidth but the value seems to change once the video actually starts.\n\tvar el = document.getElementById('demo-content');\n\t\n\tvar gui = new dat.GUI({ autoPlace: false });\n\tel.appendChild(gui.domElement);\n\t\n\tvar videoImageContext;\n\t\n\t//public variables:\n\tthis.mode = \"chromaKey\";\n\tgui.add(this, \"mode\", [\"Chroma Key\", \"Subtraction\", \"Fancy Method\"]);\n\t\n\tthis.bg_snapshot = function(){\n\t\tsnapshot();\n\t}\n\tgui.add(this, \"bg_snapshot\");\n\n\tinit();\n\t\n\tfunction init() {\n\t\tvideoImage = document.createElement( 'canvas' );\n\t\tvideoImage.width = width;\n\t\tvideoImage.height = height;\n\t\tel.appendChild( videoImage );\n\t\t\n\t\tvideoImageContext = videoImage.getContext( '2d' );\n\t\tvideoImageContext.scale(-1, 1);\n\t\tanimate();\n\t}\n\t\n\tfunction animate(){\n\t\trequestAnimationFrame( animate );\n\t\trender();\n\t}\n\t\n\tfunction drawImage(){\n\t\t//mirror the image using scale(-1, 1)\n\t\tvideoImageContext.drawImage(video, -width, 0, width, height);\n\t\t//videoImageContext.drawImage(video, 0, 0, width, height); //original method\n\t}\n\t\n\tfunction render(){\n\t\tif (video.readyState === video.HAVE_ENOUGH_DATA ){\n\t\t\tdrawImage();\n\t\t\tswitch (this.mode){\n\t\t\t\tcase 'Chroma Key':\n\t\t\t\t\tchromaKey();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Subtraction':\n\t\t\t\t\tsubtraction();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'Fancy Method':\n\t\t\t\t\tfancy();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tchromaKey();\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tvar color_ratio = 2.5, threshold = 40;\n\tfunction chromaKey() {\n\t\tvar frame = videoImageContext.getImageData(0, 0, width, height);\n\t\tvar l = frame.data.length / 4;\n\t\t\n\t\tfor (var i = 0; i < l; i++) {\n\t\t\tvar pos = i*4;\n\t\t\tvar r = frame.data[pos + 0];\n\t\t\tvar g = frame.data[pos + 1];\n\t\t\tvar b = frame.data[pos + 2];\n\t\t\tif (b>r && b>g && (b>r*color_ratio || b>g*color_ratio) && b > threshold){\n\t\t\t\tframe.data[pos + 0] = 255;\n\t\t\t\tframe.data[pos + 1] = 255;\n\t\t\t\tframe.data[pos + 2] = 255;\n\t\t\t\tframe.data[pos + 3] = 0;\n\t\t\t}\n\t\t}\n\t\t//renderer.clear();\n\t\tvideoImageContext.putImageData(frame, 0, 0);\n\t\t//videoImageContext.clearRect(0,0,50,50);\n\t}\n\t\n\tvar old_data = [], index = 0, buffer_length = 5, std_cutoff = 40;\n\tfunction fancy() {\n\t\tvar frame = videoImageContext.getImageData(0, 0, width, height);\n\t\told_data[index] = new Uint8ClampedArray(frame.data);\n\t\t\n\t\tvar current_buffer_size = old_data.length;\n\t\tvar l = frame.data.length / 4;\n\t\tfor (var i = 0; i < l; i++) {\n\t\t\tvar pos = i*4, mean = 0;\n\t\t\tfor (var j = 0; j < current_buffer_size; j++)\n\t\t\t\tmean += (old_data[j][pos + 0] + old_data[j][pos + 1] + old_data[j][pos + 2])/3;\n\t\t\tmean /= buffer_length;\n\t\t\t\n\t\t\tvar std = 0;\n\t\t\tfor (var j = 0; j < current_buffer_size; j++) {\n\t\t\t\tvar color_avg = (old_data[j][pos + 0] + old_data[j][pos + 1] + old_data[j][pos + 2])/3;\n\t\t\t\tstd += Math.pow(color_avg - mean, 2);\n\t\t\t}\n\t\t\tstd = Math.sqrt(std);\n\t\t\t//console.log('std: ', std);\n\t\t\t\n\t\t\tif (std < std_cutoff){\n\t\t\t\t//frame.data[pos + 0] = 255;\n\t\t\t\t//frame.data[pos + 1] = 255;\n\t\t\t\t//frame.data[pos + 2] = 255;\n\t\t\t\tframe.data[pos + 3] = 0;\n\t\t\t}\n\t\t\t//frame.data[pos + 3] = Math.exp(std);\n\t\t}\n\t\t//renderer.clear();\n\t\tvideoImageContext.putImageData(frame, 0, 0);\n\t\t//videoImageContext.clearRect(0,0,50,50);\n\t\tindex = (index+1)%buffer_length;\n\t\t//console.log('index: ', index);\n\t}\n\t\n\tvar snapshot_data;\n\tfunction snapshot(){\n\t\tdrawImage();\n\t\tvar frame = videoImageContext.getImageData(0, 0, width, height);\n\t\tsnapshot_data = new Uint8ClampedArray(frame.data);\n\t}\n\t\n\tvar first = true, difference_threshold = 20, frame_length=0;\n\tfunction subtraction() {\n\t\tvar frame = videoImageContext.getImageData(0, 0, width, height);\n\t\tif (first) {\n\t\t\tsnapshot();\n\t\t\tfirst = false;\n\t\t\tframe_length = frame.data.length / 4;\n\t\t}\n\t\tfor (var i = 0; i < frame_length; i++) {\n\t\t\tvar pos = i*4, r = pos, g = pos+1, b = pos+2;\n\t\t\t\n\t\t\tvar difference = Math.sqrt((Math.pow(frame.data[r]-snapshot_data[r], 2) + Math.pow(frame.data[g]-snapshot_data[g], 2) + Math.pow(frame.data[b]-snapshot_data[b], 2))/3);\n\t\t\tif (difference < difference_threshold) {\n\t\t\t\tframe.data[pos + 3] = 0;\n\t\t\t}\n\t\t}\n\t\tvideoImageContext.putImageData(frame, 0, 0);\n\t}\n\t\n\t//var bin_images = [], bin_counts = [], total_bins = 5, curr_bins = 0, frame_length = 0;\n\t//function subtraction() {\n\t// var frame = videoImageContext.getImageData(0, 0, width, height);\n\t// if (curr_bins < bins) {\n\t//\t\tbin_images[curr_bins] = new Uint8ClampedArray(frame.data);\n\t//\t\tcurr_bins++;\n\t//\t\tframe_length = frame.data.length / 4;\n\t//\t}\n\t// for (var i = 0; i < frame_length; i++) {\n\t//\t\tvar pos = i*4, best_bin = 0, r = pos, g = pos+1, b = pos+2;\n\t//\t\t\n\t//\t\tvar min_idx = 0, min_val = -1;\n\t//\t\tfor (var j = 0; j < curr_bins; j++){\n\t//\t\t\tvar data = possible_backgrounds[j];\n\t//\t\t\tvar difference = Math.sqrt((Math.pow(frame.data[r]-data[r], 2) + Math.pow(frame.data[g]-data[g], 2) + Math.pow(frame.data[b]-data[b], 2))/3);\n\t//\t\t\tif (difference < max_val || min_val == -1) {\n\t//\t\t\t\tmax_val = difference;\n\t//\t\t\t\tmin_idx = j;\n\t//\t\t\t}\n\t//\t\t}\n\t//\t\t\n\t//\t\t\n\t//\t\tvar std = 0;\n\t//\t\tfor (var j = 0; j < buffer_length; j++) {\n\t//\t\t\tvar color_avg = (old_data[j][pos + 0] + old_data[j][pos + 1] + old_data[j][pos + 2])/3;\n\t//\t\t\tstd += Math.pow(color_avg - mean, 2);\n\t//\t\t}\n\t//\t\tstd = Math.sqrt(std);\n\t//\t\t//console.log('std: ', std);\n\t//\t\t\n\t// if (std < std_cutoff){\n\t// //frame.data[pos + 0] = 255;\n\t// //frame.data[pos + 1] = 255;\n\t// //frame.data[pos + 2] = 255;\n\t// frame.data[pos + 3] = 0;\n\t// }\n\t//\t\t//frame.data[pos + 3] = Math.exp(std);\n\t// }\n\t// //renderer.clear();\n\t// videoImageContext.putImageData(frame, 0, 0);\n\t// //videoImageContext.clearRect(0,0,50,50);\n\t//\tindex = (index+1)%buffer_length;\n\t//\t//console.log('index: ', index);\n\t//}\n}", "function canvasInit() {\n var canvas = document.getElementById(\"canvas\");\n if (canvas.getContext) {\n var ctx = canvas.getContext(\"2d\");\n ctx.fillStyle = '#444';\n ctx.font = '28px Arial';\n wrapText(ctx, \"← Start by entering a jsonline.com url on the left.\", 100, 25, 700, 50);\n step = 0;\n }\n}", "function initEditorCanvas() {\n let canvas = document.getElementById('editorCanvas');\n // Resize the canvas.\n canvas.width = EDITOR_SCALE * CHR_WIDTH;\n canvas.height = EDITOR_SCALE * CHR_HEIGHT;\n\n let ctx = cmn.getContext2DNA(canvas);\n ctx.imageSmoothingEnabled = false;\n ctx.scale(EDITOR_SCALE, EDITOR_SCALE);\n\n // Canvas is white by default.\n ctx.fillStyle = 'black';\n ctx.fillRect(0, 0, CHR_WIDTH, CHR_HEIGHT);\n\n canvas.addEventListener('mousedown', function (me) { _mouseDown = true; onMouseMove(me); });\n canvas.addEventListener('mousemove', onMouseMove);\n canvas.addEventListener('mouseup', function (me) { _mouseDown = false; });\n canvas.addEventListener('mouseleave', function (me) { _mouseDown = false; });\n}", "function init() {\n canvas = document.getElementById('can');\n ctx = canvas.getContext(\"2d\");\n}", "function init() {\n // Put event listeners into place\n // Notice that in this specific case handlers are loaded on the onload event\n window.addEventListener('DOMContentLoaded', function() {\n // Grab elements, create settings, etc.\n var canvas = document.getElementById('canvas');\n var context = canvas.getContext('2d');\n var video = document.getElementById('video');\n var mediaConfig = {\n video: true,\n };\n var errBack = function(e) {\n console.log('An error has occurred!', e);\n };\n\n // Put video listeners into place\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n navigator.mediaDevices.getUserMedia(mediaConfig).then(function(stream) {\n video.srcObject = stream;\n video.onloadedmetadata = function(e) {\n video.play();\n };\n });\n }\n\n // Trigger photo take\n document.getElementById('snap').addEventListener('click', function() {\n context.drawImage(video, 0, 0, 640, 480);\n state.photoSnapped = true; // photo has been taken\n });\n\n // Trigger when upload button is pressed\n document.getElementById('upload').addEventListener('click', uploadImage);\n\n document.getElementById('search').addEventListener('click',searchPhoto);\n\n }, false);\n\n }", "function main()\n{\n\t//Function to execute when a canvas is created:\n\tvar canvasLoaded = 0;\n\tvar onLoadCanvas = function()\n\t{\n\t\tif (CB_REM.DEBUG_MESSAGES) { CB_console(\"Canvas '\" + this.getId() + \"' loaded! Mode used: \" + this.getMode()); }\n\n\t\tcanvasLoaded++;\n\n\t\t//Gets the \"context\" object to start working with the canvas:\n\t\tvar canvasContext = this.getContext();\n\t\tif (!canvasContext) { CB_console(\"ERROR: canvas context could not be obtained! Drawing cannot be performed.\"); return; }\n\n\t\t//Stores the canvas in the 'canvases' object:\n\t\tcanvases[this.getId()] = this;\n\n\t\t//If both canvas (normal and buffer) have been created, proceeds with the rendering:\n\t\tif (canvasLoaded >= 2)\n\t\t{\n\t\t\t//When the screen changes its size or its orientation, both canvases will be re-adapted:\n\t\t\tvar onResizeOrChangeOrientationTimeout = null;\n\t\t\tvar onResizeOrChangeOrientation = function()\n\t\t\t{\n\t\t\t\tclearTimeout(onResizeOrChangeOrientationTimeout);\n\t\t\t\tonResizeOrChangeOrientationTimeout = setTimeout //NOTE: needs a delay as some clients on iOS update the screen size information in two or more steps (last step is the correct value).\n\t\t\t\t(\n\t\t\t\t\tfunction()\n\t\t\t\t\t{\n\t\t\t\t\t\t//Resizes the canvas:\n\t\t\t\t\t\tcanvases[\"my_canvas\"].setWidth(CB_Screen.getWindowWidth());\n\t\t\t\t\t\tcanvases[\"my_canvas\"].setHeight(CB_Screen.getWindowHeight());\n\t\t\t\t\t\tcanvases[\"my_canvas\"].clear(); canvases[\"my_canvas\"].disableAntiAliasing();\n\t\t\t\t\t\t\n\t\t\t\t\t\t//Resizes the buffer canvas:\n\t\t\t\t\t\tcanvases[\"my_canvas_buffer\"].setWidth(CB_Screen.getWindowWidth());\n\t\t\t\t\t\tcanvases[\"my_canvas_buffer\"].setHeight(CB_Screen.getWindowHeight());\n\t\t\t\t\t\tcanvases[\"my_canvas_buffer\"].clear();\n\t\t\t\t\t\tcanvases[\"my_canvas_buffer\"].disableAntiAliasing();\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t};\n\t\t\tCB_Screen.onResize(onResizeOrChangeOrientation);\n\n\t\t\t//Clears both canvas:\n\t\t\tcanvases[\"my_canvas\"].clear();\n\t\t\tcanvases[\"my_canvas_buffer\"].clear();\n\t\t\t\n\t\t\t//Disables anti-aliasing to avoid problems with adjacent sprites:\n\t\t\tcanvases[\"my_canvas\"].disableAntiAliasing();\n\t\t\tcanvases[\"my_canvas_buffer\"].disableAntiAliasing();\n\t\t\t\n\t\t\t//Creates the sprites groups:\n\t\t\tvar graphicSpritesSceneObject = createSpritesGroups();\n\n\t\t\t//Caches all needed images (performance purposes) and starts rendering sprites groups when all are loaded:\n\t\t\tmyREM = new CB_REM();\n\t\t\tmyREM.cacheImages\n\t\t\t(\n\t\t\t\tgraphicSpritesSceneObject, //CB_GraphicSpritesSceneObject.\n\t\t\t\tundefined, //reload.\n\t\t\t\tfunction(imagesLoaded) //onLoad.\n\t\t\t\t{\n\t\t\t\t\t//Sets the current time as the start time to start counting the FPS (erased each second automatically):\n\t\t\t\t\tmyREM._startTimeFPS = CB_Device.getTiming();\n\n\t\t\t\t\t//Show the FPS (Frames Per Second) every time there is a new value:\n\t\t\t\t\tmyREM.onUpdatedFPS(function(FPS) { graphicSpritesSceneObject.getById(\"fps_group\").getById(\"fps\").src = \"FPS: \" + FPS; });\n\t\t\t\t\t\n\t\t\t\t\t//Processes the sprites groups:\n\t\t\t\t\tif (CB_REM.DEBUG_MESSAGES) { CB_console(\"Starts processing graphic sprites scene ('CB_GraphicSpritesScene' object) constantly...\"); }\n\t\t\t\t\t\n\t\t\t\t\tprocessSpritesGroups(graphicSpritesSceneObject, canvases[\"my_canvas\"], canvases[\"my_canvas\"].getContext(), canvases[\"my_canvas_buffer\"], canvases[\"my_canvas_buffer\"].getContext());\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\t\n\t//Creates the canvases:\n\tvar canvases = {};\n\tcanvases[\"my_canvas\"] = new CB_Canvas\n\t(\n\t\t\"my_canvas\", //canvasId. Unique required parameter.\n\t\t\"2d\", //contextType. NOTE: some emulation methods only support \"2d\". Default: \"2d\".\n\t\tCB_Screen.getWindowWidth(), //canvasWidth. Use 'CB_Screen.getWindowWidth()' for complete width. Default: CB_Canvas.WIDTH_DEFAULT.\n\t\tCB_Screen.getWindowHeight(), //canvasHeight. Use 'CB_Screen.getWindowHeight()' for complete height. Default: CB_Canvas.HEIGHT_DEFAULT.\n\t\tonLoadCanvas, //onLoad.\n\t\tfunction(error) { CB_console(\"Canvas object problem! Error: \" + error); }, //onError.\n\t\tundefined, undefined, !!FORCED_EMULATION_METHOD, !!FORCED_EMULATION_METHOD //Forces emulation method.\n\t);\n\tcanvases[\"my_canvas_buffer\"] = new CB_Canvas\n\t(\n\t\t\"my_canvas_buffer\", //canvasId. Unique required parameter.\n\t\t\"2d\", //contextType. NOTE: some emulation methods only support \"2d\". Default: \"2d\".\n\t\tCB_Screen.getWindowWidth(), //canvasWidth. Use 'CB_Screen.getWindowWidth()' for complete width. Default: CB_Canvas.WIDTH_DEFAULT.\n\t\tCB_Screen.getWindowHeight(), //canvasHeight. Use 'CB_Screen.getWindowHeight()' for complete height. Default: CB_Canvas.HEIGHT_DEFAULT.\n\t\tonLoadCanvas, //onLoad.\n\t\tfunction(error) { CB_console(\"Canvas object problem! Error: \" + error); }, //onError.\n\t\tundefined, undefined, !!FORCED_EMULATION_METHOD, !!FORCED_EMULATION_METHOD //Forces emulation method.\n\t);\n}", "function initializeCanvas() {\n\tcanvas = document.getElementById(\"canvas\");\n\tctx = canvas.getContext(\"2d\");\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 Init() {\r\n // Get context handles\r\n CanvasHandle = document.getElementById(\"canvas\");\r\n ContextHandle = CanvasHandle.getContext(\"2d\");\r\n CanvasWidth = ContextHandle.canvas.clientWidth;\r\n CanvasHeight = ContextHandle.canvas.clientHeight;\r\n\r\n // Create an image backbuffer\r\n BackCanvasHandle = document.createElement(\"canvas\");\r\n BackContextHandle = BackCanvasHandle.getContext(\"2d\");\r\n BackCanvasHandle.width = CanvasWidth;\r\n BackCanvasHandle.height = CanvasHeight;\r\n\r\n // Set line style\r\n BackContextHandle.lineCap = \"butt\";\r\n BackContextHandle.lineJoin = \"round\";\r\n BackContextHandle.strokeStyle = \"rgb(255, 255, 255)\";\r\n\r\n // Get the canvas center\r\n CenterX = CanvasWidth / 2;\r\n CenterY = CanvasHeight / 2;\r\n Camera = {x:0, y:0, r:20};\r\n}", "function init() {\n redrawTIAIndicator = true;\n usePhosphor = false;\n phosphorBlendPercent = JsVideoConsts.DEFAULT_PHOSPHOR_BLEND;\n\n // Allocate buffers for two frame buffers\n jsvideo.currentFrameBuffer = new Array(JsConstants.CLOCKS_PER_LINE_VISIBLE * JsConstants.FRAME_Y_MAX);\n previousFrameBuffer = new Array(JsConstants.CLOCKS_PER_LINE_VISIBLE * JsConstants.FRAME_Y_MAX);\n initBackBuffer(JsVideoConsts.DEFAULT_WIDTH, JsVideoConsts.DEFAULT_HEIGHT);\n initPalettes();\n loadImages();\n jsvideo.initialize();\n }", "function video() {\n\t\t$('#wrapper').fitVids();\n\t}", "function paintToCanvas() {\n // first we need the width and height\n const width = video.videoWidth;\n const height = video.videoHeight;\n // make sure now that the canvas is the same size as the video before we paint into it\n canvas.width = width;\n canvas.height = height;\n\n // now ever x seconds we're going to snap a picture\n setInterval(() => {\n ctx.drawImage(video, 0, 0, width, height); // paint with the video, starting at the left top of the canvas, with the width and height specified above;\n // take the pixels out\n let pixels = ctx.getImageData(0, 0, width, height); // we get an array of millions of pixel values with each one it's own color value\n // messing with the pixels\n //pixels = redEffect(pixels); // the function redEffect is all the way down below\n pixels = rgbSplit(pixels); // I'm choosing to play with this one instead of the two other functions\n ctx.globalAlpha = 0.8;\n //pixels = greenScreen(pixels);\n // putting the pixels back back\n ctx.putImageData(pixels, 0, 0);\n }, 16); // here every 16 milliseconds a picture is taken from the video\n}", "function initCanvas() {\n if(isDebugged) {\n debug.style.display = \"block\";\n } else {\n debug.style.display = \"none\";\n }\n\n console.log(\"initializing canvas\");\n\n //var canvasElement = document.querySelector(\"#canvas\");\n canvas = new fabric.Canvas(\"canvas\",{\n selection: false,\n height: canvas_initial_height,\n width: canvas_initial_width,\n backgroundColor: canvas_background_color\n });\n\n //canvas.isDrawingMode = true;\n\n canvas.on(\"mouse:down\", onMouseDownCanvas);\n\n canvas.on(\"mouse:up\", onMouseUpCanvas);\n\n canvas.on(\"mouse:move\", onMouseMoveCanvas);\n\n //updateAndSyncCanvasSize(canvas_initial_width, canvas_initial_height);\n}", "function setupMedia() {\n if (supportsMedia()) {\n audioContext = new AudioContext();\n\n navigator.getUserMedia(\n {\n video: false,\n audio: true\n },\n function (localMediaStream) {\n // map the camera\n var video = document.getElementById('live_video');\n video.src = window.URL.createObjectURL(localMediaStream);\n\n // create the canvas & get a 2d context\n videoCanvas = document.createElement('canvas');\n videoContext = videoCanvas.getContext('2d');\n\n // setup audio recorder\n var audioInput = audioContext.createMediaStreamSource(localMediaStream);\n //audioInput.connect(audioContext.destination);\n // had to replace the above with the following to mute playback\n // (so you don't get feedback)\n var audioGain = audioContext.createGain();\n audioGain.gain.value = 0;\n audioInput.connect(audioGain);\n audioGain.connect(audioContext.destination);\n\n audioRecorder = new Recorder(audioInput);\n mediaStream = localMediaStream;\n mediaInitialized = true;\n\n document.getElementById('uploading').hidden = true;\n document.getElementById('media-error').hidden = true;\n document.getElementById('record').hidden = false;\n },\n function (e) {\n console.log('web-cam & microphone not initialized: ', e);\n document.getElementById('media-error').hidden = false;\n }\n );\n }\n}", "function init(){\n W = canvas.width = window.innerWidth;\n H = canvas.height = window.innerHeight;\n\n // getting all the frames into the array of frames\n loadFrames();\n // creating the origin object\n origin = new Origin();\n}", "function setUpCanvas() {\n /* clearing up the screen */\n clear();\n /* Set display size (vw/vh). */\n var sizeWidth = (80 * window.innerWidth) / 100,\n sizeHeight = window.innerHeight;\n //Setting the canvas site and width to be responsive\n upperLayer.width = sizeWidth;\n upperLayer.height = sizeHeight;\n upperLayer.style.width = sizeWidth;\n upperLayer.style.height = sizeHeight;\n lowerLayer.width = sizeWidth;\n lowerLayer.height = sizeHeight;\n lowerLayer.style.width = sizeWidth;\n lowerLayer.style.height = sizeHeight;\n rect = upperLayer.getBoundingClientRect();\n}", "function setup() {\n createCanvas(640, 480);\n\n video = createCapture(VIDEO);\n video.size(width, height);\n\n // Create a new poseNet method with a single detection\n poseNet = ml5.poseNet(video, modelReady);\n // This sets up an event that fills the global variable \"poses\"\n // with an array every time new poses are detected\n poseNet.on('pose', function(results) {\n poses = results;\n debugger;\n });\n // Hide the video element, and just show the canvas\n video.hide();\n}", "function initVideo(){\n\t\t//fit all videos in their parent container\n\t\tjQuery(\".scalevid\").fitVids();\n\t}", "function initCanvasAndEditor() {\n // Editor\n initEditor();\n\n // Canvas\n canvasResizer();\n renderCanvas();\n\n // Listeners\n addListeners();\n}", "run() {\n requestAnimationFrame(() => {\n this.runFrame();\n });\n\n this.output.video.run();\n\n this.running = true;\n this.paused = false;\n }", "function init() \n {\n\t\t\n\t\t// initialize variables\n\t\tvideo = document.getElementById(\"video1\");\n\t\tcanvas = document.getElementById(\"canvas\");\n\t\ttime_slider = document.getElementById(\"time_slider\");\n label_CurrenFrame = document.getElementById(\"currentFrameTime\");\n label_VideoLength = document.getElementById(\"videoLength\");\n\t\tprevious_frame = document.getElementById(\"previousFrame\");\n\t\tnext_frame = document.getElementById(\"nextFrame\");\n\t\tcontainer = document.getElementById(\"container\");\n\t\tcreate_sum = document.getElementById(\"submit\");\n\t\t\n //initialize events\n\t\tcanvas.addEventListener(\"click\", saveFrame, false);\n\t\tcanvas.addEventListener(\"mousemove\", mouseMove, false);\n\t\ttime_slider.addEventListener(\"change\", UpdateFrame, false);\n\t\ttime_slider.addEventListener(\"input\", UpdateFrame, false);\n\t\t\n\t\tdocument.getElementById('files').addEventListener('change', FileChosen);\n\t\tdocument.getElementById('UploadButton').addEventListener('click', StartUpload); \n\t\t\n video.addEventListener('loadeddata', function () {\n label_CurrenFrame.innerHTML = secondsToTimeString(video.currentTime);\n label_VideoLength.innerHTML = secondsToTimeString(video.duration);\n });\n \n\t\tprevious_frame.addEventListener('click', \n\t\tfunction() {\n\t\t\tif (actual_frame === null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (isUndefined(actual_frame)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (actual_frame.second <= 0) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar value = Math.floor((actual_frame.second - 1) * 100 / video.duration);\n\t\t\tif (value >= 0 && value <= 100) {\n\t\t\t\tactual_frame.second--;\n\t\t\t\ttime_slider.value = value;\n\t\t\t\tdrawFrame(actual_frame);\n\t\t\t}\n\t\t},\n\t\tfalse);\n\t\t\n\t\tnext_frame.addEventListener('click', \n\t\tfunction() {\n\t\t\tif (actual_frame === null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (video === null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (isUndefined(actual_frame) || isUndefined(video) || isUndefined(video.duration)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (actual_frame.second >= video.duration) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar value = Math.floor((actual_frame.second + 1) * 100 / video.duration);\n\t\t\tif (value >= 0 && value <= 100) {\n\t\t\t\tactual_frame.second++;\n\t\t\t\ttime_slider.value = value;\n\t\t\t\tdrawFrame(actual_frame);\n\t\t\t}\n\t\t},\n\t\tfalse);\n\t\t\n\t\tdocument.getElementById('submit').addEventListener('click', \n\t\tfunction() {\n\t\t\tupdateDescriptions();\n\t\t\tvar result = combineSegments();\n\t\t\tconsole.log(result);\n\t\t\t// send result to server!\n \t\t\tsocket.emit('ffmpeg', { 'Name' : SelectedFile.name, 'Data' : result });\n\t\t\tdocument.getElementById(\"create_progress\").innerHTML='Creating summary... 0%';\n \n\t\t\tResetSegments();\n\t\t},\n\t\tfalse);\n\t\t\n\t\t// initialize player\n\t\tinitPlayer();\n\t\n\t}", "function initialize() {\n // will create HTML5 video element in staging area if not present\n getDOMVideo();\n isInitialized = true;\n }", "async function setupWebcam() {\n if (navigator.mediaDevices.getUserMedia) {\n const stream = await navigator.mediaDevices.getUserMedia({\n \"audio\": false,\n \"video\": {\n width: {\n min: 640,\n max: 640\n },\n height: {\n min: 480,\n max: 480\n }\n }\n });\n\n webcam.srcObject = stream;\n\n return new Promise((resolve) => {\n webcam.onloadedmetadata = () => {\n webcam.width = stream.getVideoTracks()[0].getSettings().width;\n webcam.height = stream.getVideoTracks()[0].getSettings().height;\n canvas.width = stream.getVideoTracks()[0].getSettings().width;\n canvas.height = stream.getVideoTracks()[0].getSettings().height;\n\n canvasDims = [canvas.height, canvas.width];\n\n resolve(webcam);\n };\n });\n }\n}", "function drawFrameOnCanvas(frame) {\n\t\n\t\tvar reset = frame.reset;\n\t\n canvas.height = video.videoHeight;\n canvas.width = video.videoWidth;\n\t\t// retrieve context for drawing\n\t\tvar context = canvas.getContext(\"2d\");\n\t\t\t\t\n\t\t// Start by clearing the canvas\n\t\tcontext.clearRect(0, 0, canvas.width, canvas.height);\n\t\t\n\t\t// draw frame according to time\n\t\t\n\t\tif (reset) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tcontext.drawImage(video, 0, 0, canvas.width, canvas.height);\n \n }", "function renderUIAfterFrameChange(videoNode) {\n\n const video = videoNode.data.videoCore\n\n /* Rendering the current time bar */\n renderCurrentPlaybackBar(videoNode)\n\n /* Updating the canvas resolution */\n alpha1 = canvas.width * video.videoHeight / canvas.height - video.videoWidth\n alpha2 = video.videoWidth * canvas.height / canvas.width - video.videoHeight\n\n if (alpha1 < alpha2) {\n canvas.width = video.videoWidth + alpha1\n canvas.height = video.videoHeight\n } else {\n canvas.width = video.videoWidth\n canvas.height = video.videoHeight + alpha2\n }\n\n canvasRatio = canvas.width / canvas.height\n videoRatio = video.videoWidth / video.videoHeight\n\n currentVideoDurationLabel.innerText = formatTimeFromSeconds((\n videoNode.data.metadata.baseDuration - videoNode.data.metadata.startTime + video.currentTime\n ).toFixed(2))\n \n if (videoNode.data.metadata.ratio == 'fit') {\n if (window.currentRatio == 'strech') {\n document.querySelector('.toogle-fit').click()\n }\n context.drawImage(\n video, canvas.width / 2 - videoRatio * canvas.height / 2, 0, videoRatio * canvas.height, canvas.height\n ) \n } else if (videoNode.data.metadata.ratio == 'strech') {\n if (window.currentRatio === 'fit') {\n document.querySelector('.toogle-strech').click()\n }\n context.drawImage(\n video, 0, 0, canvas.width, canvas.height\n )\n }\n}", "function init() {\n\t\t\tconstructVideoPlayerContent(elems.container);\n\t\t\tshowControls();\n\t\t\t_.event(elems.btnBigPlay, 'click', play);\n\t\t\t_.event(elems.buttons.play, 'click', playPause);\n\t\t\t_.event(elems.video, 'click', pause);\n\t\t\t_.event(elems.buttons.volume, 'click', mute);\n\t\t\t_.event(elems.buttons.fullscreen, 'click', fullscreen);\n\t\t\t_.event(elems.video, 'loadedmetadata', function(e) {\n\t\t\t\tplaybackRate(opts.speed);\n\t\t\t\tvideoProgress = new Range(opts.progress / elems.video.duration, elems.ranges.video, {\n\t\t\t\t\tonDrop: (pct) => progress(pct, true),\n\t\t\t\t});\n\t\t\t\tvolumeSlider = new Range(opts.volume, elems.ranges.volume, {\n\t\t\t\t\tonDrag: volume,\n\t\t\t\t});\n\t\t\t\tvolume(opts.volume);\n\t\t\t\tprogress(opts.progress);\n\t\t\t\ttimestamp(0, elems.video.duration);\n\t\t\t\tif (opts.autoplay) play();\n\t\t\t});\n\t\t\t_.event(elems.video, 'timeupdate', progUpdate);\n\t\t\t_.event(elems.main, 'mousemove', showControls);\n\t\t\t_.event(elems.controls, 'mouseenter', () => showControls(true));\n\t\t\t_.event(elems.controls, 'mouseleave', () => showControls(false));\n\t\t\t_.event(window, 'keyup', handleKeyPress);\n\t\t\t_.event(document, 'fullscreenchange', handleFullscreenChange); // PREFIXES WHY\n\t\t\t_.event(document, 'msfullscreenchange', handleFullscreenChange);\n\t\t\t_.event(document, 'mozfullscreenchange', handleFullscreenChange);\n\t\t\t_.event(document, 'webkitfullscreenchange', handleFullscreenChange);\n\n\t\t\tif (opts.fullscreen) fullscreen(true);\n\t\t\telems.video.src = opts.src;\n\t\t}", "function setup() {\n // set up canvas\n let canvas = createCanvas(canvasW, canvasH);\n canvas.parent('canvas');\n\n}", "init() {\n this.isCanvasSupported() ? this.ctx = this.canvas.getContext('2d') : false;\n\n if (this.ctx) {\n this.playBtn.addEventListener('click', () => {\n this.playBtn.classList.add('active');\n this.startTheGame();\n });\n\n this.retryBtn.addEventListener('click', () => {\n this.reset();\n this.retryBtn.classList.add('inactive');\n this.startTheGame();\n });\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 initialize() {\n webcamElement = document.getElementById('webcam');\n canvasElement = document.getElementById('canvas');\n webcam = new Webcam(webcamElement, 'user', canvasElement);\n snapButtonElement = document.getElementById('capture');\n startButtonElement = document.getElementById('retake');\n}", "function videoReady() { }", "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 initCanv() {\n maxWidth = window.innerWidth;\n maxHeight = window.innerHeight;\n\n canv = document.getElementById('canvas');\n canv.width = maxWidth * RATIO_MULT;\n canv.height = maxHeight * RATIO_MULT;\n ctx = canv.getContext('2d');\n ctx.fillStyle = \"black\";\n ctx.fillRect(0,0,maxWidth * RATIO_MULT,maxHeight * RATIO_MULT);\n\n dotSize = (maxWidth/1000);\n initGrid();\n\n canv.addEventListener('mousemove',canvMouseEventListener);\n canv.addEventListener('click',resetCanvas);\n\n initX();\n\n console.log(\"You can draw on that black box over there by hoving your mouse over it. Click anywhere in the black box to reset the canvas. To randomize the pattern being drawn, just run this function: 'randomLife()'. Then just draw some more!\");\n console.log(\"Other functions you can play with inclue: 'initX()', 'initPlus()', 'resetCanvas()'.\");\n console.log();\n console.log(\"You are also able to set the rules manually. The current rules are: \");\n console.log(\"SURVIVES: \" + SURVIVES);\n console.log(\"CREATES: \" + CREATES);\n}", "function GameCanvas(w) {\n var canvasFactory = new CanvasFactory();\n var $canvas = canvasFactory.createElement();\n var context = $canvas.getContext(\"2d\");\n var canvasBounds;\n var cameraWidth = 320, cameraHeight = 240;\n\n var RATIO = 0.75;\n\n w.setBodyElement($canvas);\n w.addResizeListener(adjustCanvasSize);\n\n /**\n * Renders recordings captured by given camera.\n */\n this.render = function (camera) {\n context.clearRect(0, 0, $canvas.width, $canvas.height);\n\n var $cameraCanvas = camera.getCanvasBuffer();\n cameraWidth = $cameraCanvas.width;\n cameraHeight = $cameraCanvas.height;\n\n var bounds = camera.getBounds(),\n x = Math.min(bounds.x, cameraWidth, 0),\n y = Math.min(bounds.y, cameraHeight, 0),\n width = Math.min(bounds.width, cameraWidth - x),\n height = Math.min(bounds.height, cameraHeight - y);\n\n context.drawImage(\n $cameraCanvas,\n x, y, width, height,\n 0, 0, $canvas.width, $canvas.height\n );\n };\n\n function adjustCanvasSize(width, height) {\n var left = 0;\n if (width * RATIO < height) {\n height = width * RATIO;\n } else {\n left = (width - (height / RATIO)) / 2;\n width = height / RATIO;\n }\n $canvas.style.left = left + \"px\";\n $canvas.width = width;\n $canvas.height = height;\n canvasFactory.disableContextImageSmoothing(context);\n canvasBounds = { left: left, top: 0, width: width, height: height };\n }\n\n /**\n * Registers given function for receiving all canvas events.\n */\n this.onEvent = function (f) {\n w.addMouseListener(function (type, x, y) {\n x = (x - canvasBounds.left) / canvasBounds.width * cameraWidth;\n y = (y - canvasBounds.top) / canvasBounds.height * cameraHeight;\n f(new GameEvent(type, { x: x, y: y }));\n });\n w.addKeyboardListener(function (type, key) {\n f(new GameEvent(type, key));\n });\n };\n \n Object.seal(this);\n }", "function init () {\n resizeCanvas();\n}" ]
[ "0.78905183", "0.73323876", "0.7324095", "0.6902919", "0.6802968", "0.6754874", "0.674903", "0.67110926", "0.6707982", "0.66969913", "0.66809857", "0.6675698", "0.6649001", "0.65843296", "0.65676445", "0.65668964", "0.65466964", "0.65347123", "0.6457012", "0.6453839", "0.6424336", "0.64237124", "0.6419021", "0.63978547", "0.6386163", "0.6385013", "0.63836545", "0.63807344", "0.63210124", "0.63173777", "0.6281032", "0.6267176", "0.62649333", "0.6257279", "0.6249855", "0.6246818", "0.62462586", "0.62401396", "0.6237945", "0.6231654", "0.62214667", "0.6213259", "0.62099826", "0.62049496", "0.6203167", "0.61975175", "0.6183193", "0.6170081", "0.6154397", "0.61509186", "0.6150565", "0.6128194", "0.61215734", "0.6107184", "0.60995024", "0.60750425", "0.6063687", "0.6051041", "0.6031816", "0.60154", "0.60076773", "0.60059816", "0.599167", "0.59896547", "0.5987918", "0.5982783", "0.59818137", "0.59744775", "0.59648407", "0.59646475", "0.59463876", "0.59355134", "0.59336126", "0.59305423", "0.59275657", "0.5912402", "0.58929735", "0.58873695", "0.587902", "0.58761376", "0.58730733", "0.5871292", "0.5865541", "0.58641213", "0.5861883", "0.58585936", "0.5847717", "0.5840252", "0.5837047", "0.5834216", "0.5833509", "0.5831656", "0.58228356", "0.5821191", "0.5820747", "0.58193916", "0.581668", "0.5815973", "0.5798132", "0.5797706" ]
0.7507471
1
Connect the proper camera to the video element, trying to get a camera with facing mode of "user".
async function connect_camera() { try { let stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: "user" }, audio: false }); video_element.srcObject = stream; video_element.setAttribute('playsinline', true); video_element.setAttribute('controls', true); // remove controls separately setTimeout(function() { video_element.removeAttribute('controls'); }); } catch(error) { console.error("Got an error while looking for video camera: " + error); return null; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function setupCamera() {\n const video = document.getElementById('video')\n video.width = videoWidth\n video.height = videoHeight\n\n const stream = await navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n facingMode: 'user',\n width: videoWidth,\n height: videoHeight\n }\n })\n video.srcObject = stream\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video)\n }\n })\n}", "function cameraSetup(){\n\t// Get access to the camera!\n\tif('mediaDevices' in navigator && 'getUserMedia' in navigator.mediaDevices) {\n\t\t// Not adding `{ audio: true }` since we only want video now\n\t\tnavigator.mediaDevices.getUserMedia({\n\t\t\t//Kamera Constrains:\n\t\t\t\n\t\t\tvideo: \n\t\t\t{\n\t\t\t\twidth: {ideal: 50},\n\t\t\t\theight: {ideal: 50},\n\t\t\t\tfacingMode: ['environment']\n\t\t\t}\n\t\t\t}).then(function(stream) {\n\t\t\t\tstreamVideo = stream;\n\t\t\t\tcameraOk = true;\n\t\t\t\tvideo.srcObject = stream;\n\t\t\t\tvideo.play();\n\n\t\t\t\tvar track = stream.getVideoTracks()[0];\n\t\t\t\t//Taschenlampe einschalten:\n\t\t\t\tconst imageCapture = new ImageCapture(track)\n\t\t\t\tconst photoCapabilities = imageCapture.getPhotoCapabilities().then(() => {\n\t\t\t\t\ttrack.applyConstraints({\n\t\t\t\t\t\tadvanced: [{torch: true}]\n\t\t\t\t\t});\n\t\t\t\t});\n\n\n\n\t\t\t});\n\t\t}\n\n\n\t}", "async function setupCamera() {\n const video = document.getElementById('video');\n const canvas = document.getElementById('canvas');\n if (!video || !canvas) return null;\n\n let msg = '';\n log('Setting up camera');\n // setup webcam. note that navigator.mediaDevices requires that page is accessed via https\n if (!navigator.mediaDevices) {\n log('Camera Error: access not supported');\n return null;\n }\n let stream;\n const constraints = {\n audio: false,\n video: { facingMode: 'user', resizeMode: 'crop-and-scale' },\n };\n if (window.innerWidth > window.innerHeight) constraints.video.width = { ideal: window.innerWidth };\n else constraints.video.height = { ideal: window.innerHeight };\n try {\n stream = await navigator.mediaDevices.getUserMedia(constraints);\n } catch (err) {\n if (err.name === 'PermissionDeniedError' || err.name === 'NotAllowedError') msg = 'camera permission denied';\n else if (err.name === 'SourceUnavailableError') msg = 'camera not available';\n log(`Camera Error: ${msg}: ${err.message || err}`);\n return null;\n }\n // @ts-ignore\n if (stream) video.srcObject = stream;\n else {\n log('Camera Error: stream empty');\n return null;\n }\n const track = stream.getVideoTracks()[0];\n const settings = track.getSettings();\n if (settings.deviceId) delete settings.deviceId;\n if (settings.groupId) delete settings.groupId;\n if (settings.aspectRatio) settings.aspectRatio = Math.trunc(100 * settings.aspectRatio) / 100;\n log(`Camera active: ${track.label}`); // ${str(constraints)}\n log(`Camera settings: ${str(settings)}`);\n canvas.addEventListener('click', () => {\n // @ts-ignore\n if (video && video.readyState >= 2) {\n // @ts-ignore\n if (video.paused) {\n // @ts-ignore\n video.play();\n detectVideo(video, canvas);\n } else {\n // @ts-ignore\n video.pause();\n }\n }\n // @ts-ignore\n log(`Camera state: ${video.paused ? 'paused' : 'playing'}`);\n });\n return new Promise((resolve) => {\n video.onloadeddata = async () => {\n // @ts-ignore\n canvas.width = video.videoWidth;\n // @ts-ignore\n canvas.height = video.videoHeight;\n // @ts-ignore\n video.play();\n detectVideo(video, canvas);\n resolve(true);\n };\n });\n}", "async function setupCamera() {\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n throw new Error(\n 'Browser API navigator.mediaDevices.getUserMedia not available');\n }\n\n const video = document.getElementById('video');\n video.width = videoWidth;\n video.height = videoHeight;\n\n const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'user',\n width: mobile ? undefined : videoWidth,\n height: mobile ? undefined : videoHeight,\n },\n });\n video.srcObject = stream;\n\n return new Promise((resolve) => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n}", "async function setupCamera() {\n const video = document.getElementById('video');\n video.width = maxVideoSize;\n video.height = maxVideoSize;\n\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'environment',\n width: mobile ? undefined : maxVideoSize,\n height: mobile ? undefined: maxVideoSize}\n });\n video.srcObject = stream;\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n } else {\n const errorMessage = \"This browser does not support video capture, or this device does not have a camera\";\n alert(errorMessage);\n return Promise.reject(errorMessage);\n }\n}", "async function setupCamera() {\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n throw new Error(\n 'Browser API navigator.mediaDevices.getUserMedia not available');\n }\n\n const video = document.getElementById('webcam-video');\n video.width = videoWidth;\n video.height = videoHeight;\n\n // const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'user',\n width: videoWidth,\n height: videoHeight,\n },\n });\n video.srcObject = stream;\n\n return new Promise((resolve) => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n}", "async function setupCamera() {\n const video = document.getElementById('video');\n video.width = maxVideoSize;\n video.height = maxVideoSize;\n\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n const mobile = isMobile();\n const stream = await navigator.mediaDevices.getUserMedia({\n 'audio': false,\n 'video': {\n facingMode: 'user',\n width: mobile ? undefined : maxVideoSize,\n height: mobile ? undefined: maxVideoSize}\n });\n video.srcObject = stream;\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video);\n };\n });\n } else {\n const errorMessage = \"This browser does not support video capture, or this device does not have a camera\";\n alert(errorMessage);\n return Promise.reject(errorMessage);\n }\n}", "function startCamera() {\n\n let constraints = {\n audio: false,\n video: {\n width: 640,\n height: 480,\n frameRate: 30\n }\n }\n\n video.setAttribute('width', 640);\n video.setAttribute('height', 480);\n video.setAttribute('autoplay', '');\n video.setAttribute('muted', '');\n video.setAttribute('playsinline', '');\n\n // Start video playback once the camera was fetched.\n function onStreamFetched(mediaStream) {\n video.srcObject = mediaStream;\n // Check whether we know the video dimensions yet, if so, start BRFv4.\n function onStreamDimensionsAvailable() {\n if (video.videoWidth === 0) {\n setTimeout(onStreamDimensionsAvailable, 100);\n } else {\n\n }\n }\n onStreamDimensionsAvailable();\n }\n\n window.navigator.mediaDevices.getUserMedia(constraints).then(onStreamFetched).catch(function() {\n alert(\"No camera available.\");\n });\n}", "function startvideo() {\n webcam.style.width = document.width + 'px';\n webcam.style.height = document.height + 'px';\n webcam.setAttribute('autoplay', '');\n webcam.setAttribute('muted', '');\n\twebcam.setAttribute('playsinline', '');\n\n var constraints = {\n audio: false,\n video: {\n facingMode: 'user'\n }\n }\n \tnavigator.mediaDevices.getUserMedia(constraints).then(function success(stream) {\n webcam.srcObject = stream;\n initImages();\n animate();\n });\n}", "function loadCamera() {\n // setup camera capture\n videoInput = createCapture(VIDEO);\n videoInput.size(400, 300);\n videoInput.position(0, 0);\n videoInput.id(\"v\");\n var mv = document.getElementById(\"v\");\n mv.muted = true;\n}", "async function setupCamera() {\r\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\r\n throw new Error(\r\n 'Browser API navigator.mediaDevices.getUserMedia not available');\r\n }\r\n\r\n const camera = document.getElementById('camera');\r\n camera.width = cameraWidth;\r\n camera.height = cameraHeight;\r\n\r\n const mobile = isMobile();\r\n\r\n const stream = await navigator.mediaDevices.getUserMedia({\r\n 'audio': false,\r\n 'video': {\r\n facingMode: 'user',\r\n width: mobile ? undefined : cameraWidth,\r\n height: mobile ? undefined : cameraHeight,\r\n },\r\n });\r\n camera.srcObject = stream;\r\n\r\n return new Promise((resolve) => {\r\n camera.onloadedmetadata = () => {\r\n resolve(camera);\r\n };\r\n });\r\n}", "async start() {\n if (this.webcamConfig.facingMode) {\n util.assert((this.webcamConfig.facingMode === 'user') ||\n (this.webcamConfig.facingMode === 'environment'), () => `Invalid webcam facing mode: ${this.webcamConfig.facingMode}. ` +\n `Please provide 'user' or 'environment'`);\n }\n try {\n this.stream = await navigator.mediaDevices.getUserMedia({\n video: {\n deviceId: this.webcamConfig.deviceId,\n facingMode: this.webcamConfig.facingMode ?\n this.webcamConfig.facingMode :\n 'user',\n width: this.webcamVideoElement.width,\n height: this.webcamVideoElement.height\n }\n });\n }\n catch (e) {\n // Modify the error message but leave the stack trace intact\n e.message = `Error thrown while initializing video stream: ${e.message}`;\n throw e;\n }\n if (!this.stream) {\n throw new Error('Could not obtain video from webcam.');\n }\n // Older browsers may not have srcObject\n try {\n this.webcamVideoElement.srcObject = this.stream;\n }\n catch (error) {\n console.log(error);\n this.webcamVideoElement.src = window.URL.createObjectURL(this.stream);\n }\n // Start the webcam video stream\n this.webcamVideoElement.play();\n this.isClosed = false;\n return new Promise(resolve => {\n // Add event listener to make sure the webcam has been fully initialized.\n this.webcamVideoElement.onloadedmetadata = () => {\n resolve();\n };\n });\n }", "function cameraStart() {\n if(selfie === true){\n cameraView.classList.replace(\"user\", \"environment\");\n cameraOutput.classList.replace(\"user\", \"environment\");\n cameraSensor.classList.replace(\"user\", \"environment\");\n constraints = rearConstraints;\n selfie = false;\n }\n else{\n cameraView.classList.replace(\"environment\", \"user\");\n cameraOutput.classList.replace(\"environment\", \"user\");\n cameraSensor.classList.replace(\"environment\", \"user\");\n constraints = userConstraints;\n selfie = true;\n }\n\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}", "function cameraStartFront() { \n frontCamera = true\n var constraints = { video: { facingMode: \"user\" }, audio: false };\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}", "function cameraStart() {\n cameraView = document.querySelector(\"#webcam\");\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}", "function cam() {\n snapBtn.addEventListener('click', enroll);\n // detectButton.addEventListener('click', detect);\n navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n width: 500,\n height: 500\n }\n })\n .then(stream => {\n video.srcObject = stream;\n video.onloadedmetadata = video.play()\n })\n .catch(err => console.error(err));\n}", "_switchCamera() {\n if (this.isVideoTrack() && this.videoType === _service_RTC_VideoType__WEBPACK_IMPORTED_MODULE_10___default.a.CAMERA && typeof this.track._switchCamera === 'function') {\n this.track._switchCamera();\n\n this._facingMode = this._facingMode === _service_RTC_CameraFacingMode__WEBPACK_IMPORTED_MODULE_7___default.a.ENVIRONMENT ? _service_RTC_CameraFacingMode__WEBPACK_IMPORTED_MODULE_7___default.a.USER : _service_RTC_CameraFacingMode__WEBPACK_IMPORTED_MODULE_7___default.a.ENVIRONMENT;\n }\n }", "function getCamera(){\n document.getElementById('ownGifs').style.display=\"none\"\n document.getElementById('createGif').style.display=\"none\";\n document.getElementById('camera').style.display=\"inline-block\";\n var video = document.querySelector('video');\n stream = navigator.mediaDevices.getUserMedia(constraints)\n .then(function(mediaStream) {\n video.srcObject = mediaStream;\n video.onloadedmetadata = function(e) {\n video.play(); // Starting reproduce video cam\n };\n recorder = RecordRTC(mediaStream, { \n // disable logs\n disableLogs: true,\n type: \"gif\",\n frameRate: 1,\n width: 360,\n hidden: 240,\n quality: 10});\n })\n .catch(function(err) { \n\n }); // always check for errors at the end.\n\n \n}", "async function setupCamera (config) {\n const { videoWidth, videoHeight } = config\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n throw new Error(\n 'Browser API navigator.mediaDevices.getUserMedia not available'\n )\n }\n\n const video = document.getElementById('video')\n video.width = videoWidth\n video.height = videoHeight\n\n const mobile = isMobile()\n const stream = await navigator.mediaDevices.getUserMedia({\n audio: false,\n video: {\n facingMode: 'user',\n width: mobile ? undefined : videoWidth,\n height: mobile ? undefined : videoHeight\n }\n })\n video.srcObject = stream\n\n return new Promise(resolve => {\n video.onloadedmetadata = () => {\n resolve(video)\n }\n })\n}", "function cameraStart() {\r\n navigator.mediaDevices\r\n .getUserMedia(constraints)\r\n .then(function(stream) {\r\n track = stream.getTracks()[0];\r\n cameraView.srcObject = stream;\r\n })\r\n .catch(function(error) {\r\n console.error(\"Oops. Something is broken.\", error);\r\n });\r\n}", "function cameraStart() {\r\n navigator.mediaDevices\r\n .getUserMedia(constraints)\r\n .then(function(stream) {\r\n track = stream.getTracks()[0];\r\n cameraView.srcObject = stream;\r\n })\r\n .catch(function(error) {\r\n console.error(\"Oops. Something is broken.\", error);\r\n });\r\n}", "async start() {\n if (this.webcamConfig.facingMode) {\n _tensorflow_tfjs_core__WEBPACK_IMPORTED_MODULE_0__[\"util\"].assert((this.webcamConfig.facingMode === 'user') ||\n (this.webcamConfig.facingMode === 'environment'), () => `Invalid webcam facing mode: ${this.webcamConfig.facingMode}. ` +\n `Please provide 'user' or 'environment'`);\n }\n try {\n this.stream = await navigator.mediaDevices.getUserMedia({\n video: {\n deviceId: this.webcamConfig.deviceId,\n facingMode: this.webcamConfig.facingMode ?\n this.webcamConfig.facingMode :\n 'user',\n width: this.webcamVideoElement.width,\n height: this.webcamVideoElement.height\n }\n });\n }\n catch (e) {\n // Modify the error message but leave the stack trace intact\n e.message = `Error thrown while initializing video stream: ${e.message}`;\n throw e;\n }\n if (!this.stream) {\n throw new Error('Could not obtain video from webcam.');\n }\n // Older browsers may not have srcObject\n try {\n this.webcamVideoElement.srcObject = this.stream;\n }\n catch (error) {\n console.log(error);\n this.webcamVideoElement.src = window.URL.createObjectURL(this.stream);\n }\n // Start the webcam video stream\n this.webcamVideoElement.play();\n this.isClosed = false;\n return new Promise(resolve => {\n // Add event listener to make sure the webcam has been fully initialized.\n this.webcamVideoElement.onloadedmetadata = () => {\n resolve();\n };\n });\n }", "function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function (stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function (error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}", "function startVideo(){\n //gets the webcam, takes object as the first param, video is key, empty object as param\n navigator.getUserMedia(\n {video: {}},\n //whats coming from our webcam, setting it as source\n stream =>video.srcObject = stream,\n err => console.log(err))\n}", "function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}", "function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}", "function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}", "function cameraStart() {\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}", "function setupCamera() {\n camera = new PerspectiveCamera(35, config.Screen.RATIO, 0.1, 300);\n camera.position.set(0, 8, 20);\n //camera.rotation.set(0,0,0);\n //camera.lookAt(player.position);\n console.log(\"Finished setting up Camera...\"\n + \"with x\" + camera.rotation.x + \" y:\" + camera.rotation.y + \" z:\" + camera.rotation.z);\n }", "async function setupCamera() {\n let depthStream = await DepthCamera.getDepthStream();\n const depthVideo = document.getElementById('depthStream');\n depthVideo.srcObject = depthStream;\n return DepthCamera.getCameraCalibration(depthStream);\n}", "function startVideo() {\n navigator.getUserMedia(\n { \n video: \n {\n //the ideal part is imp, it helps to get 16:9 ratio also\n height : { ideal : window.innerHeight } ,\n width : { ideal : window.innerWidth }\n } \n } ,\n stream => video.srcObject = stream,\n err => console.error(err)\n ) \n}", "function cameraStart() {\n //the getUserMedia method to access the camera\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = track;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is horribly broken.\", error);\n });\n}", "function cameraStart() {\n var flagCamera = true;\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function (stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n localStream = track;\n })\n .catch(function (error) {\n flagCamera = false;\n console.error(\"Oops. Something is broken.\", error);\n }).then(function () {\n if (flagCamera)\n visibleC();\n });\n }", "_initVideoStream () {\n const getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia ||\n navigator.mozGetUserMedia || navigator.msGetUserMedia\n if (!getUserMedia) {\n throw new Error('Webcam feature not supported! :(')\n }\n\n getUserMedia.call(navigator, { video: true }, (stream) => {\n this._stream = stream\n this._video.onloadedmetadata = this._onVideoReady.bind(this)\n this._video.src = window.URL.createObjectURL(stream)\n }, (err) => {\n throw err\n })\n }", "function getVideo() {// getUserMedia must have MediaStreamConstraints\n navigator.mediaDevices.getUserMedia({ video: true, audio: false}) // returns promise\n .then(MediaStream => {\n console.log(MediaStream); // MediaStream is an object\n video.srcObject = MediaStream; // video.srcObject is different to teacher video\n video.play();\n }).catch(err => {\n console.error(`Oh no!! You need to allow the site to use your webcam, ${err}`);\n alert(`Please reload and allow the site to access your webcam`);\n })\n}", "function startVideo() {\n navigator.getUserMedia(\n { video: {} },\n stream => video.srcObject = stream,\n error => console.error(error)\n )\n}", "function callUser(user) {\n getCam()\n .then(stream => {\n const video = document.getElementById(\"selfview\");\n try {\n video.srcObject = stream;\n } catch (error) {\n video.src = URL.createObjectURL(stream);\n }\n // document.getElementById(\"selfview\").srcObject = stream;\n\n /*if (window.URL) {\n document.getElementById(\"selfview\").src = window.URL.createObjectURL(stream);\n } else {\n document.getElementById(\"selfview\").src = stream;\n }*/\n\n toggleEndCallButton();\n caller.addStream(stream);\n localUserMedia = stream;\n caller.createOffer().then(function(desc) {\n caller.setLocalDescription(new RTCSessionDescription(desc));\n channel.trigger(\"client-sdp\", {\n \"sdp\": desc,\n \"room\": user,\n \"from\": id\n });\n room = user;\n });\n\n })\n .catch(error => {\n console.log('an error occured', error);\n })\n}", "function setCamera()\n{\n var v = 0.0025; // camera tool speed\n var r = 950.0; // camera to origin distance\n \n var alphaX = v * camRotationX * Math.PI;\n var alphaY = v * camRotationY * Math.PI;\n \n alphaX = Math.max(alphaX, -0.5 * Math.PI)\n alphaX = Math.min(alphaX, 0.0)\n \n var sX = Math.sin(alphaX);\n var cX = Math.cos(alphaX);\n \n var sY = Math.sin(alphaY);\n var cY = Math.cos(alphaY);\n \n camera.position.x = r * cX * sY;\n camera.position.y = r * (-sX);\n camera.position.z = r * cX * cY;\n \n // aim the camera at the origin\n camera.lookAt(new THREE.Vector3(0,0,0));\n}", "function startCamera() {\n Webcam.set({\n width: 320,\n height: 240,\n image_format: 'jpeg',\n jpeg_quality: 90\n });\n Webcam.attach('#my_camera');\n}", "async function cameraStart() {\n\n await faceapi.nets.faceLandmark68TinyNet.loadFromUri(\"models\");\n await faceapi.nets.tinyFaceDetector.loadFromUri('models')\n\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function(stream) {\n track = stream.getTracks()[0];\n cameraView.srcObject = stream;\n })\n .catch(function(error) {\n console.error(\"Oops. Something is broken.\", error);\n });\n}", "function captureCamera(capture) {\r\n navigator.mediaDevices.getUserMedia({\r\n video: true\r\n })\r\n .then(function (stream) {\r\n myvideo.srcObject = stream;\r\n myvideo.play();\r\n capture && capture(stream);\r\n })\r\n .catch(function (err) {\r\n console.error(err);\r\n alert(\"Ups, we need your camera! Please refresh the page and start again\");\r\n });\r\n}", "async function setupCam() {\n navigator.mediaDevices.getUserMedia({\n video: true\n }).then(mediaStream => {\n vid.srcObject = mediaStream;\n }).catch((error) => {\n console.warn(error);\n });\n await knn.load();\n setTimeout(loop, 50);\n}", "function getVideo() {\n\tnavigator.mediaDevices.getUserMedia({video: true, audio: false})\n\t\t.then(localMediaStream => {\n\t\t\tconsole.log(localMediaStream);\n\t\t\tvideo.src = window.URL.createObjectURL(localMediaStream);\n\t\t\t//MediaStream is an object and needs to be changed to be a URL\n\t\t\tvideo.play();\n\t\t\t//this updates so that the camera shouldn't just be one frame\n\t\t\t//if inspected, blob is the video being caught\n\t\t})\n\t\t.catch(err => {\n\t\t\tconsole.error(`WELP ERROR`, err);\n\t\t});\n}", "function setupCamera() {\n // const camera = new PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);\n const camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);\n camera.position.set(0, -distance,height / 2);\n camera.up = new Vector3(0,0,1);\n camera.lookAt(new Vector3(0, 0, height / 2));\n return camera;\n}", "async function setupWebcam() {\n if (navigator.mediaDevices.getUserMedia) {\n const stream = await navigator.mediaDevices.getUserMedia({\n \"audio\": false,\n \"video\": {\n width: {\n min: 640,\n max: 640\n },\n height: {\n min: 480,\n max: 480\n }\n }\n });\n\n webcam.srcObject = stream;\n\n return new Promise((resolve) => {\n webcam.onloadedmetadata = () => {\n webcam.width = stream.getVideoTracks()[0].getSettings().width;\n webcam.height = stream.getVideoTracks()[0].getSettings().height;\n canvas.width = stream.getVideoTracks()[0].getSettings().width;\n canvas.height = stream.getVideoTracks()[0].getSettings().height;\n\n canvasDims = [canvas.height, canvas.width];\n\n resolve(webcam);\n };\n });\n }\n}", "get camera() {return this._p.camera;}", "function setVideoDevice(device) {\n\t\tconsole.log(\"[StationIDReader] Using device for video stream: \");\n\t\tconsole.log(device);\n\t\tif (navigator.getUserMedia) { \n\t\t //navigator.getUserMedia({video: true}, handleVideo, videoError);\n\t\t //navigator.getUserMedia({video: { facingMode: { exact: \"environment\" } } }, handleVideo, videoError);\n\t\t var constraints = {\n\t\t \tvideo: {deviceId: {exact: device.deviceId}}\n\t\t };\n\t\t navigator.getUserMedia(constraints, handleVideo, videoError);\n\t\t}\n\t\telse {\n\t\t\talert(\"unable to create video\")\n\t\t}\n\t}", "function captureCamera_candidate(callback) {\n navigator.mediaDevices.getUserMedia({ audio: true, video: true }).then(function(camera) {\n callback(camera);\n }).catch(function(error) {\n alert('Unable to capture your camera. Please check console logs.');\n console.error(error);\n });\n}", "get camera () {return this._p.camera;}", "setCamera() {\r\n // set up camera\r\n this.camera = new Camera({\r\n time: this.time,\r\n sizes: this.sizes,\r\n renderer: this.renderer,\r\n debug: this.debug,\r\n config: this.config\r\n });\r\n\r\n // add to scene\r\n this.scene.add(this.camera.container);\r\n\r\n // update camera position per frame\r\n this.time.on('update', () => {\r\n if (this.world && this.world.car) { // if car is on the scene\r\n this.camera.target.x = this.world.car.chassis.object.position.x;\r\n this.camera.target.y = this.world.car.chassis.object.position.y;\r\n this.camera.target.z = this.world.car.chassis.object.position.z;\r\n this.camera.direction.x = this.world.car.movement.direction.x;\r\n this.camera.direction.y = this.world.car.movement.direction.y;\r\n }\r\n });\r\n }", "function webcamToVideo()\n{\n\tn \t\t\t = navigator\n\tn.getUserMedia = n.getUserMedia || n.webkitGetUserMedia || n.mozGetUserMedia || n.msGetUserMedia;\n\twindow.URL \t = window.URL || window.webkitURL;\n\tn.getUserMedia(\n\t\t{video:true}, \n\t\tfunction(stream)\n\t\t{\n\t\t\tvideo.src = window.URL.createObjectURL(stream);\n\t\t\tlocalMediaStream = stream;\n\t\t},\n\t\tonCameraFail\n\t);\n}", "function getVideo() {\n // getting someone's video webcam\n navigator.mediaDevices.getUserMedia({ video: true, audio: false}) // this returns a promise\n .then(localMediaStream => {\n console.log(localMediaStream);\n //video.src = localMediaStream;\n // still need to convert it to some sort of url to make it work\n video.src = window.URL.createObjectURL(localMediaStream); // now it works but only one frame\n video.play(); // now it's a live stream :)\n })\n .catch(err => {\n console.error(`Oupsy Daisy!`, err);\n }); // if it doesn't work shows an error (like oupsy daisy you need to allow acess to the camera)\n}", "function requestWebcam(video) {\n return new Promise((resolve, reject) => {\n const options = { video: { height: 420 }, audio: false };\n navigator.mediaDevices\n .getUserMedia(options)\n .then((stream) => {\n video.addEventListener(\n 'loadedmetadata',\n (_) => {\n video.play();\n resolve(video);\n },\n { once: true }\n );\n\n video.srcObject = stream;\n })\n .catch((e) => {\n reject(e);\n });\n });\n}", "function reloadVideo()\n{\n // From Mozilla Development Network site\n\n // Older browsers might not implement mediaDevices at all, so we set an empty object first\n if (navigator.mediaDevices === undefined) {\n navigator.mediaDevices = {};\n }\n\n // Some browsers partially implement mediaDevices. We can't just assign an object\n // with getUserMedia as it would overwrite existing properties.\n // Here, we will just add the getUserMedia property if it's missing.\n if (navigator.mediaDevices.getUserMedia === undefined) {\n navigator.mediaDevices.getUserMedia = function(constraints) {\n\n // First get ahold of the legacy getUserMedia, if present\n var getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia;\n\n // Some browsers just don't implement it - return a rejected promise with an error\n // to keep a consistent interface\n if (!getUserMedia) {\n return Promise.reject(new Error('getUserMedia is not implemented in this browser'));\n }\n\n // Otherwise, wrap the call to the old navigator.getUserMedia with a Promise\n return new Promise(function(resolve, reject) {\n getUserMedia.call(navigator, constraints, resolve, reject);\n });\n }\n }\n\n\n //let constraints = {video: { facingMode: \"environment\" } }\n let constraints = {video: { facingMode: \"environment\" }};\n\n // Acquires the video stream.\n navigator.mediaDevices.getUserMedia(constraints)\n .then((stream) => {\n if (\"srcObject\" in video) {\n video.srcObject = stream;\n } else {\n // Avoid using this in new browsers, as it is going away.\n video.src = window.URL.createObjectURL(stream);\n }\n video.onloadedmetadata = function(e) {\n video.play();\n };\n localMediaStream = stream;\n videoplayer = new VideoPlayer();\n }).catch((reason) => {\n console.error(\"Error in getting camera stream.\");\n alert(\"Camera Stream is not available on this device.\");\n });\n // Clear data, ready to be reused.\n clearText();\n}", "function updateViewerCamera(){\n\tif (viewerParams.useTrackball) viewerParams.controls.target = new THREE.Vector3(viewerParams.controlsTarget.x, viewerParams.controlsTarget.y, viewerParams.controlsTarget.z);\n\n\tif (viewerParams.camera){\n\t\tviewerParams.camera.position.set(viewerParams.cameraPosition.x, viewerParams.cameraPosition.y, viewerParams.cameraPosition.z);\n\t\tviewerParams.camera.rotation.set(viewerParams.cameraRotation._x, viewerParams.cameraRotation._y, viewerParams.cameraRotation._z);\n\t\tviewerParams.camera.up.set(viewerParams.cameraUp.x, viewerParams.cameraUp.y, viewerParams.cameraUp.z);\n\t}\n\t//console.log(viewerParams.camera.position, viewerParams.camera.rotation, viewerParams.camera.up);\n}", "function startPreview() {\n var captureSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();\n captureSettings.streamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.video;\n captureSettings.photoCaptureSource = Windows.Media.Capture.PhotoCaptureSource.videoPreview;\n \n // Enumerate cameras and add find first back camera\n var cameraId = null;\n var deviceInfo = Windows.Devices.Enumeration.DeviceInformation;\n if (deviceInfo) {\n deviceInfo.findAllAsync(Windows.Devices.Enumeration.DeviceClass.videoCapture).done(function (cameras) {\n if (cameras && cameras.length > 0) {\n cameras.forEach(function (camera) {\n if (camera && !cameraId) {\n // Make use of the camera's location if it is available to the description\n var camLocation = camera.enclosureLocation;\n if (camLocation && camLocation.panel === Windows.Devices.Enumeration.Panel.back) {\n cameraId = camera.id;\n }\n }\n });\n }\n if (cameraId) {\n captureSettings.videoDeviceId = cameraId;\n }\n\n capture.initializeAsync(captureSettings).done(function () {\n\n //trying to set focus mode\n var controller = capture.videoDeviceController;\n\n if (controller.focusControl && controller.focusControl.supported) {\n if (controller.focusControl.configure) {\n var focusConfig = new Windows.Media.Devices.FocusSettings();\n focusConfig.autoFocusRange = Windows.Media.Devices.AutoFocusRange.macro;\n\n var supportContinuousFocus = controller.focusControl.supportedFocusModes.indexOf(Windows.Media.Devices.FocusMode.continuous).returnValue;\n var supportAutoFocus = controller.focusControl.supportedFocusModes.indexOf(Windows.Media.Devices.FocusMode.auto).returnValue;\n\n if (supportContinuousFocus) {\n focusConfig.mode = Windows.Media.Devices.FocusMode.continuous;\n } else if (supportAutoFocus) {\n focusConfig.mode = Windows.Media.Devices.FocusMode.auto;\n }\n\n controller.focusControl.configure(focusConfig);\n controller.focusControl.focusAsync();\n }\n }\n\n var deviceProps = controller.getAvailableMediaStreamProperties(Windows.Media.Capture.MediaStreamType.videoRecord);\n\n deviceProps = Array.prototype.slice.call(deviceProps);\n deviceProps = deviceProps.filter(function (prop) {\n // filter out streams with \"unknown\" subtype - causes errors on some devices\n return prop.subtype !== \"Unknown\";\n }).sort(function (propA, propB) {\n // sort properties by resolution\n return propB.width - propA.width;\n });\n\n var maxResProps = deviceProps[0];\n\n controller.setMediaStreamPropertiesAsync(Windows.Media.Capture.MediaStreamType.videoRecord, maxResProps).done(function () {\n capturePreview.src = URL.createObjectURL(capture);\n // handle orientation change\n rotateVideoOnOrientationChange = true;\n capturePreview.onloadeddata = function () {\n updatePreviewForRotation();\n };\n // add event handler - will not work anyway\n window.addEventListener(\"orientationchange\", updatePreviewForRotation, false);\n\n capturePreview.play();\n\n // Insert preview frame and controls into page\n document.body.appendChild(capturePreview);\n document.body.appendChild(capturePreviewAlignmentMark);\n document.body.appendChild(captureCancelButton);\n\n startBarcodeSearch(maxResProps.width, maxResProps.height);\n });\n });\n });\n }\n }", "function getVideo() {\n // Returns a promise\n navigator.mediaDevices\n .getUserMedia({ video: true, audio: false })\n .then((localMediaStream) => {\n // console.log(localMediaStream)\n // Take video and set source object to this localMediaStream\n video.srcObject = localMediaStream;\n video.play(); // emits \"canplay\" event\n })\n .catch((err) => {\n console.error(\n 'Oh no, we need your webcam permission in order for this to work!',\n err\n );\n });\n}", "function manipulatevideo(){\n if( cameravideo || capturevideo ){\n cameravideo = false;\n capturevideo = false;\n capturestream = null;\n buttonOff(document.querySelector('.app__system--button.video'));\n camerastream.getVideoTracks()[0].enabled = cameravideo;\n document.getElementById('localvideo').srcObject = camerastream;\n //-------------------CREATE NEW PRODUCER-------------------------------------------\n removeOldVideoProducers();\n let videoProducer = mediasouproom.createProducer(camerastream.getVideoTracks()[0]);\n videoProducer.send(sendTransport);\n updatevideo();\n }\n}", "function getCameraElement() {\r\n var camera = document.elements.findElementByTypeId(\"Microsoft.VisualStudio.3D.PerspectiveCamera\");\r\n return camera;\r\n}", "function get_video(path) {\n //with camera stream, only working if we use video here not with 'var video', but before this point video doesn't exist\n video = video2;\n \n //need to be careful here: in use_webcam() the src Object is set with video.srcObject = stream; not with video.setAttribute(). If we don't reset\n //it to null it seems to override the attributes that are set with setAttribute.\n video.srcObject = null;\n //first I created a seperate source object here, which is complete nonesense\n //it's totally dufficient to add the path from the file picker <video src=\"path\" ...>\n video.setAttribute('src', path);\n video.load();\n video.play();\n\n //add an update, as soon as the video is running loop is called constantly\n video.ontimeupdate = function() {loop()};\n\n}", "attachCamera (object) {\n object.cameraAttached = true\n this.referenceObject = object\n }", "function moveCamera() {\n // calculate where the user is currently\n const t = document.body.getBoundingClientRect().top;\n\n me.rotation.y += 0.01;\n me.rotation.x =+ 0.01;\n\n camera.position.z = t * -0.01;\n camera.position.x = t * -0.0002;\n camera.rotation.y = t * -0.0002;\n \n}", "async function startVideo() {\n console.log('Models loaded!!!')\n\n let stream\n try {\n stream = await navigator.mediaDevices.getUserMedia({ video: {}})\n } catch (err) {\n console.error(err)\n }\n video.srcObject = stream\n}", "async function populateVideo() {\n // We grab the feed off the user's webcam\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { width: 1280, height: 720 },\n });\n\n // We set the object to be the stream\n video.srcObject = stream; // usually when dealing with video files we use video.src = 'videoName.mp4'\n await video.play();\n\n // size the canvases to be the same size as the video\n console.log(video.videoWidth, video.videoHeight);\n\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n\n faceCanvas.width = video.videoWidth;\n faceCanvas.height = video.videoHeight;\n}", "function startWebcam() {\n var vid = document.querySelector('video');\n // request cam\n navigator.mediaDevices.getUserMedia({\n video: true\n })\n .then(stream => {\n // save stream to variable at top level so it can be stopped lateron\n webcamStream = stream;\n // show stream from the webcam on te video element\n vid.srcObject = stream;\n // returns a Promise to indicate if the video is playing\n return vid.play();\n })\n .then(() => {\n // enable the 'take a snap' button\n var btn = document.querySelector('#takeSnap');\n btn.disabled = false;\n // when clicked\n btn.onclick = e => {\n takeSnap()\n .then(blob => {\n analyseImage(blob, params, showResults);\n })\n };\n })\n .catch(e => console.log('error: ' + e));\n}", "function setupCamera() {\n return _setupCamera.apply(this, arguments);\n}", "function startVideo() {\n const constraints = { video: true, audio: true };\n navigator.mediaDevices\n .getUserMedia(constraints)\n .then(function (stream) {\n // success\n window.stream = stream; // make variable available to browser console\n localVideo.srcObject = stream;\n\n localStream = stream;\n\n // auto start\n tellReady();\n })\n .catch(function (error) {\n // error\n console.error(\"An error occurred:\");\n console.error(error);\n return;\n });\n}", "function createCameraStream(uid) {\n var localStream = AgoraRTC.createStream({\n streamID: uid,\n audio: true,\n video: true,\n screen: false\n });\n localStream.setVideoProfile(cameraVideoProfile);\n localStream.init(function () {\n console.log(\"getUserMedia successfully\");\n // TODO: add check for other streams. play local stream full size if alone in channel\n localStream.play('local-video'); // play the given stream within the local-video div\n\n // publish local stream\n client.publish(localStream, function (err) {\n console.log(\"[ERROR] : publish local stream error: \" + err);\n });\n\n enableUiControls(localStream); // move after testing\n localStreams.camera.stream = localStream; // keep track of the camera stream for later\n }, function (err) {\n console.log(\"[ERROR] : getUserMedia failed\", err);\n });\n}", "async function setUpVideo(v) {\n const stream = await navigator.mediaDevices.getUserMedia({\n video: true,\n });\n v.srcObject = stream;\n v.play();\n}", "function createCamera(config) {\n\t //Create a new camera element\n\t var camera = document.createElement('a-camera');\n\n\t //Using javascript's short circuiting mechanism they following on executes\n\t //the `setAttribute` call if the config key is true.\n\t config.mouseControl && camera.setAttribute('mouse-cursor', true);\n\t config.allowMovement && camera.setAttribute('move-controls', true);\n\n\t return camera;\n\t}", "getCamera() {\n return this._engine._camera;\n }", "async function selectMediaStream() {\n try {\n // Working with Screen Capture API.\n // We get our mediastream data.\n const mediaStream = await navigator.mediaDevices.getDisplayMedia();\n // We pass the mediaStream the user select as video src.\n video.srcObject = mediaStream;\n // When the video has loaded its metadata it's gonna call a function to play the video.\n video.onloadedmetadata = () => {\n video.play();\n }\n } catch (error) {\n console.error(`Whoops, error here: ${error}`);\n }\n}", "function takeVideoStream() {\n\tcleanElements(); // CLean all the elements\n\t\n\t// Create the start, stop and video elements for the video stream\n\tvar videoStreamElement = document.getElementById(\"videoStreamElement\");\n\tvideoStreamElement.innerHTML = '<br><button class=\"btn btn-dark\" id=\"startStream\">Start recording</button><br>';\n\tvideoStreamElement.innerHTML += '<button class=\"btn btn-dark\" id=\"stopStream\">Stop recording</button><br>';\n\tvideoStreamElement.innerHTML += '<br><br><video></video>';\n\tvideoStreamElement.innerHTML += '<br><br><video id=\"capturedVideoStream\" controls></video>';\n\n\tvar start = document.getElementById(\"startStream\");\n\tvar stop = document.getElementById(\"stopStream\");\n\tvar capturedVideoStream = document.getElementById(\"capturedVideoStream\");\n\tcapturedVideoStream.style.visibility = \"hidden\"; // Hide the second video element (the captured video element)\n\n\n\t// The constraints for the media\n\tlet constraint = {\n\t\taudio: false,\n\t\tvideo: { facingMode: \"user\" }\n\t}\n\n\t// Handle old browsers that do not support the medie capture API\n\tif (navigator.mediaDevices == undefined) {\n\t\t/*navigator.mediaDevices = {};\n\t\tnavigator.mediaDevices.getUserMedia = function(constraintObj) {\n\t\t\tlet getUserMedia = navigator.webkitGetUserMedia || navigator.mozGetUserMedia;\n\t\t\tif (!getUserMedia) {\n\t\t\t\treturn Promise.reject(new Error('getUserMedia is not implemented in this browser'));\n\t\t\t}\n\t\t\treturn new Promise(function(resolve, reject) {\n\t\t\t\tgetUserMedia.call(navigator, constraintObj, resolve, reject);\n\t\t\t});\n\t\t}*/\n\t} else { // List all the devices ... this is where we can implement the select video capture device\n\t\tnavigator.mediaDevices.enumerateDevices().then(devices => {\n\t\t\tdevices.forEach(device => {\n\t\t\t\tconsole.log(device.kind.toUpperCase(), device.label);\n\t\t\t});\n\t\t}).catch( error => {\n\t\t\tconsole.log(error.name, error.message);\n\t\t});\n\t}\n\n\tnavigator.mediaDevices.getUserMedia(constraint).then(stream => {\n\t\t// Connect the video stream to the the video element\n\t\tlet video = document.querySelector('video');\n\t\tif (\"srcObject\" in video)\n\t\t\tvideo.srcObject = stream; // send the stream to the video element\n\t\telse\n\t\t\tvideo.src = window.URL.createObjectURL(stream); //For old browers\n\n\t\tvideo.onloadedmetadata = function(ev) {\n\t\t\tvideo.play(); // Display the video stream in the video element.\n\t\t}\n\n\t\t//store the blobs of the video stream\n\t\tlet mediaRecorder = new MediaRecorder(stream);\n\t\tlet recordedBlobs = [];\n\n\t\t// Start recording\n\t\tstart.addEventListener('click', (ev) => {\n\t\t\tmediaRecorder.start();\n\t\t\tconsole.log(mediaRecorder.state);\n\t\t\tcapturedVideoStream.style.visibility = \"hidden\"; // Hide the second video element (the captured video element)\n\t\t});\n\n\t\t// Stop recording\n\t\tstop.addEventListener('click', (ev)=> {\n\t\t\tmediaRecorder.stop();\n\t\t\tconsole.log(mediaRecorder.state);\n\t\t});\n\n\t\t// Record all of the blobs\n\t\tmediaRecorder.ondataavailable = function(ev) {\n\t\t\trecordedBlobs.push(ev.data);\n\t\t};\n\n\t\t// When the stop recoding button is clicked\n\t\tmediaRecorder.onstop = (ev)=> {\n\t\t\tlet blob = new Blob(recordedBlobs, { 'type': 'video/mp4;'});\n\n\t\t\trecordedBlobs = [];\n\t\t\tlet videoURL = window.URL.createObjectURL(blob);\n\n\t\t\tcapturedVideoStream.style.visibility = \"visible\"; // Make the captured video element visiable\n\t\t\tcapturedVideoStream.src = videoURL;\n\n\t\t\tsubmitVideo(blob, true); // Submit the video\n\t\t};\n\t}).catch(error => {\n\t\tconsole.log(error.name, error.message);\n\t});\n}", "function _switchCamera() {\n\t\tconsole.log('(ReachSDK::localstream::_switchCamera)');\n\t\tif (videoSources.length>0) {\n\t\t\tcurrentVideoSource = ++currentVideoSource % videoSources.length;\n\t\t\tif (streamAudioVideo) {\n\t\t\t\tconsole.log('(ReachSDK::localstream::_switchCamera)::streamAudioVideo');\n\t\t\t\tstreamAudioVideo.getTracks().forEach((track)=>{\n\t\t\t\t\ttrack.stop();\n\t\t\t\t});\n\t\t\t\tinitAudioVideo();\n\t\t\t}\n\t\t\tif (streamVideo) {\n\t\t\t\tconsole.log('(ReachSDK::localstream::_switchCamera)::streamVideo');\n\t\t\t\tstreamVideo.getTracks().forEach((track)=>{\n\t\t\t\t\ttrack.stop();\n\t\t\t\t});\n\t\t\t\tinitVideo();\n\t\t\t}\n\t\t}\n\t}", "updateCamera() {\n this.camera = this.cameras.get(this.currentCameraID);\n this.interface.setActiveCamera(this.camera);\n }", "function turnOn()\n{\n navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia;\n\n if (navigator.getUserMedia)\n {\n navigator.getUserMedia({video: true}, handleVideo, videoError);\n }\n}", "function setupCamera() {\n camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);\n camera.position.x = 0.6;\n camera.position.y = 16;\n camera.position.z = -20.5;\n camera.lookAt(new Vector3(0, 0, 0));\n console.log(\"Finished setting up Camera..!\");\n}", "function handleUserMediaSuccess(stream) {\n\tvideo = document.getElementById(\"my_video\");\n\tvideo.style.width = document.width + \"px\";\n\tvideo.style.height = document.height + \"px\";\n\n\t// Other video attributes to play with:\n\t// video.setAttribute('autoplay', '');\n\t// video.setAttribute('muted', '');\n\t// video.setAttribute('playsinline', '');\n\n\tvar constraints = {\n\t\taudio: false,\n\t\tvideo: {\n\t\t\tfacingMode: \"user\",\n\t\t},\n\t};\n\n\tnavigator.mediaDevices.getUserMedia(constraints).then(\n\t\tfunction success(stream) {\n\t\t\tvideo.srcObject = stream;\n\t\t\t// make a call to another function that we will use\n\t\t\t// to process our video stream in some way set the\n\t\t\t// interval to twice every second\n\t\t\t// window.setInterval(myVideoFunction, 500);\n\t\t},\n\t\t(reason) => {\n\t\t\tconsole.log(\"video stream not working\");\n\t\t}\n\t);\n}", "function setupCamera() {\n camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);\n camera.position.x = 6.5;\n camera.position.y = 16;\n camera.position.z = -32;\n camera.lookAt(new Vector3(-3, 0, 0));\n console.log(\"Finished setting up Camera...\");\n}", "async function openForFrontPage(e) {\n const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });\n document.querySelector('#myVid').srcObject = stream;\n localStream = stream;\n}", "async function selectMediaStream() {\n try {\n const mediaStream = await navigator.mediaDevices.getDisplayMedia(); //Screen Capture API\n videoElement.srcObject = mediaStream; //pass the mediaStream as the source\n videoElement.onloadedmetadata = () => { \n videoElement.play();\n }\n } catch (error) {\n console.log('Ooops, we\\'ve got an error: ', error);\n }\n}", "function useNavigatorGetUserMedia(){\n\t\t\t\t\t\t navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia ||\n\t\t\t\t\t\t\t\t\t\t\t navigator.msGetUserMedia || navigator.oGetUserMedia;\n\t\t\t\t\t\t \n\t\t\t\t\t\t if(navigator.getUserMedia){\n\t\t\t\t\t\t\t navigator.getUserMedia({video:true},handleVideo, videoError);\n\t\t\t\t\t\t }\n\t\t\t\t\t }", "function selectMediaStream() {\n const mediaStream = await navigator.mediaDevices.getDisplayMedia().then(() => { \n videoElement.srcObject = mediaStream;\n videoElement.onloadedmetadata = () => {\n videoElement.play();\n };\n })\n}", "addCamera(){\n this.camera = new THREE.PerspectiveCamera(VIEW_DEFAULT_PARAMS.camera.fov, this.viewWidth/this.viewHeight, VIEW_DEFAULT_PARAMS.camera.near, VIEW_DEFAULT_PARAMS.camera.far);\n this.camera.position.set(3, 10, 40);\n this.camera.up.set(0,1,0);\n //this.camera.lookAt(new THREE.Vector3(0, 6, 0));\n this.scene.add(this.camera);\n\n this.controls = new THREE.OrbitControls( this.camera, this.renderer.domElement );\n this.controls.target.set(5,8,0);\n }", "function setCamera(){\n var cameraTemp = new THREE.OrthographicCamera(-aspRat*viewLength/2, aspRat*viewLength/2,\n viewLength/2, -viewLength/2, -1000, 1000);\n cameraTemp.position.set(0, 100, 0);\n cameraTemp.lookAt(scene.position);\n return cameraTemp;\n}//end setCamera()", "function setupCamera() {\n camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);\n camera.position.x = -35;\n camera.position.y = 30;\n camera.position.z = 25;\n camera.lookAt(new Vector3(10, 0, 0));\n console.log(\"Finished setting up Initial Camera...\");\n}", "function setupCamera() {\n camera = new PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 1000);\n camera.position.x = 4.7;\n camera.position.y = 12.47; //z\n camera.position.z = 12.9; //y axis in blender\n camera.lookAt(new Vector3(0, 0, 0));\n cameras[0] = camera;\n console.log(\"Finished setting up Camera...\");\n}", "async function init() {\n const constraints = {\n video: {\n width: innerWidth, height: innerHeight\n }\n };\n\n try {\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n window.stream = stream;\n video.srcObject = stream;\n } catch (e) {\n errorMsgElement.style.display = \"block\";\n if (onMobile()) {\n errorMsgElement.innerHTML = \"Welcome to RiemannWeb! To get started, click the \\\"Upload\\\" button to take a photo.\";\n }\n else {\n errorMsgElement.innerHTML = \"Uh oh, an error has occured starting a live video feed! Please upload an image instead.\";\n }\n snapButton.style.display = \"none\";\n }\n}", "function setupCamera() {\n camera = new PerspectiveCamera(60, config.Screen.RATIO, 0.1, 1000);\n //camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);\n //Officiel:x=90,y=40,z=30\n //plus pres:40,10,0\n //47,9,2\n camera.position.x = 90;\n camera.position.y = 40;\n camera.position.z = 30;\n camera.lookAt(new Vector3(0, 0, 0));\n console.log(\"Finished setting up Camera...\");\n scene.add(camera);\n}", "async function initCamera() {\r\n console.log (\"##f()## initCamera function execution\");\r\n const constraints = {\r\n audio: false,\r\n video: {\r\n width: 320, height: 240\r\n }\r\n };\r\n try {\r\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\r\n handleSuccess(stream);\r\n changeStyleForStep2();\r\n } catch (e) {\r\n alert(`navigator.getUserMedia error:${e.toString()}`);\r\n }\r\n}", "async function selectMediaStream(){\n try {\n const mediaStream = await navigator.mediaDevices.getDisplayMedia();\n videoElement.srcObject = mediaStream;\n videoElement.onloadedmetadata = ()=>{\n videoElement.play();\n }\n } catch (err) {\n console.log('Whoops error here: ', err);\n }\n}", "createCamera(id, camera) {\n switch (camera.type) {\n case \"perspective\":\n this.cameras.set(id, new CGFcamera(camera.angle, camera.near, camera.far, camera.from, camera.to));\n return;\n case \"ortho\":\n this.cameras.set(id, new CGFcameraOrtho(camera.left, camera.right, camera.bottom, camera.top, camera.near, camera.far, camera.from, camera.to, camera.up));\n return;\n default:\n return;\n }\n }", "function setUpCamera() {\n \n // set up your projection\n // defualt is orthographic projection\n let projMatrix = glMatrix.mat4.create();\n //glMatrix.mat4.ortho(projMatrix, -5, 5, -5, 5, 1.0, 300.0);\n glMatrix.mat4.perspective(projMatrix, radians(60), 1, 5, 100);\n gl.uniformMatrix4fv (program.uProjT, false, projMatrix);\n\n \n // set up your view\n // defaut is at (0,0,-5) looking at the origin\n let viewMatrix = glMatrix.mat4.create();\n glMatrix.mat4.lookAt(viewMatrix, [0, 3, -11], [0, 0, 0], [0, 1, 0]);\n gl.uniformMatrix4fv (program.uViewT, false, viewMatrix);\n}", "function setupCamera() {\n camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);\n camera.position.x = -50;\n camera.position.y = 25;\n camera.position.z = 20;\n camera.lookAt(new Vector3(5, 0, 0));\n console.log(\"Finished setting up Camera...\");\n}", "function setupCamera() {\n camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 5000);\n camera.position.x = -1100;\n camera.position.y = 1000;\n camera.position.z = 1100;\n camera.lookAt(new Vector3(0, 0, 0));\n console.log(\"Finished setting up Camera\");\n}", "function setupMediaStream() {\n\t\t\tnavigator.mediaDevices\n\t\t\t\t.getUserMedia(MediaRecorderConfig.constraints)\n\t\t\t\t.then(function(mediaStream) {\n\t\t\t\t\t//Pipe stream to video element\n\t\t\t\t\tconnectStreamToVideo(mediaStream);\n\n\t\t\t\t\t//Create media recorder instance to capture the stream\n\t\t\t\t\tsetupMediaRecorder(mediaStream);\n\t\t\t\t})\n\t\t\t\t.catch(function(error) {\n\t\t\t\t\t//NotFoundError - This will show up when no video device is detected.\n\t\t\t\t\t//NotAllowedError: The request is denied by the user agent or the platform is insecure in the current context.\n\t\t\t\t\t//NotReadableError: Failed to allocate videosource - User allowed permission but disconnected device. Could also be hardware error.\n\t\t\t\t\t//OverconstrainedError: Constraints could be not satisfied.\n\t\t\t\t\tsetStreamError(`${error.name}: ${error.message}`);\n\t\t\t\t});\n\t\t}", "function initialize() {\n webcamElement = document.getElementById('webcam');\n canvasElement = document.getElementById('canvas');\n webcam = new Webcam(webcamElement, 'user', canvasElement);\n snapButtonElement = document.getElementById('capture');\n startButtonElement = document.getElementById('retake');\n}", "getCamera(){\n return this._camera;\n }", "initCameras() {\n\n // Reads the views from the scene graph.\n for (var key in this.graph.views) {\n\n if (this.graph.views.hasOwnProperty(key)) {\n var graphView = this.graph.views[key];\n\n if (graphView[0] == \"perspective\") {\n this.cameras[key] = new CGFcamera(\n Utils.degToRad(graphView[3]), // angle\n graphView[1], // near\n graphView[2], // far\n vec3.fromValues(...graphView[4]), // from\n vec3.fromValues(...graphView[5])); // to\n }\n else if (graphView[0] == \"ortho\") {\n this.cameras[key] = new CGFcameraOrtho(\n graphView[3], // left\n graphView[4], // right\n graphView[5], // bottom\n graphView[6], // top\n graphView[1], // near\n graphView[2], // far\n vec3.fromValues(...graphView[7]), // from\n vec3.fromValues(...graphView[8]), // to\n vec3.fromValues(...graphView[9])); // up\n }\n }\n }\n\n // XML default camera ID\n this.camera = this.cameras[this.selectedCamera];\n this.interface.setActiveCamera(this.camera);\n\n // Add Selected Camera Option to Interface Gui\n this.interface.initCameras(this, 'selectedCamera', this.cameras);\n }", "function startVideo() {\n\n navigator.getUserMedia = navigator.mozGetUserMedia || navigator.webkitGetUserMedia || navigator.msGetUserMedia;\n navigator.getUserMedia({video: true, audio: true}, successCallback, errorCallback);\n function successCallback(stream) {\n localStream = stream;\n try {\n sourcevid.src = window.URL.createObjectURL(stream);\n sourcevid.play();\n } catch (e) {\n console.log(\"Error setting video src: \", e);\n }\n\n }\n function errorCallback(error) {\n console.error('An error occurred: [CODE ' + error.code + ']');\n return;\n }\n}" ]
[ "0.76734245", "0.74210167", "0.7339442", "0.7298811", "0.72884417", "0.72826576", "0.72387886", "0.7193497", "0.7098979", "0.709148", "0.70444125", "0.7037726", "0.70060045", "0.6965139", "0.6923468", "0.6908866", "0.6832422", "0.68167394", "0.6798288", "0.67865056", "0.6764955", "0.6762703", "0.6756786", "0.67466146", "0.67402864", "0.67402864", "0.6718014", "0.6718014", "0.667351", "0.6665457", "0.66552955", "0.66447455", "0.6629313", "0.65920174", "0.65201235", "0.6502865", "0.64798754", "0.64758015", "0.64714384", "0.64446235", "0.64317524", "0.63963735", "0.6374422", "0.63703054", "0.6367463", "0.6363304", "0.6354638", "0.63453674", "0.6334313", "0.63329554", "0.63279605", "0.6299514", "0.6293035", "0.62855655", "0.62779576", "0.6276079", "0.6242126", "0.6241486", "0.62395495", "0.6230906", "0.6225131", "0.621992", "0.62100476", "0.6201884", "0.6196299", "0.6194698", "0.61777014", "0.61749935", "0.61656266", "0.615703", "0.6128705", "0.6120527", "0.61192536", "0.611347", "0.61098665", "0.6108715", "0.610052", "0.60995823", "0.6090564", "0.6086413", "0.6079485", "0.60728604", "0.60606915", "0.60559076", "0.60548294", "0.6048941", "0.604371", "0.6042983", "0.6040926", "0.6039396", "0.6026362", "0.60194284", "0.6015718", "0.60136604", "0.60131633", "0.6011678", "0.6010332", "0.600233", "0.5988138", "0.59724325" ]
0.8200102
0
Functions to make the calculator work
function btnPress() { if (result > 0) { clear(); } currentVal += this.value; updateDisplay(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function performCalculation() {\r\n if (calculator.firstNumber == null || calculator.operator == null) {\r\n alert(\"Anda belum menetapkan operator\");\r\n return;\r\n }\r\n\r\n let result = 0;\r\n if (calculator.operator === \"+\") {\r\n result = parseInt(calculator.firstNumber) + parseInt(calculator.displayNumber)\r\n }\r\n\r\n if (calculator.operator === \"-\") {\r\n result = parseInt(calculator.firstNumber) - parseInt(calculator.displayNumber)\r\n }\r\n calculator.displayNumber = result;\r\n}", "function Calculator() {\n \"use strict\";\n \n this.userInputString = \"\";\n var oThis = this;\n \n var evaluateExpression = function(expression) {\n if ((expression !== undefined) && (expression !== \"\")) {\n if (String(expression).match(/^-\\d+/)) {\n expression = String(expression).replace(/^-/, \"0-\");\n }\n var numberTokens = String(expression).match(/\\d+\\.\\d+|\\d+/g);\n var nonNumberTokens = String(expression).match(/[^\\d\\.]/g);\n\n var invalidInputStr = \"Invalid input.\";\n\n //Check that there are no more than one single operator in between numbers.\n var errenousOperatorTokens = String(expression).match(/\\D{2,}/g);\n\n if (errenousOperatorTokens !== null) {\n var errenousOperatorTokensStr = errenousOperatorTokens.join(\",\");\n\n return invalidInputStr;\n }\n\n if (numberTokens !== null) {\n var acc = parseFloat(numberTokens[0], 10);\n var i;\n\n if (nonNumberTokens !== null) {\n if ((numberTokens.length - 1) === nonNumberTokens.length) {\n for (i = 1; i < numberTokens.length; ++i) {\n switch (nonNumberTokens[i-1]) {\n case \"+\":\n acc += parseFloat(numberTokens[i], 10);\n break;\n\n case \"-\":\n acc -= parseFloat(numberTokens[i], 10);\n break;\n\n case \"*\":\n acc *= parseFloat(numberTokens[i], 10);\n break;\n\n case \"\\/\":\n acc /= parseFloat(numberTokens[i], 10);\n break;\n\n default:\n return \"Invalid operation: \" + nonNumberTokens[i-1];\n }\n }\n } else {\n return invalidInputStr;\n }\n return acc;\n } else {\n return numberTokens[0];\n }\n }\n }\n \n };\n \n this.buttonPress = function(buttonString) {\n switch (buttonString) {\n case \"=\":\n var result = evaluateExpression(oThis.userInputString);\n //Set the user input string to the result, as if the user wants to work with\n //the currently displayed result.\n oThis.userInputString = result;\n return result;\n \n case \"(clr)\":\n oThis.userInputString = \"\";\n return \"\";\n \n case \"(del)\":\n if (oThis.userInputString) {\n oThis.userInputString = oThis.userInputString.substr(0, oThis.userInputString.length - 1);\n }\n return oThis.userInputString;\n \n default:\n if (oThis.userInputString) {\n oThis.userInputString += buttonString;\n } else {\n oThis.userInputString = buttonString;\n }\n \n return oThis.userInputString;\n }\n };\n}", "function operations(typeOperator) {\n\t\n\tif(typeOperator=='comma' && v!='v'){\n\t\tresText=resText+\".\";\n\t\tv='v';\n\t\tdv=1;\n\t\tanimateButtons('comma');\n\t}else if(typeOperator!='comma'){\n\t\tv='f';\n\t}\n\n\tif(typeOperator==\"sum\"){\n\t\tresText=resText+\"+\";\n\t\tanimateButtons('sum');\t \n\t}else if(typeOperator==\"minus\"){\n\t\tresText=resText+\"-\";\n\t\tanimateButtons('minus');\n\n\n\t}else if(typeOperator==\"times\"){\n\t\tresText=\"ans\"+\"×\";\n\t\tanimateButtons('times');\n\n\n\t}else if(typeOperator==\"divided\"){\n\t\tresText=\"ans\"+\"÷\";\n\t\tanimateButtons('divided');\n\n\t}\n\n\n\tif(typeOperator!='comma'){\n\n\t\tif(prevTypeOperator=='sum'){\n\t\t\tresNum=numberInstMemo+resNum;\n\t\t\tnumberInstMemo=0;\n\n\t\t}else if(prevTypeOperator=='minus'){\n\t\t\tresNum=resNum-numberInstMemo;\n\t\t\tnumberInstMemo=0;\n\n\t\t}else if(prevTypeOperator=='times' && d!=0){\n\t\t\tresNum=resNum*numberInstMemo;\n\t\t\tnumberInstMemo=0; \n\n\t\t}else if(prevTypeOperator=='divided' && d!=0){\n\t\t\tresNum=resNum/numberInstMemo;\n\t\t\tnumberInstMemo=0; \n\n\t\t}\n\n\t\tprevTypeOperator=typeOperator;\n\t\t\n\t}\n\t\n\t\n\tif(typeOperator=='equal'){\n\n\t\tresText='ans';\n\t\tanimateButtons('equal');\n\t\t\n\t}\n\n\tdocument.getElementById(\"resText\").innerHTML = resText;\n\tdocument.getElementById(\"resNum\").innerHTML = resNum;\n\t\n\td=0;\n\n\n}", "function calculator(num1,operator,num2) {\r\n\r\n let result;\r\nswitch (operator) {\r\n \r\n case \"+\": result = num1+num2; break;\r\n case \"-\": result = num1-num2; break;\r\n case \"*\": result = num1*num2; break;\r\n case \"/\": result = num1/num2; break;\r\n case \"%\": result = num1%num2; break;\r\n case \"^\": result = Math.pow(num1,num2) ; break;\r\n case \"sin\": result = Math.sin(num1,num2) ; break;\r\n case \"cos\": result = Math.cos(num1,num2) ; break;\r\n case \"tan\": result = Math.tan(num1,num2) ; break;\r\n default: result = \"invalid operator\"; break;\r\n}\r\n return result;\r\n}", "function calculator() {\n \"use strict\";\n var num1, num2, action, result;\n\n num1 = parseInt(window.prompt(\"Choose a number:\"));\n num2 = parseInt(window.prompt(\"Choose another number:\"));\n action = window.prompt(\"Choose an operation: add, subtract, multiply or divider\");\n\n function add(param1, param2) {\n result = param1 + param2;\n return result;\n }\n function subtract(param1, param2) {\n result = param1 - param2;\n return result;\n }\n function multiply(param1, param2) {\n result = param1 * param2;\n return result;\n }\n function divide(param1, param2) {\n result = param1 / param2;\n return result;\n }\n \n function calculate(param1, param2, operation) {\n switch (action) {\n case \"add\":\n result = add(param1, param2);\n break;\n case \"subtract\":\n result = subtract(param1, param2);\n break;\n case \"multiply\":\n result = multiply(param1, param2);\n break;\n case \"divide\":\n result = divide(param1, param2);\n break;\n }\n return result;\n }\n \n return calculate(num1, num2, action);\n\n}", "function mathOperation() {\n if (lastOperation === \"X\") {\n result = parseFloat(result) * parseFloat(displayTwoNum);\n } else if (lastOperation === \"+\") {\n result = parseFloat(result) + parseFloat(displayTwoNum);\n } else if (lastOperation === \"-\") {\n result = parseFloat(result) - parseFloat(displayTwoNum);\n } else if (lastOperation === \"/\") {\n result = parseFloat(result) / parseFloat(displayTwoNum);\n }\n}", "function calculator(button){\r\n if(button.type == \"operator\"){\r\n data.operation.push(button.symbol);\r\n data.result.push(button.formula);\r\n }\r\n else if (button.type == \"number\"){\r\n data.operation.push(button.symbol);\r\n data.result.push(button.formula);\r\n }\r\n else if(button.type == \"key\"){\r\n if(button.name == \"delete\"){\r\n data.operation.pop();\r\n data.result.pop();\r\n }\r\n else if (button.name == \"clear\"){\r\n data.result = [];\r\n data.operation = [];\r\n output_result_element.innerHTML = 0;\r\n }\r\n else if(button.name == \"rad\"){\r\n RADIAN = true;\r\n angleToggler();\r\n }\r\n else if (button.name == \"deg\"){\r\n RADIAN = false;\r\n angleToggler();\r\n }\r\n }\r\n \r\n else if (button.type == \"math_function\") {\r\n\r\n if (button.name == \"factorial\") {\r\n data.operation.push(\"!\");\r\n data.result.push(button.formula);\r\n } else if (button.name == \"square\") {\r\n data.operation.push(\"^(\");\r\n data.result.push(button.formula);\r\n data.operation.push(\"2)\");\r\n data.result.push(\"2)\");\r\n }\r\n else if (button.name == \"power\")\r\n {\r\n data.operation.push(\"^(\");\r\n data.result.push(button.formula);\r\n\r\n }\r\n else {\r\n data.operation.push(button.symbol + \"(\");\r\n data.result.push(button.formula + \"(\");\r\n }\r\n }\r\n else if (button.type == \"trigo_function\") {\r\n data.operation.push(button.symbol + \"(\");\r\n data.result.push(button.formula);\r\n }\r\n \r\n else if (button.type == \"calculate\"){\r\n let result_tot = data.result.join(\"\");\r\n \r\n let final_result;\r\n \r\n let power_search = searcher(data.result,POWER);\r\n\r\n let factorial_search = searcher(data.result,FACTORIAL);\r\n\r\n const power_base = power_base_search(data.result,power_search);\r\n power_base.forEach( ele => {\r\n let toReplace = ele + POWER;\r\n let replacement = \"Math.pow(\" + ele + \",\";\r\n result_tot = result_tot.replace(toReplace,replacement);\r\n })\r\n\r\n const facto_base = fact_base_search(data.result,factorial_search);\r\n\r\n facto_base.forEach(ele => {\r\n result_tot = result_tot.replace(ele.toReplace, ele.replacement);\r\n })\r\n \r\n //CHECKING SYNTAX-ERROR\r\n try {\r\n final_result = eval(result_tot);\r\n } catch (error) {\r\n if( error instanceof SyntaxError){\r\n final_result = \"Error!\";\r\n output_result_element.innerHTML = final_result;\r\n return;\r\n }\r\n }\r\n\r\n final_result = calculate(final_result);\r\n ans = final_result;\r\n data.operation.push(final_result);\r\n data.result.push(final_result);\r\n output_result_element.innerHTML = final_result;\r\n return;\r\n }\r\n updateOutputOperation( data.operation.join('') );\r\n}", "function calc(){\n\nlet n1 = parseFloat(document.getElementById(\"n1\").value)\nlet n2 = parseFloat(document.getElementById(\"n2\").value)\n\n\nlet op = document.getElementById(\"opr\").value\n\nif(op === \"+\"){\n\ndocument.getElementById('result').value = n1+n2;\n\n}\nif(op === \"-\"){\n\ndocument.getElementById('result').value = n1-n2;\n\n}\nif(op === \"x\"){\n\ndocument.getElementById('result').value = n1*n2;\n\n}\nif(op === \"/\"){\n\ndocument.getElementById('result').value = n1/n2;\n\n}\n\nreturn;\n}", "function calculate() {\n\n calculator.calculate();\n\n }", "calc(){\n let lastIndex =\"\";\n //armazenando o ultimo operador\n this._lastOperator = this.getLastItem(true);\n\n if(this._operation.length < 3){\n let firstNumber = this._operation[0];\n this._operation =[];\n this._operation = [firstNumber, this._lastOperator, this._lastNumber];\n }\n\n //arrumando para quando o método for chamado pelo sinal de igual =\n if(this._operation.length > 3){\n\n lastIndex = this._operation.pop();\n //armazenando o ultimo número digitado na calcl\n this._lastNumber = this.getResult();\n\n }else if(this._operation.length == 3){\n //armazenando o ultimo número digitado na calcl\n this._lastNumber = this.getLastItem(false);\n }\n\n //transforma um vetor em uma string, usando um separador, qo separador é definido pelo parametro passado no método\n let result = this.getResult();\n\n if(lastIndex == \"%\"){\n result /= 100;\n this._operation = [result];\n }else{\n this._operation =[result];\n //se o ultimo index for diferente de vazio, então adiciona ele no vetor\n if(lastIndex){\n this._operation.push(lastIndex);\n }\n \n }\n this.setLastNumberToDisplay();\n \n }", "function operate(operator, num1, num2) {\n num1 = parseFloat(prevNum, 10);\n num2 = parseFloat(currentNum, 10);\n if (operator == 'add') {\n return add(num1, num2);\n } if (operator == 'subtract') {\n return subtract(num1, num2);\n } if (operator == 'multiply') {\n return multiply(num1, num2);\n } if (operator == 'divide') {\n return divide(num1, num2);\n } if (operator == '') {\n displayNum.textContent = '';\n }\n}", "function calculator(firstnumber,operator,secondnumber)\n{\n var totalval;\n switch(operator)\n {\n case '+':\n totalval = firstnumber + secondnumber;\n break;\n case '-':\n totalval = firstnumber - secondnumber;\n break;\n case '*':\n totalval = firstnumber * secondnumber;\n break;\n case '/':\n totalval = firstnumber / secondnumber;\n break;\n\n }\n return totalval\n}", "compute() {\r\n let computation\r\n //parseFloat converts a string argument and converts it to a float\r\n const prev = parseFloat(this.previousOperand)\r\n const current = parseFloat(this.currentOperand)\r\n //NaN means Not a Number\r\n if (isNaN(prev) || isNaN(current)) return\r\n //here, you are matching up the values and operations buttons\r\n switch (this.operation) {\r\n case '+':\r\n computation = prev + current\r\n break\r\n case '-':\r\n computation = prev - current\r\n break\r\n case 'x':\r\n computation = prev * current\r\n break\r\n case '/':\r\n computation = prev / current\r\n break\r\n \r\n default:\r\n return\r\n }\r\n //actual computation taking place\r\n this.currentOperand = computation\r\n this.operation = undefined\r\n this.previousOperand = ''\r\n }", "function calculator (value1, value2, operation) {\n var result=0\n\n if (operation== 'addition') {\n\n result = value1 + value2 \n\n } else if (operation== 'subtraction') {\n result= value1 - value2\n } else if (operation== 'multiplication') {\n result= value1 * value2\n \n } else if (operation== 'division') {\n result= value1 / value2\n\n } else {\n result='Please insert a correct operation'\n }\n return result\n}", "calc() {\n if (this.operation.length < 2) return;\n let result;\n\n //calculation if the operation is less than 2 operators\n if (this.operation.length == 2) {\n //calculation if the last operator is raised to power\n if (this.getLastPosition() == 'x²') {\n this.raisedPower(this.getLastPosition(false));\n return;\n }\n //calculation if the last operator is square root\n if (this.getLastPosition() == '√') {\n this.squareRoot(this.getLastPosition(false));\n return;\n }\n\n let firstNumber = this.operation[0];\n if (!this.lastOperator) this.lastOperator = this.getLastPosition();\n if (!this.lastNumber) this.pushOperator(firstNumber);\n if (this.lastNumber) this.pushOperator(this.lastNumber);;\n }\n\n //calculation if the operation is 3 or more operators\n if (this.operation.length > 3) {\n this.lastOperator = this.destroyLastOperator();\n } else if (this.operation.length == 3) {\n this.lastNumber = this.getLastPosition(false);\n this.lastOperator = this.getLastPosition();\n }\n\n //execute the of operation\n result = this.getResult();\n //validates of the last operator\n if (this.lastOperator == '%') {\n result /= 100;\n this.operation = [result];\n } else if (this.lastOperator == 'x²') {\n result *= result;\n this.operation = [result];\n } else {\n this._operation = [result, this.lastOperator];\n }\n\n this.updateDisplay(); \n }", "function operate()\n{\n // Initializes variables for operator input\n const add = document.querySelector(`#add`);\n const subtract = document.querySelector(`#subtract`);\n const multiply = document.querySelector(`#multiply`);\n const divide = document.querySelector(`#divide`);\n const equal = document.querySelector(`#equal`);\n\n let additionValue = ``;\n let subtractionValue = ``;\n let multiplicationValue = ``;\n let divisionValue = ``;\n\n // `+` button\n add.addEventListener(`click`, function()\n {\n // Operations for addition\n checkOperator();\n additionValue = parseArray(additionValue, inputArray);\n addition(additionValue);\n updateDisplay(total);\n resetArray();\n\n // Adds `+` to operator variable\n operator = add.textContent;\n });\n // `-` button\n subtract.addEventListener(`click`, function()\n {\n // Operations for subtraction\n checkOperator();\n subtractionValue = parseArray(subtractionValue, inputArray);\n subtraction(subtractionValue);\n updateDisplay(total);\n resetArray();\n\n // Adds `-` to operator variable\n operator = subtract.textContent;\n });\n // `X` button\n multiply.addEventListener(`click`, function()\n {\n // Operations for multiplication\n checkOperator();\n multiplicationValue = parseArray(multiplicationValue, inputArray);\n multiplication(multiplicationValue);\n updateDisplay(total);\n resetArray();\n checkArray(multiplicationValue);\n\n // Adds `X` to operator variable\n operator = multiply.textContent;\n });\n divide.addEventListener(`click`, function()\n {\n // Operations for division\n checkOperator();\n divisionValue = parseArray(divisionValue, inputArray);\n division(divisionValue);\n updateDisplay(total);\n resetArray();\n checkArray(divisionValue);\n\n // Adds `/` to operator variable\n operator = divide.textContent;\n });\n\n // `=` button\n equal.addEventListener(`click`, function()\n {\n checkOperator();\n resetOperator();\n });\n}", "function calculate(expression) {\n let field = document.getElementById(\"res\");\n let operands = expression.split(selectedOper.charAt(0));\n let res = \"\";\n switch (selectedOper.charAt(0)) {\n case '+':\n res = `${parseInt(operands[0], 2) + parseInt(operands[1], 2)}`;\n field.innerHTML = `${parseInt(res, 10).toString(2)}`;\n break;\n case '-':\n res = `${parseInt(operands[0], 2) - parseInt(operands[1], 2)}`;\n field.innerHTML = `${parseInt(res, 10).toString(2)}`;\n break;\n case '*':\n res = `${parseInt(operands[0], 2) * parseInt(operands[1], 2)}`;\n field.innerHTML = `${parseInt(res, 10).toString(2)}`;\n break;\n case '/':\n if (parseInt(operands[1], 2) > 0) {\n res = `${parseInt(operands[0], 2) / parseInt(operands[1], 2)}`; \n } else {\n res = 0;\n }\n\n field.innerHTML = `${parseInt(res, 10).toString(2)}`; \n break;\n\n default:\n break;\n }\n}", "function operate(){\n\t\n\t// Triggers when second operator is '='\n\t// Call giveResult function which actually calculates formula\n\t// Write result into display\n\t// Set first number/operand as result for further calculations\n\t// Clear the rest of calculation object\n\tif (calculation['operator2'] == '='){\n\t\tlet result = giveResult();\n\t\tdisplay.textContent = result;\n\t\t\n\t\tcalculation['operand'] = parseFloat(result);\n\t\tcalculation['operand2'] = '';\n\t\tcalculation['operator'] = '';\n\t\tcalculation['operator2'] = '';\n\n\t// Same as above, but when second operator is other than '=' give result\n\t// and set first operator as second operator\n\t// Clear the rest\n\t}else{\n\t\tlet result = giveResult()\n\t\tdisplay.textContent = result;\n\t\t\n\t\tcalculation['operand'] = result\n\t\tcalculation['operand2'] = ''\n\t\tcalculation['operator'] = calculation['operator2'];\n\t\tcalculation['operator2'] = '';\n\t}\n}", "function calcFunctions (func) {\n switch(func) {\n \n case 'backspace':\n case 'DEL':\n output.innerHTML = output.innerHTML.substring(0, output.innerHTML.length - 1);\n if (output.innerHTML === '') {\n output.innerHTML = '0';\n }\n \n if (output.innerHTML === 'Infinit') {\n output.innerHTML = '0';\n }\n \n if (output.innerHTML === 'Na') {\n output.innerHTML = '0';\n }\n \n break;\n \n case '.':\n if (!output.innerHTML.includes('.')) {\n calcNumbers(func);\n }\n break;\n \n case '+':\n console.log('Addition!');\n firstNum = output.innerHTML;\n calcState.numFlag = true;\n calcState.arithmetic = addition;\n break;\n \n case 'enter':\n case '=':\n equalsFn(calcState.arithmetic);\n break;\n \n case '\\u002a':\n case 'x':\n console.log('Multiply!')\n firstNum = output.innerHTML;\n calcState.numFlag = true;\n calcState.arithmetic = multiplication;\n break;\n \n case '/':\n case '\\u00F7':\n console.log('Division!')\n firstNum = output.innerHTML;\n calcState.numFlag = true;\n calcState.arithmetic = division;\n break;\n \n case '-':\n console.log('Minus')\n firstNum = output.innerHTML;\n calcState.numFlag = true;\n calcState.arithmetic = subtraction;\n break;\n \n case '%':\n console.log('Percentage')\n firstNum = output.innerHTML;\n calcState.numFlag = true;\n output.innerHTML = firstNum / 100;\n break;\n \n case '\\u221a':\n firstNum = output.innerHTML;\n calcState.numFlag = true;\n output.innerHTML = Math.sqrt(firstNum);\n break;\n \n case 'RND':\n firstNum = output.innerHTML;\n calcState.numFlag = true;\n output.innerHTML = Math.round(firstNum);\n \n default:\n break;\n }\n }", "function mathOperation() {\n if (lastOperation === \"x\") {\n result = parseFloat(result) * parseFloat(dis2Num);\n } else if (lastOperation === \"+\") {\n result = parseFloat(result) + parseFloat(dis2Num);\n } else if (lastOperation === \"-\") {\n result = parseFloat(result) - parseFloat(dis2Num);\n } else if (lastOperation === \"/\") {\n result = parseFloat(result) / parseFloat(dis2Num);\n } else if (lastOperation === \"%\") {\n result = parseFloat(result) % parseFloat(dis2Num);\n }\n}", "function valueCalled(e) {\n \n // code Clear the display\n if(e.target.value == 'C')\n {\n changeDisplayContent('');\n changeDisplayContent('0');\n resetFlags();\n resultDisplay.textContent = '';\n return;\n }\n\n // for removing the last digit\n if(e.target.value == 'D')\n {\n changeDisplayContent('D');\n return;\n }\n \n // for handling the floating points\n if(e.target.value == '.')\n {\n if(!floatFlag)\n {\n floatFlag = 1;\n changeDisplayContent('.');\n return;\n }\n else \n {\n return;\n }\n }\n\n // if the operator is not '='\n if(e.target.classList.contains('operator') && e.target.value != '=')\n {\n\n // if the last operator was an equal sign\n if(equalFlag)\n {\n currentOperator = e.target.value;\n equalFlag = 0;\n return;\n }\n\n // if num1 is empty then load the entered number in num1 \n // else put the num1flag on and enter it in num2\n if(!num1Flag)\n { \n currentOperator = e.target.value;\n if(checkFloat())\n {\n changeNum1(parseFloat(displayCalc));\n }\n\n else \n {\n changeNum1(parseInt(displayCalc));\n }\n changeDisplayContent('');\n }\n \n else if(!num2Flag)\n {\n if(displayCalc == '')\n {\n currentOperator = e.target.value;\n return;\n }\n\n if(checkFloat())\n {\n changeNum2(parseFloat(displayCalc));\n }\n else \n {\n changeNum2(parseInt(displayCalc));\n }\n \n // console.log('the number was saved in num2 : ' + num2);\n operate();\n changeDisplayContent('');\n changeDisplayContent('result');\n changeNum1(result);\n changeNum2(0);\n num2Flag = 0;\n currentOperator = e.target.value;\n }\n\n return;\n }\n \n // if the operator is '='\n else if(e.target.value == '=')\n {\n\n if(num1Flag && (displayCalc != '0' || displayCalc != '') && currentOperator != '')\n {\n if(checkFloat())\n {\n changeNum2(parseFloat(displayCalc));\n }\n else \n {\n changeNum2(parseInt(displayCalc));\n }\n\n operate();\n changeDisplayContent('');\n changeDisplayContent('result');\n displayCalc = '0';\n changeNum1(result);\n changeNum2(0);\n num2Flag = 0;\n currentOperator = '';\n equalFlag = 1;\n }\n return;\n }\n \n\n // if it is a number then display it on the screen\n if(e.target.classList.contains('number'))\n {\n if(equalFlag)\n {\n changeNum1(0);\n num1Flag = 0;\n equalFlag = 0;\n }\n changeDisplayContent(e.target.value);\n }\n \n}", "function operate(operator,a,b) {\n\n if (operator == \"+\"){\n let results = addNums(a,b);\n return results;\n } else if (operator == \"-\"){\n let results = subtractNums(a,b);\n return results;\n } else if (operator == \"*\"){\n let results = multiplyNums(a,b);\n return results;\n } else if (operator == \"/\"){\n let results = divideNums(a,b);\n return results;\n }\n\n \n\n}", "function calculator(x, y, option) {\n if (option == 'add') {\n return x + y;\n } else if (option == 'subtract') {\n return x - y;\n } else if (option == 'divide') {\n return x / y;\n } else if (option == 'multiply') {\n return x * y;\n } else {\n return 0;\n }\n}", "function calc(){\n var a = parseFloat(document.getElementById('numbera').value);\n var b = parseFloat(document.getElementById('numberb').value);\n\n\n if (document.getElementById('operator').value == '+'){\n var res = a+b;\n\n }else if (document.getElementById('operator').value == '-'){\n var res = a-b;\n\n }else if (document.getElementById('operator').value == '*'){\n var res = a*b;\n\n }else {\n var res = a/b;\n }\n document.getElementById('result').innerHTML = res;\n\n\n}", "function operate()\n{\n switch(operator)\n {\n case \"+\":\n number3 = add(number1, number2);\n //Rounds up the decimal\n number3 = Math.round(number3*100)/100\n break;\n\n case \"-\":\n number3 = subtract(number1, number2);\n number3 = Math.round(number3*100)/100\n break;\n\n case \"*\":\n number3 = multiply(number1, number2);\n number3 = Math.round(number3*100)/100\n break;\n\n case \"/\":\n number3 = divide(number1, number2);\n number3 = Math.round(number3*100)/100\n break;\n }\n\n document.getElementById(\"screenTextTop\").textContent = number1 + \" \" + operator + \" \" + number2 + \" =\";\n document.getElementById(\"screenTextBottom\").textContent = number3;\n}", "function evaluate(operator) {\n let op2 = document.getElementById(\"lower\").value\n\n //Evaluating the expression \n let ch = expression.charAt((expression.length) - 1)\n if (ch == \"+\" || ch == \"-\" || ch == \"*\" || ch == \"/\") {\n //If user has clicked to evluate without the value of second operand,then add 0 automatically to complete it\n if (op2 == \"\") {\n op2 = 0\n }\n expression += op2;\n answer = calculate(parseInt(answer), parseInt(op2), operator)\n }\n\n //Updating the expression and displaying the result\n expressionSection.innerHTML = expression;\n inputSection.value = answer;\n}", "function calculate(value1, oper, value2) {\n switch (oper) {\n case \"+\":\n total = value1 + value2;\n calculationDone = true;\n display.value = total;\n break;\n case \"X\":\n total = value1 * value2;\n calculationDone = true;\n display.value = total;\n break;\n case \"*\":\n total = value1 * value2;\n calculationDone = true;\n display.value = total;\n break;\n case \"-\":\n total = value1 - value2;\n calculationDone = true;\n display.value = total;\n\n break;\n case \"/\":\n total = value1 / value2;\n calculationDone = true;\n display.value = total;\n\n break;\n default:\n console.log(\"here\");\n break;\n }\n return total;\n}", "function operClicked(){\n\tif((chain === false)){\n\t\tfirstMemory = Number($display.val());\n\t} else if(numEntered){\n\t\tif(operator === \"+\"){\n\t\t\tfirstMemory = add(firstMemory, Number($display.val()));\n\t\t} else if(operator === \"-\"){\n\t\t\tfirstMemory = substract(firstMemory, Number($display.val()));\n\t\t} else if(operator === \"×\"){\n\t\t\tfirstMemory = multiply(firstMemory, Number($display.val()));\n\t\t} else if(operator === \"÷\"){\n\t\t\tfirstMemory = divide(firstMemory, Number($display.val()));\t\n\t\t}\n\t} \n\n\toperator = $(this).text();\n\tconsole.log(operator);\n\tchain = true;\n\tneedNewNum = true;\n\tisThereDot = false;\n\tnumEntered = false;\n}", "function calculateInput() {\n $(\".button\").on(\"click\", function () {\n // user types in a number\n if (this.id.match(/\\d/)) {\n currentEntry += this.id.match(/\\d/)[0];\n previousEntry = currentEntry;\n if (potentialMinusOperation) potentialMinusOperation = false; // since no minus operation has been done.\n renderAll();\n }\n else {\n // clear entire input\n if ((calculate.length !== 0 || currentEntry !== 0) && this.id === \"button_ac\") {\n calculate = \"\";\n currentEntry = \"\";\n previousEntry = \"\";\n renderAll();\n }\n // first element is a dot, so put a \"0\" in front of it\n else if (currentEntry.length === 0 && this.id === \"button_dot\") {\n currentEntry = \"0.\";\n previousEntry = \"0.\";\n if (potentialMinusOperation) potentialMinusOperation = false;\n renderAll();\n }\n // determine which button was pressed in order to perform the correct calculation\n else if (currentEntry.length !== 0) {\n if (this.className === \"button button-operator\") {\n calculate += currentEntry + this.dataset.value;\n currentEntry = \"\";\n renderSecondary(calculate);\n if (this.id === \"button_mult\" || this.id === \"button_div\") potentialMinusOperation = true;\n }\n else switch (this.id) {\n case \"button_ce\": // only clear current entry, not entire calculation\n previousEntry = \"\";\n currentEntry = \"\";\n renderAll();\n break;\n case \"button_dot\":\n if (currentEntry.match(/\\./) === null) {\n currentEntry += \".\";\n previousEntry += \".\";\n }\n renderAll();\n break;\n case \"button_enter\":\n case \"button_hide_enter\":\n calculate += currentEntry;\n result = stringToCalculation(calculate);\n previousEntry = result;\n renderResult(result);\n calculationFinished = true;\n calculate = \"\";\n currentEntry = \"\";\n break;\n }\n }\n // of the potential minus flag is set to true, allow \"-\" to be pressed\n if (potentialMinusOperation && this.id === \"button_minus\") {\n calculate += \" - \";\n renderSecondary(calculate + currentEntry);\n potentialMinusOperation = false;\n }\n // post-calculation options\n if (calculationFinished) {\n if (this.id === \"button_ce\") {\n // when calculation is finished, CE has same functionality as AC\n calculate = \"\";\n currentEntry = \"\";\n previousEntry = \"\";\n renderAll();\n calculationFinished = false;\n }\n if (this.className === \"button button-operator\") {\n // use result for next calculation\n calculate = previousEntry + this.dataset.value;\n renderSecondary(calculate + currentEntry);\n calculationFinished = false;\n // allowing for negative operations\n if (this.id === \"button_mult\" || this.id === \"button_div\") {\n potentialMinusOperation = true;\n }\n }\n }\n }\n });\n}", "function basicCalc(){\n //prompt to chose what operator to use\n var operator = parseInt(prompt(\"please chose your operation \\n\" + \"1 - Addition (+)\\n\" +\" 2 - Subtraction (-)\\n\"+\" 3 - Mulitplication (*) Root\\n\"+\" 4 - Division (/)\\n\" ));\n // use our function with 2 prompts, and default messages for 2 values\n // save the returned value_array\n var value_array = prompt_for_values(2);\n //assign the returned value_array values from index 0 and 1 into the numbers to use\n number_1 = value_array[0];\n number_2 = value_array[1];\n // switch on the operator\n switch (operator) {\n //if operator is 1= +,\n case 1:\n // then preform the addition and return the value as an alert\n return alert(\"The addition of numbers: \" +number_1 + \" + \" + number_2+ \" = \" + (number_1+number_2));\n break;\n // if operator is 2 = -\n case 2:\n // then preform the addition and return the value as an alert\n return alert(\"The subtraction of numbers: \" +number_1 + \" - \" + number_2+ \" = \"+ (number_1-number_2));\n break;\n // if operator is 3 = *\n case 3:\n // then preform the addition and return the value as an alert\n return alert(\"The mulitplication of numbers: \" +number_1 + \" * \" + number_2 +\" = \"+ (number_1*number_2));\n break;\n // if operator is 4 = /\n case 4:\n // then preform the addition and return the value as an alert\n return alert(\"The division of numbers: -:\" +number_1 + \" / \" + number_2 +\" = \"+ (number_1/number_2));\n break;\n default:\n }\n}", "function calculator(act, num1, num2) {\n\n if (act === \"suma\") {\n return num1 + num2;\n } else if (act === \"resta\") {\n return num1 - num2;\n } else if (act === \"mult\") {\n return num1 * num2;\n } else if (act === \"div\") {\n return num1 / num2;\n } else {\n return \"escribe suma, resta, mult, div\";\n }\n\n}", "function calculator(a, b){\n\n}", "function calculator(a, op, b) {\nif (op == '/' && b === 0) return \"Can't divide by 0!\"\nif (op == '+') return a + b;\nif (op == '*') return a * b;\nif (op == '-') return a - b;\nif (op == '/') return a / b; \n}", "function Calculation() {\n }", "function calculator() {\n verificationInputNumbers();\n\n if (numberArray.length > 1) {\n results.push(sum(numberArray));\n results.push(sub(numberArray));\n results.push(mult(numberArray));\n results.push(div(numberArray));\n } else if (numberArray.length === 1) {\n results.push(Math.sqrt(numberArray[0]));\n } else {\n alert('ERROR No ha introducido ningum valor, refresca la página!')\n }\n\n analyzeDecimal();\n formatFinalResult();\n newOperation();\n}", "function init() {\n let calc={ \n inputA:\"\", //Input done in strings to avoid calculating values \n inputB:\"\", //of each multi-digit input since they will be entered \n operator:\"\", //backwards (Left To Right)\n result:\"\",\n };\n //Binding DOM elements to variables \n const numberBtn=document.querySelectorAll('.numbers'); //binds a 'nodelist' of all numbers to the variable\n const dotBtn=document.querySelector('#dot'); //binds \".\" Button to variable\n const operatorBtn=document.querySelectorAll('.operation'); //binds a 'nodelist' of all operations to the variable\n const equalsBtn=document.querySelector('#equal'); //binds \"=\" Button to variable\n const allClearBtn=document.querySelector('#allClear'); //binds \"AC\" Button to variable\n const clearBtn=document.querySelector('#clear'); //binds \"C\" Button to variable\n const extraBtn=document.querySelector('.extra');\n //Binding DOM elements to variables \n \n //Event Handlers///////////////////////////////////////\n //waits for when a 'number' is clicked\n numberBtn.forEach((button)=>{ //Goes through each element in the node list and add an event listener to it\n button.addEventListener('click',(event)=>{ \n inputHandling(calc,event.target.textContent);\n });\n });\n\n //waits for when the decimal point button is clicked\n dotBtn.addEventListener('click',()=>{\n dotHandling(calc);\n });\n\n ////waits for when the operation button(+,-,*,/,%) is clicked\n operatorBtn.forEach((button)=>{ //Goes through each element in the node list and add an event listener to it\n button.addEventListener('click',(event)=>{\n operatorHandling(calc,event.target.textContent)\n });\n });\n\n //waits for when the 'Equals to'(=) button is clicked\n equalsBtn.addEventListener('click',()=>{\n equalsHandling(calc);\n });\n \n //waits for when the 'All Clear'(AC) button is clicked\n allClearBtn.addEventListener('click',()=>{\n allClearHandling(calc);\n });\n\n //waits for when the 'Clear'(C) button is clicked\n clearBtn.addEventListener('click',()=>{\n backspaceHandling(calc);\n });\n\n //waits for when the 'EXTRA' button is clicked\n extraBtn.addEventListener('click',()=>{\n extraBtn.classList.add(\"lock\");\n advancedPanel(calc)\n });\n\n //waits for when the user presses a key using a keyboard\n document.addEventListener('keydown',(event)=>{\n keyboardInputs(calc,event.key)\n });\n //End of Event Handlers\n}", "function storeOperator(e){\n if (e.target.value == \"=\"){\n if (firstNumber != null && currentString != \"\"){\n secondNumber = Number.parseFloat(currentString);\n currentString = \"\";\n if (operate(firstNumber, secondNumber, operator) == \"divideByZero\"){\n \n \n secondNumber = null;\n } else {\n firstNumber = operate(firstNumber, secondNumber, operator);\n secondNumber = null;\n operator = null;\n }\n } else if (firstNumber != null && currentString == \"\"){\n operator = null;\n }\n getDisplay();\n return;\n }\n\n // if firstNumber is null, \n // push currentString to firstNumber\n // put cureent operator to operator\n if (firstNumber == null){\n if (currentString != \"\"){\n firstNumber = Number.parseFloat(currentString);\n currentString = \"\";\n operator = e.target.value;\n } else {\n return;\n }\n // if firstNumber is not null and currentString is null\n // user is choosing a new operator\n // replace current operator with new operator\n } else if (currentString == \"\"){\n operator = e.target.value;\n \n // if firstNumber is not null and currentString is not null,\n // push currentString to secondNumber\n // clear currentString\n // calculate and put answer into firstNumber\n // put current operator choice to operator\n } else {\n secondNumber = Number.parseFloat(currentString);\n currentString = \"\";\n firstNumber = operate(firstNumber, secondNumber, operator);\n secondNumber = null;\n operator = e.target.value;\n }\n getDisplay();\n}", "function calculation(op) {\r\n var firstNumb = parseFloat(document.getElementById('firstNumb').value);\r\n var secondNumb = parseFloat(document.getElementById('secondNumb').value);\r\n var values = document.getElementById('values');\r\n //var operations = new Array(added, subtracted, divided, multiplied); Not all operations work, still working on a fix\r\n //switch statement--when written like this only the first added work\r\n switch (op) {\r\n case '+':\r\n values.textContent = firstNumb + secondNumb;\r\n break;\r\n\r\n case '-':\r\n values.textContent = firstNumb - secondNumb;\r\n break;\r\n\r\n case '&#247;':\r\n values.textContent = firstNumb / secondNumb;\r\n break;\r\n\r\n case '*':\r\n values.textContent = firstNumb * secondNumb;\r\n break;\r\n\r\n default:\r\n values.textContent = 'Try again';\r\n break;\r\n }\r\n\r\n}", "function operation(mathsymbol) {\n //It will return if there is no number in display\n if (currentText.innerHTML == '' && previousText.innerHTML == '') return;\n\n //this will work if currentText is empty and you press operation so it will change the operation in previousText\n if (previousText.innerHTML != '' && currentText.innerHTML == '') {\n previousText.innerHTML = previousText.innerHTML.slice(0, -1) + mathsymbol;\n }\n else {\n //this will execute if previousText is empty else it will compute the previousText and currentText\n if (previousText.innerHTML == '') {\n previousText.innerHTML = currentText.innerHTML + mathsymbol;\n currentText.innerHTML = '';\n } else {\n let num1 = parseFloat(previousText.innerHTML.slice(0, -1));\n let num2 = parseFloat(currentText.innerHTML);\n\n switch (previousText.innerHTML.slice(-1)) {\n case '*':\n previousText.innerHTML = (num1 * num2).toString() + mathsymbol;\n currentText.innerHTML = '';\n break;\n\n case '+':\n previousText.innerHTML = (num1 + num2).toString() + mathsymbol;\n currentText.innerHTML = '';\n break;\n\n case '-':\n previousText.innerHTML = (num1 - num2).toString() + mathsymbol;\n currentText.innerHTML = '';\n break;\n\n case '÷':\n previousText.innerHTML = (num1 / num2).toString() + mathsymbol;\n currentText.innerHTML = '';\n break;\n\n //default will work if you try to press operation after pressing equals\n default:\n previousText.innerHTML = currentText.innerHTML + mathsymbol;\n currentText.innerHTML = '';\n }\n }\n }\n}", "function calculate()\n {\n if (operator == 1)\n {\n current_input = eval(memory) * eval(current_input);\n };\n if (operator == 2)\n {\n current_input = eval(memory) / eval(current_input);\n // If divide by 0 give an ERROR message\n var initial_value = current_input.toString();\n if (initial_value == \"Infinity\")\n {\n current_input = \"ERROR\"\n };\n };\n if (operator == 3)\n {\n current_input = eval(memory) + eval(current_input);\n };\n if (operator == 4)\n {\n current_input = eval(memory) - eval(current_input);\n };\n if (operator == 5)\n {\n current_input = Math.pow(eval(memory), eval(current_input));\n };\n operator = 0; //clear operator\n memory = \"0\"; //clear memory\n displayCurrentInput();\n }", "function calculator(){\n var input1 = prompt ('Add your first number.');\n var input2 = prompt ('Add your operator (+, -, *, /).');\n var input3 = prompt ('Add your last number.');\n\n if(input2 === '+'){\n console.log(`${input1} ${input2} ${input3} = ${add(input1, input3)}`); \n }\n if(input2 === '-'){\n console.log(`${input1} ${input2} ${input3} = ${subtract(input1, input3)}`); \n }\n if(input2 === '*'){\n console.log(`${input1} ${input2} ${input3} = ${multiply(input1, input3)}`); \n }\n if(input2 === '/'){\n console.log(`${input1} ${input2} ${input3} = ${divide(input1, input3)}`); \n }\n}", "function calculator(symbol, a, b) {\n if (symbol == \"+\") {\n return a+b;\n } else if (symbol == \"-\") {\n return a-b;\n } else if (symbol == \"/\") {\n return a/b;\n } else if (symbol == \"*\") {\n return a*b;\n } else {\n return \"invalid operator\"\n }\n}", "function calculate(){\n console.table(calculator);\n if (calculator.operator === '%'){\n percent(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n else if (calculator.operator === '÷'){\n divide(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n else if (calculator.operator === '×'){\n multiply(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n else if (calculator.operator === '-'){\n substract(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n else {\n add(calculator.numA, calculator.numB);\n display.textContent = calculator.result;\n }\n calculator.calculated = true;\n console.table(calculator);\n}", "function calculator(number1, number2, operator = '*') {\n let calculator = document.getElementById('calculator');\n let header = document.getElementsByClassName ('header');\n let display = document.getElementById('numberDisplay');\n let allblocks = document.querySelectorAll('.block');\n let blocks = document.getElementById('blocks');\n let block = document.getElementsByClassName('.block');\n\n if (operator == '+') { return number1 + number2; }\n else if (operator == '-') { return number1 - number2; }\n else if (operator == '*') { return number1 * number2; }\n else if (operator == '/') { return number1 / number2; }\n}", "function calculate(btn) {\n //test to see whether there is an answer in calcDisplay, and then append calculator operator to this answer to allow user to carry on calculation\n if (startOver && (btn == \"÷\" || btn == \"/\" || btn == \"x\" || btn == \"-\" || btn == \"+\" || btn == \"*\" || btn == \"×\")) {\n //sub-test for ERROR or LOL NO and replace with 0 if operator is pressed\n if (calcDisplay.textContent == \"ERROR\" || calcDisplay.textContent == \"lol no\") {\n calculation.textContent = 0;\n startOver = false;\n }\n else {\n calculation.textContent = String(calcDisplay.textContent);\n startOver = false;\n };\n };\n //replace the ÷ symbol with the correct mathematical operator\n if (btn == \"÷\") {\n calculation.textContent += \"/\";\n }\n //replace the × symbol with the correct mathematical operator\n else if (btn == \"x\" || btn == \"×\") {\n calculation.textContent += \"*\";\n }\n //append calculation catchall\n else calculation.textContent += btn;\n startOver = false;\n}", "function doMath (operator, value){\n \n if (operator == \"+\") {\n total += value;\n }\n else if (operator == \"-\") {\n total -= value;\n }\n else if (operator == \"*\"){\n total = total * value;\n }\n else if (operator == \"/\" && value == 0) {\n console.log(\"Cannot divide by 0, please choose another number.\")\n askForOperation();\n return;\n }\n else if (operator == \"/\") {\n total = total / value;\n }\n \n\n\n console.log(\"\");\n console.log(\"Current Total : \" + total);\n console.log(\"\");\n\n askForOperation();\n}", "function Calculator() {\n this.methods = {\n \"-\": (a, b) => a - b,\n \"+\": (a, b) => a + b\n };\n this.calculate = function(str) {\n let split = str.split(' '),\n a = +split[0],\n op = split[1],\n b = +split[2];\n if (!this.methods[op] || isNaN(a) || isNaN(b)) {\n return NaN;\n }\n return this.methods[op](a, b);\n };\n this.addMethod = function(name, func) {\n this.methods[name] = func;\n };\n\n\n}", "calculate(){\r\n \r\n switch(this.operator){//evaluate the operator \r\n case \"^\"://if the operator is ^, then use the power formula\r\n return Math.pow(this.num1,this.num2); \r\n case \"*\"://if the operator is *, multiple the two numbers\r\n return this.num1*this.num2;\r\n case \"/\"://if the operator is ^,divide the two numbers\r\n return this.num1/this.num2; \r\n case \"+\"://if the operator is ^, add the two numbers\r\n return this.num1+this.num2;\r\n case \"-\"://if the operator is ^, subtract the two numbers\r\n return this.num1-this.num2; \r\n default://else error\r\n return \"ERROR\" \r\n }\r\n }", "compute(){\r\n let computation;\r\n const prev = parseFloat(this.previousOperand);\r\n const current = parseFloat(this.currentOperand);\r\n \r\n // if user clicks equals only\r\n // return cancels the function completely further\r\n if (isNaN(prev) || isNaN(current)) return;\r\n \r\n switch(this.operation){\r\n case'+':\r\n computation = prev + current;\r\n break;\r\n case '-':\r\n computation = prev - current;\r\n break;\r\n case '*':\r\n computation = prev * current;\r\n break;\r\n case '÷':\r\n computation = prev / current; \r\n break;\r\n default:\r\n return;\r\n }\r\n this.readyToReset = true;\r\n this.currentOperand = computation\r\n this.operation = undefined\r\n this.previousOperand = ''\r\n }", "function calculate() {\n \n //Parse number variables to floats\n numOne = parseFloat(numOne);\n numTwo = parseFloat(numTwo);\n\n //Determine calculation to run via ID of operator\n if( op == 'add' ) {\n numOne = numOne + numTwo;\n }\n else if( op == 'subtract' ) {\n numOne = numOne - numTwo;\n }\n else if( op == 'multiply' ) {\n numOne = numOne * numTwo;\n }\n else {\n //Throw error and ask to be reset if attempt to divide by 0\n if( numTwo == 0 ) {\n error = true;\n }\n //If not diving by 0, run calculation\n else{\n numOne = numOne / numTwo;\n }\n }\n\n //If there was a divide by 0 error inform user and prompt to reset\n if( error == true ) {\n $currentDisplay.val('Cannot divide by 0. Please clear calculator.');\n $( '.ui-btn' ).prop('disabled', true);\n $( '.clear' ).prop('disabled', false);\n }\n //Else move on to update display\n else {\n //If the display for the number is too long, set the display to be cut off at 15 decimal points\n if( numOne.length > 18 ) {\n numOneDisplay = parseFloat(numOne).toFixed(15);\n }\n //Else, display normally\n else{\n numOneDisplay = numOne;\n }\n //Update the display\n $currentDisplay.val(numOneDisplay);\n //Set calculator so that it knows a calculation just occured and no operator has been chosen yet\n postCalc = true;\n opClicked = false;\n }\n\n }", "function Calculate(){\n var first_number;\n var operator;\n var second_number;\n var total;\n \n first_number=document.getElementById(\"firstNumber\").value;\n operator=document.getElementById(\"op\").value;\n second_number=document.getElementById(\"secondNumber\").value;\n\n if(operator==\"+\"){\n total=parseInt(first_number) + parseInt(second_number);\n console.log(\"Addition\");\n }\n else if(operator==\"-\"){\n total=parseInt(first_number) - parseInt(second_number);\n console.log(\"Subtraction\");\n }\n else if(operator==\"*\"){\n total=parseInt(first_number) * parseInt(second_number);\n console.log(\"Multiplication\");\n }\n else if(operator==\"/\"){\n total=parseInt(first_number) / parseInt(second_number);\n console.log(\"Division\");\n }\n\n document.getElementById(\"result\").value=total;\n}", "function calculator(num1, operator, num2) {\n if (num2 === 0) { return \"Can't divide by 0!\"; }\n else {\n switch (operator) {\n case \"+\":\n return num1 + num2;\n case \"-\":\n return num1 - num2;\n case \"*\":\n return num1 * num2;\n case \"/\":\n return num1 / num2;\n }\n }\n}", "function calculate() {\n //this if will make sure you dont try to compute with empty currentText or previousText\n if (currentText.innerHTML == '' || previousText.innerHTML == '') return;\n\n //slice is added so that it does not take the mathematical symbol\n let num1 = parseFloat(previousText.innerHTML.slice(0, -1));\n let num2 = parseFloat(currentText.innerHTML);\n\n //computing for all math\n switch (previousText.innerHTML.slice(-1)) {\n case '*':\n previousText.innerHTML = previousText.innerHTML + currentText.innerHTML;\n currentText.innerHTML = (num1 * num2).toString();\n break;\n\n case '+':\n previousText.innerHTML = previousText.innerHTML + currentText.innerHTML;\n currentText.innerHTML = (num1 + num2).toString();\n break;\n\n case '-':\n previousText.innerHTML = previousText.innerHTML + currentText.innerHTML;\n currentText.innerHTML = (num1 - num2).toString();\n break;\n\n case '÷':\n previousText.innerHTML = previousText.innerHTML + currentText.innerHTML;\n currentText.innerHTML = (num1 / num2).toString();\n break;\n\n default:\n return;\n }\n\n}", "function operate(i){\n\n if(i == 17){ // if the input is AC\n\n numbers = [];\n operators = [];\n result = 0;\n screenValue = 0;\n }\n else if(i == 16){ // if the input is DEL\n\n numbers.pop();\n screenValue = \"\";\n \n for(let i = 0; i < numbers.length; i++){\n screenValue += numbers[i];\n }\n }\n \n\n if (i < 11) { // if the input is a number or \".\", we add it to the array\n\n if(!(numbers.length == 0 && i == 0)){ // this avoids the screen get 000000\n \n numbers.push(button[i].title); // addition of the number you pressed to an array\n\n if(screenValue == result){ // this if empties the screen value if you make an operation without clearing the screen\n\n screenValue = numbers[numbers.length - 1];\n }\n else{\n screenValue += numbers[numbers.length - 1]; // i concatenate the last value of the array\n \n }\n }\n }\n\n if(screenValue[0] == \"x\" || screenValue[0] == \"/\" || screenValue[0] == \"+\" || screenValue[0] == \"-\"){\n\n screenValue = screenValue.substring(1); //this is a way to remove the first character of a string\n }\n\n if (i < 16 && i > 10){ // if input is {+, -, *, /, =} \n\n if(screenValue != result){ // this if lets you make chain operations\n\n operators.unshift(parseFloat(screenValue)); // I could do a 'push', but later I'm gonna pop() the results i dont need\n numbers = []; // emptying the array\n }\n\n if(operators.length == 2){\n\n switch (prev_i){ // this will select whether we are adding, multiplying, ....\n\n case 11:\n operators[0] += operators[1];\n break;\n\n case 12: \n operators[0] = operators[1] - operators[0];\n break;\n\n case 13:\n operators[0] = operators[1] * operators[0];\n break;\n \n case 14:\n operators[0] = operators[1] / operators[0];\n break;\n \n }\n\n operators.pop(); // the result of the operation is in the position [0], then I throw away the position [1]\n result = operators;\n screenValue = result;\n }\n else { // this part is responsible for showing on screen the operation we're dealing with\n \n switch(i){\n case 11: \n screenValue = \"+\";\n break;\n case 12:\n screenValue = \"-\";\n break;\n case 13:\n screenValue = \"x\";\n break;\n case 14:\n screenValue = \"/\";\n break;\n \n default:\n break;\n }\n }\n prev_i = i;\n } \n}", "function calculate() {\n // alert('=');\n\n calculation.push(parseInt(total));\n calculation.push(event.target.value);\n\n let num1 = '', num2 = '', operator = null, totalValue = 0;\n let operators = ['*', '/', '+', '-']\n\n console.log('calc', calculation);\n\n\n for (let i = 0; i < calculation.length; i++) {\n const char = calculation[i]; //value at that index in the calculation array.\n\n\n if (operators.includes(char)) {\n operator = char;\n } else if (operator == null) { //if not an operator, and operator hasn't been set, then num1 = char\n num1 += char;\n\n } else {\n num2 += char; //if not an operator, and operator has been set, then num2 = char\n }\n }\n //converting value of num1 & num2 from string to #\n num1 = parseFloat(num1);\n num2 = parseFloat(num2);\n\n //operator is still a string, no way to convert that, so explaining what to return.\n if (operator === '+') {\n totalValue = num1 + num2;\n } else if (operator === '-') {\n totalValue = num1 - num2;\n } else if (operator === '*') {\n totalValue = num1 * num2;\n } else if (operator === '/') {\n totalValue = num1 / num2;\n }\n $calcTotal.value = totalValue;\n}", "function cal(num1,num2,op){\n let y ;\n if(op == \"*\"){\n return duplicate(num1,num2);\n }\n else if(op == \"/\"){\n return division(num1,num2);\n }\n else if(op == \"-\"){\n y = num1.valueOf() - num2.valueOf(); \n return y.toString();\n }\n else if(op == \"+\"){\n num1 = parseFloat(num1);\n num2 = parseFloat(num2);\n y = num1+ num2;\n return y.toString();\n }\n\n }", "function calculate() {\n if (operator == 1) { currentInput = eval(memory) * eval(currentInput); };\n if (operator == 2) { currentInput = eval(memory) / eval(currentInput); };\n if (operator == 3) { currentInput = eval(memory) + eval(currentInput); };\n if (operator == 4) { currentInput = eval(memory) - eval(currentInput); };\n\n operator = 0; //clear operator\n memory = \"0\"; //clear memory\n displayCurrentInput();\n}", "function calculator(numOne, numTwo, operator) {\n switch (operator) {\n case \"+\":\n return numOne + numTwo;\n break;\n case \"-\":\n return numOne - numTwo;\n break;\n case \"/\":\n return numOne / numTwo;\n break;\n case \"*\":\n return numOne * numTwo;\n break;\n default:\n return \"Error! Something went wrong\";\n }\n}", "function calculator(number1, number2, operator) {\n switch (operator) {\n case \"+\":\n value = number1 + number2;\n break;\n\n case \"-\":\n value = number1 - number2;\n break;\n\n case \"*\":\n value = number1 * number2;\n break;\n\n case \"/\":\n value = number1 / number2;\n break;\n\n case \"%\":\n value = number1 % number2;\n }\n\n return \"\".concat(number1, \" \").concat(operator, \" \").concat(number2, \" = \").concat(value, \".\"); //return result\n} //call function and pass parameters and write result", "function calculate() {\n const operators = ['*', '/', '+', '-'];\n let opIndex = 0;\n while ( opInputs.length > 0 && opIndex < operators.length ) {\n const op = operators[opIndex];\n const index = opInputs.findIndex((o) => o === op);\n if ( index === -1 ) {\n opIndex ++;\n } else {\n calc(index, op);\n }\n }\n currentNumber = numInputs[0];\n document.getElementById('fullHist').innerHTML = currentNumber;\n document.getElementById('calc').value = currentNumber;\n}", "function calculate(num1, op, num2) {\n // ifs and elses (switch?) using num1, num2 and operator\n\n\n var result;\n\n switch (op) {\n case \"+\":\n result = num1 + num2;\n\n break;\n\n case \"-\":\n result = num1 - num2;\n\n break;\n\n case \"*\":\n result = num1 * num2;\n\n break;\n\n case \"/\":\n result = num1 / num2;\n\n break;\n\n default:\n\n }\n // console.log(result);\n return result;\n }", "function myCalculator(firstNumber, secondNumber, enteredOperator){\nif(enteredOperator == \"add\"){\n console.log(\"Gives the result of: \" + addTwoNumbers(firstNumber, secondNumber));\n} else if(enteredOperator == \"sub\"){\n console.log(\"Gives the result of: \"+ subTwoNumbers(firstNumber, secondNumber));\n}else if(enteredOperator == \"mul\"){\n console.log(\"Gives the result of: \" + mulTwoNumbers(firstNumber, secondNumber));\n} else if(enteredOperator == \"div\"){\n console.log(\"Gives the result of: \" + divTwoNumbers(firstNumber, secondNumber));\n}\n}", "function operation(operator){\n let numberOne = parseInt(document.getElementById(\"numberOne\").value);\n let numberTwo = parseInt(document.getElementById(\"numberTwo\").value);\n let resultOp;\n if (operator === \"plus\"){\n resultOp = numberOne+numberTwo;\n }\n else if (operator === \"minus\"){\n resultOp = numberOne-numberTwo;\n }\n else if (operator === \"multiplier\"){\n resultOp = numberOne*numberTwo;\n }\n else if (operator===\"divider\"){\n resultOp = numberOne/numberTwo;\n }\n else {\n console.log(\"trace: problem\");\n }\n document.getElementById(\"result\").value = resultOp;\n}", "function mathOperator(strSign) {\n var newValue = Number(saveNumber);\n saveNumber = \"\";\n\n if (currentValue == 0) {\n currentValue = newValue;\n useOperator = strSign;\n } else if (useOperator == '')\n useOperator = strSign;\n else\n {\n if (useOperator == '+')\n currentValue = currentValue + newValue;\n else if (useOperator == '-')\n currentValue = currentValue - newValue;\n else if (useOperator == '*')\n currentValue = currentValue * newValue;\n else if (useOperator == '/') {\n if (newValue == 0)\n {\n alert('cannot divide by zero');\n clearCalc();\n }\n else\n currentValue = currentValue / newValue;\n } else if (useOperator == '=')\n useOperator = '';\n else\n useOperator = strSign;\n }\n currentValue = Math.round(currentValue * 10000) / 10000;\n document.getElementById(\"calcDisplay\").innerHTML = currentValue;\n}", "compute(){\n let computation\n //converting strings to number for computation\n const prev = parseFloat(this.previousOperand)\n const current = parseFloat(this.currentOperand)\n //to check if numbers were actually inputed before any computation\n if (isNaN(prev) || isNaN(current)) return\n switch (this.operation) {\n case '+' :\n computation = prev + current\n break\n case '-' :\n computation = prev - current\n break\n case '×' :\n computation = prev * current\n break\n case '÷' :\n computation = prev / current\n break\n default:\n return\n }\n this.toReset = true,\n this.currentOperand = computation\n this.operation = undefined\n this.previousOperand = ''\n }", "function renderCalculator() {\n var firstNumber = '';\n var secondNumber = '';\n var operator = '';\n var result = '';\n var isOperatorChosen = false;\n\n $('.number').on('click', function () {\n\n // check about opperator being picked yet.\n if (result !== '') {\n alert('You have already done an equation, please clear the Calculator');\n }\n else if (isOperatorChosen) {\n secondNumber += $(this).val();\n $('#second-number').text(secondNumber);\n\n }\n else {\n firstNumber += $(this).val();\n $('#first-number').text(firstNumber);\n }\n\n });\n\n $('.operator').on('click', function () {\n\n if (operator !== '') {\n\n }\n else if (firstNumber > 0) {\n\n operator = $(this).val();\n if (operator == 'plus') {\n $('#operator').text('+');\n }\n else if (operator == 'minus') {\n $('#operator').text('-');\n }\n else if (operator == 'times') {\n $('#operator').text('*');\n }\n else if (operator == 'divide') {\n $('#operator').text('\\xF7');\n }\n else if (operator == 'power') {\n $('#operator').text('^');\n }\n isOperatorChosen = true;\n }\n else {\n alert('Please insert a number before choosing operator');\n }\n });\n\n $('.equal').on('click', function () {\n\n if (secondNumber === '') {\n alert('equation can not be run without 2 numbers & an operator');\n }\n else {\n firstNumber = parseFloat(firstNumber);\n secondNumber = parseFloat(secondNumber);\n\n if (operator === 'plus') {\n\n result = firstNumber + secondNumber;\n }\n\n else if (operator === 'minus') {\n result = firstNumber - secondNumber;\n }\n\n else if (operator === 'times') {\n result = firstNumber * secondNumber;\n }\n\n else if (operator === 'divide') {\n result = firstNumber / secondNumber;\n }\n\n else if (operator === 'power') {\n result = Math.pow(firstNumber, secondNumber);\n }\n\n $('#result').text(result);\n }\n\n\n });\n\n $('.clear').on('click', function () {\n\n $('#first-number').empty();\n $('#operator').empty();\n $('#second-number').empty();\n $('#result').empty();\n firstNumber = '';\n secondNumber = '';\n operator = '';\n result = '';\n isOperatorChosen = false;\n })\n }", "function calculator (firstnumber, operator, secondnumber) {\n switch (operator) {\n case '+':\n return parseInt(firstnumber + secondnumber);\n break;\n case '-':\n return parseInt(firstnumber - secondnumber);\n break;\n case '*':\n return parseInt(firstnumber * secondnumber);\n break;\n case '/':\n if (secondnumber === 0) {\n return Infinity;\n break;\n } else {\n return parseInt(firstnumber / secondnumber);\n break;\n }\n default:\n console.log('Sorry, the arguments are not numbers');\n }\n}", "function calculator(number1, operator, number2) {\n switch (operator) {\n case \"+\": return number1 + number2;\n case \"-\": return number1 - number2;\n case \"*\": return number1 * number2;\n case \"/\":\n if (number2 == 0) return \"Can't divide by 0!\"\n return number1 / number2;\n }\n}", "function calcOperation (value) {\n if (!isSolved) {\n var co = value;\n switch (co) {\n case '+':\n setOutput('&#10;');\n setOutput(co);\n setOutput('\\t');\n operator = '+';\n tmpOperator = operator;\n isDirty = true;\n break;\n case '-':\n setOutput('&#10;');\n setOutput(co);\n setOutput('\\t');\n operator = '-';\n tmpOperator = operator;\n isDirty = true;\n break;\n case '*':\n setOutput('&#10;');\n setOutput(co);\n setOutput('\\t');\n operator = '*';\n tmpOperator = operator;\n isDirty = true;\n break;\n case '/':\n setOutput('&#10;');\n setOutput(co);\n setOutput('\\t');\n operator = '/';\n tmpOperator = operator;\n isDirty = true;\n break;\n case 'w':\n setOutput('&#10;');\n setOutput('&radic;');\n setOutput('\\t');\n operator = 'w';\n isDirty = true;\n break;\n case 'p2':\n setOutput('&#10;');\n setOutput('^ &sup2;');\n setOutput('\\t');\n operator = 'p2';\n isDirty = true;\n break;\n case 'pn':\n setOutput('&#10;');\n setOutput('^ \\t');\n operator = 'pn';\n isDirty = true;\n break;\n case 'pr':\n setOutput(' %');\n operator = 'pr';\n isDirty = true;\n break;\n default:\n setOutput(\"Bad Operation Input\");\n isDirty = false;\n }\n }\n }", "function fnNum(a){\r\n\t\tvar bClear = false;\r\n\t\toText.value = \"0\";\r\n\t\tfor(var i=0;i<aNum.length;i++){\r\n\t\t\taNum[i].onclick = function(){\r\n\r\n\t\t\t\t//check the switch\r\n\t\t\t\tif(!bOnOrOffClick) return;\r\n\r\n\t\t\t\t//check the clear \r\n\t\t\t\tif(bClear) {\r\n\t\t\t\t\tbClear = false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//check the dot exist\r\n\t\t\t\tif(oText.value.indexOf(\".\")!=-1){\r\n\t\t\t\t\tif(this.innerHTML ==\".\"){\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//check the operator and input value exist;\r\n\t\t\t\t//input a number and a operator\r\n\t\t\t\tif(oPer.value&&oText.value&&oText1.value ==\"\"){\r\n\t\t\t\t\toText1.value = oText.value;\r\n\t\t\t\t\toText.value = \"\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar re = /^0\\.{1}\\d+$/;\r\n\t\t\t\tvar re1 = /^([0]\\d+)$/;\r\n\r\n\t\t\t\t//input to display\r\n\t\t\t\toText.value +=this.innerHTML;\r\n\r\n\t\t\t\tif(re.test(oText.value)){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(re1.test(oText.value)){\r\n\t\t\t\t\toText.value = this.innerHTML;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//add the operator\r\n\t\t\tfor(var j=0;j<aPer.length;j++){\r\n\t\t\t\taPer[j].onclick = function(){\r\n\r\n\t\t\t\t\t//calulator\r\n\t\t\t\t\tif(oPer.value&&oText.value&&oText1.value){\r\n\t\t\t\t\t\tvar n = eval(oText1.value + oPer.value +oText.value);\r\n\t\t\t\t\t\toText1.value = n;\r\n\t\t\t\t\t\toText1.value = \"\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//display the result;\r\n\t\t\t\t\toPer.value = this.innerHTML;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//calculator get the result;\r\n\t\t\toDeng.onclick = function(){\r\n\t\t\t\t// add substract multiply divided percent\r\n\t\t\t\tif(oText1.value ==''&&oPer.value ==\"\"&&oText.value==\"\"){\r\n\t\t\t\t\treturn ;\r\n\t\t\t\t}\r\n\t\t\t\tvar n = eval(oText1.value + oPer.value + oText.value);\r\n\t\t\t\toText1.value = \"\";\r\n\t\t\t\toText.value = n;\r\n\t\t\t\toPer.value = \"\";\r\n\t\t\t\tbClear = true;\r\n\t\t\t}\r\n\r\n\t\t\t//the rec operation\r\n\t\t\toRec.onclick = function(){\r\n\t\t\t\tvar a = 1/oText.value;\r\n\t\t\t\tif(a==0){\r\n\t\t\t\t\toText1.value = \"无穷大\";\r\n\t\t\t\t}\r\n\t\t\t\toText.value = a;\r\n\t\t\t}\r\n\r\n\t\t\t//sqiuare\r\n\t\t\toSq.onclick = function(){\r\n\t\t\t\tvar a = Math.pow(oText.value,0.5);\r\n\t\t\t\toText.value = a;\r\n\t\t\t}\r\n\r\n\t\t\toZheng.onclick = function(){\r\n\t\t\t\t\toText.value = -oText.value;\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t\toClea.onclick = function(){\r\n\t\t\t\toText.value = \"0\";\r\n\t\t\t\toText1.value = \"\";\r\n\t\t\t\toPer.value = \"\";\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function doMath(num1 ,num2 , operator) {\n if (num2 == null) {\n if(totalInt2 == null){\n totalInt2 = parseFloat(num1);\n }\n num2 = totalInt2;\n storeNum2 = parseFloat(num2);\n\n }\n if (operator == \"+\") {\n num1 = parseFloat(num1) + parseFloat(num2);\n }\n else if (operator == \"-\") {\n num1 = parseFloat(num1) - parseFloat(num2);\n }\n else if (operator == \"/\") {\n if(num2 == 0){\n $(\"#displayScreen p\").text(\"Error\");\n totalInt2 = null;\n return;\n }\n num1 = parseFloat(num1) / parseFloat(num2);\n }\n else if (operator == \"X\") {\n num1 = parseFloat(num1) * parseFloat(num2);\n }\n return num1.toFixed(3);\n}", "function doCalculatorOperation() {\n input = document.getElementById(\"calcOutput\").value\n\n iLength = input.length\n currentIndex = 0;\n console.log(input)\n\n cnum1 = \"\";\n cnum2 = \"\";\n\n operation = \"none\"\n\n // Loop through, collect first number\n for (i = 0; i < iLength; i++) {\n if (input[i] === \"-\") {\n // Subtraction Operation Detected\n operation = 0\n currentIndex = i + 1\n break\n } else if (input[i] === \"+\") {\n // Addition Opeation Detected\n operation = 1\n currentIndex = i + 1\n break\n } else if (input[i] === \"/\") {\n // Division Operation Detected\n operation = 2\n currentIndex = i + 1\n break\n } else if (input[i] === \"*\") {\n // Multiplication operation detected\n operation = 3\n currentIndex = i + 1\n break\n }\n cnum1 = cnum1 + input[i]\n }\n\n // Loop through collect second number\n for (z = currentIndex; z < iLength; z++ ) {\n cnum2 = cnum2 + input[z]\n }\n\n if (operation == 0) {\n // Perform subtraction\n num1 = parseInt(cnum1)\n num2 = parseInt(cnum2)\n final = num1 - num2\n document.getElementById(\"calcOutput\").value = final\n } else if (operation == 1) {\n num1 = parseInt(cnum1)\n num2 = parseInt(cnum2)\n final = num1 + num2\n document.getElementById(\"calcOutput\").value = final\n } else if (operation == 2) {\n num1 = parseInt(cnum1)\n num2 = parseInt(cnum2)\n final = num1 / num2\n document.getElementById(\"calcOutput\").value = final\n } else if (operation == 3) {\n num1 = parseInt(cnum1)\n num2 = parseInt(cnum2)\n final = num1 * num2\n document.getElementById(\"calcOutput\").value = final\n } else {\n alert(\"Incorrect Operation\")\n }\n}", "compute() {\n let result;\n let lastnum = parseFloat(this.lastOperand);\n let currnum = parseFloat(this.currOperand);\n if (isNaN(lastnum) || isNaN(currnum)) {\n return;\n }\n switch (this.operator) {\n case \"+\":\n result = lastnum + currnum;\n break;\n case \"-\":\n result = lastnum - currnum;\n break;\n case \"*\":\n result = lastnum * currnum;\n break;\n case \"/\":\n result = lastnum / currnum;\n break;\n default:\n return;\n }\n this.currOperand = result;\n this.lastOperand = \"\";\n this.operator = undefined;\n }", "function calculator(number1, number2, operator) {\n switch (operator) {\n case \"+\":\n value = number1 + number2;\n break;\n case \"-\":\n value = number1 - number2;\n break;\n case \"*\":\n value = number1 * number2;\n break;\n case \"/\":\n value = number1 / number2;\n break;\n case \"%\":\n value = number1 % number2;\n }\n return `${number1} ${operator} ${number2} = ${value}.`; //return result\n}", "function populate_input(button) {\n\n // 1. Get value of button\n let button_val = button.innerText;\n\n // 2. Display this value in the input, if it is a number or operand\n let input = document.querySelector('#input_text');\n\n\n // CALCULATING VALUE -----\n // 1. If value is 'C', clear calculator & the variables\n if (button_val == 'C') {\n input_one = undefined;\n input_two = undefined;\n operator = undefined;\n decimal = 1;\n decimal_flag = false;\n input.innerText = '';\n\n // 2. Premature '=': don't do anything\n } else if ((input_one == undefined || input_two == undefined)\n && (button_val == \"=\")) {\n\n // 3. Decimal (only one)\n } else if (button_val == \".\") {\n\n if (input.innerText.includes(\".\")) {\n return;\n\n } else {\n if (isNaN(input.innerText)) {\n input.innerText = \".\";\n } else {\n input.innerText = input.innerText + \".\";\n }\n decimal_flag = true;\n }\n\n // 4. If input_one is undefined, set input_one variable\n } else if ((input_one == undefined) && (!isNaN(button_val))) {\n input_one = (button_val * decimal);\n input.innerText = parseFloat(input_one.toFixed(6));\n\n // 5. If input_one is defined but nothing else, add more numbers\n } else if ((input_one !== undefined) && (input_two == undefined) &&\n (operand == undefined) && (!isNaN(button_val))) {\n input_one = input_one + (button_val * decimal);\n input.innerText = input.innerText + button_val;\n\n // 6. If input_one is defined and user clicks on a non-value, set operand\n // equal to the value\n } else if ((input_one !== undefined) && (input_two == undefined) &&\n (isNaN(button_val))) {\n operand = button_val;\n input.innerText = operand;\n\n // Reset decimals\n decimal_flag = false;\n decimal = 1;\n\n // 7. If input_two is defined, operand is defined and user clicks on a value,\n // set value of input_two\n } else if ((input_one !== undefined) && (operand !== undefined) &&\n (input_two == undefined) && (!isNaN(button_val))) {\n input_two = button_val * decimal;\n input.innerText = parseFloat(input_two.toFixed(6));\n\n // 8. If input_two is defined but nothing else, add more numbers\n } else if ((input_one !== undefined) && (input_two !== undefined) &&\n (operand !== undefined) && (!isNaN(button_val))) {\n input_two = input_two + (button_val * decimal);\n input.innerText = input.innerText + button_val;\n }\n\n // If all of them are defined, calculate\n if ((input_one !== undefined) && (input_two !== undefined) &&\n (operand !== undefined) && button_val == \"=\") {\n let result = operate(operand, parseFloat(input_one),\n parseFloat(input_two));\n\n // Trim super long integers\n if ((String(result).replace(/[^0-9]/g,\"\").length >= 9) &&\n (Math.abs(result) >= 1)) {\n result = result.toExponential();\n\n } else if ((String(result).replace(/[^0-9]/g,\"\").length >= 9) &&\n (Math.abs(result) <= 1)) {\n result = parseFloat(result.toFixed(6));\n }\n\n input.innerText = result;\n\n // Edgecase: division by 0\n if (String(result).includes(\"error\")) {\n input_one = undefined;\n input_two = undefined;\n operand = undefined;\n\n // Reset: set result = input_one, reset other variables\n } else {\n input_one = result;\n input_two = undefined;\n operand = undefined;\n }\n }\n\n // Decimal Reset\n if (decimal_flag) {\n decimal = decimal * (1/10);\n }\n}", "function calculator(num1, num2) {\n function sum() {\n return num1 + num2;\n }\n function sub() {\n return num1 - num2;\n }\n function div() {\n return num1 / num2;\n }\n function mul() {\n return num1 * num2;\n }\n return { sum, sub, div, mul };\n}", "function buttonClick(e) {\n\n // calcValue variable will have the value attribute of the calcWindow text area box\n var calcValue = document.getElementById(\"calcWindow\").value;\n\n // calcDecimal variable will have the value attribute of the decimals input box \n var calcDecimal = document.getElementById(\"decimals\").value;\n\n // buttonValue variable will have the value attribute of the event object target \n var buttonValue = e.target.value; \n\n // switch-case structure for the possible values of the buttonValue variable \n switch (buttonValue) {\n case \"del\":\n // delete the contents of the calculate window by changing calcValue to an empty string\n calcValue = \"\";\n break;\n case \"bksp\":\n // erase the last character in the calculator window by changing calcValue to the \n // value return by the eraseChar() function using calcValue as the parameter \n calcValue = eraseChar(calcValue);\n break;\n case \"enter\":\n // calculate the value of the current expression by changing calcValue to...\n calcValue += \" = \" + evalEq(calcValue, calcDecimal) + \"\\n\";\n break;\n case \"prev\":\n // copy the last equation in the calculator window by changing calcValue \n // to the value returned by the lastEq() function using calcValue as a parameter\n calcValue = lastEq(calcValue);\n break;\n default:\n // otherwise, append the calculator button character to the calculator window by \n // letting calcValue equal calcValue plus buttonValue\n calcValue = calcValue + buttonValue;\n }\n\n // set the value attribute of the calcWindow text area box to calcValue\n document.getElementById(\"calcWindow\").value = calcValue;\n\n // run this command to put cursor focus within the calculator window\n document.getElementById(\"calcWindow\").focus();\n}", "calculate(){\n // divide\n if(this.state.type === \"/\"){\n this.setState(prevState => {\n let result = Number(prevState.firstNum) / Number(prevState.secondNum)\n if(isNaN(result)) return {secondNum: \"\"};\n return {output: `${prevState.firstNum} ${prevState.type} ${prevState.secondNum}`, firstNum: result, secondNum: \"\", type: \"\"}\n })\n }\n // multiply\n if(this.state.type === \"X\"){\n this.setState(prevState => {\n let result = Number(prevState.firstNum) * Number(prevState.secondNum)\n if(isNaN(result)) return {secondNum: \"\"};\n return {output: `${prevState.firstNum} ${prevState.type} ${prevState.secondNum}`, firstNum: result, secondNum: \"\", type: \"\"}\n })\n }\n // subtract\n if(this.state.type === \"-\"){\n this.setState(prevState => {\n let result = Number(prevState.firstNum) - Number(prevState.secondNum)\n if(isNaN(result)) return {secondNum: \"\"};\n return {output: `${prevState.firstNum} ${prevState.type} ${prevState.secondNum}`, firstNum: result, secondNum: \"\", type: \"\"}\n })\n }\n // add\n if(this.state.type === \"+\"){\n this.setState(prevState => {\n let result = Number(prevState.firstNum) + Number(prevState.secondNum)\n if(isNaN(result)) return {secondNum: \"\"};\n return {output: `${prevState.firstNum} ${prevState.type} ${prevState.secondNum}`, firstNum: result, secondNum: \"\", type: \"\"}\n })\n }\n // if no operator selected when \"= is pressed\" it just copies the input text to the output \n if(this.state.type === \"\") this.setState(prevState => ({output: `${prevState.firstNum} ${prevState.type} ${prevState.secondNum}`}))\n }", "function calcular(){\n // recuperando valores pelo DOM do HTML\n var operacao = document.getElementById('operacao').value \n var num1 = document.getElementById('num1').value\n var num2 = document.getElementById('num2').value\n\n // consistencias \n if(num1 == '' || num1 == null){\n alert('Favor digitar um número válido!')\n document.getElementById('num1').focus()\n return false\n }\n\n if(num2 == '' || num2 == null){\n alert('Favor digitar um número válido!')\n document.getElementById('num2').focus()\n return false\n }\n\n // converter conteúdo string para number\n num1 = Number(num1)\n num2 = Number(num2)\n var resultado = null\n\n if(operacao == '1'){ //soma\n resultado = num1 + num2\n } else if(operacao == '2'){ //subtração\n resultado = num1 - num2\n } else if(operacao == '3'){ // multiplicação\n resultado = num1 * num2\n } else if(operacao == '4'){ // divisão\n resultado = num1 / num2\n } else {\n alert('Selecione uma operação')\n document.getElementById('operacao').focus()\n return false\n }\n\n document.getElementById('resultado').value = resultado\n\n}", "function pressEqual(){\n getNum();\n switch(calc[1]){\n case ('+'):\n result = add(calc[0],calc[2]);\n break;\n case('-'):\n result = subtract(calc[0],calc[2]);\n break;\n case('x'):\n result = multiply(calc[0],calc[2]);\n break;\n case('÷'):\n result = divide(calc[0],calc[2]);\n break;\n default:\n result = calc[2];\n break;\n }\n calc = [];\n numbers.push(result);\n console.log(result);\n console.log(calc);\n var display = $('.display');\n display.text(result);\n}", "function operation(operator) {\n\n document.getElementById('oper').innerHTML = operator;\n console.log(previousVal);\n if (opt == '+') { var reducer = (previousVal, displayVal) => previousVal + displayVal; }\n else if (opt == '-') { var reducer = (previousVal, displayVal) => previousVal - displayVal; }\n else if (opt == '*') { var reducer = (previousVal, displayVal) => previousVal * displayVal; }\n else if (opt == '/') { var reducer = (previousVal, displayVal) => previousVal / displayVal; }\n else if (opt == '=') { var reducer = (previousVal, displayVal) => previousVal + \" \"; }\n result = reducer((+previousVal), (+displayVal));\n document.getElementById('result').value = result;\n previousVal = result;\n opt = operator;\n displayVal = \" \";\n}", "function calculator() {\n var nums = Array.from(arguments);\n\n switch (nums.shift()) {\n case 'sum':\n return nums.reduce((total, item) => total + item);\n case 'subtract':\n return nums.reduce((total, item) => total - item);\n case 'multiply':\n return nums.reduce((total, item) => total * item);\n case 'divide':\n return nums.reduce((total, item) => total / item, 1);\n }\n}", "function onOperatorButtonClicked(value)\n {\n //Current value doesn't equal zero and we can do stuff with it\n if(!runningTotal == 0){\n\n switch(value){\n case \"+\":\n //Set operator to clicked button\n currentOperator = \"+\";\n //Set operator press to true\n hasPressedOperator = true;\n //Update the display to reflect the change\n updateDisplay();\n break;\n case \"-\":\n //Set operator to clicked button\n currentOperator = \"-\";\n //Set operator press to true\n hasPressedOperator = true;\n //Update the display to reflect the change\n updateDisplay();\n break;\n case \"x\":\n //Set operator to clicked button\n currentOperator = \"*\";\n //Set operator press to true\n hasPressedOperator = true;\n //Update the display to reflect the change\n updateDisplay();\n break;\n case \"/\":\n //Set operator to clicked button\n currentOperator = \"/\";\n //Set operator press to true\n hasPressedOperator = true;\n //Update the display to reflect the change\n updateDisplay();\n break;\n case \"=\":\n //Check for a number and operator \n if(hasPressedOperand && hasPressedOperator){ \n //Set it so that we know they have just pressed the equals symbol\n hasPressedEquals = true;\n\n //Check currentOperator\n if(currentOperator == \"+\"){\n runningTotal += parseInt(currentOperand);\n //Reset the variables used\n hasPressedOperand = false;\n hasPressedOperator = false;\n currentOperand = 0;\n currentOperator = \"\";\n updateDisplay();\n } else if (currentOperator == \"-\"){\n runningTotal -= parseInt(currentOperand);\n //Reset the variables used\n hasPressedOperand = false;\n hasPressedOperator = false;\n currentOperand = 0;\n currentOperator = \"\";\n updateDisplay();\n } else if (currentOperator == \"*\"){\n runningTotal *= parseInt(currentOperand);\n //Reset the variables used\n hasPressedOperand = false;\n hasPressedOperator = false;\n currentOperand = 0;\n currentOperator = \"\";\n updateDisplay();\n } else if (currentOperator == \"/\"){\n runningTotal /= parseInt(currentOperand);\n //Reset the variables used\n hasPressedOperand = false;\n hasPressedOperator = false;\n currentOperand = 0;\n currentOperator = \"\";\n updateDisplay();\n } else {\n // runningTotal /= parseInt(currentOperand);\n }\n } else {\n\n }\n // -------\n }\n }\n }", "function resolver() {\n var calculo;\n var op1 = parseFloat(num1);\n var op2 = parseFloat(num2);\n if (operacion === \"+\") {\n calculo = op1 + op2;\n } else if (operacion === \"-\") {\n calculo = op1 - op2;\n } else if (operacion === \"/\") {\n calculo = op1 / op2;\n if (op2 === 0) {\n calculo = \"Error\";\n }\n } else if (operacion === \"*\") {\n calculo = op1 * op2;\n }\n mostrarResultado(calculo);\n operacion = \" \";\n num1 = 0;\n num2 = 0;\n}", "calc() {\n\n let last = '';\n\n this._lastOperator = this.getLastItem(true); //verifica o ultimo operador\n //a variavel e menor que tres elementos \n if (this._operation.length < 3) {\n let firstItem = this._operation[0]; //primeiro item do array e 0\n this._operation = [firstItem, this._lastOperator, this._lastNumber]; //o array fica o primeiro, o ultimo operador e o numero\n }\n //tira o ultimo se for maior que 3 itens\n if (this._operation.length > 3) {\n last = this._operation.pop();\n this._lastNumber = this.getResult();\n } else if (this._operation.length == 3) {\n this._lastNumber = this.getLastItem(false);\n }\n\n let result = this.getResult();\n\n if (last == '%') {\n result /= 100;\n this._operation = [result];\n } else {\n this._operation = [result];\n //se for diferente de vazio\n if (last) this._operation.push(last);\n }\n\n this.setLastNumberToDisplay();\n\n }", "function calculator(operator) {\n var a=parseInt(document.getElementById(\"op-one\").value);\n var b=parseInt(document.getElementById(\"op-two\").value);\n switch (operator){\n case \"+\":\n alert(a + b);\n break;\n case \"-\":\n alert(a - b);\n break;\n case \"*\":\n alert(a * b);\n break;\n case \"/\":\n alert(a / b);\n break;\n }\n\n}", "function result(){\n\tif(operation == \"add\"){\n\t\tcurrent = eval(previous) + eval(current);\n\t}\n\tif(operation == \"sub\"){\n\t\tcurrent = eval(previous) - eval(current);\n\t}\n\tif(operation == \"div\"){\n\t\tcurrent = eval(previous) / eval(current);\n\t}\n\tif(operation == \"mult\"){\n\t\tcurrent = eval(previous) * eval(current);\n\t}\n\tif(operation == \"mod\"){\n\t\tcurrent = eval(previous) % eval(current);\n\t}\n\tif(operation == \"poy\"){\n\t\tcurrent = Math.pow(eval(previous), eval(current));\n\t}\n\tif(operation == \"exp\"){\n\t\tcurrent = eval(previous) * Math.pow(10, eval(current));\n\t}\n\tif(operation == \"yrootx\"){\n\t\tcurrent = Math.pow(eval(previous), 1/eval(current));\n\t}\n\tdocument.getElementById('screen').value = current;\n\tprevious = \"\";\n\toperation = \"\";\n}", "function calT(a, b, op) {\n\n var result;\n \n if (op == \"+\") {\n \n result = a + b;\n \n alert(result);\n }\n \n else if (op == \"-\") {\n \n result = a - b;\n \n alert(result);\n \n }\n \n else if(op == \"*\") {\n \n result = a * b;\n \n alert(result);\n }\n \n else if(op == \"/\"){\n \n result = a / b;\n \n alert(result);\n }\n \n \n }", "function runCalculator() {\n var buttons = $('#1, #2, #3, #4, #5, #6, #7, #8, #9, #0, #dot').val();\n var operator = $('.operator').val();\n console.log(buttons);\n\n $(buttons).each(function(i, v) {\n\n if ($('#calculate')){\n displayResult(calResult);\n } else if ($('#clear')) {\n clear();\n } else {\n addValue(i);\n }\n\n console.log(i);\n });\n\n\n\n var calResult = calculate(buttons, operator, buttons);\n\n // console.log(calResult);\n\n }", "function calculate(num1,num2,operator){\r\n if(operator==\"+\"){\r\n cal=num1+num2\r\n operator=\"Addition\"\r\n return \"The \"+operator+\" Of \"+num1+\" and \"+num2+\" is : \"+cal\r\n \r\n }\r\n else if(operator==\"-\"){\r\n cal=num1-num2\r\n operator=\"Subtraction\"\r\n return \"The \"+operator+\" Of \"+num1+\" and \"+num2+\" is : \"+cal\r\n \r\n }\r\n else if(operator==\"*\"){\r\n cal=num1*num2\r\n operator=\"Multiplication\"\r\n return \"The \"+operator+\" Of \"+num1+\" x \"+num2+\" is : \"+cal\r\n \r\n }\r\n else if(operator==\"/\"){\r\n cal=num1/num2\r\n operator=\"Divison\"\r\n return \"The \"+operator+\" Of \"+num1+\" and \"+num2+\" is : \"+cal\r\n \r\n }\r\n else if(operator==\"%\"){\r\n cal=num1%num2\r\n operator=\"Modulus Division \"\r\n return \"The \"+operator+\" Of \"+num1+\" and \"+num2+\" is : \"+cal\r\n \r\n }\r\n else{\r\n \r\n return \"Please Select Correct Operator\"\r\n \r\n }\r\n \r\n }", "function calculation(e) {\r\n // Default char variable for keyboard input.\r\n let char = e.key;\r\n\r\n // If event fired from mouse then char value change based on DOM element value;\r\n // and fire the native keyboard events excep memory operation\r\n // Memory operation only available via DOM events.\r\n if (e.type == \"click\") {\r\n switch (e.target.textContent) {\r\n case \"÷\":\r\n char = \"/\";\r\n break;\r\n case \"×\":\r\n char = \"*\";\r\n break;\r\n case \"«\":\r\n char = \"Backspace\";\r\n break;\r\n case \"00\":\r\n char = \"00\";\r\n break;\r\n case \"c\":\r\n input = \"\";\r\n output = \"\";\r\n break;\r\n case \"=\":\r\n char = \"Enter\";\r\n break;\r\n case \"m+\":\r\n handleMemory(\"plus\");\r\n break;\r\n case \"m-\":\r\n handleMemory(\"substract\");\r\n break;\r\n case \"mr\":\r\n handleMemory(\"read\");\r\n break;\r\n case \"mc\":\r\n handleMemory(\"clear\");\r\n break;\r\n default:\r\n char = e.target.textContent;\r\n }\r\n }\r\n\r\n // Checking and validating input output variable, input max lenght 32 chars\r\n if (input.length <= 32) {\r\n if (operands.includes(char)) {\r\n input += char;\r\n output = evalInput(input);\r\n } else if (char in operators) {\r\n input += operators[char];\r\n } else if (char == \"=\" || char == \"Enter\") {\r\n input = handleSubmit(input, output);\r\n output = \"\";\r\n } else if (char == \"Backspace\") {\r\n input = handleDelete(input);\r\n output = evalInput(input);\r\n }\r\n } else {\r\n input = handleDelete(input);\r\n }\r\n\r\n // DOM display update with input output memory variable\r\n let inputDisplay = document.querySelector(\".calc-dis-in\");\r\n let outputDisplay = document.querySelector(\".calc-dis-out\");\r\n let memoryIndicator = document.querySelector(\".calc-dis-mi\");\r\n let memoryDisplay = document.querySelector(\".calc-dis-mo\");\r\n inputDisplay.innerHTML = input;\r\n outputDisplay.innerHTML = output;\r\n if (hasMemory) {\r\n memoryIndicator.innerHTML = \"M\";\r\n memoryDisplay.innerHTML = memory;\r\n } else {\r\n memoryIndicator.innerHTML = \"\";\r\n memoryDisplay.innerHTML = \"\";\r\n }\r\n}", "function operate(operator, num1,num2){\n num1 = parseFloat(num1)\n num2 = parseFloat(num2)\n switch(operator){\n case '*':\n return multiply(num1,num2);\n break;\n \n case '-':\n return minus(num1,num2);\n break;\n\n case '/':\n return divide(num1,num2);\n break;\n\n case '+':\n return add(num1,num2);\n break;\n }\n}", "function mathCalc(sym) {\n switch (sym) {\n case '+':\n // Calculates num1 [operand] num2, stores that value \n // in num1 and displays it, clears num2 for use in future calculations\n num1 = Number(num1) + Number(num2);\n num2 = '';\n return num1;\n case '-':\n num1 = Number(num1) - Number(num2);\n num2 = '';\n return num1;\n case '/':\n num1 = Number(num1) / Number(num2);\n num2 = '';\n return num1;\n case '*':\n num1 = Number(num1) * Number(num2);\n num2 = '';\n return num1;\n }\n}", "function calculate(screen)\n{\n\tvar currentValue = parseFloat(screen.text);\n\tvar answer = 0;\n\t\n\tif (operation == \"+\") \n\t\tanswer = lastValue + currentValue;\n\telse if (operation == \"-\") \n\t\tanswer = lastValue - currentValue;\n\telse if (operation == \"/\") \n\t\tanswer = lastValue / currentValue;\n\telse if (operation == \"*\") \n\t\tanswer = lastValue * currentValue;\n\t\t\n\tscreen.text = answer.toString();\n}", "function calc(value) {\n if (\n value !== \"+\" &&\n value !== \"-\" &&\n value !== \"*\" &&\n value !== \"/\" &&\n value !== \"=\" &&\n value !== \"clear\"\n ) {\n numero(value);\n } else if (\n total !== undefined &&\n (value == \"+\" ||\n value == \"-\" ||\n value == \"*\" ||\n value == \"/\") &&\n (value !== \"=\" && value !== \"clear\")\n ) {\n simbolo(value);\n } else if (value == \"=\" && total !== undefined) {\n igual(value);\n }\n //If 'value' doesn't meet any above conditions and it's 'value' is 'clear', then clean the screen;\n if (value == \"clear\") {\n $results.html(\"<p>0</p>\").css({ \"font-size\": \"1.5em\" });\n $processed.html(\"<p></p>\").css({ \"font-size\": \"1.2em\" });\n total = 0;\n }\n }", "function calcResult() {\n \n /* This conditional deals with cases where there is no operation to perform.\n * Notice that if 1st operand is stored an operation was already chosen and 2nd operand is at least 0 by default\n * And that if NaN flag is found, the user has just pressed the operation button and there's no 2nd operand \n * The function is just left, but operands and currentOperation remain stored, allowing calculation to continue */ \n if (numbers[0] === \"\" || Number.isNaN(currentNumber)) {\n return;\n }\n\n //2nd operand is stored in numbers\n assignPosition(currentNumber);\n \n //Operands are removed and result is added in numbers by calling the execution of currentOperation\n numbers = [\"\", \"\", currentOperation()];\n\n displayResult();\n\n}", "function operation(number1, number2, operator) {\n\n\n\n let res // result container\n // basic math operation\n switch(operator){\n case '+':\n res = parseFloat(number1) + parseFloat(number2)\n break\n case '-':\n res = parseFloat(number1) - parseFloat(number2)\n break\n case '/':\n res = parseFloat(number1) / parseFloat(number2)\n break\n case '*':\n res = parseFloat(number1) * parseFloat(number2)\n break\n default:\n return 0\n }\n\n // some scientific calculation\n\n\n return res\n}", "function calculate() {\n // alert user if they are attempting to make a calculation without any operands\n if (!firstNumber) {\n alert(\"No input given\");\n }\n\n secondNumber = parseFloat(output.textContent);\n operate(operator, firstNumber, secondNumber);\n operatorUsed = false;\n}", "function calculate() {\r\n if (operator) {\r\n if (!result) return; //To prevent errors when there's no operand\r\n nextVal = result;\r\n result = calculation();\r\n prevVal = result;\r\n } else if(result){\r\n prevVal = result;\r\n }\r\n displayResult();\r\n result = ''; //To empty the display for new operand\r\n}", "function handleSymbol(symbol){\n// if(symbol === 'C') {\n// buffer = '0';\n// runningTotal = 0;\n// }instead of doing a bunch of if-else statements for buttons, do switch as below for each case-with break after each switch case\n switch (symbol) {\n case 'C':\n buffer = '0';\n runningTotal = 0;\n break; \n case '=':\n if (previousOperator === null) {\n //so above is user hasn't entered anything yet - so screen is null\n //you need two numbers to do math\n return;\n }\n flushOperation(parseInt(buffer)); //this does the math part of equal\n previousOperator = null; //clear the button out after\n buffer = runningTotal;\n runningTotal = 0; //after math is done reassign to zero\n break;\n case '←': //tip copy and paste symbols from the DOM\n if(buffer.length === 1){ //backspace 1 character\n buffer = '0';\n }else {\n buffer = buffer.substring(0, buffer.length - 1); //-1 is stop 1 short of going all the way to the end\n }\n break;\n case '+': //note these need to be the signs not the &plus that is in the html\n case '−':\n case '×':\n case '÷':\n handleMath(symbol);\n break;\n }\n}", "function Calculate() {\r\n if(lastOperation === '/') {\r\n result = parseFloat(result) / parseFloat(current);\r\n }else if(lastOperation === 'x') {\r\n result = parseFloat(result) * parseFloat(current);\r\n }else if (lastOperation === '-') {\r\n result = parseFloat(result) - parseFloat(current);\r\n }else if (lastOperation === '+') {\r\n result = parseFloat(result) + parseFloat(current);\r\n }else if (lastOperation === '%') {\r\n result = parseFloat(result) % parseFloat(current);\r\n }\r\n}" ]
[ "0.79579", "0.79144764", "0.7734643", "0.7706488", "0.76287186", "0.75894624", "0.7580908", "0.75727016", "0.7569012", "0.7554074", "0.7547628", "0.7543969", "0.753799", "0.7525766", "0.7469643", "0.74664235", "0.74541664", "0.7437918", "0.7416802", "0.7410551", "0.7402005", "0.737695", "0.7370737", "0.73703945", "0.7366252", "0.7365181", "0.7360245", "0.73599917", "0.7356534", "0.73534864", "0.7349107", "0.7347727", "0.7347373", "0.7346487", "0.7345026", "0.73439735", "0.73411685", "0.7340965", "0.7332352", "0.7325096", "0.73146987", "0.72971123", "0.7297011", "0.72968954", "0.7296097", "0.72946286", "0.72751033", "0.7273014", "0.72720045", "0.7267477", "0.7266126", "0.7262132", "0.72534955", "0.7240905", "0.7240067", "0.72376096", "0.72358704", "0.72330654", "0.7224925", "0.7220557", "0.7215456", "0.7214302", "0.72131205", "0.72059894", "0.72013766", "0.72005594", "0.71996796", "0.7196016", "0.7193106", "0.7192417", "0.7179633", "0.7178771", "0.71777356", "0.71738195", "0.7171326", "0.7170273", "0.7165751", "0.71645385", "0.7156321", "0.71416897", "0.71412534", "0.71408975", "0.7139061", "0.71381766", "0.7135918", "0.71339405", "0.71329343", "0.7129289", "0.71074957", "0.70839846", "0.7082928", "0.70768744", "0.7067429", "0.70622414", "0.70556366", "0.7051431", "0.7048261", "0.7045066", "0.7043342", "0.7040161", "0.70373297" ]
0.0
-1
http headers are case insentive so make sure key comparison is lowercase http header values still checked for case sensitivity
function headerPropMatcher(value, other) { return function () { if (typeof value === "undefined") return true; return Object.keys(value).every(function (key) { return value[key] === other[key.toLowerCase()]; }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function normalizeHeaders(headers) {\n var h = {};\n for(var key in headers) {\n h[key.toLowerCase()] = headers[key];\n }\n return h;\n }", "function normalizeHeaders(headers) {\n var h = {};\n for(var key in headers) {\n h[key.toLowerCase()] = headers[key];\n }\n return h;\n }", "function getHeaderKey(headerName) {\n return headerName.toLowerCase();\n}", "function getHeaderKey(headerName) {\n return headerName.toLowerCase();\n}", "function getHeaderKey(headerName) {\n return headerName.toLowerCase();\n}", "getHeader(key) {\n return key ? this.headers[key.toLowerCase()] : null;\n }", "_hasHeader( key ) {\n key = String( key || '' ).replace( /[^\\w\\-]+/g, '' ).toLowerCase();\n return ( Object.keys( this._headers ).indexOf( key ) !== -1 );\n }", "function getHeaderKey(headerName) {\n return headerName.toLowerCase();\n }", "function getHeaderValue(mHeaders, sKey) {\r\n var sCurrentKey, sLowerCaseKey = sKey.toLowerCase();\r\n for (sCurrentKey in mHeaders) {\r\n if (mHeaders.hasOwnProperty(sCurrentKey) && sCurrentKey.toLowerCase() === sLowerCaseKey) {\r\n return mHeaders[sCurrentKey];\r\n }\r\n }\r\n return null;\r\n }", "rawHeaders() {\n return this.toJson({ preserveCase: true });\n }", "rawHeaders() {\n return this.toJson({ preserveCase: true });\n }", "rawHeaders() {\n return this.toJson({ preserveCase: true });\n }", "function normalizeHeader(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n return key;\n}", "function normalizeHeader(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n return key;\n}", "function normalizeHeader(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n return key;\n}", "function normalizeHeader(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n return key;\n}", "function normalizeHeader(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n return key;\n}", "function normalizeHeader(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n return key;\n}", "function normalizeHeader(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n return key;\n}", "_setHeader( key, value ) {\n key = String( key || '' ).replace( /[^\\w\\-]+/g, '' ).toLowerCase();\n value = String( value || '' ).trim();\n if ( key ) this._headers[ key ] = value;\n }", "function normalizeHeader_(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum_(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit_(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n return key;\n}", "function normalizeHeader(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n return key;\n}", "function normalizeHeader(header) {\n var key = \"\";\n var upperCase = false;\n for (var i = 0; i < header.length; ++i) {\n var letter = header[i];\n if (letter == \" \" && key.length > 0) {\n upperCase = true;\n continue;\n }\n if (!isAlnum(letter)) {\n continue;\n }\n if (key.length == 0 && isDigit(letter)) {\n continue; // first character must be a letter\n }\n if (upperCase) {\n upperCase = false;\n key += letter.toUpperCase();\n } else {\n key += letter.toLowerCase();\n }\n }\n if (key === \"\") {\n// for (var i=0, a=0; i<header.length; i++) a += header.charCodeAt(i);\n// key = \"_\" + a;\n for (var i=0, a=\"_\"; i<header.length; i++) a += header.charCodeAt(i);\n key = a;\n }\n return key;\n}", "has(name) {\n this.init();\n return this.headers.has(name.toLowerCase());\n }", "hasHeader(key) {\n if (key in this.headers) {\n return true;\n }\n return false;\n }", "function getHeader(headers, key) {\n for (var i = 0; i < headers.length; i++) {\n if (headers[i].name.toLowerCase() === key.toLowerCase()) {\n return headers[i].value;\n }\n }\n return null;\n}", "function caseInsensitiveCompare(str1, str2) {\n // code here\n}", "setHeader(key, value) {\n if (key) {\n this.headers[key.toLowerCase()] = value ? value : \"\";\n }\n return this;\n }", "function caseInsensitiveStringCompare(str1, str2) {\r\n // your code here\r\n if (str1.toLowerCase() == str2.toLowerCase()) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "function checkHeaderMatch (argument) {\n return ex_obj.header.indexOf(argument);\n }", "function getHeader(headers, name) {\n if (Ember.isNone(headers) || Ember.isNone(name)) {\n return undefined;\n }\n const matchedKey = Ember.A(Object.keys(headers)).find(key => {\n return key.toLowerCase() === name.toLowerCase();\n });\n return matchedKey ? headers[matchedKey] : undefined;\n }", "function normalizeHeaderName(headerName) {\n headerName = headerName.toLowerCase();\n\n if (headerName in irregularHeaderNames)\n return irregularHeaderNames[headerName];\n\n return headerName.replace(/(^|-)([a-z])/g, function (match, dash, letter) {\n return dash + letter.toUpperCase();\n });\n}", "function checkHeadersRequest(headersReq,json_obj){\r\n\t\t\t\tfor(j=0; j<Reqlength;j++){\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(headersReq.headers[j].name.toLowerCase() === \"content-type\"){\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tjson_obj.push(headersReq.headers[j]);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(headersReq.headers[j].name.toLowerCase() === \"cache-control\"){\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tjson_obj.push(headersReq.headers[j]);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(headersReq.headers[j].name.toLowerCase() === \"pragma\"){\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tjson_obj.push(headersReq.headers[j]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if(headersReq.headers[j].name.toLowerCase() === \"host\"){\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tjson_obj.push(headersReq.headers[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\t\t\t}", "isCaseInsensitive() {\n return !!this._options['case-insensitive'];\n }", "has(name) {\n this.init();\n return this.headers.has(name.toLowerCase());\n }", "has(name) {\n this.init();\n return this.headers.has(name.toLowerCase());\n }", "has(name) {\n this.init();\n return this.headers.has(name.toLowerCase());\n }", "has(name) {\n this.init();\n return this.headers.has(name.toLowerCase());\n }", "has(name) {\n this.init();\n return this.headers.has(name.toLowerCase());\n }", "function lowcaseKeys(h) {\n return _.transform(h, function(result, v, k) {\n result[k.toLowerCase()] = v;\n });\n}", "getCanonicalizedHeadersString(request) {\n let headersArray = request.headers.headersArray().filter((value) => {\n return value.name.toLowerCase().startsWith(HeaderConstants.PREFIX_FOR_STORAGE);\n });\n headersArray.sort((a, b) => {\n return a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n });\n // Remove duplicate headers\n headersArray = headersArray.filter((value, index, array) => {\n if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) {\n return false;\n }\n return true;\n });\n let canonicalizedHeadersStringToSign = \"\";\n headersArray.forEach((header) => {\n canonicalizedHeadersStringToSign += `${header.name\n .toLowerCase()\n .trimRight()}:${header.value.trimLeft()}\\n`;\n });\n return canonicalizedHeadersStringToSign;\n }", "getCanonicalizedHeadersString(request) {\n let headersArray = request.headers.headersArray().filter((value) => {\n return value.name.toLowerCase().startsWith(HeaderConstants.PREFIX_FOR_STORAGE);\n });\n headersArray.sort((a, b) => {\n return a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n });\n // Remove duplicate headers\n headersArray = headersArray.filter((value, index, array) => {\n if (index > 0 && value.name.toLowerCase() === array[index - 1].name.toLowerCase()) {\n return false;\n }\n return true;\n });\n let canonicalizedHeadersStringToSign = \"\";\n headersArray.forEach((header) => {\n canonicalizedHeadersStringToSign += `${header.name\n .toLowerCase()\n .trimRight()}:${header.value.trimLeft()}\\n`;\n });\n return canonicalizedHeadersStringToSign;\n }", "function normalizeHeaders(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n var key = normalizeHeader(headers[i]);\n if (key.length > 0) {\n keys.push(key);\n Logger.log(key);\n }\n }\n return keys;\n}", "get(name) {\n this.init();\n const values = this.headers.get(name.toLowerCase());\n return values && values.length > 0 ? values[0] : null;\n }", "function caseInsensitiveCompare(str1, str2) {\n str1.toLowerCase()\n str2.toLowerCase()\n if (str1 === str2) {\n return true\n } else {\n return false\n } // code here\n}", "function _enforceLowercaseKeys(original) {\n return Object.keys(original).reduce((enforced, originalKey) => {\n enforced[originalKey.toLowerCase()] = original[originalKey];\n return enforced;\n }, {});\n}", "function caselessCompare(a, b) {\n a = \"\" + a;\n b = \"\" + b;\n return !a.localeCompare(b, \"en-US\", {\n usage: \"search\",\n sensitivity: \"base\",\n ignorePunctuation: \"true\",\n });\n}", "hasHeaderWithValues(key, values) {\n if (key in this.headers) {\n const value = this.headers[key];\n if (values.includes(value)) {\n return true;\n }\n }\n return false;\n }", "get allowedHeaderNames() {\n return this.sanitizer.allowedHeaderNames;\n }", "get allowedHeaderNames() {\n return this.sanitizer.allowedHeaderNames;\n }", "function _sanitizeHeaderKey(key) {\n key = key.replace(/@/, ''); // remove the @ symbol\n key = key.replace(/-/, ' '); // replace dashes with spaces\n key = key.charAt(0).toUpperCase() + key.slice(1); // capitalize the first letter\n \n return key;\n }", "function parseResponseHeaders(headerStr) {\n let headers = {};\n if (!headerStr) {\n return headers;\n }\n let headerPairs = headerStr.split('\\u000d\\u000a');\n for (let i = 0, len = headerPairs.length; i < len; i++) {\n let headerPair = headerPairs[i];\n // Can't use split() here because it does the wrong thing\n // if the header value has the string \": \" in it.\n let index = headerPair.indexOf('\\u003a\\u0020');\n if (index > 0) {\n // make all keys lowercase\n let key = headerPair.substring(0, index).toLowerCase();\n let val = headerPair.substring(index + 2);\n headers[key] = val;\n }\n }\n return headers;\n}", "function containsNonSimpleHeaders(headers) {\n var containsNonSimple = false;\n\n qq.each(containsNonSimple, function(idx, header) {\n if (qq.indexOf([\"Accept\", \"Accept-Language\", \"Content-Language\", \"Content-Type\"], header) < 0) {\n containsNonSimple = true;\n return false;\n }\n });\n\n return containsNonSimple;\n }", "function equalsIgnoreCase(source, destination) {\n let finalSource = source !== null && source !== void 0 ? source : \"___no_value__\";\n let finalDest = destination !== null && destination !== void 0 ? destination : \"___no_value__\";\n //in any other case we do a strong string comparison\n return finalSource.toLowerCase() === finalDest.toLowerCase();\n }", "static isSameKey(data_key,search_key,caseSensitive) {\n let dKey_str=caseSensitive?String(data_key):String(data_key).toUpperCase();\n let sKey_str=caseSensitive?String(search_key):String(search_key).toUpperCase();\n if(dKey_str === sKey_str) {\n return true;\n }\n return false;\n }", "function checkCustomRequestHeaderValue(headerName, expectedValue) {\n navigateTab(getServerURL(`echoheader?${headerName}`), function(tab) {\n chrome.tabs.executeScript(\n tab.id, {code: 'document.body.innerText'}, function(results) {\n chrome.test.assertNoLastError();\n chrome.test.assertEq(expectedValue, results[0]);\n chrome.test.succeed();\n });\n });\n}", "function normalizeHeaders(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n var key = normalizeHeader(headers[i]);\n if (key.length > 0) {\n keys.push(key);\n }\n }\n return keys;\n}", "function normalizeHeaders(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n var key = normalizeHeader(headers[i]);\n if (key.length > 0) {\n keys.push(key);\n }\n }\n return keys;\n}", "function normalizeHeaders(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n var key = normalizeHeader(headers[i]);\n if (key.length > 0) {\n keys.push(key);\n }\n }\n return keys;\n}", "function normalizeHeaders(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n var key = normalizeHeader(headers[i]);\n if (key.length > 0) {\n keys.push(key);\n }\n }\n return keys;\n}", "function normalizeHeaders(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n var key = normalizeHeader(headers[i]);\n if (key.length > 0) {\n keys.push(key);\n }\n }\n return keys;\n}", "function normalizeHeaders(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n var key = normalizeHeader(headers[i]);\n if (key.length > 0) {\n keys.push(key);\n }\n }\n return keys;\n}", "get HTTPHeaders() {\n return {\n Authorization: this[sAuthHeader] || null,\n 'User-Agent': CouchbaseLiteUserAgent,\n };\n }", "get(name) {\n this.init();\n const values = this.headers.get(name.toLowerCase());\n return values && values.length > 0 ? values[0] : null;\n }", "get(name) {\n this.init();\n const values = this.headers.get(name.toLowerCase());\n return values && values.length > 0 ? values[0] : null;\n }", "get(name) {\n this.init();\n const values = this.headers.get(name.toLowerCase());\n return values && values.length > 0 ? values[0] : null;\n }", "get(name) {\n this.init();\n const values = this.headers.get(name.toLowerCase());\n return values && values.length > 0 ? values[0] : null;\n }", "get(name) {\n this.init();\n const values = this.headers.get(name.toLowerCase());\n return values && values.length > 0 ? values[0] : null;\n }", "function normalizeHeaders(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n keys.push(normalizeHeader(headers[i]));\n }\n return keys;\n}", "function normalizeHeaders(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n keys.push(normalizeHeader(headers[i]));\n }\n return keys;\n}", "function checkHeaders(app) {\n //CHECK GUEST KEY\n app.use((req, res, next) => {\n if (req.header(\"key\") === auth.getGuestKey()) {\n req.url = \"/GUEST\" + req.url;\n req.guestPermission = true;\n //router react by req.url..\n } else {\n console.log(\"guestkey:\", auth.getGuestKey());\n }\n next();\n });\n\n //CHECK ADMIN KEY\n app.use((req, res, next) => {\n if (req.header(\"key\") === auth.getAdminKey()) {\n //req.url = \"/ADMIN\" + req.url;\n req.adminPermission = true;\n //router react by req.url..\n } else {\n console.log(\"adminkey:\", auth.getAdminKey());\n }\n next();\n });\n}", "function compareIgnoreCase(str1, str2) {\n\tvar val1 = str1.toLowerCase();\n\tvar val2 = str2.toLowerCase();\n\tif (val1 == val2) {\n\t\treturn 0;\n\t} else if (val1 < val2) {\n\t\treturn -1;\n\t} else {\n\t\treturn 1;\n\t}\n}", "willSendRequest(request) {\n request.headers.set('api-key', '9bea9ab8db7fd98f1f0ebb9cd98b8001');\n }", "function normalizeHeaders_(headers) {\n var keys = [];\n for (var i = 0; i < headers.length; ++i) {\n var key = normalizeHeader_(headers[i]);\n if (key.length > 0) {\n keys.push(key);\n }\n }\n return keys;\n}", "function updateHeader(field, value){\n field = String(field).toLowerCase();\n if (typeof _headerDictionary[field] == 'undefined')\n _headerDictionary[field] = value;\n }", "function checkCustomResponseHeaders(initialHeadersParam, headers) {\n fetch(getServerURL(`set-header?${initialHeadersParam}`)).then(response => {\n for (const header in headers) {\n chrome.test.assertEq(headers[header], response.headers.get(header));\n }\n\n chrome.test.succeed();\n });\n}", "get caseSensitive() {\n\t\treturn this.__caseSensitive;\n\t}", "static caselessStringMatch(a, b) {\n const compare = a.localeCompare(b, 'en', {\n sensitivity: 'base',\n });\n return compare === 0 ? true : false;\n }", "lower_props(obj) {\n if (obj.hasOwnProperty('_raw_')) delete obj['_raw_'];\n if (this.is_object(obj)) {\n for (var key in obj) {\n if (!obj.hasOwnProperty(key))\n continue;\n if (typeof obj[key] === 'object' && obj[key] !== null) {\n var val = this.lower_props(obj[key]);\n delete obj[key];\n obj[key.toLowerCase()] = val;\n } else {\n if (key != key.toLowerCase()) {\n var val = obj[key];\n if (typeof(val) === 'string') {\n delete obj[key];\n obj[key.toLowerCase()] = val;\n }\n }\n }\n }\n return obj;\n }\n return false;\n }", "function sc_isStringCILessEqual(s1, s2) {\n return s1.toLowerCase() <= s2.toLowerCase();\n}", "function ValidateAPIKey(req) {\n var apiKey = req.headers[appConfig.apiKeyHeader] || req.headers[appConfig.apiKeyHeader.toLowerCase()];\n if (apiKey && (apiKey === appConfig.apiKey)) {\n return true;\n } else {\n false;\n }\n}", "getHeader(key) {\n const val = this.headers[key];\n return val == null ? '' : val;\n }", "function compare_strings(firstString, secondString) {\n return firstString.toLowerCase() === secondString.toLowerCase();\n}", "function startsWithLowercase (str)\n {\n return str.charAt(0).toUpperCase() !== str.charAt(0);\n }", "function obfuscate(request) {\n if (!(0, _lodash.has)(request, `headers.${key}`)) {\n return request;\n }\n\n request.headers[key] = '*****';\n}", "function testInLowerCaseAlphabet(){\n\t\tvar StringUtils = LanguageModule.StringUtils;\n\t\tvar stringUtils = new StringUtils();\n\t\tvar encodings = stringUtils.stringEncodings;\n\t\tvar lencodings = stringUtils.languageEncodings;\n\t\tvar isLowerCaseInAlphabet1 = stringUtils.isLowerCaseInAlphabet(\"abcdef\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet2 = stringUtils.isLowerCaseInAlphabet(\"ABCDEF\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet3 = stringUtils.isLowerCaseInAlphabet(\"0123456789\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet4 = stringUtils.isLowerCaseInAlphabet(\"g\", encodings.ASCII, lencodings.ENGLISH);\n\t\tvar isLowerCaseInAlphabet5 = stringUtils.isLowerCaseInAlphabet(\"->?\", encodings.ASCII, lencodings.ENGLISH);\n\t\texpect(isLowerCaseInAlphabet1).to.eql(true);\n\t\texpect(isLowerCaseInAlphabet2).to.eql(false);\n\t\texpect(isLowerCaseInAlphabet3).to.eql(false);\n\t\texpect(isLowerCaseInAlphabet4).to.eql(true);\n\t\texpect(isLowerCaseInAlphabet5).to.eql(false);\n\t}", "function caseInsensitiveKeyMapper(key) {\n return key.toLowerCase();\n }", "function getHeaderValue(headers, key) {\n let header = headers.find(header => header.name === key)\n return header ? header.value : '';\n}", "function sc_isStringCILess(s1, s2) {\n return s1.toLowerCase() < s2.toLowerCase();\n}", "function parseResponseHeaders (headerStr) {\n var headers = {}\n if (!headerStr) {\n return headers\n }\n var headerPairs = headerStr.split('\\u000d\\u000a')\n for (var i = 0; i < headerPairs.length; i++) {\n var headerPair = headerPairs[i]\n // Can't use split() here because it does the wrong thing\n // if the header value has the string \": \" in it.\n var index = headerPair.indexOf('\\u003a\\u0020')\n if (index > 0) {\n var key = headerPair.substring(0, index).toLowerCase()\n var val = headerPair.substring(index + 2)\n headers[key] = val\n }\n }\n return headers\n}", "function equalsIgnoreCase(str1, str2){\n\tif(str1 == undefined || str2 == undefined){\n\t\treturn false;\n\t}\n\treturn (str1.toString().toUpperCase() == str2.toString().toUpperCase());\n}", "tidyHeadTitle(head) {\n let output = {}, patt = /\\b[a-z]/g;\n for (let k in head) {\n let key = k.replace(patt, s => s.toUpperCase());\n output[key] = head[k];\n }\n return output;\n }", "function onBeforeHeaders(details) {\n\t// Check if Google search URL\n\tif(!isSearchUrl(details.url)) {\n\t\treturn;\n\t}\n\n\t// Get Cookie\n\tvar headers = details.requestHeaders;\n\tfor(var i = 0; i < headers.length; i++) {\n\t\tif(headers[i].name == 'Cookie') {\n\t\t\t// Remove cookies\n\t\t\theaders.splice(i, 1);\n\n\t\t\t// Return new headers\n\t\t\treturn {\n\t\t\t\trequestHeaders: headers\n\t\t\t};\n\t\t}\n\t}\n}", "function checkHasHeader(headers, headerName) {\n return !!headers.find(header => header.name.toLowerCase() == headerName);\n}", "function standardizePropertyKey(key) {\n var standardProperties = ['Title', 'Author', 'Subject', 'Keywords', 'Creator', 'Producer', 'CreationDate', 'ModDate', 'Trapped'];\n var standardizedKey = key.charAt(0).toUpperCase() + key.slice(1);\n\n if (standardProperties.includes(standardizedKey)) {\n return standardizedKey;\n }\n\n return key.replace(/\\s+/g, '');\n }", "prepareHeaders(value = null) {\n const headers = {\n API_KEY: API.HOST_API_KEY // always send api key with every request header\n };\n if (this.sessionId) {\n headers.SESSION_ID = this.sessionId; // always send session id with every request header\n }\n if (typeof value === 'string' && value != null) {\n headers['Content-Type'] = 'text/plain;charset=utf-8';\n } else {\n headers['Content-Type'] = 'application/json;charset=utf-8';\n }\n return headers;\n }", "matchKey(needle, obj, caseInsensitive) {\n\t\tneedle = (caseInsensitive) ? needle.toLowerCase() : needle;\n\t\tfor (let key in obj) {\n\t\t\tconst keyCopy = (caseInsensitive) ? key.toLowerCase() : key;\n\t\t\tif (keyCopy === needle) {\n\t\t\t\treturn key; \t\t\t\t//return the original\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "function keysToLowerCase(obj){\n\t\tObject.keys(obj).forEach(function(key){\n\t\t\tvar k=key.toLowerCase();\n\t\t\tif(k!= key){\n\t\t\t\tobj[k]= obj[key];\n\t\t\t\tdelete obj[key];\n\t\t\t}\n\t\t});\n\t\treturn (obj);\n\t}", "function _sanitizeHeaderValue(value) {\n value = value.replace(/^\\s+|\\s+$/g, ''); // trim leading and trailing spaces\n \n return value;\n }", "constructor(headers) {\n /**\n * Internal map of lowercased header names to the normalized\n * form of the name (the form seen first).\n */\n this.normalizedNames = new Map();\n /**\n * Queued updates to be materialized the next initialization.\n */\n this.lazyUpdate = null;\n if (!headers) {\n this.headers = new Map();\n } else if (typeof headers === 'string') {\n this.lazyInit = () => {\n this.headers = new Map();\n headers.split('\\n').forEach(line => {\n const index = line.indexOf(':');\n if (index > 0) {\n const name = line.slice(0, index);\n const key = name.toLowerCase();\n const value = line.slice(index + 1).trim();\n this.maybeSetNormalizedName(name, key);\n if (this.headers.has(key)) {\n this.headers.get(key).push(value);\n } else {\n this.headers.set(key, [value]);\n }\n }\n });\n };\n } else {\n this.lazyInit = () => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n assertValidHeaders(headers);\n }\n this.headers = new Map();\n Object.entries(headers).forEach(([name, values]) => {\n let headerValues;\n if (typeof values === 'string') {\n headerValues = [values];\n } else if (typeof values === 'number') {\n headerValues = [values.toString()];\n } else {\n headerValues = values.map(value => value.toString());\n }\n if (headerValues.length > 0) {\n const key = name.toLowerCase();\n this.headers.set(key, headerValues);\n this.maybeSetNormalizedName(name, key);\n }\n });\n };\n }\n }" ]
[ "0.71113825", "0.71113825", "0.6760743", "0.6760743", "0.6760743", "0.673706", "0.6694855", "0.64865065", "0.6258938", "0.6158184", "0.6158184", "0.6158184", "0.6157643", "0.6157643", "0.6157643", "0.6157643", "0.6157643", "0.6157643", "0.6157643", "0.61353904", "0.6130744", "0.6121212", "0.60998756", "0.603323", "0.5986807", "0.59701234", "0.5936753", "0.5885455", "0.5877469", "0.582907", "0.5793127", "0.57689244", "0.5755299", "0.57535124", "0.5733927", "0.5733927", "0.5733927", "0.5733927", "0.5733927", "0.57330096", "0.5713118", "0.5713118", "0.57122517", "0.5712107", "0.56479937", "0.56418854", "0.5600137", "0.5582292", "0.55776757", "0.55776757", "0.55755323", "0.5574072", "0.55694854", "0.5556164", "0.55532634", "0.5552487", "0.5547985", "0.5547985", "0.5547985", "0.5547985", "0.5547985", "0.5547985", "0.5538583", "0.55349004", "0.55349004", "0.55349004", "0.55349004", "0.55349004", "0.5514315", "0.5514315", "0.55133915", "0.5508181", "0.54952276", "0.54867464", "0.5474379", "0.54735494", "0.54709643", "0.546848", "0.5467437", "0.54520804", "0.544832", "0.5441753", "0.5433756", "0.5429412", "0.5420158", "0.5414154", "0.538155", "0.5364873", "0.5348667", "0.5346879", "0.5336864", "0.5331959", "0.53308564", "0.5321626", "0.5307373", "0.5306978", "0.52945983", "0.5289416", "0.5274564", "0.52647233" ]
0.6012075
24
app.use("/api/events", usersRoutes(knex)); app.use("/api/timeslots", usersRoutes(knex)); app.use("/api/attendees", usersRoutes(knex)); String randomizing function
function generateRandomString() { let randomize = Math.random() .toString(36) .substring(7); return randomize; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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}", "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 }", "async function main() {\n const mysql = require('mysql2/promise');\n const pool = mysql.createPool({\n host: process.env.MYSQL_HOST || 'localhost', \n database: process.env.MYSQL_DB || 'test',\n user: process.env.MYSQL_USER || 'root', \n password: process.env.MYSQL_PASSWORD\n });\n\n app.use('/api/user/', require('./routes/user')(pool))\n app.use('/api/sessions', require('./routes/sessions')(pool))\n app.use('/api/campaigns', require('./routes/campaigns')(pool))\n app.use('/api/top', require('./routes/top')(pool))\n app.use('/api/', require('./routes/misc')(pool))\n \n app.get('*',(req,res) => {\n res.status(404).json({error:'PageNotFound'})\n })\n}", "routes() {\n this.app.use(index_routes_1.default);\n this.app.use('/api/photos', photos_routes_1.default);\n this.app.use('/api/users', users_routes_1.default);\n }", "function setupRoutes(app, passport) {\n var loginWithLinkedIn = require('./routes/login/login-linkedin');\n var loginWithLGoogle = require('./routes/login/login-google');\n var loginWithLMicrosoft = require('./routes/login/login-microsoft');\n var loginWithPassword = require('./routes/login/login-with-password');\n var getCurrentUser = require('./routes/get-current-user');\n app.use('/login/linkedin', loginWithLinkedIn);\n app.use('/login/google', loginWithLGoogle);\n app.use('/login/microsoft', loginWithLMicrosoft);\n app.use('/technician/login', loginWithPassword);\n app.use('/getCurrentUser', getCurrentUser);\n /* router.get('/', function(req, res, next) {\n res.send('respond with a resource');\n }); */\n\n\n}", "routes() {\n this.app.use('/api/usuarios', require('../routes/usuarios'));\n }", "routes() {\n this.app.use('/api/usuarios', require('../routes/usuarios'));\n }", "setupRoutes() {\n this.app.use(this.express.static(__dirname + '/www'));\n this.app.use(this.express.static(__dirname + '/module1/www'));\n this.app.use(this.express.static(__dirname + '/module2/www'));\n this.app.use(this.express.static(__dirname + '/module3/www'));\n this.app.use(this.express.static(__dirname + '/module4/www'));\n this.app.use(this.express.static(__dirname + '/module5/www'));\n this.app.use(this.express.static(__dirname + '/projects/www'));\n this.app.use(this.express.static(__dirname + '/module1/frontend'));\n this.app.use(this.express.static(__dirname + '/module2/frontend'));\n this.app.use(this.express.static(__dirname + '/module3/frontend'));\n this.app.use(this.express.static(__dirname + '/module4/frontend'));\n this.app.use(this.express.static(__dirname + '/module5/frontend'));\n \n this.app.all('/meta/*', function(req, res, next) {\n var path = req.path.substr('/meta/'.length);\n var dirname = require('path').dirname(path);\n var filename = require('path').basename(path);\n if (require('fs').existsSync(dirname + '/meta.json')) {\n res.send(require('fs').readFileSync(dirname + '/meta.json', \n 'utf8'));\n }\n else {\n res.send('{}');\n }\n });\n\n this.app.all('/readings/*', function(req, res, next) {\n var path = req.path.substr('/readings/'.length);\n var dirname = require('path').dirname(path);\n var filename = require('path').basename(path);\n filename = filename.split('.');\n filename.splice(-1, 0, 'modified');\n filename = filename.join('.');\n try {\n if (require('fs').existsSync(dirname + '/' + \n filename)) {\n res.send(require('fs').readFileSync(dirname + '/' + \n filename, 'utf8'));\n } else {\n res.send(require('fs').readFileSync(__dirname + '/' + \n path, 'utf8'));\n }\n } catch(e) {\n res.send('');\n }\n });\n \n this.app.all('/reset/*', function(req, res, next) {\n var path = req.path.substr('/reset/'.length);\n var dirname = require('path').dirname(path);\n var filename = require('path').basename(path);\n filename = filename.split('.');\n filename.splice(-1, 0, 'modified');\n filename = filename.join('.');\n try {\n if (require('fs').existsSync(__dirname + '/' + dirname + '/' + \n filename)) {\n require('fs').unlinkSync(__dirname + '/' + dirname + \n '/' + filename);\n } else {\n console.info('An error: file not found?');\n }\n res.send();\n } catch(e) {\n res.send('');\n }\n });\n \n this.app.all('/run/*', function(req, res, next) {\n res.send('Node runner is being worked on. Check back soon.');\n return;\n // TODO:\n var status = '';\n var file = req.path.substr('/run/'.length);\n // open the log file for writing\n var log = __dirname + '/' + file.replace(/\\\\/g, '/')\n .replace(/\\//g, '_') + '.log';\n require('fs').writeFileSync(log, '');\n var ws = require('fs').createWriteStream(log);\n let original = process.stdout.write;\n process.stdout.write = process.stderr.write = ws.write.bind(ws);\n\n // run the file now\n require(__dirname + '/' + file);\n \n // begin the read\n let sent = false;\n var rs = require('fs').createReadStream(log);\n res.set('etag', (new Date()).getTime());\n rs.on('data', function(data) {\n res.write(data);\n });\n rs.on('end', function() {\n res.end();\n try {require('fs').unlinkSync(log);} catch(e) {console.log(e);}\n try {ws.end();} catch(e) {console.log(e);}\n process.stdout.write = process.stderr.write = original;\n sent = true;\n });\n setTimeout(() => {\n if (!sent) {\n rs.pause();\n ws.end();\n res.send();\n try {require('fs').unlinkSync(log);} catch(e) {}\n }\n }, 60000);\n });\n \n this.app.post('/save/*', function(req, res, next) {\n var path = req.path.substr('/save/'.length);\n var dirname = require('path').dirname(path);\n var filename = require('path').basename(path);\n let data = '';\n req.on('data', function(datum) {\n data += datum;\n });\n req.on('end', function() {\n filename = filename.split('.');\n filename.splice(-1, 0, 'modified');\n filename = filename.join('.');\n require('fs').writeFileSync(dirname + '/' + filename, data);\n res.send();\n });\n });\n }", "function makeRouter(app) {\n\n app.get('/', (req, res, next) => {\n // console.log(models.model('hotel').findAll.toString());\n var hotels = Hotel.findAll();\n var restaurants = Restaurant.findAll();\n var activities = Activity.findAll();\n Promise.all([hotels, restaurants, activities]).then( result => {\n res.render('index',{\n hotels: result[0],\n restaurants: result[1],\n activities: result[2]\n })\n } ).catch( err => console.trace( err ) )\n })\n\n app.get('/map', (req, res, next) => {\n var hotels = Hotel.findAll();\n var restaurants = Restaurant.findAll();\n var activities = Activity.findAll();\n Promise.all([hotels, restaurants, activities]).then( result => {\n res.render('index',{\n hotels: result[0],\n restaurants: result[1],\n activities: result[2],\n mapKey: config.mapKey\n })\n } ).catch( err => console.trace( err ) )\n })\n}", "routes() {\n this.app.use('/', indexRoutes_1.default);\n this.app.use('/api/games', gamesRoutes_1.default);\n }", "function addRoutes(app) {\n\n app.all('*', (req, res, next) => {\n console.log(req.method + ' ' + req.url);\n next();\n });\n\n //register users\n /*\n param 1: api endpong\n param 2: middleware that uses a controller function \n */\n app.post('/api/register', authController.register);\n\n //login users\n /*\n param 1: api endpoint\n param 2: middleware that uses a controller function \n */\n app.post('/api/login', authController.login);\n\n app.post('/api/account-activate', authController.accountActivate);\n app.post('/api/resend-activation-link', authController.resendActivationLink);\n app.post('/api/reset-password-link', authController.resetPasswordLink);\n app.post('/api/reset-password', authController.resetPassword);\n\n //authorize your user - check that the user sending requests to server is authorized to view this route\n\n /*\n summary of this route:\n 1. call route\n 2. run first middleware, checkAuth \n - checkAuth uses the jwtAuth strategy defined in lib/passport.js\n - remember that this jwt auth strategy compares the JWT token saved to the client, \n either stored in a cookie or sent via an Authorization Header, \n with the JWT token that was created when the user logged in.\n - checkAuth, if successful, returns the user object from the DB\n 3. run second middleware, authController.testAuth\n - returns a {isLoggedIn: true/false} based on whether or not previous middleware\n successfully returned a user object\n */\n app.get('/api/test-auth', checkAuth, authController.testAuth);\n //if you ahve other protected routes, you can use the same middleware,\n //e.g: app.get('/api/protected-route', checkAuth, authController.testAuth);\n //e.g: app.get('/api/another-protected-route', checkAuth, authController.testAuth);\n\n}", "getRandom(req,res){\n console.log(\"getRandom method executed\");\n\n // Get the count of all users\n Joke.count().exec((err, count) => {\n\n // Get a random entry\n var random = Math.floor(Math.random() * count)\n \n // Again query all users but only fetch one offset by our random #\n //findOne() is built-in to Mongoose\n Joke.findOne().skip(random).exec((err, result) => {\n if(err){\n return res.json(err)\n }\n \n // Tada! random user\n return res.json(result);\n })\n \n \n })\n }", "function routeSetup(app){\n\tapp.get('/users/:id', getUser(app));\n\tapp.delete('/users/:id', deleteUser(app));\n\tapp.use('/users/:id', bodyParser.json());\n\tapp.post('/users/:id', postUser(app));\n\tapp.put('/users/:id', putUser(app));\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 }", "routes() {\n this.app.use(indexRoutes_1.default);\n this.app.use(\"/api/games\", gamesRoutes_1.default); //Le decimos la ruta de la cual tiene acceso a esa peticion\n //Defecto es '/'\n }", "function routerInit(app, dbFull) {\n var db = dbFull.DA_HR\n\n app.get('/attendance', /*isAuthenticated,*/ function(req, res) {\n attendance_list(db, req.query, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n })\n });\n\n app.get('/getEmployeeDetails', /*isAuthenticated,*/ function(req, res) {\n var QUERY = {};\n // QUERY.id = 4017;\n QUERY.status = 4;\n // QUERY.date = new Date('2016-11-01');\n getEmployeeDetails(db, QUERY, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n })\n });\n\n app.get('/user_attendance', /*isAuthenticated,*/ function(req, res) {\n user_attendance_list(db, req.query, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n })\n });\n\n app.get('/getAttendance', /*isAuthenticated,*/ function(req, res) {\n var QUERY = {};\n QUERY.employee = 96;\n // QUERY.date = new Date('2016-08-06');\n getAttendance(db, QUERY, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n })\n });\n\n app.get('/getEmployeeDayAttendance', /*isAuthenticated,*/ function(req, res) {\n var QUERY = {};\n QUERY.id = 3209;\n QUERY.employee = 3209;\n QUERY.date = new Date('2017-01-13');\n getEmployeeDayAttendance(db, QUERY, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send([d]);\n })\n });\n\n app.get('/getEmployeeMonthAttendance/:EID', /*isAuthenticated,*/ function(req, res) {\n var QUERY = {};\n QUERY.id = req.params.EID;\n QUERY.employee = req.params.EID;\n QUERY.date = new Date('2017-01-01');\n getEmployeeMonthAttendance(db, QUERY, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n });\n });\n\n app.get('/getEmployeeMonthAttendance2', /*isAuthenticated,*/ function(req, res) {\n var QUERY = {};\n //QUERY.id = 4017;\n //QUERY.employee = 4017;\n QUERY.section = 1;\n QUERY.date = new Date('2016-11-01');\n getEmployeeMonthAttendance2(db, QUERY, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n })\n });\n\n app.get('/getEmployeeMonthAttendance', /*isAuthenticated,*/ function(req, res) {\n var QUERY = {};\n QUERY.id = 117;\n QUERY.employee = 117;\n QUERY.date = new Date('2017-06-05');\n getEmployeeMonthAttendance(db, QUERY, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n })\n });\n\n app.post('/CreateArchiveAttendance', function(req, res) {\n var files = req.files.archive_file;\n var file_path = [];\n if (files.length) {\n for (var i = 0; i < files.length; i++) {\n file_path.push(files[i].path)\n };\n } else {\n file_path.push(files.path)\n }\n CreateArchiveAttendance(db, file_path, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n });\n });\n\n app.get('/getEmployeeMonthAttendanceV2', /*isAuthenticated,*/ function(req, res) {\n var QUERY = {};\n QUERY.id = 3004;\n QUERY.employee = 3004;\n QUERY.date = new Date('2017-10-10');\n getEmployeeMonthAttendanceV2(db, QUERY, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n })\n });\n\n app.get('/getDailyAttendanceSummary', /*isAuthenticated,*/ function(req, res) {\n var QUERY = req.query;\n QUERY.date = (req.query.date) ? new Date(req.query.date) : new Date('2017-10-22');\n QUERY.status = [1, 2];\n database.sequelize.query(\n \"SELECT `section`.`id`, `section`.`name`, COUNT(`employee`.`id`) AS `emp_count` \" +\n \"FROM `section` \" +\n \"LEFT JOIN `employee`\" +\n \" ON `employee`.`section` = `section`.`id` \" +\n \"WHERE `employee`.`status` IN (1, 2) \" +\n \"GROUP BY `section`. `id`;\"\n ).complete(function(err, secData) {\n getDailyAttendanceSummary(db, QUERY, secData, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n })\n });\n });\n\n app.post('/CreatePunchDatAttendance', function(req, res) {\n var rawFile = req.files.user_file.path;\n var password = createHash('ffljcl1234');\n fs.readFile(rawFile, 'utf8', function(err, data) {\n if (err) throw err;\n var d = data.split(/[\\n]+/);\n CreatePunchDatAttendance(db, d, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n });\n });\n });\n\n app.post('/CreateCSVAttendance', function(req, res) {\n var rawFile = req.files.user_file.path;\n var password = createHash('ffljcl1234');\n fs.readFile(rawFile, 'utf8', function(err, data) {\n if (err) throw err;\n var d = data.split(/[\\n\\r]+/);\n //var d = data.split(\"\\n\");\n CreateCSVAttendance(db, d, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n });\n });\n });\n\n app.get('/getEmployeeDailyAttendance', /*isAuthenticated,*/ function(req, res) {\n var QUERY = req.query;\n QUERY.section = 1;\n QUERY.date = new Date(Date.UTC(2017, 9, 22));\n QUERY.status = [1, 2];\n getEmployeeDailyAttendance(db, QUERY, function(d) {\n res.setHeader('Content-Type', 'application/json');\n res.send(d);\n })\n });\n}", "static init(app) {\n /* Initialize DB */\n\n MongoClient.connect(url, { useUnifiedTopology: true }, function (err, database) {\n if (err) throw err;\n console.log(\"Database created!\");\n db = database.db('mydb')\n });\n\n const router = express.Router();\n\n // Install bodyParser parameters\n router.use(bodyParser.urlencoded({\n extended: true\n }));\n router.use(bodyParser.json());\n\n app.use(bodyParser.urlencoded({ extended: true }))\n app.use(bodyParser.json())\n app.use(express.static('public'))\n app.use('/user', router);\n\n // LIST All REST Endpoints \n router.get('/getUsers', UserController.getAllUsers);\n router.post('/user', UserController.addNewUser);\n router.put('/user', UserController.updateUser);\n router.delete('/user', UserController.deleteUser);\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 route(app){\n app.use('/data',dataRoute);\n app.use('/', mainRoute);\n}", "llamarRutasAPI(){\n this.app.use('/', rutas);\n }", "function randomNumber(req, res, next) {\n req.randomNumber = Math.random();\n next();\n}", "routes() {\n const publicPath = path.join(__dirname, '..', 'tmp', 'frontend', 'build');\n this.server.use('/v1/api', routes);\n this.server.use('/', express.static(publicPath));\n this.server.use('/users/*', express.static(publicPath));\n }", "function setup(app) {\n app.get('/', function(req, res) {\n res.render('index.html');\n });\n\n app.post('/account', function(req, res) {\n res.redirect('/success');\n });\n\n app.get('/success', function(req, res) {\n res.render('created.html');\n });\n\n app.post('/join_alpha', function(req, res) {\n if (req.body.email) {\n db.storeAlphaEmail(req.body.email, function(err) {\n res.render('joined.html');\n });\n } else {\n res.redirect('/');\n }\n });\n\n app.get('/download', function(req, res) {\n res.locals({\n agent: 'chrome',\n agentName: 'Chrome',\n installUrl: 'https://chrome.google.com/webstore/detail/gombot-alpha/maeopofifamhhcdbejkfolecghncglll'\n });\n res.render('download.html');\n });\n\n app.get('/downloads/latest', function(req, res) {\n latest(function(err, sha) {\n if (err) console.log(err);\n res.redirect('/downloads/gombot-' + sha + '.crx');\n });\n });\n\n app.get('/downloads/updates.xml', function(req, res) {\n latest(function(err, sha, ver) {\n if (err) console.log(err);\n res.locals({\n sha: sha,\n version: ver,\n appid: appid\n });\n res.render('updates.xml');\n });\n });\n}", "function index(req, res) {\n \n}", "function adminRoutes(){\n\t\n\t// url map to POST login details\n\tapp.post('/api/login/' ,passport.authenticate('local-login'),\n\t\t function (req, res) {\n\t\t res.json( {message: 'OK'} );\n\t\t });\n\t\n\t// logging-out\n\tapp.get('/api/logout/', isLoggedIn,\n\t\tfunction (req, res){\n\t\t req.logout();\n\t\t res.json({message : 'OK'});\n\t\t});\n\t\n\t// url map to GET admin page(list of admins)\n\tapp.get('/api/admin/', isLoggedIn,\n\t\tfunction (req, res) {\n\t\t User.find(\n\t\t\tfunction (err, admins) {\n\t\t\t if (err)\n\t\t\t\tres.send(err);\n\t\t\t\t \n\t\t\t var adminList = {};\n\t\t\t for (var i in admins)\n\t\t\t\tadminList[admins[i][\"id\"]] = admins[i][\"local\"][\"email\"]; \n\t\t\t\t \n\t\t\t res.json(adminList);\n\t\t\t});\t\t \n\t\t});\n\t// url map to add a new admin\n\tapp.post('/api/admin/',isLoggedIn,\n\t\t passport.authenticate('local-signup'),\n\t\t function (req, res) {\n\t\t res.json( {message: 'OK'} );\n\t\t });\n\t \t\t\n\t// url map to DELETE a admin\n\tapp.delete('/api/admin/:user_id', isLoggedIn,\n\t\t function (req, res) {\n\t\t User.remove({_id : req.params.user_id},\n\t\t\t\t function (err, user) {\n\t\t\t\t if (err)\n\t\t\t\t\t res.send(err);\n\t\t\t\t res.json({message : 'OK'});\n\t\t\t\t });\n\t\t });\n\t\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 }", "routing () {\n const notConnected = this.app.session.notConnected.bind(this.app.session)\n const connected = this.app.session.connected.bind(this.app.session)\n const connectedOrBuilder = this.app.session.connectedOrBuilder.bind(this.app.session)\n const admin = this.app.session.admin.bind(this.app.session)\n\n this.app.express.use('/api', express.Router()\n .post('/auth/login', notConnected, this.app.action.auth.login.routes)\n .post('/auth/forgot', notConnected, this.app.action.auth.forgotPassword.routes)\n .put('/auth/reset', notConnected, this.app.action.auth.resetPassword.routes)\n\n .delete('/auth/logout', connected, this.app.action.auth.logout.routes)\n\n .use('/invite', express.Router()\n .post('/', connected, admin, this.app.action.invitation.create.routes)\n )\n .use('/user', express.Router()\n .post('/', notConnected, this.app.action.user.create.routes)\n .get('/:id', connected, this.app.action.user.get.routes)\n .get('/', connected, this.app.action.user.list.routes)\n )\n .use('/manifest', express.Router()\n .post('/', connected, this.app.action.manifest.create.routes)\n .put('/:id', connected, this.app.action.manifest.update.routes)\n .put('/:id/maintainer', connected, admin, this.app.action.manifest.updateMaintainer.routes)\n .get('/:id', connectedOrBuilder, this.app.action.manifest.get.routes)\n .get('/', connected, this.app.action.manifest.list.routes)\n )\n .use('/build', express.Router()\n .post('/', connected, this.app.action.build.create.routes)\n .use('/:id', express.Router({ mergeParams: true })\n .get('/', connected, this.app.action.build.get.routes)\n\n // Middleware to authorize only builder\n .use('/', this.app.action.build.authorization.routes)\n // Empty endpoint for a client to verify his access\n .put('/', (req, res, next) => { res.json({}) })\n .put('/start', this.app.action.build.start.routes)\n .put('/stdout', this.app.action.build.stdout.routes)\n .put('/stderr', this.app.action.build.stderr.routes)\n .put('/end', this.app.action.build.end.routes)\n .put('/packages', this.app.action.build.packages.routes)\n )\n .get('/', connected, this.app.action.build.list.routes)\n )\n )\n\n this.app.express.use(this.errorHandler.bind(this))\n }", "_registerRoutes() {\n this.app.get('/:guild/metrics', (req, res) => {\n let guild = this.guilds.guilds[req.params.guild];\n if (typeof guild !== 'undefined') {\n guild.getMetrics((contentType, metrics) => {\n res.set('Content-Type', contentType);\n res.end(metrics);\n });\n } else {\n res.send('Guild not found');\n }\n });\n }", "function apps() { \n\t\n\tlet eapp1 = app.get('/', (req, res) => {\n\tfs.readFile('index.html', function(err, data) {\n\t\tres.statusCode = 200\n\t\tres.setHeader('Content-Type','text/html')\n res.write(data);\n\t return res.end();\n\t});\n});\n\n\tlet eapp2 = app.get('/about', (req, res) => {\n\tfs.readFile('about.html', function(err, data) {\n\t\tres.statusCode = 200\n\t\tres.setHeader('Content-Type','text/html')\n res.write(data);\n\t return res.end();\n\t});\n});\n\n\tlet eapp3 = app.get('/contact-me', (req, res) => {\n\tfs.readFile('contact-me.html', function(err, data) {\n\t\tres.statusCode = 200\n\t\tres.setHeader('Content-Type','text/html')\n res.write(data);\n\t return res.end();\n\t});\n};\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}", "function indexRoute(req, res) {\n return res.json({\n users: {\n users: '/users',\n user: '/users/{id}',\n register: '/users/register',\n login: '/users/login',\n me: '/users/me',\n newPin: '/program/{id}/add',\n },\n program: {\n newProgram: '/program',\n program: '/program/{id}/view',\n exercises: '/program/{clientId}/view/{programId}',\n },\n exercise: {\n exercise: '/program/{id}/add',\n }\n });\n}", "function registerFunctionRoutes(app, userFunction, functionSignatureType) {\n if (functionSignatureType === SignatureType.HTTP) {\n app.use('/favicon.ico|/robots.txt', (req, res) => {\n // Neither crawlers nor browsers attempting to pull the icon find the body\n // contents particularly useful, so we send nothing in the response body.\n res.status(404).send(null);\n });\n app.use('/*', (req, res, next) => {\n onFinished(res, (err, res) => {\n res.locals.functionExecutionFinished = true;\n });\n next();\n });\n app.all('/*', (req, res, next) => {\n const handler = makeHttpHandler(userFunction);\n handler(req, res, next);\n });\n }\n else if (functionSignatureType === SignatureType.EVENT) {\n app.post('/*', (req, res, next) => {\n const wrappedUserFunction = wrapEventFunction(userFunction);\n const handler = makeHttpHandler(wrappedUserFunction);\n handler(req, res, next);\n });\n }\n else {\n app.post('/*', (req, res, next) => {\n const wrappedUserFunction = wrapCloudEventFunction(userFunction);\n const handler = makeHttpHandler(wrappedUserFunction);\n handler(req, res, next);\n });\n }\n}", "function oldStuff() {\n // This container just lets me fold the code.\n router.post('/users', function(req, res) {\n models.User.create({\n email: req.body.email\n }).then(function(user) {\n res.json(user);\n });\n });\n\n // get all todos\n router.get('/todos', function(req, res) {\n models.Todo.findAll({}).then(function(todos) {\n res.json(todos);\n });\n });\n\n // get single todo\n router.get('/todo/:id', function(req, res) {\n models.Todo.find({\n where: {\n id: req.params.id\n }\n }).then(function(todo) {\n res.json(todo);\n });\n });\n\n // add new todo\n router.post('/todos', function(req, res) {\n models.Todo.create({\n title: req.body.title,\n UserId: req.body.user_id\n }).then(function(todo) {\n res.json(todo);\n });\n });\n\n // update single todo\n router.put('/todo/:id', function(req, res) {\n models.Todo.find({\n where: {\n id: req.params.id\n }\n }).then(function(todo) {\n if(todo){\n todo.updateAttributes({\n title: req.body.title,\n complete: req.body.complete\n }).then(function(todo) {\n res.send(todo);\n });\n }\n });\n });\n\n // delete a single todo\n router.delete('/todo/:id', function(req, res) {\n models.Todo.destroy({\n where: {\n id: req.params.id\n }\n }).then(function(todo) {\n res.json(todo);\n });\n });\n}", "function makeApp(InjectedDB)\n{\n\n const DB = InjectedDB;\n\n\n const corsOptions = {\n exposedHeaders: 'Authorization',\n };\n //----------------------middleware------------------------\n app.use(cors(corsOptions));\n app.use(express.urlencoded({extended: true}));\n app.use(express.json());\n app.use(express.static(path.join(__dirname, 'public')));\n\n\n //-------make the routes with passed in DB ----------//\n const UserRoute = makeUserRoute(DB);\n const TaskRoute = makeTaskRoute(DB);\n const ProjectRoute = makeProjectRoute(DB);\n //const NodeRoute = makeNodeRoute(DB);\n //const GraphRoute = makeGraphRoute(DB);\n\n //----------- router setup ------------------------//\n app.use('/project', ProjectRoute);\n app.use('/user', UserRoute);\n //app.use('/node', NodeRoute);\n app.use('/task', TaskRoute);\n //app.use('/graph',GraphRoute);\n\n //default /GET\n app.use('/', Home);\n //Handling Errors?\n app.use((req, res, next) => {\n const newError = new Error(`Not found. ${req.url}`);\n newError.status = 404;\n next(newError);\n\n });\n\n //Serve Error\n app.use((error, req, res, next) => {\n res.status(error.status || 500);\n res.json({\n error: error.message,\n type: error.type,\n loc: error.prototype,\n stack: error.stack,\n url: req.url\n\n });\n });\n\n return app;\n\n\n}", "routes() {\n // this.app.use( this.paths.auth, require('../routes/auth'));\n }", "viewRoute() {\n\n this.router.use(auth.isLoggedIn());\n \n this.router.get('/signup', auth.isLoggedIn(true), signup);\n this.router.get('/login', auth.isLoggedIn(true), 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 // Donor routes\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.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.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.get(\n '/donor/donations/new',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n (req, res, next) => ((req.page = 'new-food-donation'), next()),\n donorDashboard\n );\n \n this.router.get(\n '/donor/donations/verify',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n verifyMonetaryDonation\n );\n \n this.router.get(\n '/donor/live-chat',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n (req, res, next) => ((req.page = 'live-chat'), next()),\n donorDashboard\n );\n \n this.router.get(\n '/donor/edit-account',\n auth.authenticateApp(),\n auth.authorizeApp('donor'),\n (req, res, next) => ((req.page = 'edit-account'), next()),\n donorDashboard\n );\n \n // Admin routes\n this.router.get(\n '/admin',\n auth.authenticateApp(),\n auth.authorizeApp('admin'),\n (req, res, next) => res.redirect('/admin/dashboard')\n );\n\n this.router.get(\n '/admin/dashboard',\n auth.authenticateApp(),\n auth.authorizeApp('admin'),\n (req, res, next) => ((req.page = 'dashboard'), next()),\n adminDashboard\n );\n\n this.router.get(\n '/admin/donations',\n auth.authenticateApp(),\n auth.authorizeApp('admin'),\n (req, res, next) => ((req.page = 'donations'), next()),\n adminDashboard\n );\n\n this.router.get(\n '/admin/donation-stations',\n auth.authenticateApp(),\n auth.authorizeApp('admin'),\n (req, res, next) => ((req.page = 'donation-stations'), next()),\n adminDashboard\n );\n\n this.router.get(\n '/admin/live-chat',\n auth.authenticateApp(),\n auth.authorizeApp('admin'),\n (req, res, next) => ((req.page = 'live-chat'), next()),\n adminDashboard\n );\n\n this.router.get(\n '/admin/users',\n auth.authenticateApp(),\n auth.authorizeApp('admin'),\n (req, res, next) => ((req.page = 'users'), next()),\n adminDashboard\n );\n\n this.router.get(\n '/admin/users/edit/:id',\n auth.authenticateApp(),\n auth.authorizeApp('admin'),\n (req, res, next) => ((req.page = 'user-edit'), next()),\n adminDashboard\n );\n \n this.router.get(\n '/admin/users/new',\n auth.authenticateApp(),\n auth.authorizeApp('admin'),\n (req, res, next) => ((req.page = 'user-new'), next()),\n adminDashboard\n );\n \n return this.router;\n}", "setupRoutes() {\n let expressRouter = express.Router();\n\n for (let route of this.router) {\n let methods;\n let middleware;\n if (typeof route[1] === 'string') {\n methods = route[1].toLowerCase().split(',');\n middleware = route.slice(2);\n } else {\n methods = ['get'];\n middleware = route.slice(1);\n }\n for (let method of methods) {\n expressRouter[method.trim()](route[0], middleware.map(this.errorWrapper));\n }\n }\n this.app.use(this.config.mountPoint, expressRouter);\n }", "function generalRoutes(){\t\n\t\n\t// default GET\n\tapp.get('*',\n\t\tfunction (req, res) {\n\t\t res.sendfile('./public/index.html');\n\t\t});\n \n }", "function registerFunctionRoutes(app, userFunction, functionSignatureType) {\n if (isHttpFunction(userFunction, functionSignatureType)) {\n app.use('/*', (req, res, next) => {\n onFinished(res, (err, res) => {\n res.locals.functionExecutionFinished = true;\n });\n next();\n });\n app.all('/*', (req, res, next) => {\n const handler = makeHttpHandler(userFunction);\n handler(req, res, next);\n });\n }\n else {\n app.post('/*', (req, res, next) => {\n const wrappedUserFunction = wrapEventFunction(userFunction);\n const handler = makeHttpHandler(wrappedUserFunction);\n handler(req, res, next);\n });\n }\n}", "async index(req, res) {\n // Verificar se o usuario logado é prestador de serviço\n const checkUserProvider = await User.findOne({\n where: { id: req.userId, provider: true },\n });\n // Retorno de mensagem de erro\n if (!checkUserProvider) {\n return res.status(401).json({ error: 'User is not a provider' });\n }\n // Buscar date\n const { date } = req.query;\n //\n const parsedDate = parseISO(date);\n // Criar variavel appointments que vai listar todos os agendamentos\n const appointments = await Appointment.findAll({\n // Verificar agendamento do usuario logado\n where: {\n provider_id: req.userId,\n canceled_at: null,\n // Verificar agendamentos entre dois horarios na data inserida\n date: {\n [Op.between]: [startOfDay(parsedDate), endOfDay(parsedDate)],\n },\n },\n // Ordenar agendamentos por data\n order: ['date'],\n });\n // Criar retorno com json (só para não dar erro, e poder criar a rota)\n return res.json({ appointments });\n }", "function getUserEndpoints() {\n return function (req, res) {\n res.send({\n GetUserByID: \"/users/id/:userid\",\n GetUserCourses: \"/users/id/:userid/courses\",\n GetAllUsers: \"/users/all\",\n GetAllUsersByUni: \"/users/all/:university\",\n });\n };\n}", "function UserRoutes(userService) {\n const router = express.Router();\n\n router.get('/me', async (req, res) => {\n // This returns the OAuth user info\n const { _raw, _json, ...userProfile } = req.user;\n const userProfileResponse = userProfileToUserProfileResponse(\n userProfile,\n userProfile.userType === UserTypes.ADMIN\n );\n\n console.log('Getting info for user profile', userProfile);\n // TODO this is literally only the first email in emails\n const allPossibleUsers = await Promise.all(\n req.user.emails.map((emailValue) => userService.getUser(emailValue.value))\n );\n const userResponse = userToUserResponse(\n allPossibleUsers.filter((user) => user)[0]\n );\n return res.status(200).json({\n ...userProfileResponse,\n ...userResponse,\n });\n });\n\n router.get('/', requireAdmin, async (req, res) => {\n console.log('listing all users');\n const allUsers = await userService.listUsers();\n console.log(allUsers);\n return res\n .status(200)\n .json(allUsers.map((user) => userToUserResponse(user)));\n });\n\n router.get('/:userEmail', requireAdmin, async (req, res) => {\n const user = await userService.getUser(req.params.userEmail);\n res.status(200).json(userToUserResponse(user));\n });\n\n router.post('/', parseUserRequestBody, requireAdmin, async (req, res) => {\n const user = req.body;\n try {\n const savedUser = await userService.createUser(user);\n console.log('created user', user);\n return res.status(200).json(userToUserResponse(savedUser, true));\n } catch (e) {\n // TODO do this smarter\n if (e.message.startsWith('Validation Error:')) {\n return res.status(400).send(e.message);\n }\n return res.status(500);\n }\n });\n\n router.put(\n '/:userEmail',\n parseUserRequestBody,\n requireAdmin,\n async (req, res) => {\n const user = req.body;\n const savedUser = await userService.updateUser(\n req.params.userEmail,\n user\n );\n res.status(200).json(userToUserResponse(savedUser));\n }\n );\n\n router.delete('/:userEmail', requireAdmin, async (req, res) => {\n await userService.deleteUser(req.params.userEmail);\n res.status(200).send();\n });\n return router;\n}", "function controller(app) {\n\n app.get(\"/homepage\", function (req, res) {\n if (!req.user) {\n // The user is not logged in, send back an empty object\n res.render(\"login\", {})\n } else {\n // Otherwise send back the user's email and id\n // Sending back a password, even a hashed password, isn't a good idea\n res.render(\"homepage\", {})\n };\n \n });\n\n app.get(\"/api/discussion\", function (req, res) {\n console.log(\"hello world 2\")\n res.render(\"discussion\", {})\n });\n\n app.get(\"/api/results\", function (req, res) {\n console.log(\"hello world\")\n res.render(\"results\", {})\n });\n\n app.get(\"/api/anis\", function (req, res) {\n res.render(\"homepage\");\n });\n\n app.post(\"/api/anis\", function (req, res) {\n db.User.create({ username: req.body.usrname, password: req.body.psw}).then((result)=>{\n console.log(result.dataValues.username)\n var obj = {\n username: result.dataValues.username.toUpperCase(),\n password: result.dataValues.password\n };\n res.render(\"homepage\", obj)\n });\n });\n\n app.get(\"/api/all\", function(req, res) {\n\n // Finding all Chirps, and then returning them to the user as JSON.\n // Sequelize queries are asynchronous, which helps with perceived speed.\n // If we want something to be guaranteed to happen after the query, we'll use\n // the .then function\n db.Post.findAll({}).then(function(results) {\n // results are available to us inside the .then\n res.json(results);\n });\n\n });\n\n // Add a chirp\n app.post(\"/api/new\", function(req, res) {\n\n console.log(\"Post Data:\");\n console.log(req.body);\n\n db.Post.create({\n author: req.body.author,\n body: req.body.body,\n }).then(function(results) {\n // `results` here would be the newly created chirp\n res.end();\n });\n\n });\n\n}", "async function routes(fastify, options) {\n\tfastify.get('/', async (request, reply) => {\n\t\treturn { name: 'Hydrant API', version: process.env.npm_package_version, routes: 'api' }\n\t})\n\n\tfastify.get('/measurement', (request, reply) => {\n\t\tconst $top = request.query.top;\n\t\tif ($top)\n\t\t\tdb.all('SELECT * FROM Measurements LIMIT $top', { $top }, (err, rows) => {\n\t\t\t\treply.send(rows);\n\t\t\t});\n\t\telse\n\t\t\tdb.all('SELECT * FROM Measurements', (err, rows) => {\n\t\t\t\treply.send(rows);\n\t\t\t})\n\t});\n}", "function apiRoutes(app) {\n app.get(\"/api/friends\", function (req, res) {\n return res.json(friends);\n });\n\n app.post(\"/api/friends\", function (req, res) {\n // Get the info from newFriend\n var newFriend = req.body;\n\n // Compare the newFriend's scores to all of the other scores in the friends array\n var scoreDiffs = [];\n\n for (var i = 0; i < friends.length; i++) {\n\n var diff = 0;\n\n for (var j = 0; j < friends[i].scores.length; j++) {\n diff += Math.abs(friends[i].scores[j] - parseInt(newFriend.scores[j]));\n }\n\n scoreDiffs.push(diff);\n };\n\n // Whoever's scoreDiff is the lowest is the user's match\n var matchIndex = scoreDiffs.indexOf(Math.min(...scoreDiffs));\n\n var match = friends[matchIndex];\n\n // Add newFriend to the friends array\n friends.push(newFriend);\n\n // Send the match's info back to survey.html\n return res.json(match);\n });\n}", "function getRandQuestions(req, res, next){\r\n\tQuestion.getRandomQuestions(function(err, results){\r\n\t\tif(err) throw err;\r\n\t\tres.status(200).render(\"pages/quiz\", {questions: results , id:req.session.userId});\r\n\t\treturn;\r\n\t});\r\n}", "function main() {\n const app = express();\n const port = process.env.PORT || 5000;\n\n // var http = require('http').createServer(app);\n // var io = require('socket.io')(http);\n\n // app.use(cors({\n // origin: ['http://localhost:3000'],\n // methods: ['GET', 'POST', 'DELETE', 'PUT'],\n // credentials: true // enable set cookie\n // }));\n // app.use(cors())\n app.use(express.json());\n\n\n app.get('/admin', (req, res) => {\n const user =\n {\n name: 'Aniket Sharma',\n username: 'Draqula',\n email: 'draqulainc@gmail.com'\n }\n\n res.json(user)\n })\n\n // const uri = process.env.ATLAS_URI;\n // mongoose.connect(uri, { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true }\n // );\n // const connection = mongoose.connection;\n // connection.once('open', () => {\n // console.log(\"MongoDB database connection established successfully\");\n // })\n\n // app.use('/users', Users);\n // const Todo = require('./routes/todoList.js');\n // app.use('/Todo', Todo);\n\n app.use(express.static(\"client/build\"));\n app.get(\"*\", (req, res) => {\n res.sendFile(path.resolve(__dirname, \"client\", \"build\", \"index.html\"));\n });\n app.listen(port, () => {\n console.log(`Server is running on port: ${port}`);\n });\n}", "function loadAppRoutes(app){\n\t//To support JSON-encoded bodies\n\tapp.use(bodyParser.json());\n\n\t//To support URL-encoded bodies\n\t//app.use(bodyParser.urlencoded({extended:true}));\n\n\t//Load routes which require no authorization (publicly available)\n\tapp.use(\"/public\", publicRoutes);\n\n\t//Load routes which require authorization (secured access)\n\tapp.use(\"/secure\", securedRoutes);\n\n\t//TEST route for checking successful deployment\n\tapp.get(\"/\", function(req,res){\n\t\tres.send(\"Hello! You have reached the index.\");\n\t});\n}", "includeRoutes(app) {\n\t\tapp.get(\"/\", function (req, res) {\n\t\t\tres.sendFile(__dirname + '/client/index.html');\n\t\t});\n\t\t\n\t\tapp.post(\"/getSuggestion\", function (request, response) {\n\t\t\t// Variable for server response\n\t\t\tlet responseCollection = [];\n\n\t\t\t//Storing the user entered string into variable\n\t\t\tlet getSuggestionString = request.body.suggestion;\n\n /*\n * Creating an object of the levenshtein-distance node module by passing the collection of words\n */\n\t\t\tlet collection = new levenshteinDistance(wordCollection);\n\n /*\n * Calling the find() method on the object of the levenshtein-distance node module\n * Storing the response inside the responseCollection variable\n */\n\n\t\t\tcollection.find(getSuggestionString, function (result) {\n\t\t\t\tresponseCollection.push(result);\n\t\t\t});\n\t\t\tresponse.status(200).json(responseCollection);\n\t \t});\n\t}", "function main() {\n\t\n\tdbconnection();\n var app = express(); // Export app for other routes to use\n \n var port = process.env.PORT || 8000;\n app.use(bodyParser.urlencoded({\n extended: true\n }));\n app.use(bodyParser.json());\n // Routes & Handlers\n app.post('/login', Auth);\n\tapp.get('/getCategory/',middleware.checkToken,Category);\n\tapp.get('/deleteCategory/:id',middleware.checkToken,Category);\n\tapp.get('/getParentcategory/:id',middleware.checkToken,Category);\n\tapp.post('/addCategory',middleware.checkToken,Category);\n\t\n\n app.listen(port, function () { return console.log(\"Server is listening on port: \" + port); });\n}", "async load() {\n // setup API routes\n // eslint-disable-next-line\n this.routes = express.Router({\n caseSensitive: false,\n });\n\n // user Routes\n this.routes.route('/test')\n .get((req, res) => {\n res.send({hello: 'world'});\n });\n\n // route requiring authentication\n this.routes.route('/test')\n .get(this.server.auth.middleware, (req, res) => {\n res.send({hello: req.user});\n });\n\n // register the routes to the /api prefix and version\n this.server.app.use(this.urlPrefix, this.routes);\n }", "api () {\r\n const router = new Router()\r\n // READ\r\n router.get('/',\r\n (req, res) => {\r\n this\r\n .getAll(req.query)\r\n .then(this.ok(res))\r\n .then(null, this.fail(res))\r\n })\r\n router.get('/:key',\r\n (req, res) => {\r\n this\r\n .get(req.params.key, req.query)\r\n .then(this.ok(res))\r\n .then(null, this.fail(res))\r\n })\r\n // CREATE\r\n router.post('/',\r\n this.requiretmobileid,\r\n (req, res, next) => this.logUserAction(req, res, next, this.name, 'POST'),\r\n (req, res) => {\r\n this\r\n .post(req.body, req.query)\r\n .then(this.ok(res))\r\n .then(null, this.fail(res))\r\n })\r\n // UPDATE\r\n router.patch('/:key',\r\n this.requiretmobileid,\r\n (req, res, next) => this.logUserAction(req, res, next, this.name, 'PATCH'),\r\n (req, res) => {\r\n this\r\n .patch(req.params.key, req.body, req.query) // query?\r\n .then(this.ok(res))\r\n .then(null, this.fail(res))\r\n })\r\n // DELETE\r\n router.delete('/:key',\r\n this.requiretmobileid,\r\n (req, res, next) => this.logUserAction(req, res, next, this.name, 'DELETE'),\r\n (req, res) => {\r\n this\r\n .delete(req.params.key, req.query)\r\n .then(this.ok(res))\r\n .then(null, this.fail(res))\r\n })\r\n\r\n return router\r\n }", "createRoutes() {\n this.routes['/asciimo'] = (req, res) => {\n var link = \"http://i.imgur.com/kmbjB.png\";\n res.send(\"<html><body><img src='\" + link + \"'></body></html>\");\n };\n }", "initializeRoutes()\n {\n // Dynamic pages\n this.express.get(\"/\", function(_request, _response){\n _response.render(\"index/index.njk\");\n });\n\n // Static paths\n this.express.use(\"/css\", express.static(__dirname + \"/../frontend/css\"));\n this.express.use(\"/javascript\", express.static(__dirname + \"/../frontend/javascript\"));\n\n // External libraries\n this.express.use(\"/bootstrap\", express.static(__dirname + \"/../../node_modules/bootstrap/dist\"));\n this.express.use(\"/bootstrap-table\", express.static(__dirname + \"/../../node_modules/bootstrap-table/dist\"));\n this.express.use(\"/deep-eql\", express.static(__dirname + \"/../../node_modules/deep-eql\"));\n this.express.use(\"/flatpickr\", express.static(__dirname + \"/../../node_modules/flatpickr/dist\"));\n this.express.use(\"/font-awesome\", express.static(__dirname + \"/../../node_modules/@fortawesome/fontawesome-free\"));\n this.express.use(\"/jspdf\", express.static(__dirname + \"/../../node_modules/jspdf/dist\"));\n this.express.use(\"/jspdf-autotable\", express.static(__dirname + \"/../../node_modules/jspdf-autotable/dist\"));\n this.express.use(\"/native-toast\", express.static(__dirname + \"/../../node_modules/native-toast/dist\"));\n this.express.use(\"/jquery\", express.static(__dirname + \"/../../node_modules/jquery/dist\"));\n this.express.use(\"/jquery-ui\", express.static(__dirname + \"/../../node_modules/jquery-ui-dist\"));\n this.express.use(\"/popper-js\", express.static(__dirname + \"/../../node_modules/popper.js/dist/umd\"));\n this.express.use(\"/select2\", express.static(__dirname + \"/../../node_modules/select2/dist\"));\n\n this.initializeQueryResponses();\n this.express.post(\"/createOrder\", this.createOrderResponse.bind(this));\n }", "function setupRoutes(app){\n const APP_DIR = `${__dirname}/app`\n const features = fs.readdirSync(APP_DIR).filter(\n file => fs.statSync(`${APP_DIR}/${file}`).isDirectory()\n )\n\n features.forEach(feature => {\n const router = express.Router()\n const routes = require(`${APP_DIR}/${feature}/routes.js`)\n\n routes.setup(router)\n app.use(`/${feature}`, router)\n })\n}", "function route(endpoint){\n app.get(`/${endpoint}`, (req, res)=>{\n if (endpoint !== \"\") {\n sqlDB.connect(config, ()=>{\n const request = new sqlDB.Request();\n request.query(`SELECT * FROM ${endpoint}`, (err, result)=>{\n if (err) console.log(err);\n res.send(result.recordset);\n });\n })\n }\n else res.send(\"Hello, you have reached contacts-api. Please navigate to /contacts, /categories, or /companies to continue.\");\n })\n}", "function router(app) {\n const path = require('path')\n public = path.join(__dirname, \"../public\")\n\n // Get index\n app.get(\"/\", async function (req, res) {\n console.log('[GET /] Getting index')\n res.sendFile('./index.html', { root: public })\n })\n\n // Get exercise\n app.get(\"/exercise\", async function (req, res) {\n console.log('[GET /exercise] Getting exercise')\n res.sendFile('./exercise.html', { root: public })\n })\n\n // Get stats\n app.get(\"/stats\", async function (req, res) {\n console.log('[GET /stats] Getting stats')\n res.sendFile('./stats.html', { root: public })\n })\n\n // *** API routes ***\n // Get workouts\n app.get(\"/api/workouts\", async function (req, res) {\n console.log('[GET /api/workouts] Getting workouts')\n Workout.find({})\n .sort({ date: -1 })\n .then(dbWorkout => { res.json(dbWorkout) })\n .catch(err => { res.status(400).json(err) })\n })\n\n // Post workouts\n app.post(\"/api/workouts\", async function ({ body }, res) {\n console.log('POST api/workouts: ', body)\n Workout.create(body)\n .then(data => {\n console.log(`Adding workout`)\n res.json(data)\n })\n .catch(err => {\n console.log(\"Error occured during insert: \", err)\n res.json(err)\n })\n })\n\n // Put workout\n app.put(\"/api/workouts/:id\", async function ({ body, params }, res) {\n console.log(`[PUT /api/workouts/${params.id}] Adding exercise`)\n Workout.findByIdAndUpdate(\n params.id,\n // push the body to exercises and set the totalDuration\n { $push: { exercises: body }, $inc: { totalDuration: body.duration } },\n { new: true, runValidators: true }\n )\n .then(data => {\n res.json(data)\n console.log(`Adding ${params.id} ${data}`)\n })\n .catch(err => {\n console.log(\"Error occured during insert: \", err)\n res.json(err)\n })\n })\n\n app.get(\"/api/workouts/range\", async function (req, res) {\n console.log('[GET /api/workouts/range]')\n Workout.find({})\n .then(dbWorkout => { res.json(dbWorkout) })\n .catch(err => { res.status(400).json(err) })\n })\n\n}", "function createRoutes (router) {\n router\n .get('/', (_, response) => {\n response.end('')\n })\n .get('/user/:id', (request, response) => {\n response.end(request.params.id)\n })\n .post('/user', (request, response) => {\n response.end('')\n })\n}", "function router(nav) {\n authRoutes.route('/signin')\n .post(passport.authenticate('local', {\n successRedirect: '/auth/profile',\n failureRedirect: '/auth/signin'\n }))\n .get((req, res) => {\n // al hacer el render hay que decirle la carpeta porque en index solo le decimos que los archivos estáticos están en views, pero ahora hemos creado una carpeta dentro auth\n res.render('auth/signin', { nav }) // res.send('GET signup works') --> solo para que pinte sin mandar a un ejs // { nav } para que en el ejs salga pintada la importación del header - enviamos el arrary de los links del nav, que lo hemos pasado por le index invocado, para que llegue como parámetro a la función. A render le pasamos un obj con la propiedad nav (del array de los links). render() como segundo argumento siempre recibe un onjeto.\n })\n\n // .post((req, res) => {\n // res.send('hi')\n // }\n // );\n\n // res.json(req.body); // para ver el contenido del body, que será un objeto con los datos introducidos\n \n\n authRoutes\n .route('/signup')\n .get((req, res) => {\n res.render('auth/signup', { nav }) \n })\n .post((req, res) => {\n const newUser = { ...req.body, user: req.body.user.toLowerCase() }; // lo metemos en una const con nombre sin destructurar { user, email, password } - de esta manera nos da mucha más información porque no le decimos que queremos el user, etc.\n // res.json(req.body); // queremos obtener el objeto que nos devuelve - Hay una propiedad ops\n // metemos destructuring assignment para añadir esa propiedad y que no distinga entre un email escrito en mayúsculas o minúsculas ----> email: req.body.email.toLowerCase()\n \n (async function mongo(){\n try {\n client = await MongoClient.connect(dbUrl)\n const db = client.db(dbName);\n const collection = db.collection(collectionName);\n\n // buscar si el usuario existe en la db\n // para el findOne necesitamos un filtro y un callback para ese filtro\n // el email del objeto es el nombre que tiene el input en el ejs\n const user = await collection.findOne({ user: newUser.user }); // buscamos en la db\n\n if(user) { // user o email\n // Si el email de usuario existe, redirecciono a signin\n res.redirect('/auth/signin'); // si aquí meto un render() pintará en esa misma dirección el signin \n } else {\n const result = await collection.insertOne(newUser); // si no está te envío al profile\n req.login(result.ops[0], () => {\n res.redirect('/auth/profile')\n })\n }\n\n } catch (error) {\n debug(error.stack);\n }\n \n client.close(); \n }());\n });\n\n\n authRoutes\n .route('/profile')\n .all((req, res, next) => {\n // si no es ni 0, ni falso, ni undefined, ni null, ni cadena vacía\n // hay usuario, continúo, next()\n if(req.user) {\n next();\n } else {\n res.redirect('/auth/signin');\n }\n })\n .get((req, res) => {\n res.render('/auth/profile', { nav, user: req.user });\n })\n .post((req, res) => {\n res.send('POST profile')\n })\n\n \n \n return authRoutes;\n}", "function userMoviesApi(app) {\n \n /** Crea el router */\n const router = express.Router();\n /** Crea la ruta y adjunta el router que vamos a terminar de declarar */\n app.use('/api/user-movies', router);\n /** Crea una instancia de los servicios, que contiene los metodos de mongo */\n const userMovieService = new UserMovieService();\n\n /** Get all from this user */\n router.get(\n '/',\n validationHandler({ userId: userIdSchema }, 'query'),\n async (req, res, next) => {\n const { userId } = req.query;\n try {\n const userMovies = await userMovieService.getUserMovies({ \n userId, \n });\n res.status(200).json({\n data: userMovies,\n message: 'user movies list',\n })\n } catch (error) {\n next(error);\n }\n }\n )\n\n /** Create one for this user */\n router.post(\n '/',\n validationHandler(createUserMovieSchema),\n async (req, res, next) => {\n const { body: userMovie } = req;\n\n try {\n const createUserMovieId = await userMovieService.createUserMovie({\n userMovie,\n })\n res.status(200).json({\n data: createUserMovieId,\n message: 'user-movie',\n })\n } catch (error) {\n next(error);\n }\n }\n )\n\n /** Delete one for this user */\n\n router.delete(\n '/:userMovieId',\n validationHandler({ userMovieId: movieIdSchema}, 'params'),\n async (req, res, next) => {\n const { userMovieId } = req.params;\n\n try {\n const deleteUserMovieId = await userMovieService.deleteUserMovie({\n userMovieId\n });\n res.status(200).json({\n data: deleteUserMovieId,\n message: 'user-movie deleted'\n })\n } catch (error) {\n next(error)\n }\n }\n )\n\n}", "function setupServer() {\r\n //\r\n // Middleware's\r\n //\r\n\r\n // Use HTTP sessions\r\n let session = require('express-session')({\r\n secret: 'session_secret_key',\r\n resave: true,\r\n saveUninitialized: false\r\n });\r\n app.use(session);\r\n\r\n // Use Socket IO sessions\r\n let sharedSession = require(\"express-socket.io-session\")(session, {autoSave: true});\r\n io.use(sharedSession);\r\n\r\n // Parse the body of the incoming requests\r\n let bodyParser = require('body-parser');\r\n app.use(bodyParser.json());\r\n app.use(bodyParser.urlencoded({extended: false}));\r\n\r\n // Set static path to provide required assets\r\n let path = require('path');\r\n app.use(express.static(path.resolve('../client/')));\r\n\r\n //\r\n // Routes\r\n //\r\n\r\n // Authentication view endpoint\r\n app.get('/', function (req, res) {\r\n if (req.session.user) {\r\n res.sendFile(path.resolve('../client/views/profile.html'));\r\n }\r\n else {\r\n res.sendFile(path.resolve('../client/views/auth.html'));\r\n }\r\n });\r\n\r\n // Main game screen\r\n app.get('/play', function (req, res) {\r\n req.session.name = req.session.name || \"\";\r\n\r\n res.sendFile(path.resolve('../client/views/index.html'));\r\n });\r\n\r\n // Join endpoint\r\n app.post('/join', function (req, res) {\r\n req.session.name = (req.session.user ? req.session.user.username : req.body.name) || \"\";\r\n res.json({status: 0});\r\n });\r\n\r\n // Register endpoint\r\n app.post('/register', function (req, res) {\r\n let username = req.body.username;\r\n let password = req.body.password;\r\n\r\n if (!username || !password) {\r\n return res.json({status: 1, error_msg: \"Invalid register request\"});\r\n }\r\n\r\n let userData = {\r\n username: username,\r\n password: password,\r\n highScore: 10\r\n };\r\n\r\n // Try registering the user\r\n User.create(userData, function (error, user) {\r\n if (error || !user) {\r\n res.json({status: 1, error_msg: \"The username already exists\"});\r\n console.log(\"error in registering\", error);\r\n }\r\n else {\r\n req.session.user = user;\r\n req.session.name = user.username;\r\n res.json({status: 0});\r\n console.log(user.username, \"has registered...\");\r\n }\r\n });\r\n });\r\n\r\n // Log in post request endpoint\r\n app.post('/login', function (req, res) {\r\n let username = req.body.username;\r\n let password = req.body.password;\r\n\r\n if (!username || !password) {\r\n return res.json({status: 1, error_msg: \"Invalid login request\"});\r\n }\r\n\r\n // Authenticate user's credentials\r\n User.authenticate(username, password, function (error, user) {\r\n if (error) {\r\n res.json({status: 1, error_msg: error.message});\r\n console.log(\"error in logging in\", error);\r\n }\r\n else {\r\n req.session.user = user;\r\n req.session.name = user.username;\r\n res.json({status: 0});\r\n console.log(user.username, \"has logged in...\");\r\n }\r\n });\r\n });\r\n\r\n // Log out endpoint\r\n app.get('/logout', function (req, res) {\r\n // Destroy session object\r\n if (req.session) {\r\n let username = req.session.user;\r\n\r\n req.session.destroy(function (err) {\r\n if (err) {\r\n res.json({status: 1, error_msg: \"Please try again later!\"});\r\n console.log(\"error in logging out\", error);\r\n }\r\n else {\r\n res.json({status: 0});\r\n console.log(username, \"has logged out...\");\r\n }\r\n });\r\n }\r\n });\r\n}", "function createUsers(req, res) {\n\n}", "async function index(req, res) {}", "function movieApi(app){\n const router = express.Router();\n app.use('/api/movies', router);\n\n const moviesService = new MoviesService()\n\n router.get('/', async function(req,res,next){\n const { tags } = req.query;\n try{\n const movie = await moviesService.getMovies({tags});\n\n res.status(200).json({\n data: movie,\n menssage: 'movie listed'\n });\n }catch(err){\n next(err);\n }\n });\n\n router.get('/:movieId', async function(req,res,next){\n const { movieId } = req.params;\n try{\n const movie = await moviesService.getMovie({movieId});\n\n res.status(200).json({\n data: movie,\n menssage: 'movie retrieved'\n });\n }catch(err){\n next(err);\n }\n });\n\n router.post('/', async function(req,res,next){\n const { body: movie } = req;\n try{\n const createdMovieId = moviesService.createMovie({movie});\n\n res.status(201).json({\n data: createdMovieId,\n menssage: 'movie created'\n });\n }catch(err){\n next(err);\n }\n });\n\n router.put('/:movieId', async function(req,res,next){\n const { movieId } = req.params;\n const { body: movie } = req;\n try{\n const updateMovieId = await moviesService.updateMovie({ movieId, movie });\n\n res.status(200).json({\n data: updateMovieId,\n menssage: 'movie update'\n });\n }catch(err){\n next(err);\n }\n });\n\n router.delete('/:movieId', async function(req,res,next){\n const { movieId } = req.params;\n try{\n const deleteMovie = await moviesService.deleteMovie({ movieId });\n\n res.status(200).json({\n data: deleteMovie,\n menssage: 'movie deleted'\n });\n }catch(err){\n next(err);\n }\n });\n}", "async function dbOps() {\n let testing = false;\n\n //If in dev, set fake Ip and testing status to true\n if (process.env.NODE_ENV === \"development\") {\n testing = true;\n }\n\n MongoClient.connect(\n process.env.DB,\n { useNewUrlParser: true },\n async function(err, client) {\n //Error\n if (err) {\n next(err);\n }\n //Connection\n else {\n const db = client.db(\"trivia-actually\"); // Database\n const scoreCollection = db.collection(\"scores\"); // Scores collection\n const ipCollection = db.collection(\"ips\"); // IPs collection\n\n //Get score stats\n const scoreData = await statsHandler.getScores(testing, scoreCollection).catch(err => {\n next(err);\n });\n\n //Get ip Stats\n const ipData = await statsHandler.getIps(testing, ipCollection).catch(err => {\n next(err);\n });\n\n //Get unique locations\n const locations = await statsHandler.reduceLocations(ipData.locations).catch(err => {\n next(err);\n });\n\n //JSON request for testing\n if (req.body.format === \"json\") {\n try {\n res.json({\n triviaData: {\n easyCount: easyTrivia.length,\n medCount: medTrivia.length,\n hardCount: hardTrivia.length,\n totalTriviaCount: triviaData.length\n },\n scoreStats: scoreData,\n ipStats: { ipCount: ipData.ipCount, locations: locations }\n });\n } catch (err) {\n next(err);\n }\n } // end of if format json\n //Otherwise render Jade page\n else {\n try {\n res.render(\"admin_stats\", {\n totalCount: scoreData.totalCount,\n ipCount: ipData.ipCount,\n average: scoreData.average,\n median: scoreData.median,\n zeroCount: scoreData.zeroCount,\n tenCount: scoreData.tenCount,\n twentyCount: scoreData.twentyCount,\n thirtyCount: scoreData.thirtyCount,\n fortyCount: scoreData.fortyCount,\n fiftyCount: scoreData.fiftyCount,\n sixtyCount: scoreData.sixtyCount,\n seventyCount: scoreData.seventyCount,\n eightyCount: scoreData.eightyCount,\n ninetyCount: scoreData.ninetyCount,\n hundredCount: scoreData.hundredCount,\n easyCount: easyTrivia.length,\n medCount: medTrivia.length,\n hardCount: hardTrivia.length,\n totalTriviaCount: triviaData.length,\n locations: locations\n });\n } catch (err) {\n next(err);\n }\n } // end of else render Jade\n\n client.close();\n } // end of else for successful connection\n } // end of connection function\n ); // end of MongoClient.connect\n }", "function htmlRoutes(app) {\n app.get('/survey', function (req, res) {\n res.sendFile(path.join(__dirname + '/../public/survey.html'));\n });\n\n // A default USE route that leads to home.html which displays the home page.\n app.use(function (req, res) {\n res.sendFile(path.join(__dirname + '/../public/home.html'));\n });\n\n}", "function authroute(navbar,login){\r\n //Authot Array\r\n var authors = [\r\n { \r\n id:1,\r\n name:'William Shakespeare',\r\n img:'shakespeare.jfif',\r\n description:\"William Shakespeare was an English poet, playwright, and actor, widely regarded as the greatest writer in the English language\"\r\n },\r\n { \r\n id:2,\r\n name:'Joseph Barbera',\r\n img:'joseph.jpg',\r\n description:\"Joseph Roland Barbera was an American animator, director, producer, storyboard artist, and cartoon artist, whose film and television cartoon characters entertained millions of fans worldwide\"\r\n },\r\n { \r\n id:3,\r\n name:\"Jonathan Swift\",\r\n img:'jonathan.jpg',\r\n description:\"Jonathan Swift was an Anglo-Irish satirist, essayist, political pamphleteer poet and Anglican cleric who became Dean of St Patrick's Cathedral, Dublin, hence his common sobriquet, 'Dean Swift'\"\r\n }\r\n ]\r\n authorRouter.get('/',function(req,res){\r\n res.render(\"authors\",{\r\n navbar,\r\n login,\r\n title:\"Authors\",\r\n authors\r\n });\r\n });\r\n authorRouter.get('/:id',function(req,res){\r\n const id = req.params.id;\r\n res.render('author',{\r\n navbar,\r\n login,\r\n title:\"Author\",\r\n authors:authors[id]\r\n });\r\n })\r\n return authorRouter;\r\n}", "function main () {\n app.use(bodyParser.json());\n // Routes & Handlers\n app.get('/list',cacheMiddleware(10), function (req, res) {\n connection.query('select * from list', function (error, results, fields) {\n if (error) throw error;\n memCache.put(req.mCacheKey, results,1200000);\n incrementApiHitCount(req.mCacheKey);\n res.json(results);\n });\n});\n\napp.get('/emplist',cacheMiddleware(10), function (req, res) {\n connection.query('select * from list', function (error, results, fields) {\n if (error) throw error;\n memCache.put(req.mCacheKey, results,1200000);\n incrementApiHitCount(req.mCacheKey);\n res.json(results);\n });\n});\n \napp.get('/apilist/:key',cacheMiddleware(10), function (req, res) {\n let apikey=req.params.key;\n connection.query('select word from filter_words where siteid in (select siteid from keyinfo where api_key=?)',apikey, function (error, results, fields) {\n if (error) throw error;\n if(results.length>0) {\n memCache.put(req.mCacheKey, results,1200000);\n incrementApiHitCount(req.mCacheKey);\n res.json(results);\n }\n else{\n let emptyResponse='Invalid Key';\n res.json(emptyResponse);\n }\n });\n\n \n});\n app.listen(port, () => console.log(`Server is listening on port: ${port}`));\n\n}", "_declareExpressUses(express) {\n this.expApp.use('/', express.static(__dirname + '/../web'));\n this.expApp.use('/materialize', express.static('./node_modules/materialize-css/dist'));\n this.expApp.use('/blockui', express.static('./node_modules/blockui-npm'));\n this.expApp.use('/materialize-autocomplete', express.static('./node_modules/materialize-autocomplete'));\n this.expApp.use('/jquery', express.static('./node_modules/jquery/dist'));\n }", "setUpRoutes () {\n\n /*\n * Hotels Query\n * GET /hotels\n * params: stringify query\n * - ?name=**&stars=[2, 5]\n * - ?_id=**\n */\n this.app.get('/hotels', async (req, res) => {\n const query = parse(req.url, true).query\n\n for (const i in query) query[i] = JSON.parse(unescape(query[i])) // parse query to object\n\n console.log(query)\n const results = this.filterData(query, data)\n res.status(200).json(results)\n })\n\n /*\n * Hotels Create\n * POST /\n * body: Hotel fields (see validator)\n */\n this.app.post('/', db(async (req, res) => {\n const {Model} = req\n const data = req.body\n let result = {}\n try {\n result = await new Model(data).save()\n } catch (err) {\n console.log('error', err)\n if (err.name && err.name === 'ValidationError') {\n return res.status(400).send({message: err.message})\n }\n return res.status(500).send({message: 'Error: save hotel'})\n }\n return res.status(200).send(result)\n }))\n\n /*\n * Hotel Update\n * PUT /:id\n * params: @id\n * body: Dataset to update\n */\n this.app.put('/:id', db(async (req, res) => {\n const {Model} = req\n const data = req.body\n const {id} = req.params\n delete data._id\n let result = {}\n try {\n result = await Model.findByIdAndUpdate(id, { $set: data }, { new: true })\n } catch (err) {\n console.log('error', err)\n if (err.name && err.name === 'ValidationError') {\n return res.status(400).send({message: err.message})\n }\n return res.status(500).send({message: 'Error: update hotel'})\n }\n return res.status(200).send(result)\n }))\n\n /*\n * Hotel Delete\n * DELETE /:id\n * params: @id\n */\n this.app.delete('/:id', db(async (req, res) => {\n const {Model} = req\n const {id} = req.params\n let result = {}\n try {\n result = await Model.findByIdAndRemove(id)\n if (!result) {\n return res.status(404).send({message: 'hotel not found'})\n }\n } catch (err) {\n if (err.name && err.name === 'ValidationError') {\n return res.status(400).send({message: err.message})\n }\n return res.status(500).send({message: 'Error: delete hotel'})\n }\n return res.status(200).send({message: 'delete ok', data: result})\n }))\n\n /*\n * Hotels find by id\n * GET /:id\n * params: @id\n */\n this.app.get('/:id', db(async (req, res) => {\n const {Model} = req\n const {id} = req.params\n let result = {}\n try {\n result = await Model.findById(id)\n if (!result) {\n return res.status(404).send({message: 'hotel not found'})\n }\n } catch (err) {\n if (err.name && err.name === 'ValidationError') {\n return res.status(400).send({message: err.message})\n }\n return res.status(500).send({message: 'Error: find by id hotel'})\n }\n return res.status(200).send(result)\n }))\n\n /*\n * Hotels Query\n * GET /hotels\n * params: stringify query\n * - ?name=**&stars=[2, 5]\n * - ?_id=**\n */\n this.app.get('/', db(async (req, res) => {\n const {Model} = req\n const query = parse(req.url, true).query\n\n for (const i in query) query[i] = JSON.parse(unescape(query[i])) // parse query to object\n let results = []\n try {\n results = await Model.find(query)\n } catch (err) {\n return res.status(500).send({message: 'Error: find all hotels'})\n }\n return res.status(200).send(results)\n }))\n }", "setup() {\n this.app.use(express.json());\n\n this.app.get('/', (req, res) => {\n res.send(\"Hello World!\")\n });\n }", "middlewares() {\n //directorio publico\n this.app.use(express.static('public'));\n\n //convertir los datos que llegan en json\n this.app.use(express.json());\n }", "index(req, res) {\n User.find({}, (err, users) => {\n if (err) {\n console.log(`Error: ${err} `);\n }\n let context = {\n users: users\n };\n return res.render('index', context);\n })\n }", "function randomRest(req, res, next){\n var id = req.params.id;\n Wishlist.find({_id: id}, function(err, wishlist) {\n var taurs = wishlist.restaurants;\n var taur = shuffleList(taurs);\n res.json(taur);\n })\n}", "function route(...etc)\n{\n etc.unshift(stockAPI);\n let sOut = etc.reduce((acc, curr)=>acc+=curr+'/');\n return sOut;\n}", "function main () {\n let app = express(); // Export app for other routes to use\n let handlers = new HandlerGenerator();\n const port = process.env.PORT || 8000;\n app.use(bodyParser.urlencoded({ // Middleware\n extended: true\n }));\n app.use(bodyParser.json());\n // Routes & Handlers\n app.post('/login', handlers.login);\n app.get('/', middleware.checkToken, handlers.index);\n app.listen(port, () => console.log(`Server is listening on port: ${port}`));\n}", "function bootApplication(app, config, passport) {\n app.set('showStackError', true)\n app.use(express.static(__dirname + '/../public'))\n app.use(express.logger(':method :url :status'))\n\n // set views path, template engine and default layout\n console.log(__dirname + '/../app/views');\n app.set('views', __dirname + '/../app/views')\n app.set('view engine', 'jade')\n\n app.configure(function () {\n // dynamic helpers\n app.use(function (req, res, next) {\n res.locals.appName = 'XbeeCordinator'\n res.locals.title = 'Xbee Cordiator'\n res.locals.showStack = app.showStackError\n res.locals.req = req\n next()\n })\n\n\n // bodyParser should be above methodOverride\n app.use(express.bodyParser())\n app.use(express.methodOverride())\n\n // cookieParser should be above session\n app.use(express.cookieParser());\n app.use(express.session({\n secret: 'sessionstore',\n store: new MemoryStore(),\n key: 'blah'\n })\n );\n\n app.use(passport.initialize())\n app.use(passport.session())\n\n app.use(express.favicon())\n app.use(express.errorHandler({showStack: true, dumpExceptions: true}));\n // routes should be at the last\n app.use(app.router)\n\n // assume \"not found\" in the error msgs\n // is a 404. this is somewhat silly, but\n // valid, you can do whatever you like, set\n // properties, use instanceof etc.\n app.use(function(err, req, res, next){\n // treat as 404\n if (~err.message.indexOf('not found')) return next()\n\n // log it\n console.error(err.stack)\n\n // error page\n res.status(500).render('500')\n })\n\n // assume 404 since no middleware responded\n app.use(function(req, res, next){\n res.status(404).render('404', { url: req.originalUrl })\n })\n\n })\n\n app.set('showStackError', true)\n\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 htmlRoutes(app) {\n // Route to the homepage\n app.get(\"/\", function (req, res) {\n res.sendFile(path.join(__dirname, \"../public/home.html\"));\n });\n\n // Route to the survey page\n app.get(\"/survey\", function (req, res) {\n res.sendFile(path.join(__dirname, \"../public/survey.html\"));\n });\n}", "function route(req,res,module,app,next,counter) { \n \n // Wait for the dependencies to be met \n if(!calipso.socket) {\n \n counter = (counter ? counter : 0) + 1; \n \n if(counter < 1000) {\n process.nextTick(function() { route(req,res,module,app,next,counter); }); \n return;\n } else {\n calipso.error(\"Tweetstream couldn't route as dependencies not met.\")\n next();\n return;\n } \n }\n \n res.menu.primary.push({name:'Tweets',url:'/tweets',regexp:/tweets/});\n \n /**\n * Routes\n */ \n module.router.route(req,res,next);\n \n}", "run (req, res, next) {}", "function failRandomlyMiddleware(req, res, next) {\n if (Math.random() * 2 >= 1) {\n next();\n } else {\n res.status(500).end();\n }\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}", "async index(req, res) {\n // checando se o usuario logado é um provider\n const checkUserProvider = await User.findOne({\n where: { id: req.Id, provider: true },\n });\n // caso nao seja cai aqui\n if (!checkUserProvider) {\n return res.status(401).json({ error: 'User is not a provider' });\n }\n\n // pega a data passada\n const { date } = req.query;\n // variavel que retorna a data\n const parsedDate = parseISO(date);\n // checa todos os Appointments do dia atraves do usuario logado\n const Appointments = await Appointment.findAll({\n where: {\n provider_id: req.Id,\n canceled_at: null,\n date: {\n [Op.between]: [startOfDay(parsedDate), endOfDay(parsedDate)], // operador between, com o inicio do dia e o fim do dia\n },\n },\n order: ['date'], // ordenado pela data\n });\n\n return res.json(Appointments);\n }", "start() {\n const app = express_1.default();\n let query = new user_serv_1.default();\n // route for GET /\n // returns items\n app.get('/', (request, response) => __awaiter(this, void 0, void 0, function* () {\n let data = yield query.find({});\n response.send(data);\n }));\n app.get('/register', (request, response) => __awaiter(this, void 0, void 0, function* () {\n let user = new user_1.default();\n let answer = yield query.register(user);\n if (answer.result)\n response.send();\n else\n response.status(500).send(answer);\n }));\n // Server is listening to port defined when Server was initiated\n app.listen(this.port, () => {\n console.log(\"Server is running on port \" + this.port);\n });\n }", "constructor() {\n this.express = express(); //THE APP\n this.middleware();\n this.routes();\n }", "constructor() {\n this.express = express(); //THE APP\n this.middleware();\n this.routes();\n }", "function createExpressApp() {\n var app = express();\n\n // returns an empty response and sends a chosen HTTP status\n app.get('/return-status/:status', function(req, res) {\n res.status(parseInt(req.params.status)).send(\"\");\n });\n\n // returns a chosen body with HTTP status 200\n app.get('/return-body/:body', function(req, res) {\n res.status(200).send(req.params.body);\n });\n\n // returns a chosen header with HTTP status 200\n app.get('/return-header/:name/:value', function(req, res) {\n res.status(200).set(req.params.name, req.params.value).send(\"Ok!\");\n });\n\n // responds \"Ok!\" after a delay of :ms milliseconds\n app.get('/delay-for-ms/:ms', function(req, res) {\n setTimeout(function() {\n res.status(200).send(\"Ok!\");\n }, parseInt(req.params.ms));\n });\n\n // responds with a body of the chosen size\n app.get('/response-size/:bytes', function(req, res) {\n var size = parseInt(req.params.bytes);\n res.set({'content-type': 'application/octet-stream'});\n res.status(200).send(new Buffer(size)).end();\n });\n\n // for each ID - fails 2 times with 500, then returns \"Ok!\"\n var fttsCounts = {};\n app.all('/fail-twice-then-succeed/:id', function(req, res) {\n var count = fttsCounts[req.params.id] || 0;\n fttsCounts[req.params.id] = count + 1;\n if (count >= 2)\n res.status(200).send(\"Ok!\");\n else\n res.status(500).send(\"Oh my!\");\n });\n\n // for each ID - returns an incrementing counter after a small delay, starting at 1 for the first request\n var icCounts = {};\n app.all('/incrementing-counter/:id', function(req, res) {\n var count = icCounts[req.params.id] || 1;\n icCounts[req.params.id] = count + 1;\n setTimeout(function() {\n res.status(200).send(count.toString());\n }, 50);\n });\n\n // incrementing counter with a configurable cache-control setting\n app.all('/counter/:id/cache-control/:cache', function(req, res) {\n var count = icCounts[req.params.id] || 1;\n icCounts[req.params.id] = count + 1;\n\n res.status(200)\n .set('Cache-Control', req.params.cache)\n .send(count.toString());\n });\n\n // for each ID - return success response with cache, then fail\n var stfCounts = {};\n app.all('/succeed-then-fail/:id/cache-control/:cache', function(req, res) {\n var count = stfCounts[req.params.id] || 1;\n stfCounts[req.params.id] = count + 1;\n\n if(count < 2)\n res.status(200)\n .set('Cache-Control', req.params.cache)\n .send('Ok!');\n else\n res.status(500).send(\"Oh my!\");\n });\n\n // register a route for each HTTP method returning the method that was used in a header (to test HEAD properly)\n app.all('/return-method-used/:method', function(req, res) {\n res.status(200).set('X-Method', req.method).send('');\n });\n\n // this route returns a 404 once, then 200 to test 4xx caching\n var first404then200Ids = {};\n app.get('/first-404-then-200/:id', function(req, res) {\n if (first404then200Ids[req.params.id]) {\n res.status(200).send('Ok.');\n } else {\n first404then200Ids[req.params.id] = true;\n res.status(404).send('Not found.');\n }\n });\n\n return app;\n}", "function setupApp () {\n const app = express()\n app.use(errorHandler);\n app.get(\"/test\",(req, res)=>{\n //res.send(\"Is is working!\");\n var stooges = [{name: 'moe', age: 40}, {name: 'larry', age: 50}, {name: 'curly', age: 60}];\n let sorted=_.sortBy(stooges, 'age');\n res.send(sorted);\n });//end get(/error)\n\n\n app.get(\"/load-practitioners\", (req, res)=>{\n\n logger.log({level:levelType.info,operationType:typeOperation.normalProcess,action:\"/practitioner\",result:typeResult.iniate,\n message:`Start the import CSV file content`});\n\n let filePath = mappingConfig.app.dataFilePath;\n\n let server = mappingConfig.app.server;\n\n customLibrairy.createPractitionerFromCSV(filePath,function(records){\n\n let fhirs = records.entry\n\n for(let fhir of fhirs)\n {\n \n //fhir = fhir.resource\n\n if ( fhir.resourceType === \"Bundle\" &&\n ( fhir.type === \"transaction\" || fhir.type === \"batch\" ) ) {\n console.log( \"Saving \" + fhir.type )\n let dest = URI(server).toString()\n axios.post( dest, fhir ).then( ( res ) => {\n console.log( dest+\": \"+ res.status )\n console.log( JSON.stringify( res.data, null, 2 ) )\n } ).catch( (err) => {\n console.error(err)\n } )\n } else {\n console.log( \"Saving \" + fhir.resourceType +\" - \"+fhir.id )\n let dest = URI(server).segment(fhir.resourceType).segment(fhir.id).toString()\n axios.put( dest, fhir ).then( ( res ) => {\n console.log( dest+\": \"+ res.status )\n console.log( res.headers['content-location'] )\n } ).catch( (err) => {\n console.error(err)\n console.error(JSON.stringify(err.response.data,null,2))\n } )\n }\n \n }\n });\n\n });//end \n\n app.get(\"/load-roles\", (req, res)=>{\n\n logger.log({level:levelType.info,operationType:typeOperation.normalProcess,action:\"/practitionerRole\",result:typeResult.iniate,\n message:`Start the import CSV file content`});\n\n let filePath = mappingConfig.app.dataFilePath;\n\n let server = mappingConfig.app.server;\n\n\n customLibrairy.createPractitionerRoleFromCSV(filePath,function(records){\n\n let fhirs = records.entry\n\n\n for(let fhir of fhirs)\n {\n\n if ( fhir.resourceType === \"Bundle\" &&\n ( fhir.type === \"transaction\" || fhir.type === \"batch\" ) ) {\n\n console.log( \"Saving \" + fhir.type )\n let dest = URI(server).toString()\n axios.post( dest, fhir ).then( ( res ) => {\n console.log( dest+\": \"+ res.status )\n console.log( JSON.stringify( res.data, null, 2 ) )\n } ).catch( (err) => {\n console.error(err)\n } )\n } else {\n console.log( \"Saving \" + fhir.resourceType +\" - \"+fhir.id )\n let dest = URI(server).segment(fhir.resourceType).segment(fhir.id).toString()\n axios.put( dest, fhir ).then( ( res ) => {\n console.log( dest+\": \"+ res.status )\n console.log( res.headers['content-location'] )\n } ).catch( (err) => {\n console.error(err)\n console.error(JSON.stringify(err.response.data,null,2))\n } )\n }\n \n }\n });\n });//end \n\n app.get(\"/Practitioner\",(req, res)=>{\n logger.log({level:levelType.info,operationType:typeOperation.normalProcess,action:\"/practitioner\",result:typeResult.iniate,\n message:`Start the import CSV file content`});\n let filePath=mappingConfig.app.dataFilePath;\n customLibrairy.readCSVData(filePath,function(recordPractitioners){\n\n //console.log(recordPractitioners);\n\n logger.log({level:levelType.info,operationType:typeOperation.getData,action:\"readCSVData\",\n result:typeResult.success,message:`Return ${recordPractitioners.length} practitioner`});\n let listExtractedPractitioner=[];\n listExtractedPractitioner=customLibrairy.buildPractitioner(recordPractitioners);\n\n //console.log(listExtractedPractitioner.entry)\n \n res.send(listExtractedPractitioner);\n \n });\n });//end \n\n app.get(\"/PractitionerRole\",(req, res)=>{\n logger.log({level:levelType.info,operationType:typeOperation.normalProcess,action:\"/practitioner\",result:typeResult.iniate,\n message:`Start the import CSV file content`});\n let filePath=mappingConfig.app.dataFilePath;\n customLibrairy.readCSVData(filePath,function(recordPractitioners){\n //console.log(patientData);\n logger.log({level:levelType.info,operationType:typeOperation.getData,action:\"readCSVData\",\n result:typeResult.success,message:`Return ${recordPractitioners.length} practitioner`});\n let listExtractedPractitionerRole=[];\n listExtractedPractitionerRole=customLibrairy.buildPractitionerRole(recordPractitioners);\n res.send(listExtractedPractitionerRole);\n \n });\n });//end\n app.get(\"/Location\",(req, res)=>{\n logger.log({level:levelType.info,operationType:typeOperation.normalProcess,action:\"/location\",result:typeResult.iniate,\n message:`Start the import CSV file content`});\n let filePath=mappingConfig.app.dataFilePath;\n console.log(filePath)\n customLibrairy.readCSVData(filePath,function(recordPractitioners){\n //console.log(patientData);\n logger.log({level:levelType.info,operationType:typeOperation.getData,action:\"readCSVData\",\n result:typeResult.success,message:`Return ${recordPractitioners.length} practitioner`});\n let listExtractedLocation=[];\n listExtractedLocation=customLibrairy.buildLocation(recordPractitioners);\n res.send(listExtractedLocation);\n \n });\n });//end\n app.get(\"/ValueSet\",(req, res)=>{\n logger.log({level:levelType.info,operationType:typeOperation.normalProcess,action:\"/Job-ValueSet\",result:typeResult.iniate,\n message:`Start the import CSV file content`});\n let filePath=mappingConfig.app.dataFilePath;\n customLibrairy.readCSVData(filePath,function(recordPractitioners){\n //console.log(patientData);\n logger.log({level:levelType.info,operationType:typeOperation.getData,action:\"readCSVData\",\n result:typeResult.success,message:`Return ${recordPractitioners.length} practitioner`});\n let listExtractedJob=[];\n listExtractedJob=customLibrairy.buildJob(recordPractitioners);\n res.send(listExtractedJob);\n \n });\n });//end\n \n return app\n}", "function moviesApi(app) {\n const router = express.Router();\n app.use('/api/movies', router);\n\n //Instanciando un nuevo servicio\n const moviesServices = new MoviesServices();\n\n //----------------- Aqui definimos las rutas -----------------------------\n\n //Aqui passport actua como un middleware y en este caso no requiere de un custom callback, de esta forma protegemos nuestros endpoint con passport. Cn lo que la unica manera de obtener acceso es si tenemos un jwt valido.\n router.get(\n '/',\n passport.authenticate('jwt', { session: false }),\n scopesValidationHandler(['read:movies']),\n async function(req, res, next) {\n cacheResponse(res, FIVE_MINUTES_IN_SECONDS);\n //los tags probiene del query de la url recuerda response.object y request.object la lectura del curso\n const { tags } = req.query;\n try {\n //getMovies probiene del la capa de servicios\n const movies = await moviesServices.getMovies({ tags });\n //Hardcode Error para ver un error\n //throw new Error('error for testing propuses');\n res.status(200).json({\n data: movies,\n massage: 'movies Listed'\n });\n } catch (err) {\n next(err);\n }\n }\n );\n\n //NOTA:La diferencia principal entre parametros y query es que: los parametros estan establecidos en l url y query es cuando se le pone ?-nombreQuery- y ademas se puede concatenar.\n\n //Implementando metodos CRUD\n //Buscado por medio del ID\n //NOTA: Los middleware van entre la ruta y la definicion de la ruta tantos como se quiera\n router.get(\n '/:movieId',\n passport.authenticate('jwt', { session: false }),\n scopesValidationHandler(['read:movies']),\n validationHandler({ movieId: movieIdSchema }, 'params'),\n async function(req, res, next) {\n cacheResponse(res, SIXTY_MINUTES_IN_SECONDS);\n //en este caso el id biene como parametro en la url\n const { movieId } = req.params;\n try {\n const movies = await moviesServices.getMovie({ movieId });\n res.status(200).json({\n data: movies,\n massage: 'Movie retrive'\n });\n } catch (err) {\n next(err);\n }\n }\n );\n\n //Creando y recibiendo la pelicula\n router.post(\n '/',\n passport.authenticate('jwt', { session: false }),\n scopesValidationHandler(['create:movies']),\n validationHandler(createMovieSchema),\n async function(req, res, next) {\n //en este caso biene es del cuerpo el body con un alias para ser mas especifioc en este caso boyd: movie(alias)\n const { body: movie } = req;\n try {\n const createMovieId = await moviesServices.createMovie({ movie });\n //cuando creamos el codigo es 201\n res.status(201).json({\n data: createMovieId,\n massage: 'Movies created'\n });\n } catch (err) {\n next(err);\n }\n }\n );\n\n //Actualizando las peliculas\n router.put(\n '/:movieId',\n passport.authenticate('jwt', { session: false }),\n scopesValidationHandler(['update:movies']),\n validationHandler({ movieId: movieIdSchema }, 'params'),\n validationHandler(updateMovieSchema),\n async function(req, res, next) {\n const { movieId } = req.params;\n const { body: movie } = req;\n try {\n const updatedMovieId = await moviesServices.updateMovie({\n movieId,\n movie\n });\n res.status(200).json({\n data: updatedMovieId,\n massage: 'Movie updated'\n });\n } catch (err) {\n next(err);\n }\n }\n );\n\n //Reto:\n //NOTA: PATCH como PUT se usa para actualizaciones pero con la diferencia de que este es usado para hacer cambios en una parte del recurso en una locacion y no el recurso completo es descrito como una minorUpdate y fallara si el recurso no existe. Mas info https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods\n router.patch('/:movieId', async (req, res, next) => {\n const { movieId } = req.params;\n const { body: movie } = req;\n\n try {\n const partiallyUpdatedMovieId = await moviesServices.partialUpdateMovie({\n movieId,\n movie\n });\n\n res.status(200).json({\n data: partiallyUpdatedMovieId,\n massage: 'partially updated movie'\n });\n } catch (err) {\n next(err);\n }\n });\n\n //Borrar las Peliculas\n router.delete(\n '/:movieId',\n passport.authenticate('jwt', { session: false }), //Validar Autenticacion\n scopesValidationHandler(['delete:movies']), //Validar Permisos Necesarios\n validationHandler({ movieId: movieIdSchema }, 'params'), //Validar que los Datos esten Correctos\n async function(req, res, next) {\n const { movieId } = req.params;\n try {\n const movies = await moviesServices.deleteMovie({ movieId });\n res.status(200).json({\n data: movies,\n massage: 'Movies deleted'\n });\n } catch (err) {\n next(err);\n }\n }\n );\n}", "_createApp () {\n return new Promise(resolve => {\n this.app = Express()\n\n if (datadog.key === 'none') this.app.use((req, res) => res.json({ success: true }))\n else LoadRoutes(this, this.app, __dirname, './routes')\n\n this.app.listen(statsPort, () => {\n resolve()\n })\n })\n }", "constructor(apiName, config, totoEventPublisher, totoEventConsumer) {\n\n this.app = express();\n this.apiName = apiName;\n this.totoEventPublisher = totoEventPublisher;\n this.totoEventConsumer = totoEventConsumer;\n this.logger = new Logger(apiName)\n\n // Init the paths\n this.paths = [];\n\n config.load().then(() => {\n let authorizedClientIDs = config.getAuthorizedClientIDs ? config.getAuthorizedClientIDs() : null;\n\n if (config.getCustomAuthVerifier) console.log('[' + this.apiName + '] - A custom Auth Provider was provided');\n\n this.validator = new Validator(config.getProps ? config.getProps() : null, authorizedClientIDs, this.logger, config.getCustomAuthVerifier ? config.getCustomAuthVerifier() : null);\n\n });\n\n // Initialize the basic Express functionalities\n this.app.use(function (req, res, next) {\n res.header(\"Access-Control-Allow-Origin\", \"*\");\n res.header(\"Access-Control-Allow-Headers\", \"Origin, X-Requested-With, Content-Type, Accept, Authorization, x-correlation-id, x-msg-id, auth-provider, x-app-version, x-client\");\n res.header(\"Access-Control-Allow-Methods\", \"OPTIONS, GET, PUT, POST, DELETE\");\n next();\n });\n\n this.app.use(bodyParser.json());\n this.app.use(busboy());\n this.app.use(express.static(path.join(__dirname, 'public')));\n\n // Add the standard Toto paths\n // Add the basic SMOKE api\n this.path('GET', '/', {\n do: (req) => {\n\n return new Promise((s, f) => {\n\n return s({ api: apiName, status: 'running' })\n });\n }\n });\n\n // Add the /publishes path\n this.path('GET', '/produces', {\n do: (req) => {\n\n return new Promise((s, f) => {\n\n if (this.totoEventPublisher != null) s({ topics: totoEventPublisher.getRegisteredTopics() });\n else s({ topics: [] });\n });\n }\n })\n\n // Add the /consumes path\n this.path('GET', '/consumes', {\n do: (req) => {\n\n return new Promise((s, f) => {\n\n if (this.totoEventConsumer != null) s({ topics: totoEventConsumer.getRegisteredTopics() });\n else s({ topics: [] });\n })\n }\n })\n\n // Bindings\n this.staticContent = this.staticContent.bind(this);\n this.fileUploadPath = this.fileUploadPath.bind(this);\n this.path = this.path.bind(this);\n }", "function main() {\n getRoutes();\n}", "config() {\n this.app.set(\"PORT\", process.env.PORT || 3000);\n this.app.use(morgan_1.default(\"dev\")); //Miraremos las peticiones en modo desarrollador.\n this.app.use(cors_1.default()); //Permitira que clientes haga peticiones\n this.app.use(express_1.default.json()); //La app entendera json gracias a esto\n this.app.use(express_1.default.urlencoded({ extended: false })); //Permite peticiones por HTML\n }", "function discoverHikes(req, res, next) {\n \tconsole.log(req.user);\n\tres.render('main', req.user);\n}", "use (middleware) {\n this.app.use(middleware)\n }", "function Router(nav1){\n\n \nvisitorauthorsRouter.get('/', function(req,res){\n Authorsdata.find()\n .then(function(authors){\n\n res.render(\"visitorauthors\",{\n nav1,\n title:'Library',\n authors\n })\n })\n \n})\n\nvisitorauthorsRouter.get('/:id',function(req,res){\n const id=req.params.id;\n Authorsdata.findOne({_id:id})\n .then(function(author){\n res.render('visitorauthor',{\n nav1,\n title:'Library App',\n author\n })\n })\n \n})\n \n \n \n return visitorauthorsRouter;\n }", "function call(req, res) {\n // estatutos...\n}", "function indexTripRoute(req, res, next){\n Trip.find()\n .populate('user') //had to populate user data in order to get access to trip.user._id\n .then(trips => {\n trips = trips.filter(trip => trip.user._id.equals(req.currentUser._id)); // req.currentUser is from secureRoute\n res.status(200).json(trips);\n })\n .catch(next);\n}", "index(req, res){\r\n User.find({}, (err, users) => {\r\n if(err){\r\n console.log(err);\r\n }\r\n res.render('index', { users: users})\r\n })\r\n }", "function init(app) {\n app.get('/', (request, response) => { \n //throw 44\n response.render('home', {\n name: 'John' + request.chance\n })\n })\n}" ]
[ "0.7205066", "0.68016106", "0.65026265", "0.64773345", "0.6475147", "0.6441569", "0.6441569", "0.63967544", "0.635786", "0.6301378", "0.62763906", "0.6275354", "0.62747335", "0.6191203", "0.61695", "0.61682653", "0.61668205", "0.61516255", "0.61287296", "0.611662", "0.60459256", "0.6043112", "0.5998688", "0.59811306", "0.5952885", "0.5941086", "0.59206724", "0.5917157", "0.5906911", "0.5902978", "0.5879673", "0.58766645", "0.58497363", "0.5838889", "0.5816853", "0.5802155", "0.57530534", "0.57456416", "0.5736151", "0.5714696", "0.57079625", "0.57061034", "0.5691066", "0.5668394", "0.5663614", "0.5659089", "0.5656438", "0.5650737", "0.5649133", "0.564738", "0.560635", "0.5591301", "0.5558994", "0.55551946", "0.55397886", "0.5538527", "0.5531524", "0.5528333", "0.5526968", "0.55243397", "0.55140966", "0.5506268", "0.5501406", "0.5499699", "0.5495741", "0.5489487", "0.5479651", "0.5478872", "0.54765135", "0.54738516", "0.54601026", "0.54585046", "0.5441833", "0.5424688", "0.54102445", "0.5409485", "0.5407392", "0.5401075", "0.53998435", "0.5389837", "0.53853333", "0.5380548", "0.5375236", "0.5368183", "0.53553134", "0.53538114", "0.53538114", "0.53500444", "0.53405285", "0.5339521", "0.5336796", "0.5331847", "0.53312206", "0.5324842", "0.5324448", "0.5320774", "0.5307231", "0.53047425", "0.5303917", "0.52932256", "0.5290944" ]
0.0
-1
TimeEngine method (scheduled interface)
advanceTime(time) { this.trigger(time); this.__lastTime = time; return time + this.__period; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "ScheduleAt(time){\n \tconsole.log(\"scheduleprofecionales at\");\n }", "scheduler() {\n this.maybeTickSongChart();\n\n // When nextNoteTime (in the future) is near (gap is determined by \n // scheduleAheadTime), schedule audio & visuals and advance to the next\n // note.\n while (this.nextNoteTime <\n (this.audioContext.currentTime + this.scheduleAheadTime)) {\n this.scheduleNote(this.current16thNote, this.nextNoteTime);\n this.nextNote();\n }\n }", "function Schedule(options,element){return _super.call(this,options,element)||this;}", "constructor(schedule) {\n\n }", "static get schedule() {\n // once every hour\n return '* */1 * * *';\n }", "function startTime() {\n setTimer();\n}", "static get schedule() {\n // once every minute\n return '0 0 10 1/1 * ? *'\n }", "getSchedule() {\n this.setRelativeTime();\n return this.schedule;\n }", "function Scheduler() {\n this.clock = 0\n this.upcoming_events = []\n this.running = true\n this.devices = {}\n}", "get schedule() {\n\t\treturn this.__schedule;\n\t}", "function __time($obj) {\r\n if (window.STATICCLASS_CALENDAR==null) {\r\n window.STATICCLASS_CALENDAR = __loadScript(\"CalendarTime\", 1);\r\n }\r\n window.STATICCLASS_CALENDAR.perform($obj);\r\n}", "function tickCurrentTimeEngine() {\n\n var d = new Date();\n\n currentHours = d.getHours();\n currentMinutes = d.getMinutes();\n currentSeconds = d.getSeconds();\n\n if (currentHours.toString().length == 1) {\n choursDigit_1 = 0;\n choursDigit_2 = currentHours;\n }\n else {\n choursDigit_1 = parseInt(currentHours.toString().charAt(0), 10);\n choursDigit_2 = parseInt(currentHours.toString().charAt(1), 10);\n }\n\n if (currentMinutes.toString().length == 1) {\n cminutesDigit_1 = 0;\n cminutesDigit_2 = currentMinutes;\n }\n else {\n cminutesDigit_1 = parseInt(currentMinutes.toString().charAt(0), 10);\n cminutesDigit_2 = parseInt(currentMinutes.toString().charAt(1), 10);\n }\n\n if (currentSeconds.toString().length == 1) {\n csecondsDigit_1 = 0;\n csecondsDigit_2 = currentSeconds;\n }\n else {\n csecondsDigit_1 = parseInt(currentSeconds.toString().charAt(0), 10);\n csecondsDigit_2 = parseInt(currentSeconds.toString().charAt(1), 10);\n }\n\n tickCurrentTime = setTimeout(tickCurrentTimeEngine, timerCurrentTimeMiliSecs);\n\n return;\n }", "function morning() {\n // whole morning routine\n}", "function task4 () {\n\n function Clock (options) {\n this._template = options.template\n }\n \n Clock.prototype.render = function() {\n var date = new Date();\n var hours = date.getHours();\n if (hours < 10) hours = '0' + hours;\n var min = date.getMinutes();\n if (min < 10) min = '0' + min;\n var sec = date.getSeconds();\n if (sec < 10) sec = '0' + sec;\n var output = this._template.replace('h', hours)\n .replace('m', min)\n .replace('s', sec);\n console.log(output);\n };\n\n Clock.prototype.stop = function () {\n clearInterval(this._timer)\n }\n\n Clock.prototype.start = function() {\n this.render()\n this._timer = setInterval(this.render.bind(this), 1000)\n };\n\n\n\n // Descendant\n\n function RelativeClock(options) {\n Clock.apply(this, arguments) // coffee script super() :)\n this._precision = options.precision || 1000\n };\n\n RelativeClock.prototype = Object.create(Clock.prototype);\n RelativeClock.prototype.constructor = RelativeClock;\n\n RelativeClock.prototype.start = function() {\n this.render()\n this._timer = setInterval(this.render.bind(this), this._precision)\n };\n\n var rc = new RelativeClock({\n template: \"h:m:s\",\n precision: 10000\n })\n rc.start()\n}", "Schedule(){ren\n \tconsole.log(\"schedule\");\n \tif (this.flights.length == 0 )ren\n \t\treturn new Date();Charlie\n \tlet candidato = new Candidate();\n \tfor (let i = 0; i < this.flights.length; i++) {\n \t\tlet actualDate = newCharlie Date(this.flights[i].getTime() + 60000*10);\n \t\tif (this.CouldScheduleAt(actualDate)){\n \t\t\tconsole.log(actualDate.toLocaleTimeString());\n \t\t\treturn true;\n \t\t}\n \t\telse{\n \t\t\tactualDate = new Date(this.flights[i].getTime() - 60000*10);\n \t\t\tif (this.CouldScheduleAt(actualDate)){\n \t\t\t\tconsole.log(actualDate.toLocaleTimeString());\n \t\t\t\treturn true;\n \t\t\t}\n \t\t}\n \t\tif (i == this.flights.length - 1 ){\n \t\t\tconsole.log(actualDate.toLocaleTimeString());\n \t\t\treturn false;\n \t\t}ren\n \t}\n\n }", "function cronometro () { \n timeActual = new Date();\n acumularTime = timeActual - timeInicial;\n acumularTime2 = new Date();\n acumularTime2.setTime(acumularTime);\n ss = acumularTime2.getSeconds();\n mm = acumularTime2.getMinutes();\n hh = acumularTime2.getHours()-21;\n if (ss < 10) {ss = \"0\"+ss;} \n if (mm < 10) {mm = \"0\"+mm;}\n if (hh < 10) {hh = \"0\"+hh;}\n timer.innerHTML = hh+\" : \"+mm+\" : \"+ss;\n}", "getSchedule(){\n // return CRON schedule format\n // this sample job runs every 15 seconds\n return '*/15 * * * * *';\n }", "_scheduleEvents() {\n let now = clock.now();\n // number of events to schedule variaes based on the day of the week\n let dow = now.getDay();\n let numberOfEvents = (dow === 0 || dow === 7) ? this.weekendFrequency : this.weekDayFrequency;\n for (let i = 0; i < numberOfEvents; i++) {\n this.events.push(now.getTime() + Math.random() * MILLISECONDS_IN_DAY);\n }\n // sort ascending so we can quickly figure out the next time to run\n // after running, we'll remove it from the queue\n this.events.sort((a, b) => a - b);\n }", "static async _schedule() {\n\t\t// Register the task definition first\n\t\tconsole.log(\"SCHEDULE 1) Register Task Definition\");\n\t\tconst taskDefinition = await ECSManager.registerTaskDefinition();\n\t\tconst taskDefinitionArn = taskDefinition.taskDefinition.taskDefinitionArn;\n\n\t\t// Register a Cloudwatch event for this task definition as a cron job\n\t\tconsole.log(\"SCHEDULE 2) Register CloudWatch event\")\n\t\tconst targetSchedule = await CloudWatchManager.registerEvent(taskDefinitionArn);\n\t\treturn targetSchedule;\n\t}", "UnscheduleAt(time){\n \tconsole.log(\"unschedule\");\n }", "function schedule () {\n var future = next()\n var delta = Math.max(future.diff(moment()), 1000)\n\n debug(name + ': next run in ' + ms(delta) +\n ' at ' + future.format('llll Z'))\n\n if (timer) clearTimeout(timer)\n timer = setTimeout(run, delta)\n }", "function tickTheClock(){\n\n \n \n}", "computeNextExecution(task) {\n /**\n * If schedule is a number it means we are executing\n * on a delay of `schedule` milliseconds\n */\n if (typeof task.schedule === 'number') return task.schedule;\n\n let options = extend({}, task.scheduleOptions);\n\n /**\n * For testing etc we can specify a current date\n */\n if (!options.currentDate) {\n options.currentDate = DateTime.utc().toJSDate();\n }\n\n const interval = cron.parseExpression(task.schedule, options);\n\n const next = options.iterator ? interval.next().value.toDate() : interval.next().toDate();\n\n let now;\n\n if (task.scheduleOptions.tz) {\n DateTime.now().setZone(task.scheduleOptions.tz)\n } else {\n now = DateTime.utc().toJSDate()\n }\n\n //TODO: we should check the TTL, it should always be positive!\n let ttl = next.getTime() - now.getTime()\n\n return {\n ttl,\n interval,\n time: next.toLocaleTimeString(),\n };\n }", "onSleepingTime() {\n throw new NotImplementedException();\n }", "function Stopwatch() {}", "function Time() {}", "static cron(options) {\n try {\n jsiiDeprecationWarnings.aws_cdk_lib_aws_applicationautoscaling_CronOptions(options);\n }\n catch (error) {\n if (process.env.JSII_DEBUG !== \"1\" && error.name === \"DeprecationError\") {\n Error.captureStackTrace(error, this.cron);\n }\n throw error;\n }\n if (options.weekDay !== undefined && options.day !== undefined) {\n throw new Error('Cannot supply both \\'day\\' and \\'weekDay\\', use at most one');\n }\n const minute = fallback(options.minute, '*');\n const hour = fallback(options.hour, '*');\n const month = fallback(options.month, '*');\n const year = fallback(options.year, '*');\n // Weekday defaults to '?' if not supplied. If it is supplied, day must become '?'\n const day = fallback(options.day, options.weekDay !== undefined ? '?' : '*');\n const weekDay = fallback(options.weekDay, '?');\n return new class extends Schedule {\n constructor() {\n super(...arguments);\n this.expressionString = `cron(${minute} ${hour} ${day} ${month} ${weekDay} ${year})`;\n }\n _bind(scope) {\n if (!options.minute) {\n core_1.Annotations.of(scope).addWarning('cron: If you don\\'t pass \\'minute\\', by default the event runs every minute. Pass \\'minute: \\'*\\'\\' if that\\'s what you intend, or \\'minute: 0\\' to run once per hour instead.');\n }\n return new LiteralSchedule(this.expressionString);\n }\n };\n }", "function TimeScheduler() {\n this.timer = new Timer();\n\n /**\n * Holds an Array of timeouts : [timeout time, callback function]\n */\n this.timeouts = [];\n this.nTimeouts = 0;\n /**\n * Holds an Array of intervals : [interval starting time, interval time, callback function]\n */\n this.intervals = [];\n this.nIntervals = 0;\n\n this.clear();\n this.reset();\n }", "function sched () {\n pub()\n .then(function() {\n return Useful.handyTimer(ns.settings.redisSyncFrequency);\n }) \n .then(function() {\n sched();\n });\n }", "function schedule(elapsed) {\n\t self.state = SCHEDULED;\n\t if (self.delay <= elapsed) start(elapsed - self.delay);\n\t else self.timer.restart(start, self.delay, self.time);\n\t }", "function schedule(elapsed) {\n\t self.state = SCHEDULED;\n\t if (self.delay <= elapsed) start(elapsed - self.delay);\n\t else self.timer.restart(start, self.delay, self.time);\n\t }", "function schedule(elapsed) {\n\t self.state = SCHEDULED;\n\t if (self.delay <= elapsed) start(elapsed - self.delay);\n\t else self.timer.restart(start, self.delay, self.time);\n\t }", "function task3 () {\n //\n function Clock(options) {\n var template = options.template;\n var timer;\n \n function render() {\n var date = new Date();\n var hours = date.getHours();\n if (hours < 10) hours = '0' + hours;\n var min = date.getMinutes();\n if (min < 10) min = '0' + min;\n var sec = date.getSeconds();\n if (sec < 10) sec = '0' + sec;\n var output = template.replace('h', hours).replace('m', min).replace('s', sec);\n console.log(output);\n }\n this.stop = function() {\n clearInterval(timer);\n };\n this.start = function() {\n render();\n timer = setInterval(render, 1000);\n }\n }\n \n var cf = new Clock({\n template: 'h:m:s'\n });\n // cf.start();\n\n\n function ClockP (options) {\n this._template = options.template\n this._timer = null\n }\n\n ClockP.prototype.render = function() {\n var date = new Date();\n var hours = date.getHours();\n if (hours < 10) hours = '0' + hours;\n var min = date.getMinutes();\n if (min < 10) min = '0' + min;\n var sec = date.getSeconds();\n if (sec < 10) sec = '0' + sec;\n var output = this._template.replace('h', hours)\n .replace('m', min)\n .replace('s', sec);\n console.log(output);\n };\n\n ClockP.prototype.stop = function () {\n clearInterval(this._timer)\n }\n\n ClockP.prototype.start = function() {\n this.render()\n this._timer = setInterval(this.render.bind(this), 1000)\n };\n\n var cp = new ClockP({\n template: 'h:m:s'\n });\n cp.start();\n\n}", "function timeTest()\r\n{\r\n}", "function manualSchedule() {\r\n streamController_.manualSchedule();\r\n }", "function Scheduler(guild_id) {\n\tlet timeRule, timeJob, midnightRule, midnightJob;\n\tfunction init(time = \"00:00\", timezone, timeCommand, midnightCommand) {\n\t\ttimeRule = new schedule.RecurrenceRule();\n\t\tmidnightRule = new schedule.RecurrenceRule();\n\t\tif (timezone) {\n\t\t\ttimeRule.tz = timezone;\n\t\t\tmidnightRule.tz = timezone;\n\t\t}\n\t\t[timeRule.hour, timeRule.minute] = time.split(\":\").map(part => part * 1);\n\t\ttimeJob = schedule.scheduleJob(timeRule, (time) => {\n\t\t\ttry {\n\t\t\t\ttimeCommand(guild_id, time);\n\t\t\t} catch(e) {\n\t\t\t\tconsole.error(guild_id, time, e);\n\t\t\t}\n\t\t});\n\t\t[midnightRule.hour, midnightRule.minute] = [0, 0];\n\t\tmidnightJob = schedule.scheduleJob(midnightRule, (time) => {\n\t\t\ttry {\n\t\t\t\tmidnightCommand(guild_id, time);\n\t\t\t} catch(e) {\n\t\t\t\tconsole.error(guild_id, time, e);\n\t\t\t}\n\t\t});\n\t}\n\tfunction setTimezone(timezone) {\n\t\ttimeRule.tz = timezone;\n\t\ttimeJob.reschedule(timeRule);\n\t\tmidnightRule.tz = timezone;\n\t\tmidnightJob.reschedule(midnightRule);\n\t}\n\tfunction setTime(time = \"00:00\") {\n\t\t[timeRule.hour, timeRule.minute] = time.split(\":\").map(part => part * 1);\n\t\ttimeJob.reschedule(timeRule);\n\t}\n\tfunction destroy() {\n\t\ttimeJob.cancel();\n\t\tmidnightJob.cancel();\n\t\tdelete schedulers[guild_id];\n\t}\n\treturn {\n\t\tinit,\n\t\tsetTimezone,\n\t\tsetTime,\n\t\tdestroy\n\t}\n}", "run() {\n this.fillSportListAndTick();\n this.timerID = setInterval(() => {\n this.tick();\n console.log(\"ctr = \"+this.ctr);\n if (this.ctr < (ONE_DAY_IN_MS / LIVE_TICK_INTERVAL)) {\n this.ctr = this.ctr + 1;\n } else {\n this.ctr = 1;\n }\n }, LIVE_TICK_INTERVAL);\n }", "function updateTime() {\n\n}", "chronoStart(){\n this.start = new Date();\n this.chrono();\n }", "function intervalTasks() {\n calculateGreeting()\n displayTime()\n}", "function schedule(elapsed) {\n self.state = SCHEDULED;\n if (self.delay <= elapsed) start(elapsed - self.delay);\n else self.timer.restart(start, self.delay, self.time);\n }", "startTimer() {\n this.startTime = Date.now();\n }", "createTimer() {\n\t\t// set initial in seconds\n\t\tthis.initialTime = 0;\n\n\t\t// display text on Axis with formated Time\n\t\tthis.text = this.add.text(\n\t\t\t16,\n\t\t\t50,\n\t\t\t\"Time: \" + this.formatTime(this.initialTime)\n\t\t);\n\n\t\t// Each 1000 ms call onEvent\n\t\tthis.timedEvent = this.time.addEvent({\n\t\t\tdelay: 1000,\n\t\t\tcallback: this.onEvent,\n\t\t\tcallbackScope: this,\n\t\t\tloop: true,\n\t\t});\n\t}", "function runScheduler()\n{\n schedulerTick();\n setTimeout(runScheduler, scheduler_tick_interval);\n}", "get startTime() { return this._startTime; }", "function schedulePlan()\r\n{\r\n\tvar url = \"scheduled\";\r\n\tvar htmlAreaObj = _getWorkAreaDefaultObj();\r\n\tvar objAjax = htmlAreaObj.getHTMLAjax();\r\n\tvar objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n\r\n\tsectionName = objAjax.getDivSectionId();\r\n\t//alert(\"sectionName \" + sectionName);\r\n\tif(objAjax && objHTMLData)\r\n\t{\r\n\t\tif(!isValidRecord(true))\r\n\t\t{\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tbShowMsg = true;\r\n\t Main.loadWorkArea(\"techspecevents.do\", url);\t \r\n\t}\r\n}", "ticker() {\n if (!this.paused) {\n // Increment the tick counter:\n this.ticks++;\n this.scheduler();\n const _this = this;\n this._tickTimeout = setTimeout(() => {\n _this.ticker();\n }, this.__defaultInterval);\n }\n }", "overTime(){\n\t\t//\n\t}", "scheduleRefresh() {}", "scheduleRefresh() {}", "async flowSetupHook(flow) {\n /*\n EDEN TRIGGERS\n */\n\n // do initial triggers\n flow.trigger('cron', {\n icon : 'fa fa-clock',\n title : 'Date/Time',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n // set interval for query\n setInterval(async () => {\n // set query\n const q = query.lte('execute_at', new Date());\n\n // run with query\n await run({\n query : q,\n value : {},\n });\n }, 5000);\n }, (element, flowModel) => {\n // days\n const days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];\n\n // parse next date\n const previous = flowModel.get('executed_at') || new Date();\n let next = moment();\n\n // set time\n if (element.time) {\n // set time\n next.set({\n hour : parseInt(element.time.split(':')[0], 10),\n minute : parseInt(element.time.split(':')[1], 10),\n second : 0,\n });\n }\n\n // set day\n if (element.when === 'week') {\n // set next\n next = next.day(days.indexOf((element.day || 'monday').toLowerCase()) + 1);\n }\n\n // check last executed\n if (next.toDate() < new Date()) {\n // set day\n if (element.when === 'week') {\n // add one week\n next = next.add(7, 'days');\n } else if (element.when === 'month') {\n // add\n next = next.add(1, 'months');\n }\n }\n\n // set values\n flowModel.set('executed_at', previous);\n flowModel.set('execute_at', next.toDate());\n }, (data, flowModel) => {\n // check when\n if (flowModel.get('trigger.data.when') === 'week') {\n // set execute at\n flowModel.set('execute_at', moment(flowModel.get('execute_at')).add(7, 'days').toDate());\n } else if (flow.get('trigger.data.when') === 'month') {\n // set execute at\n flowModel.set('execute_at', moment(flowModel.get('execute_at')).add(1, 'month').toDate());\n }\n\n // set executed at\n flowModel.set('executed_at', new Date());\n });\n flow.trigger('hook', {\n icon : 'fa fa-play',\n title : 'Named Hook',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n // execute function\n const execute = (...subArgs) => {\n // find hook/type\n const { hook, type } = subArgs.find(s => s.hook && s.type);\n\n // check\n if (!hook || !type) return;\n\n // create trigger object\n const data = {\n opts : { type, hook, when : type === 'pre' ? 'before' : 'after' },\n value : { args : subArgs },\n query : query.where({\n 'trigger.data.when' : type === 'pre' ? 'before' : 'after',\n 'trigger.data.hook' : hook,\n }),\n };\n\n // run trigger\n run(data);\n };\n\n // add hooks\n this.eden.pre('*', execute);\n this.eden.post('*', execute);\n });\n flow.trigger('event', {\n icon : 'fa fa-calendar-exclamation',\n title : 'Named Event',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n // execute function\n const execute = (...subArgs) => {\n // find hook/type\n const { event } = subArgs.find(s => s.event);\n\n // check\n if (!event) return;\n\n // create trigger object\n const data = {\n opts : { event },\n value : { args : subArgs },\n query : query.where({\n 'trigger.data.event' : event,\n }),\n };\n\n // run trigger\n run(data);\n };\n\n // add hooks\n this.eden.on('*', execute);\n });\n flow.trigger('model', {\n icon : 'fa fa-calendar-exclamation',\n title : 'Model Change',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n // execute function\n const execute = (model, a, b) => {\n // check model\n if (!(model instanceof Model)) return;\n\n // set vars\n let hook;\n let type;\n\n // chec vars\n if (!b) {\n hook = a.hook;\n type = a.type;\n } else {\n hook = b.hook;\n type = b.type;\n }\n\n // check\n if (!hook || !type) return;\n\n // get model type\n const modelName = hook.split('.')[0];\n const updateType = hook.split('.')[1];\n\n // create trigger object\n const data = {\n opts : { type : updateType, name : modelName, when : type === 'pre' ? 'before' : 'after' },\n value : { model },\n query : query.where({\n 'trigger.data.when' : type === 'pre' ? 'before' : 'after',\n 'trigger.data.model' : modelName,\n 'trigger.data.event' : updateType,\n }),\n };\n\n // run trigger\n run(data);\n };\n\n // add hooks\n this.eden.pre('*.update', execute);\n this.eden.pre('*.remove', execute);\n this.eden.pre('*.create', execute);\n this.eden.post('*.update', execute);\n this.eden.post('*.remove', execute);\n this.eden.post('*.create', execute);\n });\n flow.trigger('value', {\n icon : 'fa fa-calendar-exclamation',\n title : 'Model Value',\n }, (action, render) => {\n\n }, (run, cancel, query) => {\n\n });\n\n /*\n EDEN ACTIONS\n */\n // do initial actions\n flow.action('event.trigger', {\n tag : 'event',\n icon : 'fa fa-play',\n title : 'Trigger Event',\n }, (action, render) => {\n\n }, (opts, element, data) => {\n // trigger event\n if ((element.config || {}).event) {\n // trigger event\n this.eden.emit(`flow:event.${element.config.event}`, data);\n }\n\n // return true\n return true;\n });\n // do initial actions\n flow.action('email.send', {\n tag : 'email',\n icon : 'fa fa-envelope',\n title : 'Send Email',\n }, (action, render) => {\n\n }, async (opts, element, data) => {\n // set config\n element.config = element.config || {};\n\n // clone data\n const newData = Object.assign({}, data);\n\n // send model\n if (newData.model instanceof Model) {\n // sanitise model\n newData.model = await newData.model.sanitise();\n }\n\n // send email\n await emailHelper.send((tmpl.tmpl(element.config.to || '', newData)).split(',').map(i => i.trim()), 'blank', {\n body : tmpl.tmpl(element.config.body || '', newData),\n subject : tmpl.tmpl(element.config.subject || '', newData),\n });\n\n // return true\n return true;\n });\n flow.action('hook.trigger', {\n tag : 'hook',\n icon : 'fa fa-calendar-exclamation',\n title : 'Trigger Hook',\n }, (action, render) => {\n\n }, async (opts, element, ...args) => {\n // trigger event\n if ((element.config || {}).hook) {\n // trigger event\n await this.eden.hook(`flow:hook.${element.config.hook}`, ...args);\n }\n\n // return true\n return true;\n });\n flow.action('model.query', {\n tag : 'model-query',\n icon : 'fa fa-plus',\n title : 'Find Model(s)',\n }, (action, render) => {\n\n }, async (opts, element, data) => {\n // query for data\n const Model = model(element.config.model);\n\n // create query\n let query = Model;\n\n // sanitise model\n if (data.model) data.model = await data.model.sanitise();\n\n // loop queries\n element.config.queries.forEach((q) => {\n // get values\n const { method, type } = q;\n let { key, value } = q;\n\n // data\n key = tmpl.tmpl(key, data);\n value = tmpl.tmpl(value, data);\n\n // check type\n if (type === 'number') {\n // parse\n value = parseFloat(value);\n } else if (type === 'boolean') {\n // set value\n value = value.toLowerCase() === 'true';\n }\n\n // add to query\n if (method === 'eq' || !method) {\n // query\n query = query.where({\n [key] : value,\n });\n } else if (['gt', 'lt'].includes(method)) {\n // set gt/lt\n query = query[method](key, value);\n } else if (method === 'ne') {\n // not equal\n query = query.ne(key, value);\n }\n });\n\n // return true\n return (await query.limit(element.config.count || 1).find()).map((item) => {\n // clone data\n const cloneData = Object.assign({}, data, {\n model : item,\n }, {});\n\n // return clone data\n return cloneData;\n });\n });\n flow.action('model.set', {\n tag : 'model-set',\n icon : 'fa fa-plus',\n title : 'Set Value',\n }, (action, render) => {\n\n }, async (opts, element, { model }) => {\n // sets\n element.config.sets.forEach((set) => {\n // set values\n let { value } = set;\n const { key, type } = set;\n\n // check type\n if (type === 'number') {\n // parse\n value = parseFloat(value);\n } else if (type === 'boolean') {\n // set value\n value = value.toLowerCase() === 'true';\n }\n\n // set\n model.set(key, value);\n });\n\n // save toSet\n await model.save();\n\n // return true\n return true;\n });\n flow.action('model.clone', {\n tag : 'model-clone',\n icon : 'fa fa-copy',\n title : 'Clone Model',\n }, (action, render) => {\n\n }, async (opts, element, data) => {\n // got\n const got = data.model.get();\n delete got._id;\n\n // new model\n const NewModel = model(data.model.constructor.name);\n const newModel = new NewModel(got);\n\n // set new model\n data.model = newModel;\n\n // return true\n return true;\n });\n flow.action('delay', {\n tag : 'delay',\n icon : 'fa fa-stopwatch',\n color : 'info',\n title : 'Time Delay',\n }, (action, render) => {\n\n }, (opts, element, data) => {\n return true;\n });\n\n // boolean check\n const filterCheck = async (opts, element, model) => {\n // set config\n element.config = element.config || {};\n\n // check model\n if ((element.config.type || 'value') === 'code') {\n // safe eval code\n return !!safeEval(element.config.code, model);\n }\n\n // get value\n let value = model[element.config.of];\n const is = element.config.is || 'eq';\n\n // check model\n if (model instanceof Model) {\n // get value from model\n value = await model.get(element.config.of);\n }\n\n // check\n if (is === 'eq' && value !== element.config.value) {\n // return false\n return false;\n }\n if (is === 'ne' && value === element.config.value) {\n // return false\n return false;\n }\n if (is === 'gt' && value < element.config.value) {\n // return false\n return false;\n }\n if (is === 'lt' && value > element.config.value) {\n // return false\n return false;\n }\n\n // return false at every opportunity\n return true;\n };\n\n // do initial logics\n flow.action('filter', {\n tag : 'filter',\n icon : 'fa fa-filter',\n color : 'warning',\n title : 'Conditional Filter',\n }, (action, render) => {\n\n }, filterCheck);\n flow.action('condition.split', {\n tag : 'split',\n icon : 'fa fa-code-merge',\n color : 'warning',\n title : 'Conditional Split',\n }, (action, render) => {\n\n }, async (opts, element, ...args) => {\n // set go\n const go = await filterCheck(opts, element, ...args);\n\n // get children\n const children = (element.children || [])[go ? 0 : 1] || [];\n\n // await trigger\n await FlowHelper.run(opts.flow, children, opts, ...args);\n\n // return true\n return true;\n });\n }", "eventTimer() {throw new Error('Must declare the function')}", "function tickTime() {\n // the magic object with all the time data\n // the present passing current moment\n let pc = {\n thisMoment: {},\n current: {},\n msInA: {},\n utt: {},\n passage: {},\n display: {}\n };\n\n // get the current time\n pc.thisMoment = {};\n pc.thisMoment = new Date();\n\n // slice current time into units\n pc.current = {\n ms: pc.thisMoment.getMilliseconds(),\n second: pc.thisMoment.getSeconds(),\n minute: pc.thisMoment.getMinutes(),\n hour: pc.thisMoment.getHours(),\n day: pc.thisMoment.getDay(),\n date: pc.thisMoment.getDate(),\n week: weekOfYear(pc.thisMoment),\n month: pc.thisMoment.getMonth(),\n year: pc.thisMoment.getFullYear()\n };\n\n // TODO: display day of week and month name\n let dayOfWeek = DAYS[pc.current.day];\n let monthName = MONTHS[pc.current.month];\n\n // returns the week no. out of the year\n function weekOfYear(d) {\n d.setHours(0, 0, 0);\n d.setDate(d.getDate() + 4 - (d.getDay() || 7));\n return Math.ceil(((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);\n }\n\n // set the slice conversions based on pc.thisMoment\n pc.msInA.ms = 1;\n pc.msInA.second = 1000;\n pc.msInA.minute = pc.msInA.second * 60;\n pc.msInA.hour = pc.msInA.minute * 60;\n pc.msInA.day = pc.msInA.hour * 24;\n pc.msInA.week = pc.msInA.day * 7;\n pc.msInA.month = pc.msInA.day * MONTH_DAYS[pc.current.month - 1];\n pc.msInA.year = pc.msInA.day * daysThisYear(pc.current.year);\n\n // handle leap years\n function daysThisYear(year) {\n if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {\n MONTH_DAYS[1] = 29;\n return 366;\n } else {\n return 365;\n }\n }\n\n // utt means UpToThis\n // calculates the count in ms of each unit that has passed\n pc.utt.ms = pc.current.ms;\n pc.utt.second = pc.current.second * pc.msInA.second + pc.utt.ms;\n pc.utt.minute = pc.current.minute * pc.msInA.minute + pc.utt.second;\n pc.utt.hour = pc.current.hour * pc.msInA.hour + pc.utt.minute;\n pc.utt.day = pc.current.day * pc.msInA.day + pc.utt.hour;\n pc.utt.week = pc.current.week * pc.msInA.week + pc.utt.day;\n pc.utt.date = pc.current.date * pc.msInA.day + pc.utt.hour;\n pc.utt.month = pc.current.month + 1 * pc.msInA.month + pc.utt.date;\n pc.utt.year = pc.current.year * pc.msInA.year + pc.utt.month;\n\n // calculates the proportion/ratio of each unit that has passed\n // used to display percentages\n pc.passage = {\n ms: pc.current.ms / 100,\n second: pc.current.ms / pc.msInA.second,\n minute: pc.utt.second / pc.msInA.minute,\n hour: pc.utt.minute / pc.msInA.hour,\n day: pc.utt.hour / pc.msInA.day,\n week: pc.utt.day / pc.msInA.week,\n month: pc.utt.date / pc.msInA.month,\n year: pc.utt.month / pc.msInA.year\n };\n\n // tidies up the current clock readouts for display\n pc.display = {\n ms: pc.utt.ms,\n second: pc.current.second,\n minute: pc.current.minute.toString().padStart(2, \"0\"),\n hour: pc.current.hour.toString().padStart(2, \"0\"),\n day: pc.current.date,\n week: pc.current.week,\n month: pc.current.month.toString().padStart(2, \"0\"),\n year: pc.current.year\n };\n\n if (debug) {\n console.dir(pc);\n }\n\n // returns the ratios and the clock readouts\n return { psg: pc.passage, dsp: pc.display };\n}", "get isStartable() { return (Now < this.endTime.plus(minutes(60))) && (Now > this.startTime.minus(minutes(60))) }", "update(timeStep) {\n\n }", "isScheduled() {\r\n return this.timeoutToken !== -1;\r\n }", "static cron(options) {\n if (options.weekDay !== undefined && options.day !== undefined) {\n throw new Error('Cannot supply both \\'day\\' and \\'weekDay\\', use at most one');\n }\n const minute = fallback(options.minute, '*');\n const hour = fallback(options.hour, '*');\n const month = fallback(options.month, '*');\n const day = fallback(options.day, '*');\n const weekDay = fallback(options.weekDay, '*');\n return new LiteralSchedule(`${minute} ${hour} ${day} ${month} ${weekDay}`);\n }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "handler() {\n this.totalMilliseconds = this.time;\n this.endTime = this.now() + this.time;\n\n if (this.autoStart) {\n this.start();\n }\n }", "function RequestScheduler() {}", "function tick() {\n setTime(howOld(createdOn));\n }", "checkPeriodicalTasks() {\n // Now is now\n var now = new Date(this.time.getTime());\n\n // If the farm fields are valid\n if (window.game.farm && window.game.farm.farmFields) {\n // Go through each farm field\n window.game.farm.farmFields.forEach(function(farmField, i) {\n // If there's a seed planted on them\n if (farmField.seed && farmField.seedItem) {\n // Check on which stage they are by comparing the time and their different stages\n var currentStage = 0;\n farmField.stages.forEach(function(stage, index) {\n if (stage.getTime() <= now.getTime()) {\n currentStage = index + 1;\n }\n })\n\n // If the stage is above zero, update the farm field to actually receive the new stage\n if (currentStage > 0) {\n farmField.setStage(currentStage);\n }\n }\n });\n }\n\n // If the fruit trees are valid\n if (window.game.farm && window.game.farm.fruitTrees) {\n // Go through each fruit tree\n window.game.farm.fruitTrees.forEach(function(fruitTree, i) {\n // If the fruit tree has a next ripe time set and it should be ripe by now and it isn't locked, set it to be ripe\n if (fruitTree.nextRipe && fruitTree.nextRipe.getTime() <= now.getTime() && !fruitTree.isRipe && !fruitTree.isLocked) {\n fruitTree.setRipe(true);\n }\n })\n }\n\n // Check if we should update a season\n // Season dates are\n // 01.03 - spring\n // 01.06 - summer\n // 01.09 - autumn\n // 01.12 - winter\n var month = this.time.getMonth();\n\n // If the current month (months start from 0 in js) is dividable through 3 and seasons didn't change already\n if ((month+1) % 3 == 0 && !this.didSeasonChange) {\n // Trigger a season change\n window.game.map.nextSeason();\n\n // Set this flag so the if statement above won't be fired again\n this.didSeasonChange = true;\n } \n // Check if the month IS NOT dividable through 3 and the flag is set\n else if ((month+1) % 3 != 0 && this.didSeasonChange) {\n // in that case, we can safely reset it to let the first if statement fire next roud\n this.didSeasonChange = false;\n }\n\n // Check for crop growth every 3 seconds (real time!)\n setTimeout(this.checkPeriodicalTasks.bind(this), 3*1000);\n }", "function $hs_schedule(args, onComplete, onException) {\n var f = args[0];\n var a = Array.prototype.slice.call(args, 1, args.length);\n $tr_Scheduler.start(new $tr_Jump(f.hscall, f, a), onComplete, onException);\n}", "getStartTime() {\n return this.startTime;\n }", "setupSchedule(){\n // setup the schedule\n\n SchedulerUtils.addInstructionsToSchedule(this);\n\n let n_trials = (this.practice)? constants.PRACTICE_LEN : 25;\n // added for feedback\n this.feedbacks = [];\n for(let i= 0;i<n_trials;i++)\n {\n this.add(this.loopHead);\n this.add(this.loopBodyEachFrame);\n this.add(this.loopEnd);\n\n // added for feedback\n if(this.practice){\n this.feedbacks.push(new Scheduler(this.psychojs));\n this.add(this.feedbacks[i]);\n }\n }\n this.add(this.saveData);\n }", "function Clock() {\n\n var daysInAMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\n this.month = 1;\n this.day = 1;\n this.year = 2016;\n\n this.tick = function() {\n this.day += 1;\n\n if (this.day > daysInAMonth[this.month - 1]) {\n this.month += 1;\n this.day = 1;\n }\n\n }\n\n this.time = function() {\n \tvar month = this.month < 10 ? \"0\" + this.month : this.month;\n \tvar day = this.day < 10 ? \"0\" + this.day : this.day;\n console.log(`${this.year}-${month}-${day}`)\n }\n\n this.getTime = function() {\n var month = this.month < 10 ? \"0\" + this.month : this.month;\n \tvar day = this.day < 10 ? \"0\" + this.day : this.day;\n return `${this.year}-${month}-${day}`;\n }\n\n}", "function calculateTime() {\n displayTime(Date.now() - startTime);\n}", "twelveClock () {\n const shiftAM = () => this.#hour < 4\n ? eveningGreet.run()\n : morningGreet.run()\n\n const shiftPM = () => this.#hour > 4 && this.#hour !== 12\n ? eveningGreet.run()\n : afternoonGreet.run()\n\n return this.#shift === 'AM'\n ? shiftAM()\n : shiftPM()\n }", "start() {\n // Run immediately..\n this.runUpdate();\n\n // .. then schedule 15 min interval\n timers.setInterval(() => {\n this.runUpdate();\n }, 900000);\n }", "function schedule() {\n var now = new Date().getTime(), delta = now - lastCycleTime, timeout = (30 * 60 * 1000) - delta, then = new Date(now + timeout);\n if (timeout < 100) timeout = 100;\n setTimeout(start, timeout);\n console.log(\"\\nNext cycle time:\", then.toLocaleString());\n}", "function updateTime(){\n setTimeContent(\"timer\");\n}", "function runAndScheduleTask () {\n\t\ttask( scheduleNextExecution );\n\t}", "tick() {\n let prevSecond = this.createDigits(this.vDigits(this.timeString()));\n\n this.checkAlarm();\n\n setTimeout(() => {\n this.get();\n this.update(cacheDOM.timeDisplay, this.createDigits(this.vDigits(this.timeString())), prevSecond);\n this.tick();\n }, 1000)\n }", "getTime(){return this.time;}", "function scheduler(part) {\n let relativeMod = relativeTime % part.loopTime,\n lookAheadMod = lookAheadTime % part.loopTime;\n\n if (lookAheadMod < relativeMod && part.iterator > 1) {\n part.iterator = 0;\n } \n\n while (part.iterator < part.schedule.length &&\n part.schedule[part.iterator].when < lookAheadMod) {\n\n part.queue(part.schedule[part.iterator].when - relativeMod);\n part.iterator += 1;\n }\n }", "function scheduler(part) {\n let relativeMod = relativeTime % part.loopTime,\n lookAheadMod = lookAheadTime % part.loopTime;\n\n if (lookAheadMod < relativeMod && part.iterator > 1) {\n part.iterator = 0;\n } \n\n while (part.iterator < part.schedule.length &&\n part.schedule[part.iterator].when < lookAheadMod) {\n\n part.queue(part.schedule[part.iterator].when - relativeMod);\n part.iterator += 1;\n }\n }", "resetSchedule() {\n this._scheduler.resetSchedule();\n }", "function Timer() {}", "tick() {\n\t\t// debug\n\t\t// console.log(\"atomicGLClock::tick\");\t\n var timeNow = new Date().getTime();\n\n if (this.lastTime != 0)\n \tthis.elapsed = timeNow - this.lastTime;\n\n this.lastTime = timeNow;\n }", "changeStartTime(startTime){\n this.startTime = startTime;\n }", "applyWorkingTime(timeAxis) {\n const me = this,\n config = me._workingTime;\n\n if (config) {\n let hour = null; // Only use valid values\n\n if (config.fromHour >= 0 && config.fromHour < 24 && config.toHour > config.fromHour && config.toHour <= 24 && config.toHour - config.fromHour < 24) {\n hour = {\n from: config.fromHour,\n to: config.toHour\n };\n }\n\n let day = null; // Only use valid values\n\n if (config.fromDay >= 0 && config.fromDay < 7 && config.toDay > config.fromDay && config.toDay <= 7 && config.toDay - config.fromDay < 7) {\n day = {\n from: config.fromDay,\n to: config.toDay\n };\n }\n\n if (hour || day) {\n timeAxis.include = {\n hour,\n day\n };\n } else {\n // No valid rules, restore timeAxis\n timeAxis.include = null;\n }\n } else {\n // No rules, restore timeAxis\n timeAxis.include = null;\n }\n\n if (me.isPainted) {\n var _me$features$columnLi;\n\n // Refreshing header, which also recalculate tickSize and header data\n me.timeAxisColumn.refreshHeader(); // Update column lines\n\n (_me$features$columnLi = me.features.columnLines) === null || _me$features$columnLi === void 0 ? void 0 : _me$features$columnLi.refresh(); // Animate event changes\n\n me.refreshWithTransition();\n }\n }", "now () {\n return this.t;\n }", "applyWorkingTime(timeAxis) {\n const me = this,\n config = me._workingTime;\n\n if (config) {\n let hour = null;\n // Only use valid values\n if (\n config.fromHour >= 0 &&\n config.fromHour < 24 &&\n config.toHour > config.fromHour &&\n config.toHour <= 24 &&\n config.toHour - config.fromHour < 24\n ) {\n hour = { from: config.fromHour, to: config.toHour };\n }\n\n let day = null;\n // Only use valid values\n if (\n config.fromDay >= 0 &&\n config.fromDay < 7 &&\n config.toDay > config.fromDay &&\n config.toDay <= 7 &&\n config.toDay - config.fromDay < 7\n ) {\n day = { from: config.fromDay, to: config.toDay };\n }\n\n if (hour || day) {\n timeAxis.include = {\n hour,\n day\n };\n } else {\n // No valid rules, restore timeAxis\n timeAxis.include = null;\n }\n } else {\n // No rules, restore timeAxis\n timeAxis.include = null;\n }\n\n if (me.rendered) {\n // Refreshing header, which also recalculate tickSize and header data\n me.timeAxisColumn.refreshHeader();\n // Update column lines\n if (me.features.columnLines) {\n me.features.columnLines.drawLines();\n }\n\n // Animate event changes\n me.refreshWithTransition();\n }\n }", "constructor(){\n this.startTime = 0;\n this.endTime = 0; \n this.running = 0;\n this.duration = 0;\n }", "scheduleWatchMessages() {\n this.cronJob = schedule(checkFrequency, this.checkNewMessages.bind(this), {});\n }", "function startTime() {\n var today = new Date();\n var hourNow = today.getHours();\n var h = formatHour(hourNow);\n var m = today.getMinutes();\n var ap = formatAmPm(hourNow);\n if(m==0) {\n writeDate();\n }\n m = checkTime(m);\n document.getElementById('clock').innerHTML = h + ':' + m + ap;\n var t = setTimeout(startTime, 10000);\n}", "get_timeSet() {\n return this.liveFunc._timeSet;\n }", "function Scheduler() {\n this.tasks = [];\n this.current_running = 0;\n this.enabled = false;\n this.running = {};\n}", "function scheduleTick(rootContext,flags){var nothingScheduled=rootContext.flags===0/* Empty */;rootContext.flags|=flags;if(nothingScheduled&&rootContext.clean==_CLEAN_PROMISE){var res_1;rootContext.clean=new Promise(function(r){return res_1=r;});rootContext.scheduler(function(){if(rootContext.flags&1/* DetectChanges */){rootContext.flags&=~1/* DetectChanges */;tickRootContext(rootContext);}if(rootContext.flags&2/* FlushPlayers */){rootContext.flags&=~2/* FlushPlayers */;var playerHandler=rootContext.playerHandler;if(playerHandler){playerHandler.flushPlayers();}}rootContext.clean=_CLEAN_PROMISE;res_1(null);});}}", "function TimeUtils() {}", "function scheduleNextExecution () {\n\t\tif ( status == \"running\" ) {\n\t\t\ttimerId = setTimeout( runAndScheduleTask, interval );\n\t\t}\n\t}", "timer() {\n this.sethandRotation('hour');\n this.sethandRotation('minute');\n this.sethandRotation('second');\n }", "constructor() {\n /** Indicates if the clock is endend. */\n this.endedLocal = false;\n /** The duration between start and end of the clock. */\n this.diff = null;\n this.startTimeLocal = new Date();\n this.hrtimeLocal = process.hrtime();\n }", "resume(){\n\t\tvar _self = this\n\t\tvar dur = new Date( _self.currentTime )\n\t\tthis.tick( dur.getUTCMinutes() )\n\t\tconsole.log(\"timer resumed\")\n\t}", "function scheduler() {\n if (!play) {\n return;\n }\n while (nextNoteTime < context.currentTime + scheduleAheadTime) {\n commandList.forEach(function (c) {\n return c.play(cursor);\n });\n nextNote();\n }\n}", "initChronometer() {\n let self = this;\n\n setInterval(() => {\n self.allDuration();\n }, 1000);\n\n }", "function next(){ // runs current scheduled task and creates timeout to schedule next\n\t\tif(task !== null){ // is task scheduled??\n\t\t\ttask.func(); // run it\n\t\t\ttask = null; // clear task\n\t\t}\n\t\tif(queue.length > 0){ // are there any remain tasks??\n\t\t\ttask = queue.shift(); // yes set as next task\n\t\t\ttHandle = setTimeout(next,task.time) // schedual when\n\t\t}else{\n\t\t\tAPI.done = true;\n\t\t}\n\t}", "function updateSchedule() {\n // clear all textblocks\n $(\"textarea\").empty();\n // check the time and formatting]\n styleSchedule(startHr, endHr);\n // insert the text items\n // i is the id of the textarea associated\n // with each hour on the schedule\n for (i = startHr; i <= endHr; i++) {\n indx = i - startHr;\n var nextEl = $(`#${i}`);\n nextEl.text(scheduleList[indx].task);\n }\n }", "getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n\n this.lifeTime = this.time - this.startTime;\n \n \n }", "function createTimeDrivenTriggers() {\n // Trigger every 6 hours.\n ScriptApp.newTrigger('myFunction')\n .timeBased()\n .everyHours(6)\n .create();\n // Trigger every Monday at 09:00.\n ScriptApp.newTrigger('myFunction')\n .timeBased()\n .onWeekDay(ScriptApp.WeekDay.MONDAY)\n .atHour(9)\n .create();\n}" ]
[ "0.6416027", "0.6408302", "0.63115746", "0.62752646", "0.62608033", "0.62101203", "0.61650443", "0.61095214", "0.6015887", "0.5985229", "0.59624815", "0.59351104", "0.5895897", "0.5881284", "0.5830455", "0.5811016", "0.5795725", "0.5775376", "0.57715", "0.57437265", "0.5733257", "0.56578195", "0.56393665", "0.5629156", "0.561515", "0.55869395", "0.55837786", "0.5547538", "0.55332357", "0.5529204", "0.5529204", "0.5529204", "0.55043876", "0.5502614", "0.5500715", "0.5488461", "0.5484539", "0.5484311", "0.54842967", "0.5473574", "0.5458078", "0.54548216", "0.54511625", "0.54502976", "0.54437023", "0.5443256", "0.54351884", "0.5426672", "0.54219425", "0.54219425", "0.5414837", "0.5409172", "0.5395589", "0.5392481", "0.5389904", "0.5377731", "0.53469247", "0.5346616", "0.5346616", "0.53419", "0.533841", "0.5329606", "0.5319567", "0.5319538", "0.5316337", "0.5308291", "0.5300458", "0.527308", "0.5263869", "0.5262108", "0.52596205", "0.52540964", "0.5252081", "0.52469957", "0.52394325", "0.52267224", "0.52267224", "0.52267116", "0.5225651", "0.52222985", "0.52194977", "0.5212188", "0.5204083", "0.52039814", "0.52002025", "0.51927525", "0.5189826", "0.51843715", "0.51832086", "0.5178657", "0.5174342", "0.51681244", "0.51619637", "0.51585823", "0.515806", "0.5157653", "0.5157465", "0.515051", "0.5144879", "0.51386195", "0.51357555" ]
0.0
-1
TimeEngine method (transported interface)
syncPosition(time, position, speed) { if (this.__period > 0) { var nextPosition = (Math.floor(position / this.__period) + this.__phase) * this.__period; if (speed > 0 && nextPosition < position) nextPosition += this.__period; else if (speed < 0 && nextPosition > position) nextPosition -= this.__period; return nextPosition; } return Infinity * speed; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tickCurrentTimeEngine() {\n\n var d = new Date();\n\n currentHours = d.getHours();\n currentMinutes = d.getMinutes();\n currentSeconds = d.getSeconds();\n\n if (currentHours.toString().length == 1) {\n choursDigit_1 = 0;\n choursDigit_2 = currentHours;\n }\n else {\n choursDigit_1 = parseInt(currentHours.toString().charAt(0), 10);\n choursDigit_2 = parseInt(currentHours.toString().charAt(1), 10);\n }\n\n if (currentMinutes.toString().length == 1) {\n cminutesDigit_1 = 0;\n cminutesDigit_2 = currentMinutes;\n }\n else {\n cminutesDigit_1 = parseInt(currentMinutes.toString().charAt(0), 10);\n cminutesDigit_2 = parseInt(currentMinutes.toString().charAt(1), 10);\n }\n\n if (currentSeconds.toString().length == 1) {\n csecondsDigit_1 = 0;\n csecondsDigit_2 = currentSeconds;\n }\n else {\n csecondsDigit_1 = parseInt(currentSeconds.toString().charAt(0), 10);\n csecondsDigit_2 = parseInt(currentSeconds.toString().charAt(1), 10);\n }\n\n tickCurrentTime = setTimeout(tickCurrentTimeEngine, timerCurrentTimeMiliSecs);\n\n return;\n }", "function Time() {}", "get time () { throw \"Game system not supported\"; }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "function TimeUtils() {}", "getTime(){return this.time;}", "function Engine() {\n }", "onTimeChanged () {\n this.view.renderTimeAndDate();\n }", "function tickTime() {\n // the magic object with all the time data\n // the present passing current moment\n let pc = {\n thisMoment: {},\n current: {},\n msInA: {},\n utt: {},\n passage: {},\n display: {}\n };\n\n // get the current time\n pc.thisMoment = {};\n pc.thisMoment = new Date();\n\n // slice current time into units\n pc.current = {\n ms: pc.thisMoment.getMilliseconds(),\n second: pc.thisMoment.getSeconds(),\n minute: pc.thisMoment.getMinutes(),\n hour: pc.thisMoment.getHours(),\n day: pc.thisMoment.getDay(),\n date: pc.thisMoment.getDate(),\n week: weekOfYear(pc.thisMoment),\n month: pc.thisMoment.getMonth(),\n year: pc.thisMoment.getFullYear()\n };\n\n // TODO: display day of week and month name\n let dayOfWeek = DAYS[pc.current.day];\n let monthName = MONTHS[pc.current.month];\n\n // returns the week no. out of the year\n function weekOfYear(d) {\n d.setHours(0, 0, 0);\n d.setDate(d.getDate() + 4 - (d.getDay() || 7));\n return Math.ceil(((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);\n }\n\n // set the slice conversions based on pc.thisMoment\n pc.msInA.ms = 1;\n pc.msInA.second = 1000;\n pc.msInA.minute = pc.msInA.second * 60;\n pc.msInA.hour = pc.msInA.minute * 60;\n pc.msInA.day = pc.msInA.hour * 24;\n pc.msInA.week = pc.msInA.day * 7;\n pc.msInA.month = pc.msInA.day * MONTH_DAYS[pc.current.month - 1];\n pc.msInA.year = pc.msInA.day * daysThisYear(pc.current.year);\n\n // handle leap years\n function daysThisYear(year) {\n if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {\n MONTH_DAYS[1] = 29;\n return 366;\n } else {\n return 365;\n }\n }\n\n // utt means UpToThis\n // calculates the count in ms of each unit that has passed\n pc.utt.ms = pc.current.ms;\n pc.utt.second = pc.current.second * pc.msInA.second + pc.utt.ms;\n pc.utt.minute = pc.current.minute * pc.msInA.minute + pc.utt.second;\n pc.utt.hour = pc.current.hour * pc.msInA.hour + pc.utt.minute;\n pc.utt.day = pc.current.day * pc.msInA.day + pc.utt.hour;\n pc.utt.week = pc.current.week * pc.msInA.week + pc.utt.day;\n pc.utt.date = pc.current.date * pc.msInA.day + pc.utt.hour;\n pc.utt.month = pc.current.month + 1 * pc.msInA.month + pc.utt.date;\n pc.utt.year = pc.current.year * pc.msInA.year + pc.utt.month;\n\n // calculates the proportion/ratio of each unit that has passed\n // used to display percentages\n pc.passage = {\n ms: pc.current.ms / 100,\n second: pc.current.ms / pc.msInA.second,\n minute: pc.utt.second / pc.msInA.minute,\n hour: pc.utt.minute / pc.msInA.hour,\n day: pc.utt.hour / pc.msInA.day,\n week: pc.utt.day / pc.msInA.week,\n month: pc.utt.date / pc.msInA.month,\n year: pc.utt.month / pc.msInA.year\n };\n\n // tidies up the current clock readouts for display\n pc.display = {\n ms: pc.utt.ms,\n second: pc.current.second,\n minute: pc.current.minute.toString().padStart(2, \"0\"),\n hour: pc.current.hour.toString().padStart(2, \"0\"),\n day: pc.current.date,\n week: pc.current.week,\n month: pc.current.month.toString().padStart(2, \"0\"),\n year: pc.current.year\n };\n\n if (debug) {\n console.dir(pc);\n }\n\n // returns the ratios and the clock readouts\n return { psg: pc.passage, dsp: pc.display };\n}", "overTime(){\n\t\t//\n\t}", "function updateTime() {\n\n}", "function task4 () {\n\n function Clock (options) {\n this._template = options.template\n }\n \n Clock.prototype.render = function() {\n var date = new Date();\n var hours = date.getHours();\n if (hours < 10) hours = '0' + hours;\n var min = date.getMinutes();\n if (min < 10) min = '0' + min;\n var sec = date.getSeconds();\n if (sec < 10) sec = '0' + sec;\n var output = this._template.replace('h', hours)\n .replace('m', min)\n .replace('s', sec);\n console.log(output);\n };\n\n Clock.prototype.stop = function () {\n clearInterval(this._timer)\n }\n\n Clock.prototype.start = function() {\n this.render()\n this._timer = setInterval(this.render.bind(this), 1000)\n };\n\n\n\n // Descendant\n\n function RelativeClock(options) {\n Clock.apply(this, arguments) // coffee script super() :)\n this._precision = options.precision || 1000\n };\n\n RelativeClock.prototype = Object.create(Clock.prototype);\n RelativeClock.prototype.constructor = RelativeClock;\n\n RelativeClock.prototype.start = function() {\n this.render()\n this._timer = setInterval(this.render.bind(this), this._precision)\n };\n\n var rc = new RelativeClock({\n template: \"h:m:s\",\n precision: 10000\n })\n rc.start()\n}", "function classTime(C_E,desc,day,start,fin,loc,start_date){\n this.C_E = C_E;\n this.desc = desc;\n this.day = day;\n this.start = start;\n this.fin = fin;\n this.loc = loc;\n this.start_date = start_date;\n}", "function __time($obj) {\r\n if (window.STATICCLASS_CALENDAR==null) {\r\n window.STATICCLASS_CALENDAR = __loadScript(\"CalendarTime\", 1);\r\n }\r\n window.STATICCLASS_CALENDAR.perform($obj);\r\n}", "function timeTest()\r\n{\r\n}", "function startTime() {\n setTimer();\n}", "constructor() {\n /** Indicates if the clock is endend. */\n this.endedLocal = false;\n /** The duration between start and end of the clock. */\n this.diff = null;\n this.startTimeLocal = new Date();\n this.hrtimeLocal = process.hrtime();\n }", "function Stopwatch() {}", "function task3 () {\n //\n function Clock(options) {\n var template = options.template;\n var timer;\n \n function render() {\n var date = new Date();\n var hours = date.getHours();\n if (hours < 10) hours = '0' + hours;\n var min = date.getMinutes();\n if (min < 10) min = '0' + min;\n var sec = date.getSeconds();\n if (sec < 10) sec = '0' + sec;\n var output = template.replace('h', hours).replace('m', min).replace('s', sec);\n console.log(output);\n }\n this.stop = function() {\n clearInterval(timer);\n };\n this.start = function() {\n render();\n timer = setInterval(render, 1000);\n }\n }\n \n var cf = new Clock({\n template: 'h:m:s'\n });\n // cf.start();\n\n\n function ClockP (options) {\n this._template = options.template\n this._timer = null\n }\n\n ClockP.prototype.render = function() {\n var date = new Date();\n var hours = date.getHours();\n if (hours < 10) hours = '0' + hours;\n var min = date.getMinutes();\n if (min < 10) min = '0' + min;\n var sec = date.getSeconds();\n if (sec < 10) sec = '0' + sec;\n var output = this._template.replace('h', hours)\n .replace('m', min)\n .replace('s', sec);\n console.log(output);\n };\n\n ClockP.prototype.stop = function () {\n clearInterval(this._timer)\n }\n\n ClockP.prototype.start = function() {\n this.render()\n this._timer = setInterval(this.render.bind(this), 1000)\n };\n\n var cp = new ClockP({\n template: 'h:m:s'\n });\n cp.start();\n\n}", "applyWorkingTime(timeAxis) {\n const me = this,\n config = me._workingTime;\n\n if (config) {\n let hour = null;\n // Only use valid values\n if (\n config.fromHour >= 0 &&\n config.fromHour < 24 &&\n config.toHour > config.fromHour &&\n config.toHour <= 24 &&\n config.toHour - config.fromHour < 24\n ) {\n hour = { from: config.fromHour, to: config.toHour };\n }\n\n let day = null;\n // Only use valid values\n if (\n config.fromDay >= 0 &&\n config.fromDay < 7 &&\n config.toDay > config.fromDay &&\n config.toDay <= 7 &&\n config.toDay - config.fromDay < 7\n ) {\n day = { from: config.fromDay, to: config.toDay };\n }\n\n if (hour || day) {\n timeAxis.include = {\n hour,\n day\n };\n } else {\n // No valid rules, restore timeAxis\n timeAxis.include = null;\n }\n } else {\n // No rules, restore timeAxis\n timeAxis.include = null;\n }\n\n if (me.rendered) {\n // Refreshing header, which also recalculate tickSize and header data\n me.timeAxisColumn.refreshHeader();\n // Update column lines\n if (me.features.columnLines) {\n me.features.columnLines.drawLines();\n }\n\n // Animate event changes\n me.refreshWithTransition();\n }\n }", "currentTime() {\n this.time24 = new Time();\n this.updateTime(false);\n }", "function SimulationEngine() {\n\t\t\n\t}", "function tickTheClock(){\n\n \n \n}", "function engine() {\n \n run = false;\n leg = length;\n \n while(leg--) {\n \n itm = dictionary[leg];\n \n if(!itm) break;\n if(itm.isCSS) continue;\n \n if(itm.cycle()) {\n \n run = true;\n\n }\n else {\n \n itm.stop(false, itm.complete, false, true);\n \n }\n \n }\n \n if(request) {\n \n if(run) {\n \n request(engine);\n \n }\n else {\n \n cancel(engine);\n itm = trans = null;\n \n }\n \n }\n else {\n \n if(run) {\n \n if(!engineRunning) timer = setInterval(engine, intervalSpeed);\n \n }\n else {\n \n clearInterval(timer);\n itm = trans = null;\n \n }\n \n }\n \n engineRunning = run;\n \n }", "function updateTime() {\n console.log(\"updateTime()\");\n store.timeModel.update();\n}", "get_timeSet() {\n return this.liveFunc._timeSet;\n }", "function Clock() {\n\n var daysInAMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\n this.month = 1;\n this.day = 1;\n this.year = 2016;\n\n this.tick = function() {\n this.day += 1;\n\n if (this.day > daysInAMonth[this.month - 1]) {\n this.month += 1;\n this.day = 1;\n }\n\n }\n\n this.time = function() {\n \tvar month = this.month < 10 ? \"0\" + this.month : this.month;\n \tvar day = this.day < 10 ? \"0\" + this.day : this.day;\n console.log(`${this.year}-${month}-${day}`)\n }\n\n this.getTime = function() {\n var month = this.month < 10 ? \"0\" + this.month : this.month;\n \tvar day = this.day < 10 ? \"0\" + this.day : this.day;\n return `${this.year}-${month}-${day}`;\n }\n\n}", "function onSystemTimeChanged() {\r\n updateTime();\r\n }", "function setTime( t ){\n\n this.time = t;\n\n }", "getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n\n this.lifeTime = this.time - this.startTime;\n \n \n }", "get elapsedTime() {\n return this._t;\n }", "function startTime()\n{\n //get how long does it take for the smallest unit to elapse to set timeouts\n var timeout = time.units[time.units.length-1];\n\n //put the name into the text\n $(\"[class^=timeName]\").html(time.name);\n\n //clocks\n localTime();\n currentFictional(timeout);\n countdownToBegin(timeout);\n\n //converters\n $(\"#eyToTimeY\").submit(function(event){\n event.preventDefault();\n $(\"#eyToTimeYResult\").text( earthYearsToTimeYears($(\"#eyToTimeYInput\").val()) );\n });\n\n //SUT year to Earth year\n $(\"#timeToEY\").submit(function(event){\n event.preventDefault();\n $(\"#timeToEYResult\").text( timeYearsToEarthYears($(\"#timeToEYInput\").val()) );\n });\n\n //setup date picker for Earth year\n $(\"#eDToTimeInput\").fdatepicker({format:\"yyyy-mm-dd\"});\n //Earth date to SUT\n $(\"#eDToTime\").submit(function(event){\n event.preventDefault();\n $(\"#eDToTimeResult\").text( earthDateToTime($(\"#eDToTimeInput\").val()) );\n });\n\n}", "function timebase() {\n\t//timebased will interupt all other routines once started, until shutdown\n\t\n\t//TODO: turn timebase off completely by killing the interval function.\n\tif (timebase_status != \"running\") {\n\t\treturn;\n\t}\n\n\tvar current_hour = date.getHours();\n\tvar current_month = date.getMonth();\n\n\t//Daytime (7:00 - 19:00)\n\tif (current_hour >= 7 && current_hour < 18+season_sunset_offset) {\n\t\t//TODO: fade in from sunrise to sunrise+1hr\n\t\t\n\t\t//TODO: change hue/sat value in feedback loop from color zone sensor!\n\t\t\n\t\t//Turn on when active.\n\t\tif (hasActive(detectionData)) {\n\t\t\tstateChange('on');\n\t\t}\n\t//Nighttime (19:00 - 2:00)\n\t} else if (current_hour >= 18+season_sunset_offset || current_hour < 2) {\n\t\t//TODO: Flux full transition from 19:00 to 21:30\n\t\t\n\t\t//Turn on when active.\n\t\tif (hasActive(detectionData)) {\n\t\t\tstateChange('on');\n\t\t}\n\t}\n\t//Supernight (2:00 - 7:00)\n\telse if (current_hour >= 2 && current_hour < 7) {\n\t\t//Turn on when active.\n\t\t//TODO: only 10% brightness.\n\t\tif (hasActive(detectionData)) {\n\t\t\tstateChange('on'); //TODO: Per zone.\n\t\t}\n\t}\n\n\t//TODO: grab realtime sunrise/set data from internet\n\t//Sunrise accent effect\n\tif (0) {\n\t\t//TODO: Flash accents red, yellow, blue\n\t}\n\n\t//Sunset accent effect\n\tif (0) {\n\t\t//TODO: Flash accents red, yellow, blue\n\t}\n\n\t//TODO: grab data from ical file off the internet every day. \n\t//Calendar effects\n\tif (0) { //if event_start\n\t\t//TODO: Flash accents red, yellow, blue\n\t}\n\n\t//check for securityMode\n\tif (hasActive(detectionData) && securityMode) {\n\t\t//disable it\n\t\tsecurityMode = false;\n\t\t//TODO: Flash welcome home accent pattern.\n\t}\n\n\t//Seasonal changes\n\t//Summer- push sunset back.\n\tif (current_month > 4 || current_month < 9) {\n\t\tseason_sunset_offset = 1.5;\n\t}\n\t\n\t//TODO: Update the light/history database here.\n\t//TODO: Check if database has no records for last 24 hours\n\t//Security Mode: simulate house\n\tif (0) {\n\t\tvar securityMode = true;\n\t\t//TODO: Implment security mode\n\t}\n\t//TODO: Parse duke api for warnings\n\tif (0) {\n\t\t//TODO: Check if it's an updated posting or not, and if so, flash accents red/yellow every 30s until disabled.\n\t}\n\n}", "update(timeStep) {\n\n }", "function LogicNodeTime() {\n\t\tLogicNode.call(this);\n\t\tthis.wantsProcessCall = true;\n\t\tthis.logicInterface = LogicNodeTime.logicInterface;\n\t\tthis.type = 'LogicNodeTime';\n\t\tthis._time = 0;\n\t\tthis._running = true;\n\t}", "function calcEquationOfTime(t) {\n\t var epsilon = calcObliquityCorrection(t);\n\t var l0 = calcGeomMeanLongSun(t);\n\t var e = calcEccentricityEarthOrbit(t);\n\t var m = calcGeomMeanAnomalySun(t);\n\n\t var y = Math.tan(degToRad(epsilon) / 2.0);\n\t y *= y;\n\n\t var sin2l0 = Math.sin(2.0 * degToRad(l0));\n\t var sinm = Math.sin(degToRad(m));\n\t var cos2l0 = Math.cos(2.0 * degToRad(l0));\n\t var sin4l0 = Math.sin(4.0 * degToRad(l0));\n\t var sin2m = Math.sin(2.0 * degToRad(m));\n\n\t var Etime = y * sin2l0 - 2.0 * e * sinm + 4.0 * e * y * sinm * cos2l0 - 0.5 * y * y * sin4l0 - 1.25 * e * e * sin2m;\n\t return radToDeg(Etime) * 4.0; // in minutes of time\n\t}", "createTimer() {\n\t\t// set initial in seconds\n\t\tthis.initialTime = 0;\n\n\t\t// display text on Axis with formated Time\n\t\tthis.text = this.add.text(\n\t\t\t16,\n\t\t\t50,\n\t\t\t\"Time: \" + this.formatTime(this.initialTime)\n\t\t);\n\n\t\t// Each 1000 ms call onEvent\n\t\tthis.timedEvent = this.time.addEvent({\n\t\t\tdelay: 1000,\n\t\t\tcallback: this.onEvent,\n\t\t\tcallbackScope: this,\n\t\t\tloop: true,\n\t\t});\n\t}", "function KalturaTimeWarnerService(client){\n\tthis.init(client);\n}", "function TimeStamp() {}", "function TimeStamp() {}", "get startTime() { return this._startTime; }", "applyWorkingTime(timeAxis) {\n const me = this,\n config = me._workingTime;\n\n if (config) {\n let hour = null; // Only use valid values\n\n if (config.fromHour >= 0 && config.fromHour < 24 && config.toHour > config.fromHour && config.toHour <= 24 && config.toHour - config.fromHour < 24) {\n hour = {\n from: config.fromHour,\n to: config.toHour\n };\n }\n\n let day = null; // Only use valid values\n\n if (config.fromDay >= 0 && config.fromDay < 7 && config.toDay > config.fromDay && config.toDay <= 7 && config.toDay - config.fromDay < 7) {\n day = {\n from: config.fromDay,\n to: config.toDay\n };\n }\n\n if (hour || day) {\n timeAxis.include = {\n hour,\n day\n };\n } else {\n // No valid rules, restore timeAxis\n timeAxis.include = null;\n }\n } else {\n // No rules, restore timeAxis\n timeAxis.include = null;\n }\n\n if (me.isPainted) {\n var _me$features$columnLi;\n\n // Refreshing header, which also recalculate tickSize and header data\n me.timeAxisColumn.refreshHeader(); // Update column lines\n\n (_me$features$columnLi = me.features.columnLines) === null || _me$features$columnLi === void 0 ? void 0 : _me$features$columnLi.refresh(); // Animate event changes\n\n me.refreshWithTransition();\n }\n }", "changeStartTime(startTime){\n this.startTime = startTime;\n }", "twelveClock () {\n const shiftAM = () => this.#hour < 4\n ? eveningGreet.run()\n : morningGreet.run()\n\n const shiftPM = () => this.#hour > 4 && this.#hour !== 12\n ? eveningGreet.run()\n : afternoonGreet.run()\n\n return this.#shift === 'AM'\n ? shiftAM()\n : shiftPM()\n }", "get(){\n\t\t// debug\n\t\t// console.log(\"atomicGLClock::get\");\t\n\t\treturn this.elapsed;\n\t}", "liveTime() {\n\t\tthis.updateTime();\n\t\tthis.writeLog();\n\t}", "onSleepingTime() {\n throw new NotImplementedException();\n }", "function templateEngine () { }", "function test_timepicker_should_pass_correct_timing_on_service_order() {}", "function Time() {\n this._clock = void 0;\n this._timeScale = void 0;\n this._deltaTime = void 0;\n this._startTime = void 0;\n this._lastTickTime = void 0;\n this._clock = wechatAdapter.performance ? wechatAdapter.performance : Date;\n this._timeScale = 1.0;\n this._deltaTime = 0.0001;\n\n var now = this._clock.now();\n\n this._startTime = now;\n this._lastTickTime = now;\n }", "getStartTime() {\n return this.startTime;\n }", "function timecalc(hoursBack) {\r\n // Function to return current time for use to calculate the timeframe parameter for the parkingEvents query. \r\n // The function minus the number of hours back accuratly articulates to the api what \r\n // timeframe should be viewed.\r\n var date = new Date()\r\n return Date.UTC(date.getUTCFullYear(),date.getUTCMonth(), date.getUTCDate() , \r\n date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds())-(hoursBack*60*60*1000); \r\n }", "timerTick(e) {\n console.log(\"This method should be overridden in child classes.\");\n }", "constructor(schedule) {\n\n }", "function morning() {\n // whole morning routine\n}", "setTime(ts) {\nreturn this.timeStamp = ts;\n}", "constructor(engine) {\n this.engine = engine;\n }", "function getInitialTime() {\n changeTime();\n}", "constructor (){\n\t\tsuper();\n\n\t\tthis.getTheTime = this.getTheTime.bind(this);\n\n\t\t/**\n\t\t * Setup the time variable to update every second\n\t\t */\n\t\t\n\t\tthis.state = {\n\t\t\ttime: null\n\t\t}\n\n\t\tthis.getTheTime();\n\t}", "function OnTimeModule() {\n\t\tthis.name = \"OnTime.Module\";\n\t}", "computeTime() {\n let year;\n const fields = this.fields;\n if (this.isSet(YEAR)) {\n year = fields[YEAR];\n } else {\n year = new Date().getFullYear();\n }\n let timeOfDay = 0;\n if (this.isSet(HOUR_OF_DAY)) {\n timeOfDay += fields[HOUR_OF_DAY];\n }\n timeOfDay *= 60;\n timeOfDay += fields[MINUTE] || 0;\n timeOfDay *= 60;\n timeOfDay += fields[SECONDS] || 0;\n timeOfDay *= 1000;\n timeOfDay += fields[MILLISECONDS] || 0;\n let fixedDate = 0;\n fields[YEAR] = year;\n fixedDate = fixedDate + this.getFixedDate();\n // millis represents local wall-clock time in milliseconds.\n let millis = (fixedDate - EPOCH_OFFSET) * ONE_DAY + timeOfDay;\n millis -= this.timezoneOffset * ONE_MINUTE;\n this.time = millis;\n this.computeFields();\n }", "get time() {\n return this._time;\n }", "function erlang(servers, time) {\n return (servers * time)/3600;\n}", "_specializedInitialisation()\r\n\t{\r\n\t\tLogger.log(\"Specialisation for service AVTransport\", LogType.Info);\r\n\t\tvar relativeTime = this.getVariableByName(\"RelativeTimePosition\");\r\n\t\t//Implémentation pour OpenHome\r\n\t\tif (!relativeTime)\r\n\t\t\trelativeTime = this.getVariableByName(\"A_ARG_TYPE_GetPositionInfo_RelTime\");\r\n\t\tvar transportState = this.getVariableByName(\"TransportState\");\r\n\t\t//Implémentation pour OpenHome\r\n\t\tif (!transportState)\r\n\t\t\ttransportState = this.getVariableByName(\"A_ARG_TYPE_GetTransportInfo_CurrentTransportState\");\r\n\r\n\t\tif (transportState)\r\n\t\t{\r\n\t\t\ttransportState.on('updated', (variable, newVal) =>\r\n\t\t\t{\r\n\t\t\t\tLogger.log(\"On transportStateUpdate : \" + newVal, LogType.DEBUG);\r\n\t\t\t\tvar actPosInfo = this.getActionByName(\"GetPositionInfo\");\r\n\t\t\t\tvar actMediaInfo = this.getActionByName(\"GetMediaInfo\");\r\n\t\t\t\t/*\r\n\t\t\t\t“STOPPED” R\r\n\t\t\t\t“PLAYING” R\r\n\t\t\t\t“TRANSITIONING” O\r\n\t\t\t\t”PAUSED_PLAYBACK” O\r\n\t\t\t\t“PAUSED_RECORDING” O\r\n\t\t\t\t“RECORDING” O\r\n\t\t\t\t“NO_MEDIA_PRESENT”\r\n\t\t\t\t */\r\n\t\t\t\tif (relativeTime && !relativeTime.SendEvent && actPosInfo)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (this._intervalUpdateRelativeTime)\r\n\t\t\t\t\t\tclearInterval(this._intervalUpdateRelativeTime);\r\n\t\t\t\t\tif (newVal == \"PLAYING\" || newVal == \"RECORDING\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tactPosInfo.execute(\t{\tInstanceID: 0\t} );\r\n\t\t\t\t\t\t//Déclenche la maj toutes les 4 secondes\r\n\t\t\t\t\t\tthis._intervalUpdateRelativeTime = setInterval(() =>{\r\n\t\t\t\t\t\t\t\t//Logger.log(\"On autoUpdate\", LogType.DEBUG);\r\n\t\t\t\t\t\t\t\tactPosInfo.execute(\t{\tInstanceID: 0\t}\t);\r\n\t\t\t\t\t\t\t}, 4000);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//else if (newVal == \"STOPPED\" || newVal == \"PAUSED_PLAYBACK\" || newVal == \"PAUSED_RECORDING\" || newVal == \"NO_MEDIA_PRESENT\")\r\n\t\t\t\t//{\r\n\t\t\t\t//\r\n\t\t\t\t//}\r\n\t\t\t\t//On met a jour les media info et position info pour etre sur de mettre a jour les Metadata(par defaut la freebox ne le fait pas ou plutot le fait mal)\r\n\t\t\t\tif (newVal == \"TRANSITIONING\")\r\n\t\t\t\t{\r\n\t\t\t\t\tif (actPosInfo)\r\n\t\t\t\t\t\tactPosInfo.execute(\t{InstanceID: 0}\t);\r\n\t\t\t\t\tif (actMediaInfo)\r\n\t\t\t\t\t\tactMediaInfo.execute(\t{InstanceID: 0} );\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (newVal == \"STOPPED\")\r\n\t\t\t\t{\r\n\t\t\t\t\tif (actPosInfo)\r\n\t\t\t\t\t\tactPosInfo.execute(\t{\tInstanceID: 0\t});\r\n\t\t\t\t\tif (actMediaInfo)\r\n\t\t\t\t\t\tactMediaInfo.execute(\t{\tInstanceID: 0 });\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}", "constructor() {\n\n this.timedEntities = []; // Will hold list of entities being tracked\n this.activeEntity = null; // This is the entity we are currently timing\n this.intervalTimer = null; // Will hold reference after we start setInterval\n this.chartTimer = null; // Will hold referenec to the setInterval for updating the charts\n this.timingActive = false; // Are we currently running the timer?\n this.totalTicksActive = 0; // seconds that the timer has been running\n // Store the timestamp in ms of the last time a tick happened in case the\n // app gets backgrounded and JS execution stops. Can then add in the right\n // number of secconds after\n this.lastTickTime = -1;\n this.turnList = []; // Will hold a set of dictionaries defining each time the speaker changed.\n this.minTurnLength = 10; // seconds; the time before a turn is shown on the timeline\n\n this.meetingName = \"\";\n this.attributeNameGender = \"Gender\";\n this.attributeNameSecondary = \"Secondary Attribute\";\n this.attributeNameTertiary = \"Tertiary Attribute\";\n }", "getPlayTime() {\n return this.time;\n }", "scheduler() {\n this.maybeTickSongChart();\n\n // When nextNoteTime (in the future) is near (gap is determined by \n // scheduleAheadTime), schedule audio & visuals and advance to the next\n // note.\n while (this.nextNoteTime <\n (this.audioContext.currentTime + this.scheduleAheadTime)) {\n this.scheduleNote(this.current16thNote, this.nextNoteTime);\n this.nextNote();\n }\n }", "initCurrentTimeLine() {\n const me = this,\n now = new Date();\n\n if (me.currentTimeLine || !me.showCurrentTimeLine) {\n return;\n }\n\n me.currentTimeLine = new me.store.modelClass({\n // eslint-disable-next-line quote-props\n 'id': 'currentTime',\n cls: 'b-sch-current-time',\n startDate: now,\n name: DateHelper.format(now, me.currentDateFormat)\n });\n me.updateCurrentTimeLine = me.updateCurrentTimeLine.bind(me);\n me.currentTimeInterval = me.setInterval(me.updateCurrentTimeLine, me.updateCurrentTimeLineInterval);\n\n if (me.client.isPainted) {\n me.renderRanges();\n }\n }", "get time() {}", "now () {\n return this.t;\n }", "function yFindRealTimeClock(func)\n{\n return YRealTimeClock.FindRealTimeClock(func);\n}", "setTime(time) {\n this.time = time;\n return this;\n }", "function timerWrapper () {}", "get elapsedTime() {\n return this._elapsedTime\n }", "function updateTime(){\n setTimeContent(\"timer\");\n}", "function setTime(){\n let dt = new Date();\n currScene.timeInScene = dt.getTime();\n}", "function timeUpdate() {\n timeEngaged += delta();\n}", "tickCaller(game){\n game.tick();\n }", "function localClock(){\n digitalClock(0,\"clock\");\n digitalClock(-7,\"clockNy\")\n digitalClock(8,\"tokyo\") \n}", "eventTimer() {throw new Error('Must declare the function')}", "function Schedule(options,element){return _super.call(this,options,element)||this;}", "time(time) {\n if (time == null) {\n return this._time;\n }\n\n let dt = time - this._time;\n this.step(dt);\n return this;\n }", "timer() {\n this.sethandRotation('hour');\n this.sethandRotation('minute');\n this.sethandRotation('second');\n }", "tick() {\n\t\t// debug\n\t\t// console.log(\"atomicGLClock::tick\");\t\n var timeNow = new Date().getTime();\n\n if (this.lastTime != 0)\n \tthis.elapsed = timeNow - this.lastTime;\n\n this.lastTime = timeNow;\n }", "get time () {\n\t\treturn this._time;\n\t}", "function time(){\n\t $('#Begtime').mobiscroll().time({\n\t theme: 'wp',\n\t display: 'inline',\n\t mode: 'scroller'\n\t });\n\t $('#Endtime').mobiscroll().time({\n\t theme: 'wp',\n\t display: 'inline',\n\t mode: 'scroller'\n\t });\n\t removeUnwanted(); \n\t insertClass(); \n\t getTimeFromInput(\"Begtime\");\n\t getTimeFromInput(\"Endtime\");\n\t}", "function Timer() {}", "init(...args) {\n\t\tthis._super(...args);\n\n\t\tthis.setupTime();\n\t}", "_setTime() {\n switch(this.difficultyLevel) {\n case 1:\n // this.gameTime uses ms\n this.gameTime = 45000;\n break;\n case 2:\n this.gameTime = 100000;\n break;\n case 3:\n this.gameTime = 160000;\n break;\n case 4:\n this.gameTime = 220000;\n break;\n default:\n throw new Error('there is no time');\n }\n }", "function TimeManager() {\n var self = this;\n\n this.init = function () {\n self.initTime = (new Date()).getTime() / 1000;\n self.offset = 0;\n self.speed = 1;\n self.query_params = self.get_query_param();\n if (self.query_params.hasOwnProperty('time')) {\n self.offset = parseInt(self.query_params.time);\n }\n else if (self.query_params.hasOwnProperty('from')) {\n self.offset = parseInt(self.query_params.from);\n }\n if (self.offset) {\n self.speed = 20;\n }\n\n if (self.query_params.hasOwnProperty('speed')) {\n self.speed = parseFloat(self.query_params.speed);\n }\n };\n\n this.getTime = function() {\n var realTime = self.getRealTime();\n if (self.offset) {\n return self.offset + (realTime - self.initTime) * self.speed;\n }\n\n return realTime;\n };\n\n this.getRealTime = function () {\n return (new Date()).getTime() / 1000;\n };\n\n // Extracts query params from url.\n this.get_query_param = function () {\n var query_string = {};\n var query = window.location.search.substring(1);\n var pairs = query.split('&');\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split('=');\n\n // If first entry with this name.\n if (typeof query_string[pair[0]] === 'undefined') {\n query_string[pair[0]] = decodeURIComponent(pair[1]);\n }\n // If second entry with this name.\n else if (typeof query_string[pair[0]] === 'string') {\n query_string[pair[0]] = [\n query_string[pair[0]],\n decodeURIComponent(pair[1])\n ];\n }\n // If third or later entry with this name\n else {\n query_string[pair[0]].push(decodeURIComponent(pair[1]));\n }\n }\n\n return query_string;\n };\n\n this.init();\n\n return this;\n}", "update_() {\n var current = this.tlc_.getCurrent();\n this.scope_['time'] = current;\n var t = new Date(current);\n\n var coord = this.coord_ || MapContainer.getInstance().getMap().getView().getCenter();\n\n if (coord) {\n coord = olProj.toLonLat(coord, osMap.PROJECTION);\n\n this.scope_['coord'] = coord;\n var sets = [];\n\n // sun times\n var suntimes = SunCalc.getTimes(t, coord[1], coord[0]);\n var sunpos = SunCalc.getPosition(t, coord[1], coord[0]);\n\n // Determine dawn/dusk based on user preference\n var calcTitle;\n var dawnTime;\n var duskTime;\n\n switch (settings.getInstance().get(SettingKey.DUSK_MODE)) {\n case 'nautical':\n calcTitle = 'Nautical calculation';\n dawnTime = suntimes.nauticalDawn.getTime();\n duskTime = suntimes.nauticalDusk.getTime();\n break;\n case 'civilian':\n calcTitle = 'Civilian calculation';\n dawnTime = suntimes.dawn.getTime();\n duskTime = suntimes.dusk.getTime();\n break;\n case 'astronomical':\n default:\n calcTitle = 'Astronomical calculation';\n dawnTime = suntimes.nightEnd.getTime();\n duskTime = suntimes.night.getTime();\n break;\n }\n\n var times = [{\n 'label': 'Dawn',\n 'time': dawnTime,\n 'title': calcTitle,\n 'color': '#87CEFA'\n }, {\n 'label': 'Sunrise',\n 'time': suntimes.sunrise.getTime(),\n 'color': '#FFA500'\n }, {\n 'label': 'Solar Noon',\n 'time': suntimes.solarNoon.getTime(),\n 'color': '#FFD700'\n }, {\n 'label': 'Sunset',\n 'time': suntimes.sunset.getTime(),\n 'color': '#FFA500'\n }, {\n 'label': 'Dusk',\n 'time': duskTime,\n 'title': calcTitle,\n 'color': '#87CEFA'\n }, {\n 'label': 'Night',\n 'time': suntimes.night.getTime(),\n 'color': '#000080'\n }];\n\n this.scope_['sun'] = {\n 'altitude': sunpos.altitude * geo.R2D,\n 'azimuth': (geo.R2D * (sunpos.azimuth + Math.PI)) % 360\n };\n\n // moon times\n var moontimes = SunCalc.getMoonTimes(t, coord[1], coord[0]);\n var moonpos = SunCalc.getMoonPosition(t, coord[1], coord[0]);\n var moonlight = SunCalc.getMoonIllumination(t);\n\n this.scope_['moonAlwaysDown'] = moontimes.alwaysDown;\n this.scope_['moonAlwaysUp'] = moontimes.alwaysUp;\n\n if (moontimes.rise) {\n times.push({\n 'label': 'Moonrise',\n 'time': moontimes.rise.getTime(),\n 'color': '#ddd'\n });\n }\n\n if (moontimes.set) {\n times.push({\n 'label': 'Moonset',\n 'time': moontimes.set.getTime(),\n 'color': '#2F4F4F'\n });\n }\n\n var phase = '';\n for (var i = 0, n = PHASES.length; i < n; i++) {\n if (moonlight.phase >= PHASES[i].min && moonlight.phase < PHASES[i].max) {\n phase = PHASES[i].label;\n break;\n }\n }\n\n this.scope_['moon'] = {\n 'alwaysUp': moontimes.alwaysUp,\n 'alwaysDown': moontimes.alwaysDown,\n 'azimuth': (geo.R2D * (moonpos.azimuth + Math.PI)) % 360,\n 'altitude': moonpos.altitude * geo.R2D,\n 'brightness': Math.ceil(moonlight.fraction * 100) + '%',\n 'phase': phase\n };\n\n times = times.filter(filter);\n times.forEach(addTextColor);\n googArray.sortObjectsByKey(times, 'time');\n sets.push(times);\n\n this.scope_['times'] = times;\n ui.apply(this.scope_);\n }\n }", "function playInst(inst, startTime, stopTime){\n\n var inst = inst;\n var startTime = startTime;\n var stopTime = stopTime;\n\n inst.startAtTime(globalNow+startTime);\n inst.stopAtTime(globalNow+stopTime);\n\n}", "constructor() {\r\n super();\r\n /**\r\n * Previous measurement time\r\n * @private\r\n * @type {number}\r\n */\r\n this.oldTime_;\r\n }", "getGameTime() {\n return this.time / 1200;\n }", "onChange(e) {\n if (this.props.onChange) {\n this.props.onChange(e);\n }\n window.$('#' + this.id).timepicker('setTime', e.target.value);\n }", "update(scene, time, delta) {\n // Tick the time (setting the milliseconds will automatically convert up into seconds/minutes/hours)\n this.time.setMilliseconds(this.time.getMilliseconds() + (delta * this.speed * CONSTANTS.SIMULATION_SPEED_FACTOR));\n\n // Update the sky's ambient color\n this.updateAmbientLightColor();\n\n // Check if we can emit an event to the event emitter to notify about the time of day\n // Only emits once, thats why we have the flags\n if (this.time.getHours() == 8 && !this.calledMorning) {\n this.events.emit(\"morning\");\n\n this.calledMorning = true;\n this.calledNoon = false;\n this.calledEvening = false;\n this.calledNight = false;\n } else if (this.time.getHours() == 12 && !this.calledNoon) {\n this.events.emit(\"noon\");\n\n this.calledMorning = false;\n this.calledNoon = true;\n this.calledEvening = false;\n this.calledNight = false; \n } else if (this.time.getHours() == 18 && !this.calledEvening) {\n this.events.emit(\"evening\");\n\n this.calledMorning = false;\n this.calledNoon = false;\n this.calledEvening = true;\n this.calledNight = false; \n } else if (this.time.getHours() == 21 && !this.calledNight) {\n this.events.emit(\"night\");\n\n this.calledMorning = false;\n this.calledNoon = false;\n this.calledEvening = false;\n this.calledNight = true; \n }\n }", "function interval(){\r\n\ttry{\r\n\t\tthis.startTime = function (){\t\r\n\t\t\ttry{\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tvar today=new Date();\r\n\t\t\t\t\tvar h=today.getHours();\r\n\t\t\t\t\tvar m=today.getMinutes();\r\n\t\t\t\t\tvar startm = today.getMinutes();\r\n var s=today.getSeconds();\r\n\t\t\t\t\t// add a zero in front of numbers<10\r\n\t\t\t\t\tm=this.checkTime(m);\r\n\t\t\t\t\ts=this.checkTime(s);\r\n\r\n $('txt').innerHTML= h+\":\"+m+\":\"+s;\r\n\t\t\t\t\t$('clock').value = m;\t\t\r\n\t\t\t\t\tt=setTimeout('intervalObj.startTime()',500);\t\t\t\t\t\r\n\t\t\t\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.startTime()');\r\n\t\t\t}\r\n\t\t}\r\n\t\t// add a zero in front of numbers<10\r\n\t\tthis.checkTime = function(i){\r\n\t\t\ttry{\r\n\t\t\t\tif (i<10){\r\n\t\t\t\t\ti=\"0\" + i;\r\n\t\t\t\t}\r\n\t\t\t\treturn i;\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.checkTime()');\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t//End of clock function\r\n\t\t//To start the clock on web page.\r\n\t\t\r\n\t\tthis.call = function(){\r\n\t\t\ttry{\r\n\r\n\t\t\t\t$('text').value=$('txt').innerHTML;\r\n\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.call()');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//To stop the clock.\r\n\t\tthis.stopTime = function(){\r\n\t\t\ttry{\r\n\t\t\t\t$('txtTime').value=$('txt').innerHTML;\r\n document.getElementById(\"txt\").style.display = 'none';\r\n\r\n }catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.stopTime()');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//To calculate the total time difference.\r\n\t\tthis.calculateTotalTime = function() {\r\n\t\t\ttry{\r\n\t\t\t\tvar t1=$('text').value;\r\n\t\t\t\tvar t2=$('txtTime').value;\r\n\t\t\t\tvar arrt1 = t1.split(\":\");\r\n\t\t\t\tvar arrt2 = t2.split(\":\");\t\t\r\n\t\t\t\tvar sub=(((arrt2[0]*3600)+(arrt2[1]*60)+(arrt2[2])*1)-((arrt1[0]*3600)+(arrt1[1]*60)+(arrt1[2])*1));\r\n\t\t\t\tvar timeDifference=this.convertTime(sub);\t\t\r\n\t\t\treturn timeDifference;\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.calculateTotalTime()');\r\n\t\t\t}\t\r\n\t\t}\r\n this.calculatebatsmanTime = function(t1,t2) {\r\n\t\t\ttry{\r\n\t\t\t\r\n\t\t\t\tvar arrt1 = t1.split(\":\");\r\n\t\t\t\tvar arrt2 = t2.split(\":\");\r\n\t\t\t\tvar sub=(((arrt2[0]*3600)+(arrt2[1]*60)+(arrt2[2])*1)-((arrt1[0]*3600)+(arrt1[1]*60)+(arrt1[2])*1));\r\n\t\t\t\tvar timeDifference=this.convertTime(sub);\r\n\t\t\treturn timeDifference;\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.calculateTotalTime()');\r\n\t\t\t}\r\n\t\t}\r\n\r\n //To Convert time.\r\n\t\tthis.convertTime = function(sub){\r\n\t\t\ttry{\r\n\t\t\t\tvar hrs=parseInt(sub/3600);\t\t\r\n\t\t\t\tvar rem=(sub%3600);\r\n\t\t\t\tvar min=parseInt(rem/60);\r\n\t\t\t\tvar sec=(rem%60);\r\n\t\t\t\tmin=this.checkTime(min);\r\n\t\t\t\tsec=this.checkTime(sec);\r\n\t\t\t\tvar convertDifference=(hrs+\":\"+min+\":\"+sec);\r\n\t\t\treturn convertDifference;\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.convertTime()');\r\n\t\t\t}\t\r\n\t\t}\t\t\r\n\t\t//To display the time period of interruptions and intervals.\r\n\t\t\r\n\t\tthis.DisplayInterval=function(flag){\r\n\t\r\n\t\t\tvar MATCH_TIME_ACC=42000;//700min.\r\n\t\t\tvar MATCH_INNING_ACC=21000;//350min.\r\n\t\r\n\t\t\ttry{\r\n\t\t\t\tif($('text').value==\"\" && $('txtTime').value==\"\"){\r\n\t\t\t\t\talert(\"You Did Not Start Timer\");\r\n\t\t\t\t}else if(flag==1){\t\t\r\n\t\t\t\t\talert(\"Interruption Time is:: \"+this.calculateTotalTime());\r\n\t\t\t\t}else if(flag==2){\t\r\n\t\t\t\t\t//Interval-Injury\r\n\t\t\t\t\tvar time=this.calculateTotalTime();\r\n\t\t\t\t\tvar arrtime = time.split(\":\");\r\n\t\t\t\t\tvar sec=(arrtime[0]*3600)+(arrtime[1]*60)+(arrtime[2]*1);\r\n\t\t\t\t\tMATCH_TIME_ACC=MATCH_TIME_ACC+sec;//Adding minits in match_time account.\r\n\t\t\t\t\tvar matchTime=this.convertTime(MATCH_TIME_ACC);\r\n\t\t\t\t\r\n\t\t\t\t}else if(flag==3){\r\n\t\t\t\t\t\t//Interval-Drink\r\n\t\t\t\t\t\tvar time=this.calculateTotalTime();\r\n\t\t\t\t\t\tvar arrtime = time.split(\":\");\r\n\t\t\t\t\t\tvar sec=(arrtime[0]*3600)+(arrtime[1]*60)+(arrtime[2]*1);\r\n\t\t\t\t\t\tMATCH_TIME_ACC=MATCH_TIME_ACC+sec;//Adding minits in match_time account.\r\n\t\t\t\t\t\tvar matchTime=this.convertTime(MATCH_TIME_ACC);\r\n\t\t\t\t\t\tMATCH_INNING_ACC=MATCH_INNING_ACC+sec;//Adding minits in match_inning Account\r\n\t\t\t\t\t\tvar inningTime=this.convertTime(MATCH_INNING_ACC);\r\n\t\t\t\t}else if(flag==4){\r\n\t\t\t\t\t\t//Interval-Lunch/Tea.\r\n\t\t\t\t\t\tthis.calculateTotalTime();\r\n\t\t\t\t}\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.DisplayInterval()');\r\n\t\t\t}\t\r\n\t\t}\t\r\n\t\t\r\n\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval()');\r\n\t}\t\t\r\n}", "function newRE(name) {\n\n // Object holding defaults for various saved fields.\n var virginData = {\n type: \"pk_rhythm_engine\",\n version: 1,\n morpher: {x: 36, y: 36},\n kits: [],\n voices: [],\n presets: [],\n clock: {struc: \"simple\", sig: 0, bar: 0, beat: 0, pos: 0, tempo_bpm: 90, cycleLength: 16, running: false}\n };\n\n // data will be saved and loaded to localStorage.\n var data = copy_object(virginData);\n\n var clockLastTime_secs = undefined;\n var lastTickTime_secs = 0;\n var kDelay_secs = 0.05;\n var clockJSN = undefined;\n\n // Load info about existing kits into the engine.\n function initData() {\n var k, ki;\n for (k in availableKitInfos) {\n ki = availableKitInfos[k];\n data.kits.push({\n name: ki.name,\n url: ki.url\n });\n }\n }\n\n initData();\n\n var kitNames = [];\n\n // Status of whether the clockTick() should do morphing calculations.\n var morphEnabled = 0;\n var morphNeedsUpdate = false;\n\n // Clock callbacks.\n var onGridTick = undefined;\n var onMorphUpdate = undefined;\n\n // Runs at about 60 ticks per second (linked to screen refresh rate).\n function clockTick() {\n var clock = data.clock;\n\n // Check whether the engine is running.\n if (!clock.running) {\n clockLastTime_secs = undefined;\n return;\n }\n\n var delta_secs = 0, dbeat, dbar;\n\n while (true) {\n if (clockLastTime_secs) {\n var now_secs = theAudioContext.currentTime;\n var sqpb = kTimeStruc[clock.struc].semiQuaversPerBar;\n var ticks_per_sec = clock.tempo_bpm * sqpb / 60;\n var nextTickTime_secs = lastTickTime_secs + 1 / ticks_per_sec;\n if (now_secs + kDelay_secs >= nextTickTime_secs) {\n dbeat = Math.floor(((clock.pos % sqpb) + 1) / sqpb);\n dbar = Math.floor((clock.beat + dbeat) / kTimeSig.D[clock.sig]);\n clock.bar = (clock.bar + dbar) % kTimeStruc[clock.struc].cycleLength;\n clock.beat = (clock.beat + dbeat) % kTimeSig.N[clock.sig];\n clock.pos = clock.pos + 1;\n lastTickTime_secs = nextTickTime_secs;\n } else {\n return;\n }\n } else {\n // Very first call.\n clockLastTime_secs = theAudioContext.currentTime;\n clock.bar = 0;\n clock.beat = 0;\n clock.pos = 0;\n lastTickTime_secs = clockLastTime_secs + kDelay_secs;\n }\n\n // If we're doing a morph, set all the relevant control values.\n updateMorph();\n\n // Perform all the voices for all the active presets.\n var i, N, v;\n for (i = 0, N = data.voices.length; i < N; ++i) {\n v = data.voices[i];\n if (v) {\n genBeat(v, clock, lastTickTime_secs);\n }\n }\n\n // Do the callback if specified.\n if (onGridTick) {\n onGridTick(clock);\n }\n }\n }\n\n var kVoiceControlsToMorph = [\n 'straight', 'offbeat', 'funk', 'phase', 'random', \n 'ramp', 'threshold', 'mean', 'cycleWeight', 'volume', 'pan'\n ];\n\n // Utility to calculate a weighted sum.\n // \n // weights is an array of weights. Entries can include 'undefined',\n // in which case they'll not be included in the weighted sum.\n //\n // value_getter is function (i) -> value\n // result_transform(value) is applied to the weighted sum before \n // returning the result value.\n function morphedValue(weights, value_getter, result_transform) {\n var result = 0, wsum = 0;\n var i, N, val;\n for (i = 0, N = weights.length; i < N; ++i) {\n if (weights[i] !== undefined) {\n val = value_getter(i);\n if (val !== undefined) {\n result += weights[i] * val;\n wsum += weights[i];\n }\n }\n }\n return result_transform ? result_transform(result / wsum) : result / wsum;\n }\n\n // Something about the morph status changed.\n // Update the parameters of all the voices to reflect\n // the change.\n function updateMorph() {\n var i, N;\n if (morphEnabled && morphNeedsUpdate && data.presets.length > 1) {\n\n // Compute morph distances for each preset.\n var morphWeights = [], dx, dy, ps;\n for (i = 0, N = data.presets.length; i < N; ++i) {\n ps = data.presets[i];\n if (ps && ps.useInMorph) {\n dx = data.morpher.x - data.presets[i].pos.x;\n dy = data.morpher.y - data.presets[i].pos.y;\n morphWeights[i] = 1 / (1 + Math.sqrt(dx * dx + dy * dy));\n }\n }\n\n // For each voice, compute the morph.\n var wsum = 0, wnorm = 1, p, pN, w, c, cN, v;\n\n // Normalize the morph weights.\n wsum = morphedValue(morphWeights, function (p) { return 1; });\n wnorm = 1 / wsum; // WARNING: Divide by zero?\n\n // For each voice and for each control in each voice, do the morph.\n for (i = 0, N = data.voices.length; i < N; ++i) {\n for (c = 0, cN = kVoiceControlsToMorph.length, v = data.voices[i]; c < cN; ++c) {\n v[kVoiceControlsToMorph[c]] = morphedValue(morphWeights, function (p) { \n var ps = data.presets[p];\n return i < ps.voices.length ? ps.voices[i][kVoiceControlsToMorph[c]] : undefined;\n });\n }\n }\n\n // Now morph the tempo. We morph the tempo in the log domain.\n data.clock.tempo_bpm = morphedValue(morphWeights, function (p) { return Math.log(data.presets[p].clock.tempo_bpm); }, Math.exp);\n\n // Morph the cycle length.\n data.clock.cycleLength = Math.round(morphedValue(morphWeights, function (p) { return data.presets[p].clock.cycleLength; }));\n \n if (onMorphUpdate) {\n setTimeout(onMorphUpdate, 0);\n }\n\n morphNeedsUpdate = false;\n --morphEnabled;\n }\n }\n\n // We store info about all the presets as a JSON string in\n // a single key in localStorage.\n var storageKey = 'com.nishabdam.PeteKellock.RhythmEngine.' + name + '.data';\n\n // Loads the previous engine state saved in localStorage.\n function load(delegate) {\n var dataStr = window.localStorage[storageKey];\n if (dataStr) {\n loadFromStr(dataStr, delegate);\n } else {\n alert(\"RhythmEngine: load error\");\n }\n }\n\n // Loads an engine state saved as a string from, possibly, an \n // external source.\n function loadFromStr(dataStr, delegate) {\n try {\n data = JSON.parse(dataStr);\n } catch (e) {\n setTimeout(function () {\n delegate.onError(\"Corrupt rhythm engine snapshot file.\");\n }, 0);\n return;\n }\n\n var work = {done: 0, total: 0};\n\n function reportProgress(changeInDone, changeInTotal, desc) {\n work.done += changeInDone;\n work.total += changeInTotal;\n if (delegate.progress) {\n delegate.progress(work.done, work.total, desc);\n }\n }\n\n reportProgress(0, data.kits.length * 10);\n\n kitNames = [];\n\n data.kits.forEach(function (kitInfo) {\n SampleManager.loadSampleSet(kitInfo.name, kitInfo.url, {\n didFetchMappings: function (name, mappings) {\n reportProgress(0, getKeys(mappings).length * 2);\n },\n didLoadSample: function (name, key) {\n reportProgress(1, 0);\n },\n didDecodeSample: function () {\n reportProgress(1, 0);\n },\n didFinishLoadingSampleSet: function (name, sset) {\n kitNames.push(name);\n\n // Save the drum names.\n kitInfo.drums = getKeys(sset);\n\n reportProgress(10, 0);\n\n if (kitNames.length === data.kits.length) {\n // We're done.\n delegate.didLoad();\n clockTick();\n }\n }\n });\n });\n }\n\n // This is for loading the JSON string if the user \n // gives it by choosing an external file.\n function loadExternal(fileData, delegate, dontSave) {\n if (checkSnapshotFileData(fileData, delegate)) {\n loadFromStr(fileData, {\n progress: delegate.progress,\n didLoad: function () {\n if (!dontSave) {\n save();\n }\n delegate.didLoad();\n }\n });\n }\n }\n\n // A simple check for the starting part of a snapshot file.\n // This relies on the fact that browser javascript engines\n // enumerate an object's keys in the same order in which they\n // were inserted into the object.\n function checkSnapshotFileData(fileData, delegate) {\n var valid = (fileData.indexOf('{\"type\":\"pk_rhythm_engine\"') === 0);\n if (!valid) {\n setTimeout(function () {\n delegate.onError(\"This is not a rhythm engine snapshot file.\");\n }, 0);\n }\n return valid;\n }\n\n // Loads settings from file with given name, located in\n // the \"settings\" folder.\n function loadFile(filename, delegate) {\n if (filename && typeof(filename) === 'string') {\n fs.root.getDirectory(\"settings\", {create: true},\n function (settingsDir) {\n settingsDir.getFile(filename, {create: false},\n function (fileEntry) {\n fileEntry.file(\n function (f) {\n var reader = new global.FileReader();\n\n reader.onloadend = function () {\n loadExternal(reader.result, delegate, true);\n };\n reader.onerror = delegate && delegate.onError;\n\n reader.readAsText(f);\n },\n delegate && delegate.onError\n );\n },\n delegate && delegate.onError\n );\n },\n delegate && delegate.onError\n );\n } else {\n load(delegate);\n }\n }\n\n // Makes an array of strings giving the names of saved\n // settings and calls delegate.didListSettings(array)\n // upon success. delegate.onError is called if there is\n // some error.\n function listSavedSettings(delegate) {\n fs.root.getDirectory(\"settings\", {create: true},\n function (settingsDir) {\n var reader = settingsDir.createReader();\n var result = [];\n\n function readEntries() {\n reader.readEntries(\n function (entries) {\n var i, N;\n\n if (entries.length === 0) {\n // We're done.\n delegate.didListSettings(result.sort());\n } else {\n // More to go. Accumulate the names.\n for (i = 0, N = entries.length; i < N; ++i) {\n result.push(entries[i].name);\n }\n\n // Continue listing the directory.\n readEntries();\n }\n },\n delegate && delegate.onError\n );\n }\n\n readEntries();\n },\n delegate && delegate.onError\n );\n }\n\n // Saves all the presets in local storage.\n function save(filename, delegate) {\n var dataAsJSON = JSON.stringify(data);\n\n // First save a copy in the locaStorage for worst case scenario.\n window.localStorage[storageKey] = dataAsJSON;\n\n if (filename && typeof(filename) === 'string') {\n fs.root.getDirectory(\"settings\", {create: true},\n function (settingsDir) {\n settingsDir.getFile(filename, {create: true},\n function (f) {\n f.createWriter(\n function (writer) {\n writer.onwriteend = delegate && delegate.didSave;\n writer.onerror = delegate && delegate.onError;\n\n var bb = new global.BlobBuilder();\n bb.append(dataAsJSON);\n writer.write(bb.getBlob());\n },\n delegate && delegate.onError\n );\n },\n delegate && delegate.onError\n );\n },\n delegate && delegate.onError\n );\n }\n }\n\n // Make a \"voice\" object exposing all the live-tweakable\n // parameters. The API user can just set these parameters\n // to hear immediate effect in the RE's output.\n function make_voice(kit, drum) {\n return {\n voice: {kit: kit, drum: drum},\n straight: 0.5,\n offbeat: 0.0,\n funk: 0.0,\n phase: 0,\n random: 0.0,\n ramp: 0.2,\n threshold: 0.5,\n mean: 0.5,\n cycleWeight: 0.2,\n volume: 1.0,\n pan: 0.0\n };\n }\n\n function validatePresetIndex(p, extra) {\n if (p < 0 || p >= data.presets.length + (extra ? extra : 0)) {\n throw new Error('Invalid preset index!');\n }\n }\n\n return {\n kits: data.kits, // Read-only.\n save: save,\n snapshot: function () { return JSON.stringify(data); },\n load: loadFile,\n list: listSavedSettings,\n import: loadExternal,\n\n // You can set a callback to be received on every grid tick so\n // that you can do something visual about it. The callback will\n // receive the current clock status as the sole argument.\n // The callback is expected to not modify the clock.\n get onGridTick() { return onGridTick; },\n set onGridTick(newCallback) { onGridTick = newCallback; },\n\n // You can set a callback for notification whenever the bulk\n // of sliders have been changed due to a morph update.\n get onMorphUpdate() { return onMorphUpdate; },\n set onMorphUpdate(newCallback) { onMorphUpdate = newCallback; },\n\n // Change the tempo by assigning to tempo_bpm field.\n get tempo_bpm() {\n return data.clock.tempo_bpm;\n },\n set tempo_bpm(new_tempo_bpm) {\n data.clock.tempo_bpm = Math.min(Math.max(10, new_tempo_bpm), 480);\n },\n\n // Info about the voices and facility to add more.\n numVoices: function () { return data.voices.length; },\n voice: function (i) { return data.voices[i]; },\n addVoice: function (kit, drum) {\n var voice = make_voice(kit || 'acoustic-kit', drum || 'kick');\n data.voices.push(voice);\n return voice;\n },\n\n // Info about presets and the ability to add/save to presets.\n numPresets: function () { return data.presets.length; },\n preset: function (p) { return data.presets[p]; },\n saveAsPreset: function (p) {\n validatePresetIndex(p, 1);\n\n p = Math.min(data.presets.length, p);\n\n // Either make a new preset or change a saved one.\n // We preserve a preset's morph weight if we're\n // changing one to a new snapshot.\n var old = (p < data.presets.length ? data.presets[p] : {pos: {x: 0, y: 0}});\n data.presets[p] = {\n useInMorph: old.useInMorph,\n pos: copy_object(old.pos),\n clock: copy_object(data.clock),\n voices: copy_object(data.voices)\n };\n },\n\n\n // Morphing functions. The initial state of the morpher is \"disabled\",\n // so as long as that is the case, none of the 2D position functions\n // have any effect. You first need to enable the morpher before\n // the other calls have any effect.\n enableMorph: function (flag) {\n morphEnabled += flag ? 1 : 0;\n if (flag) {\n morphNeedsUpdate = true;\n }\n },\n presetPos: function (p) { return data.presets[p].pos; },\n changePresetPos: function (p, x, y) {\n validatePresetIndex(p);\n var pos = data.presets[p].pos;\n pos.x = x;\n pos.y = y;\n morphNeedsUpdate = true;\n },\n morpherPos: function () { return data.morpher; },\n changeMorpherPos: function (x, y) {\n data.morpher.x = x;\n data.morpher.y = y;\n morphNeedsUpdate = true;\n },\n\n // Starting and stopping the engine. Both methods are\n // idempotent.\n get running() { return data.clock.running; },\n start: function () {\n if (!data.clock.running) {\n data.clock.running = true;\n clockLastTime_secs = undefined;\n clockJSN = theAudioContext.createJavaScriptNode(512, 0, 1);\n clockJSN.onaudioprocess = function (event) {\n clockTick();\n };\n clockJSN.connect(theAudioContext.destination);\n }\n },\n stop: function () {\n data.clock.running = false;\n if (clockJSN) {\n clockJSN.disconnect();\n clockJSN = undefined;\n }\n }\n };\n }", "function tick() {\n\n\n\n}", "set_time( t ){ this.current_time = t; this.draw_fg(); return this; }" ]
[ "0.60922885", "0.5949018", "0.5756867", "0.57554275", "0.57554275", "0.57131803", "0.56148666", "0.55186754", "0.5505017", "0.5497742", "0.5468396", "0.5467718", "0.54543716", "0.54002976", "0.5386592", "0.53503424", "0.5311419", "0.5294002", "0.52667093", "0.52347416", "0.52346486", "0.52319324", "0.52224326", "0.5218331", "0.52155006", "0.52090085", "0.52009827", "0.518131", "0.5158937", "0.5155084", "0.51521915", "0.5150471", "0.5145293", "0.51423", "0.5131727", "0.51138747", "0.51013", "0.50987947", "0.50969833", "0.5088159", "0.5088159", "0.5073959", "0.5072545", "0.5072029", "0.5069908", "0.5065038", "0.50513786", "0.5046419", "0.50382197", "0.5037763", "0.5023638", "0.50190544", "0.50105804", "0.5004575", "0.5001762", "0.49851534", "0.4979641", "0.49763665", "0.4975456", "0.49714097", "0.4965082", "0.49637097", "0.49571905", "0.49566728", "0.49532384", "0.4935089", "0.49201417", "0.49167356", "0.4915479", "0.4911556", "0.4906906", "0.4891314", "0.48878008", "0.48868215", "0.4885634", "0.48840037", "0.48780647", "0.48744377", "0.48667896", "0.486577", "0.48640993", "0.4862349", "0.48617733", "0.485853", "0.4852473", "0.48504347", "0.4843918", "0.4842883", "0.4842342", "0.48332587", "0.48298734", "0.48298386", "0.48223764", "0.481757", "0.4812695", "0.4811885", "0.48088992", "0.48063743", "0.4806254", "0.4799488", "0.47986594" ]
0.0
-1
TimeEngine method (transported interface)
advancePosition(time, position, speed) { this.trigger(time); if (speed < 0) return position - this.__period; return position + this.__period; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function tickCurrentTimeEngine() {\n\n var d = new Date();\n\n currentHours = d.getHours();\n currentMinutes = d.getMinutes();\n currentSeconds = d.getSeconds();\n\n if (currentHours.toString().length == 1) {\n choursDigit_1 = 0;\n choursDigit_2 = currentHours;\n }\n else {\n choursDigit_1 = parseInt(currentHours.toString().charAt(0), 10);\n choursDigit_2 = parseInt(currentHours.toString().charAt(1), 10);\n }\n\n if (currentMinutes.toString().length == 1) {\n cminutesDigit_1 = 0;\n cminutesDigit_2 = currentMinutes;\n }\n else {\n cminutesDigit_1 = parseInt(currentMinutes.toString().charAt(0), 10);\n cminutesDigit_2 = parseInt(currentMinutes.toString().charAt(1), 10);\n }\n\n if (currentSeconds.toString().length == 1) {\n csecondsDigit_1 = 0;\n csecondsDigit_2 = currentSeconds;\n }\n else {\n csecondsDigit_1 = parseInt(currentSeconds.toString().charAt(0), 10);\n csecondsDigit_2 = parseInt(currentSeconds.toString().charAt(1), 10);\n }\n\n tickCurrentTime = setTimeout(tickCurrentTimeEngine, timerCurrentTimeMiliSecs);\n\n return;\n }", "function Time() {}", "get time () { throw \"Game system not supported\"; }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "function TimeUtils() {}", "getTime(){return this.time;}", "function Engine() {\n }", "onTimeChanged () {\n this.view.renderTimeAndDate();\n }", "function tickTime() {\n // the magic object with all the time data\n // the present passing current moment\n let pc = {\n thisMoment: {},\n current: {},\n msInA: {},\n utt: {},\n passage: {},\n display: {}\n };\n\n // get the current time\n pc.thisMoment = {};\n pc.thisMoment = new Date();\n\n // slice current time into units\n pc.current = {\n ms: pc.thisMoment.getMilliseconds(),\n second: pc.thisMoment.getSeconds(),\n minute: pc.thisMoment.getMinutes(),\n hour: pc.thisMoment.getHours(),\n day: pc.thisMoment.getDay(),\n date: pc.thisMoment.getDate(),\n week: weekOfYear(pc.thisMoment),\n month: pc.thisMoment.getMonth(),\n year: pc.thisMoment.getFullYear()\n };\n\n // TODO: display day of week and month name\n let dayOfWeek = DAYS[pc.current.day];\n let monthName = MONTHS[pc.current.month];\n\n // returns the week no. out of the year\n function weekOfYear(d) {\n d.setHours(0, 0, 0);\n d.setDate(d.getDate() + 4 - (d.getDay() || 7));\n return Math.ceil(((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);\n }\n\n // set the slice conversions based on pc.thisMoment\n pc.msInA.ms = 1;\n pc.msInA.second = 1000;\n pc.msInA.minute = pc.msInA.second * 60;\n pc.msInA.hour = pc.msInA.minute * 60;\n pc.msInA.day = pc.msInA.hour * 24;\n pc.msInA.week = pc.msInA.day * 7;\n pc.msInA.month = pc.msInA.day * MONTH_DAYS[pc.current.month - 1];\n pc.msInA.year = pc.msInA.day * daysThisYear(pc.current.year);\n\n // handle leap years\n function daysThisYear(year) {\n if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {\n MONTH_DAYS[1] = 29;\n return 366;\n } else {\n return 365;\n }\n }\n\n // utt means UpToThis\n // calculates the count in ms of each unit that has passed\n pc.utt.ms = pc.current.ms;\n pc.utt.second = pc.current.second * pc.msInA.second + pc.utt.ms;\n pc.utt.minute = pc.current.minute * pc.msInA.minute + pc.utt.second;\n pc.utt.hour = pc.current.hour * pc.msInA.hour + pc.utt.minute;\n pc.utt.day = pc.current.day * pc.msInA.day + pc.utt.hour;\n pc.utt.week = pc.current.week * pc.msInA.week + pc.utt.day;\n pc.utt.date = pc.current.date * pc.msInA.day + pc.utt.hour;\n pc.utt.month = pc.current.month + 1 * pc.msInA.month + pc.utt.date;\n pc.utt.year = pc.current.year * pc.msInA.year + pc.utt.month;\n\n // calculates the proportion/ratio of each unit that has passed\n // used to display percentages\n pc.passage = {\n ms: pc.current.ms / 100,\n second: pc.current.ms / pc.msInA.second,\n minute: pc.utt.second / pc.msInA.minute,\n hour: pc.utt.minute / pc.msInA.hour,\n day: pc.utt.hour / pc.msInA.day,\n week: pc.utt.day / pc.msInA.week,\n month: pc.utt.date / pc.msInA.month,\n year: pc.utt.month / pc.msInA.year\n };\n\n // tidies up the current clock readouts for display\n pc.display = {\n ms: pc.utt.ms,\n second: pc.current.second,\n minute: pc.current.minute.toString().padStart(2, \"0\"),\n hour: pc.current.hour.toString().padStart(2, \"0\"),\n day: pc.current.date,\n week: pc.current.week,\n month: pc.current.month.toString().padStart(2, \"0\"),\n year: pc.current.year\n };\n\n if (debug) {\n console.dir(pc);\n }\n\n // returns the ratios and the clock readouts\n return { psg: pc.passage, dsp: pc.display };\n}", "overTime(){\n\t\t//\n\t}", "function updateTime() {\n\n}", "function task4 () {\n\n function Clock (options) {\n this._template = options.template\n }\n \n Clock.prototype.render = function() {\n var date = new Date();\n var hours = date.getHours();\n if (hours < 10) hours = '0' + hours;\n var min = date.getMinutes();\n if (min < 10) min = '0' + min;\n var sec = date.getSeconds();\n if (sec < 10) sec = '0' + sec;\n var output = this._template.replace('h', hours)\n .replace('m', min)\n .replace('s', sec);\n console.log(output);\n };\n\n Clock.prototype.stop = function () {\n clearInterval(this._timer)\n }\n\n Clock.prototype.start = function() {\n this.render()\n this._timer = setInterval(this.render.bind(this), 1000)\n };\n\n\n\n // Descendant\n\n function RelativeClock(options) {\n Clock.apply(this, arguments) // coffee script super() :)\n this._precision = options.precision || 1000\n };\n\n RelativeClock.prototype = Object.create(Clock.prototype);\n RelativeClock.prototype.constructor = RelativeClock;\n\n RelativeClock.prototype.start = function() {\n this.render()\n this._timer = setInterval(this.render.bind(this), this._precision)\n };\n\n var rc = new RelativeClock({\n template: \"h:m:s\",\n precision: 10000\n })\n rc.start()\n}", "function classTime(C_E,desc,day,start,fin,loc,start_date){\n this.C_E = C_E;\n this.desc = desc;\n this.day = day;\n this.start = start;\n this.fin = fin;\n this.loc = loc;\n this.start_date = start_date;\n}", "function __time($obj) {\r\n if (window.STATICCLASS_CALENDAR==null) {\r\n window.STATICCLASS_CALENDAR = __loadScript(\"CalendarTime\", 1);\r\n }\r\n window.STATICCLASS_CALENDAR.perform($obj);\r\n}", "function timeTest()\r\n{\r\n}", "function startTime() {\n setTimer();\n}", "constructor() {\n /** Indicates if the clock is endend. */\n this.endedLocal = false;\n /** The duration between start and end of the clock. */\n this.diff = null;\n this.startTimeLocal = new Date();\n this.hrtimeLocal = process.hrtime();\n }", "function Stopwatch() {}", "applyWorkingTime(timeAxis) {\n const me = this,\n config = me._workingTime;\n\n if (config) {\n let hour = null;\n // Only use valid values\n if (\n config.fromHour >= 0 &&\n config.fromHour < 24 &&\n config.toHour > config.fromHour &&\n config.toHour <= 24 &&\n config.toHour - config.fromHour < 24\n ) {\n hour = { from: config.fromHour, to: config.toHour };\n }\n\n let day = null;\n // Only use valid values\n if (\n config.fromDay >= 0 &&\n config.fromDay < 7 &&\n config.toDay > config.fromDay &&\n config.toDay <= 7 &&\n config.toDay - config.fromDay < 7\n ) {\n day = { from: config.fromDay, to: config.toDay };\n }\n\n if (hour || day) {\n timeAxis.include = {\n hour,\n day\n };\n } else {\n // No valid rules, restore timeAxis\n timeAxis.include = null;\n }\n } else {\n // No rules, restore timeAxis\n timeAxis.include = null;\n }\n\n if (me.rendered) {\n // Refreshing header, which also recalculate tickSize and header data\n me.timeAxisColumn.refreshHeader();\n // Update column lines\n if (me.features.columnLines) {\n me.features.columnLines.drawLines();\n }\n\n // Animate event changes\n me.refreshWithTransition();\n }\n }", "function task3 () {\n //\n function Clock(options) {\n var template = options.template;\n var timer;\n \n function render() {\n var date = new Date();\n var hours = date.getHours();\n if (hours < 10) hours = '0' + hours;\n var min = date.getMinutes();\n if (min < 10) min = '0' + min;\n var sec = date.getSeconds();\n if (sec < 10) sec = '0' + sec;\n var output = template.replace('h', hours).replace('m', min).replace('s', sec);\n console.log(output);\n }\n this.stop = function() {\n clearInterval(timer);\n };\n this.start = function() {\n render();\n timer = setInterval(render, 1000);\n }\n }\n \n var cf = new Clock({\n template: 'h:m:s'\n });\n // cf.start();\n\n\n function ClockP (options) {\n this._template = options.template\n this._timer = null\n }\n\n ClockP.prototype.render = function() {\n var date = new Date();\n var hours = date.getHours();\n if (hours < 10) hours = '0' + hours;\n var min = date.getMinutes();\n if (min < 10) min = '0' + min;\n var sec = date.getSeconds();\n if (sec < 10) sec = '0' + sec;\n var output = this._template.replace('h', hours)\n .replace('m', min)\n .replace('s', sec);\n console.log(output);\n };\n\n ClockP.prototype.stop = function () {\n clearInterval(this._timer)\n }\n\n ClockP.prototype.start = function() {\n this.render()\n this._timer = setInterval(this.render.bind(this), 1000)\n };\n\n var cp = new ClockP({\n template: 'h:m:s'\n });\n cp.start();\n\n}", "currentTime() {\n this.time24 = new Time();\n this.updateTime(false);\n }", "function SimulationEngine() {\n\t\t\n\t}", "function tickTheClock(){\n\n \n \n}", "function engine() {\n \n run = false;\n leg = length;\n \n while(leg--) {\n \n itm = dictionary[leg];\n \n if(!itm) break;\n if(itm.isCSS) continue;\n \n if(itm.cycle()) {\n \n run = true;\n\n }\n else {\n \n itm.stop(false, itm.complete, false, true);\n \n }\n \n }\n \n if(request) {\n \n if(run) {\n \n request(engine);\n \n }\n else {\n \n cancel(engine);\n itm = trans = null;\n \n }\n \n }\n else {\n \n if(run) {\n \n if(!engineRunning) timer = setInterval(engine, intervalSpeed);\n \n }\n else {\n \n clearInterval(timer);\n itm = trans = null;\n \n }\n \n }\n \n engineRunning = run;\n \n }", "function updateTime() {\n console.log(\"updateTime()\");\n store.timeModel.update();\n}", "get_timeSet() {\n return this.liveFunc._timeSet;\n }", "function Clock() {\n\n var daysInAMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n\n this.month = 1;\n this.day = 1;\n this.year = 2016;\n\n this.tick = function() {\n this.day += 1;\n\n if (this.day > daysInAMonth[this.month - 1]) {\n this.month += 1;\n this.day = 1;\n }\n\n }\n\n this.time = function() {\n \tvar month = this.month < 10 ? \"0\" + this.month : this.month;\n \tvar day = this.day < 10 ? \"0\" + this.day : this.day;\n console.log(`${this.year}-${month}-${day}`)\n }\n\n this.getTime = function() {\n var month = this.month < 10 ? \"0\" + this.month : this.month;\n \tvar day = this.day < 10 ? \"0\" + this.day : this.day;\n return `${this.year}-${month}-${day}`;\n }\n\n}", "function onSystemTimeChanged() {\r\n updateTime();\r\n }", "function setTime( t ){\n\n this.time = t;\n\n }", "getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n\n this.lifeTime = this.time - this.startTime;\n \n \n }", "get elapsedTime() {\n return this._t;\n }", "function startTime()\n{\n //get how long does it take for the smallest unit to elapse to set timeouts\n var timeout = time.units[time.units.length-1];\n\n //put the name into the text\n $(\"[class^=timeName]\").html(time.name);\n\n //clocks\n localTime();\n currentFictional(timeout);\n countdownToBegin(timeout);\n\n //converters\n $(\"#eyToTimeY\").submit(function(event){\n event.preventDefault();\n $(\"#eyToTimeYResult\").text( earthYearsToTimeYears($(\"#eyToTimeYInput\").val()) );\n });\n\n //SUT year to Earth year\n $(\"#timeToEY\").submit(function(event){\n event.preventDefault();\n $(\"#timeToEYResult\").text( timeYearsToEarthYears($(\"#timeToEYInput\").val()) );\n });\n\n //setup date picker for Earth year\n $(\"#eDToTimeInput\").fdatepicker({format:\"yyyy-mm-dd\"});\n //Earth date to SUT\n $(\"#eDToTime\").submit(function(event){\n event.preventDefault();\n $(\"#eDToTimeResult\").text( earthDateToTime($(\"#eDToTimeInput\").val()) );\n });\n\n}", "function timebase() {\n\t//timebased will interupt all other routines once started, until shutdown\n\t\n\t//TODO: turn timebase off completely by killing the interval function.\n\tif (timebase_status != \"running\") {\n\t\treturn;\n\t}\n\n\tvar current_hour = date.getHours();\n\tvar current_month = date.getMonth();\n\n\t//Daytime (7:00 - 19:00)\n\tif (current_hour >= 7 && current_hour < 18+season_sunset_offset) {\n\t\t//TODO: fade in from sunrise to sunrise+1hr\n\t\t\n\t\t//TODO: change hue/sat value in feedback loop from color zone sensor!\n\t\t\n\t\t//Turn on when active.\n\t\tif (hasActive(detectionData)) {\n\t\t\tstateChange('on');\n\t\t}\n\t//Nighttime (19:00 - 2:00)\n\t} else if (current_hour >= 18+season_sunset_offset || current_hour < 2) {\n\t\t//TODO: Flux full transition from 19:00 to 21:30\n\t\t\n\t\t//Turn on when active.\n\t\tif (hasActive(detectionData)) {\n\t\t\tstateChange('on');\n\t\t}\n\t}\n\t//Supernight (2:00 - 7:00)\n\telse if (current_hour >= 2 && current_hour < 7) {\n\t\t//Turn on when active.\n\t\t//TODO: only 10% brightness.\n\t\tif (hasActive(detectionData)) {\n\t\t\tstateChange('on'); //TODO: Per zone.\n\t\t}\n\t}\n\n\t//TODO: grab realtime sunrise/set data from internet\n\t//Sunrise accent effect\n\tif (0) {\n\t\t//TODO: Flash accents red, yellow, blue\n\t}\n\n\t//Sunset accent effect\n\tif (0) {\n\t\t//TODO: Flash accents red, yellow, blue\n\t}\n\n\t//TODO: grab data from ical file off the internet every day. \n\t//Calendar effects\n\tif (0) { //if event_start\n\t\t//TODO: Flash accents red, yellow, blue\n\t}\n\n\t//check for securityMode\n\tif (hasActive(detectionData) && securityMode) {\n\t\t//disable it\n\t\tsecurityMode = false;\n\t\t//TODO: Flash welcome home accent pattern.\n\t}\n\n\t//Seasonal changes\n\t//Summer- push sunset back.\n\tif (current_month > 4 || current_month < 9) {\n\t\tseason_sunset_offset = 1.5;\n\t}\n\t\n\t//TODO: Update the light/history database here.\n\t//TODO: Check if database has no records for last 24 hours\n\t//Security Mode: simulate house\n\tif (0) {\n\t\tvar securityMode = true;\n\t\t//TODO: Implment security mode\n\t}\n\t//TODO: Parse duke api for warnings\n\tif (0) {\n\t\t//TODO: Check if it's an updated posting or not, and if so, flash accents red/yellow every 30s until disabled.\n\t}\n\n}", "update(timeStep) {\n\n }", "function LogicNodeTime() {\n\t\tLogicNode.call(this);\n\t\tthis.wantsProcessCall = true;\n\t\tthis.logicInterface = LogicNodeTime.logicInterface;\n\t\tthis.type = 'LogicNodeTime';\n\t\tthis._time = 0;\n\t\tthis._running = true;\n\t}", "function calcEquationOfTime(t) {\n\t var epsilon = calcObliquityCorrection(t);\n\t var l0 = calcGeomMeanLongSun(t);\n\t var e = calcEccentricityEarthOrbit(t);\n\t var m = calcGeomMeanAnomalySun(t);\n\n\t var y = Math.tan(degToRad(epsilon) / 2.0);\n\t y *= y;\n\n\t var sin2l0 = Math.sin(2.0 * degToRad(l0));\n\t var sinm = Math.sin(degToRad(m));\n\t var cos2l0 = Math.cos(2.0 * degToRad(l0));\n\t var sin4l0 = Math.sin(4.0 * degToRad(l0));\n\t var sin2m = Math.sin(2.0 * degToRad(m));\n\n\t var Etime = y * sin2l0 - 2.0 * e * sinm + 4.0 * e * y * sinm * cos2l0 - 0.5 * y * y * sin4l0 - 1.25 * e * e * sin2m;\n\t return radToDeg(Etime) * 4.0; // in minutes of time\n\t}", "function KalturaTimeWarnerService(client){\n\tthis.init(client);\n}", "createTimer() {\n\t\t// set initial in seconds\n\t\tthis.initialTime = 0;\n\n\t\t// display text on Axis with formated Time\n\t\tthis.text = this.add.text(\n\t\t\t16,\n\t\t\t50,\n\t\t\t\"Time: \" + this.formatTime(this.initialTime)\n\t\t);\n\n\t\t// Each 1000 ms call onEvent\n\t\tthis.timedEvent = this.time.addEvent({\n\t\t\tdelay: 1000,\n\t\t\tcallback: this.onEvent,\n\t\t\tcallbackScope: this,\n\t\t\tloop: true,\n\t\t});\n\t}", "function TimeStamp() {}", "function TimeStamp() {}", "get startTime() { return this._startTime; }", "applyWorkingTime(timeAxis) {\n const me = this,\n config = me._workingTime;\n\n if (config) {\n let hour = null; // Only use valid values\n\n if (config.fromHour >= 0 && config.fromHour < 24 && config.toHour > config.fromHour && config.toHour <= 24 && config.toHour - config.fromHour < 24) {\n hour = {\n from: config.fromHour,\n to: config.toHour\n };\n }\n\n let day = null; // Only use valid values\n\n if (config.fromDay >= 0 && config.fromDay < 7 && config.toDay > config.fromDay && config.toDay <= 7 && config.toDay - config.fromDay < 7) {\n day = {\n from: config.fromDay,\n to: config.toDay\n };\n }\n\n if (hour || day) {\n timeAxis.include = {\n hour,\n day\n };\n } else {\n // No valid rules, restore timeAxis\n timeAxis.include = null;\n }\n } else {\n // No rules, restore timeAxis\n timeAxis.include = null;\n }\n\n if (me.isPainted) {\n var _me$features$columnLi;\n\n // Refreshing header, which also recalculate tickSize and header data\n me.timeAxisColumn.refreshHeader(); // Update column lines\n\n (_me$features$columnLi = me.features.columnLines) === null || _me$features$columnLi === void 0 ? void 0 : _me$features$columnLi.refresh(); // Animate event changes\n\n me.refreshWithTransition();\n }\n }", "changeStartTime(startTime){\n this.startTime = startTime;\n }", "twelveClock () {\n const shiftAM = () => this.#hour < 4\n ? eveningGreet.run()\n : morningGreet.run()\n\n const shiftPM = () => this.#hour > 4 && this.#hour !== 12\n ? eveningGreet.run()\n : afternoonGreet.run()\n\n return this.#shift === 'AM'\n ? shiftAM()\n : shiftPM()\n }", "get(){\n\t\t// debug\n\t\t// console.log(\"atomicGLClock::get\");\t\n\t\treturn this.elapsed;\n\t}", "liveTime() {\n\t\tthis.updateTime();\n\t\tthis.writeLog();\n\t}", "onSleepingTime() {\n throw new NotImplementedException();\n }", "function templateEngine () { }", "function test_timepicker_should_pass_correct_timing_on_service_order() {}", "function Time() {\n this._clock = void 0;\n this._timeScale = void 0;\n this._deltaTime = void 0;\n this._startTime = void 0;\n this._lastTickTime = void 0;\n this._clock = wechatAdapter.performance ? wechatAdapter.performance : Date;\n this._timeScale = 1.0;\n this._deltaTime = 0.0001;\n\n var now = this._clock.now();\n\n this._startTime = now;\n this._lastTickTime = now;\n }", "getStartTime() {\n return this.startTime;\n }", "function timecalc(hoursBack) {\r\n // Function to return current time for use to calculate the timeframe parameter for the parkingEvents query. \r\n // The function minus the number of hours back accuratly articulates to the api what \r\n // timeframe should be viewed.\r\n var date = new Date()\r\n return Date.UTC(date.getUTCFullYear(),date.getUTCMonth(), date.getUTCDate() , \r\n date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds())-(hoursBack*60*60*1000); \r\n }", "timerTick(e) {\n console.log(\"This method should be overridden in child classes.\");\n }", "constructor(schedule) {\n\n }", "function morning() {\n // whole morning routine\n}", "setTime(ts) {\nreturn this.timeStamp = ts;\n}", "constructor(engine) {\n this.engine = engine;\n }", "function getInitialTime() {\n changeTime();\n}", "constructor (){\n\t\tsuper();\n\n\t\tthis.getTheTime = this.getTheTime.bind(this);\n\n\t\t/**\n\t\t * Setup the time variable to update every second\n\t\t */\n\t\t\n\t\tthis.state = {\n\t\t\ttime: null\n\t\t}\n\n\t\tthis.getTheTime();\n\t}", "function OnTimeModule() {\n\t\tthis.name = \"OnTime.Module\";\n\t}", "computeTime() {\n let year;\n const fields = this.fields;\n if (this.isSet(YEAR)) {\n year = fields[YEAR];\n } else {\n year = new Date().getFullYear();\n }\n let timeOfDay = 0;\n if (this.isSet(HOUR_OF_DAY)) {\n timeOfDay += fields[HOUR_OF_DAY];\n }\n timeOfDay *= 60;\n timeOfDay += fields[MINUTE] || 0;\n timeOfDay *= 60;\n timeOfDay += fields[SECONDS] || 0;\n timeOfDay *= 1000;\n timeOfDay += fields[MILLISECONDS] || 0;\n let fixedDate = 0;\n fields[YEAR] = year;\n fixedDate = fixedDate + this.getFixedDate();\n // millis represents local wall-clock time in milliseconds.\n let millis = (fixedDate - EPOCH_OFFSET) * ONE_DAY + timeOfDay;\n millis -= this.timezoneOffset * ONE_MINUTE;\n this.time = millis;\n this.computeFields();\n }", "function erlang(servers, time) {\n return (servers * time)/3600;\n}", "get time() {\n return this._time;\n }", "_specializedInitialisation()\r\n\t{\r\n\t\tLogger.log(\"Specialisation for service AVTransport\", LogType.Info);\r\n\t\tvar relativeTime = this.getVariableByName(\"RelativeTimePosition\");\r\n\t\t//Implémentation pour OpenHome\r\n\t\tif (!relativeTime)\r\n\t\t\trelativeTime = this.getVariableByName(\"A_ARG_TYPE_GetPositionInfo_RelTime\");\r\n\t\tvar transportState = this.getVariableByName(\"TransportState\");\r\n\t\t//Implémentation pour OpenHome\r\n\t\tif (!transportState)\r\n\t\t\ttransportState = this.getVariableByName(\"A_ARG_TYPE_GetTransportInfo_CurrentTransportState\");\r\n\r\n\t\tif (transportState)\r\n\t\t{\r\n\t\t\ttransportState.on('updated', (variable, newVal) =>\r\n\t\t\t{\r\n\t\t\t\tLogger.log(\"On transportStateUpdate : \" + newVal, LogType.DEBUG);\r\n\t\t\t\tvar actPosInfo = this.getActionByName(\"GetPositionInfo\");\r\n\t\t\t\tvar actMediaInfo = this.getActionByName(\"GetMediaInfo\");\r\n\t\t\t\t/*\r\n\t\t\t\t“STOPPED” R\r\n\t\t\t\t“PLAYING” R\r\n\t\t\t\t“TRANSITIONING” O\r\n\t\t\t\t”PAUSED_PLAYBACK” O\r\n\t\t\t\t“PAUSED_RECORDING” O\r\n\t\t\t\t“RECORDING” O\r\n\t\t\t\t“NO_MEDIA_PRESENT”\r\n\t\t\t\t */\r\n\t\t\t\tif (relativeTime && !relativeTime.SendEvent && actPosInfo)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (this._intervalUpdateRelativeTime)\r\n\t\t\t\t\t\tclearInterval(this._intervalUpdateRelativeTime);\r\n\t\t\t\t\tif (newVal == \"PLAYING\" || newVal == \"RECORDING\")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tactPosInfo.execute(\t{\tInstanceID: 0\t} );\r\n\t\t\t\t\t\t//Déclenche la maj toutes les 4 secondes\r\n\t\t\t\t\t\tthis._intervalUpdateRelativeTime = setInterval(() =>{\r\n\t\t\t\t\t\t\t\t//Logger.log(\"On autoUpdate\", LogType.DEBUG);\r\n\t\t\t\t\t\t\t\tactPosInfo.execute(\t{\tInstanceID: 0\t}\t);\r\n\t\t\t\t\t\t\t}, 4000);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//else if (newVal == \"STOPPED\" || newVal == \"PAUSED_PLAYBACK\" || newVal == \"PAUSED_RECORDING\" || newVal == \"NO_MEDIA_PRESENT\")\r\n\t\t\t\t//{\r\n\t\t\t\t//\r\n\t\t\t\t//}\r\n\t\t\t\t//On met a jour les media info et position info pour etre sur de mettre a jour les Metadata(par defaut la freebox ne le fait pas ou plutot le fait mal)\r\n\t\t\t\tif (newVal == \"TRANSITIONING\")\r\n\t\t\t\t{\r\n\t\t\t\t\tif (actPosInfo)\r\n\t\t\t\t\t\tactPosInfo.execute(\t{InstanceID: 0}\t);\r\n\t\t\t\t\tif (actMediaInfo)\r\n\t\t\t\t\t\tactMediaInfo.execute(\t{InstanceID: 0} );\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif (newVal == \"STOPPED\")\r\n\t\t\t\t{\r\n\t\t\t\t\tif (actPosInfo)\r\n\t\t\t\t\t\tactPosInfo.execute(\t{\tInstanceID: 0\t});\r\n\t\t\t\t\tif (actMediaInfo)\r\n\t\t\t\t\t\tactMediaInfo.execute(\t{\tInstanceID: 0 });\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t}", "constructor() {\n\n this.timedEntities = []; // Will hold list of entities being tracked\n this.activeEntity = null; // This is the entity we are currently timing\n this.intervalTimer = null; // Will hold reference after we start setInterval\n this.chartTimer = null; // Will hold referenec to the setInterval for updating the charts\n this.timingActive = false; // Are we currently running the timer?\n this.totalTicksActive = 0; // seconds that the timer has been running\n // Store the timestamp in ms of the last time a tick happened in case the\n // app gets backgrounded and JS execution stops. Can then add in the right\n // number of secconds after\n this.lastTickTime = -1;\n this.turnList = []; // Will hold a set of dictionaries defining each time the speaker changed.\n this.minTurnLength = 10; // seconds; the time before a turn is shown on the timeline\n\n this.meetingName = \"\";\n this.attributeNameGender = \"Gender\";\n this.attributeNameSecondary = \"Secondary Attribute\";\n this.attributeNameTertiary = \"Tertiary Attribute\";\n }", "getPlayTime() {\n return this.time;\n }", "scheduler() {\n this.maybeTickSongChart();\n\n // When nextNoteTime (in the future) is near (gap is determined by \n // scheduleAheadTime), schedule audio & visuals and advance to the next\n // note.\n while (this.nextNoteTime <\n (this.audioContext.currentTime + this.scheduleAheadTime)) {\n this.scheduleNote(this.current16thNote, this.nextNoteTime);\n this.nextNote();\n }\n }", "initCurrentTimeLine() {\n const me = this,\n now = new Date();\n\n if (me.currentTimeLine || !me.showCurrentTimeLine) {\n return;\n }\n\n me.currentTimeLine = new me.store.modelClass({\n // eslint-disable-next-line quote-props\n 'id': 'currentTime',\n cls: 'b-sch-current-time',\n startDate: now,\n name: DateHelper.format(now, me.currentDateFormat)\n });\n me.updateCurrentTimeLine = me.updateCurrentTimeLine.bind(me);\n me.currentTimeInterval = me.setInterval(me.updateCurrentTimeLine, me.updateCurrentTimeLineInterval);\n\n if (me.client.isPainted) {\n me.renderRanges();\n }\n }", "get time() {}", "now () {\n return this.t;\n }", "function yFindRealTimeClock(func)\n{\n return YRealTimeClock.FindRealTimeClock(func);\n}", "setTime(time) {\n this.time = time;\n return this;\n }", "get elapsedTime() {\n return this._elapsedTime\n }", "function timerWrapper () {}", "function updateTime(){\n setTimeContent(\"timer\");\n}", "function setTime(){\n let dt = new Date();\n currScene.timeInScene = dt.getTime();\n}", "function timeUpdate() {\n timeEngaged += delta();\n}", "function localClock(){\n digitalClock(0,\"clock\");\n digitalClock(-7,\"clockNy\")\n digitalClock(8,\"tokyo\") \n}", "tickCaller(game){\n game.tick();\n }", "eventTimer() {throw new Error('Must declare the function')}", "time(time) {\n if (time == null) {\n return this._time;\n }\n\n let dt = time - this._time;\n this.step(dt);\n return this;\n }", "function Schedule(options,element){return _super.call(this,options,element)||this;}", "timer() {\n this.sethandRotation('hour');\n this.sethandRotation('minute');\n this.sethandRotation('second');\n }", "tick() {\n\t\t// debug\n\t\t// console.log(\"atomicGLClock::tick\");\t\n var timeNow = new Date().getTime();\n\n if (this.lastTime != 0)\n \tthis.elapsed = timeNow - this.lastTime;\n\n this.lastTime = timeNow;\n }", "get time () {\n\t\treturn this._time;\n\t}", "function time(){\n\t $('#Begtime').mobiscroll().time({\n\t theme: 'wp',\n\t display: 'inline',\n\t mode: 'scroller'\n\t });\n\t $('#Endtime').mobiscroll().time({\n\t theme: 'wp',\n\t display: 'inline',\n\t mode: 'scroller'\n\t });\n\t removeUnwanted(); \n\t insertClass(); \n\t getTimeFromInput(\"Begtime\");\n\t getTimeFromInput(\"Endtime\");\n\t}", "function Timer() {}", "init(...args) {\n\t\tthis._super(...args);\n\n\t\tthis.setupTime();\n\t}", "_setTime() {\n switch(this.difficultyLevel) {\n case 1:\n // this.gameTime uses ms\n this.gameTime = 45000;\n break;\n case 2:\n this.gameTime = 100000;\n break;\n case 3:\n this.gameTime = 160000;\n break;\n case 4:\n this.gameTime = 220000;\n break;\n default:\n throw new Error('there is no time');\n }\n }", "update_() {\n var current = this.tlc_.getCurrent();\n this.scope_['time'] = current;\n var t = new Date(current);\n\n var coord = this.coord_ || MapContainer.getInstance().getMap().getView().getCenter();\n\n if (coord) {\n coord = olProj.toLonLat(coord, osMap.PROJECTION);\n\n this.scope_['coord'] = coord;\n var sets = [];\n\n // sun times\n var suntimes = SunCalc.getTimes(t, coord[1], coord[0]);\n var sunpos = SunCalc.getPosition(t, coord[1], coord[0]);\n\n // Determine dawn/dusk based on user preference\n var calcTitle;\n var dawnTime;\n var duskTime;\n\n switch (settings.getInstance().get(SettingKey.DUSK_MODE)) {\n case 'nautical':\n calcTitle = 'Nautical calculation';\n dawnTime = suntimes.nauticalDawn.getTime();\n duskTime = suntimes.nauticalDusk.getTime();\n break;\n case 'civilian':\n calcTitle = 'Civilian calculation';\n dawnTime = suntimes.dawn.getTime();\n duskTime = suntimes.dusk.getTime();\n break;\n case 'astronomical':\n default:\n calcTitle = 'Astronomical calculation';\n dawnTime = suntimes.nightEnd.getTime();\n duskTime = suntimes.night.getTime();\n break;\n }\n\n var times = [{\n 'label': 'Dawn',\n 'time': dawnTime,\n 'title': calcTitle,\n 'color': '#87CEFA'\n }, {\n 'label': 'Sunrise',\n 'time': suntimes.sunrise.getTime(),\n 'color': '#FFA500'\n }, {\n 'label': 'Solar Noon',\n 'time': suntimes.solarNoon.getTime(),\n 'color': '#FFD700'\n }, {\n 'label': 'Sunset',\n 'time': suntimes.sunset.getTime(),\n 'color': '#FFA500'\n }, {\n 'label': 'Dusk',\n 'time': duskTime,\n 'title': calcTitle,\n 'color': '#87CEFA'\n }, {\n 'label': 'Night',\n 'time': suntimes.night.getTime(),\n 'color': '#000080'\n }];\n\n this.scope_['sun'] = {\n 'altitude': sunpos.altitude * geo.R2D,\n 'azimuth': (geo.R2D * (sunpos.azimuth + Math.PI)) % 360\n };\n\n // moon times\n var moontimes = SunCalc.getMoonTimes(t, coord[1], coord[0]);\n var moonpos = SunCalc.getMoonPosition(t, coord[1], coord[0]);\n var moonlight = SunCalc.getMoonIllumination(t);\n\n this.scope_['moonAlwaysDown'] = moontimes.alwaysDown;\n this.scope_['moonAlwaysUp'] = moontimes.alwaysUp;\n\n if (moontimes.rise) {\n times.push({\n 'label': 'Moonrise',\n 'time': moontimes.rise.getTime(),\n 'color': '#ddd'\n });\n }\n\n if (moontimes.set) {\n times.push({\n 'label': 'Moonset',\n 'time': moontimes.set.getTime(),\n 'color': '#2F4F4F'\n });\n }\n\n var phase = '';\n for (var i = 0, n = PHASES.length; i < n; i++) {\n if (moonlight.phase >= PHASES[i].min && moonlight.phase < PHASES[i].max) {\n phase = PHASES[i].label;\n break;\n }\n }\n\n this.scope_['moon'] = {\n 'alwaysUp': moontimes.alwaysUp,\n 'alwaysDown': moontimes.alwaysDown,\n 'azimuth': (geo.R2D * (moonpos.azimuth + Math.PI)) % 360,\n 'altitude': moonpos.altitude * geo.R2D,\n 'brightness': Math.ceil(moonlight.fraction * 100) + '%',\n 'phase': phase\n };\n\n times = times.filter(filter);\n times.forEach(addTextColor);\n googArray.sortObjectsByKey(times, 'time');\n sets.push(times);\n\n this.scope_['times'] = times;\n ui.apply(this.scope_);\n }\n }", "function TimeManager() {\n var self = this;\n\n this.init = function () {\n self.initTime = (new Date()).getTime() / 1000;\n self.offset = 0;\n self.speed = 1;\n self.query_params = self.get_query_param();\n if (self.query_params.hasOwnProperty('time')) {\n self.offset = parseInt(self.query_params.time);\n }\n else if (self.query_params.hasOwnProperty('from')) {\n self.offset = parseInt(self.query_params.from);\n }\n if (self.offset) {\n self.speed = 20;\n }\n\n if (self.query_params.hasOwnProperty('speed')) {\n self.speed = parseFloat(self.query_params.speed);\n }\n };\n\n this.getTime = function() {\n var realTime = self.getRealTime();\n if (self.offset) {\n return self.offset + (realTime - self.initTime) * self.speed;\n }\n\n return realTime;\n };\n\n this.getRealTime = function () {\n return (new Date()).getTime() / 1000;\n };\n\n // Extracts query params from url.\n this.get_query_param = function () {\n var query_string = {};\n var query = window.location.search.substring(1);\n var pairs = query.split('&');\n for (var i = 0; i < pairs.length; i++) {\n var pair = pairs[i].split('=');\n\n // If first entry with this name.\n if (typeof query_string[pair[0]] === 'undefined') {\n query_string[pair[0]] = decodeURIComponent(pair[1]);\n }\n // If second entry with this name.\n else if (typeof query_string[pair[0]] === 'string') {\n query_string[pair[0]] = [\n query_string[pair[0]],\n decodeURIComponent(pair[1])\n ];\n }\n // If third or later entry with this name\n else {\n query_string[pair[0]].push(decodeURIComponent(pair[1]));\n }\n }\n\n return query_string;\n };\n\n this.init();\n\n return this;\n}", "function playInst(inst, startTime, stopTime){\n\n var inst = inst;\n var startTime = startTime;\n var stopTime = stopTime;\n\n inst.startAtTime(globalNow+startTime);\n inst.stopAtTime(globalNow+stopTime);\n\n}", "constructor() {\r\n super();\r\n /**\r\n * Previous measurement time\r\n * @private\r\n * @type {number}\r\n */\r\n this.oldTime_;\r\n }", "getGameTime() {\n return this.time / 1200;\n }", "onChange(e) {\n if (this.props.onChange) {\n this.props.onChange(e);\n }\n window.$('#' + this.id).timepicker('setTime', e.target.value);\n }", "update(scene, time, delta) {\n // Tick the time (setting the milliseconds will automatically convert up into seconds/minutes/hours)\n this.time.setMilliseconds(this.time.getMilliseconds() + (delta * this.speed * CONSTANTS.SIMULATION_SPEED_FACTOR));\n\n // Update the sky's ambient color\n this.updateAmbientLightColor();\n\n // Check if we can emit an event to the event emitter to notify about the time of day\n // Only emits once, thats why we have the flags\n if (this.time.getHours() == 8 && !this.calledMorning) {\n this.events.emit(\"morning\");\n\n this.calledMorning = true;\n this.calledNoon = false;\n this.calledEvening = false;\n this.calledNight = false;\n } else if (this.time.getHours() == 12 && !this.calledNoon) {\n this.events.emit(\"noon\");\n\n this.calledMorning = false;\n this.calledNoon = true;\n this.calledEvening = false;\n this.calledNight = false; \n } else if (this.time.getHours() == 18 && !this.calledEvening) {\n this.events.emit(\"evening\");\n\n this.calledMorning = false;\n this.calledNoon = false;\n this.calledEvening = true;\n this.calledNight = false; \n } else if (this.time.getHours() == 21 && !this.calledNight) {\n this.events.emit(\"night\");\n\n this.calledMorning = false;\n this.calledNoon = false;\n this.calledEvening = false;\n this.calledNight = true; \n }\n }", "function newRE(name) {\n\n // Object holding defaults for various saved fields.\n var virginData = {\n type: \"pk_rhythm_engine\",\n version: 1,\n morpher: {x: 36, y: 36},\n kits: [],\n voices: [],\n presets: [],\n clock: {struc: \"simple\", sig: 0, bar: 0, beat: 0, pos: 0, tempo_bpm: 90, cycleLength: 16, running: false}\n };\n\n // data will be saved and loaded to localStorage.\n var data = copy_object(virginData);\n\n var clockLastTime_secs = undefined;\n var lastTickTime_secs = 0;\n var kDelay_secs = 0.05;\n var clockJSN = undefined;\n\n // Load info about existing kits into the engine.\n function initData() {\n var k, ki;\n for (k in availableKitInfos) {\n ki = availableKitInfos[k];\n data.kits.push({\n name: ki.name,\n url: ki.url\n });\n }\n }\n\n initData();\n\n var kitNames = [];\n\n // Status of whether the clockTick() should do morphing calculations.\n var morphEnabled = 0;\n var morphNeedsUpdate = false;\n\n // Clock callbacks.\n var onGridTick = undefined;\n var onMorphUpdate = undefined;\n\n // Runs at about 60 ticks per second (linked to screen refresh rate).\n function clockTick() {\n var clock = data.clock;\n\n // Check whether the engine is running.\n if (!clock.running) {\n clockLastTime_secs = undefined;\n return;\n }\n\n var delta_secs = 0, dbeat, dbar;\n\n while (true) {\n if (clockLastTime_secs) {\n var now_secs = theAudioContext.currentTime;\n var sqpb = kTimeStruc[clock.struc].semiQuaversPerBar;\n var ticks_per_sec = clock.tempo_bpm * sqpb / 60;\n var nextTickTime_secs = lastTickTime_secs + 1 / ticks_per_sec;\n if (now_secs + kDelay_secs >= nextTickTime_secs) {\n dbeat = Math.floor(((clock.pos % sqpb) + 1) / sqpb);\n dbar = Math.floor((clock.beat + dbeat) / kTimeSig.D[clock.sig]);\n clock.bar = (clock.bar + dbar) % kTimeStruc[clock.struc].cycleLength;\n clock.beat = (clock.beat + dbeat) % kTimeSig.N[clock.sig];\n clock.pos = clock.pos + 1;\n lastTickTime_secs = nextTickTime_secs;\n } else {\n return;\n }\n } else {\n // Very first call.\n clockLastTime_secs = theAudioContext.currentTime;\n clock.bar = 0;\n clock.beat = 0;\n clock.pos = 0;\n lastTickTime_secs = clockLastTime_secs + kDelay_secs;\n }\n\n // If we're doing a morph, set all the relevant control values.\n updateMorph();\n\n // Perform all the voices for all the active presets.\n var i, N, v;\n for (i = 0, N = data.voices.length; i < N; ++i) {\n v = data.voices[i];\n if (v) {\n genBeat(v, clock, lastTickTime_secs);\n }\n }\n\n // Do the callback if specified.\n if (onGridTick) {\n onGridTick(clock);\n }\n }\n }\n\n var kVoiceControlsToMorph = [\n 'straight', 'offbeat', 'funk', 'phase', 'random', \n 'ramp', 'threshold', 'mean', 'cycleWeight', 'volume', 'pan'\n ];\n\n // Utility to calculate a weighted sum.\n // \n // weights is an array of weights. Entries can include 'undefined',\n // in which case they'll not be included in the weighted sum.\n //\n // value_getter is function (i) -> value\n // result_transform(value) is applied to the weighted sum before \n // returning the result value.\n function morphedValue(weights, value_getter, result_transform) {\n var result = 0, wsum = 0;\n var i, N, val;\n for (i = 0, N = weights.length; i < N; ++i) {\n if (weights[i] !== undefined) {\n val = value_getter(i);\n if (val !== undefined) {\n result += weights[i] * val;\n wsum += weights[i];\n }\n }\n }\n return result_transform ? result_transform(result / wsum) : result / wsum;\n }\n\n // Something about the morph status changed.\n // Update the parameters of all the voices to reflect\n // the change.\n function updateMorph() {\n var i, N;\n if (morphEnabled && morphNeedsUpdate && data.presets.length > 1) {\n\n // Compute morph distances for each preset.\n var morphWeights = [], dx, dy, ps;\n for (i = 0, N = data.presets.length; i < N; ++i) {\n ps = data.presets[i];\n if (ps && ps.useInMorph) {\n dx = data.morpher.x - data.presets[i].pos.x;\n dy = data.morpher.y - data.presets[i].pos.y;\n morphWeights[i] = 1 / (1 + Math.sqrt(dx * dx + dy * dy));\n }\n }\n\n // For each voice, compute the morph.\n var wsum = 0, wnorm = 1, p, pN, w, c, cN, v;\n\n // Normalize the morph weights.\n wsum = morphedValue(morphWeights, function (p) { return 1; });\n wnorm = 1 / wsum; // WARNING: Divide by zero?\n\n // For each voice and for each control in each voice, do the morph.\n for (i = 0, N = data.voices.length; i < N; ++i) {\n for (c = 0, cN = kVoiceControlsToMorph.length, v = data.voices[i]; c < cN; ++c) {\n v[kVoiceControlsToMorph[c]] = morphedValue(morphWeights, function (p) { \n var ps = data.presets[p];\n return i < ps.voices.length ? ps.voices[i][kVoiceControlsToMorph[c]] : undefined;\n });\n }\n }\n\n // Now morph the tempo. We morph the tempo in the log domain.\n data.clock.tempo_bpm = morphedValue(morphWeights, function (p) { return Math.log(data.presets[p].clock.tempo_bpm); }, Math.exp);\n\n // Morph the cycle length.\n data.clock.cycleLength = Math.round(morphedValue(morphWeights, function (p) { return data.presets[p].clock.cycleLength; }));\n \n if (onMorphUpdate) {\n setTimeout(onMorphUpdate, 0);\n }\n\n morphNeedsUpdate = false;\n --morphEnabled;\n }\n }\n\n // We store info about all the presets as a JSON string in\n // a single key in localStorage.\n var storageKey = 'com.nishabdam.PeteKellock.RhythmEngine.' + name + '.data';\n\n // Loads the previous engine state saved in localStorage.\n function load(delegate) {\n var dataStr = window.localStorage[storageKey];\n if (dataStr) {\n loadFromStr(dataStr, delegate);\n } else {\n alert(\"RhythmEngine: load error\");\n }\n }\n\n // Loads an engine state saved as a string from, possibly, an \n // external source.\n function loadFromStr(dataStr, delegate) {\n try {\n data = JSON.parse(dataStr);\n } catch (e) {\n setTimeout(function () {\n delegate.onError(\"Corrupt rhythm engine snapshot file.\");\n }, 0);\n return;\n }\n\n var work = {done: 0, total: 0};\n\n function reportProgress(changeInDone, changeInTotal, desc) {\n work.done += changeInDone;\n work.total += changeInTotal;\n if (delegate.progress) {\n delegate.progress(work.done, work.total, desc);\n }\n }\n\n reportProgress(0, data.kits.length * 10);\n\n kitNames = [];\n\n data.kits.forEach(function (kitInfo) {\n SampleManager.loadSampleSet(kitInfo.name, kitInfo.url, {\n didFetchMappings: function (name, mappings) {\n reportProgress(0, getKeys(mappings).length * 2);\n },\n didLoadSample: function (name, key) {\n reportProgress(1, 0);\n },\n didDecodeSample: function () {\n reportProgress(1, 0);\n },\n didFinishLoadingSampleSet: function (name, sset) {\n kitNames.push(name);\n\n // Save the drum names.\n kitInfo.drums = getKeys(sset);\n\n reportProgress(10, 0);\n\n if (kitNames.length === data.kits.length) {\n // We're done.\n delegate.didLoad();\n clockTick();\n }\n }\n });\n });\n }\n\n // This is for loading the JSON string if the user \n // gives it by choosing an external file.\n function loadExternal(fileData, delegate, dontSave) {\n if (checkSnapshotFileData(fileData, delegate)) {\n loadFromStr(fileData, {\n progress: delegate.progress,\n didLoad: function () {\n if (!dontSave) {\n save();\n }\n delegate.didLoad();\n }\n });\n }\n }\n\n // A simple check for the starting part of a snapshot file.\n // This relies on the fact that browser javascript engines\n // enumerate an object's keys in the same order in which they\n // were inserted into the object.\n function checkSnapshotFileData(fileData, delegate) {\n var valid = (fileData.indexOf('{\"type\":\"pk_rhythm_engine\"') === 0);\n if (!valid) {\n setTimeout(function () {\n delegate.onError(\"This is not a rhythm engine snapshot file.\");\n }, 0);\n }\n return valid;\n }\n\n // Loads settings from file with given name, located in\n // the \"settings\" folder.\n function loadFile(filename, delegate) {\n if (filename && typeof(filename) === 'string') {\n fs.root.getDirectory(\"settings\", {create: true},\n function (settingsDir) {\n settingsDir.getFile(filename, {create: false},\n function (fileEntry) {\n fileEntry.file(\n function (f) {\n var reader = new global.FileReader();\n\n reader.onloadend = function () {\n loadExternal(reader.result, delegate, true);\n };\n reader.onerror = delegate && delegate.onError;\n\n reader.readAsText(f);\n },\n delegate && delegate.onError\n );\n },\n delegate && delegate.onError\n );\n },\n delegate && delegate.onError\n );\n } else {\n load(delegate);\n }\n }\n\n // Makes an array of strings giving the names of saved\n // settings and calls delegate.didListSettings(array)\n // upon success. delegate.onError is called if there is\n // some error.\n function listSavedSettings(delegate) {\n fs.root.getDirectory(\"settings\", {create: true},\n function (settingsDir) {\n var reader = settingsDir.createReader();\n var result = [];\n\n function readEntries() {\n reader.readEntries(\n function (entries) {\n var i, N;\n\n if (entries.length === 0) {\n // We're done.\n delegate.didListSettings(result.sort());\n } else {\n // More to go. Accumulate the names.\n for (i = 0, N = entries.length; i < N; ++i) {\n result.push(entries[i].name);\n }\n\n // Continue listing the directory.\n readEntries();\n }\n },\n delegate && delegate.onError\n );\n }\n\n readEntries();\n },\n delegate && delegate.onError\n );\n }\n\n // Saves all the presets in local storage.\n function save(filename, delegate) {\n var dataAsJSON = JSON.stringify(data);\n\n // First save a copy in the locaStorage for worst case scenario.\n window.localStorage[storageKey] = dataAsJSON;\n\n if (filename && typeof(filename) === 'string') {\n fs.root.getDirectory(\"settings\", {create: true},\n function (settingsDir) {\n settingsDir.getFile(filename, {create: true},\n function (f) {\n f.createWriter(\n function (writer) {\n writer.onwriteend = delegate && delegate.didSave;\n writer.onerror = delegate && delegate.onError;\n\n var bb = new global.BlobBuilder();\n bb.append(dataAsJSON);\n writer.write(bb.getBlob());\n },\n delegate && delegate.onError\n );\n },\n delegate && delegate.onError\n );\n },\n delegate && delegate.onError\n );\n }\n }\n\n // Make a \"voice\" object exposing all the live-tweakable\n // parameters. The API user can just set these parameters\n // to hear immediate effect in the RE's output.\n function make_voice(kit, drum) {\n return {\n voice: {kit: kit, drum: drum},\n straight: 0.5,\n offbeat: 0.0,\n funk: 0.0,\n phase: 0,\n random: 0.0,\n ramp: 0.2,\n threshold: 0.5,\n mean: 0.5,\n cycleWeight: 0.2,\n volume: 1.0,\n pan: 0.0\n };\n }\n\n function validatePresetIndex(p, extra) {\n if (p < 0 || p >= data.presets.length + (extra ? extra : 0)) {\n throw new Error('Invalid preset index!');\n }\n }\n\n return {\n kits: data.kits, // Read-only.\n save: save,\n snapshot: function () { return JSON.stringify(data); },\n load: loadFile,\n list: listSavedSettings,\n import: loadExternal,\n\n // You can set a callback to be received on every grid tick so\n // that you can do something visual about it. The callback will\n // receive the current clock status as the sole argument.\n // The callback is expected to not modify the clock.\n get onGridTick() { return onGridTick; },\n set onGridTick(newCallback) { onGridTick = newCallback; },\n\n // You can set a callback for notification whenever the bulk\n // of sliders have been changed due to a morph update.\n get onMorphUpdate() { return onMorphUpdate; },\n set onMorphUpdate(newCallback) { onMorphUpdate = newCallback; },\n\n // Change the tempo by assigning to tempo_bpm field.\n get tempo_bpm() {\n return data.clock.tempo_bpm;\n },\n set tempo_bpm(new_tempo_bpm) {\n data.clock.tempo_bpm = Math.min(Math.max(10, new_tempo_bpm), 480);\n },\n\n // Info about the voices and facility to add more.\n numVoices: function () { return data.voices.length; },\n voice: function (i) { return data.voices[i]; },\n addVoice: function (kit, drum) {\n var voice = make_voice(kit || 'acoustic-kit', drum || 'kick');\n data.voices.push(voice);\n return voice;\n },\n\n // Info about presets and the ability to add/save to presets.\n numPresets: function () { return data.presets.length; },\n preset: function (p) { return data.presets[p]; },\n saveAsPreset: function (p) {\n validatePresetIndex(p, 1);\n\n p = Math.min(data.presets.length, p);\n\n // Either make a new preset or change a saved one.\n // We preserve a preset's morph weight if we're\n // changing one to a new snapshot.\n var old = (p < data.presets.length ? data.presets[p] : {pos: {x: 0, y: 0}});\n data.presets[p] = {\n useInMorph: old.useInMorph,\n pos: copy_object(old.pos),\n clock: copy_object(data.clock),\n voices: copy_object(data.voices)\n };\n },\n\n\n // Morphing functions. The initial state of the morpher is \"disabled\",\n // so as long as that is the case, none of the 2D position functions\n // have any effect. You first need to enable the morpher before\n // the other calls have any effect.\n enableMorph: function (flag) {\n morphEnabled += flag ? 1 : 0;\n if (flag) {\n morphNeedsUpdate = true;\n }\n },\n presetPos: function (p) { return data.presets[p].pos; },\n changePresetPos: function (p, x, y) {\n validatePresetIndex(p);\n var pos = data.presets[p].pos;\n pos.x = x;\n pos.y = y;\n morphNeedsUpdate = true;\n },\n morpherPos: function () { return data.morpher; },\n changeMorpherPos: function (x, y) {\n data.morpher.x = x;\n data.morpher.y = y;\n morphNeedsUpdate = true;\n },\n\n // Starting and stopping the engine. Both methods are\n // idempotent.\n get running() { return data.clock.running; },\n start: function () {\n if (!data.clock.running) {\n data.clock.running = true;\n clockLastTime_secs = undefined;\n clockJSN = theAudioContext.createJavaScriptNode(512, 0, 1);\n clockJSN.onaudioprocess = function (event) {\n clockTick();\n };\n clockJSN.connect(theAudioContext.destination);\n }\n },\n stop: function () {\n data.clock.running = false;\n if (clockJSN) {\n clockJSN.disconnect();\n clockJSN = undefined;\n }\n }\n };\n }", "function interval(){\r\n\ttry{\r\n\t\tthis.startTime = function (){\t\r\n\t\t\ttry{\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tvar today=new Date();\r\n\t\t\t\t\tvar h=today.getHours();\r\n\t\t\t\t\tvar m=today.getMinutes();\r\n\t\t\t\t\tvar startm = today.getMinutes();\r\n var s=today.getSeconds();\r\n\t\t\t\t\t// add a zero in front of numbers<10\r\n\t\t\t\t\tm=this.checkTime(m);\r\n\t\t\t\t\ts=this.checkTime(s);\r\n\r\n $('txt').innerHTML= h+\":\"+m+\":\"+s;\r\n\t\t\t\t\t$('clock').value = m;\t\t\r\n\t\t\t\t\tt=setTimeout('intervalObj.startTime()',500);\t\t\t\t\t\r\n\t\t\t\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.startTime()');\r\n\t\t\t}\r\n\t\t}\r\n\t\t// add a zero in front of numbers<10\r\n\t\tthis.checkTime = function(i){\r\n\t\t\ttry{\r\n\t\t\t\tif (i<10){\r\n\t\t\t\t\ti=\"0\" + i;\r\n\t\t\t\t}\r\n\t\t\t\treturn i;\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.checkTime()');\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t//End of clock function\r\n\t\t//To start the clock on web page.\r\n\t\t\r\n\t\tthis.call = function(){\r\n\t\t\ttry{\r\n\r\n\t\t\t\t$('text').value=$('txt').innerHTML;\r\n\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.call()');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//To stop the clock.\r\n\t\tthis.stopTime = function(){\r\n\t\t\ttry{\r\n\t\t\t\t$('txtTime').value=$('txt').innerHTML;\r\n document.getElementById(\"txt\").style.display = 'none';\r\n\r\n }catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.stopTime()');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t//To calculate the total time difference.\r\n\t\tthis.calculateTotalTime = function() {\r\n\t\t\ttry{\r\n\t\t\t\tvar t1=$('text').value;\r\n\t\t\t\tvar t2=$('txtTime').value;\r\n\t\t\t\tvar arrt1 = t1.split(\":\");\r\n\t\t\t\tvar arrt2 = t2.split(\":\");\t\t\r\n\t\t\t\tvar sub=(((arrt2[0]*3600)+(arrt2[1]*60)+(arrt2[2])*1)-((arrt1[0]*3600)+(arrt1[1]*60)+(arrt1[2])*1));\r\n\t\t\t\tvar timeDifference=this.convertTime(sub);\t\t\r\n\t\t\treturn timeDifference;\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.calculateTotalTime()');\r\n\t\t\t}\t\r\n\t\t}\r\n this.calculatebatsmanTime = function(t1,t2) {\r\n\t\t\ttry{\r\n\t\t\t\r\n\t\t\t\tvar arrt1 = t1.split(\":\");\r\n\t\t\t\tvar arrt2 = t2.split(\":\");\r\n\t\t\t\tvar sub=(((arrt2[0]*3600)+(arrt2[1]*60)+(arrt2[2])*1)-((arrt1[0]*3600)+(arrt1[1]*60)+(arrt1[2])*1));\r\n\t\t\t\tvar timeDifference=this.convertTime(sub);\r\n\t\t\treturn timeDifference;\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.calculateTotalTime()');\r\n\t\t\t}\r\n\t\t}\r\n\r\n //To Convert time.\r\n\t\tthis.convertTime = function(sub){\r\n\t\t\ttry{\r\n\t\t\t\tvar hrs=parseInt(sub/3600);\t\t\r\n\t\t\t\tvar rem=(sub%3600);\r\n\t\t\t\tvar min=parseInt(rem/60);\r\n\t\t\t\tvar sec=(rem%60);\r\n\t\t\t\tmin=this.checkTime(min);\r\n\t\t\t\tsec=this.checkTime(sec);\r\n\t\t\t\tvar convertDifference=(hrs+\":\"+min+\":\"+sec);\r\n\t\t\treturn convertDifference;\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.convertTime()');\r\n\t\t\t}\t\r\n\t\t}\t\t\r\n\t\t//To display the time period of interruptions and intervals.\r\n\t\t\r\n\t\tthis.DisplayInterval=function(flag){\r\n\t\r\n\t\t\tvar MATCH_TIME_ACC=42000;//700min.\r\n\t\t\tvar MATCH_INNING_ACC=21000;//350min.\r\n\t\r\n\t\t\ttry{\r\n\t\t\t\tif($('text').value==\"\" && $('txtTime').value==\"\"){\r\n\t\t\t\t\talert(\"You Did Not Start Timer\");\r\n\t\t\t\t}else if(flag==1){\t\t\r\n\t\t\t\t\talert(\"Interruption Time is:: \"+this.calculateTotalTime());\r\n\t\t\t\t}else if(flag==2){\t\r\n\t\t\t\t\t//Interval-Injury\r\n\t\t\t\t\tvar time=this.calculateTotalTime();\r\n\t\t\t\t\tvar arrtime = time.split(\":\");\r\n\t\t\t\t\tvar sec=(arrtime[0]*3600)+(arrtime[1]*60)+(arrtime[2]*1);\r\n\t\t\t\t\tMATCH_TIME_ACC=MATCH_TIME_ACC+sec;//Adding minits in match_time account.\r\n\t\t\t\t\tvar matchTime=this.convertTime(MATCH_TIME_ACC);\r\n\t\t\t\t\r\n\t\t\t\t}else if(flag==3){\r\n\t\t\t\t\t\t//Interval-Drink\r\n\t\t\t\t\t\tvar time=this.calculateTotalTime();\r\n\t\t\t\t\t\tvar arrtime = time.split(\":\");\r\n\t\t\t\t\t\tvar sec=(arrtime[0]*3600)+(arrtime[1]*60)+(arrtime[2]*1);\r\n\t\t\t\t\t\tMATCH_TIME_ACC=MATCH_TIME_ACC+sec;//Adding minits in match_time account.\r\n\t\t\t\t\t\tvar matchTime=this.convertTime(MATCH_TIME_ACC);\r\n\t\t\t\t\t\tMATCH_INNING_ACC=MATCH_INNING_ACC+sec;//Adding minits in match_inning Account\r\n\t\t\t\t\t\tvar inningTime=this.convertTime(MATCH_INNING_ACC);\r\n\t\t\t\t}else if(flag==4){\r\n\t\t\t\t\t\t//Interval-Lunch/Tea.\r\n\t\t\t\t\t\tthis.calculateTotalTime();\r\n\t\t\t\t}\r\n\t\t\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval.DisplayInterval()');\r\n\t\t\t}\t\r\n\t\t}\t\r\n\t\t\r\n\t}catch(err){\r\n\t\t\t\talert(err.description,'BCCI.js.interval()');\r\n\t}\t\t\r\n}", "function tick() {\n\n\n\n}", "set_time( t ){ this.current_time = t; this.draw_fg(); return this; }" ]
[ "0.60914993", "0.5946908", "0.575641", "0.57523924", "0.57523924", "0.57110393", "0.5612518", "0.5518446", "0.5502605", "0.5496253", "0.54666376", "0.54654276", "0.5452242", "0.53977484", "0.5385463", "0.5348433", "0.53089094", "0.5291369", "0.52643234", "0.5233921", "0.5232764", "0.52305794", "0.5220939", "0.5216883", "0.5214839", "0.5207572", "0.5198916", "0.51798856", "0.51566845", "0.515222", "0.51496196", "0.51485324", "0.5144256", "0.5140738", "0.5129704", "0.51106876", "0.51010126", "0.5095933", "0.5095795", "0.5086692", "0.5086692", "0.50718004", "0.50716335", "0.50697833", "0.50695676", "0.5063659", "0.5048897", "0.5043801", "0.50374174", "0.50353235", "0.5021129", "0.5016889", "0.50091654", "0.500235", "0.4998731", "0.49837714", "0.49772945", "0.49770126", "0.49737597", "0.49668872", "0.49625754", "0.4962097", "0.4956865", "0.49551082", "0.49509278", "0.49332947", "0.49187458", "0.49144673", "0.49136177", "0.4909255", "0.4904737", "0.48905534", "0.4885503", "0.48838967", "0.48835048", "0.48817733", "0.48775628", "0.48739123", "0.4865101", "0.48649183", "0.48613042", "0.48597804", "0.48594204", "0.48568666", "0.48500293", "0.48483878", "0.48413312", "0.4840013", "0.483948", "0.48315957", "0.48286375", "0.48266605", "0.4820929", "0.48142713", "0.4811499", "0.48099202", "0.48085442", "0.48068577", "0.48040769", "0.4797545", "0.4796" ]
0.0
-1
You can extend webpack config here
extend (config, ctx) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "extend (config, { isDev, isClient }) {\n // if (isDev && isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n // }\n if (process.server && process.browser) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n config.plugins.push(\n new webpack.EnvironmentPlugin([\n 'APIKEY',\n 'AUTHDOMAIN',\n 'DATABASEURL',\n 'PROJECTID',\n 'STORAGEBUCKET',\n 'MESSAGINGSENDERID'\n ])\n )\n }", "function getBaseWebpackConfig(){\n const config={\n entry:{\n main:['./src/index.js']\n },\n alias:{\n $redux:'../src/redux',\n $service:'../src/service'\n },\n resolve:{\n extensions:['.js','.jsx']\n },\n // entry:['src/index.js'],\n module:{\n rules:[\n {\n test:/\\.(js|jsx)?$/,\n exclude:/node_modules/,\n use:getBabelLoader()\n }\n ]\n },\n plugins:[\n new HtmlWebpackPlugin({\n inject:true,\n // template:index_template,\n template:'./index.html',\n filename:'index.html',\n chunksSortMode:'manual',\n chunks:['app']\n })\n ]\n \n }\n return config;\n}", "extend(config, ctx) {\n // config.plugins.push(new HtmlWebpackPlugin({\n // })),\n // config.plugins.push(new SkeletonWebpackPlugin({\n // webpackConfig: {\n // entry: {\n // app: path.join(__dirname, './Skeleton.js'),\n // }\n // },\n // quiet: true\n // }))\n }", "webpack(config) {\n config.resolve.alias['@root'] = path.join(__dirname);\n config.resolve.alias['@components'] = path.join(__dirname, 'components');\n config.resolve.alias['@pages'] = path.join(__dirname, 'pages');\n config.resolve.alias['@services'] = path.join(__dirname, 'services');\n return config;\n }", "extendWebpack (cfg) {\n cfg.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules|quasar)/\n })\n cfg.resolve.alias = {\n ...(cfg.resolve.alias || {}),\n '@components': path.resolve(__dirname, './src/components'),\n '@layouts': path.resolve(__dirname, './src/layouts'),\n '@pages': path.resolve(__dirname, './src/pages'),\n '@utils': path.resolve(__dirname, './src/utils'),\n '@store': path.resolve(__dirname, './src/store'),\n '@config': path.resolve(__dirname, './src/config'),\n '@errors': path.resolve(__dirname, './src/errors'),\n '@api': path.resolve(__dirname, './src/api')\n }\n }", "extend(config, {\n isDev,\n isClient,\n isServer\n }) {\n if (!isDev) return\n if (isClient) {\n // 启用source-map\n // config.devtool = 'eval-source-map'\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 fix: true,\n cache: true\n }\n })\n }\n if (isServer) {\n const nodeExternals = require('webpack-node-externals')\n config.externals = [\n nodeExternals({\n whitelist: [/^vuetify/]\n })\n ]\n }\n }", "extend (config, { isDev, isClient,isServer }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n config.devtool = 'eval-source-map'\n }\n // if (isServer) {\n // config.externals = [\n // require('webpack-node-externals')({\n // whitelist: [/\\.(?!(?:js|json)$).{1,5}$/i, /^ai-act-ui/, /^ai-i/]\n // })\n // ]\n // }\n }", "extend(config, ctx) {\n config.module.rules.push({ test: /\\.graphql?$/, loader: 'webpack-graphql-loader' })\n config.plugins.push(new webpack.ProvidePlugin({\n mapboxgl: 'mapbox-gl'\n }))\n }", "function webpackCommonConfigCreator(options) {\r\n\r\n return {\r\n mode: options.mode, // 开发模式\r\n entry: \"./src/index.js\",\r\n externals: {\r\n \"react\": \"react\",\r\n \"react-dom\": \"react-dom\",\r\n // \"lodash\": \"lodash\",\r\n \"antd\": \"antd\",\r\n \"@fluentui/react\": \"@fluentui/react\",\r\n \"styled-components\": \"styled-components\"\r\n },\r\n output: {\r\n // filename: \"bundle.js\",\r\n // 分配打包后的目录,放于js文件夹下\r\n // filename: \"js/bundle.js\",\r\n // 对输出的 bundle.js 进行优化:分割输出,减小体积\r\n // filename: \"js/[name][hash].js\", // 改在 webpack.prod.js 和 webpack.dev.js 中根据不同环境配置不同的hash值\r\n path: path.resolve(__dirname, \"../build\"),\r\n publicPath: \"/\"\r\n },\r\n // 对输出的 bundle.js 进行优化:分割输出,减小体积\r\n optimization: {\r\n splitChunks: {\r\n chunks: \"all\",\r\n minSize: 50000,\r\n minChunks: 1,\r\n }\r\n },\r\n plugins: [\r\n // new HtmlWebpackPlugin(),\r\n new HtmlWebpackPlugin({\r\n template: path.resolve(__dirname, \"../public/index.html\"),\r\n // filename: \"./../html/index.html\", //编译后生成新的html文件路径\r\n // thunks: ['vendor', 'index'], // 需要引入的入口文件\r\n // excludeChunks: ['login'], // 不需要引入的入口文件\r\n favicon: path.resolve(__dirname, \"../src/assets/images/favicon.ico\") //favicon.ico文件路径\r\n }),\r\n new CleanWebpackPlugin({\r\n cleanOnceBeforeBuildPatterns: [path.resolve(process.cwd(), \"build/\"), path.resolve(process.cwd(), \"dist/\")]\r\n }),\r\n new ExtractTextPlugin({\r\n // filename: \"[name][hash].css\"\r\n // 分配打包后的目录,放于css文件夹下\r\n filename: \"css/[name][hash].css\"\r\n }),\r\n ],\r\n module: {\r\n rules: [\r\n {\r\n test: /\\.(js|jsx)$/,\r\n // include: path.resolve(__dirname, \"../src\"),\r\n // 用排除的方式,除了 /node_modules/ 都让 babel-loader 进行解析,这样一来就能解析引用的别的package中的组件了\r\n // exclude: /node_modules/,\r\n use: [\r\n {\r\n loader: \"babel-loader\",\r\n options: {\r\n presets: ['@babel/preset-react'],\r\n plugins: [\"react-hot-loader/babel\"]\r\n }\r\n }\r\n ]\r\n },\r\n // {\r\n // test: /\\.html$/,\r\n // use: [\r\n // {\r\n // loader: 'html-loader'\r\n // }\r\n // ]\r\n // },\r\n // {\r\n // test: /\\.css$/,\r\n // use: [MiniCssExtractPlugin.loader, 'css-loader']\r\n // },\r\n {\r\n // test: /\\.css$/,\r\n test: /\\.(css|scss)$/,\r\n // test: /\\.scss$/,\r\n // include: path.resolve(__dirname, '../src'),\r\n exclude: /node_modules/,\r\n // 进一步优化 配置css-module模式(样式模块化),将自动生成的样式抽离到单独的文件中\r\n use: ExtractTextPlugin.extract({\r\n fallback: \"style-loader\",\r\n use: [\r\n {\r\n loader: \"css-loader\",\r\n options: {\r\n modules: {\r\n mode: \"local\",\r\n localIdentName: '[path][name]_[local]--[hash:base64:5]'\r\n },\r\n localsConvention: 'camelCase'\r\n }\r\n },\r\n \"sass-loader\",\r\n // 使用postcss对css3属性添加前缀\r\n {\r\n loader: \"postcss-loader\",\r\n options: {\r\n ident: 'postcss',\r\n plugins: loader => [\r\n require('postcss-import')({ root: loader.resourcePath }),\r\n require('autoprefixer')()\r\n ]\r\n }\r\n }\r\n ]\r\n })\r\n },\r\n {\r\n test: /\\.less$/,\r\n use: [\r\n { loader: 'style-loader' },\r\n { loader: 'css-loader' },\r\n {\r\n loader: 'less-loader',\r\n options: {\r\n // modifyVars: {\r\n // 'primary-color': '#263961',\r\n // 'link-color': '#263961'\r\n // },\r\n javascriptEnabled: true\r\n }\r\n }\r\n ]\r\n },\r\n // 为第三方包配置css解析,将样式表直接导出\r\n {\r\n test: /\\.(css|scss|less)$/,\r\n exclude: path.resolve(__dirname, '../src'),\r\n use: [\r\n \"style-loader\",\r\n \"css-loader\",\r\n \"sass-loader\",\r\n \"less-loader\"\r\n // {\r\n // loader: 'file-loader',\r\n // options: {\r\n // name: \"css/[name].css\"\r\n // }\r\n // }\r\n ]\r\n },\r\n // 字体加载器 (前提:yarn add file-loader -D)\r\n {\r\n test: /\\.(woff|woff2|eot|ttf|otf)$/,\r\n use: ['file-loader']\r\n },\r\n // 图片加载器 (前提:yarn add url-loader -D)\r\n {\r\n test: /\\.(jpg|png|svg|gif)$/,\r\n use: [\r\n {\r\n loader: 'url-loader',\r\n options: {\r\n limit: 10240,\r\n // name: '[hash].[ext]',\r\n // 分配打包后的目录,放于images文件夹下\r\n name: 'images/[hash].[ext]',\r\n publicPath: \"/\"\r\n }\r\n },\r\n ]\r\n },\r\n ]\r\n },\r\n // 后缀自动补全\r\n resolve: {\r\n // symlinks: false,\r\n extensions: ['.js', '.jsx', '.png', '.svg'],\r\n alias: {\r\n src: path.resolve(__dirname, '../src'),\r\n components: path.resolve(__dirname, '../src/components'),\r\n routes: path.resolve(__dirname, '../src/routes'),\r\n utils: path.resolve(__dirname, '../src/utils'),\r\n api: path.resolve(__dirname, '../src/api')\r\n }\r\n }\r\n }\r\n}", "extend(config, { isDev, isClient }) {\n\n // Resolve vue2-google-maps issues (server-side)\n // - an alternative way to solve the issue\n // -----------------------------------------------------------------------\n // config.module.rules.splice(0, 0, {\n // test: /\\.js$/,\n // include: [path.resolve(__dirname, './node_modules/vue2-google-maps')],\n // loader: 'babel-loader',\n // })\n }", "extend (config, ctx) {\n config.devtool = ctx.isClient ? \"eval-source-map\" : \"inline-source-map\";\n\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: \"pre\",\n // test: /\\.(js|vue)$/,\n // loader: \"eslint-loader\",\n // exclude: /(node_modules)/,\n // });\n // }\n }", "extend (config, { isDev, isClient }) {\n config.resolve.alias['fetch'] = path.join(__dirname, 'utils/fetch.js')\n config.resolve.alias['api'] = path.join(__dirname, 'api')\n config.resolve.alias['layouts'] = path.join(__dirname, 'layouts')\n config.resolve.alias['components'] = path.join(__dirname, 'components')\n config.resolve.alias['utils'] = path.join(__dirname, 'utils')\n config.resolve.alias['static'] = path.join(__dirname, 'static')\n config.resolve.alias['directive'] = path.join(__dirname, 'directive')\n config.resolve.alias['filters'] = path.join(__dirname, 'filters')\n config.resolve.alias['styles'] = path.join(__dirname, 'assets/styles')\n config.resolve.alias['element'] = path.join(__dirname, 'plugins/element-ui')\n config.resolve.alias['@element-ui'] = path.join(__dirname, 'plugins/element-ui')\n config.resolve.alias['e-ui'] = path.join(__dirname, 'node_modules/h666888')\n config.resolve.alias['@e-ui'] = path.join(__dirname, 'plugins/e-ui')\n config.resolve.alias['areaJSON'] = path.join(__dirname, 'static/area.json')\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n /*\n const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;\n config.plugins.push(\n new BundleAnalyzerPlugin({\n openAnalyzer: true\n })\n )\n */\n /**\n *全局引入scss文件\n */\n const sassResourcesLoader = {\n loader: 'sass-resources-loader',\n options: {\n resources: [\n 'assets/styles/var.scss'\n ]\n }\n }\n // 遍历nuxt定义的loader配置,向里面添加新的配置。 \n config.module.rules.forEach((rule) => {\n if (rule.test.toString() === '/\\\\.vue$/') {\n rule.options.loaders.sass.push(sassResourcesLoader)\n rule.options.loaders.scss.push(sassResourcesLoader)\n }\n if (['/\\\\.sass$/', '/\\\\.scss$/'].indexOf(rule.test.toString()) !== -1) {\n rule.use.push(sassResourcesLoader)\n }\n })\n }", "extend(config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: \"pre\",\n test: /\\.(js|vue)$/,\n loader: \"eslint-loader\",\n exclude: /(node_modules)/\n })\n }\n // https://github.com/vuejs/vuepress/blob/14d4d2581f4b7c71ea71a41a1849f582090edb97/lib/webpack/createBaseConfig.js#L92\n config.module.rules.push({\n test: /\\.md$/,\n use: [\n {\n loader: \"vue-loader\",\n options: {\n compilerOptions: {\n preserveWhitespace: false\n }\n }\n },\n {\n loader: require.resolve(\"vuepress/lib/webpack/markdownLoader\"),\n options: {\n sourceDir: \"./blog\",\n markdown: createMarkdown()\n }\n }\n ]\n })\n // fake the temp folder used in vuepress\n config.resolve.alias[\"@temp\"] = path.resolve(__dirname, \"temp\")\n config.plugins.push(\n new webpack.DefinePlugin({\n \"process.GIT_HEAD\": JSON.stringify(GIT_HEAD)\n })\n )\n config.plugins.push(\n new webpack.LoaderOptionsPlugin({\n options: {\n stylus: {\n use: [poststylus([\"autoprefixer\", \"rucksack-css\"])]\n }\n }\n })\n )\n }", "extend (config, { isDev, isClient }) {\n\t\t\tif (isDev && isClient) {\n\t\t\t\tconfig.module.rules.push({\n\t\t\t\t\tenforce: 'pre',\n\t\t\t\t\ttest: /\\.(js|vue)$/,\n\t\t\t\t\tloader: 'eslint-loader',\n\t\t\t\t\texclude: /(node_modules)/\n\t\t\t\t})\n\t\t\t}\n\t\t\tif(!isDev && isClient){\n\t\t\t\tconfig.externals = {\n\t\t\t\t\t\"vue\": \"Vue\",\n\t\t\t\t\t\"axios\" : \"axios\",\n\t\t\t\t\t\"vue-router\" : \"VueRouter\"\n\t\t\t\t},\n\t\t\t\tconfig.output.library = 'LingTal',\n\t\t\t\tconfig.output.libraryTarget = 'umd',\n\t\t\t\tconfig.output.umdNamedDefine = true\n\t\t\t\t//config.output.chunkFilename = _assetsRoot+'js/[chunkhash:20].js'\n\t\t\t}\n\t\t}", "prepareWebpackConfig () {\n // resolve webpack config\n let config = createClientConfig(this.context)\n\n config\n .plugin('html')\n // using a fork of html-webpack-plugin to avoid it requiring webpack\n // internals from an incompatible version.\n .use(require('vuepress-html-webpack-plugin'), [{\n template: this.context.devTemplate\n }])\n\n config\n .plugin('site-data')\n .use(HeadPlugin, [{\n tags: this.context.siteConfig.head || []\n }])\n\n config\n .plugin('vuepress-log')\n .use(DevLogPlugin, [{\n port: this.port,\n displayHost: this.displayHost,\n publicPath: this.context.base,\n clearScreen: !(this.context.options.debug || !this.context.options.clearScreen)\n }])\n\n config = config.toConfig()\n const userConfig = this.context.siteConfig.configureWebpack\n if (userConfig) {\n config = applyUserWebpackConfig(userConfig, config, false /* isServer */)\n }\n this.webpackConfig = config\n }", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n // muse设置\n config.resolve.alias['muse-components'] = 'muse-ui/src'\n config.resolve.alias['vue$'] = 'vue/dist/vue.esm.js'\n config.module.rules.push({\n test: /muse-ui.src.*?js$/,\n loader: 'babel-loader'\n })\n }", "extend(config, { isDev }) {\n if (isDev && process.client) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n // config.module.rules.push({\n // test: /\\.postcss$/,\n // use: [\n // 'vue-style-loader',\n // 'css-loader',\n // {\n // loader: 'postcss-loader'\n // }\n // ]\n // })\n }\n }", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push(\n {\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n options: {\n fix: true\n }\n },\n {\n test: /\\.ico$/,\n loader: 'uri-loader',\n exclude: /(node_modules)/\n }\n )\n console.log(config.output.publicPath, 'config.output.publicPath')\n // config.output.publicPath = ''\n }\n }", "extend(config) {\n if (process.server && process.browser) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "extend (config, ctx) {\n if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n config.node = {\n console: true,\n fs: 'empty',\n net: 'empty',\n tls: 'empty'\n }\n }\n\n if (ctx.isServer) {\n config.externals = [\n nodeExternals({\n whitelist: [/^vuetify/]\n })\n ]\n }\n }", "webpack(config, env) {\n\n // Drop noisy eslint pre-rule\n config.module.rules.splice(1, 1);\n\n // Drop noisy tslint plugin\n const EXCLUDED_PLUGINS = ['ForkTsCheckerWebpackPlugin'];\n config.plugins = config.plugins.filter(plugin => !EXCLUDED_PLUGINS.includes(plugin.constructor.name));\n // config.plugins.push(\n // [\"prismjs\", {\n // \"languages\": [\"go\", \"java\", \"javascript\", \"css\", \"html\"],\n // \"plugins\": [\"line-numbers\", \"show-language\"],\n // \"theme\": \"okaidia\",\n // \"css\": true\n // }]\n // )\n return config;\n }", "extend(config, { isClient, isDev }) {\n // Run ESLint on save\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue|ts)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n })\n\n // stylelint\n config.plugins.push(\n new StylelintPlugin({\n files: ['**/*.vue'],\n }),\n )\n\n config.devtool = '#source-map'\n }\n\n // glsl\n config.module.rules.push({\n test: /\\.(glsl|vs|fs)$/,\n use: ['raw-loader', 'glslify-loader'],\n exclude: /(node_modules)/,\n })\n\n config.module.rules.push({\n test: /\\.(ogg|mp3|wav|mpe?g)$/i,\n loader: 'file-loader',\n options: {\n name: '[path][name].[ext]',\n },\n })\n\n config.output.globalObject = 'this'\n\n config.module.rules.unshift({\n test: /\\.worker\\.ts$/,\n loader: 'worker-loader',\n })\n config.module.rules.unshift({\n test: /\\.worker\\.js$/,\n loader: 'worker-loader',\n })\n\n // import alias\n config.resolve.alias.Sass = path.resolve(__dirname, './assets/sass/')\n config.resolve.alias.Js = path.resolve(__dirname, './assets/js/')\n config.resolve.alias.Images = path.resolve(__dirname, './assets/images/')\n config.resolve.alias['~'] = path.resolve(__dirname)\n config.resolve.alias['@'] = path.resolve(__dirname)\n }", "extend(config, ctx) {\n const vueLoader = config.module.rules.find(\n rule => rule.loader === 'vue-loader'\n )\n vueLoader.options.transformAssetUrls = {\n video: ['src', 'poster'],\n source: 'src',\n img: 'src',\n image: 'xlink:href',\n 'b-img': 'src',\n 'b-img-lazy': ['src', 'blank-src'],\n 'b-card': 'img-src',\n 'b-card-img': 'img-src',\n 'b-carousel-slide': 'img-src',\n 'b-embed': 'src'\n }\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n config.node = {\n fs: 'empty'\n }\n // Add markdown loader\n config.module.rules.push({\n test: /\\.md$/,\n loader: 'frontmatter-markdown-loader'\n })\n }", "extend(config, ctx) {\n const vueLoader = config.module.rules.find((loader) => loader.loader === 'vue-loader')\n vueLoader.options.transformToRequire = {\n 'vue-h-zoom': ['image', 'image-full']\n }\n }", "extend (config, ctx) {\n config.resolve.alias['class-component'] = '~plugins/class-component'\n if (ctx.dev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n if (ctx.isServer) {\n config.externals = [\n nodeExternals({\n whitelist: [/\\.(?!(?:js|json)$).{1,5}$/i, /^vue-awesome/, /^vue-upload-component/]\n })\n ]\n }\n }", "extend (config, { isDev, isClient }) {\n if (isClient && isDev) {\n config.optimization.splitChunks.maxSize = 51200\n }\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n config.resolve.alias.vue = process.env.NODE_ENV === 'production' ? 'vue/dist/vue.min' : 'vue/dist/vue.js'\n }", "extend(config) {\n config.devtool = process.env.NODE_ENV === 'dev' ? 'eval-source-map' : ''\n }", "extend(config, ctx) {\n // Added Line\n config.devtool = ctx.isClient ? \"eval-source-map\" : \"inline-source-map\";\n\n // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n // }\n\n }", "extend(config, { isDev }) {\n if (process.server && process.browser) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n });\n }\n }", "extend (config, ctx) {\n config.output.publicPath = 'http://0.0.0.0:3000/';\n //config.output.crossOriginLoading = 'anonymous'\n /* const devServer = {\n public: 'http://0.0.0.0:3000',\n port: 3000,\n host: '0.0.0.0',\n hotOnly: true,\n https: false,\n watchOptions: {\n poll: 1000,\n },\n headers: {\n \"Access-Control-Allow-Origin\": \"\\*\",\n }\n };\n config.devServer = devServer; */\n }", "extend(config, ctx) {\n config.devtool = \"source-map\";\n\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: \"pre\",\n test: /\\.(js|vue)$/,\n loader: \"eslint-loader\",\n exclude: /(node_modules)/,\n options: {\n fix: true,\n },\n });\n }\n\n config.module.rules.push({\n enforce: \"pre\",\n test: /\\.txt$/,\n loader: \"raw-loader\",\n exclude: /(node_modules)/,\n });\n }", "extend(config, ctx) {\n ctx.loaders.less.javascriptEnabled = true\n config.resolve.alias.vue = 'vue/dist/vue.common'\n }", "extend(config, { isDev }) {\n if (isDev) config.devtool = '#source-map';\n if (isDev && process.client) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n });\n }\n }", "extend(config, { isDev }) {\n if (isDev) {\n config.devtool = 'source-map';\n }\n }", "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 }", "extend(config, ctx) {\n if (ctx.isClient) {\n // 配置别名\n config.resolve.alias['@'] = path.resolve(__dirname, './');\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n });\n }\n }", "extend (config, ctx) {\n if (ctx.dev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n /*\n ** For including scss variables file\n */\n config.module.rules.forEach((rule) => {\n if (isVueRule(rule)) {\n rule.options.loaders.scss.push(sassResourcesLoader)\n }\n if (isSASSRule(rule)) {\n rule.use.push(sassResourcesLoader)\n }\n })\n }", "extend(config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n config.plugins.push(\n new StylelintPlugin({\n files: ['**/*.vue', '**/*.scss']\n })\n )\n }\n config.module.rules.push({\n test: /\\.webp$/,\n loader: 'url-loader',\n options: {\n limit: 1000,\n name: 'img/[name].[hash:7].[ext]'\n }\n })\n }", "extend (config, {isDev, isClient, isServer}) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n if (isServer) {\n config.externals = [\n nodeExternals({\n whitelist: [/\\.(?!(?:js|json)$).{1,5}$/i, /^vue-awesome/, /^vue-upload-component/]\n })\n ]\n }\n }", "extend (config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n config.devtool = '#source-map' // 添加此行代码\n }\n }", "extend (config, { isDev }) {\n if (isDev && process.client) {\n\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n },\n {\n test: /\\.pug$/,\n resourceQuery: /^\\?vue/,\n loader: 'pug-plain-loader',\n exclude: /(node_modules)/\n },\n {\n test: /\\.styl/,\n resourceQuery: /^\\?vue/,\n loader: 'pug-plain-loader',\n exclude: /(node_modules)/\n })\n }\n config.module.rules.filter(r => r.test.toString().includes('svg')).forEach(r => { r.test = /\\.(png|jpe?g|gif)$/ });\n\n config.module.rules.push({\n test: /\\.svg$/,\n loader: 'vue-svg-loader',\n });\n\n [].concat(...config.module.rules\n .find(e => e.test.toString().match(/\\.styl/)).oneOf\n .map(e => e.use.filter(e => e.loader === 'stylus-loader'))).forEach(stylus => {\n Object.assign(stylus.options, {\n import: [\n '~assets/styles/colors.styl',\n '~assets/styles/variables.styl',\n ]\n })\n });\n }", "extend (config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push(...[{\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n },{\n test: /\\.(gif|png|jpe?g|svg)$/i,\n use: [\n 'file-loader',\n {\n loader: 'image-webpack-loader',\n options: {\n bypassOnDebug: true,\n mozjpeg: {\n progressive: true,\n quality: 65\n },\n // optipng.enabled: false will disable optipng\n optipng: {\n enabled: true,\n },\n pngquant: {\n quality: '65-90',\n speed: 4\n },\n gifsicle: {\n interlaced: false,\n },\n // the webp option will enable WEBP\n webp: {\n quality: 75\n }\n },\n },\n ],\n }])\n }\n }", "extend(config, { isDev, isClient }) {\n if (isDev && isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n }\n }", "extend(config, ctx) {\n config.module.rules.forEach((r) => {\n if(r.test.toString() === `/\\.(png|jpe?g|gif|svg|webp)$/i`) {\n r.use = [\n {\n loader: \"url-loader\",\n options: {\n limit: 1000,\n name: 'img/[name].[hash:7].[ext]'\n }\n },\n {\n loader: 'image-webpack-loader',\n }\n ]\n delete r.loader;\n delete r.options;\n }\n })\n config.module.rules.push(\n {\n test: /\\.ya?ml$/,\n type: 'json',\n use: 'yaml-loader'\n }\n )\n }", "extend(config, { isDev }) {\r\n if (isDev && process.client) {\r\n config.module.rules.push({\r\n enforce: 'pre',\r\n test: /\\.(js|vue)$/,\r\n loader: 'eslint-loader',\r\n exclude: /(node_modules)/,\r\n })\r\n\r\n const vueLoader = config.module.rules.find(\r\n ({ loader }) => loader === 'vue-loader',\r\n )\r\n const { options: { loaders } } = vueLoader || { options: {} }\r\n\r\n if (loaders) {\r\n for (const loader of Object.values(loaders)) {\r\n changeLoaderOptions(Array.isArray(loader) ? loader : [loader])\r\n }\r\n }\r\n\r\n config.module.rules.forEach(rule => changeLoaderOptions(rule.use))\r\n }\r\n }", "extend (config, ctx) {\n if (ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n // vue-loader\n const vueLoader = config.module.rules.find((rule) => rule.loader === 'vue-loader')\n vueLoader.options.loaders.less = 'vue-style-loader!css-loader!less-loader'\n }", "function webpackConfigDev(options = {}) {\n // get the common configuration to start with\n const config = init(options);\n\n // // make \"dev\" specific changes here\n // const credentials = require(\"./credentials.json\");\n // credentials.branch = \"dev\";\n //\n // config.plugin(\"screeps\")\n // .use(ScreepsWebpackPlugin, [credentials]);\n\n // modify the args of \"define\" plugin\n config.plugin(\"define\").tap((args) => {\n args[0].PRODUCTION = JSON.stringify(false);\n return args;\n });\n\n return config;\n}", "extend(config, ctx) {\n // Use vuetify loader\n const vueLoader = config.module.rules.find((rule) => rule.loader === 'vue-loader')\n const options = vueLoader.options || {}\n const compilerOptions = options.compilerOptions || {}\n const cm = compilerOptions.modules || []\n cm.push(VuetifyProgressiveModule)\n\n config.module.rules.push({\n test: /\\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)(\\?.*)?$/,\n oneOf: [\n {\n test: /\\.(png|jpe?g|gif)$/,\n resourceQuery: /lazy\\?vuetify-preload/,\n use: [\n 'vuetify-loader/progressive-loader',\n {\n loader: 'url-loader',\n options: { limit: 8000 }\n }\n ]\n },\n {\n loader: 'url-loader',\n options: { limit: 8000 }\n }\n ]\n })\n\n if (ctx.isDev) {\n // Run ESLint on save\n if (ctx.isClient) {\n config.module.rules.push({\n enforce: \"pre\",\n test: /\\.(js|vue)$/,\n loader: \"eslint-loader\",\n exclude: /(node_modules)/\n });\n }\n }\n if (ctx.isServer) {\n config.externals = [\n nodeExternals({\n whitelist: [/^vuetify/]\n })\n ];\n } else {\n config.plugins.push(new NetlifyServerPushPlugin({\n headersFile: '_headers'\n }));\n }\n }", "extend (config) {\n config.module.rules.push({\n test: /\\.s(c|a)ss$/,\n use: [\n {\n loader: 'sass-loader',\n options: {\n includePaths: [\n 'node_modules/breakpoint-sass/stylesheets',\n 'node_modules/susy/sass',\n 'node_modules/gent_styleguide/build/styleguide'\n ]\n }\n }\n ]\n })\n }", "extend (config, ctx) {\n // if (ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n // }\n }", "extend(config, ctx) {\n // NuxtJS debugging support\n // eval-source-map: a SourceMap that matchers exactly to the line number and this help to debug the NuxtJS app in the client\n // inline-source-map: help to debug the NuxtJS app in the server\n config.devtool = ctx.isClient ? 'eval-source-map' : 'inline-source-map'\n }", "extend (config, ctx) {\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n if (ctx.isServer) {\n config.externals = [\n nodeExternals({\n whitelist: [/^vuetify/]\n })\n ]\n }\n }", "extend (config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n \n config.module.rules.push({\n test: /\\.svg$/,\n loader: 'svg-inline-loader',\n exclude: /node_modules/\n })\n \n }\n }", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push(\n {\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n },\n {\n test: /\\.(png|jpe?g|gif|svg|webp|ico)$/,\n loader: 'url-loader',\n query: {\n limit: 1000 // 1kB\n }\n }\n )\n }\n\n for (const ruleList of Object.values(config.module.rules || {})) {\n for (const rule of Object.values(ruleList.oneOf || {})) {\n for (const loader of rule.use) {\n const loaderModifier = loaderModifiers[loader.loader]\n if (loaderModifier) {\n loaderModifier(loader)\n }\n }\n }\n }\n }", "extend(config, ctx) {\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n options: {\n formatter: require('eslint-friendly-formatter'),\n fix: true\n }\n })\n }\n if (ctx.isServer) {\n config.externals = [\n nodeExternals({\n whitelist: [/^vuetify/, /^vue-resource/]\n })\n ]\n }\n }", "extend(config, ctx) {\n // Run ESLint on saves\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push(\n {\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n },\n // {\n // test: /\\.(jpg)$/,\n // loader: 'file-loader'\n // },\n {\n test: /\\.jpeg$/, // jpeg의 모든 파일\n loader: 'file-loader', // 파일 로더를 적용한다.\n options: {\n // publicPath: './', // prefix를 아웃풋 경로로 지정\n name: '[name].[ext]?[hash]' // 파일명 형식\n }\n }\n )\n }\n }", "extend (config, ctx) {\n // transpile: [/^vue2-google-maps($|\\/)/]\n /*\n if (!ctx.isClient) {\n // This instructs Webpack to include `vue2-google-maps`'s Vue files\n // for server-side rendering\n config.externals = [\n function(context, request, callback){\n if (/^vue2-google-maps($|\\/)/.test(request)) {\n callback(null, false)\n } else {\n callback()\n }\n }\n ]\n }\n */\n }", "extend(configuration, { isDev, isClient }) {\n configuration.resolve.alias.vue = 'vue/dist/vue.common'\n\n configuration.node = {\n fs: 'empty',\n }\n\n configuration.module.rules.push({\n test: /\\.worker\\.js$/,\n use: { loader: 'worker-loader' },\n })\n\n if (isDev && isClient) {\n configuration.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n })\n }\n }", "extend (config, ctx) {\n if (ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n config.resolve.alias['vue'] = 'vue/dist/vue.common'\n }", "extend (config, ctx) {\n if (ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n })\n }\n\n config.module.rules\n .find((rule) => rule.loader === 'vue-loader')\n .options.loaders.scss\n .push({\n loader: 'sass-resources-loader',\n options: {\n resources: [\n path.join(__dirname, 'app', 'assets', 'scss', '_variables.scss'),\n path.join(__dirname, 'app', 'assets', 'scss', '_mixins.scss'),\n ],\n },\n })\n }", "extend (config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n\n const svgRule = config.module.rules.find(rule => rule.test.test('.svg'));\n svgRule.test = /\\.(png|jpe?g|gif|webp)$/;\n\n config.module.rules.push({\n test: /\\.svg$/,\n loader: 'vue-svg-loader',\n });\n\n config.module.rules.push({\n test: /\\.(png|gif)$/,\n loader: 'url-loader',\n query: {\n limit: 1000,\n name: 'img/[name].[hash:7].[ext]'\n }\n });\n }", "extend(config, { isDev }) {\n if (isDev && process.client) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "extend (config, ctx) {\n if (ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n config.devtool = false\n }", "extend(config, ctx) {\n const vueLoader = config.module.rules.find(\n rule => rule.loader === \"vue-loader\"\n );\n vueLoader.options.transformToRequire = {\n img: \"src\",\n image: \"xlink:href\",\n \"b-img\": \"src\",\n \"b-img-lazy\": [\"src\", \"blank-src\"],\n \"b-card\": \"img-src\",\n \"b-card-img\": \"img-src\",\n \"b-carousel-slide\": \"img-src\",\n \"b-embed\": \"src\"\n };\n }", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n config.module.rules\n .filter(r => r.test.toString().includes('svg'))\n .forEach(r => {\n r.test = /\\.(png|jpe?g|gif)$/\n })\n // urlLoader.test = /\\.(png|jpe?g|gif)$/\n config.module.rules.push({\n test: /\\.svg$/,\n loader: 'svg-inline-loader',\n exclude: /node_modules/\n })\n }", "extend (config, { isDev, isClient }) {\n /*\n // questo linta ogni cosa ad ogni salvataggio\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }*/\n }", "extend(config, ctx) {\n // Run ESLint on save\n config.module.rules.push({\n test: /\\.graphql?$/,\n exclude: /node_modules/,\n loader: 'webpack-graphql-loader',\n });\n }", "extend(config, {\n isDev,\n isClient\n }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n config.module.rules.push({\n test: /\\.yaml$/,\n loader: 'js-yaml-loader'\n })\n config.module.rules.push({\n test: /\\.md$/,\n loader: 'frontmatter-markdown-loader',\n include: path.resolve(__dirname, 'articles'),\n options: {\n markdown: body => {\n return md.render(body)\n }\n }\n })\n }", "extend(config, ctx) {\n // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: \"pre\",\n // test: /\\.(js|vue)$/,\n // loader: \"eslint-loader\",\n // exclude: /(node_modules)/\n // })\n // }\n config.module.rules.push({\n test: /\\.md$/,\n use: [\n {\n loader: \"html-loader\"\n },\n {\n loader: \"markdown-loader\",\n options: {\n /* your options here */\n }\n }\n ]\n })\n }", "extend(config, ctx) {\n // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n \n }", "function createCommonWebpackConfig({\n isDebug = true,\n isHmr = false,\n withLocalSourceMaps,\n isModernBuild = false,\n} = {}) {\n const STATICS_DIR_MODERN = path.join(BUILD_DIR, 'statics-modern');\n const config = {\n context: SRC_DIR,\n\n mode: isProduction ? 'production' : 'development',\n\n output: {\n path: isModernBuild ? STATICS_DIR_MODERN : STATICS_DIR,\n publicPath,\n pathinfo: isDebug,\n filename: isDebug\n ? addHashToAssetName('[name].bundle.js')\n : addHashToAssetName('[name].bundle.min.js'),\n chunkFilename: isDebug\n ? addHashToAssetName('[name].chunk.js')\n : addHashToAssetName('[name].chunk.min.js'),\n hotUpdateMainFilename: 'updates/[hash].hot-update.json',\n hotUpdateChunkFilename: 'updates/[id].[hash].hot-update.js',\n },\n\n resolve: {\n modules: ['node_modules', SRC_DIR],\n\n extensions,\n\n alias: project.resolveAlias,\n\n // Whether to resolve symlinks to their symlinked location.\n symlinks: false,\n },\n\n // Since Yoshi doesn't depend on every loader it uses directly, we first look\n // for loaders in Yoshi's `node_modules` and then look at the root `node_modules`\n //\n // See https://github.com/wix/yoshi/pull/392\n resolveLoader: {\n modules: [path.join(__dirname, '../node_modules'), 'node_modules'],\n },\n\n plugins: [\n // This gives some necessary context to module not found errors, such as\n // the requesting resource\n new ModuleNotFoundPlugin(ROOT_DIR),\n // https://github.com/Urthen/case-sensitive-paths-webpack-plugin\n new CaseSensitivePathsPlugin(),\n // Way of communicating to `babel-preset-yoshi` or `babel-preset-wix` that\n // it should optimize for Webpack\n new EnvirnmentMarkPlugin(),\n // https://github.com/Realytics/fork-ts-checker-webpack-plugin\n ...(isTypescriptProject && project.projectType === 'app' && isDebug\n ? [\n // Since `fork-ts-checker-webpack-plugin` requires you to have\n // TypeScript installed when its required, we only require it if\n // this is a TypeScript project\n new (require('fork-ts-checker-webpack-plugin'))({\n tsconfig: TSCONFIG_FILE,\n async: false,\n silent: true,\n checkSyntacticErrors: true,\n formatter: typescriptFormatter,\n }),\n ]\n : []),\n ...(isHmr ? [new webpack.HotModuleReplacementPlugin()] : []),\n ],\n\n module: {\n // Makes missing exports an error instead of warning\n strictExportPresence: true,\n\n rules: [\n // https://github.com/wix/externalize-relative-module-loader\n ...(project.features.externalizeRelativeLodash\n ? [\n {\n test: /[\\\\/]node_modules[\\\\/]lodash/,\n loader: 'externalize-relative-module-loader',\n },\n ]\n : []),\n\n // https://github.com/huston007/ng-annotate-loader\n ...(project.isAngularProject\n ? [\n {\n test: reScript,\n loader: 'yoshi-angular-dependencies/ng-annotate-loader',\n include: project.unprocessedModules,\n },\n ]\n : []),\n\n // Rules for TS / TSX\n {\n test: /\\.(ts|tsx)$/,\n include: project.unprocessedModules,\n use: [\n {\n loader: 'thread-loader',\n options: {\n workers: require('os').cpus().length - 1,\n },\n },\n\n // https://github.com/huston007/ng-annotate-loader\n ...(project.isAngularProject\n ? [{ loader: 'yoshi-angular-dependencies/ng-annotate-loader' }]\n : []),\n\n {\n loader: 'ts-loader',\n options: {\n // This implicitly sets `transpileOnly` to `true`\n ...(isModernBuild ? {configFile: 'tsconfig-modern.json'} : {}),\n happyPackMode: true,\n compilerOptions: project.isAngularProject\n ? {}\n : {\n // force es modules for tree shaking\n module: 'esnext',\n // use same module resolution\n moduleResolution: 'node',\n // optimize target to latest chrome for local development\n ...(isDevelopment\n ? {\n // allow using Promises, Array.prototype.includes, String.prototype.padStart, etc.\n lib: ['es2017'],\n // use async/await instead of embedding polyfills\n target: 'es2017',\n }\n : {}),\n },\n },\n },\n ],\n },\n\n // Rules for JS\n {\n test: reScript,\n include: project.unprocessedModules,\n use: [\n {\n loader: 'thread-loader',\n options: {\n workers: require('os').cpus().length - 1,\n },\n },\n {\n loader: 'babel-loader',\n options: {\n ...babelConfig,\n },\n },\n ],\n },\n\n // Rules for assets\n {\n oneOf: [\n // Inline SVG images into CSS\n {\n test: /\\.inline\\.svg$/,\n loader: 'svg-inline-loader',\n },\n\n // Allows you to use two kinds of imports for SVG:\n // import logoUrl from './logo.svg'; gives you the URL.\n // import { ReactComponent as Logo } from './logo.svg'; gives you a component.\n {\n test: /\\.svg$/,\n issuer: {\n test: /\\.(j|t)sx?$/,\n },\n use: [\n '@svgr/webpack',\n {\n loader: 'svg-url-loader',\n options: {\n iesafe: true,\n noquotes: true,\n limit: 10000,\n name: staticAssetName,\n },\n },\n ],\n },\n {\n test: /\\.svg$/,\n use: [\n {\n loader: 'svg-url-loader',\n options: {\n iesafe: true,\n limit: 10000,\n name: staticAssetName,\n },\n },\n ],\n },\n\n // Rules for Markdown\n {\n test: /\\.md$/,\n loader: 'raw-loader',\n },\n\n // Rules for HAML\n {\n test: /\\.haml$/,\n loader: 'ruby-haml-loader',\n },\n\n // Rules for HTML\n {\n test: /\\.html$/,\n loader: 'html-loader',\n },\n\n // Rules for GraphQL\n {\n test: /\\.(graphql|gql)$/,\n loader: 'graphql-tag/loader',\n },\n\n // Try to inline assets as base64 or return a public URL to it if it passes\n // the 10kb limit\n {\n test: reAssets,\n loader: 'url-loader',\n options: {\n name: staticAssetName,\n limit: 10000,\n },\n },\n ],\n },\n ],\n },\n\n // https://webpack.js.org/configuration/stats/\n stats: 'none',\n\n // https://github.com/webpack/node-libs-browser/tree/master/mock\n node: {\n fs: 'empty',\n net: 'empty',\n tls: 'empty',\n __dirname: true,\n },\n\n // https://webpack.js.org/configuration/devtool\n // If we are in CI or requested explictly we create full source maps\n // Once we are in a local build, we create cheap eval source map only\n // for a development build (hence the !isProduction)\n devtool:\n inTeamCity || withLocalSourceMaps\n ? 'source-map'\n : !isProduction\n ? 'cheap-module-eval-source-map'\n : false,\n };\n\n return config;\n}", "extend(config, ctx) {\n config.module.rules.push(\n {\n test: /\\.html$/,\n loader: 'raw-loader'\n }\n )\n }", "extend (config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n 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 = ['node_modules/foundation-sites/scss', 'node_modules/motion-ui/src'];\n }\n }\n }\n }\n }", "extend(config, ctx) {\n config.module.rules.push({\n test: /\\.(graphql|gql)$/,\n exclude: /node_modules/,\n loader: 'graphql-tag/loader'\n })\n }", "extend(config,ctx){ \n const sassResourcesLoader = { \n loader: 'sass-resources-loader', \n options: { \n resources: [ \n 'assets/scss/style.scss' \n ] \n } \n } \n // 遍历nuxt定义的loader配置,向里面添加新的配置。 \n config.module.rules.forEach((rule) => { \n if (rule.test.toString() === '/\\\\.vue$/') { \n rule.options.loaders.sass.push(sassResourcesLoader) \n rule.options.loaders.scss.push(sassResourcesLoader) \n } \n if (['/\\\\.sass$/', '/\\\\.scss$/'].indexOf(rule.test.toString()) !== -1) { \n rule.use.push(sassResourcesLoader) \n } \n }) \n\n }", "extend(config, ctx) {\n if (ctx.isServer) {\n config.externals = [\n nodeExternals({\n // whitelist: [/es6-promise|\\.(?!(?:js|json)$).{1,5}$/i]\n whitelist: [/es6-promise|\\.(?!(?:js|json)$).{1,5}$/i, /^echarts/]\n })\n ];\n }\n }", "extend(config, ctx) {\n // // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n // }\n }", "extend(config, {isDev, isClient}) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "extend(config, {isDev, isClient}) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "function makeConfig() {\n\tif (config)\n\t\tthrow new Error('Config can only be created once');\n\n\toptions = project.custom.webpack || {}\n\t_.defaultsDeep(options,defaultOptions);\n\n\tif (options.config) {\n\t\tconfig = options.config;\n\t} else {\n\t\tlet configPath = path.resolve(options.configPath);\n\t\tif (!fs.existsSync(configPath)) {\n\t\t\tthrow new Error(`Unable to location webpack config path ${configPath}`);\n\t\t}\n\n\t\tlog(`Making compiler with config path ${configPath}`);\n\t\tconfig = require(configPath);\n\n\t\tif (_.isFunction(config))\n\t\t\tconfig = config()\n\t}\n\n\n\tconfig.target = 'node';\n\n\t// Output config\n\toutputPath = path.resolve(process.cwd(),'target');\n\tif (!fs.existsSync(outputPath))\n\t\tmkdirp.sync(outputPath);\n\n\tconst output = config.output = config.output || {};\n\toutput.library = '[name]';\n\n\t// Ensure we have a valid output target\n\tif (!_.includes([CommonJS,CommonJS2],output.libraryTarget)) {\n\t\tconsole.warn('Webpack config library target is not in',[CommonJS,CommonJS2].join(','))\n\t\toutput.libraryTarget = CommonJS2\n\t}\n\n\t// Ref the target\n\tlibraryTarget = output.libraryTarget\n\n\toutput.filename = '[name].js';\n\toutput.path = outputPath;\n\n\tlog('Building entry list');\n\tconst entries = config.entry = {};\n\n\tconst functions = project.getAllFunctions();\n\tfunctions.forEach(fun => {\n\n\t\t// Runtime checks\n\t\t// No python or Java :'(\n\n\t\tif (!/node/.test(fun.runtime)) {\n\t\t\tlog(`${fun.name} is not a webpack function`);\n\t\t\treturn\n\t\t}\n\n\n\t\tconst handlerParts = fun.handler.split('/').pop().split('.');\n\t\tlet modulePath = fun.getRootPath(handlerParts[0]), baseModulePath = modulePath;\n\t\tif (!fs.existsSync(modulePath)) {\n\t\t\tfor (let ext of config.resolve.extensions) {\n\t\t\t\tmodulePath = `${baseModulePath}${ext}`;\n\t\t\t\tlog(`Checking: ${modulePath}`);\n\t\t\t\tif (fs.existsSync(modulePath))\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (!fs.existsSync(modulePath))\n\t\t\tthrow new Error(`Failed to resolve entry with base path ${baseModulePath}`);\n\n\t\tconst handlerPath = require.resolve(modulePath);\n\n\t\tlog(`Adding entry ${fun.name} with path ${handlerPath}`);\n\t\tentries[fun.name] = handlerPath;\n\t});\n\n\tlog(`Final entry list ${Object.keys(config.entry).join(', ')}`);\n}", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n if (ctx.isServer) {\n config.externals = [\n nodeExternals({\n whitelist: [/^vuetify/]\n })\n ]\n }\n }", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n config.module.rules.push({\n test: /\\.json5$/,\n loader: 'json5-loader',\n exclude: /(node_modules)/\n })\n config.node = {\n fs: 'empty'\n }\n }", "extend(config, ctx) {\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n });\n }\n }", "extend(config, ctx) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/,\n options: {\n fix: true\n }\n })\n }", "extend(config, ctx) {\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "extend(config, ctx) {\n // Run ESLint on save\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n\n const vueRule = config.module.rules.find(\n rule => rule.loader === 'vue-loader'\n )\n vueRule.options.compilerOptions = {\n ...vueRule.options.compilerOptions,\n modules: [\n ...((vueRule.options.compilerOptions &&\n vueRule.options.compilerOptions.modules) ||\n []),\n { postTransformNode: staticClassHotfix }\n ]\n }\n\n function staticClassHotfix(el) {\n el.staticClass = el.staticClass && el.staticClass.replace(/\\\\\\w\\b/g, '')\n if (Array.isArray(el.children)) {\n el.children.map(staticClassHotfix)\n }\n }\n }", "extend(config) {\n config.module.rules.push({\n test: /\\.(glsl|frag|vert|fs|vs)$/,\n loader: 'shader-loader',\n exclude: /(node_modules)/\n })\n }", "extend(config, ctx) {\n if (ctx.isDev) {\n config.devtool = ctx.isClient ? 'source-map' : 'inline-source-map';\n }\n }", "extend (config, ctx) {\n config.module.rules.push({\n test: /\\.ya?ml?$/,\n loader: ['json-loader', 'yaml-loader', ]\n })\n }", "extend(config) {\n const vueLoader = config.module.rules.find(\n (rule) => rule.loader === 'vue-loader'\n )\n vueLoader.options.transformAssetUrls = {\n video: ['src', 'poster'],\n source: 'src',\n img: 'src',\n image: 'xlink:href',\n 'b-img': 'src',\n 'b-img-lazy': ['src', 'blank-src'],\n 'b-card': 'img-src',\n 'b-card-img': 'img-src',\n 'b-card-img-lazy': ['src', 'blank-src'],\n 'b-carousel-slide': 'img-src',\n 'b-embed': 'src',\n }\n }", "extend(config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n });\n }\n }", "extend(config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "extend(config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "extend(config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "extend(config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n })\n }\n }", "config(cfg) {\n // if (cfg.hasFilesystemConfig()) {\n // // Use the normal config\n // return cfg.options;\n // }\n\n const {\n __createDll,\n __react,\n __typescript = false,\n __server = false,\n __spaTemplateInject = false,\n __routes,\n } = customOptions;\n const { presets, plugins, ...options } = cfg.options;\n const isServer =\n __server || process.env.WEBPACK_BUILD_STAGE === 'server';\n // console.log({ options });\n\n // presets ========================================================\n const newPresets = [...presets];\n if (__typescript) {\n newPresets.unshift([\n require('@babel/preset-typescript').default,\n __react\n ? {\n isTSX: true,\n allExtensions: true,\n }\n : {},\n ]);\n // console.log(newPresets);\n }\n newPresets.forEach((preset, index) => {\n if (\n typeof preset.file === 'object' &&\n /^@babel\\/preset-env$/.test(preset.file.request)\n ) {\n const thisPreset = newPresets[index];\n if (typeof thisPreset.options !== 'object')\n thisPreset.options = {};\n thisPreset.options.modules = false;\n thisPreset.options.exclude = [\n // '@babel/plugin-transform-regenerator',\n // '@babel/plugin-transform-async-to-generator'\n ];\n if (isServer || __spaTemplateInject) {\n thisPreset.options.targets = {\n node: true,\n };\n thisPreset.options.ignoreBrowserslistConfig = true;\n thisPreset.options.exclude.push(\n '@babel/plugin-transform-regenerator'\n );\n thisPreset.options.exclude.push(\n '@babel/plugin-transform-async-to-generator'\n );\n }\n // console.log(__spaTemplateInject, thisPreset);\n }\n });\n\n // plugins ========================================================\n // console.log('\\n ');\n // console.log('before', plugins.map(plugin => plugin.file.request));\n\n const newPlugins = plugins.filter((plugin) => {\n // console.log(plugin.file.request);\n if (testPluginName(plugin, /^extract-hoc(\\/|\\\\)babel$/))\n return false;\n if (testPluginName(plugin, /^react-hot-loader(\\/|\\\\)babel$/))\n return false;\n if (testPluginName(plugin, 'transform-regenerator'))\n return false;\n\n return true;\n });\n\n // console.log('after', newPlugins.map(plugin => plugin.file.request));\n\n if (\n !__createDll &&\n __react &&\n process.env.WEBPACK_BUILD_ENV === 'dev'\n ) {\n // newPlugins.push(require('extract-hoc/babel'));\n newPlugins.push(require('react-hot-loader/babel'));\n }\n\n if (!__createDll && !isServer) {\n let pathname = path.resolve(getCwd(), __routes);\n if (fs.lstatSync(pathname).isDirectory()) pathname += '/index';\n if (!fs.existsSync(pathname)) {\n const exts = ['.js', '.ts'];\n exts.some((ext) => {\n const newPathname = path.resolve(pathname + ext);\n if (fs.existsSync(newPathname)) {\n pathname = newPathname;\n return true;\n }\n return false;\n });\n }\n newPlugins.push([\n path.resolve(\n __dirname,\n './plugins/client-sanitize-code-spliting-name.js'\n ),\n {\n routesConfigFile: pathname,\n },\n ]);\n // console.log(newPlugins);\n }\n\n const thisOptions = {\n ...options,\n presets: newPresets,\n plugins: newPlugins,\n };\n // console.log(isServer);\n\n return thisOptions;\n }", "extend (config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_modules)/\n });\n }\n\n config.module.rules.forEach((rule) => {\n if (isVueRule(rule)) {\n rule.options.loaders.sass.push(sassResourcesLoader);\n rule.options.loaders.scss.push(sassResourcesLoader);\n }\n if (isSassRule(rule)) rule.use.push(sassResourcesLoader);\n });\n }", "extend (config, ctx) {\n if (ctx.isDev && ctx.isClient) {\n config.module.rules.push({\n enforce: 'pre',\n test: /\\.(ts|js|vue)$/,\n loader: 'eslint-loader',\n exclude: /(node_module)/\n })\n }\n }", "extend(config, ctx) {\n // Run ESLint on save\n // if (ctx.isDev && ctx.isClient) {\n // config.module.rules.push({\n // enforce: 'pre',\n // test: /\\.(js|vue)$/,\n // loader: 'eslint-loader',\n // exclude: /(node_modules)/\n // })\n // }\n }", "extend(config, { isDev, isClient }) {\n if (isDev && isClient) {\n config.module.rules.push({\n enforce: \"pre\",\n test: /\\.(js|vue)$/,\n loader: \"eslint-loader\",\n exclude: /(node_modules)/\n });\n }\n }" ]
[ "0.75780183", "0.7486256", "0.74535376", "0.7388344", "0.73616195", "0.72877634", "0.7282417", "0.7211369", "0.71547335", "0.7107632", "0.70970905", "0.7090317", "0.7045734", "0.7035934", "0.70036227", "0.699704", "0.69930667", "0.6985959", "0.69833404", "0.6973784", "0.69592714", "0.6957332", "0.69565624", "0.6953751", "0.69367003", "0.6934928", "0.69198984", "0.6918667", "0.6916272", "0.6914212", "0.6904401", "0.6878041", "0.68734443", "0.6873211", "0.68403995", "0.68301773", "0.6815345", "0.6808729", "0.6798517", "0.6792629", "0.67694056", "0.6767418", "0.6745065", "0.67429864", "0.67425466", "0.6742329", "0.6741698", "0.67343605", "0.6730357", "0.6722651", "0.67210746", "0.66935563", "0.66860217", "0.6677227", "0.6670981", "0.6662804", "0.6651306", "0.6646672", "0.6639688", "0.66372496", "0.6633925", "0.66318494", "0.66288406", "0.66256106", "0.66063815", "0.66058326", "0.6604861", "0.6590057", "0.6587027", "0.6583075", "0.657836", "0.6576266", "0.6571445", "0.6571217", "0.6562979", "0.65626484", "0.656086", "0.6557368", "0.6555168", "0.6555168", "0.6546314", "0.6546203", "0.6544196", "0.6533708", "0.652474", "0.65215254", "0.6519123", "0.65124923", "0.65034574", "0.65013987", "0.6500342", "0.64998245", "0.6491299", "0.6491299", "0.6491299", "0.6491299", "0.6489082", "0.64888567", "0.64861816", "0.64853734", "0.648373" ]
0.0
-1
converts it to a base b number. Return the new number as a string E.g. base_converter(5, 2) == "101" base_converter(31, 16) == "1f"
function baseConverter(num, b) { if (num === 0) { return "" }; const digit = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]; return baseConverter((num/b), b) + digit[num % b]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function baseConverter(num, base) {\n const bases = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\n const possibleBases = bases.slice(0, base)\n\n let result = [];\n\n while (num >= base) {\n result.unshift(possibleBases[num % base])\n num = Math.floor(num / base)\n }\n result.unshift(num)\n return result.join(\"\")\n}", "function baseConverter(decNumber, base) {\n\n\tvar remStack = new Stack(),\n\t\trem,\n\t\tbaseString = '';\n\t\tdigits = '0123456789ABCDEF';\n\n\twhile(decNumber > 0) {\n\t\trem = Math.floor(decNumber % base);\n\t\tremStack.push(rem);\n\t\tdecNumber = Math.floor(decNumber / base);\n\t}\n\n\twhile(!remStack.isEmpty()) {\n\t\tbaseString += digits[remStack.pop()];\n\t}\n\n\treturn baseString;\n}", "function strBaseConverter (number,ob,nb) {\n number = number.toUpperCase();\n var list = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n var dec = 0;\n for (var i = 0; i <= number.length; i++) {\n dec += (list.indexOf(number.charAt(i))) * (Math.pow(ob , (number.length - i - 1)));\n }\n number = '';\n var magnitude = Math.floor((Math.log(dec)) / (Math.log(nb)));\n for (var i = magnitude; i >= 0; i--) {\n var amount = Math.floor(dec / Math.pow(nb,i));\n number = number + list.charAt(amount);\n dec -= amount * (Math.pow(nb,i));\n }\n return number;\n}", "function baseConvert(base, number) {\n if (checkNum()) {\n let conversion = 0;\n let digits = number.split('').map(Number).reverse();\n base = Number(base);\n for (let place = digits.length - 1; place >= 0; place--) {\n conversion += (Math.pow(base, place)) * digits[place];\n }\n return conversion;\n }\n }", "toBase10(value, b = 62) {\n const limit = value.length;\n let result = base.indexOf(value[0]);\n for (let i = 1; i < limit; i++) {\n result = b * result + base.indexOf(value[i]);\n }\n return result;\n }", "function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function convertBase(str, fromBase, toBase) {\n const digits = parseToDigitsArray(str, fromBase);\n if (digits === null) return null;\n\n let outArray = [];\n let power = [1];\n for (let i = 0; i < digits.length; i += 1) {\n // invariant: at this point, fromBase^i = power\n if (digits[i]) {\n outArray = add(outArray, multiplyByNumber(digits[i], power, toBase), toBase);\n }\n power = multiplyByNumber(fromBase, power, toBase);\n }\n\n let out = '';\n for (let i = outArray.length - 1; i >= 0; i -= 1) {\n out += outArray[i].toString(toBase);\n }\n // if the original input was equivalent to zero, then 'out' will still be empty ''. Let's check for zero.\n if (out === '') {\n let sum = 0;\n for (let i = 0; i < digits.length; i += 1) {\n sum += digits[i];\n }\n if (sum === 0) out = '0';\n }\n\n return out;\n}", "function base(dec, base) {\n var len = base.length;\n var ret = '';\n while(dec > 0) {\n ret = base.charAt(dec % len) + ret;\n dec = Math.floor(dec / len);\n }\n return ret;\n}", "function $builtin_base_convert_helper(obj, base) {\n var prefix = \"\";\n switch(base){\n case 2:\n prefix = '0b'; break\n case 8:\n prefix = '0o'; break\n case 16:\n prefix = '0x'; break\n default:\n console.log('invalid base:' + base)\n }\n\n if(obj.__class__ === $B.long_int){\n var res = prefix + obj.value.toString(base)\n return res\n }\n\n var value = $B.$GetInt(obj)\n\n if(value === undefined){\n // need to raise an error\n throw _b_.TypeError.$factory('Error, argument must be an integer or' +\n ' contains an __index__ function')\n }\n\n if(value >= 0){return prefix + value.toString(base)}\n return '-' + prefix + (-value).toString(base)\n}", "function h$ghcjsbn_showBase(b, base) {\n ASSERTVALID_B(b, \"showBase\");\n ASSERTVALID_S(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === GHCJSBN_EQ) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function toBaseOut(str,baseIn,baseOut,alphabet){var j,arr=[0],arrL,i=0,len=str.length;for(;i<len;){for(arrL=arr.length;arrL--;arr[arrL]*=baseIn){;}arr[0]+=alphabet.indexOf(str.charAt(i++));for(j=0;j<arr.length;j++){if(arr[j]>baseOut-1){if(arr[j+1]==null)arr[j+1]=0;arr[j+1]+=arr[j]/baseOut|0;arr[j]%=baseOut}}}return arr.reverse()}// Convert a numeric string of baseIn to a numeric string of baseOut.", "function decimalToBase(decNumber, base) {\n if (!Number.isInteger(decNumber) || !Number.isInteger(base)) {\n throw TypeError('input number is not an integer');\n }\n if (!(base >= 2 && base <= 36)) {\n throw Error('invalid base')\n }\n\n const remStack = new Stack();\n const digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n let number = decNumber;\n let rem;\n let stringified = '';\n\n while (number > 0) {\n rem = number % base;\n remStack.push(rem);\n number = Math.floor(number / base);\n }\n\n while (!remStack.isEmpty()) {\n stringified += digits[remStack.pop()].toString();\n }\n\n return stringified;\n}", "toBase(value, b = 62) {\n let r = value % b;\n let result = base[r];\n let q = Math.floor(value / b);\n while (q) {\n r = q % b;\n q = Math.floor(q / b);\n result = base[r] + result;\n }\n return result;\n }", "function baseConvert(obj, begBase, endBase ){\n if (begBase < 2 && endBase > 36){\n throw new Error(\"Bases are not valid\");\n }else {\n return parseInt(obj, begBase).toString(endBase);\n }\n}", "function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\n\t d = e + dp + 1;\n\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( d < 1 || !xc[0] ) {\n\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\n\t if (r) {\n\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\n\t // The caller will add the sign.\n\t return str;\n\t }", "function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\n\t d = e + dp + 1;\n\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\n\t if ( d < 1 || !xc[0] ) {\n\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\n\t if (r) {\n\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\n\t // The caller will add the sign.\n\t return str;\n\t }", "function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\t\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\t\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\t\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\t\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\t\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\t\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\t\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\t\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\t\n\t d = e + dp + 1;\n\t\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\t\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\t\n\t if ( d < 1 || !xc[0] ) {\n\t\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\t\n\t if (r) {\n\t\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\t\n\t if ( !d ) {\n\t ++e;\n\t xc.unshift(1);\n\t }\n\t }\n\t }\n\t\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\t\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\t\n\t // The caller will add the sign.\n\t return str;\n\t }", "function convertBase( str, baseOut, baseIn, sign ) {\n\t var d, e, k, r, x, xc, y,\n\t i = str.indexOf( '.' ),\n\t dp = DECIMAL_PLACES,\n\t rm = ROUNDING_MODE;\n\t\n\t if ( baseIn < 37 ) str = str.toLowerCase();\n\t\n\t // Non-integer.\n\t if ( i >= 0 ) {\n\t k = POW_PRECISION;\n\t\n\t // Unlimited precision.\n\t POW_PRECISION = 0;\n\t str = str.replace( '.', '' );\n\t y = new BigNumber(baseIn);\n\t x = y.pow( str.length - i );\n\t POW_PRECISION = k;\n\t\n\t // Convert str as if an integer, then restore the fraction part by dividing the\n\t // result by its base raised to a power.\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n\t y.e = y.c.length;\n\t }\n\t\n\t // Convert the number as integer.\n\t xc = toBaseOut( str, baseIn, baseOut );\n\t e = k = xc.length;\n\t\n\t // Remove trailing zeros.\n\t for ( ; xc[--k] == 0; xc.pop() );\n\t if ( !xc[0] ) return '0';\n\t\n\t if ( i < 0 ) {\n\t --e;\n\t } else {\n\t x.c = xc;\n\t x.e = e;\n\t\n\t // sign is needed for correct rounding.\n\t x.s = sign;\n\t x = div( x, y, dp, rm, baseOut );\n\t xc = x.c;\n\t r = x.r;\n\t e = x.e;\n\t }\n\t\n\t d = e + dp + 1;\n\t\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\t i = xc[d];\n\t k = baseOut / 2;\n\t r = r || d < 0 || xc[d + 1] != null;\n\t\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n\t rm == ( x.s < 0 ? 8 : 7 ) );\n\t\n\t if ( d < 1 || !xc[0] ) {\n\t\n\t // 1^-dp or 0.\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\n\t } else {\n\t xc.length = d;\n\t\n\t if (r) {\n\t\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\n\t xc[d] = 0;\n\t\n\t if ( !d ) {\n\t ++e;\n\t xc = [1].concat(xc);\n\t }\n\t }\n\t }\n\t\n\t // Determine trailing zeros.\n\t for ( k = xc.length; !xc[--k]; );\n\t\n\t // E.g. [4, 11, 15] becomes 4bf.\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n\t str = toFixedPoint( str, e );\n\t }\n\t\n\t // The caller will add the sign.\n\t return str;\n\t }", "function convertBase( str, baseOut, baseIn, sign ) {\r\n\t var d, e, k, r, x, xc, y,\r\n\t i = str.indexOf( '.' ),\r\n\t dp = DECIMAL_PLACES,\r\n\t rm = ROUNDING_MODE;\r\n\r\n\t if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n\t // Non-integer.\r\n\t if ( i >= 0 ) {\r\n\t k = POW_PRECISION;\r\n\r\n\t // Unlimited precision.\r\n\t POW_PRECISION = 0;\r\n\t str = str.replace( '.', '' );\r\n\t y = new BigNumber(baseIn);\r\n\t x = y.pow( str.length - i );\r\n\t POW_PRECISION = k;\r\n\r\n\t // Convert str as if an integer, then restore the fraction part by dividing the\r\n\t // result by its base raised to a power.\r\n\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n\t y.e = y.c.length;\r\n\t }\r\n\r\n\t // Convert the number as integer.\r\n\t xc = toBaseOut( str, baseIn, baseOut );\r\n\t e = k = xc.length;\r\n\r\n\t // Remove trailing zeros.\r\n\t for ( ; xc[--k] == 0; xc.pop() );\r\n\t if ( !xc[0] ) return '0';\r\n\r\n\t if ( i < 0 ) {\r\n\t --e;\r\n\t } else {\r\n\t x.c = xc;\r\n\t x.e = e;\r\n\r\n\t // sign is needed for correct rounding.\r\n\t x.s = sign;\r\n\t x = div( x, y, dp, rm, baseOut );\r\n\t xc = x.c;\r\n\t r = x.r;\r\n\t e = x.e;\r\n\t }\r\n\r\n\t d = e + dp + 1;\r\n\r\n\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n\t i = xc[d];\r\n\t k = baseOut / 2;\r\n\t r = r || d < 0 || xc[d + 1] != null;\r\n\r\n\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n\t if ( d < 1 || !xc[0] ) {\r\n\r\n\t // 1^-dp or 0.\r\n\t str = r ? toFixedPoint( '1', -dp ) : '0';\r\n\t } else {\r\n\t xc.length = d;\r\n\r\n\t if (r) {\r\n\r\n\t // Rounding up may mean the previous digit has to be rounded up and so on.\r\n\t for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n\t xc[d] = 0;\r\n\r\n\t if ( !d ) {\r\n\t ++e;\r\n\t xc.unshift(1);\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t // Determine trailing zeros.\r\n\t for ( k = xc.length; !xc[--k]; );\r\n\r\n\t // E.g. [4, 11, 15] becomes 4bf.\r\n\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n\t str = toFixedPoint( str, e );\r\n\t }\r\n\r\n\t // The caller will add the sign.\r\n\t return str;\r\n\t }", "function convertBase(str, baseIn, baseOut) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n strL = str.length;\n\n for (; i < strL;) {\n for (arrL = arr.length; arrL--;) {arr[arrL] *= baseIn;}\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\n for (j = 0; j < arr.length; j++) {\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }", "function convertFromBaseTenToBaseX( xbase, inval ) {\n\n return inval.toString( xbase ).toUpperCase();\n\n /* let xinval = inval;\n let remainder = hexidecimal[ xinval % xbase ];\n while ( xinval >= xbase ) {\n let r1 = subtract( xinval, ( xinval % xbase ) );\n xinval = divide( r1, xbase );\n // in this case we do not want to add we want to append the strings together\n if ( xinval >= xbase ) {\n remainder = hexidecimal[ xinval % xbase ] + remainder;\n } else {\n remainder = hexidecimal[ xinval ] + remainder;\n }\n }\n return remainder; */\n}", "function dec_to_bho(number, change_base) {\n if (change_base == B ){\n return parseInt(number + '', 10)\n .toString(2);} else\n if (change_base == H ){\n return parseInt(number + '', 10)\n .toString(8);} else \n if (change_base == O ){\n return parseInt(number + '', 10)\n .toString(8);} else\n console.log(\"pick H, B, or O\");\n\n }", "function convertBase(str, baseOut, baseIn, sign) {\n var d,\n e,\n k,\n r,\n x,\n xc,\n y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if (baseIn < 37) str = str.toLowerCase();\n\n // Non-integer.\n if (i >= 0) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e), 10, baseOut);\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut(str, baseIn, baseOut);\n e = k = xc.length;\n\n // Remove trailing zeros.\n for (; xc[--k] == 0; xc.pop()) {}\n if (!xc[0]) return '0';\n\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (d < 1 || !xc[0]) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint('1', -dp) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for (k = xc.length; !xc[--k];) {}\n\n // E.g. [4, 11, 15] becomes 4bf.\n for (i = 0, str = ''; i <= k; str += ALPHABET.charAt(xc[i++])) {}\n str = toFixedPoint(str, e);\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase(str, baseOut, baseIn, sign) {\n var d,\n e,\n k,\n r,\n x,\n xc,\n y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if (baseIn < 37) str = str.toLowerCase();\n\n // Non-integer.\n if (i >= 0) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e), 10, baseOut);\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut(str, baseIn, baseOut);\n e = k = xc.length;\n\n // Remove trailing zeros.\n for (; xc[--k] == 0; xc.pop()) {}\n if (!xc[0]) return '0';\n\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (d < 1 || !xc[0]) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint('1', -dp) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for (k = xc.length; !xc[--k];) {}\n\n // E.g. [4, 11, 15] becomes 4bf.\n for (i = 0, str = ''; i <= k; str += ALPHABET.charAt(xc[i++])) {}\n str = toFixedPoint(str, e);\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase(str, baseOut, baseIn, sign) {\n var d,\n e,\n k,\n r,\n x,\n xc,\n y,\n i = str.indexOf('.'),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n if (baseIn < 37) str = str.toLowerCase(); // Non-integer.\n\n if (i >= 0) {\n k = POW_PRECISION; // Unlimited precision.\n\n POW_PRECISION = 0;\n str = str.replace('.', '');\n y = new BigNumber(baseIn);\n x = y.pow(str.length - i);\n POW_PRECISION = k; // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n\n y.c = toBaseOut(toFixedPoint(coeffToString(x.c), x.e), 10, baseOut);\n y.e = y.c.length;\n } // Convert the number as integer.\n\n\n xc = toBaseOut(str, baseIn, baseOut);\n e = k = xc.length; // Remove trailing zeros.\n\n for (; xc[--k] == 0; xc.pop()) {\n }\n\n if (!xc[0]) return '0';\n\n if (i < 0) {\n --e;\n } else {\n x.c = xc;\n x.e = e; // sign is needed for correct rounding.\n\n x.s = sign;\n x = div(x, y, dp, rm, baseOut);\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1; // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));\n\n if (d < 1 || !xc[0]) {\n // 1^-dp or 0.\n str = r ? toFixedPoint('1', -dp) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for (--baseOut; ++xc[--d] > baseOut;) {\n xc[d] = 0;\n\n if (!d) {\n ++e;\n xc.unshift(1);\n }\n }\n } // Determine trailing zeros.\n\n\n for (k = xc.length; !xc[--k];) {\n } // E.g. [4, 11, 15] becomes 4bf.\n\n\n for (i = 0, str = ''; i <= k; str += ALPHABET.charAt(xc[i++])) {\n }\n\n str = toFixedPoint(str, e);\n } // The caller will add the sign.\n\n\n return str;\n } // Perform division in the specified base. Called by div and convertBase.", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc = [1].concat(xc);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }", "function convertBase( str, baseOut, baseIn, sign ) {\r\n\t\t var d, e, k, r, x, xc, y,\r\n\t\t i = str.indexOf( '.' ),\r\n\t\t dp = DECIMAL_PLACES,\r\n\t\t rm = ROUNDING_MODE;\r\n\t\t\r\n\t\t if ( baseIn < 37 ) str = str.toLowerCase();\r\n\t\t\r\n\t\t // Non-integer.\r\n\t\t if ( i >= 0 ) {\r\n\t\t k = POW_PRECISION;\r\n\t\t\r\n\t\t // Unlimited precision.\r\n\t\t POW_PRECISION = 0;\r\n\t\t str = str.replace( '.', '' );\r\n\t\t y = new BigNumber(baseIn);\r\n\t\t x = y.pow( str.length - i );\r\n\t\t POW_PRECISION = k;\r\n\t\t\r\n\t\t // Convert str as if an integer, then restore the fraction part by dividing the\r\n\t\t // result by its base raised to a power.\r\n\t\t y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n\t\t y.e = y.c.length;\r\n\t\t }\r\n\t\t\r\n\t\t // Convert the number as integer.\r\n\t\t xc = toBaseOut( str, baseIn, baseOut );\r\n\t\t e = k = xc.length;\r\n\t\t\r\n\t\t // Remove trailing zeros.\r\n\t\t for ( ; xc[--k] == 0; xc.pop() );\r\n\t\t if ( !xc[0] ) return '0';\r\n\t\t\r\n\t\t if ( i < 0 ) {\r\n\t\t --e;\r\n\t\t } else {\r\n\t\t x.c = xc;\r\n\t\t x.e = e;\r\n\t\t\r\n\t\t // sign is needed for correct rounding.\r\n\t\t x.s = sign;\r\n\t\t x = div( x, y, dp, rm, baseOut );\r\n\t\t xc = x.c;\r\n\t\t r = x.r;\r\n\t\t e = x.e;\r\n\t\t }\r\n\t\t\r\n\t\t d = e + dp + 1;\r\n\t\t\r\n\t\t // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n\t\t i = xc[d];\r\n\t\t k = baseOut / 2;\r\n\t\t r = r || d < 0 || xc[d + 1] != null;\r\n\t\t\r\n\t\t r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n\t\t : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n\t\t rm == ( x.s < 0 ? 8 : 7 ) );\r\n\t\t\r\n\t\t if ( d < 1 || !xc[0] ) {\r\n\t\t\r\n\t\t // 1^-dp or 0.\r\n\t\t str = r ? toFixedPoint( '1', -dp ) : '0';\r\n\t\t } else {\r\n\t\t xc.length = d;\r\n\t\t\r\n\t\t if (r) {\r\n\t\t\r\n\t\t // Rounding up may mean the previous digit has to be rounded up and so on.\r\n\t\t for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n\t\t xc[d] = 0;\r\n\t\t\r\n\t\t if ( !d ) {\r\n\t\t ++e;\r\n\t\t xc.unshift(1);\r\n\t\t }\r\n\t\t }\r\n\t\t }\r\n\t\t\r\n\t\t // Determine trailing zeros.\r\n\t\t for ( k = xc.length; !xc[--k]; );\r\n\t\t\r\n\t\t // E.g. [4, 11, 15] becomes 4bf.\r\n\t\t for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n\t\t str = toFixedPoint( str, e );\r\n\t\t }\r\n\t\t\r\n\t\t // The caller will add the sign.\r\n\t\t return str;\r\n\t\t }", "function convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n}", "function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }", "function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }", "function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }", "function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }", "function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }", "function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }", "function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc.unshift(1);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }", "function convertBase( str, baseOut, baseIn, sign ) {\r\n var d, e, k, r, x, xc, y,\r\n i = str.indexOf( '.' ),\r\n dp = DECIMAL_PLACES,\r\n rm = ROUNDING_MODE;\r\n\r\n if ( baseIn < 37 ) str = str.toLowerCase();\r\n\r\n // Non-integer.\r\n if ( i >= 0 ) {\r\n k = POW_PRECISION;\r\n\r\n // Unlimited precision.\r\n POW_PRECISION = 0;\r\n str = str.replace( '.', '' );\r\n y = new BigNumber(baseIn);\r\n x = y.pow( str.length - i );\r\n POW_PRECISION = k;\r\n\r\n // Convert str as if an integer, then restore the fraction part by dividing the\r\n // result by its base raised to a power.\r\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\r\n y.e = y.c.length;\r\n }\r\n\r\n // Convert the number as integer.\r\n xc = toBaseOut( str, baseIn, baseOut );\r\n e = k = xc.length;\r\n\r\n // Remove trailing zeros.\r\n for ( ; xc[--k] == 0; xc.pop() );\r\n if ( !xc[0] ) return '0';\r\n\r\n if ( i < 0 ) {\r\n --e;\r\n } else {\r\n x.c = xc;\r\n x.e = e;\r\n\r\n // sign is needed for correct rounding.\r\n x.s = sign;\r\n x = div( x, y, dp, rm, baseOut );\r\n xc = x.c;\r\n r = x.r;\r\n e = x.e;\r\n }\r\n\r\n d = e + dp + 1;\r\n\r\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\r\n i = xc[d];\r\n k = baseOut / 2;\r\n r = r || d < 0 || xc[d + 1] != null;\r\n\r\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\r\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\r\n rm == ( x.s < 0 ? 8 : 7 ) );\r\n\r\n if ( d < 1 || !xc[0] ) {\r\n\r\n // 1^-dp or 0.\r\n str = r ? toFixedPoint( '1', -dp ) : '0';\r\n } else {\r\n xc.length = d;\r\n\r\n if (r) {\r\n\r\n // Rounding up may mean the previous digit has to be rounded up and so on.\r\n for ( --baseOut; ++xc[--d] > baseOut; ) {\r\n xc[d] = 0;\r\n\r\n if ( !d ) {\r\n ++e;\r\n xc = [1].concat(xc);\r\n }\r\n }\r\n }\r\n\r\n // Determine trailing zeros.\r\n for ( k = xc.length; !xc[--k]; );\r\n\r\n // E.g. [4, 11, 15] becomes 4bf.\r\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\r\n str = toFixedPoint( str, e );\r\n }\r\n\r\n // The caller will add the sign.\r\n return str;\r\n }", "function convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function numberToString(n, base) {\n let result = '';\n let sign = '';\n if (n < 0) {\n sign = '-';\n n = -n;\n }\n do {\n // convert the number into the given 'base'\n // by repeatedly picking out the last digit and then dividing the number to get rid of this digit\n result = String(n % base) + result;\n n = Math.floor(n / base);\n } while (n > 0);\n return sign + result;\n}", "function convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function convertBase(str, baseIn, baseOut) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n strL = str.length;\r\n\r\n for (; i < strL;) {\r\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\r\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\r\n for (j = 0; j < arr.length; j++) {\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function convertBase(str, baseIn, baseOut) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n strL = str.length;\n\n for (; i < strL;) {\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\n for (j = 0; j < arr.length; j++) {\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }", "function toBase10(number) {\n\n var x = number.toLowerCase();\n Logger.debug(\"x = \" + x)\n\n if (!x.startsWith('0b') && !x.startsWith('0x') && parseInt(x, 10).toString(10) == x.replace(/^0+/, '')) {\n Logger.debug('>>> Base 10: ' + parseInt(x, 10).toString(10) + ' = ' + x);\n return parseInt(x, 10);\n } else if (x.startsWith('0b') && (parseInt(x.substring(2), 2).toString(2) == x.substring(2).replace(/^0+/, ''))) {\n Logger.debug('>>> Base 2: ' + parseInt(x.substring(2), 2).toString(2) + ' = ' + x.substring(2));\n return parseInt(x.substring(2), 2);\n } else if (x.startsWith('0x') && (parseInt(x.substring(2), 16).toString(16) == x.substring(2).replace(/^0+/, ''))) {\n Logger.debug('>>> Base 16: ' + parseInt(x.substring(2), 16).toString(16) + ' = ' + x.substring(2));\n return parseInt(x.substring(2), 16);\n } else {\n Logger.debug('>>> ???')\n return NaN;\n }\n}", "function convertBase(str, baseIn, baseOut) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n strL = str.length;\n\n for (; i < strL;) {\n for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;\n arr[0] += NUMERALS.indexOf(str.charAt(i++));\n for (j = 0; j < arr.length; j++) {\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] === void 0) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }", "function toBinary(decNumber,base){\n var remStack = new stacks(),\n rem,\n binarystring = '';\n digits = '0123456789ABCDEF';\n\n while (decNumber>0) {\n rem = Math.floor(decNumber%base);\n remStack.push(rem);\n decNumber = Math.floor(decNumber/base);\n\n }\n\nwhile (!remStack.isEmpty()) {\n binarystring += digits[remStack.pop()];\n}\n return binarystring;\n}", "function toBaseOut(str, baseIn, baseOut, alphabet) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) {\n ;\n }\n\n arr[0] += alphabet.indexOf(str.charAt(i++));\n\n for (j = 0; j < arr.length; j++) {\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n } // Convert a numeric string of baseIn to a numeric string of baseOut.", "function toBaseOut(str, baseIn, baseOut, alphabet) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\n\n arr[0] += alphabet.indexOf(str.charAt(i++));\n\n for (j = 0; j < arr.length; j++) {\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n } // Convert a numeric string of baseIn to a numeric string of baseOut.", "function util_frombase(input_buffer, input_base)\n {\n /// <summary>Convert number from 2^base to 2^10</summary>\n /// <param name=\"input_buffer\" type=\"Uint8Array\">Array of bytes representing the number to convert</param>\n /// <param name=\"input_base\" type=\"Number\">The base of initial number</param>\n\n var result = 0;\n\n for(var i = (input_buffer.length - 1); i >= 0; i-- )\n result += input_buffer[(input_buffer.length - 1) - i] * Math.pow(2, input_base * i);\n\n return result;\n }", "function baseConvert(faceValues, num) {\n let base = faceValues.length;\n let result = \"\";\n if (num === 0) {\n return faceValues[0];\n }\n while (num !== 0) {\n let remainder = num % base;\n result += faceValues[remainder]; // we got result from right to left, last digit is entered first, we need to reverse\n let quotient = Math.floor(num / base);\n num = quotient;\n }\n return reverseString(result);\n}", "function conversaoBase(num,b1,b2){\r\n\r\n num = num.toString()\r\n numArr = num.split(\"\",num.length)\r\n virgPos = numArr.indexOf(\".\")\r\n \r\n console.log(virgPos)\r\n \r\n // numero com 'casa decimal'\r\n if(numArr.indexOf(\".\") != -1 )\r\n {\r\n console.log('quebrado')\r\n intSize = virgPos\r\n numArr.splice(virgPos, 1)\r\n decSize = (numArr.length) - (intSize)\r\n }\r\n //numero inteiro\r\n else if(numArr.indexOf(\".\") == -1)\r\n {\r\n console.log('inteiro')\r\n intSize = numArr.length\r\n decSize = 0 \r\n }\r\n\r\n numConcat = 0\r\n index = 0\r\n\r\n console.log(`Numero: ${numArr}`)\r\n console.log(`intSize: ${intSize}`)\r\n console.log(`decSize: ${decSize}`)\r\n \r\n // converte da base n1 para a base 10\r\n for(let i = intSize - 1; i>= (-1*decSize); i--)\r\n {\r\n numConcat = numConcat + numArr[index]*(Math.pow(b1,i))\r\n index++\r\n console.log(numConcat)\r\n }\r\n // retorna da base 10 para a base n2\r\n return numConcat.toString(b2)\r\n}", "function toBaseOut( str, baseIn, baseOut ) {\r\n\t\t var j,\r\n\t\t arr = [0],\r\n\t\t arrL,\r\n\t\t i = 0,\r\n\t\t len = str.length;\r\n\t\t\r\n\t\t for ( ; i < len; ) {\r\n\t\t for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n\t\t arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\t\t\r\n\t\t for ( ; j < arr.length; j++ ) {\r\n\t\t\r\n\t\t if ( arr[j] > baseOut - 1 ) {\r\n\t\t if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n\t\t arr[j + 1] += arr[j] / baseOut | 0;\r\n\t\t arr[j] %= baseOut;\r\n\t\t }\r\n\t\t }\r\n\t\t }\r\n\t\t\r\n\t\t return arr.reverse();\r\n\t\t }", "function toBaseOut( str, baseIn, baseOut ) {\r\n\t var j,\r\n\t arr = [0],\r\n\t arrL,\r\n\t i = 0,\r\n\t len = str.length;\r\n\r\n\t for ( ; i < len; ) {\r\n\t for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n\t arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n\t for ( ; j < arr.length; j++ ) {\r\n\r\n\t if ( arr[j] > baseOut - 1 ) {\r\n\t if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n\t arr[j + 1] += arr[j] / baseOut | 0;\r\n\t arr[j] %= baseOut;\r\n\t }\r\n\t }\r\n\t }\r\n\r\n\t return arr.reverse();\r\n\t }", "function toBaseOut( str, baseIn, baseOut ) {\n\t var j,\n\t arr = [0],\n\t arrL,\n\t i = 0,\n\t len = str.length;\n\t\n\t for ( ; i < len; ) {\n\t for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\n\t arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\n\t\n\t for ( ; j < arr.length; j++ ) {\n\t\n\t if ( arr[j] > baseOut - 1 ) {\n\t if ( arr[j + 1] == null ) arr[j + 1] = 0;\n\t arr[j + 1] += arr[j] / baseOut | 0;\n\t arr[j] %= baseOut;\n\t }\n\t }\n\t }\n\t\n\t return arr.reverse();\n\t }", "function toBaseOut( str, baseIn, baseOut ) {\n\t var j,\n\t arr = [0],\n\t arrL,\n\t i = 0,\n\t len = str.length;\n\t\n\t for ( ; i < len; ) {\n\t for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\n\t arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\n\t\n\t for ( ; j < arr.length; j++ ) {\n\t\n\t if ( arr[j] > baseOut - 1 ) {\n\t if ( arr[j + 1] == null ) arr[j + 1] = 0;\n\t arr[j + 1] += arr[j] / baseOut | 0;\n\t arr[j] %= baseOut;\n\t }\n\t }\n\t }\n\t\n\t return arr.reverse();\n\t }", "function bigInt2str(x, base) {\n var i, t, s = \"\";\n\n if (s6.length != x.length)\n s6 = dup(x);\n else\n copy_(s6, x);\n\n if (base == -1) { //return the list of array contents\n for (i = x.length - 1; i > 0; i--)\n s += x[i] + ',';\n s += x[0];\n }\n else { //return it in the given base\n while (!isZero(s6)) {\n t = divInt_(s6, base); //t=s6 % base; s6=floor(s6/base);\n s = digitsStr.substring(t, t + 1) + s;\n }\n }\n if (s.length == 0)\n s = \"0\";\n return s;\n }", "function toBaseOut( str, baseIn, baseOut ) {\n\t var j,\n\t arr = [0],\n\t arrL,\n\t i = 0,\n\t len = str.length;\n\n\t for ( ; i < len; ) {\n\t for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\n\t arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\n\n\t for ( ; j < arr.length; j++ ) {\n\n\t if ( arr[j] > baseOut - 1 ) {\n\t if ( arr[j + 1] == null ) arr[j + 1] = 0;\n\t arr[j + 1] += arr[j] / baseOut | 0;\n\t arr[j] %= baseOut;\n\t }\n\t }\n\t }\n\n\t return arr.reverse();\n\t }", "function toBaseOut( str, baseIn, baseOut ) {\n\t var j,\n\t arr = [0],\n\t arrL,\n\t i = 0,\n\t len = str.length;\n\n\t for ( ; i < len; ) {\n\t for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\n\t arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\n\n\t for ( ; j < arr.length; j++ ) {\n\n\t if ( arr[j] > baseOut - 1 ) {\n\t if ( arr[j + 1] == null ) arr[j + 1] = 0;\n\t arr[j + 1] += arr[j] / baseOut | 0;\n\t arr[j] %= baseOut;\n\t }\n\t }\n\t }\n\n\t return arr.reverse();\n\t }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\n\n arr[0] += alphabet.indexOf(str.charAt(i++));\n\n for (j = 0; j < arr.length; j++) {\n\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }", "function baseChange(number, newBase) {\n\n var newNumber = \"\";\n var myStack = new Stack();\n while(number > 0) {\n myStack.push(number%newBase);\n number = Math.floor(number/newBase);\n }\n while(!myStack.isEmpty()) {\n newNumber += myStack.pop();\n }\n return newNumber;\n}", "function toBaseOut( str, baseIn, baseOut ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n for ( ; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut( str, baseIn, baseOut ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n for ( ; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut( str, baseIn, baseOut ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n for ( ; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut( str, baseIn, baseOut ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n for ( ; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut( str, baseIn, baseOut ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n for ( ; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut( str, baseIn, baseOut ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n for ( ; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut( str, baseIn, baseOut ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n for ( ; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut( str, baseIn, baseOut ) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for ( ; i < len; ) {\r\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\r\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\r\n\r\n for ( ; j < arr.length; j++ ) {\r\n\r\n if ( arr[j] > baseOut - 1 ) {\r\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) {}\n arr[j = 0] += ALPHABET.indexOf(str.charAt(i++));\n\n for (; j < arr.length; j++) {\n\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }", "function toBaseOut(str, baseIn, baseOut) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for (; i < len;) {\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) {}\n arr[j = 0] += ALPHABET.indexOf(str.charAt(i++));\n\n for (; j < arr.length; j++) {\n\n if (arr[j] > baseOut - 1) {\n if (arr[j + 1] == null) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }", "function toBaseOut(str, baseIn, baseOut, alphabet) {\r\n var j,\r\n arr = [0],\r\n arrL,\r\n i = 0,\r\n len = str.length;\r\n\r\n for (; i < len;) {\r\n for (arrL = arr.length; arrL--; arr[arrL] *= baseIn);\r\n\r\n arr[0] += alphabet.indexOf(str.charAt(i++));\r\n\r\n for (j = 0; j < arr.length; j++) {\r\n\r\n if (arr[j] > baseOut - 1) {\r\n if (arr[j + 1] == null) arr[j + 1] = 0;\r\n arr[j + 1] += arr[j] / baseOut | 0;\r\n arr[j] %= baseOut;\r\n }\r\n }\r\n }\r\n\r\n return arr.reverse();\r\n }" ]
[ "0.78933334", "0.7787537", "0.76196146", "0.746665", "0.74133676", "0.7408443", "0.7408443", "0.7408443", "0.7408443", "0.7367569", "0.7335649", "0.72488385", "0.7197895", "0.7121101", "0.7059255", "0.7058206", "0.69450194", "0.6917524", "0.6917524", "0.68824667", "0.68824667", "0.68236697", "0.6814816", "0.6798944", "0.6797506", "0.67898643", "0.67898643", "0.67874205", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.67802835", "0.6776346", "0.67730635", "0.6771581", "0.6771581", "0.6771581", "0.6771581", "0.6771581", "0.6771581", "0.6771581", "0.6771581", "0.67676973", "0.6760945", "0.67603624", "0.67603624", "0.67603624", "0.67603624", "0.67603624", "0.67603624", "0.67567784", "0.675574", "0.6753925", "0.66673553", "0.6662116", "0.6609488", "0.65580267", "0.6555964", "0.65552354", "0.65265375", "0.6452172", "0.6449309", "0.6449309", "0.6428673", "0.64064467", "0.64064467", "0.6396517", "0.6389517", "0.63818103", "0.63818103", "0.63818103", "0.63818103", "0.63818103", "0.63818103", "0.63818103", "0.63818103", "0.63793993", "0.63793993", "0.6378372", "0.6378372", "0.6378372", "0.6378372", "0.6378372", "0.6378372", "0.6378372", "0.6378372", "0.6378372", "0.6378372", "0.6378372", "0.6378372", "0.6378372" ]
0.81513506
0
Redraw the HTML table when needed ( eg when we change the generation)
function redrawHTMLGrid(grid, gridID) { var gridHTML = document.getElementById(gridID); for (var i = 0; i < height; i++) { for (var j = 0; j < width; j++) { var cell = gridHTML.rows[i].cells[j]; if (grid[i][j]) cell.className = "selected"; else cell.className = ""; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderTable() {\n clearTable();\n showTable();\n}", "function drawtable()\n{\n // going to use a template for this!\n\n // example table data row { id: \"CDL\", rank: 1949, \"change\": 23, \"winp\" : 84.4, \"run\" : \"wwwwwwwwww\" },\n\n // need in the item s_players,\n // {{:rank}}\n // {{:change}}\n // {{:id}} - initials\n // {{:record}} - win percentage\n // {{:gamerun}} - last ten games results\n\n // the template then executes for each of the elements in this.\n\n // what player do we want? URL format is player.html/INITIALS\n playerid = window.location.href.substring(window.location.href.indexOf('?')+1);\n opponents = get_player_opponents(all_results, playerid);\n player_results = get_player_results(all_results, playerid, opponents)[0];\n\n recent_player_results = get_results_to_display(player_results, playerid, recent_results_to_display);\n var recent_res_template = $.templates(\"#resultTemplate\");\n var htmlOutput = recent_res_template.render(recent_player_results);\n $(\"#rec_res_tbl\").html(htmlOutput);\n\n var opponents_template = $.templates(\"#opponentsTemplate\");\n var opponent_template = create_opponents_template(opponents);\n var htmlOutput = opponents_template.render(opponent_template);\n $(\"#opponents_tbl\").html(htmlOutput);\n\n head_to_head = document.getElementById(\"opp_res_tbl\");\n head_to_head.setAttribute(\"style\", \"height:\" + 15 * player_results.length + \"px\");\n\n slider = document.getElementById(\"head_to_head_range\");\n label = document.getElementById(\"results_output\");\n\n for (var ii = 0; ii < opponents.length; ii++)\n {\n checkbox = document.getElementById(\"opp_check_box_\" + opponents[ii]);\n checkbox.onchange = function() {\n redraw_head_to_head(slider.value);\n };\n }\n change_opponenet_check_boxes(false);\n\n label.value = slider.value; // Display the default slider value\n // Update the current slider value (each time you drag the slider handle)\n slider.oninput = function() {\n label.value = this.value;\n redraw_head_to_head(this.value);\n }\n\n}", "function refreshTables() {\n\n\t\t$(\"#biomatcher-data-table\").html(\"<table id='biomatcher-data-table' class='table table-striped'><tr><th>Subject ID</th><th>Oligo Name</th><th>Oligo Seq</th><th>Mismatch Tolerance</th><th>Hit Coordinates</th></tr></table>\");\n\t}", "redraw() {\n while (this.tbody.firstChild) {\n this.tbody.removeChild(this.tbody.firstChild);\n }\n var filteredRows = this.filterRows();\n var orderedRows = this.sortRows(filteredRows);\n orderedRows.forEach(row => {\n this.tbody.appendChild(row);\n });\n }", "function refreshData(){\r\n\t\tvar myTable=$('#'+settings.table_id);\r\n\t\tmyTable.empty();\r\n\t\tmyTable.addClass('table');\r\n\t\tmyTable.addClass('table-bordered');\r\n\t\tmyTable.addClass('table-striped');\r\n\t\tmyTable.addClass('table-hover');\r\n\t\t//add head table\r\n\t\tvar head=$(\"<thead></thead>\");\r\n\t\thead.append('<tr>\t\t\t\t<th class=\"buttons\" colspan=\"12\"></th>\t\t\t\t</tr>');\r\n\t\tvar tr='<tr>';\r\n\t\tfor(var i=0;i<settings.table_columns.length;i++){\r\n\t\t\ttr+='<th class=\"header\" title=\"'+settings.table_columns[i]+'\"><a href=\"#\">'+settings.table_columns[i]+'</a><i style=\"float: right\"></i></th>';\r\n\t\t}\r\n\t\ttr+='</tr>';\r\n\t\thead.append(tr);\r\n\t\tmyTable.append(head);\r\n\t\t//add head row\r\n\t\tvar body=$('<tbody></tbody>');\r\n\t\tvar rows=[];\r\n\t\tvar start=0;\r\n\t\tvar end=settings.table_data.length;\r\n\t\tif(settings.paging){\r\n\t\t\tstart=(settings.page-1)*settings.page_items;\r\n\t\t\tend=start+settings.page_items;\r\n\t\t\tif(end>settings.table_data.length){\r\n\t\t\t\tend=settings.table_data.length;\r\n\t\t\t}\r\n\t\t}\r\n\t\tfor(var i=start;i<end;i++){\r\n\t\t\tvar row_data=settings.table_data[i];\r\n\t\t\tvar tr='<tr>';\r\n\t\t\tfor(var j=0;j<row_data.length;j++){\r\n\t\t\t\t//format columns\t\t\t\t\r\n\t\t\t\tif(settings.columns_format[j]=='number'){\r\n\t\t\t\t\ttr+='<td align=\"right\">'+accounting.formatNumber(row_data[j])+'</td>';\r\n\t\t\t\t}else\r\n\t\t\t\tif(settings.columns_format[j]=='%'){\r\n\t\t\t\t\ttr+='<td align=\"right\">'+accounting.formatNumber(row_data[j]*100,2)+'%</td>';\r\n\t\t\t\t}else\r\n\t\t\t\tif(settings.columns_format[j]=='money'){\r\n\t\t\t\t\ttr+='<td align=\"right\">'+accounting.formatMoney(row_data[j])+'</td>';\r\n\t\t\t\t}else\r\n\t\t\t\tif(settings.columns_format[j]=='short date'){\r\n\t\t\t\t\t\ttr+='<td align=\"left\">'+verveDateConvert(row_data[j]).format('mmm dd')+'</td>';\r\n\t\t\t\t}else\r\n\t\t\t\tif(settings.columns_format[j]=='date'){\r\n\t\t\t\t\t\ttr+='<td align=\"left\">'+verveDateConvert(row_data[j]).format('yyyy-mm-dd')+'</td>';\r\n\t\t\t\t}else{\r\n\t\t\t\t\ttr+='<td>'+row_data[j]+'</td>';\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\ttr+='</tr>';\r\n\t\t\trows.push(tr);\r\n\t\t}\r\n\t\tbody.append(rows.join(''));\r\n\t\tmyTable.append(body);\t\r\n\t\t\r\n\t\t//add class sort\r\n\t\tif(settings.sort_by!=''){\r\n\t\t\tvar headArray=myTable.find(\"thead tr th.header[title='\"+settings.sort_by+\"']\").addClass('sort');\r\n\t\t\tif(settings.sort_type=='asc'){\r\n\t\t\t\tmyTable.find(\"thead tr th.header i\").removeClass();\r\n\t\t\t\tmyTable.find(\"thead tr th.header[title='\"+settings.sort_by+\"'] i\").addClass('fa fa-sort-alpha-asc');\r\n\t\t\t}else{\r\n\t\t\t\tmyTable.find(\"thead tr th.header i\").removeClass();\r\n\t\t\t\tmyTable.find(\"thead tr th.header[title='\"+settings.sort_by+\"'] i\").addClass('fa fa-sort-alpha-desc');\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t}\r\n\t\t//add sort event\r\n\t\tif(settings.sortable){\r\n\t\t\tmyTable.find(\"thead tr th.header\").click(function(){\r\n\t\t\t\tsettings.sort_by=$(this).attr('title');\r\n\t\t\t\tsort($(this).attr('title'));\r\n\t\t\t});\r\n\t\t}\r\n\t\t//Add onClick Event\r\n\t\tmyTable.find(\"tbody tr\").click(function(){\r\n\t\t\tvar tr=$(this);\r\n\t\t\tvar row=[];\r\n\t\t\ttr.find(\"td\").each(function(){\r\n\t\t\t\trow.push($(this).html());\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tsettings.onClickRow(row);\r\n\t\t});\r\n\t\t//\r\n\t\t$('a').click(function(event){\r\n\t\t\tconsole.log();\r\n\t\t\tif($(this).attr('href')=='#'){\r\n\t\t\t\tevent.preventDefault();\r\n\t\t\t}\r\n\t\t});\r\n\t}", "function renderTable() {\n $tbody.innerHTML = \"\";\n console.log(\"rendering\")\n\n for (var i = 0; i < tableData.length; i++) {\n // Get get the current UFO info object and its fields\n var ufoinfo = tableData[i];\n var field = Object.keys(ufoinfo);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < field.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = ufo[field];\n }\n } \n}", "function drawTable() {\n var stat = getState(cm);\n _replaceSelection(cm, stat.table, insertTexts.table);\n}", "function _redrawTable() {\n if (!_results) {\n return;\n }\n\n var rows = '';\n for (var i in _results) {\n var responder = _results[i];\n rows += '<tr>' +\n '<td>' + responder.name + '</td>' +\n '<td>' + responder.occupation + '</td>' +\n '<td>' + responder.city + ', ' + responder.state + '</td>' +\n '<td>' + responder.status + '</td>' +\n '</tr>';\n }\n\n $('#responder_results tbody').html(rows);\n }", "function redrawTable() {\n if ($scope.redraw) {\n return;\n }\n // reset display styles so column widths are correct when measured below\n angular.element(elem.querySelectorAll('thead, tbody, tfoot')).css('display', '');\n // wrap in $timeout to give table a chance to finish rendering\n $timeout(function () {\n $scope.redraw = true;\n // set widths of columns\n var totalColumnWidth = 0;\n angular.forEach(elem.querySelectorAll('tr:first-child th'), function (thElem, i) {\n var tdElems = elem.querySelector('tbody tr:first-child td:nth-child(' + (i + 1) + ')');\n var tfElems = elem.querySelector('tfoot tr:first-child td:nth-child(' + (i + 1) + ')');\n var columnWidth = Math.ceil(elem.querySelectorAll('thead')[0].offsetWidth / (elem.querySelectorAll('thead th').length || 1));\n if (tdElems) {\n tdElems.style.width = columnWidth + 'px';\n }\n if (thElem) {\n thElem.style.width = columnWidth + 'px';\n }\n if (tfElems) {\n tfElems.style.width = columnWidth + 'px';\n }\n totalColumnWidth = totalColumnWidth + columnWidth;\n });\n // set css styles on thead and tbody\n angular.element(elem.querySelectorAll('thead, tfoot')).css('display', 'block');\n angular.element(elem.querySelectorAll('tbody')).css({\n 'display': 'block',\n 'max-height': $scope.tableMaxHeight || 'inherit',\n 'overflow': 'auto'\n });\n // add missing width to fill the table\n if (totalColumnWidth < elem.offsetWidth) {\n var last = elem.querySelector('tbody tr:first-child td:last-child');\n if (last) {\n last.style.width = (last.offsetWidth + elem.offsetWidth - totalColumnWidth) + 'px';\n last = elem.querySelector('thead tr:first-child th:last-child');\n last.style.width = (last.offsetWidth + elem.offsetWidth - totalColumnWidth) + 'px';\n }\n }\n // reduce width of last column by width of scrollbar\n var tbody = elem.querySelector('tbody');\n var scrollBarWidth = tbody.offsetWidth - tbody.clientWidth;\n if (scrollBarWidth > 0) {\n var lastColumn = elem.querySelector('tbody tr:first-child td:last-child');\n lastColumn.style.width = (parseInt(lastColumn.style.width.replace('px', '')) - scrollBarWidth) + 'px';\n }\n $scope.redraw = false;\n });\n }", "updateBody() {\n this.tableBody.innerHTML = '';\n\n if (!this.sortedData.length) {\n let row = this.buildRow('Nothing found', true);\n\n this.tableBody.appendChild(row);\n }\n\n else {\n for (let i = 0; i < this.sortedData.length; i++) {\n let row = this.buildRow(this.sortedData[i]);\n\n this.tableBody.appendChild(row);\n }\n }\n\n this.buildStatistics();\n }", "table() {\n this.showtable= ! this.showtable;\n //workaround - table width is incorect when rendered hidden\n //render it after 100 ms again, usually after it is shown, thus calculating\n //correct width\n if (this.showtable) window.setTimeout(function(that){that.ht2.render()},100,this);\n }", "function render() {\n\tconsole.log(indicatorData);\n\n\td3.select('table#mipex tbody')\n\t\t.selectAll('tr')\n\t\t.data(indicatorData)\n\t\t.enter()\n\t\t.append('tr')\n\t\t\t.html(rowTemplate);\n\n\t// Inform parent frame of new height\n\tfm.resize()\n}", "function redoTableRows() {\n let d3tbody = d3.select(\"tbody\");\n d3tbody.html(\"\");\n generateTableBody(tbody, data, dateText, cityText, stateSelected, shapeSelected)\n}", "function updateTable() {\n var rowCount = 5;\n if(pageId == 'page-screen')\n rowCount = 8;\n\n // Build the new table contents\n var html = '';\n for(var i = getGuessesCount() - 1; i >= Math.max(0, getGuessesCount() - rowCount); i--) {\n html += \"<tr>\";\n html += \"<td>\" + (i + 1) + \"</td>\\n\";\n html += \"<td>\" + guesses[i].firstName + \"</td>\";\n html += \"<td>\" + guesses[i].weight + \" gram</td>\";\n html += \"</tr>\";\n }\n\n // Set the table contents and update it\n $(\"#guess-table > tbody\").html(html);\n $(\"#guess-table\").table(\"refresh\");\n }", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < ufoSightings.length; i++) {\n // Get get the current sightings object and its fields\n var sightings = ufoSightings[i];\n var fields = Object.keys(sightings);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the sightings object, create a new cell at set its inner text to be the current value at the current sightings field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sightings[field];\n }\n }\n}", "function refresh() {\n // Clear the table\n $('tbody').empty();\n // Insert each row into the table\n var ind = 0;\n rows.forEach(function(item){\n $('tbody').append('<tr onclick=\"tableClick(' + ind + '); show(\\'page2\\')\"><td>' + item.name + '</td><td>' +\n item.status + '</td><td>' + item.wordcount + '</td><td>' + item.date + '</td><td>' +\n item.deadline + '</td></tr>');\n ind++;\n });\n}", "function updateTable() {\n $(\"#table-body\") .empty();\n for (i = 0; i < trainNames.length; i++) {\n trainName = trainNames [i];\n showTrains();\n };\n \n }", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredDataSet.length; i++) {\n\n // Get the current object and its fields\n var data = filteredDataSet[i];\n var fields = Object.keys(data);\n\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n\n // For every field in the table object, create a new cell at set its inner text to be the current value at the current field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = data[field];\n }\n }\n}", "function generateTable() {\n\n // Only render once\n if (isTableClean) {\n disableTableGeneration();\n return;\n }\n\n psdCalculations = getGridData();\n\n // Remove previous table if needed\n if (psdHandsontable) {\n psdHandsontable.destroy();\n }\n\n var container = document.getElementById('exampleTable');\n psdHandsontable = new window.Handsontable(container,\n {\n data: psdCalculations,\n scollV: 'auto',\n scollH: 'auto',\n rowHeaders: true,\n // colHeaders: true \n colHeaders: [\n 'Step', 'freq (1/micron)', 'PSD2 (nm^4)', 'RMS DENSITY', 'RMS^2', 'RMSB^2'\n ],\n columns: [\n { data: 'step' },\n { data: 'freq' },\n //{ data: 'hidden', readOnly: true }, // Calculation column\n { data: 'psd2' },\n { data: 'rmsDensity' },\n { data: 'rms2' },\n { data: 'rmsb2' }\n ]\n });\n disableTableGeneration();\n }", "function renderUpdatedDogs() {\n let dogTable = document.querySelector('#table-body');\n dogTable.innerHTML = '';\n getAllDogs();\n}", "function redrawTable(data) {\n let tableContent = '';\n for(let i = 0 ;i <data.count;){\n tableContent += '<tr>';\n for(let j = 0; j <3;j++,i++){\n if(i===data.count){\n break;\n }else{\n tableContent +=\n '<td><a target=\"_blank\" href=\"' + data.recipes[i].f2f_url +'\">' +\n '<img class=\"picture\" src=\"'+data.recipes[i].image_url+ '\"></img>'+'</a><br>'+\n '<a target=\"_blank\" href=\"' + data.recipes[i].f2f_url +'\">' +data.recipes[i].title +'</a></td>'\n }\n }\n tableContent += '</tr>';\n }\n console.log(tableContent);\n table.innerHTML = tableContent;\n}", "function redrawDebugTable() {\n let tbody = '';\n Object.keys(debugTableData).forEach(key => {\n tbody += '<tr>';\n tbody += '<td>' + key + '</td>';\n tbody += '<td>' + debugTableData[key].type + '</td>';\n tbody += '<td>' + debugTableData[key].value + '</td>';\n tbody += '</tr>';\n });\n\n debugTbody.innerHTML = tbody;\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < sightingData.length; i++) { // Loop through the data object items\n var sighting = sightingData[i]; // Get each data item object\n var fields = Object.keys(sighting); // Get the fields in each data item\n var $row = $tbody.insertRow(i); // Insert a row in the table object\n for (var j = 0; j < fields.length; j++) { // Add a cell for each field in the data item object and populate its content\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sighting[field];\n }\n }\n}", "triggerRedraw() {\n \tlet jtabid = this.idFor('jtab');\n\t$(jtabid).empty();\n\tthis.jsonToTopTable(this, $(jtabid));\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < AlienData.length; i++) {\n // Get get the current address object and its fields\n var Sighting = AlienData[i];\n var fields = Object.keys(Sighting);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the address object, create a new cell at set its inner text to be the current value at the current address's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = Sighting[field];\n }\n }\n}", "function renderTable() {\n $('.request-item').remove();\n\n requests.forEach(function writeToTable(request) {\n $('#request-table').append(request.rowHtml);\n })\n}", "function table_fill_empty() {\n pagination_reset();\n $('.crash-table tbody').html(`\n <tr>\n <th>-</th>\n <td>-</td>\n <td>-</td>\n <td>-</td>\n </tr>`);\n}", "function renderTable() {\n $newDataTable.innerHTML = \"\";\n for (var i = 0; i < ufoData.length; i++) {\n // Get the current ufo sighting and its fields\n var sighting = ufoData[i];\n var fields = Object.keys(sighting);\n // Insert a row into the table at position i\n var $row = $newDataTable.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the address object, create a new cell \n // at set its inner text to be the current value at the \n // current address's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sighting[field];\n }\n }\n}", "draw() {\r\n // IDs Template: _box, _title, _refresh, _popup, _body, _loading\r\n // IDs Widget: _table\r\n var body = \"#\"+this.id+\"_body\"\r\n // add table\r\n // 0: key\r\n // 1: size\r\n // 2: start\r\n // 3: end\r\n // 4: value\r\n var table = '\\\r\n <table id=\"'+this.id+'_table\" class=\"table table-bordered table-striped\">\\\r\n <thead>\\\r\n <tr><th>Key</th><th># Entries</th><th>Oldest</th><th>Newest</th><th>Latest Value</th></tr>\\\r\n </thead>\\\r\n <tbody></tbody>\\\r\n </table>'\r\n $(body).html(table)\r\n // how to render the timestamp\r\n function render_timestamp(data, type, row, meta) {\r\n if (type == \"display\") return gui.date.timestamp_difference(gui.date.now(), data)\r\n else return data\r\n };\r\n // define datatables options\r\n var options = {\r\n \"responsive\": true,\r\n \"dom\": \"Zlfrtip\",\r\n \"fixedColumns\": false,\r\n \"paging\": true,\r\n \"lengthChange\": false,\r\n \"searching\": true,\r\n \"ordering\": true,\r\n \"info\": true,\r\n \"autoWidth\": false,\r\n \"columnDefs\": [ \r\n {\r\n \"targets\" : [2, 3],\r\n \"render\": render_timestamp,\r\n },\r\n {\r\n \"className\": \"dt-center\",\r\n \"targets\": [1, 2, 3]\r\n }\r\n ],\r\n \"language\": {\r\n \"emptyTable\": '<span id=\"'+this.id+'_table_text\"></span>'\r\n }\r\n };\r\n // create the table\r\n $(\"#\"+this.id+\"_table\").DataTable(options);\r\n $(\"#\"+this.id+\"_table_text\").html('<i class=\"fas fa-spinner fa-spin\"></i> Loading')\r\n // ask the database for statistics\r\n var message = new Message(gui)\r\n message.recipient = \"controller/db\"\r\n message.command = \"STATS\"\r\n this.send(message)\r\n }", "function renderTable(numProcesses, processPrefix, allocationArr,\n needArr, maxArr, resourcesArr, finished) {\n document.querySelector('#table').innerHTML = table(numProcesses, processPrefix,\n allocationArr, needArr, maxArr, resourcesArr, finished)\n}", "function RefreshTable() {\n dc.events.trigger(function () {\n alldata = tableDimension.top(Infinity);\n datatable.fnClearTable();\n datatable.fnAddData(alldata);\n datatable.fnDraw();\n });\n }", "function updateTable() {\n\t// Check if plcs finished loading\n\tfor (var i = 0; i < g_plcs.length; ++i) {\n\t\tif (g_plcs[i].err) {\n\t\t\tmoduleStatus(\"Error querying table\");\n\t\t\treturn false;\n\t\t}\n\t\tif (g_plcs[i].ready != READY_ALL) return false;\n\t}\n\n\t$(\"#detail-table-body\").html(\"\");\n\n\tfor (var i = 0; i < g_plcs.length; ++i) {\n\t\tvar row_name = \"detail-table-row-\" + i;\n\t\t$(\"#detail-table-body\").append(\"<tr id = '\" + row_name + \"'>\");\n\n\t\t$(\"#\" + row_name).append(\"<td>\" + g_plcs[i].name + \"</td>\");\n\n\t\tfor (var j = 0; j < 6; ++j)\n\t\t\t$(\"#\" + row_name).append(\"<td data-toggle='tooltip' data-placement='top' title='\" + g_plcs[i].ai[j].name + \"'>\" + g_plcs[i].ai[j].val + \"</td>\");\n\n\t\tfor (var j = 0; j < 6; ++j)\n\t\t\t$(\"#\" + row_name).append(\"<td data-toggle='tooltip' data-placement='top' title='\" + g_plcs[i].di[j].name + \"'>\" + g_plcs[i].di[j].val + \"</td>\");\n\n\t\tfor (var j = 0; j < 6; ++j) {\n\t\t\tdo_val = g_plcs[i].do[j].val ? \"ON\" : \"OFF\";\n\t\t\tdo_class = \"btn do-button \" + (g_plcs[i].do[j].val ? \"btn-success\" : \"btn-secondary\");\n\t\t\tdo_txt = \"<button data-do-index = \" + j + \" data-plc-index = \" + i + \" data-do-value = \" + g_plcs[i].do[j].val + \" type = 'button' class = '\" + do_class + \"'>\" + do_val + \"</button>\";\n\t\t\t$(\"#\" + row_name).append(\"<td data-toggle='tooltip' data-placement='top' title='\" + g_plcs[i].do[j].name + \"'>\" + do_txt + \"</td>\");\n\t\t}\n\t\tconf_val = g_plcs[i].confirmation ? \"Pend\" : \"OK\";\n\t\tconf_class = \"btn \" + (g_plcs[i].confirmation ? \"btn-warning\" : \"btn-info\")\n\t\t$(\"#\" + row_name).append(\"<td><button type = 'button' class = '\" + conf_class + \"'>\" + conf_val + \"</button></td>\");\n\n\t\t$(\"#\" + row_name).append(\"<td><button data-plc-index = \" + i + \" type = 'button' class = 'send-button btn btn-light'> Enviar </button></td>\");\n\t}\n\t$('[data-toggle=\"tooltip\"]').tooltip({trigger : 'hover'});\n\tmoduleStatus(\"Table query OK\");\n}", "function render(data) {\r\n\t\t\t\t\t\t$('#slc_Marca').children().remove();\r\n\t\t\t\t\t\t$('#slc_TipoVeiculo').children().remove();\r\n\t\t\t\t\t\tvar tabela = $('#tableDiv').append(\r\n\t\t\t\t\t\t\t\t$('<table></table>').attr(\"id\", \"tabela\"));\r\n\t\t\t\t\t\tvar tHead = \"<thead id='tableHead'></thead>\";\r\n\t\t\t\t\t\t$('#tabela').append(tHead);\r\n\t\t\t\t\t\tvar rowH = \"<tr> \" + \"<th>ID</th>\" + \"<th>Marca</th>\"\r\n\t\t\t\t\t\t\t\t+ \"<th>Tipo Veiculo</th>\" + \"<th>Modelo</th>\"\r\n\t\t\t\t\t\t\t\t+ \"<th>Status</th>\" + \"<th>Actions</th>\"\r\n\t\t\t\t\t\t\t\t+ \"</tr>\";\r\n\t\t\t\t\t\t$('#tableHead').append(rowH);\r\n\r\n\t\t\t\t\t\t$('#tabela').append(\r\n\t\t\t\t\t\t\t\t$('<tbody></tbody>').attr(\"id\", \"tabelaBody\"));\r\n\r\n\t\t\t\t\t\t$.each(data, function(index, value) {\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tvar td = $(\"<tr id= 'row\" + index\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ \"'>\" + \"</tr>\");\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tvar row1 = $(\"<td>\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ value.idModelo + \"</td>\");\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tvar row2 = $(\"<td>\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ value.idMarca.descMarca\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ \"</td>\");\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tvar row3 = $(\"<td>\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ value.idTipoV.descTipoV\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ \"</td>\");\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tvar row4 = $(\"<td>\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ value.descModelo\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ \"</td>\");\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tvar row5 = $(\"<td>\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ value.statusModelo\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ \"</td>\");\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t// Efetua A Funcao Ao Clicar No\r\n\t\t\t\t\t\t\t\t\t\t\t// Botao\r\n\t\t\t\t\t\t\t\t\t\t\t// btn-update\r\n\t\t\t\t\t\t\t\t\t\t\tvar buttonUpdate = $(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<button>Modificar</button>')\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"id\",\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"btn-update-\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t+ index)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.click({\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tp1 : this\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}, setInputData);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tvar buttonRemove = $(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t'<button>Remover</button>')\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.attr(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"id\",\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"btn-remove-\"\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t+ index)\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.click({\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tp1 : this\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t}, callRemoveServlet);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\tvar row6 = $(\"<td></td>\");\r\n\t\t\t\t\t\t\t\t\t\t\trow6.append(buttonUpdate);\r\n\t\t\t\t\t\t\t\t\t\t\trow6.append(buttonRemove);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\ttd.append(row1);\r\n\t\t\t\t\t\t\t\t\t\t\ttd.append(row2);\r\n\t\t\t\t\t\t\t\t\t\t\ttd.append(row3);\r\n\t\t\t\t\t\t\t\t\t\t\ttd.append(row4);\r\n\t\t\t\t\t\t\t\t\t\t\ttd.append(row5);\r\n\t\t\t\t\t\t\t\t\t\t\ttd.append(row6);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t$('#tabela tbody').append(td);\r\n\r\n\t\t\t\t\t\t\t\t\t\t\t$('#set')\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t.append('</tbody></table>');\r\n\r\n\t\t\t\t\t\t\t\t\t\t})\r\n\r\n\t\t\t\t\t\t// Preenche O Select Marca\r\n\t\t\t\t\t\tgetMarcas();\r\n\r\n\t\t\t\t\t\t// Preenche O Select TipoVeiculo\r\n\t\t\t\t\t\tgetTiposVeiculos();\r\n\r\n\t\t\t\t\t}", "function generateTable(){\n if(!table_data.length)\n return;\n //generate first header row with column names\n var tmpl1='<TR><TD></TD>';\n for(var i=0;i<table_data[0].length;i++){\n tmpl1+='<TH onclick=\"sortData('+i+'\\,this)\"';\n if(sort_track==i)\n tmpl1+='sort=\\''+sort_type+'\\' class=\"active\"';\n tmpl1+='>C'+(i+1)+'<i class=\"ion-minus-circled\" onclick=\"removeRC(0,'+i+'\\)\\\" title=\"Delete Column\"></i></TH>';\n }\n tmpl1+='<TH class=\"addRC\" onclick=\"addRC(0)\"><i class=\"ion-plus-circled\"></i> Add</TH>';\n tmpl1+='</TR>';\n\n //generate rest of the rows\n var tmpl2;\n for(i=0;i<table_data.length;i++){\n tmpl2='<TR>';\n for(var j=0;j<table_data[0].length;j++) {\n if(j==0)\n tmpl2 += '<TH>R' + (i+1) + '<i class=\"ion-minus-circled\" onclick=\"removeRC(1,'+i+'\\)\\\" title=\"Delete Row\"></i></TH>';\n tmpl2 += '<TD><div contenteditable=\"true\" onkeyup=\"updateData('+i+','+j+'\\,this\\)\\\" onkeypress=\"avoidEnter(event)\">'+table_data[i][j]+'</div></TD>';\n }\n tmpl2 += '<TD class=\"addRC\" onclick=\"addRC(0)\"></TD>';\n tmpl2+='</TR>';\n tmpl1=tmpl1.concat(tmpl2);\n }\n\n //generate last row with add function\n tmpl2='<TR>';\n for(var j=0;j<table_data[0].length;j++) {\n if(j==0)\n tmpl2 += '<TH class=\"addRC\" onclick=\"addRC(1)\"><i class=\"ion-plus-circled\"></i> Add</TH>';\n tmpl2 += '<TD class=\"addRC\" onclick=\"addRC(1)\"></TD>';\n }\n tmpl2 += '<TD class=\"addRC\" onclick=\"addRC(1)\"></TD>';\n tmpl2+='</TR>';\n tmpl1=tmpl1.concat(tmpl2);\n\n document.getElementById('excel').innerHTML=tmpl1;\n}", "_refreshLayout() {\n this.deselect();\n\n this._containerHead.clear();\n this._containerBody.clear();\n\n // create header\n if (this._columns.length) {\n const headRow = new TableRow({\n header: true\n });\n\n this._columns.forEach((column, colIndex) => {\n const cell = new TableCell({\n header: true\n });\n\n this._addResizeHandle(cell, colIndex);\n\n // set preferred width\n if (column.width !== undefined) {\n cell.width = column.width;\n }\n\n // add sort class to header cell\n if (column.sortKey && this._sort.key === column.sortKey ||\n column.sortFn && this._sort.fn === column.sortFn) {\n cell.class.add(CLASS_SORT_CELL);\n if (!this._sort.ascending) {\n cell.class.add(CLASS_SORT_CELL_DESCENDING);\n }\n }\n\n const label = new Label({\n text: column.title\n });\n // make inline to be able to use text-overflow: ellipsis\n label.style.display = 'inline';\n cell.append(label);\n\n // sort observers when clicking on header cell\n cell.on('click', () => this.sortByColumnIndex(colIndex));\n\n headRow.append(cell);\n });\n\n this.head.append(headRow);\n }\n\n if (!this._observers) return;\n\n this._sortObservers();\n\n this._observers.forEach((observer) => {\n const row = this._createRow(observer);\n this.body.append(row);\n });\n }", "function _buildTable() {\n // _displayLoading(true);\n _addGradeRange();\n _renderSelects();\n var table = _setupDataTable(renderTable());\n renderFeatures();\n}", "function refreshTable(domId) {\n\n //Remove the current table\n $('table').remove();\n var app = quickforms.app;\n //Append the new table with the new options list\n var newJson = [];\n for (var row in quickforms.designer.values) {\n if (quickforms.designer.values[row][quickforms.designer.lookup + 'Order'] >= 0)\n newJson.push(quickforms.designer.values[row]);\n }\n newJson.sort(function (a, b) {\n return parseInt(a[quickforms.designer.lookup + 'Order']) - parseInt(b[quickforms.designer.lookup + 'Order']);\n });\n displayEditingPage(JSON.stringify(newJson), quickforms.designer.lookup);\n }", "function GenerateFullTable() {\n\n //debugger;\n\n if((Intern_TableDivName === undefined || Intern_TableDivName === null || Intern_TableDivName === \"\") ||\n (Intern_TableDivElem === undefined || Intern_TableDivElem === null || Intern_TableDivElem === \"\"))\n return;\n\n var Intern_TableHtml = '';\n if (Intern_ArrayOfValues.length !== 0) {\n Intern_TableHtml = Intern_TableHtml + '<table class=\"tableCls\">';\n Intern_TableHtml = Intern_TableHtml + '<thead>';\n Intern_TableHtml = Intern_TableHtml + '<tr id=\"' + Intern_InstanceName + 'trHeaders\">';\n if (Intern_TableFieldDispNames === undefined || Intern_TableFieldDispNames === null)\n Intern_TableFieldDispNames = Intern_TableFieldIDs;\n $.each(Intern_TableFieldDispNames, function (index, value) {\n Intern_TableHtml = Intern_TableHtml + '<th class=\"tableHeadCls\">';\n Intern_TableHtml = Intern_TableHtml + value;\n Intern_TableHtml = Intern_TableHtml + '</th>';\n });\n if (Setting_IncludeUpDown || Setting_IncludeEdit || Setting_IncludeDelete) {\n Intern_TableHtml = Intern_TableHtml + '<th class=\"tableHeadCls\">';\n Intern_TableHtml = Intern_TableHtml + Disp_OperationsTitle;\n Intern_TableHtml = Intern_TableHtml + '</th>';\n }\n Intern_TableHtml = Intern_TableHtml + '</tr>';\n Intern_TableHtml = Intern_TableHtml + '</thead>';\n\n Intern_TableHtml = Intern_TableHtml + '<tbody>';\n Intern_TableHtml = Intern_TableHtml + '</tbody>';\n Intern_TableHtml = Intern_TableHtml + '</table>';\n\n Intern_TableDivElem.html(Intern_TableHtml);\n\n $(\"#\" + Intern_TableDivName + \" tbody\").html(GenerateTableData());\n for (var i = 0; i < Intern_ArrayOfValues.length; i++)\n AddEvents(i);\n Intern_DictConcatInput = null;\n }\n }", "function updateTable() {\n\t_formatDatepicker();\n\t_updateTable('table-internal-order', true);\n\t_autoFormattingDate(\"input.datepicker\");\n}", "function refreshTable() {\n\t// Empty the table body to refresh\n\tlet tbody = document.getElementById('tbody');\n\ttbody.innerHTML = '';\n\n\t// Loop through todos and add cells.\n\tfor (var i = 0; i < todos.length; i++) {\n\t\tlet todo = todos[i];\n\t\taddTodoCell(todo, i+1);\n\t}\n}", "onRowsRerender() {\n this.scheduleDraw(true);\n }", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredrows.length; i++) {\n // Get get the current address object and its fields\n var rows = filteredrows[i];\n var fields = Object.keys(rows);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the rows object, create a new cell at set its inner text to be the current value at the current row's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = rows[field];\n }\n }\n}", "function redrawTable(id){ \n clearTable();\n removeFromList(id);\n povoateTable(); \n setupDeleteListener();\n setfilter();\n}", "function renderData() {\n tableBody.innerHTML = \"\";\n for (var i = 0; i < tableData.length; i++) {\n var data = tableData[i];\n var rows = Object.keys(data);\n var input = tableBody.insertRow(i);\n for (var j = 0; j < rows.length; j++) {\n var field = rows[j];\n var cell = input.insertCell(j);\n cell.innerText = data[field];\n }\n }\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredData.length; i++) {\n // Get the current object and its fields\n var data = filteredData[i];\n var fields = Object.keys(data);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = data[field];\n }\n }\n}", "function drawTable(){\n for (employee of allEmployees){\n newRow(employee);\n }\n}", "function drawDynamicTable() {\n try {\n var tableSortingColumns = [\n { orderable: false },null, null, null, null, null, null, null,\n ];\n var tableFilteringColumns = [\n { type: \"null\" },{ type: \"text\" }, { type: \"text\" }, { type: \"text\" }, { type: \"text\" }, { type: \"text\" }, { type: \"text\" }, { type: \"text\" },\n ];\n\n var tableColumnDefs = [\n\n ];\n //select tblletter.id as 'AutoCodeHide', tblletter.title as 'عنوان الخطاب ',tblletter.details as 'تفاصيل الخطاب', tbldepartmen.name as 'صادر من',to_d.name as 'صادر الي',tblUsers.User_Name as 'الراسل', 1 as ' تعديل /حذف' from tblletter inner join tbldepartmen on tblletter.from_dep=tbldepartmen.id inner join tbldepartmen to_d on to_d.id=tblletter.to_dep inner join tblUsers on tblletter.add_by=tblUsers.id where tblletter.type=2 and ISNUll(tblletter.deleted,0)=0\n var initialSortingColumn = 0;\n loadDynamicTable('out_outside_letters', \"AutoCodeHide\", tableColumnDefs, tableFilteringColumns, tableSortingColumns, initialSortingColumn, \"Form\");\n } catch (err) {\n alert(err);\n }\n}", "function renderTable(data) {\n var table_data = data.data;\n var height = data.height;\n var width = data.width;\n var table = document.getElementById(\"results-\" + current_tab);\n $(\".no-table#tab-\" + current_tab).hide();\n table.innerHTML = \"\";\n $(\"h5\").hide();\n for (var i = 0; i < height; i++) {\n let row = document.createElement(\"tr\");\n for (var j = 0; j < width; j++) {\n let col;\n if (i == 0 || j == 0) col = document.createElement(\"th\");\n else col = document.createElement(\"td\");\n col.appendChild(document.createTextNode(table_data[i][j]));\n row.appendChild(col);\n }\n table.appendChild(row);\n }\n var current_date = new Date();\n $(\".date#tab-\" + current_tab).text(current_date.toLocaleTimeString());\n $(\"h5\").show();\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredTable.length; i++) {\n var address = filteredTable[i];\n var fields = Object.keys(address);\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = address[field];\n }\n }\n}", "renderAndAdjust() {\n this.hot.render();\n\n // Dirty workaround to prevent scroll height not adjusting to the table height. Needs refactoring in the future.\n this.hot.view.adjustElementsSize();\n }", "function renderTable() {\n \n // Delete the list of cities prior to adding new city table data \n // (necessary to prevent repeat of table data)\n $(\"tbody\").empty();\n\n // Loop through the array of cities\n for (var i = 0; i < citiesArray.length; i++) {\n // Render new table row and table data elements for each city in the array.\n var tRow = $(\"<tr>\");\n var tData = $(\"<td>\");\n var tSpan = $(\"<span>\");\n\n tSpan.addClass(\"city\");\n tData.attr(\"data-name\", citiesArray[i]);\n tData.attr(\"data-index\", i);\n tSpan.text(citiesArray[i]);\n\n let button = $(\"<button>\");\n button.text(\"Remove\");\n button.attr(\"class\", \"btn-sm bg-danger rounded text-white\");\n \n tData.append(tSpan);\n tData.append(button);\n tRow.append(tData);\n $(\"tbody\").append(tRow);\n }\n }", "function renderSalesTable() {\n\n renderTableHead();\n renderTableBody();\n renderTableFoot();\n\n}", "function fillInTable() {\n var toggleIcon = ' <i class=\"view-toggle icon-chevron-down icon-blue\"></i>';\n var rowLinks = '<div class=\"pull-right\"><a href=\"javascript:;\" class=\"patient-launch\" title=\"View Patient List\"><i class=\"icon-list report-icon\"></i></a></div>';\n // Not currenlty in use - for tables with only one set of numbers per row (doesn't display chart link\n //var rowLinksShort = '<div class=\"pull-right\"><a href=\"#\" class=\"patient-launch\" title=\"View Patient List\"><i class=\"icon-list report-icon\"></i></a></div>';\n var total = 0;\n $(\".report-mainrow\").each(function() {\n rowtotal = $(this).closest('tr').find('td:last-child').prev().html();\n total = (total * 1) + (rowtotal * 1);\n var rowCount = $(this).nextUntil('.report-mainrow,.report-totalrow').length;\n if ( rowCount > '0') {\n $(this).find('td.report-row-info span').append(toggleIcon);\n $(this).find('td:first-child').addClass('view-details');\n $(this).children('td').eq(1).find('div').addClass('view-details');\n }\n });\n $('.report-table tbody td.report-row-info div').each(function() {\n $(this).before(rowLinks);\n });\n // For displaying one set of results only\n $('.report-table tbody td.report-row-info-short div').each(function() {\n $(this).before(rowLinksShort);\n });\n // Add total to total row\n $(\"#datatable tr:last\").find('td:last-child').prev().empty().append(total);\n }", "function renderTable() {\n console.log(\"in Render\");\n tbody.innerHTML = \"\";\n for (var i = 0; i < filteredObs.length; i++) {\n // Get get the current address object and its fields\n var address = filteredObs[i];\n var fields = Object.keys(address);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var row = tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the address object, create a new cell at set its inner text to be the current value at the current address's field\n var field = fields[j];\n var cell = row.insertCell(j);\n cell.innerText = address[field];\n }\n }\n}", "function redrawTable(tbl, itemsdata) {\n tbl.clear();\n for (var i = 0; i < data.length; i++) {\n tbl.row.add(data[i]);\n }\n tbl.draw();\n }", "function getTable() {\n\n if (this.object) {\n var tbody = $('#gcodelist tbody');\n\n // clear table\n $(\"#gcodelist > tbody\").html(\"\");\n\n for (let i = 0; i < this.object.userData.lines.length; i++) {\n var line = this.object.userData.lines[i];\n\n if (line.args.origtext != '') {\n tbody.append('<tr><th scope=\"row\">' + (i + 1) + '</th><td>' + line.args.origtext + '</td></tr>');\n }\n }\n\n // set tableRows to the newly generated table rows\n tableRows = $('#gcodelist tbody tr');\n }\n}", "function initTable() {\n var table = document.getElementById('my_table');\n utils.removeAllChildren(table); // in case one of the catalogs got updated\n\n //table.appendChild( initColGroup());\n table.appendChild( initTHead());\n table.appendChild( initTBody());\n}", "function render() {\n\tbookTable.innerHTML = \"\"; // Reset all books already rendered on page\n\t//Render the books currently in myLibrary to the HTML page\n\tfor (var book of library.getLibrary()) {\n\t\taddRow(book, book.firebaseKey); // Use book.firebaseKey to have a way to remove / update specific books\n\t}\n}", "render() {\n this.config.element.innerHTML = this.humanTable;\n this.config.preloader.classList.remove(this.config.loading_class);\n }", "function populateTable(ID) {\n\tlet table;\n\tlet newTableBody;\n\tswitch (currentPage) {\n\t\tcase 'bonus': {\n\t\t\tlet world = document.getElementById('worldSelector').value;\n\t\t\tlet character = document.getElementById('characterSelector').value;\n\t\t\tlet worldBonusesArray = bonusArray[character]['All Character Bonuses'][world]['World Bonuses'];\n\t\t\ttable = document.getElementById('bonusTable');\n\t\t\tnewTableBody = document.createElement('tbody');\n\t\t\tif (worldBonusesArray.length > 0) {\n\t\t\t\tfor (let i = 0; i < worldBonusesArray.length; i++) {\n\t\t\t\t\tlet row = document.createElement('tr');\n\t\t\t\t\trow.id = 'row' + i;\n\t\t\t\t\tlet cell = document.createElement('input');\n\t\t\t\t\tcell.type = 'checkbox';\n\t\t\t\t\tcell.id = 'check' + i;\n\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\tbonusPropertiesArray.forEach(property => {\n\t\t\t\t\t\tlet cell = document.createElement('td');\n\t\t\t\t\t\tcell.innerHTML = worldBonusesArray[i][property];\n\t\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\t})\n\t\t\t\t\tnewTableBody.appendChild(row);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'chests': {\n\t\t\ttable = document.getElementById('chestsTable');\n\t\t\tnewTableBody = document.createElement('tbody');\n\t\t\tif (chestArray[ID].Chests.length > 0) {\n\t\t\t\tfor (let i = 0; i < chestArray[ID].Chests.length; i++) {\n\t\t\t\t\tlet row = document.createElement('tr');\n\t\t\t\t\trow.id = 'row' + i;\n\t\t\t\t\tlet cell = document.createElement('input');\n\t\t\t\t\tcell.type = 'checkbox';\n\t\t\t\t\tcell.id = 'check' + i;\n\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\tchestPropertiesArray.forEach(property => {\n\t\t\t\t\t\tlet cell = document.createElement('td');\n\t\t\t\t\t\tcell.innerHTML = chestArray[ID].Chests[i][property];\n\t\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\t})\n\t\t\t\t\tnewTableBody.appendChild(row);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'equipment': {\n\t\t\ttable = document.getElementById('equipmentTable');\n\t\t\tnewTableBody = document.createElement('tbody');\n\t\t\tif (equipmentArray[ID].Equipments.length > 0) {\n\t\t\t\tfor (let i = 0; i < equipmentArray[ID].Equipments.length; i++) {\n\t\t\t\t\tlet row = document.createElement('tr');\n\t\t\t\t\trow.id = 'row' + i;\n\t\t\t\t\tlet cell = document.createElement('input');\n\t\t\t\t\tcell.type = 'checkbox';\n\t\t\t\t\tcell.id = 'check' + i;\n\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\tequipmentPropertiesArray.forEach(property => {\n\t\t\t\t\t\tlet cell = document.createElement('td');\n\t\t\t\t\t\tcell.innerHTML = equipmentArray[ID].Equipments[i][property];\n\t\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\t})\n\t\t\t\t\tnewTableBody.appendChild(row);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'forms': {\n\t\t\ttable = document.getElementById('formsTable');\n\t\t\tnewTableBody = document.createElement('tbody');\n\t\t\tif (driveFormArray[ID]['Drive Levels'].length > 0) {\n\t\t\t\tfor (let i = 0; i < driveFormArray[ID]['Drive Levels'].length; i++) {\n\t\t\t\t\tlet row = document.createElement('tr');\n\t\t\t\t\trow.id = 'row' + i;\n\t\t\t\t\tlet cell = document.createElement('input');\n\t\t\t\t\tcell.type = 'checkbox';\n\t\t\t\t\tcell.id = 'check' + i;\n\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\tdriveFormPropertiesArray.forEach(property => {\n\t\t\t\t\t\tlet cell = document.createElement('td');\n\t\t\t\t\t\tcell.innerHTML = driveFormArray[ID]['Drive Levels'][i][property];\n\t\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\t})\n\t\t\t\t\tnewTableBody.appendChild(row);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'levels': {\n\t\t\ttable = document.getElementById('levelsTable');\n\t\t\tnewTableBody = document.createElement('tbody');\n\t\t\tlevelArray.forEach(level => {\n\t\t\t\tlet row = document.createElement('tr');\n\t\t\t\trow.id = 'row' + (level['Level'] - 1);\n\t\t\t\tlet cell = document.createElement('input');\n\t\t\t\tcell.type = 'checkbox';\n\t\t\t\tcell.id = 'check' + (level['Level'] - 1);\n\t\t\t\trow.appendChild(cell);\n\t\t\t\tlevelPropertiesArray.forEach(property => {\n\t\t\t\t\tlet cell = document.createElement('td');\n\t\t\t\t\tcell.innerHTML = level[property];\n\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t})\n\t\t\t\tnewTableBody.appendChild(row);\n\t\t\t})\n\t\t\tbreak;\n\t\t}\n\t\tcase 'other': {\n\t\t\ttable = document.getElementById('criticalTable');\n\t\t\tnewTableBody = document.createElement('tbody');\n\t\t\tfor (let i = 0; i < criticalArray.length; i++) {\n\t\t\t\tlet row = document.createElement('tr');\n\t\t\t\trow.id = 'row' + i;\n\t\t\t\tlet cell = document.createElement('input');\n\t\t\t\tcell.type = 'checkbox';\n\t\t\t\tcell.id = 'check' + i;\n\t\t\t\trow.appendChild(cell);\n\t\t\t\tcriticalPropertiesArray.forEach(property => {\n\t\t\t\t\tlet cell = document.createElement('td');\n\t\t\t\t\tcell.innerHTML = criticalArray[i][property];\n\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t})\n\t\t\t\tnewTableBody.appendChild(row);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase 'popups': {\n\t\t\ttable = document.getElementById('popupsTable');\n\t\t\tnewTableBody = document.createElement('tbody');\n\t\t\tif (popupArray[ID].Popups.length > 0) {\n\t\t\t\tfor (let i = 0; i < popupArray[ID].Popups.length; i++) {\n\t\t\t\t\tlet row = document.createElement('tr');\n\t\t\t\t\trow.id = 'row' + i;\n\t\t\t\t\tlet cell = document.createElement('input');\n\t\t\t\t\tcell.type = 'checkbox';\n\t\t\t\t\tcell.id = 'check' + i;\n\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\tpopupPropertiesArray.forEach(property => {\n\t\t\t\t\t\tlet cell = document.createElement('td');\n\t\t\t\t\t\tcell.innerHTML = popupArray[ID].Popups[i][property];\n\t\t\t\t\t\trow.appendChild(cell);\n\t\t\t\t\t})\n\t\t\t\t\tnewTableBody.appendChild(row);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tbreak;\n\t\t}\n\t}\n\tlet oldTableBody = table.lastElementChild;\n\ttable.replaceChild(newTableBody, oldTableBody);\n}", "function theQwertyGrid_reFillTable(data) {\n\t\t\ttheQwertyGrid_clearAllRows();\n\t\t\ttheQwertyGrid_addRows(data, _theQwertyGrid_tableProps);\n\t\t}", "function renderTable() {\n $tbody.innerHTML = '';\n for (var i = 0; i < filteredData.length; i++) {\n // Get get the current UFOData object and its fields\n var UFOData = filteredData[i];\n var fields = Object.keys(UFOData);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the UFOData object, create a new cell at set its inner text to be the current value\n // at the current UFOData's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = UFOData[field];\n }\n }\n}", "function resetTable(){\n Array.from(tableProduct.rows).forEach(function(row){\n row.style.display='table-row';\n })\n }", "function resetTableValuesBeforeRendering (){\n listOfAllPieChartElements = [];\n remainingPieChartsForAdding = [];\n clearInterval(pieRenderedInterval);\n pieRenderedInterval = null;\n }", "updateColorTable(){\n let self = this;\n let keys = Object.keys(this._colors);\n let values = Object.values(this._colors);\n /* these are the DOM elements in each row of the table */\n let rowComponents = [\n { 'type': 'div', 'attr':[['class', 'flex-cell display']] },\n { 'type': 'div', 'attr':[['class', 'flex-cell label']] },\n { 'type': 'span', 'attr':[['class', 'flex-cell small-close']] },\n ];\n super.initTableRows('#color-table', 'color', keys, rowComponents);\n /* update the color backgroud of the display are of each row */\n d3.select('#color-table').selectAll('.display')\n .data(values)\n .style('background-color', d => d )\n ;\n /* set the labels for each row */\n d3.select('#color-table').selectAll('.label')\n .data(keys)\n .text(d => d)\n ;\n /* update the small close span element */\n d3.select('#color-table').selectAll('.small-close')\n .data(keys)\n .attr('data-key', d => d)\n .html('&times;')\n .on('click', function(d){\n if( this.dataset.key === 'Default' ) return;\n delete( self._colors[this.dataset.key] );\n self.assignColors();\n self.updateColorTable();\n self.plot();\n })\n ;\n }", "function generateTable(data) {\n noResults.style('display', 'none');\n tableBody.html('');\n table.style('display', 'table');\n data.forEach(result => {\n var row = tableBody.append('tr');\n var date = row.append('td').text(result.datetime).attr('class', 'datetime').on('click', lookUp);\n var city = row.append('td').text(result.city).attr('class', 'city').on('click', lookUp);\n var state = row.append('td').text(result.state).attr('class', 'state').on('click', lookUp);\n var country = row.append('td').text(result.country).attr('class', 'country').on('click', lookUp);\n var shape = row.append('td').text(result.shape).attr('class', 'shape').on('click', lookUp);\n var duration = row.append('td').text(result.durationMinutes).attr('class', 'duration');\n var description = row.append('td').text(result.comments).attr('class', 'description');\n });\n}", "function table_maker(datasets) {\n reset_table();\n for (var i = 0; i < datasets.length; i++) {\n $('#summary').append('<tr style=\"text-align: center\">' + data(datasets[i]) + '</tr>');\n }\n totals_row_maker(datasets);\n $('#table-div').slideDown();\n }", "function resetTable(){\n tbody.html(\"\");\n}", "function resetT(){\r\n output.innerHTML = \r\n \"<table class=\\\"ttable\\\" id=\\\"t\\\">\"+\r\n \"<thead class=\\\"tthead\\\">\"+\r\n \"<tr>\"+\r\n \"<th colspan=\\\"3\\\">Table Data</th>\"+\r\n \"</tr>\"+\r\n \"</thead>\"+\r\n \"<tbody class=\\\"ttbody\\\">\"+\r\n \"<tr>\"+\r\n \"<td rowspan=\\\"2\\\">1</td>\"+\r\n \"<td>2</td>\"+\r\n \"<td>3</td>\"+\r\n \"</tr>\"+\r\n \"<tr>\"+\r\n \"<td>4</td>\"+\r\n \"<td>5</td>\"+\r\n \"</tr>\"+\r\n \"<tr>\"+\r\n \"<td>6</td>\"+\r\n \"<td rowspan=\\\"2\\\">7</td>\"+\r\n \"<td>8</td>\"+\r\n \"</tr>\"+\r\n \"<tr>\"+\r\n \"<td>9</td>\"+\r\n \"<td>10</td>\"+\r\n \"</tr>\"+\r\n \"</tbody>\"+\r\n \"<tfoot class=\\\"ttfoot\\\">\"+\r\n \"<tr>\"+\r\n \"<td>11</td>\"+\r\n \"<td>12</td>\"+\r\n \"<td rowspan=\\\"2\\\">13</td>\"+\r\n \"</tr>\"+\r\n \"<tr>\"+\r\n \"<td>14</td>\"+\r\n \"<td>15</td>\"+\r\n \"</tr>\"+\r\n \"</tfoot>\"+\r\n\"</table>\"\r\n}", "function addtable() {\n tbody.html(\"\");\n console.log(`There are ${tableDatashape.length} records in this table.`);\n console.log(\"----------\");\n tableDatashape.forEach(function(sighting) {\n var row = tbody.append(\"tr\");\n Object.entries(sighting).forEach(function([key, value]) {\n var cell = row.append(\"td\");\n cell.text(value);\n });\n });\n }", "function GenerateTableData() {\n var ret = \"\";\n var tempRet = \"\";\n var display;\n var i;\n $.each(Intern_ArrayOfValues, function (index, value) {\n\n //debugger;\n\n tempRet = tempRet + '<tr id=\"' + Intern_InstanceName + 'tableRow_' + index + '\">';\n $.each(Intern_TableFieldIDs, function (index1, value1) {\n\n //debugger;\n\n i = Intern_InputFieldIds.indexOf(value1);\n if (Intern_InputFieldTypes === undefined || Intern_InputFieldTypes === null\n || Intern_InputFieldTypes[i] === undefined || Intern_InputFieldTypes[i] === null\n || Intern_InputFieldTypes[i] === \"\") {\n display = '<td>' + value[value1] + '</td>';\n }\n else if (Intern_InputFieldTypes[i] === \"checkbox\") {\n if (value[value1] === \"0\") {\n display = \"<td>false</td>\";\n }\n else {\n display = \"<td>true</td>\";\n }\n }\n else if (Intern_InputFieldTypes[i] === \"radio\") {\n if (value[value1] === null) {\n display = \"<td></td>\";\n }\n else {\n display = \"<td>\" + value[value1] + \"</td>\";\n }\n }\n else if (Intern_InputFieldTypes[i] === \"color\") {\n display = '<td style=\"background-color:' + value[value1] + '\"></td>';\n }\n else if (Intern_InputFieldTypes[i] === \"select\") {\n display = '<td>' + $('#' + Intern_InputFieldIds[i] + ' option[value=' + value[value1] + ']').text() + '</td>';\n }\n else {\n display = '<td>' + value[value1] + '</td>';\n }\n tempRet = tempRet + display;\n //i++;\n });\n tempRet = tempRet + AddOperations(index);\n tempRet = tempRet + '</tr>';\n\n if (Setting_AddToTop)\n ret = tempRet + ret;\n else\n ret = ret + tempRet;\n tempRet = \"\";\n //i = 0;\n });\n return ret;\n }", "function refreshTable() {\n debug(base.options.dataSourceType);\n $(base.$el_body.find('.sibdatatable-spin')).show();\n base.$el_body_content.hide();\n switch (base.options.dataSourceType) {\n case 'remote':\n getTableDataFromRemote();\n break;\n case 'html':\n getTableDataFromHtml();\n break;\n case 'json':\n getTableDataFromJSON();\n break;\n }\n }", "function pagesChange() {\r\n renderTable();\r\n}", "onRendering() {\n this.set('tableIsLoading', false);\n }", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredData.length; i++) {\n // Get get the current address object and its fields\n var data = filteredData[i];\n var fields = Object.keys(data);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the address object, create a new cell at set its inner text to be the current value at the current address's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = data[field];\n }\n }\n}", "function renderTable() {\n tbody.innerHTML = \"\";\n for (var i = 0; i < filterData.length; i++) {\n // Get the current objects and its fields. Calling each dictionary object 'ovni'. This comes from the data.js database where\n //the object dataSet holds an array (list) of dictionaries. Each dictionary is an object and I'm calling it ovni. This will\n // loop through each dictionary/object from the variable dataSet and store their keys in the variable fields. \n\n var ovni = filterData[i];\n var fields = Object.keys(ovni);\n \n // Create a new row in the tbody, set the index to be i + startingIndex\n // fields are the columns\n var row = tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the address object, create a new cell and set its inner text to be the current value at the current address's field\n // the variable field will gather the columns names. It will loop through the fields(columns). Example, fields index 0 is datetime.\n var field = fields[j];\n var cell = row.insertCell(j);\n // now i will pass to the cell the ovni object, field values.\n cell.innerText = ovni[field];\n }\n }\n}", "function clearTable() {\n tbody.html(\"\");\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n\n var endingIndex = startingIndex + resultsPerPage;\n // Get a section of the addressData array to render\n var sightingsSubset = sightingsData.slice(startingIndex, endingIndex);\n\n\n for (var i = 0; i < sightingsSubset.length; i++) {\n //console.log(sightingsData.length);\n // Get get the current sighting object and its fields\n var sighting = sightingsSubset[i];\n var fields = Object.keys(sighting);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the sighting object, create a new cell at set its inner text to be the current value at the current sighting's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = sighting[field];\n }\n }\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredDateTime.length; i++) {\n // Get get the current date_time object and its fields\n var date_time = filteredDateTime[i];\n var fields = Object.keys(date_time);\n // Create a new row in the tbody, set the index to be i + startingIndex\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n // For every field in the date_time object, create a new cell at set its inner text to be the current value at the current date_time's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = date_time[field];\n }\n }\n}", "function renderCookieStand() {\n tableDataDisplay.innerHTML = ''; //Clear the data table (tableDataDisplay)\n salesPerHour = []; //Clear the salesByHour array\n grandTotalSales = 0; //Clear the total sales across all locations\n renderTableHeader(); //reRender the header for the table\n for (var i = 0; i < cookieStands.length; i++) { //Loop through the businesses array to render the table\n cookieStands[i].renderTableBody(); //reRender the table body for the current business[i]\n }\n calcGrandTotal(); //Calculate the new sales totals\n renderTableFooter(); //reRender the footer for the table\n}", "function populateTable() {\n cell1.innerHTML = '<img class=\"image\" src=\"\" />';\n cell2.innerHTML = item.name;\n cell3.innerHTML = item.price;\n cell4.innerHTML =\n '<div class=\"item-quantity-container\"><div class=\"item-quantity-box\"><div class=\"item-down-box\"><img class=\"item-down-image\" src=\"img/icons-2x.png\" /></div><p class=\"quantity\"></p><div class=\"item-up-box\"><img class=\"item-up-image\" src=\"img/icons-2x.png\" /></div></div><div class=\"item-update-container\"><button class=\"item-update-button\" type=\"button\">Update</button></div></div>';\n cell5.innerHTML =\n '<span class=\"item-subtotal-text\">Subtotal: </span><span class=\"item-subtotal-number\">' +\n item.price * item.numItems +\n \"</span>\";\n cell6.innerHTML =\n '<div class=\"item-remove-box remove-text-box\"><p class=\"remove-text\">Remove</p><img class=\"item-remove-image\" src=\"img/icons-2x.png\" /></div>';\n }", "function rerender_branch_table(tree, test_results, annotations, element) {\n $(element).empty();\n render_branch_table(tree, test_results, annotations, element);\n}", "function drawTable() {\n let dow_chart_data = new google.visualization.DataTable();\n dow_chart_data.addColumn('string', 'Δραστηριότητα');\n dow_chart_data.addColumn('string', 'Ημέρα Περισσότερων Εγγραφών');\n dow_chart_data.addRow(['IN_VEHICLE', dow_data['IN_VEHICLE']]);\n dow_chart_data.addRow(['ON_BICYCLE', dow_data['ON_BICYCLE']]);\n dow_chart_data.addRow(['ON_FOOT', dow_data['ON_FOOT']]);\n dow_chart_data.addRow(['RUNNING', dow_data['RUNNING']]);\n dow_chart_data.addRow(['STILL', dow_data['STILL']]);\n dow_chart_data.addRow(['TILTING', dow_data['TILTING']]);\n dow_chart_data.addRow(['UNKNOWN', dow_data['UNKNOWN']]);\n\n var dow_table = new google.visualization.Table(document.getElementById('dow-table-div'));\n dow_table.draw(dow_chart_data, {showRowNumber: false, width: '100%', height: '100%'});\n }", "function resetTable() {\n\n // clear the current data\n clearTable();\n \n // use forEach and Object.values to populate the initial table\n tableData.forEach((ufoSighting) => {\n var row = tbody.append(\"tr\");\n Object.values(ufoSighting).forEach(value => {\n var cell = row.append(\"td\");\n cell.text(value);\n cell.attr(\"class\", \"table-style\");\n }); // close second forEach\n }); // close first forEach\n}", "function renderTableData(code, changeCurrent) {\r\n const pre = select(`.table-data[data-table-code=\"${code}\"]`)\r\n const tableArray = JSON.parse(pre.textContent)\r\n\r\n if(!changeCurrent) {\r\n currentTable = code\r\n }\r\n\r\n // remove old table content\r\n tableBody.textContent = ''\r\n\r\n tableArray.forEach(obj => {\r\n const specieRow = document.createElement('tr')\r\n // specie link column\r\n const specieLinkCol = document.createElement('td')\r\n const specieLink = document.createElement('a')\r\n specieLink.setAttribute('href', obj.link)\r\n specieLink.textContent = obj.specie\r\n\r\n specieLinkCol.appendChild(specieLink)\r\n\r\n // specie color box\r\n const colorCol = document.createElement('td')\r\n const colorBox = document.createElement('span')\r\n colorBox.classList.add('specie_color-box')\r\n colorBox.style = `background-color: ${obj.color}`\r\n\r\n colorCol.appendChild(colorBox)\r\n\r\n // species months\r\n const monthsCol = document.createElement('td')\r\n const monthsDiv = document.createElement('div')\r\n monthsDiv.classList.add('months')\r\n months.forEach(month => {\r\n const monthBox = document.createElement('span')\r\n monthBox.classList.add('month-box')\r\n\r\n monthsDiv.appendChild(monthBox)\r\n })\r\n\r\n const monthBoxes = selectAll('span.month-box', monthsDiv)\r\n\r\n obj.months.forEach(month => {\r\n monthBoxes[month - 1].classList.add('filled')\r\n })\r\n\r\n monthsCol.appendChild(monthsDiv)\r\n\r\n\r\n // append children to specie\r\n specieRow.appendChild(specieLinkCol)\r\n specieRow.appendChild(colorCol)\r\n specieRow.appendChild(monthsCol)\r\n\r\n tableBody.appendChild(specieRow)\r\n })\r\n }", "refreshPage() {\n $(\"#tableMasterHeader tr\").last().remove();\n this.drawFilterForTable(\"#tableMasterHeader\");\n $(\".ASC\").removeClass(\"ASC\");\n $(\".DESC\").removeClass(\"DESC\");\n $(\"#PageSize\").val(50);\n $(\"#offsetRow\").val(1);\n $('#tableMasterHeader th[property=\"RefDate\"]').addClass(\"DESC\");\n var data = this.getValueToLoadData();\n data[\"OrderQuery\"] = resource.OrderBy.RefDateDesc;\n this.order = resource.OrderBy.RefDateDesc;\n this.loadDataMaster(data);\n }", "function renderTable() { \r\n $tbody.innerHTML = \"\";\r\n var length = filteredData.length;\r\n for (var i = 0; i < length; i++) {\r\n // Get get the current address object and its fields\r\n var data = filteredData[i]; \r\n var fields = Object.keys(data); \r\n // Create a new row in the tbody, set the index to be i + startingIndex\r\n var $row = $tbody.insertRow(i);\r\n for (var j = 0; j < fields.length; j++) {\r\n // For every field in the address object, create a new cell at set its inner text to be the current value at the current address's field\r\n var field = fields[j];\r\n var $cell = $row.insertCell(j);\r\n $cell.innerText = data[field];\r\n }\r\n }\r\n}", "function table_reset() {\n $('.crash-table tbody').html(\"\");\n}", "function reset() {\n d3.selectAll(\"#tableVis table tr\").style(\"font-weight\", \"normal\");\n destroyVis();\n colleges = Object.keys(current_json);\n autocomp();\n createVis(current_json, current_csv);\n}", "function render_table_chunk() {\n\n $tablehead.text('');\n $tablebody.text('');\n \n chunkdata = alien_data.slice((currentPage-1) * perPage, currentPage * perPage);\n\n try {\n \n //setting up a header\n var $headrow = $tablehead.append(\"tr\");\n Object.keys(alien_data[0]).forEach(item => $headrow.append('td').text(item));\n\n // setting up a table\n chunkdata.forEach(function(item) {\n var $bodyrow = $tablebody.append('tr');\n Object.values(item).forEach(value => $bodyrow.append('td').text(value));\n });\n }\n\n catch (error) {\n console.log('NO data in the dataset');\n $tablehead.append('tr')\n .append('td')\n .text('Sorry we do not have the data you have requested. Please refresh the page and do another search.');\n \n d3.selectAll('.pagination')\n .style('display', 'none'); \n }\n\n $currentpage.text(currentPage);\n window.name = JSON.stringify(alien_data);\n numberOfPages = Math.ceil(alien_data.length / perPage);\n \n}", "function refreshTable() {\n\t\tvar partners = [\"piston\", \"plumgrid\"];\n\t\tfor (var i = 0; i < partners.length; i++) {\n\t\t\tdoAjaxSelects(partners[i])\n\t\t}\n\t\tsetTimeout(refreshTable, 1000);\n\t}", "function drawAppTable() {\n var idTable = new Array('first_app', 'second_app', 'third_app');\n var inc = 0, i = 1;\n var tdEl;\n // add appointments\n for (var field in jsonAppsPerHour) {\n document.getElementById(idTable[inc]).style.display = \"\";\n console.log(\"in first loop idTable[\" + inc + \"] = \" + idTable[inc]);\n document.getElementById(idTable[inc]).childNodes[i].innerHTML = \n jsonAppsPerHour[field].PatientID;\n i += 2;\n document.getElementById(idTable[inc]).childNodes[i].innerHTML = \n jsonAppsPerHour[field].Fname;\n i += 2;\n document.getElementById(idTable[inc]).childNodes[i].innerHTML = \n jsonAppsPerHour[field].Lname;\n i += 2;\n document.getElementById(idTable[inc]).childNodes[i].innerHTML = \n jsonAppsPerHour[field].DocFullName;\n i += 2;\n document.getElementById(idTable[inc]).childNodes[i].innerHTML = \n jsonAppsPerHour[field].EmployeeID;\n i += 2;\n document.getElementById(idTable[inc]).childNodes[i].innerHTML = \n jsonAppsPerHour[field].AppointmentID;\n \n inc += 1;\n i = 1;\n }\n if (inc < 3) { // have all table rows been filled?\n for (var i = 2;i >= inc; i--) {\n document.getElementById(idTable[i]).style.display = \"none\";\n }\n }\n}", "function buildTable(){\n\n}", "function renderTable() {\n $tbody.innerHTML = \"\";\n for (var i = 0; i < filteredUFOData.length; i++) {\n\n // Get UFO Data object and its fields\n var UFOdata = filteredUFOData[i];\n var fields = Object.keys(UFOdata);\n\n // Create new row in tbody\n var $row = $tbody.insertRow(i);\n for (var j = 0; j < fields.length; j++) {\n\n // For every field in the UFOData object create a new cell at set its inner text to be the current value at the current address's field\n var field = fields[j];\n var $cell = $row.insertCell(j);\n $cell.innerText = UFOdata[field];\n }\n\n }\n\n}", "function init() {\n theTable.innerHTML = '';\n makeHeader();\n for(var i = 0; i < Shop.all.length; i++){\n Shop.all[i].render();\n }\n makeFooter();\n}", "function remplirTableau() {\r\n tabIsEmpty = false;\r\n tbody.empty();\r\n var html = \"\";\r\n data.forEach(function (element) {\r\n html = '<tr>' +\r\n '<th>' + element.order + '</th>' +\r\n '<td>' + element.activity + '</td>' +\r\n '<td>' + element.manager + '</td>' +\r\n '<td>' + element.numofsub + '</td>' +\r\n '</tr>';\r\n tbody.append(html);\r\n });\r\n }", "function clearContent(){\n\t$('#output').html('<table class=\"table table-bordered table-hover\" id=\"stats\"><thead></thead><tbody></tbody></table>');\n}", "function effacerTableau() {\r\n tabIsEmpty = true;\r\n tbody.empty();\r\n }", "function reload(){\n\tvar body = document.getElementById(\"body\");\n\twhile(body.firstChild){\n\t\tbody.removeChild(body.firstChild);\n\t}\n\tvar table = document.createElement(\"table\");\n\ttable.id = \"firstTable\";\n\ttable.classList = \"table table-hover\";\n\tvar thead = document.createElement(\"thead\");\n\tthead.id = \"thead\";\n\tthead.classList = \"thead-dark\";\n\tvar tbody = document.createElement(\"tbody\");\n\ttbody.id = \"tbody\";\n\ttable.appendChild(thead);\n\ttable.appendChild(tbody);\n\tbody.appendChild(table);\n}", "function drawTable() {\n var id = 1;\n var productData = '';\n\n $(\"#product-table > tbody\").empty();\n\n $.getJSON(\"/Products\", function (data) {\n if (data != 0) {\n $.each(data, function (key, value) {\n productData += '<tr>';\n productData += '<td>' + id++ + '</td>';\n productData += '<td> <a href=\"#\" class=\"item-name\" data-id=\"' + value.id_product + '\">' + value.name + '</a></td>';\n productData += '<td>' + value.code + '</td>';\n productData += '<td>' + value.group_name + '</td>';\n productData += '<td>' + unitArray[value.unit] + '</td>';\n productData += '<td class=\"item-description\">' + value.description + '</td>';\n productData += '<td><button class=\"btn-modal\" id=\"button-table-edit\" data-type=\"edit\" data-id=\"' + value.id_product + '\">Edycja</button> <button class=\"button-table-delete\"data-id=\"' + value.id_product + '\">Usuń</button></td>';\n productData += '</tr>';\n codeOfLastProduct = value.code;\n });\n $(\"#product-table\").append(productData);\n displayTable();\n }\n else {\n removeTable();\n }\n });\n }", "renderTable() {\n if (!this.hasSetupRender()) {\n return;\n }\n\n // Iterate through each found schema\n // Each of them will be a table\n this.parsedData.forEach((schemaData, i) => {\n const tbl = document.createElement('table');\n tbl.className = `${this.classNamespace}__table`;\n\n // Caption\n const tblCaption = document.createElement('caption');\n const tblCaptionText = document.createTextNode(`Generated ${this.schemaName} Schema Table #${i + 1}`);\n tblCaption.appendChild(tblCaptionText);\n\n // Table Head\n const tblHead = document.createElement('thead');\n const tblHeadRow = document.createElement('tr');\n const tblHeadTh1 = document.createElement('th');\n const tblHeadTh2 = document.createElement('th');\n const tblHeadTh1Text = document.createTextNode('itemprop');\n const tblHeadTh2Text = document.createTextNode('value');\n tblHeadTh1.appendChild(tblHeadTh1Text);\n tblHeadTh2.appendChild(tblHeadTh2Text);\n tblHeadRow.appendChild(tblHeadTh1);\n tblHeadRow.appendChild(tblHeadTh2);\n tblHead.appendChild(tblHeadRow);\n\n const tblBody = document.createElement('tbody');\n\n generateTableBody(tblBody, schemaData);\n\n // put the <caption> <thead> <tbody> in the <table>\n tbl.appendChild(tblCaption);\n tbl.appendChild(tblHead);\n tbl.appendChild(tblBody);\n // appends <table> into container\n this.containerEl.appendChild(tbl);\n // sets the border attribute of tbl to 0;\n tbl.setAttribute('border', '0');\n });\n\n // Close table btn\n const closeBtn = document.createElement('button');\n closeBtn.setAttribute('aria-label', 'Close');\n closeBtn.setAttribute('type', 'button');\n closeBtn.className = 'schema-parser__close';\n this.containerEl.appendChild(closeBtn);\n // Add close handler\n closeBtn.addEventListener('click', this.handleClose.bind(this));\n }" ]
[ "0.7407916", "0.73421526", "0.731697", "0.7130859", "0.70566887", "0.68977284", "0.6853059", "0.67965204", "0.6790126", "0.67550945", "0.67364925", "0.66919464", "0.6648768", "0.6648", "0.66468537", "0.6614461", "0.6550473", "0.65374005", "0.6521049", "0.6520708", "0.6518475", "0.6507798", "0.6489031", "0.6475376", "0.6457053", "0.6447409", "0.6446392", "0.63909656", "0.6389993", "0.63896865", "0.63894475", "0.63862705", "0.63778657", "0.63638604", "0.63584983", "0.63336426", "0.6329898", "0.6325228", "0.6315492", "0.63098437", "0.6308456", "0.63011056", "0.6291633", "0.62906194", "0.6286708", "0.62790257", "0.6278808", "0.6275707", "0.6270439", "0.62698215", "0.6269473", "0.6266523", "0.62581134", "0.6257615", "0.62393355", "0.62353265", "0.62348413", "0.6213935", "0.6213625", "0.6212537", "0.6212475", "0.62110966", "0.62084347", "0.62067896", "0.61994284", "0.6198757", "0.6195235", "0.61923605", "0.61901754", "0.61899155", "0.61749935", "0.6173306", "0.616825", "0.6165843", "0.61592937", "0.61421597", "0.6140533", "0.6137206", "0.61332047", "0.61331904", "0.61318433", "0.61221015", "0.6120195", "0.61198705", "0.61152565", "0.611268", "0.6109116", "0.61077565", "0.6105203", "0.60969776", "0.6093599", "0.60924274", "0.6089217", "0.60847336", "0.6071179", "0.60691625", "0.6067262", "0.60660106", "0.606497", "0.60611016", "0.6044294" ]
0.0
-1
Draw a grid (html table) according to the input values for height and width of user
function drawHTMLGrid(height, width, gridID) { var gridHTML = document.getElementById(gridID); // Clear previous table and stop game of life algorithm gridHTML.innerHTML = ""; clearInterval(globalInterval); // Create html table for (var i = 0; i < height; i++) { var row = gridHTML.insertRow(0); for (var j = 0; j < width; j++) { var cell = row.insertCell(0); cell.innerHTML = ""; } } // Onclick a table element, change its class $(".grid td").click(function () { if (this.className == "") this.className = "selected"; else this.className = ""; }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 (){\nvar in1= $('#input_height').val();\nvar in2= $('#input_width').val();\n$(\"#pixel_canvas\").html(table(in1,in2)); }", "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}", "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(){\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 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(){\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(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(inputWidth, inputHeight) {\n\tlet table = \"\";\n\n\tfor (let row = 0; row < inputHeight; row++) {\n\t\t$('.row').remove();\n\t\ttable += \"<tr class='row'>\";\n\t\tfor (let column = 0; column < inputWidth; column++) {\n\t\t\tif (column % 2 === 0 && row % 2 === 1) {\n\t\t\t\ttable += \"<td class='grey'></td>\";\n\t\t\t} else if (column % 2 === 1 && row % 2 === 0) {\n\t\t\t\ttable += \"<td class='grey'></td>\";\n\t\t\t} else {\n\t\t\t\ttable += \"<td class='white'></td>\";\n\t\t\t}\n\t\t}\n\t\ttable += \"</tr>\";\n\t}\n\tpixelCanvas.append(table);\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 createGrid(width, height) {\n\n}", "function makeGrid() {\n\t// hide the Grid by defult to show it in an animation style\n\ttable.hide();\n\ttable.empty();\n\n\tconst width = $('#input_width').val() ;\n\tconst height = $('#input_height').val() ;\n\n\t// no create the Grid !!\n\t// create the rows first (height).\n\tfor(var i = 0; i < height; i++) {\n\t\ttable.append('<tr class=\"rows\"></tr>') ;\n\t}\n\t// then we create the columns(width).\n\tfor(var i = 0; i < width; i++) {\n\t\t$('.rows').append('<td class=\"col\"></td>') ;\n\t}\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(evt) {\n\t//access current height and width\n\txCell = $(\"#inputWidth\").val();\n\tyCell = $(\"#inputHeight\").val(); \n\t//access table element\n\ttable = $(\"#pixelCanvas\");\n\trows =\"\";//rows\n\tcols =\"\";//cols\n\t//create xCell no of row.\n\tfor(var r=1; r<=yCell; r++){\n\t\trows = rows + \"<tr></tr>\";\n\t}\n\t//create ycell no of column in each row.\n\tfor(var c=1; c<=xCell; c++){\n\t\tcols = cols + \"<td></td>\";\n\t}\n\t//create table with above rows and cols.\n\ttable.html(rows);\n\t$(\"tr\").html(cols);\n\t//do not submit.\n\tevt.preventDefault();\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(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\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 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() {\n // Avoid the creation of repeating elements (h3, h4 tags)\n setInitialStates();\n\n const tableHeight = $('#input_height').val();\n const tableWidth = $('#input_width').val();\n\n // clear the old canvas\n myTable.children().remove();\n\n //Set maximum limit for number inputs\n if(tableHeight>50||tableWidth>50){\n alert(\"Please Insert a Number Between 1 and 50 for GRID Height & Width\");\n // Function the removes the unnecessary info tags (at this point)\n setInitialStates();\n // Reset the input values\n $(\"form input[type=number]\").val(\"1\");\n return true;\n }else {\n // Create the table\n for (let n = 1; n<=tableHeight; n++){\n // Create rows\n myTable.append('<tr></tr>');\n for(let m = 1; m<=tableWidth; m++){\n $('tr').last().append('<td></td>');\n }\n }\n // Add the extra info\n addInfo();\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 }", "function makeGrid(height, width) {\n\n for (let i = 0; i < height; i++){\n const rows = document.createElement(\"tr\");\n for (let j = 0; j < width; j++){\n const cells = document.createElement(\"td\");\n rows.appendChild(cells);\n cells.setAttribute(\"id\", \"cell\" + [i]+[j]);\n cells.setAttribute(\"onclick\", \"drawPixels(this.id)\");\n }\n table.appendChild(rows);\n }\n}", "function makeGrid(height, width) {\n table;\n var grid = '';\n\n for (var i = 0; i < height; i++){\n grid += '<tr class=\"row-' + i + '\">';\n for (var j = 0; j < width; j++){\n grid += '<td class=\"cell\" id=\"row-' + i + '_cell-' + j + '\"></td>';\n }\n grid += '</tr>';\n }\n table.innerHTML = grid;\n addClickEventToCells();\n}", "function makeGrid(height, width) {\n // create rows\n for (let i = 0; i < height; i++) {\n let row = document.createElement('tr');\n table_element.appendChild(row);\n // create columns\n for (let j = 0; j < width; j++) {\n let column = document.createElement('td');\n row.appendChild(column);\n // add event to cell\n column.addEventListener('mousedown', function () {\n let color = color_value.value;\n this.style.backgroundColor = color;\n });\n }\n }\n}", "function makeGrid() {\n\n// Your code goes here!\n var height, width, grid, gridrow;\n height = $('#inputHeight').val();\n width = $('#inputWeight').val();\n grid = $('#pixelCanvas');\n gridrow = $('#pixelCanvas tr');\n\n for (var x = 0; x < width; x++) {\n for (var y = 0; y < height; y++)\n grid.append('tr');\n }\n gridrow.append('td');\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(height,width,table){\n for(var r=0;r<height;r++){\n var newRow = table.insertRow(r);\n for(var c =0;c<width;c++){\n newRow.insertCell(c);\n }\n }\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 // Removing previous grid if it exists\n $('tr').remove();\n // Setting variables for width and height\n const canvasWidth = $('#input_width').val();\n const canvasHeight = $('#input_height').val();\n // Conditional for checking correct input\n // NOT NEEDED ANYMORE\n\n // if (((canvasWidth < 1) || (canvasWidth > 50) || (canvasHeight < 1) || (canvasHeight > 50))) {\n // $('.warning p').css('visibility', 'visible');\n // $('.warning p').fadeOut(7000, function() {\n // $(this).css('display', 'block');\n // $(this).css('visibility', 'hidden');\n // });\n // } else {\n\n // Actual function making all hard work :)\n for (let i = 0; i < canvasHeight; i++) {\n $('#pixel_canvas').append('<tr></tr>');\n for (let i = 0; i < canvasWidth; i++) {\n $('tr:last-of-type').append('<td></td>');\n };\n };\n}", "function makeGrid() {\n // Removing previous grid if it exists\n $('tr').remove();\n // Setting variables for width and height\n const canvasWidth = $('#input_width').val();\n const canvasHeight = $('#input_height').val();\n // Conditional for checking correct input\n // NOT NEEDED ANYMORE\n\n // if (((canvasWidth < 1) || (canvasWidth > 50) || (canvasHeight < 1) || (canvasHeight > 50))) {\n // $('.warning p').css('visibility', 'visible');\n // $('.warning p').fadeOut(7000, function() {\n // $(this).css('display', 'block');\n // $(this).css('visibility', 'hidden');\n // });\n // } else {\n\n // Actual function making all hard work :)\n for (let i = 0; i < canvasHeight; i++) {\n $('#pixel_canvas').append('<tr></tr>');\n for (let i = 0; i < canvasWidth; i++) {\n $('tr:last-of-type').append('<td></td>');\n };\n };\n}", "function makeGrid(height,width) {\n\n// Your code goes here!\n event.preventDefault();\n var stgTable = \"\"\n for(var intCountHeight = 0; intCountHeight < height; intCountHeight++) {\n stgTable = stgTable + \"<tr>\";\n for(var intCountWidth = 0; intCountWidth < width; intCountWidth++) {\n stgTable = stgTable + \"<td></td>\"\n };\n stgTable = stgTable + \"</tr>\";\n };\n\n tblElement.innerHTML = stgTable;\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 makeGrid() {\n\n let height = document.getElementById('inputHeight').value;\n let width = document.getElementById('inputWidth').value;\n let table = document.getElementById('pixelCanvas');\n\n console.log(height, width)\n// clear table\ntable.innerHTML = '';\ncolor.value = '#000000'\n for (var i=0; i<height; i++)\n {\n var tr=document.createElement('tr');\n for (var j=0; j<width; j++)\n {\n // create column; table data\n var td = document.createElement('td');\n\n // td.onclick = function() {\n // this.style.backgroundColor = color.value;\n // }\n td.addEventListener('click', function() {\n this.style.backgroundColor = color.value;\n }, false);\n\n tr.appendChild(td);\n }\n table.appendChild(tr);\n }\n\n\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 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}", "function makeGrid(height, width) {\n\tfor(i = 0; i < height; i++){\n\t\t$(\"#pixelCanvas\").append($(\"<tr></tr>\"));\n\t\tfor(j = 0; j < width; j++){\n\t\t\t$(\"tr\").last().append($(\"<td></td>\"));\n\t\t}\t\n\t}\n\n\t$(\"td\").on('click', function(event){\n\t\tconst painting = $('#colorPicker').val(); // Select color input\n\t\t$(event.target).css('background-color', painting); //painting the background of td with color picked by user\n\t});\n\n}", "function makeGrid() {\r\n // Your code goes here!\r\n var height,width,table;\r\n\r\n //the value of height and width\r\n var height=$(\"#input_height\").val();\r\n var width=$(\"#input_width\").val();\r\n\r\n var table=$(\"#pixel_canvas\");\r\n\r\n\r\n //to create new table, we must delete the prev\r\n table.children().remove();\r\n\r\n //to create rows and columns\r\n for (var i=0; i<height ;++i) \r\n {\r\n table.append(\"<tr></tr>\");\r\n for (var j=0; j<width ;++j) \r\n {\r\n table.children().last().append(\"<td></td>\");\r\n }\r\n }\r\n\r\n //make event listener when we click on any cell, color it\r\n table.on(\"click\",\"td\",function() {\r\n var color=$(\"input[type='color']\").val();\r\n $(this).attr(\"bgcolor\",color);\r\n });\r\n}", "function makeGrid() {\n\tlet\trowNUM = $('#inputHeight').val();\n\tlet\tcolumnNUM = $('#inputWeight').val();\n\t$('table').children().remove();\n\t\n\tfor(let i = 0;i < rowNUM; i++) {\n\t\t$('table').append('<tr></tr>');\n\t\t}\n\tfor (let j = 0; j < columnNUM; j++) {\n\t\t$('tr').append('<td></td>');\n\t\t}\n\t\n\t//上色\n\t$('td').on('click',function() {\n\tvar color = $('#colorPicker').val();\n\t$(this).attr('bgcolor', color);\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 makeGrid(height, width) {\n for (let row = 0; row < height; row++) {\n $(\"#pixelCanvas\").append($(\"<tr></tr>\"));\n for (let col = 0; col < width; col++) {\n $(\"tr\")\n .last()\n .append($(\"<td></td>\"));\n\n $(\"td\").attr(\"class\", \"pixel\");\n }\n }\n}", "function createDivs(gridDimension, canvasSize) {\n $(\".container\").children().remove();\n $(\".container\").append(\"<table>\");\n for(i=0; i< gridDimension; i++) {\n $(\".container\").append(\"<tr>\");\n for(j=0; j < gridDimension; j++) {\n $(\".container\").append(\"<td></td>\")\n $(\"td\").css(\"height\", canvasSize/gridDimension);\n $(\"td\").css(\"width\", canvasSize/gridDimension);\n }\n $(\".container\").append(\"</tr>\");\n }\n $(\".container\").append(\"</table>\");\n drawOnCanvas(getColor());\n}", "function makeGrid() {\n removeGrid();\n let rows = gridHeight.val();\n let columns = gridWidth.val();\n //Add Row to the Table\n for (let addRow = 0; addRow < rows; addRow++) {\n grid.append('<tr class=\"tableRow\">');\n };\n //Add column to the table\n for (let addColumn = 0; addColumn < columns; addColumn++) {\n $(\"tr\").each(function() {\n $(this).append('<td class=\"tableCell\">');\n });\n }\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 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 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(gridHeight, gridWidth) {\n gridCanvas.innerHTML = \"\"; //clear previous table\n //Table creation code from:\n //https://stackoverflow.com/questions/14643617/create-table-using-javascript\n for (var h = 1; h <= gridHeight; h++) {\n var row = document.createElement('tr');\n for (var w = 1; w <= gridWidth; w++) {\n var column = document.createElement('td');\n row.appendChild(column);\n column.addEventListener('click', function(event) {\n event.target.style.backgroundColor = cellColor;\n })\n }\n gridCanvas.appendChild(row);\n }\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(event1) {\n// 1. We get the reference where we should place the table\nvar tableplace = document.getElementById(\"pixelCanvas\")\n//1.1 We take the table place reference and clear the old grid\ntableplace.innerHTML = \" \";\n// 2. We get the sizes of our inputs\nvar Height = document.getElementById(\"inputHeight\").value;\nvar Widht = document.getElementById(\"inputWidth\").value;\n// 3. We do a loop to create a new <tr> (row) for each number on our height input\n for (var row = 0; row < Height; row++) {\n let newrow = tableplace.insertRow(row);\n// 4. We do a loop, inside the loop of step 4, to create a new column <td> for each number on the input width\n for (var columns = 0; columns < Widht; columns++) {\n let newcell = newrow.insertCell(columns);\n //With this function Im going to let the user colored and specific square\n newcell.addEventListener(\"click\", function () {\n newcell.style.backgroundColor = color.value\n })\n }\n }\nevent1.preventDefault();\n}", "function makeGrid() {\n\n// Your code goes here!\n\n const height = $(\"#input_height\").val();\n const width = $(\"#input_width\").val();\n const table = $(\"#pixel_canvas\");\n\n // Remove previous table\n table.children().remove();\n\n // Set the table\n for(let r = 0; r < height; r++ ){\n let tr = document.createElement(\"tr\");\n table.append(tr);\n\n for(let w = 0; w < width; w++){\n let td = document.createElement(\"td\");\n tr.append(td);\n }\n\n }\n\n // Submit the form and call function to set the grid\n $(\"#sizePicker\").submit(function(event){\n event.preventDefault();\n makeGrid();\n });\n\n // Declare clickable mouse event\n let mouseDown = false;\n\n $(\"td\").mousedown(function(event){\n mouseDown = true;\n const color = $(\"#colorPicker\").val();\n $(this).css(\"background\", color);\n // Mouse drag for drawing\n $(\"td\").mousemove(function(event){\n event.preventDefault();\n // Check if mouse is clicked and being held\n if(mouseDown === true){\n $(this).css(\"background\",color);\n }else{\n mouseDown = false;\n } \n });\n });\n\n // Mouse click release\n $(\"td\").mouseup(function(){\n mouseDown = false;\n });\n\n // Disable dragging when the pointer is outside the table\n $(\"#pixel_canvas\").mouseleave(\"td\",function(){\n mouseDown = false;\n });\n}", "function insertTableCells(){\n const pixelCanvas = document.getElementById('pixelCanvas');\n const heightInput = document.getElementById('inputHeight');\n const widthInput = document.getElementById('inputWidth');\n\n for (let row = 0; row < heightInput.value; row++){\n tr = document.createElement('tr');\n trList.push(tr); // will add rows to trList to use them in cleanGrid\n pixelCanvas.appendChild(tr);\n for (let column = 0; column < widthInput.value; column++) {\n td = document.createElement('td');\n tr.appendChild(td);\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\tconst inputHeight = document.getElementById('inputHeight').value;//get the height value given by the user\n\tconst inputWidth = document.getElementById('inputWidth').value;//get the width value given by the user\n\tconst pixelCanvas = document.getElementById('pixelCanvas');// create a variable for the table\n pixelCanvas.innerHTML = \"\";//create a table. also reset the table after a new submit\n for (let x = 0; x < inputHeight; x++) {\n var row = document.createElement('tr');\n pixelCanvas.appendChild(row);//insert new element row in the table \n for (let y = 0; y < inputWidth; y++) {\n var column = document.createElement('td');\n row.appendChild(column); // insert new element column in the table\n\t\t\tcolumn.addEventListener('mousedown', function(e) { //implement clickListener on the td element\n \t\t\tlet color = document.getElementById('colorPicker').value;// get the color that the user has selected. i use let so that the color changes everytime the user choose a new one.\n \t\te.target.style.backgroundColor = color; // paint the td with the color\n\t\t\t})\n }\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 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 makeGrid() {\n // prevent submit button from reloading page\n event.preventDefault();\n const grid = document.querySelector(\"table\");\n // clear any previously created table\n grid.innerHTML = \"\";\n // get the users size input\n const size = getSize();\n const width = size[0];\n const height = size[1];\n for (let y = 0; y < height; y++) {\n // table row is intitialized inside the for loop so as to create a different <tr> in each loop\n const tableRow = document.createElement(\"tr\");\n grid.appendChild(tableRow);\n for (let x = 0; x < width; x++) {\n const tableColumn = document.createElement(\"td\");\n tableRow.appendChild(tableColumn);\n }\n }\n grid.addEventListener(\"click\", setCellColor);\n}", "function makeGrid(height, width) {//takes the width and height input from the user\r\n $('tr').remove(); //remove previous table if any\r\n for(var i =1; i<=width;i++){\r\n $('#pixelCanvas').append('<tr id = table' + i + '></tr>');//the tableid plus table data\r\n for (var j =1; j <=height; j++){\r\n $('#table' + i).append('<td></td');\r\n }\r\n\r\n }\r\n\r\n //getting more interesting with adding color\r\n $('td').click(function addColor(){\r\n color = $('#colorPicker').val();\r\n\r\n if ($(this).attr('style')){\r\n $(this).removeAttr('style')\r\n } else {\r\n $(this).attr('style', 'background-color:' + color);\r\n }\r\n })\r\n\r\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 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 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 makeGrid(HEIGHT,WIDTH) {\n\n// Your code goes here!\nfor (let i = 0; i < HEIGHT; i++) {\n $PCANVA.append('<tr></td>');\n };\n\n for (let i = 0; i < WIDTH; i++) {\n $('tr').append('<td></td>');\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 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(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 makeGrid(height,width) {\n //let row = table.insertRow(0);\n //let cell = row.insertCell(0);\n\n for (let i = 0; i <= height; i++){\n let row = table.insertRow(i); // for the rows\n for (let k = 0; k <= width; k++){\n let cell = row.insertCell(k); // for the columns\n // added eventListeners to each cell\n cell.addEventListener('click', (e) => {\n // to change the color of each cell clicked\n cell.style.backgroundColor = color.value;\n console.log(e);\n });\n \n }\n }\n\n // console.log(height,width);\n // Your code goes here!\n}", "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 table(size){\r\n\tvar div=document.getElementById(\"div\"); //select the div to draw grid on it\r\n\tvar createTable=document.createElement(\"table\"); \r\n\tdiv.appendChild(createTable); \r\n\tvar rows=[];\r\n\tvar rowsData=[];\r\n\tfor(var i=0;i<size;i++)\r\n\t{\r\n\t\t rows[i]=$(\"<tr></tr>\");\r\n\t\t createTable.appendChild(rows[i][0]);\r\n\t\t for(var j=0;j<size;j++)\r\n\t\t {\r\n var tdEle=$(\"<td></td>\");\r\n tdEle.css(\"width\",\"35px\");\r\n tdEle.css(\"height\",\"15px\");\r\n rowsData.push(tdEle);\r\n\t\t\t rows[i].append(tdEle); \r\n\t\t } \r\n\t}\r\n createTable.setAttribute(\"border\",\"1\");\r\n\tcreateTable.style.width=\"80%\";\r\n\t$(\"td\").on(\"click\",triggerTile); //set click event on the cells of the grid\r\n\treturn rowsData; //return array of cells\r\n}", "function drawHlGrid(){\n\tvar obj = gridSize();\n\tvar canvas = document.getElementById('hl_grid');\n\t\n\tvar context = canvas.getContext('2d');\n\tcontext.scale(dpr,dpr);\n\t\n\t//Set the canvas size\n\tcanvas.width = (obj.colWidth * obj.cols+0.5)*dpr;\n\tcanvas.height = (obj.rowHeight*obj.rows+0.5)*dpr;\n\t\n\tcanvas.style.width = `${obj.colWidth * obj.cols+0.5}px`;\n\tcanvas.style.height = `${obj.rowHeight*obj.rows+0.5}px`;\n\tcontext.scale(dpr,dpr);\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(tabinput, xbeg, y, plotwidth, plotheight, xaxistics, majorint) {\n\n var colwidth = plotwidth / tabinput.getRowCount();\n\n stroke(gridstroke);\n strokeWeight(gridweight);\n let x = xbeg;\n // columns\n for (let i = 0; i < xaxistics; i++) {\n if (!(i % majorint)) { strokeWeight(gridweight * 2) };\n line(x, y, x, y - plotheight);\n x += plotwidth / tabinput.getRowCount();\n strokeWeight(gridweight);\n };\n\n strokeWeight(gridweight * 2);\n line(x, y, x, y - plotheight);\n strokeWeight(gridweight);\n x += plotwidth / table.getRowCount();\n\n\n\n // rows\n\n}", "function makeGrid() {\n\n// defining variables\n\nvar rowNumber = $('#input_height').val();\nvar colNumber = $('#input_width').val();\nvar table = $('#pixel_canvas');\n\ntable.children().remove();\n\n// adding rows\n\tfor(var i = 0; i < rowNumber; i++) {\n\t\ttable.append(\"<tr></tr>\");\n\n\t\t//adding columns\n\t\tfor (var j = 0; j < colNumber; j++) {\n\t\t\ttable.children().last().append(\"<td></td>\");\n\t\t}\n\t}\n\n// Event Listener table cell click\n\ttable.children().on('click', 'td', function() {\n\t\tvar color = $(\"input[type='color']\").val();\n\t\t$(this).attr('bgcolor', color);\n\t});\n\n// Event Listener table cell doubleclick\n\ttable.children().on('dblclick', 'td', function() {\n\t\t$(this).attr('bgcolor', 'transparent');\n\t});\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(form) {\n const height = form.input_height.value;\n const width = form.input_width.value;\n $('tr').remove();\n $('table').append(returnTable(height, width));\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 drawGrid() {\n let dotCount = Number(inputDotCount.value);\n let dotSize = Number(inputDotSize.value);\n let desiredGridWidth = Number(inputGridWidth.value);\n let columnCount = Math.floor(desiredGridWidth / dotSize);\n\n // dette er bare for å vise ønsket bredde på grid\n // (faktisk bredde styres også av prikkstørrelse)\n widthIndicator.style.width = desiredGridWidth + 'px';\n\n // sette hvor mye man skal øke/minke input-feltet for gridbredde når man bruker pil opp/ned\n inputGridWidth.step = dotSize;\n\n grid.style.gridTemplateColumns = `repeat(${columnCount}, ${dotSize}px)`;\n grid.style.gridAutoRows = dotSize + 'px';\n\n let html = '';\n for (let i = 0; i < dotCount; i++) {\n html += '<div class=\"dot\"><div></div></div>';\n }\n\n grid.innerHTML = html;\n}", "function agpMakeGrid(evt) {\n // turn off the default event processing for the submit event\n evt.preventDefault();\n // reset the default canvas color to white as the default\n document.getElementById(\"colorPicker\").value = \"#ffffff\";\n\n // remove any existing art work\n let agpPixelCanvas=document.getElementById('pixelCanvas');\n while (agpPixelCanvas.hasChildNodes()) {\n agpPixelCanvas.removeChild(agpPixelCanvas.firstChild);\n }\n\n // retrieve the grid heoght and width\n let agpGridHeight=document.getElementById('inputHeight').value;\n let agpGridWidth=document.getElementById('inputWidth').value;\n\n // create the row elements and within those, the individual table cells\n for (var j=0;j<agpGridHeight;j++){\n let tr=document.createElement('tr');\n agpPixelCanvas.appendChild(tr);\n for (var i=0;i<agpGridWidth;i++){\n // append a table cell to the row in question\n let td=document.createElement('td');\n tr.appendChild(td);\n }\n }\n}", "function draw_grid(grid_size, cell_size) {\r\n\t//instantiate variables\r\n\tvar i;\r\n\tvar j;\r\n\r\n\t$(\"#grid\").empty();\r\n\r\n\t//iterate to create rows\r\n\tfor (i = 0; i < grid_size; i++) {\r\n\t\tfor (j = 0; j < grid_size; j++) {\r\n\t\t\t//draw row of divs, assinging them a class of \"cell\" and a css width and height\r\n\t\t\t$(\"#grid\").append(\"<div class='cell'></div>\").find(\"div:last\").css({\r\n\t\t\t\t\"width\": cell_size,\r\n\t\t\t\t\"height\": cell_size\r\n\t\t\t});\r\n\t\t}\r\n\t\t//end the line\r\n\t\t$(\"#grid\").append(\"<br>\");\r\n\t}\r\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 generateGrid(x = 4, y= 4){\n /* This function will generate a grid of x by y size */\n var html = \"\";\n\n for (let i = 0;i < y; i++) {\n for(let j = 0;j < x; j ++) {\n var content = getValue(i,j);\n if (j == 0){\n if (content == ''){\n html += \"<tr><td class =\\\"blank\\\">\" + content + \"</td>\";\n }\n else if( content == 2){\n html += \"<tr><td class =\\\"two\\\">\"+ content +\"</td>\";\n }\n else if (content == 4){\n html += \"<tr><td class =\\\"four\\\">\"+ content +\"</td>\";\n }\n else if (content == 8){\n html += \"<tr><td class =\\\"eight\\\">\"+ content +\"</td>\";\n }\n else if (content == 16){\n html += \"<tr><td class =\\\"sixteen\\\">\"+ content +\"</td>\";\n }\n else if (content == 32){\n html += \"<tr><td class =\\\"thirtytwo\\\">\"+ content +\"</td>\";\n }\n else if (content == 64){\n html += \"<tr><td class =\\\"sixtyfour\\\">\"+ content +\"</td>\";\n }\n else if (content == 128){\n html += \"<tr><td class =\\\"onetwentyeight\\\">\"+ content +\"</td>\";\n }\n else if (content == 256){\n html += \"<tr><td class =\\\"twofivesix\\\">\"+ content +\"</td>\";\n }\n else if (content == 512){\n html += \"<tr><td class =\\\"fivetwelve\\\">\"+ content +\"</td>\";\n }\n else if (content == 1024){\n html += \"<tr><td class =\\\"tentwofour\\\">\"+ content +\"</td>\";\n }\n else if (content >= 2048){\n html += \"<tr><td class =\\\"twentyfoureight\\\">\"+ content +\"</td>\";\n }\n }\n else if (j < x - 1){\n if (content == ''){\n html += \"<td class =\\\"blank\\\">\" + content + \"</td>\";\n }\n else if( content == 2){\n html += \"<td class =\\\"two\\\">\"+ content +\"</td>\";\n }\n else if (content == 4){\n html += \"<td class =\\\"four\\\">\"+ content +\"</td>\";\n }\n else if (content == 8){\n html += \"<td class =\\\"eight\\\">\"+ content +\"</td>\";\n }\n else if (content == 16){\n html += \"<td class =\\\"sixteen\\\">\"+ content +\"</td>\";\n }\n else if (content == 32){\n html += \"<td class =\\\"thirtytwo\\\">\"+ content +\"</td>\";\n }\n else if (content == 64){\n html += \"<td class =\\\"sixtyfour\\\">\"+ content +\"</td>\";\n }\n else if (content == 128){\n html += \"<td class =\\\"onetwentyeight\\\">\"+ content +\"</td>\";\n }\n else if (content == 256){\n html += \"<td class =\\\"twofivesix\\\">\"+ content +\"</td>\";\n }\n else if (content == 512){\n html += \"<td class =\\\"fivetwelve\\\">\"+ content +\"</td>\";\n }\n else if (content == 1024){\n html += \"<td class =\\\"tentwofour\\\">\"+ content +\"</td>\";\n }\n else if (content >= 2048){\n html += \"<td class =\\\"twentyfoureight\\\">\"+ content +\"</td>\";\n } \n }\n else if (j == x -1){\n if (content == ''){\n html += \"<td class =\\\"blank\\\">\" + content + \"</td></tr>\";\n }\n else if( content == 2){\n html += \"<td class =\\\"two\\\">\"+ content +\"</td></tr>\";\n }\n else if (content == 4){\n html += \"<td class =\\\"four\\\">\"+ content +\"</td></tr>\";\n }\n else if (content == 8){\n html += \"<td class =\\\"eight\\\">\"+ content +\"</td></tr>\";\n }\n else if (content == 16){\n html += \"<td class =\\\"sixteen\\\">\"+ content +\"</td></tr>\";\n }\n else if (content == 32){\n html += \"<td class =\\\"thirtytwo\\\">\"+ content +\"</td></tr>\";\n }\n else if (content == 64){\n html += \"<td class =\\\"sixtyfour\\\">\"+ content +\"</td></tr>\";\n }\n else if (content == 128){\n html += \"<td class =\\\"onetwentyeight\\\">\"+ content +\"</td></tr>\";\n }\n else if (content == 256){\n html += \"<td class =\\\"twofivesix\\\">\"+ content +\"</td></tr>\";\n }\n else if (content == 512){\n html += \"<td class =\\\"fivetwelve\\\">\"+ content +\"</td></tr>\";\n }\n else if (content == 1024){\n html += \"<td class =\\\"tentwofour\\\">\"+ content +\"</td></tr>\";\n }\n else if (content >= 2048){\n html += \"<td class =\\\"twentyfoureight\\\">\"+ content +\"</td></tr>\";\n }\n } \n }\n }\n return html;\n}", "function makeGrid() {\n\tevent.preventDefault();\n\tconst height = document.getElementById(\"input_height\").value;\n\tconst width = document.getElementById(\"input_width\").value;\n\tlet table = document.getElementById(\"pixel_canvas\");\n\tconst delELeCell = document.getElementsByClassName(\"cell\");\n\t//console.log(delELeCell.length);\n\tlet k = delELeCell.length - 1;\n\twhile(k >= 0){\n\t\tconst parent = delELeCell[k].parentNode;\n\t\tparent.removeChild(delELeCell[k]);\n\t\tk--;\n\t}\n\n\tconst delRow = document.getElementsByClassName(\"row\");\n\tk = delRow.length - 1;\n\twhile(k >= 0){\n\t\tconst parent = delRow[k].parentNode;\n\t\tparent.removeChild(delRow[k]);\n\t\tk--;\n\t}\n\n\tfor(let i = 0; i < height; i++){\n\t\tconst row = document.createElement(\"tr\");\n\t\trow.setAttribute(\"id\", `row_${i}`);\n\t\trow.setAttribute(\"class\", \"row\");\n\t\ttable.appendChild(row);\n\t\t//const findRow = document.getElementById(`row_${}`)\n\t\tfor(let j = 0; j < width; j++){\n\t\t\tconst column = document.createElement(`td`);\n\t\t\tcolumn.setAttribute(\"id\", `cell_${i}_${j}`);\n\t\t\tcolumn.setAttribute(\"class\", \"cell\");\n\t\t\trow.appendChild(column);\n\t\t}\n\t}\n\tconst buttonLen = document.getElementsByTagName(\"button\");\n\tif(buttonLen.length === 0){\n\t\tconst button = document.createElement(\"button\");\n\t\tconst text = document.createTextNode(\"Reset\");\n\t\tbutton.appendChild(text);\n\t\tdocument.getElementsByTagName(\"body\")[0].appendChild(button);\n\t}\n}", "function createGrid(h, v){\n let width = 960 / h;\n for (var i = 1; i <= v * h; i++) {\n var div = document.createElement('div');\n div.className = 'cell';\n div.style.border = 'solid 1px black';\n container.appendChild(div);\n container.appendChild(br);\n }\n cellsEvent();\n container.style.display = 'grid';\n container.style.gridTemplateRows = 'repeat(' + v + ', ' + width + 'px)';\n container.style.gridTemplateColumns = 'repeat(' + h + ', ' + width + 'px)';\n container.style.justifyContent = 'center';\n}", "function makeGrid(gridHeight, gridWidth) {\n while (PIXEL_CANVAS.firstChild){\n \tPIXEL_CANVAS.removeChild(PIXEL_CANVAS.firstChild);\n }\n\n //Create the grid rows\n for (let gridRow = 0; gridRow < gridHeight; gridRow++) {\n const newRow = document.createElement('tr');\n PIXEL_CANVAS.appendChild(newRow);\n // insertAdjacentHTML('beforeend', '<tr class=\"grid-row\"></tr>');\n for (let i = 0; i < gridWidth; i++) {\n const newCell = document.createElement('td');\n newRow.appendChild(newCell);\n }\n }\n}", "function makeGrid(height, width) {\n \n// Your code goes here!\n// Create rows and columns\n \n for (let rows = 0; rows < height; rows++) {\n let row = table.insertRow(rows);\n for (var columns = 0; columns < width; columns++) {\n let cell = row.insertCell(columns);\n \n// Allow user to color each, individual cell\n \n cell.addEventListener('click', (e) => { \n let color = document.getElementById('colorPicker');\n cell.style.backgroundColor = color.value;\n });\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}", "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(){\n\n table.innerHTML =''; //czyszczenie tabeli\n\n const fragment = document.createDocumentFragment(); // DocumentFragment wrapper\n\n for(let h = 0; h < gridHeight.value; h++){\n let tr = document.createElement('tr');\n fragment.appendChild(tr);\n for(let w = 0; w < gridWitdh.value; w++){\n let td = document.createElement('td');\n tr.appendChild(td);\n }\n }\n table.appendChild(fragment);\n colorSet();\n colorClick();\n colorRemove();\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(height, width) {\n\n//console.log(height.value, width.value);\n \n//const row = table.insertRow(0);\n//const cell = row.insertCell(0);\n\n// Your code goes here!\nfor(let i = 0; i <= height; i++){\n let row = table.insertRow(i);\n for(let j = 0; j <= width; j++){\n let cell = row.insertCell(j);\n cell.addEventListener('click',(e) => {\n console.log(e);\n cell.style.background = color.value;\n });\n }\n}\n\n}", "function makeGrid(h,w) {\n for(let i = 1; i <= h; i++) {\n grid.append(\"<tr></tr>\");\n let j = 1;\n while (j <= w){\n $(\"tr\")\n .last()\n .append(\"<td></td>\");\n j++;\n }\n } \n}", "function makeGrid(h,l) {\n // Remove previous grid if any\n $(grid).children().remove();\n // Loops to draw new Grid\n for (i=0 ; i<h ; i++){ // Loop on each row\n grid.append('<tr></tr'); //Add the row\n for (j=0 ; j<l ; j++){ //Loop on each column\n let currentRow =grid.find('tr').last();\n currentRow.append(\"<td></td>\"); // Add a cell at the end of the current row\n }\n }\n}", "function createGrid(width, height) {\n for (let i = 0; i < height; i++) {\n let row = document.createElement('div');\n row.classList.add('row');\n\n for (let x = 0; x < width; x++) {\n let pixel = document.createElement('div');\n pixel.classList.add('pixel');\n row.appendChild(pixel);\n }\n grid.appendChild(row);\n }\n}", "function plot(rows = 36, cols = 64) {\n\n /* 'c' will contain the whole generated html rect tags string to change innerhtml of enclosing div */\n /* 'y' will denote the 'y' coordinate where the next grid must be placed */\n let c = \"\", y = 0;\n\n /* Looping for each row */\n for (let i = 0; i < rows; i++) {\n\n /* 'x' is a coordinate denoting where the next grid must be placed */\n var x = 0;\n\n /* For each row we will loop for each column present in the Grid */\n for (let j = 0; j < cols; j++) {\n\n /* 'colr' will store the rest grid color which is dark gray currently */\n let colr = grid_color;\n\n /* If the Rectange present in the grid is on the border side then change the color in order to highlight borders */\n if(i === 0 || j === 0 || i === rows - 1 || j === cols - 1){\n colr = border_color;\n }\n\n /* Creating a rect tag that is appending in 'c' for now and will be updated to innerhtml of enclosing div */\n /* I know you will be wondering about the id given to each rect :-\n * Each rect must be provided with id in order to do anything with the corresponding rect.\n * Operations like coloring the grid as well saving saving any number in corresponding matrix needs an id of the rect.\n * Hence id is important to allot to each rect to make further changes in matrix on which whole algo is based.\n * In order to assing every rect id i decided to allot their corresponding row_number + : + col_number to be as id\n * As with this scenario it is easy to remember and will be unique for every rect tag. \n */\n c += `<rect id=${i + \":\" + j} x=\"${x}\" y=\"${y}\" width=\"30\" height=\"30\" fill=\"${colr}\" r=\"0\" rx=\"0\" ry=\"0\" stroke=\"#000\" style=\"-webkit-tap-highlight-color: rgba(0, 0, 0, 0); stroke-opacity: 0.2;\" stroke-opacity=\"0.2\"></rect>`;\n\n /* Incrementing the 'x' coordinate as we have width of 30px and hence 'x' coordinate for next rect will be +30 from current pos. */\n x += 30;\n }\n\n /* Incrementing the 'y' coordinate as we have placed sufficient rect in 1 row now need to advance 'y' as height of each rect \n is 30px hence for every rect in next column the y coordinate will be +30*/\n y += 30;\n }\n\n /* At last after creating rect tags using loops, now update innerHtml of enclosing div with id='container'[grid.html] */\n document.getElementById(\"container\").innerHTML = c;\n\n /* I wanted to preplace the Source - coordinate so at rect with id='src_crd' will be coloured green */\n document.getElementById(src_crd).style.fill = \"rgb(0, 255, 0)\";\n matrix[split(src_crd, 0)][split(src_crd, 1)] = 1; /* Update the pos as '1' to denote source location */\n\n /* I wanted to preplace the Destination - coordinate so at rect with id='dst_crd' will be coloured Red */\n document.getElementById(dst_crd).style.fill = \"rgb(255, 0, 0)\";\n matrix[split(dst_crd, 0)][split(dst_crd, 1)] = 2; /* Update the pos as '2' to denote Destination location */\n\n }", "function makeGrid() {\n const GRID = $(\"#pixel_canvas\");\n\n // Select size input\n const COLUMNS = $(\"#input_width\").val();\n const ROWS = $(\"#input_height\").val();\n\n // Clears the table\n GRID.children().remove();\n\n // Limit the grid size to avoid browser crash\n if (COLUMNS <= 50 && ROWS <= 50) {\n // Adds new rows\n for (let i = 0; i < ROWS; i++) {\n GRID.append(\"<tr></tr>\");\n\n // Adds new columns\n for (let j = 0; j < COLUMNS; j++)\n GRID.children()\n .last()\n .append(\"<td></td>\");\n }\n }\n\n // Selects the grid tile\n tile = GRID.find(\"td\");\n\n // Allows the interaction with the grid\n tile.click(function() {\n // Selects color input\n let colorPicker;\n color = $(\"#colorPicker\").val();\n $(this).attr(\"bgcolor\", color);\n });\n // Erases single cell color\n tile.on(\"dblclick\", function() {\n let colorPicker;\n color = $(\"#colorPicker\").val();\n $(this).removeAttr(\"bgcolor\");\n });\n\n // Executes the action on the table and allows the color selection\n GRID.on(\"click\", \"td\", function() {\n const COLOR = $(\"input[type = 'color']#colorPicker\").val();\n $(this).attr(\"background-color\", COLOR);\n });\n}", "function makeGrid(squaresPerSide) {\n\n //Add div rows(basically tr), to act as rows\n for (var i = 0; i < squaresPerSide; i++) {\n $('#pad').append('<div class=\"row\"></div>');\n }\n\n //Add div squares(basically td), to ever row\n for (var i = 0; i < squaresPerSide; i++) {\n $('.row').append('<div class=\"square\"></div>');\n }\n\n //Set square size= giant grid div divided by sqperside\n var squareDimension = $('#pad').width() / squaresPerSide;\n $('.square').css({\n 'height': squareDimension,\n 'width': squareDimension\n });\n}", "drawGrid() {\n\n for (let i = 0; i <= HEIGHT; i += SQUARE_SIDE) {\n line(0, i, WIDTH, i);\n }\n for (let i = 0; i <= WIDTH; i += SQUARE_SIDE) {\n line(i, 0, i, HEIGHT);\n }\n\n }", "function grid() {\n\tvar spaceX = 64;\n\tvar spaceY = spaceX;\n\n\tstroke(200);\n\tfor (var i = 64; i < width; i += 64) {\n\t\tline(i, 0, i, height);\n\t}\n\tfor (var i = 64; i < height; i += 64) {\n\t\tline(0, i, width, i);\n\t}\n}", "function makeGrid() {\n\n const pixelGrid = document.querySelector('#pixelCanvas');\n\n pixelGrid.innerHTML = ''; //Clears previous grid\n\n inputHeight = document.querySelector('#inputHeight').value;\n inputWidth = document.querySelector('#inputWidth').value;\n\n if (inputHeight > 100) { //Limit grid height\n inputHeight = 100;\n };\n\n if (inputWidth > 100) { //Limit grid width\n inputWidth = 100;\n }\n\n //Get user selected color and set pixel color\n function colorClick() {\n color = document.querySelector('#colorPicker').value;\n event.target.style.backgroundColor = color;\n }\n\n // Build grid based on user form input\n for (var height = 0; height < inputHeight; ++height) { //Loop creates rows\n const newRow = document.createElement('tr');\n pixelGrid.appendChild(newRow);\n for (var width = 0; width < inputWidth; ++width) { //Loop create pixels\n const newPixel = document.createElement('td');\n newRow.appendChild(newPixel);\n newPixel.addEventListener('click', colorClick);//Add click event to pixels\n }\n }\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 makeGrid(x, y) {\n for (var rows = 0; rows < x; rows++) {\n for (var columns = 0; columns < y; columns++) {\n $(\"#container\").append(\"<div class='grid'></div>\");\n };\n };\n $(\".grid\").height(960/x);\n $(\".grid\").width(960/y);\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 generage_grid() {\n\n for (var i = 0; i < rows; i++) {\n $('.grid-container').append('<div class=\"grid-row\"></div>');\n }\n\n\n $('.grid-row').each(function () {\n for (i = 0; i < columns; i++) {\n $(this).append('<div class=\"grid-cell\"></div>')\n }\n });\n\n var game_container_height = (34.5 * rows)\n $('.game-container').height(game_container_height);\n var game_container_width = (34.5 * columns)\n $('.game-container').width(game_container_width);\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 makeGrid(input1, input2) {\n // make the table\n var table = document.getElementById('pixelCanvas');\n //to remove the table if the user decied to make another table\n table.innerHTML = \"\";\n // the loop here for row in table t\n for (var i = 0; i < input1; i++) {\n var row = document.createElement('tr');\n\n // the inner loopp for the cell and when user click in one of cell changed the color\n for (var j = 0; j < input2; j++) {\n var cell = document.createElement('td');\n row.appendChild(cell);\n cell.addEventListener('click', function(e) {\n var color = document.getElementById('colorPicker').value;\n e.target.style.backgroundColor = color;\n })\n }\n table.appendChild(row);\n }\n}" ]
[ "0.8265037", "0.81319696", "0.8104697", "0.802983", "0.79749984", "0.7900075", "0.78400546", "0.7790189", "0.77530295", "0.7727299", "0.7696823", "0.7652794", "0.76238596", "0.76086986", "0.760159", "0.7578795", "0.7557386", "0.75469404", "0.7451794", "0.74278045", "0.7396933", "0.7370144", "0.73356515", "0.7330653", "0.73177314", "0.7314027", "0.7300973", "0.7300615", "0.7300615", "0.7262645", "0.7256636", "0.72484237", "0.72481656", "0.7235104", "0.7232532", "0.7228658", "0.721424", "0.72039175", "0.7194214", "0.71849674", "0.71812475", "0.7158256", "0.71231467", "0.71075916", "0.71036226", "0.70987386", "0.7096474", "0.70944357", "0.70825773", "0.70807827", "0.70606804", "0.70468867", "0.70387495", "0.7026473", "0.70244515", "0.7020401", "0.7016435", "0.70103663", "0.7004835", "0.6996304", "0.6973097", "0.69321066", "0.69289035", "0.6909058", "0.69079685", "0.6906452", "0.6894914", "0.6881412", "0.68628603", "0.6858857", "0.68193513", "0.6814483", "0.6809891", "0.6808196", "0.6796759", "0.67897093", "0.6770928", "0.67627734", "0.6751094", "0.6748172", "0.673616", "0.67141503", "0.67133397", "0.6711852", "0.669505", "0.6684061", "0.6677014", "0.667345", "0.6673008", "0.6668397", "0.6653581", "0.6651125", "0.66391927", "0.66356575", "0.6624877", "0.6609144", "0.6608871", "0.6604191", "0.6601479", "0.6594729", "0.65920794" ]
0.0
-1
Get the grid state from HTML
function getHTMLGrid(gameofLife) { var gridHTML = document.getElementById("grid"); var array = []; for (var i = 0, row = void 0; row = gridHTML.rows[i]; i++) { array[row.rowIndex] = []; for (var j = 0, col = void 0; col = row.cells[j]; j++) { if (col.className == "selected") array[row.rowIndex][col.cellIndex] = 1; else array[row.rowIndex][col.cellIndex] = 0; } } return array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseGrid(grid) {\n var str = '';\n for (var row = 0; row < grid.length; row++) {\n for (var col = 0; col < grid[row].length; col++) {\n str = str + (grid[row][col].state ? grid[row][col].state.toLowerCase() : '-')\n }\n }\n return str;\n}", "getGrid(gridNr) {\n var gridVal = this.state.gridValues[gridNr];\n if (gridVal == null) {\n gridVal = '.';\n }\n return <Grid value={gridVal} onClick={() => this.gridClick(gridNr)} />\n }", "function getGrid(pos) {\n\tlet childs = c.childNodes;\n\treturn childs[pos];\n}", "getGridHtml(editor) {\n const curPos = editor.getCursor();\n\n if (this.isInGridBlock(editor)) {\n const bog = this.getBog(editor);\n const eog = this.getEog(editor);\n // skip block begin sesion(\"::: editable-row\")\n bog.line++;\n // skip block end sesion(\":::\")\n eog.line--;\n eog.ch = editor.getDoc().getLine(eog.line).length;\n return editor.getDoc().getRange(bog, eog);\n }\n return editor.getDoc().getLine(curPos.line);\n }", "function getGridPosition() {\n\tvar selectedUnit = document.getElementsByClassName(\"selected\");\n\tif (angular.isDefined(selectedUnit[0])) {\n\t\tvar rowIndex = selectedUnit[0]['className'].split(\" \")[2].substring(8);\n\t\tvar gridPos = rowIndex.split('-');\n\t\treturn gridPos;\n\t} else {\n\t\treturn false;\n\t}\n}", "function state_to_dom(s) {\n try {\n let html=\"\";\n for(let j=0;j<3;++j) {\n for(let i=0;i<3;++i) {\n html+=\" \";\n if(s.grid[j][i]==0) html+=\" \";\n else html+=s.grid[j][i];\n }\n html+=\"\\n\";\n }\n let obj=document.createElement(\"pre\");\n obj.innerHTML=html;\n return obj;\n } catch(e) {\n helper_log_exception(e);\n throw e;\n return null;\n }\n}", "function getBoardState() {\n\t\tfor (var i = 0; i < 3; i++) {\n\t\t\tfor (var j = 0; j < 3; j++) {\n\t\t\t\tboard[i][j] = $('[data-loc=\"{i : ' + i + ', j : ' + j + '}\"]').text();\n\t\t\t}\n\t\t}\n\t}", "function gridState(){\n var grid = {};\n $theInputs = $('.game-cell-input');\n $theInputs.each(function(){ // iterate over each input\n if($(this).val()){\n var num = $(this).data('num');\n var special = $(this).data('special');\n if(typeof special == \"undefined\" || special > 5 || special == 0){\n special = 0;\n }\n grid[num] = {val: $(this).val(), special: special};\n }\n });\n return grid;\n }", "function TreeGrid_GetHTMLTarget(eEvent, aData)\n{\n\t//default result: null\n\tvar result = null;\n\t//get the position\n\tvar position = TreeGrid_GetTargetItemPosition(this, aData, __DESIGNER_CONTROLLER || __SCREENSHOTS_ON || eEvent != __NEMESIS_EVENT_CLICK && eEvent != __NEMESIS_EVENT_SELECT && eEvent != __NEMESIS_EVENT_NOTHANDLED);\n\t//header?\n\tif (position.Row == -1 && position.Column != null)\n\t{\n\t\t//get the headers\n\t\tvar headers = this.InterpreterObject.Content ? this.InterpreterObject.Content.Headers.Ordered : null;\n\t\t//get the header\n\t\tresult = headers && position.Column >= 0 && position.Column < headers.length ? headers[position.Column].HTML : null;\n\t}\n\t//is the row visible?\n\telse if (position.Row != null && position.Row >= 0 && (this.InterpreterObject.Content.TreeData == null || this.InterpreterObject.Content.TreeData.VisibleMap[position.Row]))\n\t{\n\t\t//get the tree data\n\t\tvar treeData = this.InterpreterObject.Content.TreeData;\n\t\t//get the row\n\t\tvar row = this.InterpreterObject.Content.Cells.Rows[position.Row];\n\t\t//assume we will be clicking on the scrollable part of the grid\n\t\tresult = row.HTML ? row.HTML.Fixed.firstChild ? row.HTML.Fixed : row.HTML.Scrollable : null;\n\t\t//also has a column? ie: want a cell?\n\t\tif (position.Column != null)\n\t\t{\n\t\t\t//get the row cell\n\t\t\tresult = row.Objects[position.Column].HTML;\n\t\t}\n\t\t//check the event\n\t\telse switch (eEvent)\n\t\t{\n\t\t\tcase __NEMESIS_EVENT_OPENBRANCH:\n\t\t\tcase __NEMESIS_EVENT_CLOSEBRANCH:\n\t\t\t\t//this row is a treegrid line?\n\t\t\t\tif (treeData && row)\n\t\t\t\t{\n\t\t\t\t\t//set the target\n\t\t\t\t\tresult = row.Objects[treeData.Column].HTML.BranchButton;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t//cell selection only (but of course requesting a row selection, of course)\n\t\t\t\tif (Get_String(this.InterpreterObject.Properties[__NEMESIS_PROPERTY_SELECTION_TYPE], \"\") == \"CellOnly\")\n\t\t\t\t{\n\t\t\t\t\t//loop through the cells\n\t\t\t\t\tfor (var i = 0, c = row.Objects.length; i < c; i++)\n\t\t\t\t\t{\n\t\t\t\t\t\t//this one has cell selects row?\n\t\t\t\t\t\tif (row.Objects[i].SelectionActionsOnly)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t//use this one isntead\n\t\t\t\t\t\t\tresult = row.Objects[i].HTML;\n\t\t\t\t\t\t\t//end loop\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\tbreak;\n\t\t}\n\t}\n\telse\n\t{\n\t\t//use the entire treegrid\n\t\tresult = this;\n\t}\n\t//return the result\n\treturn result;\n}", "function getGrid() {\n\tconsole.log(\"Current rows are: \" + GRID.rows + \"\\nCurrent columns are: \" + GRID.columns);\n}", "function setState() {\n var tags = document.getElementsByTagName(\"td\")\n let state = [];\n for (var i = 0; i < tags.length; i++) {\n state.push(tags[i].innerHTML)\n };\n return state;\n}", "function getGridClass(pos) {\n\tlet childs = c.childNodes;\n\tlet classes = childs[pos].className.split(' ');\n\treturn classes;\n}", "function TreeGrid_GetData()\n{\n\t//create an array for the result\n\tvar result = [];\n\t//have we got content? with cells?\n\tif (this.InterpreterObject.Content && this.InterpreterObject.Content.Cells)\n\t{\n\t\t//loop through the html\n\t\tfor (var rows = this.InterpreterObject.Content.Cells.Rows, i = 0, c = rows.length; i < c; i++)\n\t\t{\n\t\t\t//selected?\n\t\t\tif (rows[i].Selected)\n\t\t\t{\n\t\t\t\t//add this to the result\n\t\t\t\tresult.push(\"\" + (i + 1));\n\t\t\t}\n\t\t}\n\t}\n\t//return it\n\treturn result;\n}", "function UltraGrid_GetHTMLTarget(eEvent, aData)\n{\n\t//default result: null\n\tvar result = null;\n\n\t//get the target\n\tvar target = UltraGrid_GetTarget(this.InterpreterObject, aData[0]);\n\t//valid target?\n\tif (target)\n\t{\n\t\t//this a cell?\n\t\tif (target.UltraGridCell || target.UltraGridHeader)\n\t\t{\n\t\t\t//use the html\n\t\t\tresult = target.HTML;\n\t\t}\n\t\t//must be a row\n\t\telse if (target.Panels)\n\t\t{\n\t\t\t//get its first panel row\n\t\t\tresult = target.PanelRows[target.PanelIds[0]];\n\t\t}\n\t}\n\t//return the result\n\treturn result;\n}", "function read_state() {\n let grid=Array(3).fill(0).map(x => Array(3));\n for(let k=0;k<9;++k) {\n let input=document.getElementById(\"input_pos\"+k);\n let j=Math.floor(k/3);\n let i=k%3;\n if(input.value==\"\") grid[j][i]=0;\n else grid[j][i]=parseInt(input.value,10);\n }\n return {\n grid : grid\n };\n}", "function getSpanGrid() {\n\tvar grid = new Array(4);\n\tgrid[0] = new Array(4);\n\tgrid[1] = new Array(4);\n\tgrid[2] = new Array(4);\n\tgrid[3] = new Array(4);\n\tvar n = 0;\n\tfor (var r = 0; r < 4 ; r++ ) {\n\t\tfor (var c = 0; c < 4 ; c++ ) {\n\t\t\tgrid[r][c] = $(\"#grid .cell\").eq(n).find(\"span\");\n\t\t\tn++;\n\t\t}\n\t}\n\treturn grid;\n}", "function getViewState(formElement) {\n return AjaxImpl_1.Implementation.getViewState(formElement);\n }", "function handleDemoGrid() {\r\n\tswitch(demoGridState) {\r\n\t\tcase 0: //\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\tbreak;\r\n\t}\r\n}", "get gridMode() {\n return this.i.ni;\n }", "getGrid() {\n return this.gridCells;\n }", "getHTML() {\n return getHTMLFromFragment(this.state.doc.content, this.schema);\n }", "function getElementBasedFormatState(editor, event) {\n var listTag = roosterjs_editor_dom_1.getTagOfNode(roosterjs_editor_core_1.cacheGetElementAtCursor(editor, event, 'OL,UL'));\n var headerTag = roosterjs_editor_dom_1.getTagOfNode(roosterjs_editor_core_1.cacheGetElementAtCursor(editor, event, 'H1,H2,H3,H4,H5,H6'));\n return {\n isBullet: listTag == 'UL',\n isNumbering: listTag == 'OL',\n headerLevel: (headerTag && parseInt(headerTag[1])) || 0,\n canUnlink: !!editor.queryElements('a[href]', 1 /* OnSelection */)[0],\n canAddImageAltText: !!editor.queryElements('img', 1 /* OnSelection */)[0],\n isBlockQuote: !!editor.queryElements('blockquote', 1 /* OnSelection */)[0],\n };\n}", "function getGridElementsPosition(index) {\n const gridEl = document.getElementById(\"grid\");\n let offset = Number(window.getComputedStyle(gridEl.children[0]).gridColumnStart) - 1;\n if (isNaN(offset)) {\n offset = 0;\n }\n const colCount = window.getComputedStyle(gridEl).gridTemplateColumns.split(\" \").length;\n const rowPosition = Math.floor((index + offset) / colCount);\n const colPosition = (index + offset) % colCount;\n return {\n row: rowPosition,\n column: colPosition\n };\n}", "getCurrentGridState(args) {\n const gridState = {\n columns: this.getCurrentColumns(),\n filters: this.getCurrentFilters(),\n sorters: this.getCurrentSorters(),\n };\n const currentPagination = this.getCurrentPagination();\n if (currentPagination) {\n gridState.pagination = currentPagination;\n }\n if (this.hasRowSelectionEnabled()) {\n const currentRowSelection = this.getCurrentRowSelections(args && args.requestRefreshRowFilteredRow);\n if (currentRowSelection) {\n gridState.rowSelection = currentRowSelection;\n }\n }\n return gridState;\n }", "function getState(el) {\n // insert your own code here to extract a relevant state object from an <a> or <form> tag\n // for example, if you rely on any other custom \"data-\" attributes to determine the link behaviour\n return {};\n }", "function TreeGrid_GetInterpreterTarget(theHTML, aData)\n{\n\t//default result: null\n\tvar result = null;\n\t//get the position\n\tvar position = TreeGrid_GetTargetItemPosition(theHTML, aData);\n\t//header?\n\tif (position.Row == -1 && position.Column != null)\n\t{\n\t\t//get headers\n\t\tvar headers = theHTML.InterpreterObject.Content ? theHTML.InterpreterObject.Content.Header.Cells : null;\n\t\t//get the header\n\t\tresult = headers && position.Column >= 0 && position.Column < headers.length ? headers[position.Column] : null;\n\t}\n\t//we have this row?\n\telse if (position.Row != null && position.Row >= 0 && theHTML.InterpreterObject.Content && position.Row < theHTML.InterpreterObject.Content.Cells.Rows.length)\n\t{\n\t\t//get the row\n\t\tvar row = theHTML.InterpreterObject.Content.Cells.Rows[position.Row];\n\t\t//have we got a cell?\n\t\tif (row != null && position.Column >= 0 && row.Objects && position.Column < row.Objects.length)\n\t\t{\n\t\t\t//get the cell\n\t\t\tresult = row.Objects[position.Column];\n\t\t}\n\t}\n\t//return the result\n\treturn result;\n}", "function loadBoardState(thisState){\n document.querySelectorAll(\".dim\").forEach(function(item){\n if(getLitStateBit(thisState, parseInt(item.getAttribute(\"data-index\")))){\n item.classList.add(\"lit\");\n }else{\n item.classList.remove(\"lit\");\n }\n });\n }", "function readState () {\n cache()\n var str = location.pathname.substr(1)\n var result = getRouteNode(str)\n\n if (!result) {\n const ev = new CustomEvent(\"routenotfound\", {\n detail: {\n path: str\n }\n })\n\n window.dispatchEvent(ev)\n return\n }\n var node = cloneNodeAsElement(result.node, 'div')\n\n node.innerHTML = result.node.textContent\n loadNodeSource(node, result.matches)\n return node\n}", "function loadState(){\n var state = $.deparam.fragment();\n grid = state.grid;\n \n if(typeof state.variant !== \"undefined\"){\n options.variant = state.variant;\n }\n \n if(typeof state.level !== \"undefined\"){\n options.level = state.level;\n } else {\n options.level = 1;\n }\n \n $theInputs = $('.game-cell-input');\n $theInputs.each(function(){ // iterate over each input, putting saved value in.\n var num = $(this).data('num');\n if(typeof grid !== \"undefined\" && typeof grid[num] !== \"undefined\" && grid[num] !== \"\"){\n $(this).val( grid[num].val );\n $(this).data('special', grid[num].special );\n } else {\n $(this).val('');\n $(this).data('special', 0 );\n }\n decorateInput($(this));\n });\n \n $('#level').val(options.level);\n }", "function getGridStateAndNumFilled() {\n let state = '';\n let numFilled = 0\n for (let i = 0; i < gridHeight; i++) {\n for (let j = 0; j < gridWidth; j++) {\n if (grid[i][j].notBlocked()) {\n if (langMaxCharCodes == 1) {\n state = state + grid[i][j].currentLetter\n } else {\n state = state + grid[i][j].currentLetter + '$'\n }\n if (grid[i][j].currentLetter != '0') {\n numFilled++\n }\n } else {\n state = state + '.'\n }\n }\n }\n numCellsFilled = numFilled\n return state;\n}", "getCellState(i, j) {\n let that = this;\n return function () {\n return that.state.grid[i][j];\n }\n }", "cellState(row, col) {\n const cells = this.cells;\n return cells[ this.to_1d(row, col) * this.cellBytes ];\n }", "function getGrid () {\n\tlet grid = new Array(3);\n\tfor (var i = 0; i < 3; i++)\n\t\tgrid[i]=new Array(3);\n\n\tfor (var i = 0; i < 3; i++) {\n\t\tfor (var j = 0; j < 3; j++) {\n\t\t\tlet divSector = $(\"#grid-\" + i + j + \"-id\");\n\t\t\tgrid[i][j] = divSector.text();\n\t\t}\n\t}\n\n\treturn grid;\n}", "function redrawHTMLGrid(grid, gridID) {\n var gridHTML = document.getElementById(gridID);\n for (var i = 0; i < height; i++) {\n for (var j = 0; j < width; j++) {\n var cell = gridHTML.rows[i].cells[j];\n if (grid[i][j])\n cell.className = \"selected\";\n else\n cell.className = \"\";\n }\n }\n}", "function setHTMLCell(x, y, liveState){\n Array.from(dom.boardNode.children)[size*x + y].classList.toggle(\"live\", liveState);\n}", "function drawHTMLGrid(height, width, gridID) {\n var gridHTML = document.getElementById(gridID);\n // Clear previous table and stop game of life algorithm\n gridHTML.innerHTML = \"\";\n clearInterval(globalInterval);\n // Create html table\n for (var i = 0; i < height; i++) {\n var row = gridHTML.insertRow(0);\n for (var j = 0; j < width; j++) {\n var cell = row.insertCell(0);\n cell.innerHTML = \"\";\n }\n }\n // Onclick a table element, change its class \n $(\".grid td\").click(function () {\n if (this.className == \"\")\n this.className = \"selected\";\n else\n this.className = \"\";\n });\n}", "function getTableDataFromHtml() {\n\n }", "getHTML() {\n return this._executeAfterInitialWait(() => this.currently.getHTML());\n }", "function getElementsFromHTML() {\n toRight = document.querySelectorAll(\".to-right\");\n toLeft = document.querySelectorAll(\".to-left\");\n toTop = document.querySelectorAll(\".to-top\");\n toBottom = document.querySelectorAll(\".to-bottom\");\n }", "getState() {\n // TODO return obj with the board's properties\n }", "getState(ant) {\n const tile = this.grid[ant.getPosition().y][ant.getPosition().x];\n if (!tile) { return 0; }\n if (this.scope.config.ant_coloring == \"rgb_blend\") {\n return tile[ant.id];\n }\n return tile.state;\n }", "function getgridobj() {\n\n return gridobj;\n\n }", "function getGridElement(row, col){\n\tvar cellNum = parseInt(row-1)*size + parseInt(col);\n\tvar cell = dom.gameBoard.querySelector(\"#cell\"+cellNum);\n\treturn cell;\n}", "function identifyCell(gridPossibilities) {\n var cellReference = 0;\n return cellReference;\n}", "getGameGrid() {\n return this.buildBlockGrid();\n }", "function aanmaken_grid_layout() {\n var nummer = 0;\n var kolom__struct = '';\n var grid__struct = '';\n\n for (rij = 0; rij < grid_struct__obj.aantal_rijen; rij++) {\n kolom__struct = '';\n for (kolom = 0; kolom < grid_struct__obj.aantal_kolommen; kolom++) {\n nummer = nummer + 1\n kolom__struct += `<div class=\"grid_${nummer} grid_kolom ${ kolom ? 0 : 'grid_kolom_1' }\"></div>`;\n }\n grid__struct += `<div class=\"uk-child-width-expand@m\" style=\"margin-top:5px;\" uk-grid>${kolom__struct}</div>`;\n }\n return grid__struct; // geeft de grid structuur als resultaat terug\n }", "getGridView() {\n const { data } = this.state;\n if (data.length == 0) return null;\n\n return <GridView\n data={data}\n columns={[\n { attribute: 'descripcion', alias: 'Actiividad'},\n { attribute: 'estado', alias: 'Estado', value : data => {\n return <div className=\"switch\">\n <label>\n Off\n <input type=\"checkbox\" name=\"estado\" data-pk={data.iddef_actividad} onChange={this.getUpdateStatus} defaultChecked={data.estado == 1}/>\n <span className=\"lever\"></span>\n On\n </label>\n </div>\n }},\n { alias: 'Detalles', value : data => {\n return <Link to={'/activityDetail/' + data.iddef_actividad}><i className=\"material-icons left\">visibility</i></Link>;\n }},\n ]}\n />;\n }", "async readOverviewTiles() {\n const tiles = await this.page.evaluate(() =>\n Array.from(document.querySelectorAll('div[id$=ITtile]')).map(t => {\n const [title, badge] = t.querySelectorAll('span');\n return {\n isSelected: t.classList.contains('p_AFSelected'),\n title: title.textContent,\n badge: badge.textContent,\n selectId: t.querySelector('a[title^=\"Select:\"]').id,\n };\n }));\n\n tiles.forEach(t => t.click =\n this.page.click.bind(this.page, '#'+t.selectId.replace(/:/g,'\\\\:')));\n return tiles;\n }", "function getElementByString(html) {\n let element = document.createElement('div')\n element.classList = 'col form-group row';\n element.innerHTML = html;\n return element.firstElementChild\n\n}", "getGridRowIndex(){return this.__gridRowIndex}", "function gridButton() {\n let elem = document.querySelectorAll(\".square\");\n elem.forEach(toggleGrid);\n if (grid == false) {\n let gridBtn =\n document.getElementById(\"grid-button\");\n gridBtn.innerText = \"Grid On\";\n }\n else if (grid == true) {\n let gridBtn =\n document.getElementById(\"grid-button\");\n gridBtn.innerText = \"Grid Off\";\n }\n}", "function getTreeState() {\n var tree = viewTree.getData().getAllNodes();\n //isc.JSON.encode(\n return { width: viewTree.getWidth(),\n time: isc.timeStamp(),\n pathOfLeafShowing: viewInstanceShowing ? viewInstanceShowing.path : null,\n // selectedPaths: pathShowing, //viewTree.getSelectedPaths(),\n //only store data needed to rebuild the tree \n state: tree.map(function(n) {\n return {\n\t type: n.type,\n\t id: n.id,\n\t parentId: n.parentId,\n\t isFolder: n.isFolder,\n\t name: n.name,\n\t isOpen: n.isOpen,\t\n\t state: n.state,\n icon: n.icon\n };\n\t\t })\n };\n }", "function evaluateLightDOM() {\n \n // Light DOM is given as HTML string? => use fragment with HTML string as innerHTML\n if ( typeof self.inner === 'string' ){\n self.inner = document.createRange().createContextualFragment( self.inner );\n }\n \n var children = ( self.inner || self.root ).children;\n self.questions = [];\n self.question_ids = [];\n var count = 0;\n \n // iterate over all children of the Light DOM to search for config parameters\n self.ccm.helper.makeIterable( children ).map( function ( elem ) {\n count += 1;\n\n // self.ccm.helper.generateConfig( elem ); // ToDo\n \n if ( elem.tagName.startsWith('CCM-EXERCISE-') ){\n var param_name = elem.tagName.split('-')[2].toLowerCase();\n switch ( param_name ){\n case 'question':\n self.questions.push( elem.innerHTML );\n self.question_ids.push( self.fkey + '_' + count );\n self.html.main.inner.push( { tag: 'label', for: self.fkey + '_' + count, inner: elem.innerHTML } );\n self.html.main.inner.push( { tag: 'textarea', id: self.fkey + '_' + count } );\n break;\n default: self[ param_name ] = elem.innerHTML;\n }\n }\n } );\n \n if ( self.questions.length === 0 ){\n self.html.main.inner.push( { tag: 'label', for: self.fkey } );\n self.html.main.inner.push( { tag: 'textarea', id: self.fkey, placeholder: self.placeholder || '' } );\n }\n \n self.html.main.inner.push( { tag: 'ccm-show_solutions', for: self.fkey } );\n \n }", "function Edit_GetHTMLTarget(eEvent, aData)\n{\n\t//by default use ourselves\n\tvar result = this;\n\t//switch on event\n\tswitch (eEvent)\n\t{\n\t\tcase __NEMESIS_EVENT_MATCHCODE:\n\t\t\t//our matchcode exist? and is visible? use it\n\t\t\tresult = this.STATES_MATCHCODE ? this.MATCHCODE : null;\n\t\t\tbreak;\n\t}\n\t//return it\n\treturn result;\n}", "function getGridGetAction() {\n var keys = $(\"div.grid-view\").find(\"div.keys\");\n var getAction = '';\n switch (keys.length) {\n case 0:\n alert('No gridview keys found');\n getAction = '';\n break;\n case 1:\n getAction = keys.attr('title');\n break;\n default:\n alert('Mutiple gridview keys found');\n getAction = '';\n break;\n }\n \n return getAction;\n}", "function getHeaderGrid(dp,cellIndex){\n\treturn dp.obj.hdrLabels[cellIndex];\n}", "get grid() {\n return this._grid;\n }", "function setGridState(visible, enabled) {\n var gridContents = document.getElementsByClassName('grid-content');\n var grid = document.getElementById('grid');\n\n if (enabled) {\n grid.setAttribute('enabled', '');\n } else {\n grid.removeAttribute('enabled');\n }\n\n for (var i = 0; i < gridContents.length; i++) {\n if (!visible) {\n gridContents[i].classList.add('invisible');\n } else {\n gridContents[i].classList.remove('invisible');\n }\n }\n}", "function Simulator_Position_GetDisplayRect(html)\n{\n\treturn Position_GetDisplayRect(html);\n}", "function getGridString(cols, rows)\n{\n\tvar tableMarkup = $(\"#drawing-table\").html();\n\tvar index = 0;\n\tvar result = \"\";\n\twhile(true)\n\t{\n\t\tindex = tableMarkup.indexOf(\"</td>\", index);\n\t\tif (index == -1)\n\t\t\tbreak;\n\t\tif (tableMarkup[index-1] == SYMB_AVAIL)\n\t\t\tresult += \"1\";\n\t\telse\n\t\t\tresult += \"0\";\n\t\tindex++;\n\t}\n\treturn result;\n}", "function displayState(tab) {\n $(\".grid\").empty();\n for (let i = 0; i < tab.length; i++) {\n for (let j = 0; j < tab[i].length; j++) {\n const elem = tab[i][j];\n if (elem) {\n const item = $(`<div data-i=\"${i}\" data-j=\"${j}\" class=\"item\" id=\"${elem}\">${elem}</div>`);\n $(\".grid\").append(item);\n } else {\n // if (leftMove == 1) {\n // $(\".grid\").append(`<div class=\"vide\" id = \"caseVide\"\"><img src=\"images/davidou.png\" alt=\"car\" id=\"car\"></div>`);\n // leftMove = 0\n // } else if (rightMove == 1) {\n // $(\".grid\").append(`<div class=\"vide\" id = \"caseVide\"\"><img src=\"images/davidou.png\" alt=\"car\" id=\"car\"></div>`);\n // rightMove = 0\n // } else {\n $(\".grid\").append(`<div class=\"vide\" id = \"caseVide\"\"><img src=\"images/davidou.png\" alt=\"DAVIDOU\" id=\"DAVID\"></div>`);\n\n // }\n }\n\n }\n }\n}", "validateGridView() {\n return this\n .waitForElementVisible('@gridViewContainer')\n .assert.elementPresent('@gridViewContainer', 'Grid View Displayed');\n }", "function pagehtml(){\treturn pageholder();}", "function IsDomCustomGrid(evt, element, eventOpts, objName, description, flavor, items)\r\n\t{\r\n\t\tfunction _getName(el)\r\n\t\t{\r\n\t\t\tvar name = __getAttribute(el, '<attributeName>');\r\n\t\t\tif (name)\r\n\t\t\t{\r\n\t\t\t\treturn name;\r\n\t\t\t}\r\n\t\t\treturn \"Grid\";\r\n\t\t} \r\n \r\n\t\tfunction _getCell(el)\r\n\t\t{\r\n\t\t\treturn {row: 0, col: 0};\r\n\t\t}\r\n\t\r\n\t\tvar rvalue =\r\n\t\t{\r\n\t\t\troot: null, // to define in future the most near element or smth else\r\n\t\t\tresult: null, // here will be old res placed\r\n\t\t\trcode: R_NOT_OBJECT // return code\r\n\t\t};\r\n\t \r\n\t\tvar root = false;\r\n\r\n\t\t/**\r\n\t\t * Test element or it's neighbour nodes to detect type of an object we are dealing with.\r\n\t\t * Element API is described here: https://developer.mozilla.org/en-US/docs/Web/API/Element\r\n\t\t * API to use:\r\n\t\t *\t__hasParentWithAttr(element, attributeName, regexp)\r\n\t\t * __getAttribute(element, attributeName);\r\n\t\t *\r\n\t\t */\r\n\t\tif(root=__hasParentWithAttr(element, '<attributeName>', /<attributeValue>/ig))\r\n\t\t{\r\n\t\t\t// TODO\r\n\t\r\n\t\t\tvar res = {\r\n\t\t\t\tcancel: false,\r\n\t\t\t\tobject_flavor: 'Grid',\r\n\t\t\t\tobject_name: _getName(root),\r\n\t\t\t\tobject_type: 'DomCustomGrid',\r\n\t\t\t\tdescription: 'TODO Action description',\r\n\t\t\t\tlocator_data: \r\n\t\t\t\t{\r\n\t\t\t\t\txpath: SeS_GenerateXPath(root)\r\n\t \t\t}\r\n\t\t\t};\r\n\t\r\n\t\t\t// Learn\r\n\t\t\trvalue.result = res;\r\n\t\t\trvalue.root = root;\r\n\t\t\trvalue.rcode = R_OBJECT_FOUND;\r\n\t\t\t\r\n\t\t\tif(evt == \"resolveElementDescriptor\")\r\n\t\t\t{\r\n\t\t\t\tres.rect = __getElementRect(root);\r\n\t\t\t\tres.action = undefined;\r\n\t\t\t\treturn rvalue;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (evt == \"Click\")\r\n\t\t\t{\r\n\t\t\t\tvar cell = _getCell(element);\r\n\t\t\t\tif (cell)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar actionClick = {\r\n\t\t\t\t\t\t\tname: \"ClickCell\",\r\n\t\t\t\t\t\t\tdescription: \"Click cell in a grid\",\r\n\t\t\t\t\t\t\tparams: [cell.row, cell.col]\r\n\t\t\t\t\t\t};\t\r\n\t\t\t\t\tres.action = actionClick;\r\n\t\t\t\t}\r\n\t\t\t}\t\t\t\t\r\n\t\t\r\n\t\t\t// Actions \r\n\t\t\trvalue.rcode = R_ACTION_FOUND;\r\n\t\t}\r\n\t\t\r\n\t\treturn rvalue;\r\n\t}", "GetGraphFromHTML() {\n var mydiv = document.getElementById(\"mygraphdata\");\n var graph_as_string = mydiv.innerHTML;\n let graph = eval(graph_as_string);\n return graph;\n }", "htmlForStatus() {\nvar html;\n//----------\nreturn html = `<!--========================================================-->\n<span class=\"spanInfo av${this.ix}\" >\nStatus:\n<input type=\"text\" class=\"statusExtra av${this.ix}\" />\n</span> <!--class=\"spanInfo av${this.ix}\"-->`;\n}", "function social_curator_grid_post_loaded(data, element){}", "function getGridCellDev(grid, row, col)\n{\n // IGNORE IF IT'S OUTSIDE THE GRID\n if (!isValidCellDev(row, col))\n {\n return -1;\n }\n var index = (row * gridWidthDev) + col;\n return grid[index];\n}", "generateGridRows() {\n // Object to store the tiles\n let grid_rows = []\n let grid_ind = 1\n // For each row\n for (let row = 1; row <= 4; row++) {\n let col_grids = []\n //For each column\n for (let col = 1; col <= 4; col++) {\n // Referred to reactjs documentation for handle click\n let id = grid_ind++\n // To assign class based on state\n // Useful for styling\n let classVar = this.state.tileData[id]['status'] == 'hide' ? '' : 'tile-' + this.state.tileData[id]['status']\n col_grids.push(<td key={id} id={id} className={'column column-25 tile ' + classVar}\n onClick={() => {\n this.handleClick(id)\n }}>{this.state.tileData[id]['status'] != 'hide'\n ? this.state.tileData[id]['letter'] : ''}</td>)\n }\n grid_rows.push(<tr key={row} className=\"row\">{col_grids}</tr>)\n }\n return grid_rows\n }", "function loadGrid() {\n \n }", "function getTemplate(winNo) {\n var str =\n ' <div class=\"vis-fp-bodycontent vis-formouterwrpdiv\"> ' +\n ' <div class=\"vis-fp-viwall\" > ' +\n ' <span>' + VIS.Msg.getMsg(\"ViewMore\") + '</span> ' +\n ' </div> ' +\n ' <div class=\"vis-fp-datawrap\"> ' +\n ' <div class=\"vis-fp-static-ctrlwrp\"> ' +\n ' <div class=\"vis-fp-static-ctrlinnerwrp\"></div> ' +\n ' </div> ' +\n ' <div class=\"vis-fp-custcolumns\" id=\"accordion_' + winNo + '\"\"> ' +\n ' <div class=\"card\"> ' +\n ' <div class=\"card-header\" style=\"cursor:pointer\" data-toggle=\"collapse\" href=\"#collapseOne_' + winNo + '\"> ' +\n ' <span>' + VIS.Msg.getMsg(\"CustomCondition\") + '</span> ' +\n ' <a class=\"card-link\" > ' +\n ' <i class=\"vis vis-arrow-up\"></i> ' +\n ' </a> ' +\n ' </div> ' +\n ' <div id=\"collapseOne_' + winNo + '\"\" class=\"collapse\" data-parent=\"#accordion_' + winNo + '\" >' +\n ' <div class=\"card-body\"> ' +\n ' <div class=\"input-group vis-input-wrap\"> ' +\n ' <div class=\"vis-control-wrap\"> ' +\n ' <select class=\"vis-fp-cols\"> ' +\n ' </select> ' +\n ' <label class=\"vis-fp-lblcols\">' + VIS.Msg.getMsg(\"Column\") + '</label> ' +\n ' </div> ' +\n ' </div> ' +\n ' <div class=\"input-group vis-input-wrap\"> ' +\n ' <div class=\"vis-control-wrap\"> ' +\n ' <select class=\"vis-fp-op\"> ' +\n ' </select> ' +\n ' <label class=\"vis-fp-lblop\">' + VIS.Msg.getMsg(\"Operator\") + '</label> ' +\n ' </div> ' +\n ' </div> ' +\n ' <div class=\"vis-fp-valueone\"> ' +\n ' </div> ' +\n ' <div class=\"vis-fp-valuetwo\"> ' +\n ' </div> ' +\n ' <div class=\"vis-fp-valuethree\"> ' +\n ' </div> ' +\n ' <div class=\"vis-fp-cc-addbtnwrp\"> ' +\n ' <span class=\"vis-fp-cc-addbutton\">' + VIS.Msg.getMsg(\"Add\") + '</span> ' +\n ' </div> ' +\n ' </div> ' +\n ' </div> ' +\n ' </div> ' +\n ' <div class=\"vis-fp-custcoltagswrp\"> ' +\n ' <div class=\"vis-fp-custcoltag\"> ' +\n ' </div> ' +\n ' </div><!-- vis-fp-custcoltagswrp --> ' +\n ' </div> </div> ' +\n ' </div>';\n return str;\n }", "_parseHTML(htmlString) {\n //current xpath is body.div[i].table.tbody.tr[j].td[1-5]\n let cleanedHtmlString = htmlString.replace(/(\\\\t|\\\\n|&nbsp;)/gi,'');\n let root = htmlParser.parse(htmlString);\n let divs = root.querySelectorAll('div');\n if (divs) {\n for (let div of divs) {\n let table = div.querySelector('table');\n if (!table) {\n continue;\n }\n\n let tbody = table.querySelector('tbody');\n if (!tbody) {\n continue;\n }\n\n let rows = tbody.querySelectorAll('tr');\n if (!rows) {\n continue;\n }\n for (let row of rows) {\n let cols = row.querySelectorAll('td');\n //take 5 cols from here\n this._data.add(cols[0].rawText, cols[1].rawText, cols[2].rawText, cols[4].rawText);\n }\n }\n }\n }", "getHTML() {\n const l = this.strings.length - 1;\n let html = '';\n let isTextBinding = true;\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n html += s;\n // We're in a text position if the previous string closed its tags.\n // If it doesn't have any tags, then we use the previous text position\n // state.\n const closing = findTagClose(s);\n isTextBinding = closing > -1 ? closing < s.length : isTextBinding;\n html += isTextBinding ? nodeMarker : marker;\n }\n html += this.strings[l];\n return html;\n }", "get cellTagName() {\n return 'div';\n }", "function lightCell(str){\n if ( convertRow(str) <= countRows() && convertColumn(str) <= countColumns() ) {\n return GRID[convertRow(str)][convertColumn(str)];\n } else {\n return false;\n }\n}", "function _getWebComponentsState() {\r\n //<link> is mostly valid (css)\r\n //import feature is not always enabled\r\n const _imp = 'import' in document.createElement('link');\r\n const _tmp = !(document.createElement('template')\r\n instanceof HTMLUnknownElement);\r\n return Object.freeze({\r\n import: _imp,\r\n template: _tmp,\r\n isError: (!_imp || !_tmp)\r\n });\r\n }", "function gridMap() {\n return {\n top_left: { _cx_cy_index: 4, drag_index : [ 2, 3, 4 ] },\n bottom_left: { _cx_cy_index : 3, drag_index : [ 1, 4, 3 ] },\n top_right: { _cx_cy_index : 2, drag_index : [ 4, 1, 2 ] },\n bottom_right: { _cx_cy_index : 1, drag_index : [ 3, 2, 1 ] }\n };\n }", "getGridColumnIndex(){return this.__gridColumnIndex}", "function Grid() {\n /* public properties */\n //是否能够多选行\n this.multiple = true;\n //排序列,内部用\n this.sortCol = -1;\n //降序排序\n this.sortDescending = 0;\n //错误信息\n this.error = '';\n //已选择的行数组\n this.selectedRows = [];\n //奇偶行是否用不同颜色显示,此开关打开时,添加删除行ie会自动关闭,原因目前不明\n this.colorEvenRows = true;\n //列是否允许调整宽度\n this.resizeColumns = true;\n //表体body列是否随表头head列的宽度实时调整列宽\n this.bodyColResize = true;\n //用户定义的对象变量名的字符串形式\n this.selfName = '';\n //是否排序开关\n this.sortFlag = true;\n //显示右键菜单\n this.showMenu = false;\n //是否能增减行,只控制键盘事件和右键菜单\n this.addSubRow = false;\n //序号的起始数\n this.startNum = 1\n //用户输入数据错误标志,\n this.inputError = false;\n //grid是否可编辑,该标志由程序更加html代码设置,用于对编辑快捷键的控制\n this.editFlag = false;\n //在grid最后一个编辑框失去焦点时,页面焦点聚到grid外的其他元素上\n this.nextFocus = null;\n //设置gird的高度为 maxViewRow行记录,不设置,默认高度按container高度走\n this.maxViewRow = -1\n //对gird的单元格统一加的累计宽度值\n this.widthAddValue = 20;\n //排序类型,数组,存放类型有'String','Number','None','Date','CaseInsensitiveString'\n this.sortTypes =[];\n //数据列的显示位置,页面用户将要排序的列序号(从0开始)作为数组传入,没有传入的列序号,将(通过把列宽置为0)被隐藏\n //如:o.colPos=[0,4,3,2]\n // o.colPos=[4,2,3,1]\n // 注意:1.在o.bind(...)调用之前对此赋值,不需要排序和隐藏列的功能不要赋值此属性\n // 2.列号一定要在 0 和 列数减一 之间,grid对此不校验,可能会出错。\n this.colPos = [];\n //添加行时,是否复制上一行的数据。ture-复制,false-不复制,默认false\n this.isAddRowWithData=false;\n //新增行时按照哪一行(首行或末行或选择的行的第一行)进行复制 (默认按首行复制)\n // false -首行复制 ; true - 末行复制 ;null - 按选择行复制(如果选择多行,复制选择的第一行,没选择行 则复制首行)\n //此参数在o.bind前后都可以设置。\n this.isAddRowWithLast = false;\n //在设置完只读单元格后,当前的编辑框是否下移到下一个可编辑框上,默认为移动\n this.isMoveFocusAfterSetReadOnly = true;\n //哪些列是多行select ,如:o.mutiSelectPos=[2,3]\n this.mutiSelectPos = [];\n\n /* events */\n this.onresize = null;\n this.onsort = null;\n this.onselect = null;\n this.onAddRow = null;\n this.onRemoveRow = null;\n this.onGridBlur = null; //Grid失去焦点时触发函数, Added by likey, Date: 2006-04-20\n\n\n /* private properties */\n //Container容器\n this._eCont = null;\n //Head 容器\n this._eHead = null;\n //left 容器\n this._eLeft = null;\n //body 容器\n this._eBody = null;\n //head 表格\n this._eHeadTable = null;\n //left 表格\n this._eLeftTable = null;\n //body 表格\n this._eBodyTable = null;\n //head 列集合\n this._eHeadCols = null;\n //暂时为1列\n this._eLeftCols = null;\n //body 的列集合\n this._eBodyCols = null;\n //用于调整Left行高\n this._eBodyRows = null;\n\n //当前处于编辑状态的单元格\n this._eEditTd = null;\n //第一个可编辑td\n this._eFistEditTd = null;\n //内部用的全局变量,用于左右键移动单元格的递归函数调用中\n this.__tempTd = null;\n //上次施动者td\n this._preLinkerTd = null;\n\n //右键菜单\n this._eMenu = null;\n\n this._eDataTable = null;\n //保存列的一些设置数据信息的数组\n this._eDataCols = null;\n\n this._activeHeaders = null;\n this._rows = 0;\n this._cols = 0;\n\n this._defaultLeftWidth = 40;\n\n}", "function stateCheck() {\n var stateLog = document.querySelector(\".state\");\n var state = response.regionName;\n console.log(state);\n\n stateLog.innerHTML += state;\n }", "function getPopupFormState()\n {\n var state = new Object();\n var elms;\n if(isParameterizedPopup && popupFormName!=null)\n elms = popupFormName.elements;\n else\n elms = popupDiv.getElementsByTagName(\"*\");\n var len = elms.length;\n for (var i = 0; i < len; i++)\n {\n var element = elms[i];\n //bug18449628 \n if (element && element.tagName != \"IMG\")\n {\n var name = element.name;\n if (name)\n {\n // Skip over hidden values\n var elmType = element.type;\n if (!elmType || (elmType != 'hidden'))\n state[name] = _getValue(element);\n }\n }\n }\n return state;\n }", "getState(board){\r\n return this.fenToArray(this.game.fen())\r\n }", "function saveState(){\n var grid = gridState();\n var state = {grid:grid};\n state.level = $('#level').val();\n state.variant = options.variant;\n $.bbq.pushState(state);\n }", "function _getElements() {\n\tif(_store){\n if (_isSubpageOpened()) {\n return _store.getState().secondLevelPage.elements;\n }\n return _store.getState().elements;\n\t}\n }", "function getStateFromUi() {\n \n var state = {\n tab: getSelectedTab(),\n selectedPeriodOffset: getSelectedPeriodOffset(),\n selectedGroup: getSelectedGroup(),\n selectedIndividual: getSelectedIndividual()\n };\n \n if(state.selectedIndividual !== null) {\n state.mode = MODE.INDIVIDUAL;\n } else if(state.selectedIndividual === null && state.selectedGroup !== null) {\n state.mode = MODE.GROUP;\n } else {\n state.mode = MODE.FLEET;\n }\n \n return state;\n }", "function getDeviceState() {\n var state = window.getComputedStyle(\n document.querySelector('.state-indicator'), ':before'\n ).getPropertyValue('content')\n\n state = state.replace(/\"/g, \"\");\n state = state.replace(/'/g, \"\"); //fix for update in chrome which returns ''\n\n return state; //need to replace quotes to support mozilla - which returns a string with quotes inside.\n\n}", "function generateGrid() {\n gameBoard.childNodes[1].innerText = `It's ${game.turn.token}'s turn`;\n var grid = gameBoard.childNodes[3];\n grid.innerHTML = '';\n for (var i = 0; i < 9; i++) {\n gridIndex = i;\n grid.innerHTML += `\n <article class=\"${gridIndex}\">\n </article>\n `\n }\n game.resetGame();\n persistWins();\n}", "function createGrid() {\n let board = document.getElementById(\"board\");\n let tableHTML = \"\";\n for (let r = 0; r < height; r++) {\n let currentArrayRow = [];\n let currentHTMLRow = `<tr id=\"row ${r}\">`;\n for (let c = 0; c < width; c++) {\n let newNodeId = `${r}-${c}`;\n let newNodeClass = \"unvisited\";\n currentHTMLRow += `<th id=\"${newNodeId}\" class=\"${newNodeClass}\"></th>`;\n }\n currentHTMLRow += `</tr>`;\n tableHTML += currentHTMLRow;\n }\n board.innerHTML = tableHTML;\n}", "function getStates(game) {\n\n}", "function draw_grid_html(grid,n,id){\n var html = ''\n var grid_center = grid[(grid.length-1)/2];\n html += '<div class=\"info\">Grid build of '+ n + ' blocks with center ' + grid_center + ' blocks high</div>';\n html += '<div class=\"info\">['+ grid.toString() + '] = ' + grid.reduce(function(a,b){return a+b;}) + ' blocks</div>';\n html += '<div class=\"grid\">'\n for(var x = 0; x < grid.length; x++){\n var column = '<div class=\"col\">';\n for (var b=1; b <= grid[x]; b++){\n column += '<div class=\"block\"></div>';\n }\n column +='</div>';\n html += column;\n }\n html += '</div>';\n document.getElementById(id).innerHTML = html;\n\n return html;\n}", "function renderGrid() {\n let { C, cols, rows, px, grid_color, render_border } = state\n C.gx.clearRect(\n -render_border,\n -render_border,\n C.gx.canvas.width,\n C.gx.canvas.height\n )\n C.gx.strokeStyle = grid_color\n C.gx.lineWidth = 1\n C.gx.strokeRect(0.5, 0.5, sub(mul(cols, px), 1), sub(mul(rows, px), 1))\n C.gx.lineWidth = 2\n for (let c = 1; c < state.cols; c++) {\n C.gx.beginPath()\n C.gx.moveTo(mul(c, px), 0)\n C.gx.lineTo(mul(c, px), mul(rows, px))\n C.gx.stroke()\n }\n for (let r = 1; r < state.rows; r++) {\n C.gx.beginPath()\n C.gx.moveTo(0, mul(r, px))\n C.gx.lineTo(mul(cols, px), mul(r, px))\n C.gx.stroke()\n }\n}", "getHTML() {\n const l = this.strings.length - 1;\n let html = '';\n let isTextBinding = true;\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n html += s;\n // We're in a text position if the previous string closed its tags.\n // If it doesn't have any tags, then we use the previous text position\n // state.\n const closing = findTagClose(s);\n isTextBinding = closing > -1 ? closing < s.length : isTextBinding;\n html += isTextBinding ? nodeMarker : marker;\n }\n html += this.strings[l];\n return html;\n }", "getRow(n) {\n return this.grid[n];\n }", "function renderGrid(grid) {\r\n let modules = grid.modules;\r\n let svg = document.getElementById('root');\r\n let i;\r\n\r\n for (i = 0; i < modules.length; i++) {\r\n svg.appendChild(createModule(modules[i], svg.namespaceURI));\r\n }\r\n}", "_parseContent(item) {\n const textFieldClass = this.getCSS(this._data.mode, \"textField\");\n return item.querySelector(`.${textFieldClass}`).innerHTML;\n }", "async getSingleMarkup() {\n return ` \n <div class=\"city-banner\" style=\"background-image: url('${this.image}')\" data-id=\"${this[\"_id\"]}\">\n <h1>${this.name}</h1>\n <button type=\"button\" class=\"${await this.isFavoriteCity(this[\"_id\"])}\"><i class=\"fas fa-heart\"></i></button> \n </div>\n <div class=\"city-detail\">\n <div>\n <div id=\"breadcrumbs\">\n ${window.Core.checkFirstBreadcrumb()}<span> > </span>\n <a>${this.name}</a>\n </div>\n <div class=\"city-info\">\n <p><span>${window.Core.t(\"country\")}</span>${this.country}</p>\n <p><span>${window.Core.t(\"nickname\")}</span>${this.nickname}</p> \n </div>\n </div> \n \n <div id=\"mapid\"></div> \n </div>\n <h1 class=\"headline-hotels\">${window.Core.t(\"visithotelsheader\")}</h1>\n <div id=\"city-hotels\"></div>`;\n }", "function getState() {\n return window.stokr.model.getState();\n }", "function getCurrentBoard(){\n\t\t\tvar $rows = $el.find('.panel-row');\n\t\t\tvar currentBoard = [];\n\t\t\t\n\t\t\t$.each( $rows, function(){\n\t\t\t\tvar $row = $(this);\n\t\t\t\tvar $panels = $row.find('.top .stationary-panel span');\n\t\t\t\tvar panelVals = [];\n\t\t\t\t\n\t\t\t\t$.each( $panels, function(){\n\t\t\t\t\tvar $panel = $(this);\n\t\t\t\t\t\n\t\t\t\t\tpanelVals.push( $panel.text() );\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tcurrentBoard.push( panelVals );\n\t\t\t});\n\t\t\t\n\t\t\treturn currentBoard;\n\t\t}", "function displayWinState() {\n // Set the win state styling on all of the cells\n $('.content').addClass('winstate');\n // Make the win state div visible\n $('#solved').removeClass('hidden');\n }", "function $3gv(){\n var readyStateDone$=new $3gv.$$;ReadyState(4,readyStateDone$);\n return readyStateDone$;\n}" ]
[ "0.6115273", "0.5874661", "0.5821485", "0.5768903", "0.5744697", "0.57446486", "0.5667717", "0.5627815", "0.5625856", "0.55612373", "0.5547919", "0.54730815", "0.5395059", "0.53842986", "0.5363936", "0.5337135", "0.53354484", "0.5299901", "0.52846044", "0.52349216", "0.52164143", "0.5214967", "0.5207256", "0.51944715", "0.5186086", "0.5181298", "0.5152873", "0.51385415", "0.5117867", "0.5110878", "0.50963235", "0.506584", "0.5059069", "0.5054729", "0.50518936", "0.50391144", "0.5035484", "0.50307393", "0.49407017", "0.49399582", "0.49229738", "0.49126834", "0.49084532", "0.49034274", "0.48847023", "0.4879218", "0.48758888", "0.48531014", "0.48430118", "0.483426", "0.48283967", "0.4815245", "0.48109084", "0.48071927", "0.48065916", "0.4803267", "0.48010173", "0.4800265", "0.47917172", "0.47847798", "0.4784675", "0.4776392", "0.47545776", "0.4745077", "0.47450468", "0.4740537", "0.47347835", "0.47315022", "0.47274947", "0.47188166", "0.4711711", "0.47050765", "0.47004396", "0.46976703", "0.46959013", "0.46931154", "0.46866855", "0.46856898", "0.46855694", "0.46839434", "0.4676958", "0.46725163", "0.46544728", "0.46494946", "0.46428958", "0.4638598", "0.46360683", "0.46345854", "0.46323818", "0.46310177", "0.46305767", "0.4627041", "0.46246287", "0.462108", "0.46113282", "0.4607924", "0.46050745", "0.4601773", "0.45988986", "0.45954642" ]
0.57623345
4
(only applicable to raw and normal forms)
showError(message){ this.setState({ message: message }); this.setState({ loggedIn: false }); this.setState({ messageclass: 'alert alert-danger' }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set Raw(value) {}", "get Raw() {}", "function Raw(){}", "get raw() { return this._raw; }", "get raw() { return this._raw; }", "callSite(values, raw) {\n\n values.raw = raw || values;\n return values;\n }", "protected internal function m252() {}", "get normalized() {}", "async normalize () {\n\t}", "function normal() {}", "get type() {\n return 'raw';\n }", "set normal(value) {}", "set normal(value) {}", "_encodeObject(object) {\n return object.termType === 'Literal' ? this._encodeLiteral(object) : this._encodeIriOrBlank(object);\n }", "function customHandling() { }", "set normalized(value) {}", "transient private protected internal function m182() {}", "function Surrogate(){}", "function Surrogate(){}", "function Surrogate(){}", "get Normal() {}", "transient protected internal function m189() {}", "static getRawObject(data) {\n if (data && typeof data.toObject === 'function') {\n return data.toObject();\n }\n return data;\n }", "getRawInput(start, end) {\n\t\t\treturn this.input.slice(start.valueOf(), end.valueOf());\n\t\t}", "get normal() {}", "get normal() {}", "function Bind_Oliteral() {\r\n}", "function r(e){return\"string\"==typeof e}", "function r(e){return\"string\"==typeof e}", "function set_raw(env) {\n\tenv._cmeta.raw = true;\n}", "function Surrogate() {}", "private public function m246() {}", "function notValid_anySimpleType(strObj) {\n\treturn false;\n }", "function validDataFormat(raw_data) {\n return true;\n }", "function decodeRaw(value, position) {\n return entities(value, {\n position: normalize(position),\n warning: handleWarning\n });\n }", "function decodeRaw(value, position) {\n return entities(value, {\n position: normalize(position),\n warning: handleWarning\n });\n }", "set Normal(value) {}", "transient private internal function m185() {}", "function handle_entity( raw ) {\n raw = _.isObject( raw ) ? raw : {}\n \n if( raw.entity$ ) {\n return seneca.make$( raw )\n }\n else {\n _.each( raw, function(v,k) {\n if( _.isObject(v) && v.entity$ ) {\n raw[k] = seneca.make$( v )\n }\n })\n return raw\n }\n }", "static get sanitize() {\n return {\n title: false,\n text: {\n br: true,\n a: { href: true },\n b: true,\n i: true,\n },\n action: false,\n link: false,\n }\n }", "function inflateRaw(input,options){options=options||{};options.raw=true;return inflate$1(input,options);}", "function Bind_A_Oliteral() {\r\n}", "function freezeRaw(raw) {\n if (Array.isArray(raw)) {\n return Array.prototype.slice.call(raw);\n }\n return raw;\n }", "transient final protected internal function m174() {}", "raw() {\n return this.data;\n }", "formatToPrimitive(entity, args) {\n // optimize entities which are simple strings by skipping resultion\n if (typeof entity === 'string') {\n return [entity, []];\n }\n\n // optimize entities with null values and no default traits\n if (!entity.val && entity.traits && !(entity.traits.some(t => t.def))) {\n return [null, []];\n }\n\n const result = format(this, args, entity, optsPrimitive);\n return (result[0] instanceof FTLNone) ?\n [null, result[1]] : result;\n }", "obtain(){}", "function VIEWAS_boring_default(obj) {\n //tabulator.log.debug(\"entered VIEWAS_boring_default...\");\n var rep; //representation in html\n\n if (obj.termType == 'literal')\n {\n var styles = { 'integer': 'text-align: right;',\n 'decimal': 'text-align: \".\";',\n 'double' : 'text-align: \".\";',\n };\n rep = myDocument.createElement('span');\n rep.textContent = obj.value;\n // Newlines have effect and overlong lines wrapped automatically\n var style = '';\n if (obj.datatype && obj.datatype.uri) {\n var xsd = tabulator.ns.xsd('').uri;\n if (obj.datatype.uri.slice(0, xsd.length) == xsd)\n style = styles[obj.datatype.uri.slice(xsd.length)];\n }\n rep.setAttribute('style', style ? style : 'white-space: pre-wrap;');\n\n } else if (obj.termType == 'symbol' || obj.termType == 'bnode') {\n rep = myDocument.createElement('span');\n rep.setAttribute('about', obj.toNT());\n thisOutline.appendAccessIcons(kb, rep, obj);\n\n if (obj.termType == 'symbol') {\n if (obj.uri.slice(0,4) == 'tel:') {\n var num = obj.uri.slice(4);\n var anchor = myDocument.createElement('a');\n rep.appendChild(myDocument.createTextNode(num));\n anchor.setAttribute('href', obj.uri);\n anchor.appendChild(tabulator.Util.AJARImage(tabulator.Icon.src.icon_telephone,\n 'phone', 'phone '+num,myDocument))\n rep.appendChild(anchor);\n anchor.firstChild.setAttribute('class', 'phoneIcon');\n } else { // not tel:\n rep.appendChild(myDocument.createTextNode(tabulator.Util.label(obj)));\n }\n } else { // bnode\n rep.appendChild(myDocument.createTextNode(tabulator.Util.label(obj)));\n }\n } else if (obj.termType=='collection'){\n // obj.elements is an array of the elements in the collection\n rep = myDocument.createElement('table');\n rep.setAttribute('about', obj.toNT());\n /* Not sure which looks best -- with or without. I think without\n\n var tr = rep.appendChild(document.createElement('tr'));\n tr.appendChild(document.createTextNode(\n obj.elements.length ? '(' + obj.elements.length+')' : '(none)'));\n */\n for (var i=0; i<obj.elements.length; i++){\n var elt = obj.elements[i];\n var row = rep.appendChild(myDocument.createElement('tr'));\n var numcell = row.appendChild(myDocument.createElement('td'));\n numcell .setAttribute('notSelectable','false')\n numcell.setAttribute('about', obj.toNT());\n numcell.innerHTML = (i+1) + ')';\n row.appendChild(thisOutline.outline_objectTD(elt));\n }\n } else if (obj.termType=='formula'){\n rep = tabulator.panes.dataContentPane.statementsAsTables(obj.statements, myDocument);\n rep.setAttribute('class', 'nestedFormula')\n\n } else {\n tabulator.log.error(\"Object \"+obj+\" has unknown term type: \" + obj.termType);\n rep = myDocument.createTextNode(\"[unknownTermType:\" + obj.termType +\"]\");\n } //boring defaults.\n tabulator.log.debug(\"contents: \"+rep.innerHTML);\n return rep;\n } //boring_default", "function normalize($0,$1,$2){\r\n\t\treturn $2 || NEWLINE.test($1)?\"\\n\":$1;\r\n\t}", "function normalizeData(raw) {\n var data = {\n fields: {}\n };\n if (raw.errors) {\n for (var field in raw.errors) {\n if (raw.errors.hasOwnProperty(field)) {\n data.fields[field] = {\n type: raw.errors[field].kind,\n message: raw.errors[field].message\n };\n }\n }\n }\n return data;\n}", "custom({ decode, encode, schema }) {\r\n return {\r\n decode,\r\n encode,\r\n unsafeDecode: (input) => decode(input).mapLeft(Error).unsafeCoerce(),\r\n schema: schema !== null && schema !== void 0 ? schema : (() => ({}))\r\n };\r\n }", "function isRawPostcodeObject(o, additionalAttr, blackListedAttr) {\n\tif (!additionalAttr) additionalAttr = [];\n\tif (!blackListedAttr) blackListedAttr = [];\n\tisSomeObject(o, rawPostcodeAttributes, additionalAttr, blackListedAttr);\n}", "function w(e) {\n var t = C(e);\n switch (t) {\n case \"array\":\n case \"object\":\n return \"an \" + t;\n\n case \"boolean\":\n case \"date\":\n case \"regexp\":\n return \"a \" + t;\n\n default:\n return t;\n }\n }", "function processRaw(raw, type, lastModified, cb) {\n var json;\n try {\n switch (type.slice(0, 1)) {\n case 'x':\n // json = xml2json.toJson(raw, { object: true, coerce: true, trim: true, sanitize: false, reversible: true });\n break;\n case 'h':\n\n xray(raw, 'li.shopBrandItem', [{\n name: 'a',\n url: 'a@href',\n }])\n (function(err, data) {\n if (err) {\n console.log('Error: ' + err);\n } else {\n // console.log(data);\n json = data;\n }\n });\n\n break;\n case 'j':\n json = JSON.parse(raw);\n break;\n default:\n json = {\n text: '' + raw\n };\n }\n } catch (e) {\n return cb(tidyError(e));\n }\n\n cb(null, json, lastModified || 0);\n }", "get interpretation () {\r\n\t\treturn this._interpretation;\r\n\t}", "function oi(a){this.Of=a;this.rg=\"\"}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "raw() {\n\t\treturn this[MAP];\n\t}", "function PlatForm() {}", "function stringRepresentation(value) {\n switch (value[0]) {\n case \"Num\": \n\treturn getNumValue(value);\n case \"Clo\":\n\treturn;\n }\n}", "function s(e){return e}", "process(raw_item) {\n return raw_item;\n }", "function isRaw(cell) {\n return cell.cell_type === 'raw';\n }", "function w(e) {\n var t = C(e);\n switch (t) {\n case \"array\":\n case \"object\":\n return \"an \" + t;\n\n case \"boolean\":\n case \"date\":\n case \"regexp\":\n return \"a \" + t;\n\n default:\n return t;\n }\n }", "function nonvalidatedObject() {\n var str = gAppState.checkValue(\"objectID\", \"objectID2\");\n\n if (regexp.test(str) && !isBlankNode(str)) {\n return '<' + str + '>'; // Case: input is a uri. Solution: quote it\n } else if (str.charAt(0) == \"#\") {\n return '<' + str + '>'; // Case: input is an unquoted relative uri. Solution: quote it\n } else if (str.charAt(0) == '<' && str.charAt(1) == '#' && str.charAt(str.length - 1) == '>') {\n return str; // Case: input is already a relative uri. Solution: return it as is\n } else if (str.includes(\":\") || str.includes(\"<#\")) {\n return str; // Case: input is a curie. Solution: return it as is\n } else if (str.charAt(0) == \"?\") {\n return str; // checks if input is a variable for deletion\n } else if (str.charAt(0) == '<' && str.charAt(str.length - 1) == '>') {\n var newStr = str.slice(1, -1); // Case: input is quoted uri. Solution: must be unquotted to be recognize as a uri by regexp\n return nonvalidatedObject(newStr);\n } else if (str.includes('\"') || str.includes(\"'\") || str.indexOf(' ') >= 0) {\n return formatLiteral(str); // Case: input is a quoted literal value\n } else if (isBlankNode(str)) {\n return str; // Case : blank node\n }\n else {\n return ':' + str; // Case: input is not a uri or a blank node. Solution: make it a relative uri\n }\n}", "normalize( node ){\n var clone = node || this.DOM.input, //.cloneNode(true),\n v = [];\n\n // when a text was pasted in FF, the \"this.DOM.input\" element will have <br> but no newline symbols (\\n), and this will\n // result in tags not being properly created if one wishes to create a separate tag per newline.\n clone.childNodes.forEach(n => n.nodeType==3 && v.push(n.nodeValue))\n v = v.join(\"\\n\")\n\n try{\n // \"delimiters\" might be of a non-regex value, where this will fail (\"Tags With Properties\" example in demo page):\n v = v.replace(/(?:\\r\\n|\\r|\\n)/g, this.settings.delimiters.source.charAt(0))\n }\n catch(err){}\n\n v = v.replace(/\\s/g, ' ') // replace NBSPs with spaces characters\n\n return this.trim(v)\n }", "toObject() { throw new Error('virtual function called') }", "function If_bound_literal_literal() {\r\n}", "function decodeRaw(value, position, options) {\n return entities(value, xtend(options, {\n position: normalize(position),\n warning: handleWarning\n }));\n }", "function decodeRaw(value, position, options) {\n return entities(value, xtend(options, {\n position: normalize(position),\n warning: handleWarning\n }));\n }", "function decodeRaw(value, position, options) {\n return entities(value, xtend(options, {\n position: normalize(position),\n warning: handleWarning\n }));\n }", "function decodeRaw(value, position, options) {\n return entities(value, xtend(options, {\n position: normalize(position),\n warning: handleWarning\n }));\n }" ]
[ "0.6127074", "0.60859853", "0.6042301", "0.59349465", "0.59349465", "0.5480133", "0.5360717", "0.52917254", "0.52516854", "0.52384514", "0.5226667", "0.51880723", "0.51880723", "0.509369", "0.5085544", "0.5026419", "0.50058883", "0.5000224", "0.5000224", "0.5000224", "0.4956932", "0.4956258", "0.49322712", "0.49296835", "0.4922578", "0.4922578", "0.48932296", "0.4868307", "0.4868307", "0.4864497", "0.48508164", "0.4850324", "0.48481762", "0.4832611", "0.482476", "0.482476", "0.48177245", "0.47992194", "0.4799078", "0.4794765", "0.4786253", "0.47777787", "0.47686103", "0.47667104", "0.47633514", "0.47504666", "0.47497502", "0.4739698", "0.47318769", "0.47211438", "0.4707584", "0.47063422", "0.46980357", "0.46980307", "0.46911046", "0.4684859", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.4678201", "0.46775782", "0.46771067", "0.4675192", "0.46502492", "0.46488026", "0.4648426", "0.46379325", "0.46356246", "0.46332482", "0.46270555", "0.46210107", "0.46210107", "0.46210107", "0.46210107" ]
0.0
-1
Function to create circles with different positions and velocities
function create_circle() { //Random Position this.x = Math.random()*W; this.y = Math.random()*H; //Random Velocities this.vx = 0.1+Math.random()*1; this.vy = -this.vx; //Random Radius this.r = 10 + Math.random()*50; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createCircles() {\n \n \tconst dTheta = 0.5*2.43;\n \n \tlet c1 = new OrthoganalCircle(0,dTheta);\n \tlet c2 = new OrthoganalCircle(TWO_PI/3,dTheta);\n \tlet c3 = new OrthoganalCircle(2*TWO_PI/3,dTheta);\n\n \tcircles = [c1,c2,c3]; \n \n}", "createCircle() {\n const particle = [];\n\n for (let i = 0; i < this.numParticles; i++) {\n const color = this.colors[~~(Particles.rand(0, this.colors.length))];\n\n particle[i] = {\n radius: Particles.rand(this.minRadius, this.maxRadius),\n xPos: Particles.rand(0, this.canvas.width),\n yPos: Particles.rand(0, this.canvas.height),\n xVelocity: Particles.rand(this.minSpeed, this.maxSpeed),\n yVelocity: Particles.rand(this.minSpeed, this.maxSpeed),\n color: 'rgba(' + color + ',' + Particles.rand(this.minOpacity, this.maxOpacity) + ')'\n }\n\n //once values are determined, draw particle on canvas\n this.draw(particle, i);\n }\n //...and once drawn, animate the particle\n this.animate(particle);\n }", "function Circle(position, move, color) {\nthis.position = createVector(position.x, position.y);\nthis.speed = createVector(move.x, move.y);\nthis.move2 = random(0);\nthis.life = 200;\n}", "function Circle(x, y) {\r\n this.position = createVector(x, y); // Position of the circles\r\n this.getColor = floor(random(360)); // Random color of the circles. floor() rounds the random number down to the closest int.\r\n this.speed = random(-1, -3); // Randomized speed that only goes up\r\n this.sway = random(-2, 2); // An experimental speed for the x position, wasn't used in the end\r\n this.d = random(25,100); // The size of the circles is random\r\n\r\n this.show = function() {\r\n if(startCol == 0) {\r\n fill(this.getColor, 100, 100); // Fills with a random color\r\n this.getColor+=colorSpeed; // The color will change over time\r\n\r\n\t\t\tif (this.getColor >= 360) {\r\n\t\t\t\tthis.getColor = 0;\r\n\t\t\t}\r\n }\r\n\r\n this.move = function() {\r\n this.position.y += this.speed; // The random speed for the Circle\r\n //this.position.x += this.sway; // If this is activated the circles will go in directions other than straight\r\n }\r\n\r\n ellipse(this.position.x, this.position.y, this.d, this.d); // The circles are drawn\r\n }\r\n}", "function CreateCircle(x, y, radius, option, rate) {\n return Matter.Bodies.circle(x * rate, y * rate, radius * rate, option);\n}", "function setupCircles(){\n\n var delay=0;\n var i = 0;\n for(var radius=canvasDiagonalFromCenter; radius>0; radius-=10){\n var circle = new Circle(radius, 0*Math.PI + i , 2*Math.PI + i ,0,0,delay,inputSpeed,inputAcceleration);\n circles.push(circle);\n delay+=delayIncrements;\n i+= 0.3*Math.PI;\n }\n drawAndUpdateCircles();\n}", "function Circles(x, y, size)\r\n{\r\n this.x = x;\r\n this.y = y;\r\n this.size = size;\r\n this.shape = 'circle';\r\n}", "function circle(x,y,xVel,yVel,r,m)\n{\n\tthis.x=x;\n\tthis.y=y;\n\tthis.xVel=xVel;\n\tthis.yVel=yVel;\n\tthis.mass=m;\n\tthis.r=r;\n\t\n\tthis.moveSpeed=2;\n\n}", "function buildCircleScene() {\n var posOrig = new THREE.Vector2(0, 0, 0); \n var posTarget = new THREE.Vector2(0, 0, 0); \n var num = sceneData.nAgents;\n var radius = 4;\n\n positionsArray = new Array();\n\n for (var i = 0; i < num; i++) {\n // circle shape\n var theta = 2*M_PI/num * i;\n var xLoc = radius * Math.cos(theta);\n var zLoc = radius * Math.sin(theta);\n var xLocDest = radius * Math.cos(theta + M_PI);\n var zLocDest = radius * Math.sin(theta + M_PI);\n\n posOrig = new THREE.Vector3(xLoc, zLoc);\n posTarget = new THREE.Vector3(xLocDest, zLocDest);\n\n positionsArray.push(posOrig);\n positionsArray.push(posTarget);\n }\n}", "function drawCircles() {\n for (var i = 0; i < numCircles; i++) {\n var randomX = Math.round(-100 + Math.random() * 704);\n var randomY = Math.round(-100 + Math.random() * 528);\n var speed = 1 + Math.random() * 3;\n var size = 1 + Math.random() * circleSize;\n\n var circle = new Circle(speed, size, randomX, randomY);\n circles.push(circle);\n }\n update();\n }", "function addCircles(num){\r\n\tfor(var i=0; i<num; i++){\r\n\r\n\t\t\tvar c = {};\r\n\t\t\tc.x = getRandom(START_RADIUS*2,CANVAS_WIDTH-START_RADIUS*2);\r\n\t\t\tc.y = getRandom(START_RADIUS*2,CANVAS_HEIGHT-START_RADIUS*2);\r\n\r\n\t\t\tc.radius = START_RADIUS;\r\n\t\t\tc.xSpeed = getRandom(-MAX_SPEED,MAX_SPEED);\r\n\t\t\tc.ySpeed = getRandom(-MAX_SPEED,MAX_SPEED);\r\n\t\t\t// c.xSpeed = MAX_SPEED;\r\n\t\t\t// c.ySpeed = MAX_SPEED;\r\n\t\t\tc.fillStyle=getRandomColor();\r\n\t\t\tcircles.push(c);\r\n\t}\r\n}", "function createCircle(pointList, context, addObject = true, rotation = 0){\n //this is the equation (x - h)^2 + (y - k)^2 = r^2, I'm just using sqrt afterwards to get the usable r.\n radiusX = Math.sqrt(Math.pow((pointList[1][0] - pointList[0][0]), 2) + Math.pow((pointList[1][1] - pointList[0][1]), 2));\n radiusY = radiusX;\n context.beginPath();\n context.ellipse(pointList[0][0], pointList[0][1], radiusX, radiusY, (rotation * Math.PI) / 180, 0, 2 * Math.PI);\n\n if(addObject){\n var test = [];\n for(var i = 0; i < pointList.length; i++){\n test.push(vec2(pointList[i][0], pointList[i][1]));\n }\n\n //return the object that represents this particular circle\n return {type:\"1\", points:pointList, radx:radiusX, rady:radiusY, color:currentFill, Scale:\"1\", scaledPoints:test, rotation:\"0\", hiddenColor:selectRGB()};\n }\n}", "function createCircles(number){\n //Generate number of circles told\n for (let i = 0; i < number; i++){\n let x = 0;\n let y = 0;\n \n switch(Math.floor(getRandom(0,4))){\n //left side of screen\n case 0:\n x = -10;\n y = Math.floor(getRandom(5,710));\n break;\n //right side of screen\n case 1:\n x = 1290;\n y = Math.floor(getRandom(5,710));\n break;\n //top of screen\n case 2:\n y = -10;\n x = Math.floor(getRandom(5,1270));\n break;\n //bottom of screen\n case 3:\n y = 730;\n x = Math.floor(getRandom(5,1270));\n break;\n }\n\n let circle = new Circle(Math.floor(getRandom(20,60)),0x0000FF,x,y,Math.floor(getRandom(20,80)),time);\n circles.push(circle);\n gameScene.addChild(circle);\n }\n}", "function drawCircle(x1, y1, x2, y2) {\n var circleVertices = [];\n var inc = 2 * Math.PI / 50;\n var radius = Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));\n for (var theta = 0; theta < 2 * Math.PI; theta += inc) {\n circleVertices.push(vec2(radius * Math.cos(theta) + x1, radius * Math.sin(theta) + y1));\n }\n return circleVertices;\n}", "function createCircle(radius) { \n return {\n radius, \n draw: function() {}\n } \n }", "function Circle() {var _this6;var centerX = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.0;var centerY = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.0;var radius = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1.0;var style = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DefaultStyle.clone();var tessSegments = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 20;_classCallCheck(this, Circle);\n _this6 = _possibleConstructorReturn(this, _getPrototypeOf(Circle).call(this, style));\n\n _this6.polygon = new Polygon([], style);\n\n // Force polygon.id to be the same, so that its geometry is associated with this Circle.\n // This is a bit hacky, but can be removed as soon as we use native arcs for circle rendering.\n _this6.polygon.id = _this6.id;\n\n _this6.centerX = centerX;\n _this6.centerY = centerY;\n _this6.radius = radius;\n _this6.tessSegments = tessSegments;\n\n _this6.needsUpdate = true;return _this6;\n }", "function circle(self, xpos, ypos, radius) {\n let positions = [];\n let deltas = bfsDeltas[radius];\n let deltaLength = deltas.length;\n for (let k = 0; k < deltaLength; k++) {\n \n let nx = xpos + deltas[k][0];\n let ny = ypos + deltas[k][1];\n //self.log(`circle xy: ${xpos}, ${ypos}; NEW: ${nx}, ${ny}`);\n if (inArr(nx,ny, self.map)){\n positions.push([nx,ny]);\n }\n }\n return positions;\n}", "function createCircle(radius) {\n return {\n radius,\n draw: function () {}\n }\n}", "function createCircle(cx, cy, radius) {\n let a1 = new Arc();\n a1.startX = cx + radius;\n a1.startY = cy;\n a1.endX = cx - radius;\n a1.endY = cy;\n a1.radiusX = radius;\n a1.radiusY = radius;\n\n let a2 = new Arc();\n a2.startX = cx - radius;\n a2.startY = cy;\n a2.endX = cx + radius;\n a2.endY = cy;\n a2.radiusX = radius;\n a2.radiusY = radius;\n\n return [a1, a2];\n}", "function addNewCircle() {\n\n // circles can expose in 3 position,\n // bottom-left corner, bottom-right corner and bottom center.\n const entrances = [\"bottomRight\", \"bottomCenter\", \"bottomLeft\"];\n // I take one of entrances randomly as target entrance\n const targetEntrance = entrances[rndNum(entrances.length, 0, true)];\n\n // we have 5 different gradient to give each\n // circle a different appearance. each item\n // in below array has colors and offset of gradient.\n const possibleGradients = [\n [\n [0, \"rgba(238,31,148,0.14)\"],\n [1, \"rgba(238,31,148,0)\"]\n ],\n [\n [0, \"rgba(213,136,1,.2)\"],\n [1, \"rgba(213,136,1,0)\"]\n ],\n [\n [.5, \"rgba(213,136,1,.2)\"],\n [1, \"rgba(213,136,1,0)\"]\n ],\n [\n [.7, \"rgba(255,254,255,0.07)\"],\n [1, \"rgba(255,254,255,0)\"]\n ],\n [\n [.8, \"rgba(255,254,255,0.05)\"],\n [.9, \"rgba(255,254,255,0)\"]\n ]\n ];\n // I take one of gradients details as target gradient details\n const targetGrd = possibleGradients[rndNum(possibleGradients.length, 0, true)];\n\n // each circle should have a radius. and it will be\n // a random number between three and four quarters of canvas-min side\n const radius = rndNum(canvasMin / 3, canvasMin / 4);\n\n // this will push the created Circle to the circles array\n circles.push(new Circle(targetEntrance, radius, targetGrd))\n}", "function createCircle(x,y)\n{\n\t//each segment of the circle is its own circle svg, placed in an array\n\tvar donuts = new Array(9)\n\t\n\t//loop through the array\n\tfor (var i=0;i<9;i++){\n\t\tdonuts[i]=document.createElementNS(\"http://www.w3.org/2000/svg\",\"circle\");\n\t\tdonuts[i].setAttributeNS(null,\"id\",\"d\".concat(i.toString()));\n\t\tdonuts[i].setAttributeNS(null,\"cx\",parseInt(x));\n donuts[i].setAttributeNS(null,\"cy\",parseInt(y));\n\t\tdonuts[i].setAttributeNS(null,\"fill\",\"transparent\");\n\t\tdonuts[i].setAttributeNS(null,\"stroke-width\",3);\n\t\t//each ring of circles has different radius values, and dash-array values\n\t\t//dash array defines what percentage of a full circle is being drawn\n\t\t//for example the inner circle has a radius of 15.91549, 2*pi*15.91549\n\t\t//gives a circumfrence of 100 pixels for the circle, so defining the dasharray as 31 69 means that 31% of 100 pixels is drawn, and 69% is transparent.\n\t\tif (i<3){\n\t\t\t\t\tdonuts[i].setAttributeNS(null,\"r\",15.91549);\n\t\t\t\t\tdonuts[i].setAttributeNS(null,\"stroke-dasharray\",\"31 69\");\n\t\t}\n\t\t//middle ring\n\t\telse if (i<6){\n\t\t\tdonuts[i].setAttributeNS(null,\"r\",19.853);\n\t\t\tdonuts[i].setAttributeNS(null,\"stroke-dasharray\",\"39.185019 85.555059\");\n\t\t}\n\t\t//outer ring\n\t\telse{\n\t\t\tdonuts[i].setAttributeNS(null,\"r\",23.76852);\n\t\t\tdonuts[i].setAttributeNS(null,\"stroke-dasharray\",\"47.335504 102.006512\");\n\t\t}\n\t\t//each point is added to the points SVGs, use insertBefore so that it is drawn below the points rather than above, which allows for click events to still occur\n\t\t document.getElementById(\"points\").insertBefore(donuts[i],document.getElementById(\"points\").childNodes.item(0));\n\t}\n\t//each point has its own colour, dash offset and class. Dash offset is how far from the starting point (top of the circle) to begin drawing the segment\n\t//each class relates to a different css animation because each animation has a different starting point. Animations are defined in component.css\ndonuts[0].setAttributeNS(null,\"stroke-dashoffset\",\"58.33333\" );\n\t\t\t\t\t\tdonuts[0].setAttributeNS(null,\"class\",\"spin1\");\ndonuts[1].setAttributeNS(null,\"stroke-dashoffset\",\"25\");\n\t\t\t\t\t\t\tdonuts[1].setAttributeNS(null,\"class\",\"spin2\");\ndonuts[2].setAttributeNS(null,\"stroke-dashoffset\",\"91.66667\" );\n\t\t\t\t\t\t\tdonuts[2].setAttributeNS(null,\"class\",\"spin3\");\ndonuts[3].setAttributeNS(null,\"stroke-dashoffset\",\"41.18502\" );\n\tdonuts[3].setAttributeNS(null,\"class\",\"spin4\");\ndonuts[4].setAttributeNS(null,\"stroke-dashoffset\",\"82.76505\" );\n\tdonuts[4].setAttributeNS(null,\"class\",\"spin5\");\ndonuts[5].setAttributeNS(null,\"stroke-dashoffset\",\"124.34508\");\n\tdonuts[5].setAttributeNS(null,\"class\",\"spin6\");\ndonuts[6].setAttributeNS(null,\"stroke-dashoffset\",\"56.3355\");\n\tdonuts[6].setAttributeNS(null,\"class\",\"spin7\");\ndonuts[7].setAttributeNS(null,\"stroke-dashoffset\",\"106.11618\");\n\tdonuts[7].setAttributeNS(null,\"class\",\"spin8\");\ndonuts[8].setAttributeNS(null,\"stroke-dashoffset\",\"155.89685\");\n\tdonuts[8].setAttributeNS(null,\"class\",\"spin9\");\ndonuts[0].setAttributeNS(null,\"stroke\",\"#115D6B\");\ndonuts[1].setAttributeNS(null,\"stroke\",\"#D90981\");\ndonuts[2].setAttributeNS(null,\"stroke\",\"#4A3485\");\ndonuts[3].setAttributeNS(null,\"stroke\",\"#F51424\");\ndonuts[4].setAttributeNS(null,\"stroke\",\"#0BA599\");\ndonuts[5].setAttributeNS(null,\"stroke\",\"#1077B5\");\ndonuts[6].setAttributeNS(null,\"stroke\",\"#FA893D\");\ndonuts[7].setAttributeNS(null,\"stroke\",\"#87C537\");\ndonuts[8].setAttributeNS(null,\"stroke\",\"#02B3EE\");\n}", "function circle(x, y, px, py) {\n //this is the speed part making the size be determined by speed of mouse\n var distance = abs(x-px) + abs(y-py);\n stroke(r, g, b);\n strokeWeight(2);\n //first set of variables for bigger circle\n r = random(255);\n g = random(255);\n b = random(255);\n\n//second set of colours so the inner circle is different colour or else it is the same\n r2 = random(255);\n g2 = random(255);\n b2 = random(255);\n //this is the big circle\n fill(r, g, b);\n ellipse(x, y, distance, distance);\n //this is the smaller inner circle\n fill(r2, g2, b2);\n ellipse(x, y, distance/2, distance/2);\n}", "function drawCircle(radius, x, y) { svg.append(\"circle\").attr(\"fill\", \"red\").attr(\"r\", radius).attr(\"cx\", x).attr(\"cy\", y); }", "static createCircle(x, y, radius, numSides = -1) {\n return new Ellipse(x, y, radius, radius, numSides)\n }", "function createCircle(radius){\n return{\n radius,\n draw (){\n console.log('draw');\n }\n };\n\n }", "function OrthoganalCircle(theta,dTheta) {\n \n \tlet R = 1.0/cos(dTheta);\n this.r = abs(tan(dTheta));\n // this.x = R*cos(theta);\n // this.y = R*sin(theta);\n \t//endpoints\n \tthis.p1 = createVector(cos(theta-dTheta),sin(theta-dTheta));\n this.p2 = createVector(cos(theta+dTheta),sin(theta+dTheta));\n \n \tthis.center = createVector(R*cos(theta),R*sin(theta));\n \tthis.containsPoint = function(p){\n \t\n \treturn this.center.dist(p) < this.r;\n };\n \t\n \n \t/*\n \tCircle inversion. Swaps points inside the circle with points outside the circle. Like a refection in a line in hyperbolic space.\n */\n \tthis.invert = function(p){ \n \t\n \n \tlet op = this.center.dist(p);\n \n \tlet oq = this.r*this.r/op;\n \t\n \tlet dq = p5.Vector.sub(p,this.center).normalize().mult(oq);\n \t\n \treturn p5.Vector.add(this.center,dq);\n };\n \n \tthis.draw = function(graphics) {\n //Draw the arc\n let v1 = p5.Vector.sub(this.p1,this.center);\n let v2 = p5.Vector.sub(this.p2,this.center);\n \n let theta1 = v1.heading();\n let theta2 = v2.heading();\n \n let i = ii(this.center.x);\n let j = jj(this.center.y);\n \n graphics.arc(i,j, this.r*width,this.r*height ,theta2,theta1)\n }\n \n this.drawAnchors = function(graphics) {\n graphics.ellipse(ii(this.p1.x),jj(this.p1.y),4,4); \n graphics.ellipse(ii(this.p2.x),jj(this.p2.y),4,4); \n }\n}", "_createRandomCircles2(options) {\n let { n, filled, stroke, colours, minRadius, maxRadius, acceleration, friction, dx, dy } = options;\n minRadius = minRadius ? minRadius : this.MIN_RADIUS;\n maxRadius = maxRadius ? maxRadius : this.MAX_RADIUS;\n dx = dx === undefined ? 2 : dx;\n dy = dy === undefined ? 10 : dy;\n\n for (let i = 0; i < n; i++) {\n const radius = randomIntFromRange(minRadius, maxRadius);\n const x = randomIntFromRange(radius, this.canvas.width - radius);\n const y = randomIntFromRange(0, this.canvas.height / 2);\n const colour = randomColour(colours);\n const dx_ = randomIntFromRange(-dx, dx);\n const dy_ = randomIntFromRange(-dy, dy);\n this.makeCircle({ x, y, dx: dx_, dy: dy_, colour, radius, filled, gravity: true, acceleration, friction, stroke })\n }\n\n }", "constructor({colorCode, context, x, y, radius, percentFromCenter}) {\n this.circles = [];\n this.percentFromCenter = percentFromCenter;\n\n if (Math.abs(this.percentFromCenter) < 0.01) {\n this.circles.push(new ColorCircle({\n x: 0,\n y: 0,\n radius: radius,\n colorCode: new ColorCode({\n base: colorCode.getBase(),\n bits: colorCode.getBits(),\n red: colorCode.getComponent('R'),\n green: colorCode.getComponent('G'),\n blue: colorCode.getComponent('B')\n }),\n context\n }));\n }\n else {\n // Add red circle in bottom left position\n this.circles.push(new ColorCircle({\n x: x - radius * MAX_CIRCLE_DIST_MULT * this.percentFromCenter * RT_3_OVER_2,\n y: y - radius * MAX_CIRCLE_DIST_MULT * this.percentFromCenter * ONE_HALF,\n radius: radius,\n colorCode: new ColorCode({\n base: colorCode.getBase(),\n bits: colorCode.getBits(),\n red: colorCode.getComponent('R'),\n green: 0,\n blue: 0,\n }),\n context\n }));\n // Add green circle in top position\n this.circles.push(new ColorCircle({\n x: x,\n y: y + radius * MAX_CIRCLE_DIST_MULT * this.percentFromCenter,\n radius: radius,\n colorCode: new ColorCode({\n base: colorCode.getBase(),\n bits: colorCode.getBits(),\n red: 0,\n green: colorCode.getComponent('G'),\n blue: 0,\n }),\n context\n }));\n // Add blue circle in bottom right position\n this.circles.push(new ColorCircle({\n x: x + radius * MAX_CIRCLE_DIST_MULT * this.percentFromCenter * RT_3_OVER_2,\n y: y - radius * MAX_CIRCLE_DIST_MULT * this.percentFromCenter * ONE_HALF,\n radius: radius,\n colorCode: new ColorCode({\n base: colorCode.getBase(),\n bits: colorCode.getBits(),\n red: 0,\n green: 0,\n blue: colorCode.getComponent('B'),\n }),\n context\n }));\n }\n }", "function Circle(speed, width, xPos, yPos) {\n this.speed = speed\n this.width = width\n this.xPos = xPos\n this.yPos = yPos\n this.dx = Math.floor(Math.random() * 2) + 1\n this.dy = Math.floor(Math.random() * 2) + 1\n this.opacity = 0.05 + Math.random() * 0.5;\n this.isEaten = false\n this.color = colors[Math.floor(Math.random() * numColors - 1)]\n\n }", "function Circle(x, y, dx, dy, radius) {\n this.x = x;\n this.y = y;\n // Step 4\n this.dx = dx;\n this.dy = dy;\n this.radius = radius;\n // Step 8 Add Color\n this.colors = [\"#16a085\", \"#e74c3c\", \"#34495e\"];\n\n // Step 3 Add Draw Function\n this.draw = function() {\n c.beginPath();\n c.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);\n // Step 8 Add Color\n c.strokeStyle = \"blue\";\n // c.strokeStyle = this.colors[Math.floor(Math.random() * 3)];\n c.stroke();\n // c.fillStyle = this.colors[Math.floor(Math.random() * 3)];\n };\n\n // Step 4 Update / Create Animation\n // Add dx, dy, radius\n this.update = function() {\n if (this.x + this.radius > innerWidth || this.x - this.radius < 0) {\n this.dx = -this.dx;\n }\n\n if (this.y + this.radius > innerHeight || this.y - this.radius < 0) {\n this.dy = -this.dy;\n }\n\n this.x += this.dx;\n this.y += this.dy;\n\n // Step 5 add draw\n this.draw();\n };\n}", "function Circle(x, y, dx, dy, radius) {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n this.radius = radius;\n \n // FUNCTION FOR DRAWING NEW CIRCLE\n this.draw = function() {\n context.beginPath();\n context.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);\n context.fillStyle = circleBodyColor;\n context.strokeStyle = circleLineColor;\n context.stroke();\n context.fill();\n }\n\n // FUNCTION WITH LOGIC FOR MOVEMENT OF THE CIRCLES\n this.update = function() {\n // MOVING CIRCLES LEFT AND RIGHT\n if (this.x + this.radius + 1 > innerWidth || this.x - this.radius < 0 ) {\n this.dx = -this.dx;\n }\n\n // MOVING CIRCLE UP AND DOWN\n if (this.y + this.radius + 1 > innerHeight || this.y - this.radius < 0) {\n this.dy = -this.dy;\n }\n this.x += this.dx;\n this.y += this.dy;\n \n // AFTER MOVEMENT IS UPDATED, DRAW EVERYTHING AGAIN\n this.draw();\n }\n}", "function drawCircles() {\n canvasContext.fillStyle = 'white';\n canvasContext.fillRect(0, 0, xMax, yMax);\n\n for (let i = 0; i < particles.length; i++) {\n let r = particles[i].circleShape.radius;\n canvasContext.drawImage(\n particleImages[r],\n particles[i].position[0] - r + (xMax / 2),\n particles[i].position[1] - r + (yMax / 2)\n );\n }\n\n for (let i = 0; i < circles.length; i++) {\n canvasContext.save();\n\n canvasContext.lineWidth = LINE_WIDTH;\n canvasContext.strokeStyle = colors[i];\n\n canvasContext.beginPath();\n\n canvasContext.arc(\n circles[i].position[0] + (xMax / 2),\n circles[i].position[1] + (yMax / 2),\n circles[i].circleShape.radius,\n 0,\n Math.PI * 2\n );\n canvasContext.stroke();\n canvasContext.fill();\n\n canvasContext.restore();\n }\n }", "function Circle(x, y, vx, vy, r, growth) {\n this.x = x;\n this.y = y;\n this.vx = vx;\n this.vy = vy;\n this.r = r;\n this.color = canvasColors[0];\n this.alpha = 1;\n\n this.draw = function() {\n contextCanvas.beginPath();\n contextCanvas.strokeStyle = this.color.replace('x', + this.alpha);\n contextCanvas.arc(this.x, this.y, this.r, Math.PI * 2, false);\n contextCanvas.lineWidth = 2;\n contextCanvas.stroke();\n contextCanvas.fillStyle = 'transparent';\n contextCanvas.fill();\n }\n\n this.update = function() {\n this.x += this.vx;\n this.y += this.vy;\n this.alpha -= 0.015;\n this.r += growth;\n this.draw();\n }\n}", "function createCircle(radius) {\n return {\n radius,\n draw() {\n console.log(\"draw\");\n },\n };\n}", "function createCircle(radius) {\n return {\n radius,\n draw() {\n console.log(\"draw\");\n },\n };\n}", "function createCircle(radius) {\n return {\n radius,\n draw() {\n console.log(\"draw\");\n }\n };\n}", "function createCircle(radius) {\n return {\n radius,\n draw() {\n console.log(\"draw\");\n }\n };\n}", "constructor(x, y, radius) {\n super(createVector(x, y));\n this.x = x;\n this.y = y;\n this.radius = radius;\n this.setShape();\n this.fixtureType = \"circle\";\n\n }", "function circlePoint(x, y, r, type, force, exceptions) {\n elipsePoint(x, y, r, r, type, force, exceptions);\n }", "constructor(x, y, radius, color, xspeed, yspeed) {\n this.x = x;\n this.y = y;\n this.radius = radius;\n this.color = color;\n this.xspeed = xspeed;\n this.yspeed = yspeed;\n }", "function Circle (x, y, dx, dy, radius) {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n this.radius = radius;\n\n // Create a nameless function\n this.draw = function() {\n context.beginPath();\n // arc(x, y, radius: Int, startAngle: float, endAngle: float, drawCounterClockwise: bool)\n context.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);\n context.strokeStyle = ' #000000';\n //context.strokeStyle = '#'+Math.floor(Math.random()*16777215).toString(16);\n context. stroke();\n }\n\n this.update = function() {\n if( this.x + this.radius > innerWidth || this.x - this.radius < 0 ) {\n this.dx = -this.dx;\n }\n \n if( this.y + this.radius > innerHeight || this.y - this.radius < 0 ) {\n this.dy = -this.dy;\n }\n \n this.x += this.dx;\n this.y += this.dy;\n\n this.draw();\n }\n}", "function calculateCircle(c1, c2, c3, properties, pathIndex, level)\n{\t\n\tcalCount++;\n\t\n\tvar k1 = properties.k1;\n\tvar k2 = properties.k2;\n\tvar k3 = properties.k3;\n\tvar k4 = properties.k4;\n\t\n\tvar z4 = mRC((1/k4), aCC(aCC(aCC(mRC(k1, c1._origin), mRC(k2, c2._origin)), mRC(k3, c3._origin)), mRC(2, sqrtC(aCC(aCC(mRC(k1*k2, mCC(c1._origin, c2._origin)), mRC(k2*k3, mCC(c2._origin, c3._origin))), mRC(k1*k3, mCC(c1._origin, c3._origin)))))));\n\tvar tangencyList = [c1, c2, c3];\n\tvar circ = new Circle(z4, 1/k4, c1.id + pathIndex, tangencyList, c1, level+1, \"#FFFFFF\", false);\n\t\n\treturn circ;\n}", "function Circle(x,y,dx,dy,radius){\n //independent x&y values\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n this.radius = radius;\n\n//creating a method within an object to create a circle every time this function is called anonymous function\n this.draw = function() {\n //console.log('hello there');\n //arc //circle\n c.beginPath();\n c.arc(this.x, this.y, this.radius, 0, Math.PI*2, false);\n c.strokeStyle = 'pink';\n c.stroke();\n c.fill();\n}\n\nthis.update = function() {\n //moving circle by 1px --> x += 1;\n\n if(this.x + this.radius > innerWidth ||\n this.x - this.radius < 0){\n this. dx = -this.dx;\n }\n if(this.y + this.radius > innerHeight ||\n this.y - this.radius < 0){\n this.dy = -this.dy;\n }\n this.x += this.dx; \n this.y += this.dy;\n\n this.draw();\n }\n}", "function Circle () {\n /**\n * Radius of circle\n * @type Ray3d\n */\n this.fRadius = 0.0;\n /**\n * Point of center\n * @type Float32Array\n */\n this.v2fCenter = null;\n\n switch (arguments.length) {\n case 0:\n this.v2fCenter = Vec2.create();\n break;\n case 1:\n this.v2fCenter = Vec2.create(arguments[0].v2fCenter);\n this.fRadius = arguments[0].fRadius;\n break;\n case 2:\n this.v2fCenter = Vec2.create(arguments[0]);\n this.fRadius = arguments[1];\n break;\n case 3:\n this.v2fCenter = Vec2.create();\n this.v2fCenter.X = arguments[0];\n this.v2fCenter.Y = arguments[1];\n this.fRadius = arguments[2];\n break;\n }\n ;\n}", "function createCircle(radius) {\n return {\n radius,\n draw() {\n console.log('draw');\n }\n };\n}", "function createCircle(radius) {\n return {\n radius,\n draw() {\n console.log('draw');\n }\n };\n}", "function Circle(x, y, dx, dy, radius, color) {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n this.radius = radius;\n this.color = color;\n\n\n this.draw = function(){\n c.beginPath();\n c.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);\n c.fillStyle = this.color;\n c.fill();\n c.closePath();\n }\n\n\n//****movement and edges\n this.update = function(){\n if (this.x + this.radius > innerWidth || this.x - this.radius < 0){\n this.dx = -this.dx;\n }\n if (this.y + this.radius > innerHeight || this.y - this.radius < 0){\n this.dy = -this.dy;\n }\n this.x += this.dx;\n this.y += this.dy;\n\n this.draw();\n }\n}", "function drawDonut() {\n for (let i = 0; i <= 360; i += angleStep) {\n let x = width * sin(i);\n let y = height * cos(i);\n let z = 0;\n let center = { x, y, z };\n circlesVertices.push(createCircleVertices(center, i, 1));\n }\n drawVertices();\n}", "function drawTarget() {\n let circleSize = 400;\n \n //draw circles of decreasing size\n for (let i = 0; i < NUM_CIRC; i++) {\n ellipse(X_POS, Y_POS, circleSize, circleSize);\n circleSize -= 40;\n }\n}", "function CircleMethods() {\n const origin = [0, 0];\n const pointA = [10, 20];\n const pointB = [20, 0];\n const pointC = [-15, -15];\n\n const radius = 20;\n\n const circleMethod1 = new makerjs.paths.Circle(radius);\n const circleMethod2 = new makerjs.paths.Circle(origin, radius);\n const circleMethod3 = new makerjs.paths.Circle(pointA, pointB);\n const circleMethod4 = new makerjs.paths.Circle(pointA, pointB, pointC);\n\n this.paths = {\n circleMethod1,\n circleMethod2,\n circleMethod3,\n circleMethod4,\n };\n}", "function walkingCircle() {\n addCircle(150, \"green\");\n addCircle(300, \"blue\");\n addCircle(600, \"purple\");\n addCircle(searchRadius, \"black\");\n}", "drawCircle () {\n const context = this.canvas.getContext('2d')\n const [x, y] = this.center\n const radius = this.size / 2\n\n for (let angle = 0; angle <= 360; angle++) {\n const startAngle = (angle - 2) * Math.PI / 180\n const endAngle = angle * Math.PI / 180\n context.beginPath()\n context.moveTo(x, y)\n context.arc(x, y, radius, startAngle, endAngle)\n context.closePath()\n context.fillStyle = 'hsl(' + angle + ', 100%, 50%)'\n context.fill()\n }\n }", "function createCircle(radius){\n return {\n // radius <-----> radius = radius\n radius,\n draw(){\n console.log('draw');\n }\n };\n}", "function createCircle(radius) {\n return {\n radius,\n draw() {\n console.log(draw);\n }\n };\n}", "function circle(a, b, x, r) {\n for (var i = 0; i < x; i++) {\n ctx.moveTo(r*a*Math.cos(i*2*Math.PI/x), r*b*Math.sin(i*2*Math.PI/x));\n ctx.lineTo(r*a*Math.cos((i+1)*2*Math.PI/x), r*b*Math.sin((i+1)*2*Math.PI/x));\n ctx.stroke();\n }\n }", "drawCircle(ctx, _x_loc, _y_loc, _radius, _speed_vector){\n ctx.beginPath();\n ctx.arc(_x_loc, _y_loc, _radius, 0, 2*Math.PI);\n if (_speed_vector < 4)\n ctx.fillStyle = \"#B6FF33\";\n else if (_speed_vector < 8)\n ctx.fillStyle = \"#FF9900\";\n else{\n ctx.fillStyle = ctx.createPattern(document.getElementById(\"ball\"), \"repeat\");\n }\n ctx.fill();\n\n }", "circle() {\n const context = GameState.current;\n\n Helper.strewnSprite(\n Helper.getMember(GroupPool.circle().members),\n { y: context.game.stage.height },\n { y: 2 },\n (sprite) => {\n this._tweenOfCircle(context, sprite);\n }\n );\n }", "function createCircleAnimation(cords) {\n\tvar xy = cords.x + 'px ' + cords.y + 'px';\n\t$.keyframe.define([{\n\t\tname: 'circle-in',\n\t\tfrom: {'clip-path': 'circle( 0% at '+ xy + ')', '-webkit-clip-path': 'circle( 0% at '+ xy + ')', '-ms-clip-path': 'circle( 0% at '+ xy + ')'},\n\t\tto: {'clip-path': 'circle(120% at '+ xy + ')', '-webkit-clip-path': 'circle(120% at '+ xy + ')', '-ms-clip-path': 'circle(120% at '+ xy + ')'},\n\t}]);\n\t$.keyframe.define([{\n\t\tname: 'circle-out',\n\t\tfrom: {'clip-path': 'circle(120% at '+ xy + ')', '-webkit-clip-path': 'circle(120% at '+ xy + ')', '-ms-clip-path': 'circle(120% at '+ xy + ')'},\n\t\tto: {'clip-path': 'circle( 0% at '+ xy + ')', '-webkit-clip-path': 'circle( 0% at '+ xy + ')', '-ms-clip-path': 'circle( 0% at '+ xy + ')'},\n\t}]);\n}", "function createCircle(radius) {\n return {\n radius,\n draw() {\n console.log(\"draw\");\n }\n };\n}", "function Circle(x, y, dx, dy, radius, r, g, b) {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n this.radius = radius;\n this.minRadius = radius;\n this.r = r;\n this.g = g;\n this.b = b;\n this.color = colorArray[Math.floor(Math.random() * colorArray.length)]\n\n this.draw = function () {\n c.beginPath();\n c.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);\n // c.strokeStyle = `rgb(${r}, ${g}, ${b})`;\n // c.fillStyle = `rgb(${r}, ${g}, ${b})`;\n c.fillStyle = this.color\n // c.stroke();\n c.fill();\n }\n this.update = function () {\n if (this.x + this.radius > innerWidth || this.x - this.radius < 0) {\n this.dx = -this.dx;\n }\n if (this.y + this.radius > innerHeight || this.y - this.radius < 0) {\n this.dy = -this.dy;\n }\n this.x += this.dx;\n this.y += this.dy;\n\n\n //INTERACTIVITY portion\n if (mouse.x - this.x < 50 \n && mouse.x - this.x > -50\n && mouse.y - this.y < 50 \n && mouse.y - this.y > -50) {\n if (this.radius < maxRadius) {\n this.radius += 1;\n }\n } else if (this.radius > this.minRadius) {\n this.radius -= 1;\n }\n\n this.draw();\n }\n}", "function circle(x,y,radius) { \n ctx.beginPath();\n ctx.arc(x, y, radius,0, 2*Math.PI);\n ctx.fill();\n ctx.stroke();\n}", "function circlePath (pathX, pathY, x, y, r, s)\n{\n // Compute the number of steps given the speed\n let nSteps = 2 * Math.PI * r / s;\n // Clear the current path\n pathX.length = 0;\n pathY.length = 0;\n // Add points to the path uniformly along a circle\n for (let i = 0; i < nSteps; i ++)\n {\n pathX[i] = x + r * Math.sin(i * s / r);\n pathY[i] = y + r * Math.cos(i * s / r);\n }\n}", "function shapes() {\n for (x = -1; x <= (width / 100) + 1; x++) {\n for (y = -1; y <= (height / 100) + 1; y++) {\n // Checks if the object is moving right or left\n if (posX) {\n // Checks if the object is moving up or down\n if (posY) {\n // Object creation in the Right and Down direction\n if (createCircles) {\n ellipse((x * 100) + w, (y * 100) + z, 50, 50);\n } else {\n rect((x * 100) + w, (y * 100) + z, 45, 45);\n }\n // The else of the up/down check\n } else {\n // Object creation in the right and Up direction\n if (createCircles) {\n ellipse((x * 100) + w, (y * 100) - z, 50, 50);\n } else {\n rect((x * 100) + w, (y * 100) - z, 45, 45);\n }\n }\n // The else of the right/left check\n } else {\n if (posY) {\n // Object creation in the left and Down direction\n if (createCircles) {\n ellipse((x * 100) - w, (y * 100) + z, 50, 50);\n } else {\n rect((x * 100) - w, (y * 100) + z, 45, 45);\n }\n } else {\n // Object creation in the left and Up direction\n if (createCircles) {\n ellipse((x * 100) - w, (y * 100) - z, 50, 50);\n } else {\n rect((x * 100) - w, (y * 100) - z, 45, 45);\n }\n }\n }\n }\n }\n}", "animateCircles() {\n requestAnimationFrame(this.animateCircles.bind(this));\n this.clearCanvas();\n this.circles.forEach(circle => circle.update({\n mouse_x: this.mouse.x,\n mouse_y: this.mouse.y,\n range: this.mouse.range,\n particles: this.circles\n }));\n }", "function drawCircle(x,y,radius,color)\r\n{\r\n\tdrawArc(x, y, radius, 0, Math.PI * 2, color);\r\n}", "function createCircle(radius) {\n //Object Template\n const circle = {\n radius,\n draw() {\n console.log('Draw ' + radius);\n }\n }\n\n return circle;\n}", "function generate_circles(){\n\t\t\tvar timerHasStarted = false; // reset the timer, don't start until after the circles are done being generated\n\t\t\tctx.clearRect(0, 0, window.innerWidth, window.innerHeight); // ensure no past canvas features are remaining\n\n\t\t\tright_circs = gen_right_centers()\n\t\t\tfor(var i=0; i < right_circs.length; i++){\n\t\t\t\t\tctx.beginPath();\n\t\t\t\t\tctx.arc(right_circs[i].x, right_circs[i].y, r2, 0 ,2*Math.PI);\n\t\t\t\t\tctx.fillStyle = trial.circle_color;\n\t\t\t\t\tctx.fill();\n\t\t\t\t\tctx.closePath();\n\t\t\t}\n\n\t\t\tleft_circs = gen_left_centers()\n\t\t\tfor(var i=0; i < left_circs.length; i++){\n\n\t\t\t\t\tctx.beginPath();\n\t\t\t\t\tctx.arc(left_circs[i].x, left_circs[i].y, r1, 0 ,2*Math.PI);\n\t\t\t\t\tctx.fillStyle = trial.circle_color;\n\t\t\t\t\tctx.fill();\n\t\t\t\t\tctx.closePath();\n\t\t\t}\n\n\t\t\tstartKeyboardListener();\n\t\t\tjsPsych.pluginAPI.setTimeout(function() {\n end_trial();\n \t\t}, trial.trial_duration);\n\t\t}", "function circle2(x, y, r){\n for(let a=Math.random(); a<180; a+=1+Math.random()*0.1234){\n context.beginPath()\n context.moveTo(x, y)\n const xoff = Math.cos(a) * r + x\n const yoff = Math.sin(a) * r + y\n context.lineTo(xoff, yoff)\n context.stroke()\n }\n}", "crearFormaDeTunelCircular(circleRadius = 10){\r\n\t\tvar shape = new THREE.Shape();\r\n\t\tshape.moveTo( circleRadius, 0 );\r\n\t\tshape.absarc( 0, 0, circleRadius, 0, 2 * Math.PI, false );\r\n\r\n\t\treturn shape;\r\n\t}", "function circle(x, y, r) {\n\tctx.beginPath();\n\tctx.arc(x, y, r, 0, 6.28);\n\tctx.closePath();\n\tctx.fillStyle = \"peru\"\n\tctx.fill();\n}", "function Circle(C, R = Math.random() * CANDY_START_RADIUS + CANDY_MIN_SIZE, M = CANDY_MASS, forcedString) {\n var newCircle = {\n C, // center\n I: 0, // inertia\n V: Vec2(M ? Math.random() * 1000 - 500 : 0, M ? Math.random() * -500 : 0), // velocity (speed)\n M, // inverseMass (0 if immobile)\n A: Vec2(0, M ? 250 : 0), // acceleration\n B: 0, //M ? Math.random() * 7 : 0, // angle? could start at random rotation\n D: 0, // angle velocity (stays on!)\n E: 0, // angle acceleration,\n R, // radius\n // random emojoi! works on most modern devices but not all\n //Z: String.fromCodePoint(0x1F600 + Math.random() * 69/*56*/ | 0)\n // random letter A-Z\n Z: forcedString || String.fromCharCode(65 + Math.floor(Math.random() * 26)),\n //color: \"rgba(\"+rndInt(0,255)+\",\"+rndInt(0,255)+\",\"+rndInt(0,255)+\",1)\" //0.25)\"\n color: \"rgba(\" + rndInt(64, 255) + \",\" + rndInt(64, 255) + \",\" + rndInt(64, 255) + \",1)\" //0.25)\"\n //I: M, // (here it's simplified as M) Inertia = mass * radius ^ 2. 12 is a magic constant that can be changed\n };\n objects.push(newCircle);\n return newCircle;\n }", "function pointOnCircle(posX, posY, radius, angle) {\n const x = posX + radius * p5.cos(angle)\n const y = posY + radius * p5.sin(angle)\n return p5.createVector(x, y)\n}", "move (circles) {\n circles.forEach((circle) => {\n if (circle !== this) {\n // detect collision with another circle\n if (calculateDistance(circle, this) <= circle.radius + this.radius) {\n this.changeDirectionX()\n this.changeDirectionY()\n }\n\n // draw the link between circles if in range\n if (calculateDistance(circle, this) <= circle.radius + this.radius + linkDistance) {\n drawLink(this, circle)\n }\n }\n })\n\n if (this.x + this.direction.dirX + this.radius >= width ||\n (this.x + this.direction.dirX) - this.radius <= 0) {\n this.changeDirectionX()\n }\n\n if (this.y + this.direction.dirY + this.radius >= height ||\n (this.y + this.direction.dirY) - this.radius <= 0) {\n this.changeDirectionY()\n }\n\n this.x += this.direction.dirX\n this.y += this.direction.dirY\n\n ctx.lineWidth = 3\n this.render(canvas, ctx)\n ctx.fill()\n }", "function circle(args) {\n\t\tvar ctx = args[0];\n\t\tvar circeCenterX = args[1];\t// Centro del cerchio, coordinata X\n\t\tvar circeCenterY = args[2];\t// Centro del cerchio, coordinata Y\n\t\t\n\t\tvar colorCircle = args[3];\t// Colore del cerchio\n\t ctx.fillStyle = colorCircle;\n\t \n\t\tctx.beginPath();\n\t /*\n\t Parametri funzione .arc(x, y, r, sAngle, eAngle):\n\t - x: coordinata X del centro del cerchio\n\t - y: coordinata X del centro del cerchio;\n\t - r: raggio;\n\t - sAngle: angolo di inizio in radianti\n\t - eAngle: angolo di fine in radianti\n\t */\n\t ctx.arc(circeCenterX, circeCenterY, 2, 0, 2 * Math.PI);\n\t ctx.stroke();\n\t ctx.fill();\n\t}", "function draw() {\n \n // Colouring the background\n background(220);\n\n // Changing the x and the y position\n xPosition = xPosition + xSpeed * xDirection;\n yPosition = yPosition + ySpeed * yDirection;\n\n // Changing the x direction so that it bounces off\n if (xPosition > width - radius || xPosition < radius) {\n xSpeed *= -1;\n }\n\n // Changing the y direction so that it bounces off\n if (yPosition > height - radius || yPosition < radius) {\n ySpeed *= -1;\n }\n\n // Creating the ellipse\n ellipse(xPosition, yPosition, radius, radius);\n\n}", "function Circle(x,y,r, color) { //circle object\r\n this.x = x;\r\n this.y = y;\r\n this.r = r;\r\n this.color = color;\r\n}", "function drawCircle(cArray){\n\t\tvar circles = arguments[0];\n\t\tfor(var i = 0; i < circles.length; i++){\n\t\t\t//画球\n\t\t\tctx.beginPath();\n\t\t\tctx.arc(circles[i].x,circles[i].y,circles[i].r,0,Math.PI*2,false);\n\t\t\tctx.fill();\n\t\t\t//球间连线\n\t\t\tctx.beginPath();\n\t\t\tctx.moveTo(circles[0].x,circles[0].y);\n\t\t\tctx.lineTo(circles[i].x,circles[i].y);\n\t\t\t\n\t\t\tctx.stroke();\n\t\t}\n\t}", "function SimpleCircle(scene, radius, track_point=null) {\n\n // general\n this.id = Nickel.UTILITY.assign_id();\n this.type = 'SimpleCircle';\n this.scene = scene;\n this.canvas = scene.canvas;\n this.context = this.canvas.getContext(\"2d\");\n\n // style\n this.stroke_width = 1;\n this.stroke_dash_length = 0;\n this.stroke_gap_length = 0;\n this.stroke_fill = null;\n this.stroke_color = null;\n\n // size\n this.radius = radius;\n\n // pos (initially hide the circle)\n this.cx = -radius;\n this.cy = -radius;\n\n // pos of extra point to be tracked\n // (helps with origin related computation)\n // (usually set to center of shape)\n this.tracker = track_point;\n\n // other\n this.dead = false;\n this.visibility = true;\n\n this.update = function() {\n //-- Called every frame.\n //-- Updates changing parameters.\n //--\n\n // skip if marked for deletion\n if (this.dead == true) {\n return;\n }\n\n // user custom update\n this.update_more();\n\n // render graphics\n this.draw();\n }\n\n this.draw = function() {\n //-- Called every frame. Processes graphics\n //-- based on current parameters.\n //--\n\n // skip if marked for invisibility\n if (this.visibility == false || this.dead == true) {\n return;\n }\n\n // skip if no stroke color\n if (!this.stroke_color) {\n return;\n }\n\n // draw\n var ctx = this.context;\n ctx.save();\n\n // stroke properties\n ctx.lineWidth = this.stroke_width;\n ctx.setLineDash([this.stroke_dash_length, this.stroke_gap_length]);\n ctx.fillStyle = this.stroke_fill;\n ctx.strokeStyle = this.stroke_color;\n\n // draw circle\n ctx.beginPath();\n // (params: cx, cy, radius, start_angle, end_angle, anticlockwise?)\n ctx.arc(this.cx,this.cy,this.radius,0,2*Math.PI,false);\n ctx.stroke();\n if (this.stroke_fill)\n ctx.fill();\n\n ctx.restore();\n }\n\n this.destroy = function() {\n //-- Marks current instance for deletion\n //--\n\n this.dead = true;\n this.visibility = false;\n }\n\n this.hide = function() {\n //-- Marks current instance's visibility to hidden\n //--\n\n this.visibility = false;\n }\n\n this.show = function() {\n //-- Marks current instance's visibility to shown\n //--\n\n this.visibility = true;\n }\n\n this.is_visible = function() {\n //-- Returns if self is visible\n //--\n\n return this.visibility;\n }\n\n this.update_more = function() {\n //-- Called in update. Meant to be over-ridden.\n //--\n\n }\n\n this.get_tracker = function() {\n //-- Returns track point\n //--\n\n return this.tracker;\n }\n\n this.set_tracker = function(track_point) {\n //-- Sets a new track point\n //--\n\n this.tracker = track_point;\n }\n\n this.get_center = function() {\n //-- Returns center of circle\n //--\n\n return [this.cx, this.cy];\n }\n\n this.set_center = function(new_center) {\n //-- Centers self onto a position\n //--\n\n if (this.tracker) {\n this.tracker[0] += new_center[0] - this.cx;\n this.tracker[1] += new_center[1] - this.cy;\n }\n\n this.cx = new_center[0];\n this.cy = new_center[1];\n }\n\n this.shift_pos = function(shiftx, shifty) {\n //-- Shifts center position\n //--\n\n this.cx += shiftx;\n this.cy += shifty;\n\n if (this.tracker) {\n this.tracker[0] += shiftx;\n this.tracker[1] += shifty;\n }\n }\n\n this.set_pos = function(point) {\n //-- Translates self where center point\n //-- is at the given point (proxy to 'set_center')\n //--\n\n this.set_center(point);\n }\n\n this.scale_around = function(scale, point) {\n //-- Scales x,y center position and radius\n //-- of self from/to a point\n //--\n\n this.scale_around2(scale, scale, scale, point);\n }\n\n this.scale_around2 = function(scalex, scaley, scaler, point) {\n //-- Scales x,y center position and radius\n //-- of self from/to a point\n //--\n\n this.cx = scalex * (this.cx - point[0]) + point[0];\n this.cy = scaley * (this.cy - point[1]) + point[1];\n this.radius *= scaler;\n\n if (this.tracker) {\n this.tracker[0] = scalex * (this.tracker[0] - point[0]) + point[0];\n this.tracker[1] = scaley * (this.tracker[1] - point[1]) + point[1];\n }\n }\n\n this.rotate_around = function(degrees, point) {\n //-- Applies a rotation transformation to centerpoint\n //--\n\n var radians = degrees*Math.PI/180*-1;\n\n var tmpx = this.cx - point[0];\n var tmpy = this.cy - point[1];\n this.cx = tmpx * Math.cos(radians) - tmpy * Math.sin(radians) + point[0];\n this.cy = tmpx * Math.sin(radians) + tmpy * Math.cos(radians) + point[1];\n\n if (this.tracker) {\n\n var tmpx = this.tracker[0] - point[0];\n var tmpy = this.tracker[1] - point[1];\n this.tracker[0] = tmpx * Math.cos(radians) - tmpy * Math.sin(radians) + point[0];\n this.tracker[1] = tmpx * Math.sin(radians) + tmpy * Math.cos(radians) + point[1];\n }\n }\n \n this.copy_base = function() {\n //-- Copies self using basic properties\n //--\n \n var new_tracker = [this.tracker[0], this.tracker[1]];\n var new_circle = new SimpleCircle(this.scene,this.radius,new_tracker);\n new_circle.set_center([this.cx, this.cy]);\n new_circle.stroke_width = this.stroke_width;\n new_circle.stroke_dash_length = this.stroke_dash_length;\n new_circle.stroke_gap_length = this.stroke_gap_length;\n new_circle.stroke_fill = this.stroke_fill;\n new_circle.stroke_color = this.stroke_color;\n new_circle.update_more = this.update_more;\n return new_circle;\n }\n\n //\n // proxy functions:\n //\n\n this.offset_position = function(offx, offy) {\n //-- shift_pos proxy\n //--\n\n this.shift_pos(offx, offy);\n }\n\n this.offset_turn = function(angle, point) {\n //-- rotate_around proxy\n //--\n\n this.rotate_around(angle, point);\n }\n\n this.offset_scale = function(scale, point) {\n //-- scale_around proxy\n //--\n\n this.scale_around(scale, point);\n }\n}//end SimpleCircle", "createParticle() {\n noStroke();\n fill('rgba(200,169,169,random(0,1)');\n circle(this.x, this.y, this.r);\n }", "function generate_circle(shape, center) {\n var radius = shape.dimensions['r'];\n var rotation = shape.rotation;\n var pinned = shape.pinned;\n var vertices = [];\n\n // Approximate the circle with a polygon\n var sides = 30; // Number of sides for the polygon approximation\n var theta = 0;\n for (var i = 0; i < sides; i++) {\n theta += (2*Math.PI)/sides;\n vertices.push({x: (radius * Math.cos(theta)) + center.x,\n y: radius * Math.sin(theta) + center.y})\n }\n\n // Adjust nodes to be defined from center of shape\n for (i of shape.nodes) {\n i['x'] += center.x\n i['y'] += center.y\n }\n\n new_shape = {\n vertices: vertices,\n nodes: shape.nodes,\n pinned: shape.pinned,\n center: center\n }\n\n return new_shape;\n}", "circlePath (x, y, r) {\n return \"M\" + x + \",\" + y + \" \" +\n \"m\" + -r + \", 0 \" +\n \"a\" + r + \",\" + r + \" 0 1,0 \" + r * 2 + \",0 \" +\n \"a\" + r + \",\" + r + \" 0 1,0 \" + -r * 2 + \",0Z\";\n }", "function initManyCircles() \r\n{\r\n\tfor (let i = 0; i < noc; i++) \r\n\t{\r\n\t\trandomInitialize();\r\n\r\n\t\tcircleArr.push(new Circle(center_x_pos,center_y_pos,radius,arc_start,arc_end,colour,dx,dy));\r\n\t}\t\r\n}", "function EvilCircle(x, y, velX, velY, exists, color, size) {\n Shape.call(this, x, y, 20, 20, exists);\n this.color = color;\n this.size = size;\n}", "function createCircle (number) {\n return new Circle({\n id: number,\n x: Math.floor((Math.random() * (width - maxCircleRadius)) + maxCircleRadius),\n y: Math.floor((Math.random() * (height - maxCircleRadius)) + maxCircleRadius),\n radius: Math.floor((Math.random() * maxCircleRadius) + minCircleRadius),\n direction: { dirX: Math.random() * animationSpeed, dirY: Math.random() * animationSpeed }\n })\n}", "function Circle ( x, y, r){\n Shape.call(this,x,y); //powiązanie x y koła z x y kształtu!!\n this.r = r; \n\n}", "function createFilledCircle(x,y,radius,color){\n let circle = GOval(x - radius,y - radius,2 * radius,2 * radius);\n circle.setColor(color);\n circle.setFilled(true);\n return circle;\n }", "function circle18(x, y, r){\n for(let a=0; a<1000; a++){\n context.beginPath()\n let rt = r * Math.pow(Math.random(), 1/4)\n let theta = Math.random() * Math.PI * 2\n const xoff = Math.cos(theta) * rt + x\n const yoff = Math.sin(theta) * rt + y\n context.arc(xoff, yoff, 10, 0, 2 * Math.PI)\n context.stroke()\n }\n}", "constructor (position, speed, radius, color) {\n this.position = position;\n this.speed = speed;\n this.radius = radius;\n this.color = color;\n this.imgX = this.position.x - this.radius;\n }", "function createCircle() {\n $.get(\"/shape/circle\", function (data, status) {\n var obj = JSON.parse(data);\n app.drawCircle(obj.loc,obj.radius,obj.color);\n }, \"json\");\n}", "function Circle(x, y, dx, dy, radius, minimumRadius) {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n this.radius = radius;\n this.minimumRadius = radius;\n this.color = colors[Math.round(Math.random() * colors.length - 1)];\n\n this.draw = function () {\n c.beginPath(); //need to have this beginPath to prevent the begin point connect to the previous\n c.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);\n c.fillStyle = this.color;\n // c.fillStyle = colors[Math.round(Math.random()*colors.length - 1)] //randomize the color, but this will blink\n c.fill();\n };\n\n this.update = function() {\n this.x = this.x + this.dx;\n this.y = this.y + this.dy;\n c.beginPath();\n c.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);\n\n if (this.x > innerWidth - this.radius || this.x < 0 + this.radius) {\n this.dx = -this.dx;\n };\n if (this.y > innerHeight - this.radius || this.y < 0 + this.radius) {\n this.dy = -this.dy;\n };\n\n //interactivity\n if (mouse.x - this.x < 50 && mouse.x - this.x > -50 && mouse.y - this.y < 50 && mouse.y - this.y > -50) {\n if(this.radius < maximumRadius){\n this.radius += 1;\n }\n } else if (this.radius > this.minimumRadius) {\n this.radius -= 1;\n } //make sure the circle have a distance from the mouse x horizontally and vertically\n //and make sure they are within the maximum and minimum radius range;\n\n this.draw();\n }\n\n}", "function drawCircle(context){\r\n\tconsole.log(\"drawing circles\");\r\n\tfor(i = 0; i < circles.length; i++){\r\n\t\tcontext.beginPath();\r\n\t\tvar x = circles[i].xCenter;\r\n\t\tvar y = circles[i].yCenter;\r\n\t\tvar radius = circles[i].radius;\r\n\t\tconsole.log(\"drawing a circle at (\" + x + \", \" + y + \") with radius\" + radius);\r\n\t\tcontext.arc(x, y, radius, 0, 2*Math.PI);\r\n\t\tcontext.stroke();\r\n\t}\r\n}", "function createCircle(radius) {\n let c = {\n radius,\n draw: function() {\n console.log(\"draw\");\n }\n };\n return c;\n}", "createParticle() {\n noStroke();\n fill('rgba(200,169,169,1)');\n circle(this.x,this.y,this.r);\n }", "function Circle(radius) {\n this.radius = radius;\n}", "function SequentialCircles(radius) {\n const gap = 10;\n const arr = generateRadius(radius, 5);\n // console.log(arr, 'arr');\n\n this.paths = {};\n\n let y = gap;\n for (const r of arr) {\n // console.log(r, 'r');\n const circle = new makerjs.paths.Circle([0, y + r], r);\n y += 2 * r + gap;\n this.paths['circle_' + r] = circle;\n }\n}", "function Circle(radius) {\n this.radius = radius; \n}", "function newCircle() {\n x = random(windowWidth);\n y = random(windowHeight);\n r = random(255);\n g = random(255);\n b = random(255);\n}", "constructor(x = 0, y = 0, vx = 0, vy = 0, theta = 0, av = 0, pts = f.geometry.shape.square(), circles = [], density = 1, springConstant = .5) {\n super(x, y, vx, vy, theta, av, pts, circles, density);\n }", "function printCircles(){ /**This function prints out all the coloured circles to the screen*/\r\n\tfor(let i=0;i<colors.length;i++){\r\n\t\tlet obj = new Circles(colors[i],prices[i]);\r\n\t\tobj.drawCircle('#circles');\r\n\t\tColorObj[i]=obj;\r\n\t}\r\n}", "function createCircle(radius){\n return {\n radius, \n draw: function(){\n console.log('draw')\n }\n }\n}" ]
[ "0.8012867", "0.7532649", "0.72093153", "0.71758884", "0.71456313", "0.7104973", "0.7095474", "0.70853734", "0.7039927", "0.7023612", "0.7003312", "0.6963377", "0.69378877", "0.68887025", "0.6850711", "0.6844003", "0.6842291", "0.67999196", "0.67995", "0.6793498", "0.6775934", "0.67489004", "0.6742083", "0.6732291", "0.67272294", "0.6720192", "0.671921", "0.6671766", "0.665379", "0.6653453", "0.663947", "0.6636374", "0.6630318", "0.66285634", "0.66285634", "0.66241974", "0.66241974", "0.6623866", "0.6621931", "0.6618938", "0.66069007", "0.6606692", "0.6606486", "0.65875804", "0.6578698", "0.6578698", "0.65763557", "0.6576249", "0.65756214", "0.656783", "0.6566398", "0.65516883", "0.6545169", "0.65406716", "0.6534342", "0.65278596", "0.6523553", "0.651197", "0.65113926", "0.6509633", "0.65078366", "0.64942753", "0.6491369", "0.6486517", "0.6480341", "0.6479201", "0.6478314", "0.6472641", "0.64726114", "0.6468854", "0.6459959", "0.64451677", "0.6440566", "0.64394426", "0.6436", "0.6434036", "0.6429132", "0.64289767", "0.6428219", "0.6428176", "0.64281225", "0.6423118", "0.6422271", "0.6420602", "0.6420016", "0.6413155", "0.64047194", "0.6392091", "0.6387377", "0.6379619", "0.6378939", "0.6377017", "0.63750744", "0.6370385", "0.63628596", "0.63599664", "0.63587767", "0.63575673", "0.6357071", "0.63569796" ]
0.7532618
2
Function to draw the background
function draw() { //Create the gradient var grad = ctx.createLinearGradient(0, 0, W, H); grad.addColorStop(0, 'rgb(19, 105, 168)'); grad.addColorStop(1, 'rgb(0, 0, 0)'); //Fill the canvas with the gradient ctx.globalCompositeOperation = "source-over"; ctx.fillStyle = grad; ctx.fillRect(0,0,W,H); //Fill the canvas with the circles for(var j = 0; j < circles.length; j++) { var c = circles[j]; //Draw the circle and it with the blur grad ctx.beginPath(); ctx.globalCompositeOperation = "lighter"; ctx.fillStyle = grad; ctx.arc(c.x, c.y, c.r, Math.PI*2, false); ctx.fill(); //Lets use the velocity now c.x += c.vx; c.y += c.vy; //To prevent the circles from moving out of the canvas if(c.x < -50) c.x = W+50; if(c.y < -50) c.y = H+50; if(c.x > W+50) c.x = -50; if(c.y > H+50) c.y = -50; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawBackground() {\n\t// Draw the background\n\tcolorRect(0, 0, canvas.width, canvas.height, '#333');\n}", "function drawBackground() {\n ctx.fillStyle = COLOR_BACKGROUND;\n ctx.fillRect(0, 0, width, height);\n}", "function Background() {\n\tctx.beginPath();\n\tctx.rect(0, 0, 1140, 600);\n\tctx.fillStyle = \"black\";\n\tctx.fill();\n}", "drawbackground(){\n CTX.fillStyle = \"#41f459\";\n CTX.fillRect(this.x,this.y, this.width, this.height);\n\n\n }", "function drawBackground() {\n\tcontext.save();\n\tcontext.fillStyle = \"#f0f0ff\";\n\tcontext.fillRect(0, 0, canvas.width, canvas.height);\n\tcontext.translate(0, canvas.height - 50);\n\tcontext.fillStyle = \"#007f00\";\n\tcontext.fillRect(0, 0, canvas.width, 50);\n\tcontext.restore();\n}", "drawBackground() {\n this.cxt.fillStyle = '#FFE5CE'\n this.cxt.fillRect(0, 0, this.width, this.height)\n }", "function drawBackground() {\n context.fillStyle = \"gray\";\n context.fillRect(0, 0, canvas.width, canvas.height);\n}", "function drawBackground() {\r\n context.drawImage(backgroundCanvas, 0, 0);\r\n }", "backgroundDisplay() {\n push();\n rectMode(CORNER);\n noStroke();\n fill(this.color);\n rect(this.x, this.y, this.width, this.height);\n pop()\n }", "function drawBG()\n{\n ctx.beginPath();\n ctx.rect(0, 0, DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);\n ctx.fillStyle = '#333'; // Gray\n ctx.fill();\n}", "function drawBackground() {\n //drawShadow(); //drawDog shadow beneath dog first\n context.fillStyle = BG_COLOR;\n context.fillRect(0, 0, WIDTH, 500); //wipe picture above shadow\n context.fillStyle = '#83B799';\n context.fillRect(0, 500, WIDTH, 2); //drawDog horizontal ground line\n}", "function drawBackground() {\n // draw 3x3 copies of the background, offset by the position\n const xOffset = ((x % background.width) + background.width) % background.width;\n const yOffset = ((y % background.height) + background.height) % background.height;\n for (let xPos = -xOffset; xPos < canvas.width; xPos += background.width) {\n for (let yPos = -yOffset; yPos < canvas.height; yPos += background.height) {\n ctx.drawImage(background, xPos, yPos);\n }\n }\n}", "function draw() {\n background(\"#222831\");\n}", "_drawBackground() {\n const { x, y, width, height } = this.config;\n this._background = this.scene.add.rectangle( x, y, width, height,\n this.config.backgroundColor );\n this._background.setOrigin( 0, 0 );\n }", "background(lib){\n lib.moveTo(lib.width/2,lib.height/2);\n lib.penColor(\"black\");\n lib.dot(500);\n }", "function drawBackGround() {\n\t//for (let i = 0; i < 14; i++) {\n\t//\tfor (let j = 0; j < 10; j++) {\n\t//\t\tcontext.drawImage(bg, 64*i, 64*j);\n\t//\t}\n\t//}\n\tcontext.drawImage(bg, 0, 0,800,600);\n\n}", "drawBackground() {\n const width = this.canvas.width;\n const height = this.canvas.height;\n const radius = this.getBorderRadius();\n this.context.fillStyle = this.getBackgroundColor();\n this.context.beginPath();\n this.context.moveTo(radius, 0);\n this.context.arcTo(width, 0, width, radius, radius);\n this.context.arcTo(width, height, width - radius, height, radius);\n this.context.arcTo(0, height, 0, height - radius, radius);\n this.context.arcTo(0, 0, radius, 0, radius);\n this.context.fill();\n }", "function draw() {\n background(220);\n}", "function draw() {\n background(204, 153, 0);\n}", "function draw(){\r\n background(\"white\");\r\n \r\n \r\n \r\n}", "function drawBackground() {\n var STEP_Y = 12,\n TOP_MARGIN = STEP_Y*4,\n LEFT_MARGIN = 35,\n i = context.canvas.height;\n \n context.save();\n\n context.strokeStyle = 'lightgray';\n context.lineWidth = 0.5;\n\n while(i > TOP_MARGIN) { // Draw horizontal lines from bottom up\n context.beginPath();\n context.moveTo(0, i);\n context.lineTo(context.canvas.width, i);\n context.stroke();\n i -= STEP_Y;\n }\n\n // Draw vertical line\n context.strokeStyle = 'rgba(100,0,0,0.3)';\n context.lineWidth = 1;\n\n context.beginPath();\n context.moveTo(LEFT_MARGIN, 0);\n context.lineTo(LEFT_MARGIN, context.canvas.height);\n context.stroke();\n\n context.restore();\n}", "function drawBackground() {\n\tcanvasContext.fillStyle = 'black';\n\tcanvasContext.fillRect(0, 0, GAME_WIDTH, GAME_HEIGHT);\n}", "function draw() {\n\tbackground(0, 0, 255); // blue background\n}", "function drawBackground() {\n // Wasser\n L10_Canvas.crc2.fillStyle = \"#3686e1\";\n L10_Canvas.crc2.fillRect(0, 0, 600, 800);\n // Stein\n L10_Canvas.crc2.fillStyle = \"#768b99\";\n L10_Canvas.crc2.beginPath();\n L10_Canvas.crc2.moveTo(0, 480);\n L10_Canvas.crc2.quadraticCurveTo(320, 450, 350, 650);\n L10_Canvas.crc2.lineTo(0, 600);\n L10_Canvas.crc2.stroke();\n L10_Canvas.crc2.fill();\n // Sand\n L10_Canvas.crc2.fillStyle = \"#ae8f58\";\n L10_Canvas.crc2.beginPath();\n L10_Canvas.crc2.moveTo(0, 600);\n L10_Canvas.crc2.quadraticCurveTo(150, 550, 300, 600);\n L10_Canvas.crc2.quadraticCurveTo(450, 650, 600, 600);\n L10_Canvas.crc2.lineTo(600, 800);\n L10_Canvas.crc2.lineTo(0, 800);\n L10_Canvas.crc2.fill();\n }", "function drawBackground() {\n var STEP_Y = 12,\n i = context.canvas.height;\n \n context.strokeStyle = 'rgba(0,0,200,0.225)';\n context.lineWidth = 0.5;\n\n context.save();\n context.restore();\n\n while(i > STEP_Y*4) {\n context.beginPath();\n context.moveTo(0, i);\n context.lineTo(context.canvas.width, i);\n context.stroke();\n i -= STEP_Y;\n }\n\n context.save();\n\n context.strokeStyle = 'rgba(100,0,0,0.3)';\n context.lineWidth = 1;\n\n context.beginPath();\n\n context.moveTo(35,0);\n context.lineTo(35,context.canvas.height);\n context.stroke();\n\n context.restore();\n}", "function draw() {\n // Place your drawing code here \n background('black');\n \n image(bg, bgX, 0, bgWidth, bgHeight);\n image(bg, bgX + bgWidth, 0, bgWidth, bgHeight);\n \n// noFill();\n// stroke('white');\n// strokeWeight(3);\n// rect(bgX, 0, bgWidth, bgHeight);\n// rect(bgX + bgWidth, 0, bgWidth, bgHeight);\n \n bgX -= 5;\n if (bgX < -bgWidth) {\n bgX = 0; \n }\n \n}", "function drawBG() {\n\tsetBG('#00B2EE');\n\tdrawGrid(16);\n\tlet i;\n\tfor (i = 0; i < levelWidth; i++) {\n\t\tdrawTile(tiles[0], i * 16, canvas.height - 16, 0);\n\t}\n\tdecorateBG();\n}", "function background(){\n //background\n ctx.fillStyle = '#000000';\n ctx.fillRect(0, 0, width, height);\n //grid of dots\n ctx.fillStyle = '#AAAAAA';\n for(var h = 50; h < height; h += 50){\n for(var w = 50; w < width; w += 50){\n drawDot(w, h);\n }\n }\n}", "drawBackground(ctx) {\n if (this.background) {\n if (!ctx) {\n this.background.draw(this.ctx)\n } else {\n this.background.draw(ctx)\n }\n }\n }", "function createBackground(ctx){\n ctx.clearRect(0, 30, 400, 600);\n ctx.fillStyle = bgColour;\n ctx.fillRect(0, 30, 400, 600);\n}", "function drawBackground() {\n\n // first clear the the whole canvas\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n // this will generate the main gradient (main-light) of wallpaper\n let mainGrd = ctx.createRadialGradient(\n canvas.width / 2, rndNum(-85, -100), 1,\n canvas.width / 2, canvasMax / 4, canvasMin * 1.8);\n mainGrd.addColorStop(.4, \"#1a0003\");\n mainGrd.addColorStop(0, \"#d58801\");\n\n // after creating the gradient and set it colors,\n // we should set it as the fillStyle of the context and\n // paint whole canvas\n ctx.fillStyle = mainGrd;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n}", "function drawBackground(chart) {\n\t\tvar background = chart.rect(\n\t\t\twidth,\n\t\t\theight\n\t\t);\n\t\tbackground.move(\n\t\t\tleft,\n\t\t\ttop\n\t\t);\n\t\tbackground.attr({\n\t\t\t\"opacity\": \"0\"\n\t\t});\n\n\t\treturn background;\n\t}", "function drawBackground(){\n ctx = myGameArea.context;\n //clear canvas\n ctx.clearRect(0, 0, 6656, 468);\n backgroundImg.draw();\n \n }", "drawBg() {\n let ctx = this.bgCanvas.getContext(\"2d\");\n // important: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/clearRect\n // using beginPath() after clear() prevents odd behavior\n ctx.beginPath();\n ctx.fillStyle = \"white\";\n ctx.lineStyle = \"black\";\n ctx.lineWidth = 1;\n\n // white rectangle for background\n ctx.fillRect(0, 0, this.canvasWidth, this.canvasHeight);\n }", "function drawBackground() {\n var background = new Image();\n background.src = \"plain-bg2.png\";\n background.onload = function() {\n ctx.drawImage(background,0,0,canvas.width, canvas.height)};\n}", "function draw_background() {\n\t// fills background\n\tbackground(colors.bg);\n\t// draws golden quadrilateral\n\tnoStroke();\n\tfill(colors.bg_quad);\n\tquad(Math.floor(width / 3), 0, width, Math.floor(height / 3), \n\t\tMath.floor(width / 3 * 2), height, 0, Math.floor(height * .55));\n\n\t// fills in top left w/ custom shape to shape the side of the quadrilateral into a curve\n\tfill(colors.bg_dark);\n\tbeginShape();\n\tvertex(0, 0);\n\tvertex(Math.floor(width / 3), 0);\n\t// temporary variable for computing coordinates of vertices for easy input\n\tlet v = [{x: Math.floor(width * .2), y: Math.floor(height * .2)}, \n\t\t{x: Math.floor(width * .25), y: width * .4}, {x: 0, y: Math.floor(height * .55)}];\n\tbezierVertex(v[0].x, v[0].y, v[1].x, v[1].y, v[2].x, v[2].y);\n\tendShape();\n\n\t// fills in top right w/ custom shape to shape other side of quadrilateral\n\tbeginShape();\n\tvertex(Math.floor(width / 3), 0);\n\tvertex(width, 0);\n\tvertex(width, height / 3);\n\tv = [{x: Math.floor(width * .8), y: Math.floor(height * .28)}, \n\t\t{x: Math.floor(width * .55), y: Math.floor(height * .2)}, {x: Math.floor(width / 3), y: 0}];\n\tbezierVertex(v[0].x, v[0].y, v[1].x, v[1].y, v[2].x, v[2].y);\n\tendShape();\n}", "function drawBackground() {\n // sky\n skyTop.tesselate(HORIZONTAL, 0);\n skyBackground.tesselate(HORIZONTAL, skyTop.height);\n\n // grass blades\n groundHeight = HEIGHT - grass.height * 2;\n for (var pos in grassBladePositions) {\n grassBlade = grassBladePositions[pos];\n grassBlade.draw(pos * grassBlade.width,\n groundHeight - grassBlade.height);\n }\n\n // ground\n grass.tesselate(HORIZONTAL, groundHeight);\n stone.tesselate(HORIZONTAL, groundHeight + grass.height);\n // drawTesselation(stone, HORIZONTAL, lowestHeight);\n}", "function showBackground() {\n\n clearGameBoard();\n var background = new Image();\n background.src = 'images/background05.png';\n ctx.drawImage(background, 0, 0, game.width, game.height);\n\n var fontSize = game.width * 0.025;\n ctx.font = fontSize+'pt Calibri';\n\n if (game.width >= 768) {\n ctx.lineWidth = 3.3;\n } else {\n ctx.lineWidth = 1.5;\n }\n \n // stroke color\n ctx.strokeStyle = 'yellow';\n \n ctx.shadowColor = \"rgba(0,0,0,0.3)\";\n\n if (game.width >= 768) {\n ctx.strokeText('Space Invaders', game.width/2 - (fontSize*5), fontSize + 10);\n } else {\n ctx.strokeText('Space Invaders', 160, 15);\n }\n \n\n }", "setupBackground() {\n this.bgRect = new paper.Path.Rectangle(new paper.Point(), view.size);\n this.bgRect.fillColor = this.backgroundColor;\n this.bgRect.sendToBack();\n }", "function bg(ctx) {\n\tctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n\tctx.fillStyle = '#1c1c1c';\n\tfor (var x = -1; x < ctx.canvas.width + 1; x += cellSize) {\n\t\tctx.fillRect(x, 0, 2, ctx.canvas.height);\n\t}\n\tfor (var y = -1; y < ctx.canvas.height + 1; y += cellSize) {\n\t\tctx.fillRect(0, y, ctx.canvas.width, 2);\n\t}\n}", "function drawBackround(){\n ctx.fillStyle = 'rgb(148,229,255)';\n ctx.fillRect(\n 0,\n 0,\n WIDTH,\n HEIGHT\n );\n}", "drawBackground(ctx) {\n this.drawHorizonGradient(ctx);\n if(this.moon !== undefined) {\n this.moon.draw(ctx);\n } else {\n this.sun.draw(ctx);\n }\n this.drawTrees(ctx);\n }", "draw() {\n // Displaying the background\n image(hubImage, 0, 0, width, height);\n }", "function draw_background(graphics_context, color = \"white\")\n{\n\tgraphics_context.save();\n\n\tgraphics_context.fillStyle = color;\n\tgraphics_context.fillRect\n\t(\n\t\t0, 0,\n\t\tgraphics_context.canvas.width,\n\t\tgraphics_context.canvas.height\n\t);\n\n\tgraphics_context.restore();\n}", "function DrawBackground(){\n\n // draw the background\n ctx.fillStyle = trial.background_colour;\n ctx.fillRect(0, 0, trial.canvas_dimensions[0], trial.canvas_dimensions[1]);\n\n // draw the progress text\n ctx.font = \"28px Arial\";\n ctx.fillStyle = \"white\";\n ctx.textAlign = \"center\";\n var info_text = \"Block \" + counter.block + \" of \" + counter.n_blocks + \", Trial \" + counter.trial + \" of \" + trial.n_trials;\n ctx.fillText(info_text, trial.canvas_dimensions[0]/2, 3* ctx.measureText('M').width/2);\n\n\n }", "drawBg() {\n let g = this,\n cxt = g.context,\n sunnum = window._main.sunnum,\n cards = window._main.cards,\n img = imageFromPath(allImg.bg);\n cxt.drawImage(img, 0, 0);\n sunnum.draw(cxt);\n }", "function background(col){\r\n ctx.fillStyle = col;\r\n return ctx.fillRect(0,0,creation.width,creation.height);\r\n}", "function backgroundGradient() {\n if (ball.x < width) {\n push();\n colorMode(HSB,255);\n background(map(ball.x,0,width,0,255),180,200);\n pop();\n }\n}", "function setBackground()\n{\n canvas.style.backgroundColor = 'rgb(' + [paintColor[0],paintColor[1],paintColor[2]].join(',') + ')';\n}", "function draw() {\n background(0);\n}", "function draw() {\n background(0);\n}", "drawGradientBackground() {\n const grd = this.ctx.createLinearGradient(0, 0, this.width, this.height);\n grd.addColorStop(0, '#333333');\n grd.addColorStop(1, '#000000');\n this.ctx.fillStyle = grd;\n this.ctx.fillRect(0, 0, this.width, this.height);\n }", "function updateBackground(){\n gameWorld.ctx.fillStyle = \"rgb(0,0,0)\";\n gameWorld.ctx.fillRect(0, 0, gameWorld.canvas.width, gameWorld.canvas.height);\n}", "function draw() {\n background(240);\n drawTarget();\n}", "function drawFrame(perc) {\n background(backColor);\n}", "function drawBackgrounds() {\n for (i = 0; i < 3; i++) {\n addBackgroundObject('./img/background/03_farBG/Completo.png', bg_elem_3_x + i * 1726, -110, 0.45); //far away background layer\n }\n\n for (j = 0; j < 6; j++) {\n addBackgroundObject('./img/background/02_middleBG/completo.png', bg_elem_2_x + j * 1050, 70, 0.28); //middle distanced background layer\n }\n\n for (k = 0; k < 10; k++) {\n addBackgroundObject('./img/background/01_nearBG/completo.png', bg_elem_1_x + k * 960, -30, 0.45); //nearest background layer\n }\n}", "function paintBG(ctx, color, dim) {\n\tctx.beginPath();\n\tctx.fillStyle = color;\n ctx.fillRect(0,0,dim[0],dim[1]);\n\tctx.closePath();\t\n}", "function draw() {\n drawbackground();\n drawHoles();\n }", "draw_background(){\n this.svg.append('rect')\n .attr(\"class\", \"timeline-bg\")\n .attr('y', `${this.label_height - 5}`)\n .attr('x', -5)\n .attr('width', `${this.WIDTH}`)\n .attr('height', '100%')\n }", "generateBg() {\n this.addChild(BgContainer.generateRect());\n }", "function Background() {\n this.x = 0;\n this.y = 0;\n this.w = bg.width;\n this.h = bg.height;\n this.render = function () {\n context.drawImage(bg, this.x--, 0);\n if(this.x <= -499){\n this.x = 0;\n }\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}", "function createBackground(){\n\t\tvar bg = createSquare(stageWidth, stageHeight, 0, 0, null, Graphics.getRGB(0,0,0,0));\n\t\tstage.addChild( bg );\n\t\tupdate = true;\n\t}", "function drawBackground(canvas, settings) {\n const ctx = canvas.getContext(\"2d\");\n ctx.fillStyle = settings.colours.bg;\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n}", "function drawBackground() {\n let randomNumber = Math.floor(Math.random() * 3);\n if (randomNumber == 2) {\n bgColor = \"whitesmoke\";\n }\n else {\n bgColor = \"black\";\n }\n crc2.fillStyle = bgColor;\n crc2.fillRect(0, 0, crc2.canvas.width, crc2.canvas.height);\n }", "function drawBackground(w,h,color= '#000000', width=1,style = 'solid'){\n if(this.background){\n this.removeChild(this.background);\n }\n var background = new PIXI.Graphics();\n const {hex,alpha} = parseColor(color);\n background.beginFill(hex,alpha)\n // drawBackground.lineStyle(width,parseColor(color))\n background.drawRect(\n 0,\n 0,\n w,\n h\n );\n background.endFill();\n this.background = background;\n this.addChildAt(background,0)\n }", "redrawBg() {\n this.clearBg();\n this.drawBg();\n }", "function drawBackground(W,H) {\n\t\tvar colors = currentColors;\n\n\t\tif(bgCanvas === null) {\n\t\t\tvar myCanvasElement = $scope.theView.parent().find('#theBgCanvas');\n\t\t\tif(myCanvasElement.length > 0) {\n\t\t\t\tbgCanvas = myCanvasElement[0];\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//$log.log(preDebugMsg + \"no canvas to draw on!\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tif(bgCtx === null) {\n\t\t\tbgCtx = bgCanvas.getContext(\"2d\");\n\t\t}\n\n\t\tif(!bgCtx) {\n\t\t\t//$log.log(preDebugMsg + \"no canvas to draw bg on\");\n\t\t\treturn;\n\t\t}\n\n\t\tbgCtx.clearRect(0,0, W,H);\n\n\t\tif(colors.hasOwnProperty(\"skin\")) {\n\t\t\tvar drewBack = false;\n\t\t\tif(colors.skin.hasOwnProperty(\"gradient\") && W > 0 && H > 0) {\n\t\t\t\tvar OK = true;\n\t\t\t\tvar grd = bgCtx.createLinearGradient(0,0,W,H);\n\t\t\t\tfor(var i = 0; i < colors.skin.gradient.length; i++) {\n\t\t\t\t\tvar cc = colors.skin.gradient[i];\n\t\t\t\t\tif(cc.hasOwnProperty('pos') && cc.hasOwnProperty('color')) {\n\t\t\t\t\t\tgrd.addColorStop(cc.pos, cc.color);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tOK = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(OK) {\n\t\t\t\t\tbgCtx.fillStyle = grd;\n\t\t\t\t\tbgCtx.fillRect(0,0,W,H);\n\t\t\t\t\tdrewBack = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!drewBack && colors.skin.hasOwnProperty(\"color\")) {\n\t\t\t\tbgCtx.fillStyle = colors.skin.color;\n\t\t\t\tbgCtx.fillRect(0,0,W,H);\n\t\t\t\tdrewBack = true;\n\t\t\t}\n\n\t\t\tif(colors.skin.hasOwnProperty(\"border\")) {\n\t\t\t\tbgCtx.fillStyle = colors.skin.border;\n\t\t\t\tbgCtx.fillRect(0,0, W,1);\n\t\t\t\tbgCtx.fillRect(0,H-1, W,H);\n\t\t\t\tbgCtx.fillRect(0,0, 1,H);\n\t\t\t\tbgCtx.fillRect(W-1,0, W,H);\n\t\t\t}\n\t\t}\n\t}", "function draw() {\n background(204, 231, 227)\n checkState();\n}", "function draw_bg() {\n title = ctx.drawImage(sprites, 13, 11, 321, 34, 0, 0, 399, 34);\n greenTop = ctx.drawImage(sprites, 0, 53, 399, 56, 0, 53, 399, 53);\n purpleTop = ctx.drawImage(sprites, 0, 117, 399, 37, 0, 272, 399, 37);\n\tpurpleBot = ctx.drawImage(sprites, 0, 117, 399, 37, 0, 473, 399, 37);\n}", "function Background(x, y, width, height, color) {\n this.x = x; this.y = y; \n this.width = width; this.height = height;\n this.color = color;\n\n // Draw background image to given canvas context\n this.draw = function(surface) {\n surface.beginPath();\n surface.fillStyle = this.color;\n surface.fillRect(this.x, this.y, this.width, this.height);\n }\n }", "function draw() {\n background(10,0,40);\n environment.draw()\n}", "playbackground1() {\r\n background(\"white\");\r\n\r\n //giving the background image details\r\n background(background_image_one);\r\n\r\n //displaying the variables\r\n\r\n \r\n ground.display();\r\n // drawSprites();\r\n\r\n \r\n \r\n \r\n }", "_setBackgroundLayerStyles() {\n this.b.fillStyle = \"white\";\n this.b.fillRect(0, 0, WORLD.WIDTH, WORLD.HEIGHT);\n }", "function drawBackgroundSquares() {\n for (var index = 0; index < self.allBackgroundSquares.length; index++) {\n var square = self.allBackgroundSquares[index];\n self.draw.fillStyle = square.color;\n self.draw.fillRect(square.x, square.y, square.width, square.height);\n }\n }", "function drawBackground(){\n ctx.drawImage(space, 0, 0, canvas.width, canvas.height);\n switch(levelnum){\n case 0:\n //Free Flight\n ctx.drawImage(freeflightground, 0,canvas.height-25,canvas.width,25);\n break;\n case 1:\n //Mercury\n ctx.drawImage(mercuryground, 0,canvas.height-25,canvas.width,25);\n break;\n case 2:\n //Venus\n ctx.drawImage(venusground, 0,canvas.height-25,canvas.width,25);\n break;\n case 3:\n //Moon\n ctx.drawImage(moonground, 0,canvas.height-25,canvas.width,25);\n break;\n case 4:\n //Mars\n ctx.drawImage(marsground, 0,canvas.height-25,canvas.width,25);\n break;\n case 5:\n //Ganymede\n ctx.drawImage(ganymedeground, 0,canvas.height-25,canvas.width,25);\n break;\n case 6:\n //Titan\n ctx.drawImage(titanground, 0,canvas.height-25,canvas.width,25);\n break;\n case 7:\n //Uranus\n ctx.drawImage(uranusground, 0,canvas.height-25,canvas.width,25);\n break;\n case 8:\n //Neptune\n ctx.drawImage(neptuneground, 0,canvas.height-25,canvas.width,25);\n break;\n case 9:\n //Black Hole\n break;\n default:\n //Not recognised\n ctx.drawImage(freeflightground, 0,canvas.height-25,canvas.width,25);\n break;\n }\n //bonus landing area\n if (levelnum != 0 && levelnum != 9){\n ctx.fillStyle = \"#00F\";\n ctx.fillRect(800,(canvas.height/2)+300, 100, 10);\n }\n}", "create() {\n let background = this.add.image(0, 0, 'background');\n background.displayOriginX = 0;\n background.displayOriginY = 0;\n background.displayWidth = this.sys.canvas.width;\n background.displayHeight = this.sys.canvas.height;\n }", "function drawSky() {\n\n addBackgroundobject('./img/background/sky.png', 0, 0, -80, 0.5);\n\n}", "function makeBackground(){\n\timg = createImage(width, height);\n\n\timg.loadPixels();\n\tlet xoff = 0;\n\tfor (let i = 0; i < width; i++){\n\n\t\tlet yoff = 0;\n\n\t\tfor (let j = 0; j<height; j++){\n\n\t\t\tlet col = map(noise(xoff, yoff), 0,1,0,255);\n\t\t\timg.set(i, j, color(col, 0, col));\n\n\n\t\t\tyoff+=0.01;\n\n\t\t}\n\t\txoff+=0.01;\n\t}\n\timg.updatePixels();\n}", "function createBackground() {\r\n var background = this.add.image(256, 256, \"background\");\r\n background.setScale(2.2, 2.5);\r\n}", "function drawbg() {\n\tpalset = curbg;\n\tloadRomPal();\n\n\tvar bf = new bytebuffer(romFrameData);\n\tvar bf2 = new bytebuffer(romFrameData);\n\tvar bf3 = new bytebuffer(romFrameData);\n\tctxBack.clearRect(0, 0, canvasBack.width, canvasBack.height);\n\t\n\tlet bigindex = bf.getInt(0x1DE0A + curbg * 4);\n\t\n\tvar imageData = ctxBack.createImageData(gridWidth, gridHeight);\n\n\tvar height = 2;\n\tbf3.position(bigindex);\n\t\n\tlet startscr=0;\n\n\tlet w = mapdata[curbg][0];\n\tlet h = mapdata[curbg][1];\n\n\tbf3.skip(mapdata[curbg][3] * w * 2);\n\tbf3.skip(mapdata[curbg][2] * 2);\n\tbf3.skip(bgAddressSkip * 2);\n\tfor(let scr=0;scr<6;scr++) {\n\t\t\n\t\tif(scr == 2 || scr == 4) {\t// jump to next row\n\n\t\t\tif(h <= scr / 2) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbf3.skip((w - 2) * 2);\n\t\t}\n\t\tlet scrTile = bf3.getShort();\n\t\t\n\t\tlet scrx = (scr % 2) * 256;\n\t\tlet scry = (scr >> 1) * 256;\n\n\t\tbf.position(bgAddress + (scrTile << 10));\n\t\n\t\tfor(let i=0;i<16;i++) {\n\t\t\tfor(let j=0;j<16;j++) {\n\t\t\t\t\t\t\n\t\t\t\tlet tile = bf.getShort() + 0x6800;\n\t\t\t\tlet flag = bf.get();\n\t\t\t\tlet pal = bf.get();\n\t\t\t\tif(hideBackground) {\t// hide background based on flag and color, 0x10 maybe the switch\n\t\t\t\t\tlet hide = flag & 0xF;\n\t\t\t\t\tif((pal & 0x80) == 0)\n\t\t\t\t\t\thide = 16;\n\t\t\t\t\tdrawTilesBase(imageData, tile, 1, 1, (pal & 0x1F) + 0x40, 16, false, (pal & 0x40), (pal & 0x20), hide);\n\t\t\t\t} else \n\t\t\t\t\tdrawTilesBase(imageData, tile, 1, 1, (pal & 0x1F) + 0x40, 16, false, (pal & 0x40), (pal & 0x20));\n\t\t\t\tctxBack.putImageData(imageData, scrx + (i)%32 * gridHeight, scry + (j) * gridWidth);\n\t\t\t}\n\t\t}\n\t}\n\n}", "function Background() {\n\n // Implement abstract function draw\n this.draw = function() {\n this.context.drawImage(imageRepository.background, this.x, this.y);\n };\n}", "function drawBackground(W,H) {\n\t\tvar colors = $scope.gimme(\"GroupColors\");\n\t\tif(typeof colors === 'string') {\n\t\t\tcolors = JSON.parse(colors);\n\t\t}\n\n\t\tif(colors.hasOwnProperty(\"skin\")) {\n\t\t\tvar drewBack = false\n\t\t\tif(colors.skin.hasOwnProperty(\"gradient\")) {\n\t\t\t\tvar OK = true;\n\n\t\t\t\tvar grd = ctx.createLinearGradient(0,0,W,H);\n\t\t\t\tfor(var i = 0; i < colors.skin.gradient.length; i++) {\n\t\t\t\t\tvar cc = colors.skin.gradient[i];\n\t\t\t\t\tif(cc.hasOwnProperty('pos') && cc.hasOwnProperty('color')) {\n\t\t\t\t\t\tgrd.addColorStop(cc.pos, cc.color);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tOK = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(OK) {\n\t\t\t\t\tctx.fillStyle = grd;\n\t\t\t\t\tctx.fillRect(0,0,W,H);\n\t\t\t\t\tdrewBack = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!drewBack && colors.skin.hasOwnProperty(\"color\")) {\n\t\t\t\tctx.fillStyle = colors.skin.color;\n\t\t\t\tctx.fillRect(0,0,W,H);\n\t\t\t\tdrewBack = true;\n\t\t\t}\n\n\t\t\tif(colors.skin.hasOwnProperty(\"border\")) {\n\t\t\t\tctx.fillStyle = colors.skin.border;\n\t\t\t\tctx.fillRect(0,0, W,1);\n\t\t\t\tctx.fillRect(0,H-1, W,H);\n\t\t\t\tctx.fillRect(0,0, 1,H);\n\t\t\t\tctx.fillRect(W-1,0, W,H);\n\t\t\t}\n\t\t}\n\t}", "function createBackground() {\n\t\t\tbg = new createjs.Shape();\t\t\n\t\t\tstage.addChild(bg);\n \t}", "_draw_all(){\r\n\t\tthis._draw_bg();\r\n\t\tthis._draw_fg();\r\n\t}", "function draw() {\n background(255,0,0)\n rectMode(CENTER)\n rect(250.250,100,100)\n}", "function displayBg() \n{\n\tvar bg = new Image();\n\tbg.src = \"Images/background.jpg\";\n\tctx.drawImage(bg,minCanvasWidth,minCanvasHeight,maxCanvasWidth,maxCanvasHeight);\n}", "function drawBackground() {\n\n ctx.fillStyle = \"white\";\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n\n timePassedSinceHurt = new Date().getTime() - lastHurtStarted;\n timePassedSinceDead = new Date().getTime() - deadStarted;\n\n drawSky();\n drawHills();\n drawClouds();\n drawShadows();\n drawGround();\n}", "function drawBG() {\n magicalCanvas.crc2.clearRect(0, 0, magicalCanvas.canvas.width, magicalCanvas.canvas.height);\n if (day == true) {\n //sky\n magicalCanvas.crc2.fillStyle = \"skyblue\";\n magicalCanvas.crc2.fillRect(0, 0, magicalCanvas.canvas.width, magicalCanvas.canvas.height);\n //background\n magicalCanvas.crc2.fillStyle = \"limegreen\";\n magicalCanvas.crc2.strokeStyle = \"limegreen\";\n magicalCanvas.crc2.lineWidth = 2;\n magicalCanvas.crc2.beginPath();\n magicalCanvas.crc2.moveTo(0, magicalCanvas.canvas.height);\n magicalCanvas.crc2.lineTo(0, magicalCanvas.canvas.height - 50);\n magicalCanvas.crc2.quadraticCurveTo(magicalCanvas.canvas.width / 2, magicalCanvas.canvas.height - 250, magicalCanvas.canvas.width, magicalCanvas.canvas.height - 50);\n magicalCanvas.crc2.lineTo(magicalCanvas.canvas.width, magicalCanvas.canvas.height);\n magicalCanvas.crc2.closePath();\n magicalCanvas.crc2.fill();\n magicalCanvas.crc2.stroke();\n //foreground\n magicalCanvas.crc2.fillStyle = \"forestgreen\";\n magicalCanvas.crc2.strokeStyle = \"forestgreen\";\n magicalCanvas.crc2.beginPath();\n magicalCanvas.crc2.moveTo(0, magicalCanvas.canvas.height);\n magicalCanvas.crc2.lineTo(0, magicalCanvas.canvas.height - 150);\n magicalCanvas.crc2.bezierCurveTo(20, magicalCanvas.canvas.height - 150, 20, magicalCanvas.canvas.height - 20, magicalCanvas.canvas.width / 2, magicalCanvas.canvas.height - 20);\n magicalCanvas.crc2.bezierCurveTo(magicalCanvas.canvas.width - 20, magicalCanvas.canvas.height - 20, magicalCanvas.canvas.width - 20, magicalCanvas.canvas.height - 150, magicalCanvas.canvas.width, magicalCanvas.canvas.height - 150);\n magicalCanvas.crc2.lineTo(magicalCanvas.canvas.width, magicalCanvas.canvas.height);\n magicalCanvas.crc2.closePath();\n magicalCanvas.crc2.fill();\n magicalCanvas.crc2.stroke();\n }\n else {\n //sky\n magicalCanvas.crc2.fillStyle = \"#252D3F\";\n magicalCanvas.crc2.fillRect(0, 0, magicalCanvas.canvas.width, magicalCanvas.canvas.height);\n //background\n magicalCanvas.crc2.fillStyle = \"#142615\";\n magicalCanvas.crc2.strokeStyle = \"#142615\";\n magicalCanvas.crc2.lineWidth = 2;\n magicalCanvas.crc2.beginPath();\n magicalCanvas.crc2.moveTo(0, magicalCanvas.canvas.height);\n magicalCanvas.crc2.lineTo(0, magicalCanvas.canvas.height - 30);\n magicalCanvas.crc2.quadraticCurveTo(magicalCanvas.canvas.width / 2, magicalCanvas.canvas.height - 270, magicalCanvas.canvas.width, magicalCanvas.canvas.height - 30);\n magicalCanvas.crc2.lineTo(magicalCanvas.canvas.width, magicalCanvas.canvas.height);\n magicalCanvas.crc2.closePath();\n magicalCanvas.crc2.fill();\n magicalCanvas.crc2.stroke();\n }\n }", "function Background() {\n\tthis.speed = 1; // Redefine speed of the background for panning\n\t\n\t// Implement abstract function\n\tthis.draw = function() {\n\t\t// Pan background\n\t\tthis.x -= this.speed;\n\t\tthis.context.drawImage(imageRepository.background, this.x, this.y);\n\t\t\n\t\t// Draw another image at the top edge of the first image\n\t\tthis.context.drawImage(imageRepository.background, this.x + this.canvasWidth, this.y);\n\n\t\t// If the image scrolled off the screen, reset\n\t\tif (this.x <= -this.canvasWidth)\n\t\t\tthis.x = 0;\n\t};\n}", "function Background() {\n this.speed = 1; // Redefine speed of the background for panning\n // Implement abstract function\n this.draw = function() {\n // Pan background\n this.x -= this.speed;\n this.context.drawImage(imageRepository.background, this.x, this.y);\n // Draw another image at the top edge of the first image\n this.context.drawImage(imageRepository.background, this.x - this.canvasWidth, this.y);\n // If the image scrolled off the screen, reset\n if (this.x >= this.canvasWidth) {\n this.x = 0;\n }\n };\n}", "function drawBackground(width, height, color, x, y, type) {\n this.gamearea = gameArea;\n this.type = type;\n if (type == 'image' || type == 'background') {\n this.image = new Image();\n this.image.src = color;\n }\n this.width = width;\n this.height = height;\n this.speedX = 0;\n this.speedY = 0;\n this.x = x;\n this.y = y;\n this.update = function() {\n ctx = gameArea.context;\n if (type == 'image' || type == 'background') {\n ctx.drawImage(this.image,\n this.x,\n this.y,\n this.width, this.height);\n\n if (type == 'background') {\n ctx.drawImage(this.image,\n this.x + this.width,\n this.y,\n this.width, this.height);\n }\n }\n else {\n ctx.fillStyle = color;\n ctx.fillRect(this.x, this.y, this.width, this.height);\n }\n }\n this.newPos = function() {\n this.x += this.speedX;\n this.y += this.speedY;\n if (this.type == 'background') {\n if (this.x == -(this.width)) {\n this.x = 0;\n }\n }\n }\n this.clicked = function () {\n let myleft = this.x;\n let myright = this.x + (this.width);\n let mytop = this.y;\n let mybottom = this.y + (this.height);\n var clicked = true;\n if ((mybottom < gameArea.y) || (mytop > gameArea.y) || (myright < gameArea.x) || (myleft > gameArea.x)) {\n clicked = false;\n }\n return clicked;\n }\n}", "createBackground() {\n const canvas = document.getElementById(\"background\");\n const ctx = canvas.getContext(\"2d\");\n canvas.width = window.innerWidth;\n //save some space for the footer\n canvas.height = window.innerHeight;\n //clear previous canvas to avoid memory leaks\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n this.RED_OFFSET = Math.floor(Math.random() * (MAX_RED - MIN_RED)) + MIN_RED; \n this.GREEN_OFFSET = Math.floor(Math.random() * (MAX_GREEN - MIN_GREEN)) + MIN_GREEN; \n this.BLUE_OFFSET = Math.floor(Math.random() * (MAX_BLUE - MIN_BLUE)) + MIN_BLUE; \n //each overlapping layer will contain randomly drawn shapes and colors\n this.canvasLayers = new Array(NUM_LAYERS);\n //parameters that will be fed into the drawLayer on each iteration. These will be updated each time\n //we call the drawLayer function\n const step = Math.floor(window.width / this.canvasLayers.length);\n const parameters = {\n blue: 150,\n green: 155, \n red: 255,\n position: 0,\n step: step\n }\n\n for (let position = 0; position < this.canvasLayers.length; position++) {\n parameters.position = position;\n this.drawLayer(canvas, ctx, parameters);\n }\n\n this.drawClouds(canvas, ctx);\n this.drawSun(canvas, ctx);\n }", "function Background()\n{\n\tthis.speed = 1; // Redefine speed of the background for panning\n\t// Implement abstract function\n\tthis.draw = function()\n {\n\t\t// Pan background\n\t\tthis.y += this.speed;\n\t\tthis.context.drawImage(imageRepository.background, this.x, this.y);\n\t\t// Draw another image at the top edge of the first image\n\t\tthis.context.drawImage(imageRepository.background, this.x, this.y - this.canvasHeight);\n\t\t// If the image scrolled off the screen, reset\n\t\tif (this.y >= this.canvasHeight)\n\t\t\tthis.y = 0;\n\n\t};\n}", "initBackground() {\n\t\tthis.background = new createjs.Shape();\n\t\tthis.background.graphics.beginFill(\"black\").drawRect(0, 0, this.width, this.height);\n\t\tthis.background.x = 0;\n\t\tthis.background.y = 0;\n\t\tthis.stage.addChild(this.background);\n\t\t//this.updateStage();\n\t}", "function drawBackground() {\n\t\n\tif (backgroundImg.width >= canvas.width) {\n\t\t// If the image has fully passed through screen, reset x to default position and\n\t\t// draw again \n\t\tif (x <= -(backgroundImg.width + canvas.width)) \n\t\t{ \n\t\t\tx = -canvas.width;\n\t\t}\n\t\t\t\n\t\tif (x <= -(backgroundImg.width - canvas.width)) \n\t\t{ \n\t\t\t// Continuing to draw image if it's width runs out\n\t\t\tctx.drawImage(backgroundImg, (x + backgroundImg.width), 0, \n\t\t\tbackgroundImg.width, backgroundImg.height); \n\t\t}\n\t}\n\n\t// Drawing a new image from canvas.width\n\tctx.drawImage(backgroundImg, x, 0, backgroundImg.width, backgroundImg.height);\t\n\n\t// Amount for the x on image to move left each frame\n\tx -= xv;\t\n}", "function Background() {\n\n // Implement abstract function\n this.draw = function () {\n this.context.drawImage(imageRepository.background, this.x, this.y);\n };\n}", "animate(ctx){\n this.drawBackground(ctx);\n }", "function createBackground() {\n\tvar background = document.createElementNS($SVG_LIB, \"rect\");\n\tbackground.setAttribute(\"id\", \"background\");\n\tbackground.setAttribute(\"fill\", backgroundColor);\n\tbackground.setAttribute(\"height\", size * height);\n\tbackground.setAttribute(\"width\", size * width);\n\tdocument.getElementById(\"components\").appendChild(background);\n}", "background(r, g, b) {\n this.ctx.canvas.style.backgroundColor = getColorString(this.palette, r, g, b);\n }", "function draw(context) {\n context.drawImage(background, ofsetted_x, ofsetted_y);\n debug.do_draw('panels') && draw_debug(context);\n }" ]
[ "0.840327", "0.83144766", "0.8288564", "0.8146599", "0.81359756", "0.81241894", "0.80891436", "0.8056861", "0.802413", "0.8013045", "0.79130584", "0.78841805", "0.78572387", "0.78559095", "0.78409606", "0.78127265", "0.77953005", "0.7791962", "0.7768092", "0.77617973", "0.7738038", "0.77342945", "0.77248245", "0.77241486", "0.7712989", "0.76777774", "0.764632", "0.75916797", "0.75373816", "0.75309384", "0.7508517", "0.7503374", "0.74968505", "0.7478999", "0.7446551", "0.74352896", "0.7427754", "0.7424929", "0.7381953", "0.73799103", "0.7347159", "0.7341219", "0.7307525", "0.7274661", "0.72481024", "0.7234932", "0.7227836", "0.7122677", "0.70993006", "0.7094605", "0.7094605", "0.7089473", "0.7080205", "0.708018", "0.7079015", "0.70762545", "0.7066231", "0.70617986", "0.70501876", "0.70451623", "0.7041397", "0.70226234", "0.6999996", "0.69867986", "0.696276", "0.69625485", "0.6954444", "0.6949504", "0.6947391", "0.69445324", "0.6934798", "0.69335264", "0.6925623", "0.6919596", "0.6916067", "0.6912107", "0.690659", "0.6905616", "0.6903135", "0.6900676", "0.688", "0.68653226", "0.68524194", "0.68479335", "0.68332165", "0.68237644", "0.68102497", "0.6806546", "0.6785522", "0.6755144", "0.67523926", "0.67478704", "0.6743007", "0.6734922", "0.6730787", "0.6720739", "0.6720129", "0.67140764", "0.67115873", "0.6703872", "0.6692029" ]
0.0
-1
Filtrar por nombre y especie
function handleFilter(data) { if (data.key === "name") { return setFilterName(data.value); } else if (data.key === "species") { return setFilterSpecies(data.value); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function filtrarProd(){\nlet filtrado = productos.filter(prod => {\n \n return prod.nombre.toLowerCase().includes($(\"#txtFiltrar\").val().toLowerCase())\n})\nlistarProductos(filtrado)\n$(\"#txtFiltrar\").val(\"\")\n}", "function filtro() {\n let selectorSexo = document.getElementById(\"selectorSexo\");\n let inputNombre = document.getElementById(\"inombre\");\n\n const sexo = selectorSexo.value;\n const nombre = inputNombre.value.trim().toLowerCase();\n\n console.trace(`filtro sexo=${sexo} nombre=${nombre}`);\n console.debug(\"personas %o\", personas);\n\n //creamos una copia para no modificar el original\n let personasFiltradas = personas.map((el) => el);\n\n //filtrar por sexo, si es 't' todos no hace falta filtrar\n if (sexo == \"h\" || sexo == \"m\") {\n personasFiltradas = personasFiltradas.filter((el) => el.sexo == sexo);\n console.debug(\"filtrado por sexo %o\", personasFiltradas);\n }\n\n //filtrar por nombre buscado\n if (nombre != \" \") {\n personasFiltradas = personasFiltradas.filter((el) =>\n el.nombre.toLowerCase().includes(nombre)\n );\n console.debug(\"filtrado por nombre %o\", personasFiltradas);\n }\n\n maquetarLista(personasFiltradas);\n}", "function filtrar(value) {\n $(\".items\").filter(function () {\n $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);//SI ES DIFERENTE A -1 ES QUE ENCONTRO\n });\n}", "function filterNames() {\n //3.1. get value of filterInput and convert it to upper case for comparision\n let filterValue = filterInput.value.toUpperCase();\n\n //3.2. get ul containing all the names\n let nameList = document.querySelector('.list');\n\n //3.3. get all the names from the nameList in a array\n let namesArray = Array.from(nameList.querySelectorAll('.list__item'));\n\n //3.4. loop through namesArray to compare filterValue with the names in the namesArray\n for (let i = 0; i < namesArray.length; i++){\n //3.4.1. get currentname\n let currentname = namesArray[i].innerText.toUpperCase();\n //3.4.2 compare both the names\n if(currentname.indexOf(filterValue) > -1){\n //if matched do nothing\n namesArray[i].style.display ='';\n }else{\n //else display none\n namesArray[i].style.display ='none';\n }\n }\n}", "function filtre_texte(txt) {\r\n tabObj = tabObjInit.filter(function (elm) {\r\n var pattern = new RegExp(\"(\" + txt + \")\", 'ig');\r\n if ( elm.Nom.match(pattern) ) {\r\n return true;\r\n } else {\r\n return false\r\n }\r\n });\r\n ecrit_liste(tabObj);\r\n}", "async function filtrarNomes(){\n let valorInput = filterInput.value.charAt(0).toUpperCase() + filterInput.value.toLowerCase().substring(1);\n let nomes = buscarDadosNoJSON();\n \n nomes.then((nomeDoJSON) => {\n let resultados = nomeDoJSON.filter(nome => {\n let regex = new RegExp(`${valorInput}`, 'gi');\n return nome.name.match(regex);\n });\n\n if(resultados.length > 0)\n mostrarResultados(resultados)\n });\n }", "filtrarSugerencias(resultado, busqueda){\n \n //filtrar con .filter\n const filtro = resultado.filter(filtro => filtro.calle.indexOf(busqueda) !== -1);\n console.log(filtro);\n \n //mostrar los pines\n this.mostrarPines(filtro);\n }", "function filterNames() {\r\n //Search value, list items, pokemon names\r\n const filterValue = searchResult.value.toLowerCase(); //Gets search value\r\n const pokemonListLi = pokemonList.querySelectorAll('li'); //Gets list items\r\n const pokemonListNames = pokemonList.querySelectorAll('.pokemon-name'); //Gets pokemon names\r\n\r\n for (let i = 0; i < pokemonListNames.length; i++) {\r\n /*if at least one value of search appears in name, list item stays\r\n if value of search never occurs, list item is hidden*/\r\n if (pokemonListNames[i].textContent.toLowerCase().indexOf(filterValue) > -1) {\r\n pokemonListLi[i].style.display = '';\r\n } else {\r\n pokemonListLi[i].style.display = 'none';\r\n }\r\n }\r\n}", "function filterItem (){\n let filter = valorfilter();\n estructuraFilter = \"\";\n if (filter == \"Prime\"){\n for (propiedad of carrito) {\n if (propiedad.premium) imprimirItemFilter(propiedad);\n }\n noItenCarrito();\n } else if (filter == \"Todos\") {\n estructuraPrincipalCarrito();\n } \n}", "function filterByName (data) {\n const arrCard = document.querySelectorAll('.card');\n const searchInput = document.querySelector('.search-input');\n const arrName = [...document.querySelectorAll('#name')];\n searchInput.addEventListener('input', elInput => {\n const gallery = document.querySelector('#gallery');\n let dataArr = [];\n gallery.innerHTML = '';\n data.map(card => {\n let name = card.name.first + card.name.last;\n if(name.match(elInput.target.value)) {\n createCardsNew (card);\n dataArr.push(card);\n }\n });\n byClickCreateModal (dataArr);\n });\n}", "function filterNames(event) {\n let searchString = event.target.value.toLowerCase()\n\n $lis.forEach((li) => {\n if (li.querySelector('a').innerText.toLowerCase().includes(searchString)) {\n li.style.display = ''\n }\n else {\n li.style.display = 'none'\n }\n })\n}", "function filterBySearchTerm(){\n let inputName = document.querySelector('#input-pokemon-name').value;\n let pokemonNames = arrayOfPokemon.filter(pokemon => pokemon.name.startsWith(inputName));\n\n let inputType = document.querySelector('#input-pokemon-type').value;\n let pokemonTypes = arrayOfPokemon.filter(pokemon => pokemon.primary_type.startsWith(inputType));\n\n if (inputName !== \"\"){\n document.querySelector('#pokemon-list').innerText = '';\n displayList(pokemonNames);\n } else if (inputType !== \"\"){\n document.querySelector('#pokemon-list').innerText = '';\n displayList(pokemonTypes);\n } else if (inputName == \"\" && inputType == \"\"){\n let pokemonList = document.querySelector('#pokemon-list');\n pokemonList.innerHTML = \"\";\n displayList(arrayOfPokemon);\n };\n}", "function filterMovies(titlename) {\r\n const filteredMovies = movies.filter(word => word.Title.includes(titlename));\r\n addMoviesToDom(filteredMovies);\r\n}", "function filtros1(){\n\t\n\t\n\tvar recibe=$(this).val();\n\tvar detector=$(this).attr('name');\t\n\t\n\t$('#empleados tr').show();\n\t\n\tif(recibe.length>0 && detector=='cedula'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#empleados tr td.cedula\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t\t\n\t}\n\tif(recibe.length>0 && detector=='nombre'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#empleados tr td.nombre\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='costo'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#empleados tr td.costo\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='cargo'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#empleados tr td.cargo\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\t\n\t\n\treturn false;\n}", "function filterBy(filter) {\n JsontoHTML()\n for (let i = 0; i < all_html.length; i++) {\n let c = databaseObj[i];\n let genre = (JSON.parse(c[\"genres\"]))\n for (let a = 0; a < genre.length; a++) {\n if (genre[a][\"name\"] === filter) {\n $(\".items\").append([all_html[i]].map(movie_item_template).join(\"\"));\n }\n }\n }\n storage()\n }", "function filterByName(name){\n document.querySelectorAll('.card').forEach(el => {\n if(el.querySelector('h3').innerText.toLowerCase().indexOf(name.toLowerCase()) > -1){\n el.classList.remove('hidden')\n }else{\n el.classList.add('hidden')\n }\n })\n }", "function ObtenerResultadosFiltrados(){\n var comparar=[];\n $(selector+' .campoFiltrado input.campoBlancoTextoSeleccion').each(function(i,campo){\n if(ValidarCadena($(campo).val())){\n comparar.push(\n $(campo).attr('identificador')\n );\n }\n });\n return descargasGenerales.filter(function(elemento){\n if(comparar.length==0){\n return true;\n }\n for(let i=0;i<comparar.length;i++){\n var termino=$(selector+' .campoFiltrado input.campoBlancoTextoSeleccion[identificador=\"'+comparar[i]+'\"]').val().trim();\n if(!ContenerCadena(elemento[comparar[i]],termino)){\n return false;\n }\n }\n return true;\n });\n}", "function filterItems(e) {\n let filterValue = e.target.value.toUpperCase();\n\n // iterate of every exist items\n items.forEach(item => {\n if (item.textContent.toUpperCase().indexOf(filterValue) > -1) {\n item.parentElement.style.display = \"\";\n } else {\n item.parentElement.style.display = \"none\";\n }\n });\n}", "function filtresPers(searchFilter) {\n\t\treturn listPers.filter(p => p.nom.includes(searchFilter)||p.prenom.includes(searchFilter)||p.nomBiblio.includes(searchFilter)||p.titre.includes(searchFilter));\n\t}", "function filterNames() {\n // Get the input value\n\n let filterValue = document.getElementById('filterInput').value.toUpperCase();\n\n // Get the ul\n\n let ul = document.getElementById('names');\n\n // Get the lis from ul , an array would also be created from this\n let li = ul.querySelectorAll('li.collection-item');\n\n // Loop through \n\nfor( let i=0; i < li.length; i++) {\n let a = li[i].getElementsByTagName('a')[0];\n if(a.innerHTML.toUpperCase().indexOf(filterValue) > -1) {\n li[i].style.display = '';\n } else {\n li[i].style.display = 'none'\n }\n}\n}", "function filterAndSearch(films, searched, filtered, num) {\n\titems.innerHTML = \"\";\n\tvar arrayOne = [];\n\tvar arrayTwo = [];\n\tvar filmRating;\n\tfor (var i=0; i<films.length; i++) {\n\t\tif (num == 2) {\n\t\t\tif(films[i].genre.toLowerCase().match(searched)){\n\t\t\t\tarrayOne[i]=\"film\"+i;\n\t\t\t}\n\t\t}else{\n\t\t\tarrayOne=searched;\n\t\t}\n\t\tfilmRating = films[i].rating.replace(\".\", \"\");\n\t\tfilmRating = filmRating.replace(\".\", \"\");\n\t\t\n\t\tif (filmRating>Math.round(slider.noUiSlider.get()[0])&&filmRating<Math.round(slider.noUiSlider.get()[1])) {\n\t\t\tarrayTwo[i]=\"film\"+ i;\n\t\t}\n\t\t\n\t\tif (arrayOne[i]==undefined && arrayTwo[i]==undefined) {\n\t\t}else if (arrayOne[i]==arrayTwo[i]) {\n\t\t\titems.innerHTML += defLa[0] + i + defLa[1] + i + defLa[2] + films[i].image + defLa[3] + \" Title: \" +films[i].title + \" <br>Genre: \" + films[i].genre + defLa[4] + films[i].rating + defLa[5];\n\t\t}\n\t}\n\tif (items.innerHTML == \"\") {\n\t\titems.innerHTML = \"No Results Found\";\n\t}\n}", "function searchConcepto() {\n\tvar input, i, filter, li, ul, txtValue;\n\tinput = document.getElementById('buscarConcepto');\n\tfilter = input.value.toUpperCase();\n\t//collection-item getElementsByClassName('prueba') ;\n\tlet array_aux = document.getElementById('listadoconceptos').getElementsByTagName('A');\n\t//console.log(array_aux);\n\tfor (i = 0; i < array_aux.length; i++) {\n\t\ta = array_aux[i].getAttribute('concepto');\n\t\ttxtValue = a;\n\t\tif (txtValue.toUpperCase().indexOf(filter) > -1) {\n\t\t\tarray_aux[i].parentElement.style.display = '';\n\t\t} else {\n\t\t\tarray_aux[i].parentElement.style.display = 'none';\n\t\t}\n\t}\n}", "function searchData(){\n var dd = dList\n var q = document.getElementById('filter').value;\n var data = dd.filter(function (thisData) {\n return thisData.name.toLowerCase().includes(q) ||\n thisData.rotation_period.includes(q) ||\n thisData.orbital_period.includes(q) || \n thisData.diameter.includes(q) || \n thisData.climate.includes(q) ||\n thisData.gravity.includes(q) || \n thisData.terrain.includes(q) || \n thisData.surface_water.includes (q) ||\n thisData.population.includes(q)\n });\n showData(data); // mengirim data ke function showData\n}", "function filtro(tmpIdDecada, filtro) {\n\n // Violencias\n $(\"#\" + tmpIdDecada + \" .flt\").show();\n\n for (var tmpObra in arrayDecadas) {\n // todo get\n if (filtro === \"filtro_1\") {\n }\n if (getIDByCollection(tmpIdDecada) == arrayDecadas[tmpObra][\"collection_name\"]\n && arrayDecadas[tmpObra][\"violencias\"] == filtro) {\n $(\"#i-\" + decadas[\"ID\"]).addClass(\"flt\").hide();\n }\n }\n\n}", "function filterEmployee() {\n // Declare variables\n const input = document.querySelector('input');\n const filter = input.value.toUpperCase();\n let name = document.querySelectorAll('.name');\n const heading4 = document.querySelectorAll('h4')\n const card = document.querySelectorAll('.card');\n const btn = document.querySelector('button');\n\n\n // Loop through all employees name, and hide those who don't match the search query\n for (let i = 0; i < card.length; i++) {\n if (name[i].textContent.toUpperCase().includes(filter)) {\n showModalFunc(card[i]);\n } else {\n removeModalFunc(card[i]);\n }\n const clearFilter = (e) => {\n e.preventDefault();\n input.value = '';\n }\n }\n }", "function filterByNameOrAdress(classNameOf) {\n const drinkNames = document.querySelectorAll(classNameOf);\n\n for (let index = 0; index < drinkNames.length; index++) {\n if (\n drinkNames[index].innerHTML\n .toLowerCase()\n .includes(searchTxt.value.toLowerCase())\n ) {\n drinkNames[index].style.display = \"block\";\n } else {\n drinkNames[index].style.display = \"none\";\n }\n }\n }", "function mostrarResultados(nomesFiltrados){\n ul.innerHTML = [];\n letters.forEach(letra =>{\n let li = document.createElement('li');\n let h5 = document.createElement('h5');\n \n ul.append(li);\n li.classList.add('collection-header');\n li.append(h5);\n h5.innerHTML = `${letra}`;\n \n nomesFiltrados.forEach((nomeFiltrado) => {\n if(letra === nomeFiltrado.letter){\n let liItem = document.createElement('li');\n let aItem = document.createElement('a');\n ul.append(liItem);\n liItem.classList.add('collection-item');\n liItem.append(aItem);\n aItem.href = '#';\n aItem.innerHTML = `${nomeFiltrado.name}`;\n }\n });\n });\n}", "function filtrar(){\n $(\"#grillaProductos>div\").hide();\n let arrayTemp=[];\n for (let i=0; i<$(\".checkbox\").length; i++ ){\n if($(\".checkbox\")[i].checked){\n switch (i){\n case 0:\n arrayTemp= arrayTemp.concat(arrayProductos.filter(el=>el.nombre.split(/(?=[A-Z])/)[0]==\"shampoo\"));\n break;\n case 1:\n arrayTemp= arrayTemp.concat(arrayProductos.filter(el=>el.nombre.split(/(?=[A-Z])/)[0]==\"acondicionador\"));\n break;\n case 2:\n arrayTemp= arrayTemp.concat(arrayProductos.filter(el=>el.nombre.split(/(?=[A-Z])/)[0]==\"combo\"));\n break;\n }\n }\n }\n \n if (arrayTemp.length === 0){\n $(\"#grillaProductos>div\").show();\n }else{\n arrayTemp.forEach(element => {\n $(`#${element.nombre}CardgrillaProductos`).show(); \n });\n }\n }", "function filtrar() {\n var input, filter, table, tr, td, i;\n input = $('#filtrar');\n filter = input.val().toUpperCase();\n table = $('#tabela');\n tr = $('tr');\n for (i = 0; i < tr.length; i++) {\n td = tr[i].getElementsByTagName('td')[0];\n if (td) {\n if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {\n tr[i].style.display = '';\n } else {\n tr[i].style.display = 'none';\n }\n }\n }\n}", "function filterAccion() {\n let texto = \"Accion\";\n Mangas = JSON.parse(localStorage.getItem(\"biblioteca\"));\n\n Mangas = Mangas.filter(function (manga) {\n return manga.categoria.indexOf(texto) > -1;\n });\n contarRegistro(Mangas)\n cargarManga4(Mangas);\n \n}", "function filterEmployeesByName() {\n const $cards = $(\".card\");\n let $matched = 0;\n let $filterInput = $(\"#filter\").val();\n\n if ($filterInput !== \"\") {\n $(\".card\").each(function () {\n let n = $(this).children(\".info\").children(\".name\").text();\n let u = $(this).children(\".info\").children(\".username\").text();\n if (n.indexOf($filterInput) < 0 && u.indexOf($filterInput) < 0) {\n $(this).hide();\n } else {\n $matched += 1;\n $(this).show();\n }\n if ($matched === 0) {\n $('.main-footer span').text(\"No matched face...\");\n } else {\n $('.main-footer span').text(\"So many beautiful faces ...\");\n }\n });\n } else {\n //show all employees if input field is blank.\n $(\".card\").show();\n }\n}", "function comprobarNombre(pokemon) {\n\n var valueFiltro = filtroInput.value.toLowerCase();\n\n var nombre = pokemon.name;\n\n contador = 0;\n\n return nombre.includes(valueFiltro);\n\n}", "function filterBiblio() {\n let texto = document.querySelector(\"#textBuscar\");\n Mangas = JSON.parse(localStorage.getItem(\"biblioteca\"));\n\n Mangas = Mangas.filter(function (manga) {\n return manga.titulo.indexOf(texto.value.charAt(0).toUpperCase() + texto.value.toLowerCase().slice(1)) > -1;\n });\n texto.value=\"\"\n texto.focus()\n contarRegistro(Mangas)\n cargarManga4(Mangas);\n}", "function filter() {\n let preFilter = [];\n let gender = selectG.value;\n let stat = selectS.value;\n let filteredChar = [];\n\n if (gender != \"Gender\") {\n filteredChar.push(\"gender\");\n if (filteredChar.length == 1) {\n limpiartodo();\n preFilter = filterGender(preFilter, gender, true);\n print(preFilter);\n }\n else {\n limpiartodo();\n preFilter = filterGender(preFilter, gender, false);\n print(preFilter);\n }\n }\n\n if (stat != \"Status\") {\n filteredChar.push(\"status\");\n if (filteredChar.length == 1) {\n limpiartodo();\n preFilter = filterStatus(preFilter, stat, true);\n print(preFilter);\n }\n else {\n limpiartodo();\n preFilter = filterStatus(preFilter, stat, false);\n print(preFilter);\n }\n }\n }", "function filtros(){\n\n\tvar recibe=$(this).val();\n\tvar detector=$(this).attr('name');\t\n\t\n\t$('#supernumerario tr').show();\n\t\n\tif(recibe.length>0 && detector=='cedula'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#supernumerario tr td.cedula\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t\t\n\t}\n\tif(recibe.length>0 && detector=='nombre'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#supernumerario tr td.nombre\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='costo'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#supernumerario tr td.costo\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='cargo'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#supernumerario tr td.cargo\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\t\n\tif(recibe.length>0 && detector=='estado'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#supernumerario tr td.estado\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\treturn false;\n}", "function search() {\n let input, filter, elements, a, txtValue;\n input = document.getElementById('search-bar');\n filter = input.value.toUpperCase();\n elements = document.getElementsByClassName('pokebox');\n \n for (let i = 0; i < elements.length; i++) {\n a = elements[i].getElementsByClassName('name')[0];\n txtValue = a.textContent || a.innerText;\n\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n elements[i].style.display = \"\";\n } else {\n elements[i].style.display = \"none\";\n }\n }\n}", "resultadoDePesquisa(){\n \n var input, filter, ul, li, a, i;\n\n var entrei = \"nao\";\n \n input = document.getElementById('buscaPrincipal');\n filter = input.value.toUpperCase();\n ul = $(\".area-pesquisa-principal\");\n\n li = $(\".area-pesquisa-principal .caixa-branca\");\n\n for (i = 0; i < li.length; i++) {\n a = li[i];\n if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {\n li[i].style.display = \"\";\n entrei = \"sim\";\n } else {\n li[i].style.display = \"none\";\n }\n }\n \n }", "function loadFilteredFilmList(value) {\n axios.get('https://data.sfgov.org/resource/wwmu-gmzc.json').then(res => {\n var regex = new RegExp(value, \"gi\");\n var searchValue = res.data.filter(film => {\n return film.title.match(regex);\n });\n renderFilmList(searchValue);\n }).catch();\n}", "function filtroUsuarios() {\r\n var input, filter, table, tr, td, td2, td3, i;\r\n input = document.getElementById(\"search\");\r\n filter = input.value.toUpperCase();\r\n table = document.getElementById(\"table\");\r\n tr = table.getElementsByTagName(\"tr\");\r\n for (i = 0; i < tr.length; i++) {\r\n td = tr[i].getElementsByTagName(\"td\")[0]; //ID\r\n td2 = tr[i].getElementsByTagName(\"td\")[1]; //Nome\r\n td3 = tr[i].getElementsByTagName(\"td\")[2]; //Permissões\r\n if (td || td2 || td3) {\r\n if (td.innerHTML.toUpperCase().indexOf(filter) > -1 || td2.innerHTML.toUpperCase().indexOf(filter) > -1 || td3.innerHTML.toUpperCase().indexOf(filter) > -1) {\r\n tr[i].style.display = \"\";\r\n } else {\r\n tr[i].style.display = \"none\";\r\n }\r\n }\r\n }\r\n}", "function filter2Dos() {\n var filterInput = $(this).val().toLowerCase();\n $('.text-wrapper').each(function () {\n var cardText = $(this).text().toLowerCase();\n if (cardText.indexOf(filterInput) != -1) {\n $(this).parent().show();\n } else {\n $(this).parent().hide();\n }\n });\n}", "function nameFilter(element, index, array) {\n var $item = $(\"#\" + element);\n\n if (visible.filterOn.length > 0 && visible.items[element].name.toLowerCase().indexOf(visible.filterOn.toLowerCase()) === -1) {\n return false;\n }\n return true;\n }", "function filterItems(e){\n\t//convert text to lowercase\n\tvar text = e.target.value.toLowerCase();\n\t//get li's\n\tvar items = itemList.getElementsByTagName('li');\n\t//Convert HTML collection to an array\n\tArray.from(items).forEach(function(item){\n\t\tvar itemName = item.firstChild.textContent;\n\t\t// console.log(itemName); //check if we get the item names\n\t\tif(itemName.toLowerCase().indexOf(text) != -1){//check if the search is equal to the item(matching) -1 if not match\n\t\t\titem.style.display = 'block'; //shows the search item(s)\n\t\t} else{\n\t\t\titem.style.display = 'none'; //if not match, remove display\n\t\t}\n\n\t});\n}", "function searchNameText(e) {\n\tcardsList.innerHTML = ''; // clear the container for the new filtered cards\n\tbtnLoadMore.style.display = 'none';\n\tlet keyword = e.target.value;\n\tlet arrByName = dataArr.filter(\n\t\t(card) => { \n\t\t\treturn( \n\t\t\t\tcard.name.toLowerCase().indexOf(keyword.toLowerCase()) > -1 ||\n\t\t\t\tcard.artist.toLowerCase().indexOf(keyword.toLowerCase()) > -1 ||\n\t\t\t\tcard.setName.toLowerCase().indexOf(keyword.toLowerCase()) > -1 \n\t\t\t\t)\n\t\t}\t\n\t);\n\trenderCardList(arrByName);\n\tconsole.log(arrByName);\n}", "function finder() {\n filter = keyword.value.toUpperCase();\n var li = box_search.getElementsByTagName(\"li\");\n // Recorriendo elementos a filtrar mediante los li\n for (i = 0; i < li.length; i++) {\n var a = li[i].getElementsByTagName(\"a\")[0];\n textValue = a.textContent || a.innerText;\n\n // QUIERO QUE ME APAREZCAN LAS OPCIONES SI TEXTVALUE.STARTSWITH = FILTER \n\n if (textValue.toUpperCase().indexOf(filter) > -1) {\n li[i].style.display = \"flex\";\n box_search.style.display = \"flex\";\n if (keyword.value === \"\") {\n box_search.style.display = \"none\";\n }\n }\n else {\n li[i].style.display = \"none\";\n }\n\n }\n\n}", "function filter(word) {\n let length = items.length\n let collection = []\n let hidden = 0\n for (let i = 0; i < length; i++) {\n if (items[i].value.toLowerCase().startsWith(word)) {\n $(items[i]).show()\n }\n else {\n $(items[i]).hide()\n hidden++\n }\n }\n\n //If all items are hidden, show the empty view\n if (hidden === length) {\n $('#empty').show()\n }\n else {\n $('#empty').hide()\n }\n}", "function filter(word) {\n let length = items.length\n let collection = []\n let hidden = 0\n for (let i = 0; i < length; i++) {\n if (items[i].value.toLowerCase().startsWith(word)) {\n $(items[i]).show()\n }\n else {\n $(items[i]).hide()\n hidden++\n }\n }\n\n //If all items are hidden, show the empty view\n if (hidden === length) {\n $('#empty').show()\n }\n else {\n $('#empty').hide()\n }\n}", "function filtros2(){\n\t\n\t\n\tvar recibe=$(this).val();\n\tvar detector=$(this).attr('name');\t\n\t\n\t$('#externos tr').show();\n\t\n\tif(recibe.length>0 && detector=='cedula'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#externos tr td.cedula\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t\t\n\t}\n\tif(recibe.length>0 && detector=='nombre'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#externos tr td.nombre\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='costo'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#externos tr td.costo\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='cargo'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#externos tr td.cargo\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\t\n\t\n\treturn false;\n}", "function filterByName(element)\r\n{\r\n _upObject.filterByName(element.value, \"name\");\r\n}", "function filtro(categoria) {\n setCat(categoria)\n }", "function filterByName(searchForName, personList) {\n searchForName = searchForName.toLowerCase();\n return personList.filter((person) => {\n console.log(person)\n // Only needs to check if letters typed so far are included in name, not equal to name. \n return person.name.toLowerCase().includes(searchForName);\n });\n}", "function filterData(tex) {\n const tempRests = rests.filter((itm) => itm.name.toLowerCase().includes(tex.toLowerCase()));\n setFilteredRests(tempRests);\n }", "_filter(value) {\n //convert text to lower case\n const filterValue = value.toLowerCase();\n //get matching products\n return this.products.filter(option => option.toLowerCase().includes(filterValue));\n }", "function filterName(){\n\t// Set filters to localstorage\n\tvar formName = $(\"#searchTitle\").val();\n\tif(formName == \"\"){\n\t\tfilterResults();\n\t}\n\telse{\n\t\tsearchResults(formName, \"600\", \"2800\");\n\t}\n}", "function nameFilterEvent() {\n var input, filter, ul, li, a, i, txtValue;\n input = document.getElementById(\"filterInputName\");\n filter = input.value.toUpperCase();\n\n ul = document.getElementsByClassName(\"eventListTable\");\n li = ul[0].getElementsByTagName(\"li\");\n \n for (i = 0; i < li.length; i++) {\n a = li[i].getElementsByTagName(\"h1\")[0];\n txtValue = a.textContent || a.innerText;\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n li[i].style.display = \"\";\n } else {\n li[i].style.display = \"none\";\n }\n }\n}", "function filtroProdutos() {\r\n var input, filter, table, tr, td, td2, td3, i;\r\n input = document.getElementById(\"search\");\r\n filter = input.value.toUpperCase();\r\n table = document.getElementById(\"table\");\r\n tr = table.getElementsByTagName(\"tr\");\r\n for (i = 0; i < tr.length; i++) {\r\n td = tr[i].getElementsByTagName(\"td\")[0]; //ID\r\n td2 = tr[i].getElementsByTagName(\"td\")[1]; //Descrição\r\n td3 = tr[i].getElementsByTagName(\"td\")[3]; //Código de barras\r\n if (td || td2 || td3) {\r\n if (td.innerHTML.toUpperCase().indexOf(filter) > -1 || td2.innerHTML.toUpperCase().indexOf(filter) > -1 || td3.innerHTML.toUpperCase().indexOf(filter) > -1) {\r\n tr[i].style.display = \"\";\r\n } else {\r\n tr[i].style.display = \"none\";\r\n }\r\n }\r\n }\r\n}", "filteravanzado(event) {\n var text = event.target.value\n console.log(text)\n const data = this.state.listaBackup2\n const newData = data.filter(function (item) {\n\n const itemDataTitle = item.titulo.toUpperCase()\n const itemDataSubt = item.subtitulo.toUpperCase()\n const campo = itemDataTitle+\" \"+itemDataSubt\n const textData = text.toUpperCase()\n return campo.indexOf(textData) > -1\n })\n this.setState({\n listaAviso2: newData,\n textBuscar2: text,\n })\n }", "findItem(query) {\n if (query === '') {\n return this.dataSearch.slice(0, 5);\n }\n const regex = new RegExp(`${query.trim()}`, 'i');\n return this.dataSearch.filter(film => film.name.search(regex) >= 0);\n }", "function filter(kataKunci) {\n var filteredItems = []\n for (var j = 0; j < items.length; j++) {\n var item = items[j];\n var namaItem = item[1]\n var isMatched = namaItem.toLowerCase().includes(kataKunci.toLowerCase())\n\n if(isMatched == true) {\n filteredItems.push(item)\n }\n }\n return filteredItems\n}", "function filterTasks() {\n let result = filter.value.toLowerCase()\n document.querySelectorAll(\".collection-item\").forEach(function (item) { //NodeList\n if (item.innerText.toLowerCase().includes(result)) {\n item.style.display = \"block\"\n } else {\n item.style.display = \"none\"\n }\n })\n /*\n Array.from(taskList.children).forEach(function(item){\n item.style.display = (item.textContent.toLowerCase().includes(e.target.value.toLowerCase())? \"block\" : \"none\")\n })\n */\n}", "function filter(word) {\n let length = items.length\n let collection = []\n let hidden = 0\n for (let i = 0; i < length; i++) {\n if (items[i].value.toLowerCase().startsWith(word)) {\n $(items[i]).css({display: 'block'})\n }\n else {\n $(items[i]).css({display: 'none'})\n hidden++\n }\n }\n\n //If all items are hidden, show the empty view\n if (hidden === length) {\n $('#empty').show()\n }\n else {\n $('#empty').hide()\n }\n}", "function filtrarProductosXEtiqueta() {\n let textoIngresado = $(\"#txtFiltroProductos\").val();\n textoIngresado = textoIngresado.toLowerCase();\n let arrayFiltrados = { data: Array(), error: \"\" };\n for (let i = 0; i < productos.length; i++) {\n let unProd = productos[i];\n let unaEtiqueta = unProd.etiquetas;\n let x = 0;\n let encontrado = false;\n while (!encontrado && x < unaEtiqueta.length) {\n let etiquetaX = unaEtiqueta[x];\n if (etiquetaX.includes(textoIngresado)) {\n arrayFiltrados.data.push(unProd);\n encontrado = true;\n }\n x++;\n }\n }\n crearListadoProductos(arrayFiltrados);\n}", "function sexoSeleccionado(){\n console.trace('sexoSeleccionado');\n let sexo = document.getElementById(\"selector\").value;\n console.debug(sexo);\n if(sexo == 't'){\n pintarLista( personas );\n }else{\n const personasFiltradas = personas.filter( el => el.sexo == sexo) ;\n pintarLista( personasFiltradas );\n \n \n }//sexoSeleccionado\n limpiarSelectores('sexoselec');\n \n}", "function filter(films, margins) {\n\tif (margins[0]==10&&margins[1]==100) {\n\t}else{\n\t\titems.innerHTML=\"\";\n\t\tvar searchedFilms = [];\n\t\tvar filmRating;\n\t\tfor (var i=0; i<films.length; i++) {\n\t\t\tvar content = defLa[0] + i + defLa[1] + i + defLa[2] + films[i].image + defLa[3] + \" Title: \" +films[i].title + \" <br>Genre: \" + films[i].genre + defLa[4] + films[i].rating + defLa[5];\n\t\t\tfilmRating = films[i].rating.replace(\".\", \"\");\n\t\t\tfilmRating = filmRating.replace(\".\", \"\");\n\t\t\tif (filmRating>margins[0]&&filmRating<margins[1]) {\n\t\t\t\titems.innerHTML += content;\n\t\t\t\tsearchedFilms[i]=\"film\"+i;\n\t\t\t}\n\t\t}\n\t\tif(SecondSearch.value!=\"\") {\n\t\t\tfilterAndSearch(films,SecondSearch.value.toLowerCase(), searchedFilms, 2, content);\n\t\t}\n\t\tif (items.innerHTML==\"\") {\n\t\t\titems.innerHTML = \"No Results Found\";\n\t\t}\n\t}\n}", "function filtresLiv(searchFilter) {\n\t\treturn listLiv.filter(l => l.titre.includes(searchFilter)||l.auteur.nom.includes(searchFilter)||l.auteur.prenom.includes(searchFilter));\n\t}", "filteredFruits(){\n return this.fruits.filter((element)=> {\n return element.match(this.filterInputText)\n })\n }", "function filterGenres() {\r\n var genderMovieSelect = $(\"#genders-movie select\").val()\r\n if (genderMovieSelect != \"all\") {\r\n $(\"#movie .template\").each(function() {\r\n var gid = $(this).attr(\"data-generi\").split(',');\r\n if (gid.includes(genderMovieSelect)) $(this).show()\r\n else $(this).hide()\r\n });\r\n } else {\r\n $(\"#movie .template\").show()\r\n }\r\n var genderTVSelect = $(\"#genders-tv select\").val()\r\n if (genderTVSelect != \"all\") {\r\n $(\"#tvshow .template\").each(function() {\r\n var gid = $(this).attr(\"data-generi\").split(',');\r\n if (gid.includes(genderMovieSelect)) $(this).show()\r\n else $(this).hide()\r\n });\r\n } else {\r\n $(\"#tvshow .template\").show()\r\n }\r\n }", "function filterFunction() {\n var input, filter, ul, li, a, i;\n input = document.getElementById(\"mySearches\");\n filter = input.value.toUpperCase();\n div = document.getElementById(\"mySearch\");\n a = div.getElementsByTagName(\"a\");\n for (i = 0; i < a.length; i++) {\n txtValue = a[i].textContent || a[i].innerText;\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n a[i].style.display = \"\";\n } else {\n a[i].style.display = \"none\";\n }\n }\n}", "function filtros3(){\n\t\n\t\n\tvar recibe=$(this).val();\t\n\tvar detector=$(this).attr('name');\t\n\t\n\t$('#admin tr').show();\n\t\n\tif(recibe.length>0 && detector=='nombre'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#admin tr td.nombre\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t\t\n\t}\n\tif(recibe.length>0 && detector=='area'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#admin tr td.area\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='super'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#admin tr td.super\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='baja'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#admin tr td.baja\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='inicio'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#admin tr td.inicio\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='fin'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#admin tr td.fin\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\tif(recibe.length>0 && detector=='jefe'){\n\t\t // con la clase .nombre le decimos en cual de las celdas buscar y si no coincide, ocultamos el tr que contiene a esa celda. \n $(\"#admin tr td.jefe\").not(\":Contains('\"+recibe+\"')\").parent().hide();\n\t}\n\t\n\t\n\treturn false;\n}", "function displayFilterValues(type, name) {\n $(\"#filterType\").text(type);\n\n //to ensure that the name is not too long\n const maxNameLength = 25;\n if (name.length > maxNameLength) {\n const nameArr = name.split(' ');\n name = '';\n for (let count = 0; count < nameArr.length; count++) {\n if ((name + nameArr[count]).length > maxNameLength) break;\n name += ' ' + nameArr[count];\n }\n name = name.substring(1);\n }\n\n $(\"#filterName\").text(name);\n}", "function filterNames () {\n\n // Declare variable to hold value of filtered names\n let filteredNames;\n\n // If all...\n if (isAllShowing===true) {\n filteredNames = myNames.map((name) => {\n name.is_visible=true\n return name\n });\n setMyNames(filteredNames);\n }\n\n // If first...\n else if (isFirstShowing===true) {\n filteredNames = myNames.map((name) => {\n if (name.type==='first') {\n name.is_visible=true\n return name\n }\n else {\n name.is_visible=false\n return name;\n }\n });\n setMyNames(filteredNames);\n }\n\n // If middle...\n else if (isMiddleShowing===true) {\n filteredNames = myNames.map((name) => {\n if (name.type==='middle') {\n name.is_visible=true\n return name\n }\n else {\n name.is_visible=false\n return name;\n }\n });\n setMyNames(filteredNames);\n }\n\n // If full...(implied as all other types are specified in above conditionals)\n else {\n filteredNames = myNames.map((name) => {\n if (name.type==='full') {\n name.is_visible=true\n return name\n }\n else {\n name.is_visible=false\n return name;\n }\n });\n setMyNames(filteredNames);\n }\n }", "selectFilterFacilidade(facilidades){\n\n //to open the DropDown\n this.getDropDownBoxFacilidades().click();\n\n //Search by the passed facilidades and click in checkBoxes\n facilidades.forEach((item) => {\n this.getCheckboxesFacilidades().contains(item).click();\n });\n }", "function filtra(event){\n\t\n\tconst searchString=event.currentTarget.value.toLowerCase();\n\tconst trovati = document.querySelectorAll('.cercato');\n\tconst corpo = document.querySelector('body');\n\tconst primaSezione = document.querySelector('section');\n\tconst oggetti = document.querySelectorAll('.oggetto');\n\t\n\tconst sezFiltrati = document.createElement('div');\n\tsezFiltrati.classList.add('filtrati');\n\tcorpo.insertBefore(sezFiltrati, primaSezione);\n\t\t\n\t\tfor(let obj of oggetti){\n\t\t\t\n\t\t\t\n\t\t\tif(obj.childNodes[4].innerText.toLowerCase().includes(searchString)){\n\n\t\t\t\t\n\t\t\t\tconst oggetto1 = document.createElement('div'); \n\t\t\t\toggetto1.classList.add('cercato');\n\t\t\t\tsezFiltrati.appendChild(oggetto1);\n\t\t\t\t\n\t\t\t\tconst titolo = document.createElement('h2'); \n\t\t\t\ttitolo.innerText = obj.childNodes[1].innerText;\n\t\t\t\toggetto1.appendChild(titolo);\n\t\t\t\t\n\t\t\t\tconst immagine1 = document.createElement('img');\n\t\t\t\timmagine1.src = obj.childNodes[2].src;\n\t\t\t\toggetto1.appendChild(immagine1);\n\t\t\t\t\n\t\t\t\tconst codice1 = document.createElement('h3');\n\t\t\t\tcodice1.textContent = obj.childNodes[3].textContent;\n\t\t\t\toggetto1.appendChild(codice1);\n\t\t\n\t\t\t\tconst didascalia1 = document.createElement('article');\n\t\t\t\t\n\t\t\t\tdidascalia1.textContent = obj.childNodes[4].textContent;\n\t\t\t\toggetto1.appendChild(didascalia1);\n\t\t\t\t\n\t\t\t\tconst filtraggio = document.querySelectorAll('.filtrati');\t\n//\t\t\t\tconsole.log(filtraggio);\n\t\t\t\tlet conta = 0;\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\tfor(let item of filtraggio){\t\t\t\t\t\t\t\t\n\t\t\t\t\tconta++;\n//\t\t\t\t\tconsole.log(conta);\n\t\t\t\t}\n\t\t\t\tif(conta > 1){\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tfor(let item of filtraggio){\n\t\t\t\t\t\titem.remove();\n\t\t\t\t\t\tconta--;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif(searchString == ''){\n\t\t\tconst filtraggio = document.querySelectorAll('.filtrati');\n//\t\t\tconsole.log('Stringa vuota');\n\t\t\tfor(let item of filtraggio){\n\t\t\t\t\n\t\t\t\t\t\titem.remove();\n\t\t\t}\n\t\t}\n}", "function filtro(arreglo, criterios,signo) { \n return arreglo.filter(function(obj) {return Object.keys(criterios).every(function(c) { //retorna los objetos que no cumplan los criterios si signo es true\n if (signo) //retorna los objetos que cumplen los criterios si signo es false\n return obj[c] != criterios[c]; // ejmplo de uso (arregloObjetos,{atributo1:a,atributo2:b},true)\n else \n return obj[c] == criterios[c]; \n }); \n }); \n }", "function getCarsByName(name, count = 5) {\n return data\n .filter((car) =>\n car.Name.toLocaleLowerCase().startsWith(name ? name.toLowerCase() : name)\n )\n .slice(0, count);\n}", "function queryUserName(name){\n var results = users.filter(function(o){\n if(o.name.toLowerCase().indexOf(name.toLowerCase()) > - 1){\n return o;\n }\n });\n showUserResults(results);\n}", "function searchAuthName() {\n let input, filter, table, tr, td, i;\n input = document.getElementById(\"searchAName\");\n filter = input.value.toUpperCase();\n table = document.getElementById('authorsTable');\n tr = table.getElementsByTagName(\"tr\");\n\n // Loop through all list items, and hide those who don't match the search query\n for (i = 0; i < tr.length; i++) {\n td = tr[i].getElementsByTagName('td')[1];\n if (td) {\n if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {\n tr[i].style.display = \"\";\n } else {\n tr[i].style.display = \"none\";\n };\n };\n };\n }", "function filter(){\n\n\tvar fifilter = $('#filter');\n\n\tvar wadahFilter = fifilter.val().toLowerCase();\n\n\tvar buah = $('.buah');\n\t\tfor (var a = 0; a < buah.length; a++) {\n\n\t\t\tvar wadahLi = $(buah[a]).text().toLowerCase();\n\t\t\t\n\t\t\tif(wadahLi.indexOf(wadahFilter) >= 0){\n\t\t\t\t\t$(buah[a]).slideDown();\n\t\t\t}else{\n\t\t\t\t\t$(buah[a]).slideUp();\n\t\t\t}\n\t\t}\n\n\t// buah.each(function(){\n\t// \tvar bubuah = $(this);\n\t// \tvar namaBuah = bubuah.text().toLowerCase();\n\n\t// \tif(namaBuah.indexOf(wadahFilter) >= 0 ){\n\t// \t\t$(this).slideDown();\n\t// \t}else{\n\t// \t\t$(this).slideUp();\n\t// \t}\n\t// });\n\t\n\n}", "filterFunc (searchExpression, value) {\n const itemValue = value.name\n\n return (!searchExpression || !itemValue)\n ? false\n : itemValue.toUpperCase().indexOf(searchExpression.toUpperCase()) !== -1\n }", "function search() {\n let input, filter, li, a, i, txtValue;\n input = document.querySelector(\".search\");\n filter = input.value.toUpperCase();\n li = document.getElementsByClassName(\"readthis\");\n for (i = 0; i < li.length; i++) {\n a = li[i].getElementsByClassName(\"studentdetails\")[0];\n txtValue = a.textContent || a.innerText;\n if (txtValue.toUpperCase().indexOf(filter) > -1) {\n li[i].style.display = \"\";\n } else {\n li[i].style.display = \"none\";\n }\n }\n}", "function filterUser(value) {\n const filterIndex = select.selectedIndex\n let filter = select.options[select.selectedIndex].text\n if (value.length >= 3) {\n filteredUsers = users.filter((user) => {\n if (user[filter].toLowerCase().includes(value.toLowerCase())) {\n return user[filter]\n }\n })\n createCards(filteredUsers)\n } else if (value.length === 0) {\n createCards(users)\n }\n\n}", "function filterByGame() {\n clearSearchbar();\n const chosenGame = this.value;\n const allGameCategories = Array.from(document.querySelectorAll(\".game-name\"));\n allGameCategories.forEach(gameName => {\n if (gameName.textContent !== chosenGame) {\n gameName.parentElement.parentElement.parentElement.classList.add(\"hidden\");\n }\n else(gameName.parentElement.parentElement.parentElement.classList.remove(\"hidden\"));\n });\n checkAllTermsHidden();\n}", "function filterTasks(e){\n const text=e.target.value.toLowerCase();\n //We used for each as the query selector all returns nodelist\n document.querySelectorAll('.collection-item').forEach(function(task)\n {\n const item=task.firstChild.textContent;\n if(item.toLowerCase().indexOf(text)!=-1)\n {\n task.style.display='block';\n\n }\n else{\n task.style.display='none';\n }\n });\n}", "function textFilter() {\n var filterValue, input, ul, li, i;\n input = document.querySelector(\"#filterCompany\");\n filterValue = input.value.toUpperCase();\n ul = document.querySelector(\"#listOfCompanies\")\n li = document.querySelectorAll(\"#listOfCompanies li\");\n\n for(i=0; i < li.length; i++) {\n var a = li[i];\n if(a.innerHTML.toUpperCase().indexOf(filterValue) > -1) {\n li[i].style.display = \"\";\n }\n else {\n li[i].style.display = \"none\";\n }\n }\n}", "function searchText(value) {\r\n const card = document.querySelectorAll('.card');\r\n for (let i = 0; i < card.length; i++) {\r\n const userName = card[i].querySelector('.card-name').textContent\r\n if (userName.indexOf(value) > -1) {\r\n card[i].style.display = \"\";\r\n } else {\r\n card[i].style.display = \"none\";\r\n\r\n }\r\n }\r\n}", "function filtrarAuto() {\r\n // Funcion de alto nivel. Una funcion que toma a otra funcion.\r\n const resultado = autos.filter(filtrarMarca).filter(filtrarYear).filter(filtrarMinimo).filter(filtrarMaximo).filter(filtrarPuertas).filter(filtrarTransmision).filter(filtrarColor);\r\n // console.log(resultado);\r\n if (resultado.length)\r\n mostrarAutos(resultado);\r\n else\r\n noHayResultados();\r\n}", "function createFilterFor(query) {\n\n return function filterFn(proyecto) {\n return (proyecto.titulo.indexOf(query) === 0);\n };\n }", "function filterByName(val){\n return val.speaker == this;\n }", "function SearchByName(){\n if(inputSearch.value !== \"\"){\n setTimeout(responsiveVoice.speak(inputSearch.value),0);\n resultHotel= [];\n result = hotels.filter((hotel) =>{\n if( hotel.name.toLocaleLowerCase().indexOf(inputSearch.value.toLocaleLowerCase()) > -1){\n return hotel;\n }\n })\n inputSearch.value=\"\";\n resultHotel = result;\n display(result);\n }else{\n alerts(\"Add your Search\",3000);\n }\n range();\n filterByPrice()\n}", "filteredBirds() {\n return vm.birds.filter(\n (bird) => {\n let filterBirdResult = true\n if (this.filterName !== \"\") {\n filterBirdResult = bird.name.includes(vm.filterName)\n\n }\n return filterBirdResult\n\n }\n )\n\n }", "function filterProjectsBy(evt) {\n var category = evt.target.value;\n $('.project-filterable').hide();\n if (category) {\n $('.' + category).show();\n } else {\n $('.project-filterable').show();\n }\n}", "function filterTasks(e){\n console.log(\"Task filter...\")\n var searchFilter, listItem, txtValue;\n searchFilter = filter.value.toUpperCase();\n listItem = document.querySelectorAll('.collection-item');\n //looping through the list items, and hiding unmatching results\n listItem.forEach(function(element){\n txtValue = element.textContent || element.innerText;\n if(txtValue.toUpperCase().indexOf(searchFilter) > -1){\n element.style.display = \"\";\n }else{\n element.style.display = \"none\";\n }\n });\n}", "filter(event) {\n var text = event.target.value\n console.log(text)\n const data = this.state.listaBackup\n const newData = data.filter(function (item) {\n const itemData = item.titulo.toUpperCase()\n const textData = text.toUpperCase()\n return itemData.indexOf(textData) > -1\n })\n this.setState({\n listaAviso: newData,\n textBuscar: text,\n })\n }", "function search() {\n const text = this.value;\n if (text === '') {\n rows.forEach(row => row.style.display = null);\n return;\n }\n const length = names.length;\n const regex = new RegExp(text, 'gi');\n for (let i = 0; i < length; i++) {\n if (names[i].match(regex)) rows[i].style.display = null;\n else rows[i].style.display = 'none';\n }\n}", "function createFilterFor(query) {\n\n return function filterFn(fondeo) {\n return (fondeo.titulo.indexOf(query) === 0);\n };\n }", "filterSuggest(results, search) {\n const filter = results.filter( filter => filter.calle.indexOf(search) !== -1 );\n\n // Mostrar pines del Filtro\n this.showPins(filter);\n }", "function filterUl(value) {\n var list = $(\"#drag-list-container li\").hide()\n .filter(function () {\n var item = $(this).text();\n var padrao = new RegExp(value, \"i\");\n return padrao.test(item);\n }).closest(\"li\").show();\n}", "filteredBirds() {\n return this.birds.filter(\n (bird) => {\n let filterBirdResult = true\n if (this.filterName !== \"\") {\n filterBirdResult = bird.name.includes(this.filterName)\n\n }\n return filterBirdResult\n\n }\n )\n\n }", "function searchName(){\n\n const searchValue = document.querySelector('.search-input').value;\n const cards = document.querySelectorAll(\".card\");\n for (let index = 0; index < cards.length; index++) {\n const name = cards[index].querySelector(\"#name\").innerHTML;\n if (name.indexOf(searchValue)!=-1) {\n cards[index].style.display = \"\";\n }\n else{\n cards[index].style.display = \"none\";\n }\n \n }\n\n}", "function searchEmployees() {\n const searchName = searchBar.value.toLowerCase();\n const cards = document.querySelectorAll(\".card\");\n const names = document.querySelectorAll(\".card-name\");\n\n names.forEach((name, index) => {\n const nameValue = name.textContent.toLowerCase();\n\n if (nameValue.includes(searchName)) {\n cards[index].style.display = \"flex\";\n } else {\n cards[index].style.display = \"none\";\n }\n });\n}", "function searchmovie() {\r\n var search,filter,ul,li,a,i,text;\r\n search=document.getElementById(\"inputid\");\r\n filter=search.value.toUpperCase();\r\n ul=document.getElementById(\"ulid\");\r\n li=ul.getElementsByTagName(\"li\");\r\n for(i=0; i<li.length; i++)\r\n {\r\n a = li[i].getElementsByTagName(\"span\")[0];\r\n text=a.textContent || a.innerText;\r\n if(text.toUpperCase().indexOf(filter) > -1)\r\n {\r\n li[i].style.display=\"\";\r\n }\r\n else\r\n {\r\n li[i].style.display=\"none\";\r\n }\r\n }\r\n}", "function searchCoffeeNames(e) {\n e.preventDefault();\n var userCoffeeName = document.getElementById(\"user-search\").value;\n var filteredNames = [];\n coffees.forEach(function(coffee) {\n\n if(coffee.name.toLowerCase().includes(userCoffeeName.toLowerCase())){\n filteredNames.push(coffee);\n\n }\n });\n divBody.innerHTML = renderCoffees(filteredNames);\n}" ]
[ "0.7111127", "0.70671946", "0.6926898", "0.65646803", "0.65564334", "0.65414715", "0.6495549", "0.64823645", "0.6480472", "0.64273787", "0.6356719", "0.6287484", "0.628119", "0.62747353", "0.6254951", "0.62457097", "0.6240369", "0.6231702", "0.62291324", "0.6214421", "0.61833346", "0.61649287", "0.61540836", "0.6152671", "0.6150111", "0.61392003", "0.6131705", "0.61268264", "0.61259377", "0.6095607", "0.60922086", "0.6086056", "0.6080461", "0.60792506", "0.60767734", "0.6075486", "0.6068441", "0.60681546", "0.60640305", "0.6064003", "0.60636234", "0.60502464", "0.60488564", "0.604296", "0.60367113", "0.60367113", "0.60263735", "0.5979184", "0.5976218", "0.59689987", "0.5962634", "0.59612143", "0.5948518", "0.5946755", "0.5940837", "0.59381574", "0.5936582", "0.5930257", "0.59255344", "0.59248585", "0.5923567", "0.59207857", "0.59156793", "0.5912786", "0.59094304", "0.58990616", "0.5897481", "0.5888217", "0.588466", "0.58823884", "0.58691734", "0.58639187", "0.58576757", "0.58512354", "0.58500934", "0.5843733", "0.58343816", "0.5820156", "0.581933", "0.5818533", "0.5810253", "0.58017683", "0.5798005", "0.5793281", "0.5789564", "0.5786442", "0.57753366", "0.57703155", "0.57699883", "0.5764388", "0.5760336", "0.57591444", "0.575787", "0.5753717", "0.57503706", "0.57480997", "0.5741961", "0.5738072", "0.5730007", "0.5728624", "0.5724562" ]
0.0
-1
Checks if `value` is a property name and not a property path.
function isKey(value, object) { if (Array.isArray(value)) { return false; } const type = typeof value; if ( type === "number" || type === "boolean" || value == null || isSymbol(value) ) { return true; } return ( reIsPlainProp.test(value) || !reIsDeepProp.test(value) || (object != null && value in Object(object)) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isControlled(props, valueProp) {\n // React's built-in <input> considers a prop to be provided if its value is non-null/undefined.\n // Mirror that behavior here (rather than checking for just undefined).\n return props[valueProp] !== undefined && props[valueProp] !== null;\n}", "function isControlled(props, valueProp) {\n // React's built-in <input> considers a prop to be provided if its value is non-null/undefined.\n // Mirror that behavior here (rather than checking for just undefined).\n return props[valueProp] !== undefined && props[valueProp] !== null;\n}", "function checkOjects(value, obj) {\n return !!obj[value]\n }", "validateVariablesValue(value, property, relativePath) {\n if (Object.prototype.toString.call(value) !== '[object Object]') {\n throw new Error(`Only an object can be converted to style vars (${relativePath}${property})`);\n }\n\n const keys = Object.keys(value);\n for (const k of keys) {\n if (!(\n // Define ok types of value (can be output as a style var)\n typeof value[k] === \"string\"\n || (typeof value[k] === \"number\" && Number.isFinite(value[k]))\n )) {\n throw new Error(\n `Style vars must have a value of type \"string\" or \"number\". Only flat objects are supported. ` +\n `In: ${relativePath}${property ? \":\" : \"\"}${property}`);\n }\n }\n\n return true;\n }", "_isValidPropertyName(str) {\n return /^(?![0-9])[a-zA-Z0-9$_]+$/.test(str);\n }", "function objectPropertyHasValue(prop) {\r\n\r\n return typeof prop !== 'undefined' && prop !== \"\" ? true : false;\r\n}", "function isKey(value, key) {\n\t\t\t/// <summary>Validate a value as being equal to an object key.</summary>\n\t\t\t/// <param name=\"value\" type=\"Object\">The value to validate.</param>\n\t\t\t/// <param name=\"key\" type=\"String\">The name of the property</param>\n\t\t\t/// <returns type=\"String\" />\n\n\t\t\tif (value === null || value === undefined) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif (Object.keys(obj).indexOf(value) !== -1) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\tthrow new TypeError(\n\t\t\t\tkey + \" must be one of: \" + Object.keys(obj).join(\", \")\n\t\t\t);\n\t\t}", "function assertProp(\n prop,\n name,\n value,\n vm,\n absent\n ) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n }", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" + \" Expected \" + expectedTypes.map(capitalize).join(', ') + \", got \" + toRawType(value) + \".\", vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n }", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" + \" Expected \" + expectedTypes.map(capitalize).join(', ') + \", got \" + toRawType(value) + \".\", vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" + \" Expected \" + expectedTypes.map(capitalize).join(', ') + \", got \" + toRawType(value) + \".\", vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" + \" Expected \" + expectedTypes.map(capitalize).join(', ') + \", got \" + toRawType(value) + \".\", vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" + \" Expected \" + expectedTypes.map(capitalize).join(', ') + \", got \" + toRawType(value) + \".\", vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" + \" Expected \" + expectedTypes.map(capitalize).join(', ') + \", got \" + toRawType(value) + \".\", vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" + \" Expected \" + expectedTypes.map(capitalize).join(', ') + \", got \" + toRawType(value) + \".\", vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(\n prop,\n name,\n value,\n vm,\n absent,\n ) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm,\n );\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || \"\");\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(\n getInvalidTypeMessage(name, value, expectedTypes),\n vm,\n );\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name +\n '\".',\n vm,\n );\n }\n }\n }", "function assertProp(prop, name, value, vm, absent) {\n\t if (prop.required && absent) {\n\t warn('Missing required prop: \"' + name + '\"', vm);\n\t return;\n\t }\n\t if (value == null && !prop.required) {\n\t return;\n\t }\n\t var type = prop.type;\n\t var valid = !type || type === true;\n\t var expectedTypes = [];\n\t if (type) {\n\t if (!Array.isArray(type)) {\n\t type = [type];\n\t }\n\t for (var i = 0; i < type.length && !valid; i++) {\n\t var assertedType = assertType(value, type[i]);\n\t expectedTypes.push(assertedType.expectedType || '');\n\t valid = assertedType.valid;\n\t }\n\t }\n\t if (!valid) {\n\t warn('Invalid prop: type check failed for prop \"' + name + '\".' + ' Expected ' + expectedTypes.map(capitalize).join(', ') + ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.', vm);\n\t return;\n\t }\n\t var validator = prop.validator;\n\t if (validator) {\n\t if (!validator(value)) {\n\t warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n\t }\n\t }\n\t}", "function assertProp(prop, name, value, vm, absent) {\n\t if (prop.required && absent) {\n\t warn('Missing required prop: \"' + name + '\"', vm);\n\t return;\n\t }\n\t if (value == null && !prop.required) {\n\t return;\n\t }\n\t var type = prop.type;\n\t var valid = !type || type === true;\n\t var expectedTypes = [];\n\t if (type) {\n\t if (!Array.isArray(type)) {\n\t type = [type];\n\t }\n\t for (var i = 0; i < type.length && !valid; i++) {\n\t var assertedType = assertType(value, type[i]);\n\t expectedTypes.push(assertedType.expectedType || '');\n\t valid = assertedType.valid;\n\t }\n\t }\n\t if (!valid) {\n\t warn('Invalid prop: type check failed for prop \"' + name + '\".' + ' Expected ' + expectedTypes.map(capitalize).join(', ') + ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.', vm);\n\t return;\n\t }\n\t var validator = prop.validator;\n\t if (validator) {\n\t if (!validator(value)) {\n\t warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n\t }\n\t }\n\t}", "function assertProp(prop, name, value, vm, absent) {\n\t if (prop.required && absent) {\n\t warn('Missing required prop: \"' + name + '\"', vm);\n\t return;\n\t }\n\t if (value == null && !prop.required) {\n\t return;\n\t }\n\t var type = prop.type;\n\t var valid = !type || type === true;\n\t var expectedTypes = [];\n\t if (type) {\n\t if (!Array.isArray(type)) {\n\t type = [type];\n\t }\n\t for (var i = 0; i < type.length && !valid; i++) {\n\t var assertedType = assertType(value, type[i]);\n\t expectedTypes.push(assertedType.expectedType || '');\n\t valid = assertedType.valid;\n\t }\n\t }\n\t if (!valid) {\n\t warn('Invalid prop: type check failed for prop \"' + name + '\".' + ' Expected ' + expectedTypes.map(capitalize).join(', ') + ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.', vm);\n\t return;\n\t }\n\t var validator = prop.validator;\n\t if (validator) {\n\t if (!validator(value)) {\n\t warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n\t }\n\t }\n\t}", "function IsPropertyKey(argument) {\n if (Type(argument) === 'string') return true;\n if (Type(argument) === 'symbol') return true;\n return false;\n }", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn('Invalid prop: type check failed for prop \"' + name + '\".' + ' Expected ' + expectedTypes.map(capitalize).join(', ') + ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.', vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn('Invalid prop: type check failed for prop \"' + name + '\".' + ' Expected ' + expectedTypes.map(capitalize).join(', ') + ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.', vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n `Invalid prop: type check failed for prop \"${name}\".` +\n ` Expected ${expectedTypes.map(capitalize).join(', ')}` +\n `, got ${toRawType(value)}.`,\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" +\n \" Expected \" + (expectedTypes.map(capitalize).join(', ')) +\n \", got \" + (toRawType(value)) + \".\",\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n\n if (value == null && !prop.required) {\n return;\n }\n\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(getInvalidTypeMessage(name, value, expectedTypes), vm);\n return;\n }\n\n var validator = prop.validator;\n\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n }", "function assertProp(\n prop,\n name,\n value,\n vm,\n absent\n ) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i], vm);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n var haveExpectedTypes = expectedTypes.some(function (t) {\n return t;\n });\n if (!valid && haveExpectedTypes) {\n warn(\n getInvalidTypeMessage(name, value, expectedTypes),\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n }", "function check_property(obj, name, value)\n{\n property = Object.getOwnPropertyDescriptor(obj, name)\n assert(typeof property === \"object\")\n assert(property.value === value)\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n ) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(\n getInvalidTypeMessage(name, value, expectedTypes),\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n }", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n ) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(\n getInvalidTypeMessage(name, value, expectedTypes),\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n }", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n ) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(\n getInvalidTypeMessage(name, value, expectedTypes),\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n }", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n ) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(\n getInvalidTypeMessage(name, value, expectedTypes),\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n }", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n ) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n \n if (!valid) {\n warn(\n getInvalidTypeMessage(name, value, expectedTypes),\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n }", "function isMapProperty(name) {\n return isObjectProperty(name) || ['any','collect',\n 'collectEntries','collectMany','countBy','dropWhile',\n 'each','eachWithIndex','every','find','findAll',\n 'findResult','findResults','get','getAt','groupBy',\n 'inject','intersect','max','min',\n 'putAll','putAt','reverseEach', 'clear',\n 'sort','spread','subMap','add','take','takeWhile',\n 'withDefault','count','drop','keySet',\n 'put','size','isEmpty','remove','containsKey',\n 'containsValue','values'].indexOf(name) >= 0;\n }", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n if (value == null && !prop.required) {\n return;\n }\n var type = prop.type;\n var valid = !type;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType);\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn('Invalid prop: type check failed for prop \"' + name + '\".' + ' Expected ' + expectedTypes.map(capitalize).join(', ') + ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.', vm);\n return;\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType);\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp (\n prop,\n name,\n value,\n vm,\n absent\n) {\n if (prop.required && absent) {\n warn(\n 'Missing required prop: \"' + name + '\"',\n vm\n );\n return\n }\n if (value == null && !prop.required) {\n return\n }\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType);\n valid = assertedType.valid;\n }\n }\n if (!valid) {\n warn(\n 'Invalid prop: type check failed for prop \"' + name + '\".' +\n ' Expected ' + expectedTypes.map(capitalize).join(', ') +\n ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',\n vm\n );\n return\n }\n var validator = prop.validator;\n if (validator) {\n if (!validator(value)) {\n warn(\n 'Invalid prop: custom validator check failed for prop \"' + name + '\".',\n vm\n );\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n\n if (value == null && !prop.required) {\n return;\n }\n\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(getInvalidTypeMessage(name, value, expectedTypes), vm);\n return;\n }\n\n var validator = prop.validator;\n\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n\n if (value == null && !prop.required) {\n return;\n }\n\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(getInvalidTypeMessage(name, value, expectedTypes), vm);\n return;\n }\n\n var validator = prop.validator;\n\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n\n if (value == null && !prop.required) {\n return;\n }\n\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(getInvalidTypeMessage(name, value, expectedTypes), vm);\n return;\n }\n\n var validator = prop.validator;\n\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}", "function assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n\n if (value == null && !prop.required) {\n return;\n }\n\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i]);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n if (!valid) {\n warn(getInvalidTypeMessage(name, value, expectedTypes), vm);\n return;\n }\n\n var validator = prop.validator;\n\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}" ]
[ "0.60520184", "0.60520184", "0.60428756", "0.58993435", "0.5889884", "0.585996", "0.5847797", "0.5843738", "0.57885444", "0.5783723", "0.5783723", "0.5783723", "0.5783723", "0.5783723", "0.5783723", "0.5781897", "0.57815415", "0.57815415", "0.57815415", "0.5776515", "0.577588", "0.577588", "0.5771946", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.576871", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.57657343", "0.5762621", "0.57625186", "0.57500386", "0.5747452", "0.5747452", "0.5747452", "0.5747452", "0.5747394", "0.5742467", "0.57264394", "0.57261753", "0.57261753", "0.5724732", "0.5724732", "0.5724732", "0.5724732" ]
0.0
-1
click a los numeros;
function Nu(num){ document.getElementById("result").value=document.getElementById("result").value+num; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buttonClicked(key) {\r\n numberButtons.forEach(number => {\r\n if(number.innerText === key) {\r\n number.click();\r\n }\r\n })\r\n}", "handleNumClick(i, e) {\n let numEvent = new CustomEvent('numPress', { 'detail': { 'number': i } });\n let keypad = document.getElementById('keypad');\n keypad.dispatchEvent(numEvent);\n }", "function numberClickListener(evt) {\n var button_id = this.id;\n digit_response.push(button_id.split(\"_\")[1]);\n click_history.push({\n \"button\": button_id.split(\"_\")[1],\n \"rt\": Math.round(performance.now() - trial_onset)\n });\n if (flag_debug) {\n console.log(button_id, ' was clicked. ', digit_response, click_history);\n }\n }", "function clickedNum(num) {\n if (state.result !== undefined) {\n clear();\n }\n\n if (state.operation === undefined) {\n state.operandOne = state.operandOne === \"0\" ? num : (state.operandOne + num);\n panel.textContent = state.operandOne;\n } else {\n state.operandTwo += num;\n panel.textContent = state.operandTwo;\n }\n }", "function numClick(number) {\n\n if ((eval(currentNum) == 0) && (currentNum.indexOf(\".\" == -1))) {\n currentNum = number;\n } else {\n currentNum += number;\n }\n document.getElementById(\"result-display\").value = currentNum;\n\n }", "function handleNumberClick(i) {\n function handleClick() {\n if (i == 0){\n if (!clickNonZero) {\n currentNumber = '0';\n } else {\n currentNumber += '0';\n }\n added = false;\n } else {\n if (!clickNonZero){\n currentNumber = '' + i;\n clickNonZero = true; \n } else {\n currentNumber += i;\n clickNonZero = true; \n }\n added = false; \n }\n // update the text\n paragraph.textContent = pastInput + currentNumber; \n }\n return handleClick;\n}", "function displayNumbers(nr) {\n nr.addEventListener(\"click\", function () {\n clicked.push(nr.value);\n screen.innerText += nr.value;\n })\n\n}", "function click(value) {\n if (!Number.isNaN(parseInt(value))) {\n number(value);\n } else {\n operation(value);\n }\n refresh();\n}", "function clickButtonEl(key) {\n numbersEl.forEach((button) => {\n if (button.innerText === key) {\n button.click();\n }\n });\n}", "function numberClicked(eventData) {\n let buttonInformation = eventData;\n let numberClicked = buttonInformation.target.textContent;\n insertDisplay(numberClicked);\n}", "function onNumberClick($event, getNum) {\n $event.preventDefault();\n userAttempt = parseInt(getNum);\n angular.element('.check-btns').css({'pointer-events': 'auto','cursor':'pointer'});\n return false;\n }", "function chitClicked() {\n press(chitNumberOf(this));\n}", "function clickMe (clicked) {\n let num = clicked.value;\n console.log(arr);\n displayNumber (num);\n}", "function addNum() {\n // add number to display\n\n function numClick(number) {\n\n if ((eval(currentNum) == 0) && (currentNum.indexOf(\".\" == -1))) {\n currentNum = number;\n } else {\n currentNum += number;\n }\n document.getElementById(\"result-display\").value = currentNum;\n\n }\n\n\n// event.target.id to get the number values from the button click\n\n// stackoverflow.com/a/35936912/313756\n\n\n\n $(\"#1\").click(function(){\n numClick(\"1\");\n });\n // if ((eval(currentNum) == 0) && (currentNum.indexOf(\".\" == -1))) {\n // currentNum = \"1\";\n // } else {\n // currentNum += \"1\";\n // }\n // document.getElementById(\"result-display\").value = currentNum;\n // });\n\n $(\"#2\").click(function(){\n numClick(\"2\");\n });\n\n $(\"#3\").click(function(){\n numClick(\"3\");\n });\n\n $(\"#4\").click(function(){\n numClick(\"4\");\n });\n\n $(\"#5\").click(function(){\n numClick(\"5\");\n });\n\n $(\"#6\").click(function(){\n numClick(\"6\");\n });\n\n $(\"#7\").click(function(){\n numClick(\"7\");\n });\n\n $(\"#8\").click(function(){\n numClick(\"8\");\n });\n\n $(\"#9\").click(function(){\n numClick(\"9\");\n });\n\n $(\"#0\").click(function(){\n numClick(\"0\");\n });\n\n}", "function numberClick(event) {\n\tif (!ansPressed)\n\t{\n var content = disp.textContent;\n var btnNum = event.target.textContent.trim();\n \n if(content != \"0\"){\n\t //limit the display area to 12 characters\n\t if(content.length < 12)\n content += btnNum;\n } else {\n content = btnNum;\n }\n \ndisp.textContent = content;\n\t}\n\t\n}", "function handleClick(number) {\n console.log(`Button ${number} was clicked`);\n }", "function fnNum(a){\r\n\t\tvar bClear = false;\r\n\t\toText.value = \"0\";\r\n\t\tfor(var i=0;i<aNum.length;i++){\r\n\t\t\taNum[i].onclick = function(){\r\n\r\n\t\t\t\t//check the switch\r\n\t\t\t\tif(!bOnOrOffClick) return;\r\n\r\n\t\t\t\t//check the clear \r\n\t\t\t\tif(bClear) {\r\n\t\t\t\t\tbClear = false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//check the dot exist\r\n\t\t\t\tif(oText.value.indexOf(\".\")!=-1){\r\n\t\t\t\t\tif(this.innerHTML ==\".\"){\r\n\t\t\t\t\t\treturn;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//check the operator and input value exist;\r\n\t\t\t\t//input a number and a operator\r\n\t\t\t\tif(oPer.value&&oText.value&&oText1.value ==\"\"){\r\n\t\t\t\t\toText1.value = oText.value;\r\n\t\t\t\t\toText.value = \"\";\r\n\t\t\t\t}\r\n\r\n\t\t\t\tvar re = /^0\\.{1}\\d+$/;\r\n\t\t\t\tvar re1 = /^([0]\\d+)$/;\r\n\r\n\t\t\t\t//input to display\r\n\t\t\t\toText.value +=this.innerHTML;\r\n\r\n\t\t\t\tif(re.test(oText.value)){\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(re1.test(oText.value)){\r\n\t\t\t\t\toText.value = this.innerHTML;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//add the operator\r\n\t\t\tfor(var j=0;j<aPer.length;j++){\r\n\t\t\t\taPer[j].onclick = function(){\r\n\r\n\t\t\t\t\t//calulator\r\n\t\t\t\t\tif(oPer.value&&oText.value&&oText1.value){\r\n\t\t\t\t\t\tvar n = eval(oText1.value + oPer.value +oText.value);\r\n\t\t\t\t\t\toText1.value = n;\r\n\t\t\t\t\t\toText1.value = \"\";\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//display the result;\r\n\t\t\t\t\toPer.value = this.innerHTML;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t//calculator get the result;\r\n\t\t\toDeng.onclick = function(){\r\n\t\t\t\t// add substract multiply divided percent\r\n\t\t\t\tif(oText1.value ==''&&oPer.value ==\"\"&&oText.value==\"\"){\r\n\t\t\t\t\treturn ;\r\n\t\t\t\t}\r\n\t\t\t\tvar n = eval(oText1.value + oPer.value + oText.value);\r\n\t\t\t\toText1.value = \"\";\r\n\t\t\t\toText.value = n;\r\n\t\t\t\toPer.value = \"\";\r\n\t\t\t\tbClear = true;\r\n\t\t\t}\r\n\r\n\t\t\t//the rec operation\r\n\t\t\toRec.onclick = function(){\r\n\t\t\t\tvar a = 1/oText.value;\r\n\t\t\t\tif(a==0){\r\n\t\t\t\t\toText1.value = \"无穷大\";\r\n\t\t\t\t}\r\n\t\t\t\toText.value = a;\r\n\t\t\t}\r\n\r\n\t\t\t//sqiuare\r\n\t\t\toSq.onclick = function(){\r\n\t\t\t\tvar a = Math.pow(oText.value,0.5);\r\n\t\t\t\toText.value = a;\r\n\t\t\t}\r\n\r\n\t\t\toZheng.onclick = function(){\r\n\t\t\t\t\toText.value = -oText.value;\t\t\t\t\r\n\t\t\t}\r\n\r\n\t\t\toClea.onclick = function(){\r\n\t\t\t\toText.value = \"0\";\r\n\t\t\t\toText1.value = \"\";\r\n\t\t\t\toPer.value = \"\";\r\n\t\t\t}\r\n\t\t}\r\n\t}", "function clickBotton(){\n\tvar groupNumbers = $numbers.value.trim();\n\tvar numbers = groupNumbers.split(' ');\n\n\t/* ordenando los valores ascendentemente */\n\tvar numberAsc = numbers.sort(function(a, b){return a-b});\n\t/* ordenando los valores ascendentemente */\n\n\t/*revisar si es que hay un valor repetido y retirarlo*/\n\tvar unique = numberAsc.filter(function(item, i, ar){ return ar.indexOf(item) === i; });\n\t/*revisar si es que hay un valor repetido y retirarlo*/\n\n\n\t$numberList.innerHTML = '';\n\n\tfor( var i = 0; i < unique.length; i++ ) {\n\n\t\tvar current = unique[i];\n\n\t\tvar elt = document.createElement('span');\n\t\telt.appendChild(document.createTextNode(current));\n\n\t\t$numberList.appendChild(elt);\n\t}\n}", "NumberButtonSelect(number){\n this.refHolder.getComponent('AudioController').PlayTap();\n console.log(\"number \"+number);\n\n if(this.prevID !== 10){\n\n if(this.inputButs[this.prevID].getComponent(\"InputButScript\").GetValue() !== 0){\n this.numberButs[this.inputButs[this.prevID].getComponent(\"InputButScript\").GetValue()].getComponent(\"NumberButScript\").DeSelectNumber();\n }\n this.inputButs[this.prevID].getComponent(\"InputButScript\").SetValue(number);\n\n }\n\n\n }", "function clickNumbers(val) {\n var string = displayBox.innerHTML;\n if (string.lastIndexOf(\")\")>3) {\n ;\n } else {\n if (string.charAt(string.indexOf(\"(\") + 1) != string.charAt(string.indexOf(\")\") - 1)) {\n var substring1 = Number(string.charAt(string.indexOf(\"(\") + 1) + string.charAt(string.indexOf(\")\") - 1));\n } else {\n var substring1 = Number(string.charAt(string.indexOf(\"(\") + 1));\n }\n if (Number(val) < substring1) {\n string += val;\n checkLength(string);\n displayBox.innerHTML = string;\n } else {\n displayBox.innerHTML = \"Invalid\";\n $(\"button\").prop(\"disabled\", true);\n $(\".calu-func\").attr(\"disabled\", false);\n }\n }\n }", "function operandClicked(key) {\r\n operatorButtons.forEach(operator => {\r\n if(operator.innerText === key) {\r\n operator.click();\r\n }\r\n })\r\n}", "function numberClick() {\n lowerDisplayString += $(this).attr('id');\n displayString += $(this).attr('id');\n $('#display').text(displayString);\n $('#lower-display').text(lowerDisplayString);\n $(this).addClass('keyFrame');\n keyFrame = $(this);\n window.setTimeout(removeKeyframe, 250);\n}", "function clickDigit(number) {\n if (active==\"input\") {\n\n if ((decimalPoints + digitPoints) > 9) {\n return;\n }\n\n if (decimalActive) {\n decimalPoints ++;\n\n if (input >= 0) {\n input += number*Math.pow(10,(-1)*(decimalPoints));\n }\n\n else {\n input -= number*Math.pow(10,(-1)*(decimalPoints));\n }\n }\n\n else {\n\n if (input == 0 && number ==0) {\n return\n }\n\n else {\n digitPoints ++;\n\n if (input >= 0) {\n input = (input*10)+number;\n }\n\n else {\n input = (input*10)-number;\n }\n\n }\n\n }\n\n setScreen(\"input\");\n\n }\n\n else if (active==\"calculation\") {\n input = number;\n digitPoints=1;\n\n setScreen(\"input\");\n }\n\n else {\n setScreen(\"ERROR\");\n }\n\n}", "function buttonPress(clickId,displayId,number){\n const clickBtn= document.getElementById(clickId);\n clickBtn.addEventListener(\"click\", function(){\n document.getElementById(displayId).value+=\n number;\n})\n}", "function handleNum(e) {\n\n // There are two ways into this function: either clicking on the number or pressing said num in the keyboard\n // This \n let numberPressed;\n (e instanceof Event) ? numberPressed = e.target.textContent : numberPressed = e;\n\n if (lastBtnPressed == 'operator' || mainDisplay.textContent == '0') {\n mainDisplay.textContent = numberPressed;\n } else {\n mainDisplay.textContent += numberPressed;\n\n // If the width of the display is higher than the preset value, ignore last number (as to prevent visual overflow)\n if(getComputedStyle(mainDisplay).width != '370px') {\n let auxArr = Array.from(mainDisplay.textContent);\n auxArr.pop();\n mainDisplay.textContent = auxArr.join('');\n }\n }\n\n lastBtnPressed = 'number';\n clearBtn.textContent = 'C';\n}", "function amelioration(){\n return nbMultiplicateurAmelioAutoclick +9;\n}", "function clickPlusMinus() {\n if (dispError()) return;\n if (currentNumber===undefined) {\n if (storedNumber === undefined) return;\n currentNumber = -1 * storedNumber;\n digitAfterPeriod = String(currentNumber).split('.')[1] === undefined ? 0 : String(currentNumber).split('.')[1].length + 1;\n } else {\n currentNumber *= -1;\n }\n displayStoredContent('');\n displayCurrentNumber();\n}", "function strum(){\n let button;\n for(let i = 6; i >= 1; i--){\n button = document.getElementById(i);\n button.click();\n }\n}", "function panierIncrement0(){\n boutonPanier[0] = document.querySelector('#bouton-panier-0');\n boutonPanier[0].addEventListener('click', () =>{\n i++;\n nbrPanier.innerHTML = i;\n prixPanier0();\n }); \n}", "handleClick(e, number) {\n console.log(\"clicke\" + e.target);\n this.counter += number;\n }", "function putNumber(num){ // for buttons\n line.value = line.value + num.toString();\n}", "function clickDigit(digit) {\n if (operator === null) {\n if (firstOperand.includes('.') && digit === '.') {\n // Do Nothing\n } else {\n setFirstOperand(`${firstOperand}${digit}`)\n setDisplay(`${firstOperand}${digit}`)\n }\n } else {\n if (secondOperand.includes('.') && digit === '.') {\n // Do Nothing\n } else {\n setSecondOperand(`${secondOperand}${digit}`)\n setDisplay(`${secondOperand}${digit}`)\n }\n }\n }", "function reiniciar() {\n $(\"#num1\").text(\"\");\n $(\"#num2\").text(\"\");\n $(\"#num3\").text(\"\");\n $(\"#num4\").text(\"\");\n $(\"#num5\").text(\"\");\n $(\"#num6\").text(\"\");\n $(\"#num7\").text(\"\");\n $(\"#num8\").text(\"\");\n $(\"#num9\").text(\"\");\n $(\".celda\").click(jugada);\n numero=0;\n // cualquiera de los dos se puede \n //$(document).on(\"click\", \".celda\", jugada);\n}", "function numberClicked(number) {\r\n status = document.getElementById(\"hidden_status\").value ;\r\n \r\n if (status == 'eq') {\r\n number_new = number;\r\n document.getElementById(\"hidden_text\").value ='';\r\n document.getElementById(\"hidden_status\").value ='ok';\r\n }\r\n else if (status == 'operator') {\r\n number_new = number;\r\n document.getElementById(\"hidden_status\").value ='ok';\r\n } \r\n else{\r\n number_prev = document.getElementById(\"display\").value;\r\n number_new = number_prev + number; \r\n }\r\n \r\n\r\n document.getElementById(\"display\").value = number_new;\r\n\r\n addText(number);\r\n\r\n // decimal point can be only once\r\n if (number == '.') {\r\n disableDecimalPoint(true);\r\n }\r\n\r\n}", "function doeClick(){\n \n countClik ++;\n var number= this.getAttribute('data-role');\n totalCount += parseInt(number);\n uitvoeren();\n}", "function ceClicked(){\n\t$display.val('');\n\tneedNewNum = true;\n\tnumEntered = false;\n}", "function choiceClick(counter) {\n $('#picture .slick-next').trigger('click');\n $('.img-overlay').find('.click-overlay').parent().next().find('.overlay').addClass('click-overlay');\n $('#picture-array .slick-next').trigger('click');\n $('.image_number').html(counter + 1 + ' of 46');\n}", "function input_digit(n) {\n if (equals_just_used) {\n AC();\n }\n equals_just_used = false;\n operator_click_num = 0;\n digit_click_num++;\n update_variables('digit', n);\n update_display();\n}", "function buttonClickHandler(el) {\n removeLeadingZero(el)\n lastValue = el.value\n\n let basicOperator = evalBasicOperator(el)\n if (calculatePower(el)) {\n\n }\n else if (basicOperator != null) {\n display += basicOperator\n evaluationString += basicOperator\n if(basicOperator == \"-\" || basicOperator ==\"+\"){\n lastDigitClicked += basicOperator\n }\n } else if (!evalComplexOperator(el)) {\n if(!isNaN(el.value)){\n if(!isNaN(lastValue)){\n lastDigitClicked += el.value\n }else{\n lastDigitClicked = el.value\n }\n }\n display += el.value\n evaluationString += el.value\n }\n document.getElementById(\"output\").value = display\n}", "function digitsListener(item, i){\n item.addEventListener('click', function(){\n if(digits[i].textContent==='.'){\n if(!sign && firstNumber.indexOf('.')>-1) return;\n if(sign && secondNumber.indexOf('.')>-1) return;\n }\n if((!firstNumber && digits[i].textContent==='.') ||\n (sign && !secondNumber && digits[i].textContent==='.')) {\n inputPanel.innerHTML+=\"0\";\n }\n inputPanel.innerHTML+=digits[i].textContent;\n if(sign===\"\"){\n firstNumber+=digits[i].textContent;\n }\n else {\n secondNumber+=digits[i].textContent;\n }\n })\n}", "function prixamelioclick(){\n return Math.round(500 * (nbMultiplicateurAmelioAutoclick * 0.5));\n}", "function keyboardListener(key) {\n switch (key) {\n case 13:\n $(\"#equals\").trigger(\"click\");\n break;\n case 42:\n $(\"#multiply\").trigger(\"click\");\n break;\n case 43:\n $(\"#add\").trigger(\"click\");\n break;\n case 45:\n $(\"#subtract\").trigger(\"click\");\n break;\n case 46:\n $(\"#decimal\").trigger(\"click\");\n break;\n case 47:\n $(\"#divide\").trigger(\"click\");\n break;\n case 48:\n $(\"#zero\").trigger(\"click\");\n break;\n case 49:\n $(\"#one\").trigger(\"click\");\n break;\n case 50:\n $(\"#two\").trigger(\"click\");\n break;\n case 51:\n $(\"#three\").trigger(\"click\");\n break;\n case 52:\n $(\"#four\").trigger(\"click\");\n break;\n case 53:\n $(\"#five\").trigger(\"click\");\n break;\n case 54:\n $(\"#six\").trigger(\"click\");\n break;\n case 55:\n $(\"#seven\").trigger(\"click\");\n break;\n case 56:\n $(\"#eight\").trigger(\"click\");\n break;\n case 57:\n $(\"#nine\").trigger(\"click\");\n break;\n }\n}", "function clickCube(){\r\n\tlet cube = parseInt(document.querySelector(\"#cube\").value);\r\n\tconsole.log(cube * cube * cube);\r\n}", "function clickedOn() {\n if (this.id === 'C' || this.id === '/' || this.id === 'X' || this.id === '-' || this.id === '+' || this.id === '=' || this.id === '.') {\n symPress(this.id);\n } else {\n numPress(this.id);\n }\n // If NaN (for example, from 0/0) clears the calc and displays a message)\n if (displayWindow.innerHTML === 'NaN') {\n clear();\n displayWindow.innerHTML = '-Undefined-';\n }\n // Debugging Logs:\n console.log(`Equation: ${num1} ${operand} ${num2}`);\n console.log(`Equal temp num: ${equalTemp}; eqPress: ${eqPress}`)\n console.log('---------------');\n}", "function inputNum(evt){\n //have one event on the parent that listens to all the children. The if statement stops the even firing if the parent element is clicked. \n num += evt.target.id;\n screen.value = num;\n}", "function ClickCounter() {}", "function getNumber(e) {\n 'use strict';\n\n // if the actions array has a number\n // and no operator then reset the array\n if (actions.length === 1) {\n num = '';\n results = [];\n actions = [];\n }\n\n keyPress = e.currentTarget.id;\n // console.log(keyPress);\n\n // make sure only one decimal\n if (keyPress === 'dot' || keyPress === '.') {\n // console.log(result.indexOf('.'));\n if (results.indexOf('.') === -1) {\n keyPress = '.';\n results.push(keyPress);\n }\n } else {\n results.push(keyPress);\n }\n // console.log(results);\n\n // make the number from the array\n num = results.join('');\n // strip off leading zero's\n // console.log(/^0+[1-9]+/.test(num));\n if (/^0+[1-9]+/.test(num)) {\n // console.log(\"zeros with a number\");\n num = num.replace(/^0+/, '');\n } else if (/^0+\\./.test(num)) {\n // console.log(\"zeros with a dot\");\n num = num.replace(/^0+\\./, '0.');\n } else if (/^0+/.test(num)) {\n // zero\n // console.log(\"all zeros\");\n num = 0;\n }\n // console.log('results: ' + num);\n if (isNaN(num) === false) {\n showNum(num);\n return;\n } else {\n return;\n }\n }", "function getNumbers() {\n let numbers = document.getElementsByClassName('number');\n for(i=0; i<numbers.length; i++) {\n numbers[i].addEventListener('click', event => {\n let eventData = event;\n numberClicked(eventData);\n });\n }\n \n}", "function celulaClick() {\n let loc = this.id.split(\"_\");\n let row = Number(loc[0]);\n let col = Number(loc[1]);\n\n if (this.className==='vivo'){\n this.setAttribute('class', 'muerto');\n aGen[row][col] = 0;\n \n }else{\n this.setAttribute('class', 'vivo');\n aGen[row][col]=1;\n }\n}", "click() { }", "function operator(x) {\n decimal_clicked = false;\n equals_just_used = false;\n digit_click_num = 0;\n if (x != \"%\") {\n operator_click_num++;\n }\n update_variables('operator', x);\n update_display();\n}", "function clickNumber(event) {\r\n console.log(event.target.value);\r\n \r\n if(operation.innerHTML == \"\")\r\n\tfirstNumber.innerHTML += event.target.value;\r\n else if(operation.innerHTML != \"\")\r\n\tsecondNumber.innerHTML += event.target.value;\r\n}", "function dondeClick(event) {\n if (event.target.className == \"asiento\") {\n event.target.classList.add(\"seleccionado\");\n document.getElementById(\"numero\").innerHTML++;\n calcularPrecio();\n almacenar();\n } else if (event.target.className == \"asiento seleccionado\") {\n event.target.classList.remove(\"seleccionado\");\n document.getElementById(\"numero\").innerHTML--;\n calcularPrecio();\n almacenar();\n }\n}", "function dailNumberFunc(e){ \n let clickBtn=e.target.textContent; \n showHideDisplays('none','none','block')\n let dailNumber=['1','2','3','4','5','6','7','8','9','0','*','#']; \n let addingNumber=dailNumber.find(elem=>{\n return clickBtn===elem?elem:null; })\n if(addingNumber===undefined){\n return; \n } else{ \n if(textArea.textContent.length>=7){\n textArea.style.fontSize='1.5em'; \n }\n if(textArea.textContent.length>=20){\n textArea.style.fontSize='1em';\n }\n if(textArea.textContent.length>=30){\n return\n }\n textArea.textContent += addingNumber; \n } }", "function ClickEvent(maso){\n var string_So_Luong=\"\";\n //lay string text box\n string_So_Luong=document.getElementById(maso.ToString()).value;\n //parse to int\n So_Luong = parseInt(string_So_Luong);\n \n\n }", "function digitPressed(digit) {\n button = document.querySelector(`.number${digit}`);\n button.classList.add(\"clicked\");\n if (display.classList.contains(\"clear\")) {\n display.textContent = \"\"; // clear display\n display.classList.remove(\"clear\");\n }\n if(display.textContent.length > 10){\n return;\n }\n display.textContent += digit;\n}", "function clickOn1(){if(goodAnswer == 1){ correctAnswerClick(1); }else{ badAnswerClick(1); }}", "function printDigit(e) {\n let obj=e.target;\n\n if (result.value==='0') {\n result.value=obj.textContent;\n } else {\n result.value +=obj.textContent;\n }\n}", "function digit_input_one (value) {\n //conditional to allow number click\n if (buttonClick === null) {\n //get number value from html element\n var numberRetriever = $(value).children('h3').html();\n //differentiate between a decimal. If decimal has been clicked during forst operand then no other decimals will be allowed\n if(numberRetriever === '.' && decimalClick === null) {\n number = numberRetriever;\n //sets decimal conditional to be false\n decimalClick = false;\n }\n //conditional to allow all html elements besides decimals top be logged\n else if (numberRetriever != '.') {\n number = numberRetriever;\n }\n console.log('Subsequent Number is: ' + number);\n //Once the first number has been enetered the operators may be clicked\n operatorClick = true;\n }\n //empty operand value set to add on the the number value for every click\n operand += number;\n //reset the number value\n number = '';\n //show the operand value on the screen\n $('.output').html(operand);\n console.log(operand);\n //allow operator buttons to be clicked\n equateClick = true;\n}", "function onClick () {\n\n // erhöhe den Wert der Variable 'clicks' um 1\n clicks++;\n\n var text = '';\n\n if (clicks === 1) {\n // beim ersten Klick\n text = 'Hallo!';\n } else if (clicks < 4) {\n // beim zweiten und dritten Klick\n text = 'Hmmm';\n } else {\n // bei allen folgenden Klicks\n text = 'Autsch!';\n }\n\n // setze den Inhalt des Elements mit der ID 'reaktion' auf den zuvor bestimmten Text\n reaktion.textContent = text;\n }", "function toOctClicked(){colorTo(3); toOct = true, toDec = false; toBin = false, toHex = false;}", "function numberClicked(event) {\n\n if (para.textContent.includes(\"=\")) {\n // do nothing\n } else if ((event.target.innerHTML == \".\") && (para.textContent.endsWith(\".\"))) {\n // do nothing\n } else {\n para.textContent += event.target.innerHTML;\n }\n}", "function touches9() {\n\tif (num[9]==true){\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"9\";\n\t} else {\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"\";\n\t}\n}", "function clicked(d,i) {\n\n}", "function clicked(d,i) {\n\n}", "function setupNumberButtons() {\n let buttons = document.querySelectorAll(\".button-operator, .button-number\");\n for (var i = 0; i < buttons.length; i++) {\n buttons[i].addEventListener('click', addToScreen, false);\n }\n}", "function updateClickerDisplay(num) {\n clickerCounterDisplay.innerText = num;\n}", "clickNumber(event) {\n\n // 'number' is set to the number clicked\n let NUMBER = event.target.innerText\n\n /* \n If the number 0 is clicked, we don't want 0 to simply be concating onto the existing operand\n lest we create a situation where we have '003080', so we separate zero and check whether it\n should be appended\n */\n\n if(NUMBER==ZERO) {\n this.handleZero()\n }\n\n /*\n If the value of the operand is default '0' then 'number' is not concated to it, but replaces\n the default value. This prevents readouts like '03' (if 3 is clicked.) Instead it will become '3'\n */\n else {\n if(this.state.operand==ZERO) {\n this.setState({operand: NUMBER});\n this.updateLowerDisplay(NUMBER);\n }\n else if(this.state.operand!=ZERO) {\n this.handleConcat(NUMBER);\n }\n }\n }", "function onClickUno() {\n if (operandoType != 1) { opHiddenIndex++; }\n operandoType = 1;\n strDisplay += \"1\";\n\n insertOpHidden(\"1\");\n refreshDisplay();\n}", "function listenForClick(number) {\n if (TEST_LIGHTS === game[TEST_MODE]) {\n setTimeout(function () {\n nextRound()\n }, 1000);\n }\n}", "function autoclickprix(){\n return Math.round(200 * (nbMultiplicateurAmelioAutoclick * 0.40));\n}", "function o(a){a.click(p).mousedown(ka)}", "function crystalClick () {\n counter += parseInt($(this).attr(\"value\"));\n\t\t$(\".score-number\").html(counter);\n\t\tif (counter == targetNumber) {\n\t\t\twins++;\n\t\t\ttotalReset();\n\t\t}\n\t\telse if (counter > targetNumber) {\n\t\t\tlosses++;\n\t\t\ttotalReset();\n };\n console.log(\"clicks are working\")\n }", "numBoxClicked(numBoxRow, numBoxCol, numBoxVal) {\n \tif (this.model.crossOutNum(numBoxRow, numBoxCol, numBoxVal) === true) {\n \t\tthis.view.strikeNum(numBoxRow, numBoxCol);\n \t\t\n \t\tif (this.model.crossOutLockBox(numBoxRow, numBoxCol) === true) {\n \t\t\tthis.view.strikeLockBox(numBoxRow);\n \t\t\tthis.view.disappearDie(numBoxRow);\n \t\t}\n \t\t\n \t\tthis.view.changeButtons(this.model.gamePhase);\n \t\tthis.gameOverCheck();\n \t}\n }", "function btn1click(){\n //calling function with btn number\n if(start ==true){ selectImg(\"1\");}\n}", "function runEventListener (i){\n clickSound.play()\n let currentButtonText = buttons[i].innerHTML\n if ((!isNaN(currentButtonText) || currentButtonText === '.') && temporaryValue.length < 10){\n clickNumberButton(currentButtonText)\n }\n else if (currentButtonText === 'AC'){\n clickAcButton ()\n }\n else if (currentButtonText === 'CE'){\n clickCeButton ()\n }\n else if (currentButtonText === '='){\n clickEqualButton ()\n }\n else if (isNaN(currentButtonText)){\n clickSymbolButton (currentButtonText)\n }\n}", "function clickListener(num) {\n\treturn function() {\n\t\tself.port.emit(\"clicked-link\", num);\n\t};\n}", "function printDigit(e) {\n let obj = e.target;\n \n if (result.value === '0') {\n result.value = obj.textContent;\n } else {\n result.value += obj.textContent;\n }\n}", "function numero1(num){\n \n if(document.getElementById(\"Ctexto\").value==\"\" && op==false ){\n\t\tdocument.getElementById(\"Ctexto\").value=num;\n\t\top=true;\n\t\tcont++;\n\t\tdocument.getElementById(\"dados1\").style.visibility =\"hidden\";\n\t\t\n\t}else if(op==false){\n\t\t//$('#dados1,#dados2,#dados3,#dados4,#dados5').click(function (){$(this).hide()});\n\t\tdocument.getElementById(\"Ctexto\").value+=num;\n\t\top=true;\n\t\tcont++;\n\t\tdocument.getElementById(\"dados1\").style.visibility =\"hidden\";\n\t}\n\n}", "function clickPageNumber(pagenumber){\n pageNumber = pagenumber;\n //chang display amount label and write page to next page\n changeDisplayAmount(displayType,pagenumber);\n}", "function clickOperator(event) {\r\n console.log(event.target.value);\r\n \r\n if(secondNumber.innerHTML != \"\" || firstNumber.innerHTML == \"\")\r\n\treturn;\r\n operation.innerHTML = event.target.value;\r\n}", "function touches1() {\n\tif (num[1]==true){\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"1\";\n\t} else {\n\t\twindow.document.calculatrice.affiche.value = \n\t\twindow.document.calculatrice.affiche.value + \"\";\t\t\n\t}\n}", "function operClicked(){\n\tif((chain === false)){\n\t\tfirstMemory = Number($display.val());\n\t} else if(numEntered){\n\t\tif(operator === \"+\"){\n\t\t\tfirstMemory = add(firstMemory, Number($display.val()));\n\t\t} else if(operator === \"-\"){\n\t\t\tfirstMemory = substract(firstMemory, Number($display.val()));\n\t\t} else if(operator === \"×\"){\n\t\t\tfirstMemory = multiply(firstMemory, Number($display.val()));\n\t\t} else if(operator === \"÷\"){\n\t\t\tfirstMemory = divide(firstMemory, Number($display.val()));\t\n\t\t}\n\t} \n\n\toperator = $(this).text();\n\tconsole.log(operator);\n\tchain = true;\n\tneedNewNum = true;\n\tisThereDot = false;\n\tnumEntered = false;\n}", "function operatorPressed(operator) {\n // if remaining minus, do nothing\n if (display.textContent === '-'){\n return;\n }\n const button = document.querySelector(`.${getOperatorName(operator)}`);\n button.classList.add(\"clicked\");\n display.dataset.numbers += \",\"+display.textContent; // save number\n display.dataset.operators += \",\"+operator; // save operator\n display.classList.add(\"clear\");\n}", "function printNumber() {\n\n //Attribution du symbol du bouton cliqué (chiffre) à la variable nb\n let nb = this.getAttribute(\"data-symbol\");\n\n //Affiche le chiffre cliqué dans l'écran (screen)\n screen.textContent += nb;\n\n //On enlève tous les espaces du string (screen) et on met cela dans la variable screenContent\n let screenContent = screen.textContent.replace(/\\s/g, \"\");\n \n //On affiche le résultat de l'équation dans screenResult avec un arrondit à 2 chiffres après la virgule\n screenResult.textContent = `= ${Math.round(eval(screenContent)*100)/100}`;\n\n //On enlève la classe \"result\" au screenResult\n screenResult.classList.remove(\"result\");\n}", "function buttonClick(value) {\n if (isNaN(parseInt(value))) {\n handleSymbol(value);\n } else {\n handleNumber(value);\n }\n rerender();\n}", "function buttonClicked(value) {\n\tif (isNaN(parseInt(value))) {\n\t\thandleOperators(value);\n\t\tclear(value);\n\t} else {\n\t\tnumberManage(value);\n\t}\n\trerender();\n}", "function acClicked(){\n\tfirstMemory = 0;\n\tsecondMemory = 0;\n\tshowOnDisplay('');\n\tneedNewNum = true;\n\tchain = false;\n\tnumEntered = false;\n}", "function handler(){\n switchCounter++;\n if(switchCounter%2===1 && $values.innerText.length<8){\n $values.style.display=\"block\";\n for(j=0;j<=10;j++){\n $number[j].addEventListener(\"click\",numberSelect);\n }\n for(m=0;m<=3;m++){\n $operator[m].addEventListener(\"click\",operation);\n }\n $equals.addEventListener(\"click\",showAnswer);\n $mPositive.addEventListener(\"click\",storeToMemory);\n $mNegative.addEventListener(\"click\",removeFromMemory);\n $mrc.addEventListener(\"click\",storedMemory);\n }\n else{\n $values.style.display=\"none\";\n $values.innerText=0;\n numberIsClicked=false;\n operatorIsClicked=false;\n numberOfOperand=0;\n equalsToIsClicked=false;\n myoperator=\"\";\n }\n}", "function addClicks (int1) {\n rockTotal += int1;\n }", "clicked(x, y) {}", "function change_by_one(value, direction){\n\n var number = value.replace(/[^-\\d\\.]/g, '');\n var unit = value.replace(number, '').trim();\n\n if(number == \"\") number = \"0\";\n if(unit == \"\") unit = \"px\"; \n\n var newvalue = \"\";\n\n if(direction == \"plus\")\n newvalue = Number(number) + 1; \n else newvalue = Number(number) - 1; \n\n console.log(newvalue + \"\" +unit);\n return newvalue+unit; \n\n alert(\"new value after click \"+ newvalue+unit);\n }", "function getNum(n){\n let screen = document.getElementById(\"screen\");\n screen.value += n;\n}", "function getNumber(count){\n\n\t var num = document.getElementById(\"btn\");\n alert(num.innerHTML);\n alert (count);\n}", "function _click(d){\n \n }", "function fromOctClicked(){colorFrom(3); fromOct = true, fromBin =false, fromDec = false, fromHex = false;}", "function buttons(idbutton) {\n var value = idbutton.val();\n $(idbutton).click(() => {\n console.log(\"Puntos: \" + contpoint);\n if(entry == null) {\n entry.val(value);\n } else if(entry.val().length >= 12) {\n console.log(\"Esta full\");\n } else if(value == \".\" && contpoint == 0) {\n contpoint++;\n entry.val(entry.val() + value);\n } else if(value == \".\" && contpoint > 0) {\n console.log(\"Hay mas de un punto\");\n }\n else {\n entry.val(entry.val() + value);\n }\n $(idbutton).addClass(\"animated pulse\").one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', () => {\n $(idbutton).removeClass(\"animated pulse\");\n });\n });\n}", "function addClick(ind){\n var elem = shapes[ind];\n elem.addEventListener(\"click\", function(){\n clicked += 1;\n checkOrder(ind);\n\n });\n }", "function SomaClickState() {\n setState(stateValue = stateValue + 1); // Mesma coisa que isso state[1](stateValue);\n // Por setState ser uma funcao ele temq ue ser escrito seu nome e parenteses\n }", "function handleNumber(number) {\n if (resultDisplay.innerText == '0' || operatorPressed) {\n changeDisplay('');\n operatorPressed = false;\n }\n resultDisplay.innerText += number;\n}", "function clickToSum() {\n\tvar sum = 0;\n\tvar nums = document.getElementsByClassName(\"number\");\n\tvar bigButton = document.getElementsByClassName(\"info\")[0];\n\n\tfor (var i = 0; i < nums.length; i++) {\n\t\tsum += parseInt(nums[i].innerHTML);\n\t}\n\n\tbigButton.getElementsByTagName(\"h2\")[0].appendChild(document.createTextNode(sum));\n}" ]
[ "0.7131207", "0.7007308", "0.6951292", "0.6844245", "0.68236154", "0.6785539", "0.6764145", "0.67068475", "0.66902304", "0.66212386", "0.65701467", "0.6565539", "0.6507141", "0.6483116", "0.6441663", "0.63847923", "0.6383678", "0.63509285", "0.6316498", "0.6312572", "0.63093907", "0.62617254", "0.6249654", "0.6219076", "0.61256856", "0.6119096", "0.61123574", "0.60940564", "0.603111", "0.60231227", "0.6001712", "0.59867424", "0.5984633", "0.5984572", "0.5983966", "0.59804595", "0.59698683", "0.5966743", "0.5951503", "0.59353095", "0.5932322", "0.5928852", "0.59286857", "0.5928476", "0.59198296", "0.5915391", "0.5915377", "0.5905284", "0.58984935", "0.5893946", "0.5889284", "0.58698094", "0.5863869", "0.5860097", "0.58464664", "0.58461916", "0.58415407", "0.5839543", "0.5820957", "0.58150446", "0.58066446", "0.58011943", "0.57853895", "0.5777331", "0.5777331", "0.57765007", "0.5774835", "0.57676953", "0.57670313", "0.5761483", "0.57516265", "0.57507247", "0.5748041", "0.5741868", "0.5732195", "0.5731344", "0.5728761", "0.57133913", "0.5710279", "0.5706748", "0.5702245", "0.57019645", "0.5693243", "0.5692313", "0.5690719", "0.56894517", "0.5684643", "0.56791306", "0.56778723", "0.5671207", "0.5668744", "0.5663496", "0.566273", "0.5658428", "0.5656604", "0.56556857", "0.56429654", "0.5638859", "0.5636795", "0.56322515", "0.5628458" ]
0.0
-1
click al signo (+,/,,)
function Sign(s){ G_Numero1=document.getElementById("result").value; G_Signo=s; document.getElementById("result").value=""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clickSignInLnk() {\n return this.SignInLnk.click();\n }", "function signupLinkClick() {\n closeSigninClick();\n signupClick();\n}", "clickOnSignInLink(){\n let signInLink = utils.byLocator(jobsPageLocator.jobsPage.SignInLink);\n utils.clickOn(signInLink);\n }", "async clickSignIn() {\n await this.driver.findElement(By.css(SELECTORS.signIn)).click();\n }", "function onClick () {\n navCur && navCur.click();\n }", "@api\n click() {\n const anchor = this.emailAnchor;\n if (anchor && anchor.click) {\n anchor.click();\n }\n }", "clickFacebook(){\n window.location.href=\"http://facebook.com\";\n }", "click_extra() {\r\n }", "function click(){\n document.getElementById(\"defaultOpen\").click();\n}", "function emailIconClick() {\n\tlocation.href = \"mailto:mjdargen@gmail.com\";\n}", "function twitKisminaTikla(){\n let nelerOluor = document.getElementsByClassName(\"public-DraftEditorPlaceholder-inner\");\n nelerOluor[0].click();\n\n}", "function equalsClicked(key) {\r\n equalButton.click();\r\n}", "click() { }", "async clickSignUp() {\n await this.driver.findElement(By.css(SELECTORS.signUpButton)).click();\n }", "function ClickGerarElite() {\n GeraElite();\n AtualizaGeral();\n}", "function handleClick(event){\n console.log(\"Signing in\")\n}", "function ClickGerarComum() {\n GeraComum();\n AtualizaGeral();\n}", "function InventoryItemMouth2CupholderGagClick() {\n\tInventoryItemMouthCupholderGagClick();\n}", "function operandClicked(key) {\r\n operatorButtons.forEach(operator => {\r\n if(operator.innerText === key) {\r\n operator.click();\r\n }\r\n })\r\n}", "function signatureBoxFun() {\r\n if (!this.classList.contains('loading')) {\r\n const input = this.querySelector('#sign-upload');\r\n input.click();\r\n }\r\n}", "function ClickGerarAleatorioElite() {\n GeraAleatorioElite();\n AtualizaGeral();\n}", "function q(a){a.click(u).mousedown(Ta)}", "goToSignupPage() {\n Linking.openURL('https://signup.sbaustralia.com');\n //Actions.signup();\n }", "function trackSignupClick (e) {\n var buttonId = e.currentTarget.getAttribute('id');\n var pageId = document.querySelector('body').getAttribute('id');\n return window.client.trackExternalLink(e, 'signup_click', {id: buttonId, page: pageId});\n}", "clickAddToCart() {\n return this\n .waitForElementVisible('@addToCartBtn')\n // .moveToElement('@addToCartBtn', 10, 10)\n .click('@addToCartBtn');\n }", "function click(x, y)\n{\n //Do Nothing, prompt only command.\n}", "function q(a){a.click(u).mousedown(V)}", "function ativeBonusRound() {\n document.getElementsByClassName(\"start-button\")[0].click();\n }", "function ClickAdicionarEscudo() {\n gEntradas.escudos.push({ chave: 'nenhum', obra_prima: false, bonus: 0 });\n AtualizaGeralSemLerEntradas();\n}", "function accediLinkPop(){\n\tif (checkCustomLoginComUrl(LOGIN_COM_URL_TYPE.REG_URL))\n\t\treturn false;\n\talreadyRcsUser = false;\n\twaitingToLoad = false;\n\tBotAccetto = false;\n\tBotConcludi = false;\n\n\tcallOmnitureTracing('event2','COR/Accesso Network Corriere.it','Corriere');\n\tsocial_selected = null;\n\topenFBbox(context_ssi+\"boxes/community/login/accedi.shtml?\"+corriereDevice);\n}", "function buyGym(){\n\t\t\tbuyClick(\"localgym\");\n\t\t}", "async clickOnButton(string) {\n if (string == \"Work out how much I could borrow\") xpath = '[id=\"btnBorrowCalculater\"]';\n else if (string == \"Start over\") xpath = '[aria-label=\"Start over\"]';\n // click\n await this.page.click(xpath);\n }", "function ClickGerarAleatorioComum() {\n GeraAleatorioComum();\n AtualizaGeral();\n}", "function select() {\n getElements()[selection].getElementsByTagName('a')[0].click();\n\n}", "function goto_social(element) {\n// var selected = element.id.replace('_goto_btn_', '');\n// var selected = element.id.substring(0, element.id.indexOf(\"_goto_btn_\"));\n// console.log(selected);\n var parent_grp_btn_id = element.id.replace('_goto_btn_', '_btn_group_');\n var sel_med_url = $('#' + parent_grp_btn_id).attr('url_value');\n if (sel_med_url.indexOf('google-plus') > -1) {\n sel_med_url = sel_med_url.replace('google-plus', 'googleplus');\n }\n window.open(sel_med_url, '_newtab');\n}", "function buttonClicked(key) {\r\n numberButtons.forEach(number => {\r\n if(number.innerText === key) {\r\n number.click();\r\n }\r\n })\r\n}", "function clickAssess() {\n\t$.trigger(\"clickAssess\");\n}", "function ClickMe(e) {\n if (userjwt) {\n if (e.target.getAttribute('src') === 'https://img.icons8.com/android/24/ffffff/star.png') {\n e.target.setAttribute('src', 'https://img.icons8.com/ios-filled/25/ffffff/star--v1.png');\n } else if (e.target.getAttribute('src') === 'https://img.icons8.com/ios-filled/25/ffffff/star--v1.png') {\n e.target.setAttribute('src', 'https://img.icons8.com/android/24/ffffff/star.png');\n }\n }\n }", "function clickme(){\n\n\t\talert('Hey, you clicked me!');\n\t}", "function clickGithub() {\n\t$.ajax({\n\t\turl: '\\/login\\/github',\n\t\tmethod: 'GET'\n\t}).done(function(jsondata) {\n\t\tif (jsondata.redirect) {\n\t\t\twindow.location.href = jsondata.redirect;\n\t\t}\n\t});\n}", "function openSign(evt, signName) {\n // Declare the variables\n var i, tabcontent, tablinks;\n\n // Retrieves and hides those elements with class \"tabcontent\"\n tabcontent = document.getElementsByClassName(\"tabcontent\");\n for (i = 0; i < tabcontent.length; i++) {\n tabcontent[i].style.display = \"none\";\n }\n\n // Retrieves those elements with class=\"tablinks\" and removes the class \"active\"\n tablinks = document.getElementsByClassName(\"tablinks\");\n for (i = 0; i < tablinks.length; i++) {\n tablinks[i].className = tablinks[i].className.replace(\" active\", \"\");\n }\n\n // Shows current tab, and gives button which opened that tab the class \"active\"\n document.getElementById(signName).style.display = \"block\";\n evt.currentTarget.className += \" active\";\n\n}", "function scribblePoser() {\n\tvar $elt = $(\"#poser_chooser\");\n\t$elt.click();\n}", "function clickme(){\r\n\t\t// this function includes an alert, or a pop-up box with the following text when the function is called.\r\n\t\talert('Hey, you clicked me!');\r\n\t}", "register() {\n this.jquery(\"#register\").on(\"click\", function (event) {\n event.preventDefault();\n navigateTo(\"/sign\");\n });\n }", "function cbox_key(e) {\n\t\tif (e.keyCode === 37) {\n\t\t\te.preventDefault();\n\t\t\t$prev.click();\n\t\t} else if (e.keyCode === 39) {\n\t\t\te.preventDefault();\n\t\t\t$next.click();\n\t\t}\n\t}", "function clickElement(el) {\r\n\t/*var clickMouse = document.createEvent(\"MouseEvents\");\r\n\tclickMouse.initMouseEvent(\"click\", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);\r\n\tplaybutton.dispatchEvent(clickMouse);*/\r\n\tvar clickUI = document.createEvent(\"UIEvents\");\r\n\tclickUI.initUIEvent(\"click\", true, true, window, 1);\r\n\tel.dispatchEvent(clickUI);\r\n}", "function loginCmd( proj ) {\n\tvar user = document.getElementById( 'loginUser' ).value; \n\tvar pass = document.getElementById( 'loginPass' ).value; \n\twindow.location.href=\"plus.php?action=2&user=\" + user + \n\t\"&pass=\"+ pass + \"&project=\" + proj ;\n}", "function ClickHabilidadeEspecial() {\n // TODO da pra melhorar.\n AtualizaGeral();\n}", "function o(a){a.click(p).mousedown(ka)}", "function interaction1() {\n window.location.href = `https://amdevito.github.io/211/interact/index.html`;\n}", "function clickme(){\n //the message in the pop up\n\t\talert('Hey, you clicked me!');\n\t}", "function onCancelClick() {\n $.trigger('promptSignature:cancel_signature');\n}", "function loginUgyldig() {\r\n Aliases.linkAuthorizationLogin.Click();\r\n\r\n let brukernavn = func.random(15) + \"@\" + func.random(7) + \".com\"\r\n let passord = func.random(8)\r\n loggInn(brukernavn, passord);\r\n\r\n //Sjekk om feilmelding kommer frem: \r\n aqObject.CheckProperty(Aliases.textnodeBeklagerViFantIngenMedDe, \"Visible\", cmpEqual, true);\r\n Aliases.linkHttpsTestOptimeraNo.Click();\r\n}", "function lcom_RegOKCompleta(){\n\topenFBbox(context_ssi+\"boxes/community/login/verifica_ok_nomail.shtml\");\n}", "function click_sanc()\r\n{\r\ndocument.getElementById('bountyForm').getElementsByClassName('btnMed btnBroadcast')[0].click();\r\n//click(document.getElementById('bountyForm').getElementsByClassName('btnMed btnBroadcast')[0]);\r\n}", "function click1()\n{\n\tagreeLink1_valid = true;\n}", "handleClick(){\n var urlBuilder = [];\n urlBuilder.push('response_type=code', `client_id=${config.google_client_id}`, `redirect_uri=${window.location.origin}/login/callback`, 'scope=profile email');\n const url = \"https://accounts.google.com/o/oauth2/v2/auth?\" + urlBuilder.join('&');\n // Open the popup window\n window.location.href = url;\n }", "function handleClick() {\n\t\tpaymentsClient.loadPaymentData(getRequest()).then(function(paymentData){\n\t\t\tconst $data = paymentData.paymentMethodData.tokenizationData.token\n\t\t\tgpaytoken($data);\n\n\t\t}).catch(function(err){\n\t\t\tself.hide(err);\n\t\t});\n\n\t}", "function asignarEventos() {\n _.click(function() {\n\n });\n}", "function toSigns() {\n document.getElementById('keyboardMinus').style.display = \"none\";\n document.getElementById('keyboardMayus').style.display = \"none\";\n document.getElementById('keyboardNum').style.display = \"none\";\n document.getElementById('keyboardSymb').style.display = \"block\";\n document.getElementById('keyboardGif').style.display = \"none\";\n}", "function bwClick(itemId) {\n $(itemId).click();\n}", "handleJDotterClick() {}", "function prim_click(e) {\n var user = document.querySelector('#select_value').value;\n browser.runtime.sendMessage({ 'name': 'set_change_card_for_site', 'user': user }, function (response) { });\n window.close();\n}", "async click() {\n await t.click(selector);\n }", "verCartelera(){\n browser.click('.btn.btnEnviar.btnVerCartelera')\n }", "function trackShatnerBoxClick(result) {\n var s = s_gi(s_account);\n var txt = 'ShatnerBoxClick_' + result;\n s.trackExternalLinks = false;\n s.linkTrackVars = 'prop6,eVar6';\n s.tl(this, 'o', txt);\n}", "function onClickFollow(){\n if(compname === \"\"){\n notification['warning']({\n message: 'Function Error',\n description:\n 'There is no company selected.',\n });\n }else{\n notification['success']({\n message: 'Operation Success',\n description:\n `${compname} has been added to the following list. `,\n });\n }\n }", "function ClickAdicionarArmadura() {\n gEntradas.armaduras.push({ chave: 'nenhuma', obra_prima: false, bonus: 0 });\n AtualizaGeralSemLerEntradas();\n}", "clickMyProfileLink() {\n return this.myProfileLink.click();\n }", "click(x, y, _isLeftButton) {}", "goToGithub() {\n window.location.href = \"https://github.com/kandrupr\"\n }", "static addClickListenerOnPublisherSignInButton_() {\n self.document\n .getElementById(PUBLISHER_SIGN_IN_BUTTON_ID)\n .addEventListener('click', (e) => {\n e.preventDefault();\n\n callSwg((swg) => swg.triggerLoginRequest({linkRequested: false}));\n });\n }", "function goTo(menuKey) {\n\t\t\tvar template = SUGGGET_ADPAYMENT;\n\t\t\tsetArParams(menuKey);\n\t\t\tsetIdCheckbox(menuKey);\n\t\t\tsetApParams(menuKey);\n\t\t\tpostal.publish({\n\t\t\t\tchannel: \"Tab\",\n\t\t\t\ttopic: \"open\",\n\t\t\t\tdata: template\n\t\t\t});\n\t\t}", "function clickHandler(e) {\n // Nur bei Linksklick\n if (e.button !== 0) return;\n clickAt(e.offsetX, e.offsetY);\n }", "function logClick() {\n ReactGA.event({\n category: 'Registration',\n action: 'Clicked Register Today',\n label: 'Challenge Text link',\n });\n}", "function simulateclick(){\n\tdocument.getElementById('imagefiles').click();\n}", "function openSignUp() {\n\tif (validateEmail()) {\n\t\tvar url = '/' + channel + '/Content.ice?page=Sign-Up-For-Fashion-News&pgForward=popup' + '&email=' + document.getElementById('email').value;\n open(url,'SignupForFashionNews','width=700,height=500');\n var tmp = open(url,'SignupForFashionNews','width=700,height=500');\n\t\ttmp.focus();\n\t}\n\treturn false;\n}", "click() { // add click event\n app.quit();\n }", "function handleAuthClick() {\n\tgapi.auth2.getAuthInstance().signIn().catch((ignore) => {});\n}", "function handleAuthClick(event) {\n gapi.auth2.getAuthInstance().signIn();\n }", "clickLoginButton() {\n this.loginButton.click();\n }", "function clicksubmitskill(e) {\n if (e.keyCode == 13) {\n document.getElementById(\"submitskill\").click();\n return false;\n }\n return true;\n }", "function click2()\n{\n\tagreeLink2_valid = true;\n}", "function TakeLoginAction(e) {\n\n var enterkeyPressed = IsEnterKeyPressed(e);\n\n if (enterkeyPressed) {\n\n if (window.event) {\n event.returnValue = false;\n event.cancel = true;\n }\n else {\n e.returnValue = false;\n e.cancel = true;\n }\n\n var actionButton = GetActionButton(\"logonButton\");\n\n if (actionButton != null) {\n actionButton.click();\n }\n }\n}", "function ClickGerarResumo() {\n AtualizaGeral(); // garante o preenchimento do personagem com tudo que ta na planilha.\n var input = Dom(\"resumo-personagem-2\");\n input.value = GeraResumo();\n input.focus();\n input.select();\n}", "function click(el) {\n var ev = document.createEvent('MouseEvent');\n ev.initMouseEvent(\n 'click',\n true /* bubble */, true /* cancelable */,\n window, null,\n 0, 0, 0, 0, /* coordinates */\n false, false, false, false, /* modifier keys */\n 0 /*left*/, null\n );\n el.dispatchEvent(ev);\n }", "function handleAuthClick(event) {\r\n gapi.auth2.getAuthInstance().signIn();\r\n}", "function handleAuthClick(event) {\r\n gapi.auth2.getAuthInstance().signIn();\r\n}", "clickCheckOutGreenTea() {\n this.clickElem(this.btnCheckOutGreenTea);\n }", "function keywordsMsg(e)\n{\n var event = e || window.event;\n if(event.keyCode == 13)\n {\n $('#send').click(); \n }\n}", "async cookieClicker() {\n let isPresent = await this.cookieButtonElement.isPresent();\n if (isPresent) {\n await this.cookieButtonElement.click();\n }\n }", "function click(el){\n var ev = document.createEvent('MouseEvent');\n ev.initMouseEvent(\n 'click',\n true, true,\n window, null,\n 0, 0, 0, 0,\n false, false, false, false,\n 0, null\n );\n el.dispatchEvent(ev);\n}", "function done(){\n iframes[0].querySelector(\"#InlineEditDialog_buttons > input:nth-child(1)\").click()\n }", "function click(e) {\r\n\t\tif(!e && typeof e=='string') e=document.getElementById(e);\r\n\t\tif(!e) return;\r\n\t\tvar evObj = e.ownerDocument.createEvent('MouseEvents');\r\n\t\tevObj.initMouseEvent(\"click\",true,true,e.ownerDocument.defaultView,0,0,0,0,0,false,false,false,false,0,null);\r\n\t\te.dispatchEvent(evObj);\r\n\t}", "function click(e) {\r\n\t\tif(!e && typeof e=='string') e=document.getElementById(e);\r\n\t\tif(!e) return;\r\n\t\tvar evObj = e.ownerDocument.createEvent('MouseEvents');\r\n\t\tevObj.initMouseEvent(\"click\",true,true,e.ownerDocument.defaultView,0,0,0,0,0,false,false,false,false,0,null);\r\n\t\te.dispatchEvent(evObj);\r\n\t}", "function handleAuthClick(event) {\n\tgapi.auth2.getAuthInstance().signIn();\n}", "function handleAuthClick(event) {\n\tgapi.auth2.getAuthInstance().signIn();\n}", "function clickButtonEl(key) {\n numbersEl.forEach((button) => {\n if (button.innerText === key) {\n button.click();\n }\n });\n}", "function signCon() {\n\t$(\"#sps\").click( function() {\n\t\t$(\"#signup\").slideToggle();\n\t})\n\t$(\"#spc\").click( function() {\n\t\t$(\"#settingsBox\").slideToggle();\n\t})\n\t$(\"#contactMeButton\").click( function() {\n\t\t$(\"#contactme\").slideToggle();\n\t})\n}", "function onCallForwardingAutoPopupOkBtnClick() {\r\n callForwardingAutoToggleSwitch.click();\r\n }" ]
[ "0.63308024", "0.6325274", "0.59800106", "0.5818107", "0.5774368", "0.5710783", "0.57096374", "0.5677159", "0.567587", "0.5666399", "0.5660508", "0.56503785", "0.56413054", "0.5638463", "0.55988306", "0.5586199", "0.55725545", "0.5566793", "0.553986", "0.55269295", "0.5509403", "0.55068874", "0.54900956", "0.5474483", "0.54682106", "0.5459994", "0.54569554", "0.54367834", "0.54134107", "0.5409913", "0.5408414", "0.5406675", "0.54039973", "0.5396695", "0.5395361", "0.53876543", "0.53832656", "0.5379943", "0.53703994", "0.53687024", "0.5359421", "0.5353413", "0.5348026", "0.53460854", "0.5339658", "0.5333531", "0.53269124", "0.5323306", "0.53179044", "0.53137565", "0.53117764", "0.53113395", "0.5308042", "0.53022575", "0.52863246", "0.5285958", "0.5284779", "0.5279279", "0.527756", "0.52730554", "0.5266057", "0.5256763", "0.5249958", "0.52480716", "0.5247977", "0.5241694", "0.5240843", "0.52374166", "0.5236948", "0.5236922", "0.5234914", "0.522757", "0.52225536", "0.5220033", "0.5220012", "0.52151877", "0.52144265", "0.5200432", "0.51979256", "0.51945335", "0.5193316", "0.5190369", "0.518967", "0.51881045", "0.51875114", "0.51820844", "0.5181772", "0.5180902", "0.5175787", "0.51753527", "0.5174047", "0.51733947", "0.51687264", "0.5166905", "0.5166905", "0.5166553", "0.5166553", "0.5165698", "0.51600856", "0.515703" ]
0.534272
44
=============================================>>>>> = MEDIA QUERIES = ===============================================>>>>>
function handleWidthChange(mqlVal) { if (mqlVal.matches) { $navLinks.off('click'); $('.btn-section').off('click'); $navLinks.on('click', function(e) { e.preventDefault(); var target = $(this).attr('href'), targetOffset = $(target).offset(); $(this).parent().addClass('active').siblings().removeClass('active'); $('html,body').animate({scrollTop: (targetOffset.top)}, 500); $('.nav-main').removeClass('active'); $('.hamburger').removeClass('is-active'); }); /*=============================================>>>>> = REMOVE CUSTOM SCROLLBAR = ===============================================>>>>>*/ $('.section-block-content').mCustomScrollbar('destroy'); } else { $navLinks.off('click'); checkUrlHash(); $('.section-main-block, .section-secondary-block').addClass('animated'); $('.section-secondary-block-right').on(animationEnd, function(e) { if ($(e.target).parent().hasClass('section-out') && $(e.target).hasClass('section-secondary-block-right')) { console.log('Section "' + $(e.target).parent().attr('id') + '" out.' ); $(e.target).parents('.section').removeClass('section-out'); $(e.target).removeClass(sectionOutAnimation).siblings('.section-secondary-b').removeClass(sectionOutAnimation); } else if ($(e.target).parent().hasClass('section-in') && $(e.target).hasClass('section-secondary-block-right')) { console.log('Section "' + $(e.target).parent().attr('id') + '" in.' ); isAnimating = false; } }); $navLinks.on('click', function(e) { e.preventDefault(); changeSections(e); }); $('.btn-section').on('click', function(e) { e.preventDefault(); changeSections(e); }); /*=============================================>>>>> = INIT CUSTOM SCROLLBAR = ===============================================>>>>>*/ $('.section-block-content').mCustomScrollbar({ theme: 'flipcard', scrollInertia: 100 }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getMediaItems(albumID){\n //Reponse contains an array of (id, description, productUr, mediaMetaData, filename)\n const token = await GoogleSignin.getTokens();\n await this.getDbUserData();\n data = {\n URI: 'https://photoslibrary.googleapis.com/v1/mediaItems:search',\n method: 'POST',\n headers: {\n 'Authorization': 'Bearer '+ token.accessToken,\n 'Content-type': 'application/json'\n },\n body: JSON.stringify({\n \"pageSize\":\"100\",\n \"albumId\": albumID\n })\n }\n response = await this.APIHandler.sendRequest(data);\n return response.mediaItems\n }", "function MediaByTag() {\r\n\tvar caption;\r\n\tvar link;\r\n\tvar tags;\r\n\tvar comments;\r\n\tvar likes;\r\n\tvar imageUrls;\r\n\tvar userInfo;\r\n}", "function getMediaByIds(ids) {\n return $.post('/api/media/ids', { media: { ids } });\n }", "function queryPictures(req) {\n\n let query = Picture.find();\n\n if (typeof (req.query.src) == 'string') {\n query = query.where('src').equals(req.query.src);\n }\n\n if (typeof (req.query.description) == 'string') {\n query = query.where('description').equals(req.query.description);\n }\n\n return query;\n}", "async function getMedia() {\n if (!username) return;\n const resp = await fetch(`https://www.instagram.com/${username}/?__a=1`);\n const { graphql } = await resp.json();\n setImages(\n graphql.user.edge_owner_to_timeline_media.edges.map(\n ({ node }) => node.thumbnail_resources\n )\n );\n }", "async function FindMediaItems(options = [], button) {\n\t\tif(!(options.length && button))\n\t\t\treturn;\n\n\t\t/* Get rid of repeats */\n\t\tlet uuids = [];\n\n\t\toptions = options.map((v, i, a) => {\n\t\t\tlet { type, title } = v,\n\t\t\t\tuuid = UUID.from({ type, title });\n\n\t\t\tif(!!~uuids.indexOf(uuid))\n\t\t\t\treturn options.splice(i, 1), null;\n\t\t\tuuids.push(uuid);\n\n\t\t\treturn v;\n\t\t})\n\t\t.filter(v => v);\n\n\t\tlet results = [],\n\t\t\tlength = options.length,\n\t\t\tqueries = (FindMediaItems.queries = FindMediaItems.queries || {});\n\n\t\tFindMediaItems.OPTIONS = options;\n\n\t\tlet query = JSON.stringify(options);\n\n\t\tquery = (queries[query] = queries[query] || {});\n\n\t\tif(query.running === true)\n\t\t\treturn;\n\t\telse if(query.results) {\n\t\t\tlet { results, multiple, items } = query;\n\n\t\t\tnew Notification('update', `Welcome back. ${ multiple } new ${ items } can be grabbed`, 7000, (event, target = button.querySelector('.list-action')) => target.click({ ...event, target }));\n\n\t\t\tif(multiple)\n\t\t\t\tUpdateButton(button, 'multiple', `Download ${ multiple } ${ items }`, results);\n\n\t\t\treturn;\n\t\t}\n\n\t\tquery.running = true;\n\n\t\tnew Notification('info', `Processing ${ length } item${ 's'[+(length === 1)] || '' }...`);\n\n\t\tfor(let index = 0, option, opt; index < length; index++) {\n\t\t\tlet { IMDbID, TMDbID, TVDbID } = (option = await options[index]);\n\n\t\t\topt = { name: option.title, title: option.title, year: option.year, image: options.image, type: option.type, imdb: IMDbID, IMDbID, tmdb: TMDbID, TMDbID, tvdb: TVDbID, TVDbID };\n\n\t\t\ttry {\n\t\t\t\tawait Request_Plex(option)\n\t\t\t\t\t.then(async({ found, key }) => {\n\t\t\t\t\t\tlet { imdb, tmdb, tvdb } = opt,\n\t\t\t\t\t\t\t{ type, title, year } = opt,\n\t\t\t\t\t\t\tuuid = UUID.from({ type, title });\n\n\t\t\t\t\t\tif(found) {\n\t\t\t\t\t\t\t// ignore found items, we only want new items\n\t\t\t\t\t\t\tupdateMinion({ imdb, tmdb, tvdb, uuid }, 'found', { ...opt, key })\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\toption.field = 'original_title';\n\n\t\t\t\t\t\t\treturn await Request_Plex(option)\n\t\t\t\t\t\t\t\t.then(({ found, key }) => {\n\t\t\t\t\t\t\t\t\tif(found) {\n\t\t\t\t\t\t\t\t\t\t// ignore found items, we only want new items\n\t\t\t\t\t\t\t\t\t\tupdateMinion({ imdb, tmdb, tvdb, uuid }, 'found', { ...opt, key })\n\t\t\t\t\t\t\t\t\t} else if(CAUGHT.has({ imdb, tmdb, tvdb })) {\n\t\t\t\t\t\t\t\t\t\t// ignore items already being watched\n\t\t\t\t\t\t\t\t\t\tupdateMinion({ imdb, tmdb, tvdb, uuid }, 'queued')\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlet available = (__CONFIG__.usingOmbi || __CONFIG__.usingWatcher || __CONFIG__.usingRadarr || __CONFIG__.usingSonarr || __CONFIG__.usingMedusa || __CONFIG__.usingSickBeard || __CONFIG__.usingCouchPotato),\n\t\t\t\t\t\t\t\t\t\t\taction = (available? 'download': 'notfound'),\n\t\t\t\t\t\t\t\t\t\t\ttitle = available?\n\t\t\t\t\t\t\t\t\t\t\t\t'Not on Plex (download available)':\n\t\t\t\t\t\t\t\t\t\t\t'Not on Plex (download not available)';\n\n\t\t\t\t\t\t\t\t\t\tupdateMinion({ imdb, tmdb, tvdb, uuid }, (available? 'download': 'not-found'));\n\t\t\t\t\t\t\t\t\t\tresults.push({ ...opt, found: false, status: action });\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}\n\t\t\t\t\t})\n\t\t\t\t\t.catch(error => { throw error });\n\t\t\t} catch(error) {\n\t\t\t\tUTILS_TERMINAL.error('Request to Plex failed: ' + String(error));\n\t\t\t\t// new Notification('error', 'Failed to query item #' + (index + 1));\n\t\t\t}\n\t\t}\n\n\t\tresults = results.filter(v => v.status == 'download');\n\n\t\tlet img = furnish('img#plexit-add', { title: 'Add to Plex It!', onmouseup: event => {let frame = document.querySelector('#plexit-bookmarklet-frame'); frame.src = frame.src.replace(/(#plexit:.*)?$/, '#plexit:' + event.target.parentElement.getAttribute('data'))} }),\n\t\t\tpo, pi = furnish('li#plexit.list-item', { data: encode(JSON.stringify(results)) }, img),\n\t\t\top = document.querySelector('#wtp-plexit');\n\n\t\tif(po = button.querySelector('#plexit'))\n\t\t\tpo.remove();\n\t\ttry {\n\t\t\tbutton.querySelector('ul').insertBefore(pi, op);\n\t\t} catch(e) { /* Don't do anything */ }\n\n\t\tlet multiple = results.length,\n\t\t\titems = multiple == 1? 'item': 'items';\n\n\t\tnew Notification('update', `Done. ${ multiple } new ${ items } can be grabbed`, 7000, (event, target = button.querySelector('.list-action')) => target.click({ ...event, target }));\n\n\t\tquery.running = false;\n\t\tquery.results = results;\n\t\tquery.multiple = multiple;\n\t\tquery.items = items;\n\n\t\tif(multiple)\n\t\t\tUpdateButton(button, 'multiple', `Download ${ multiple } ${ items }`, results);\n\t}", "function uploadMusic() {\n //returns array of music available for ringtone after reading from file, is used for \"tones\" array\n}", "function mediaQueryListDispatcher() {\n\t\tthis.mqls = [];\n\t}", "function myMedia(req, res) {\n return _media2.default.find({ 'uid': req.user.email },null, {sort: {created_at: -1}}).exec().then(respondWithResult(res)).catch(handleError(res));\n}", "async function _loadMedia() {\n\n var data = await fetch('/content/media.json');\n var json = await data.json();\n\n json.forEach((file) => {\n media.push(file);\n });\n\n _buildTable();\n tableUIUpdate();\n\n }", "processUploadImages(uploadData){\n mediaItems = []\n for (i = 0; i < uploadData.length; i ++){\n mediaItems.push({\n \"description\": uploadData[i].description,\n \"simpleMediaItem\": {\n \"uploadToken\": uploadData[i].uploadToken\n }\n })\n }\n return mediaItems\n }", "function deduplicteMediaItems() {\n\n}", "function getMedia(user) {\n userId = user || \"\";\n if (userId) {\n userId = \"/?userId=\" + userId;\n }\n $.get(\"/api/posts\" + authorId, function(data) {\n console.log(\"Posts\", data);\n saved = data;\n if (!posts || !posts.length) {\n displayEmpty(user);\n }\n else {\n initializeRows();\n }\n });\n }", "function searchMusic(name){\n if(!name){\n name = \"The sigin\";\n }\n spotify.search({ type: 'track', query: name }, function(err, data) {\n if (err) {\n return console.log('Error occurred: ' + err);\n }\n for (var i = 0; i < 5; i++) {\n console.log(\"Artist Name: \"+data.tracks.items[i].artist[0].name); \n console.log(\"Song name: \"+data.tracks.items[i].name);\n console.log(\"Link: \"+data.tracks.items[i].album.name);\n console.log(\"Album\"+data.tracks.items[i].preview_url);\n console.log(\"-------------------------------------\");\n }\n });\n}", "function loadMedia(location, queries, manage, final) {\n\n // Recursive function\n function nextMedia(i) {\n\n // From queries object to array, in order to use $.when()\n var indices = []; // Keeps track of which number corresponds with which key\n var queriesArr = []; // Array of the queries\n var j = 0; // Index\n for(var q in queries) {\n indices.push(q);\n // Make a shallow copy of queries[q], so it's unaffected for next iteration\n queriesArr.push($.extend({}, queries[q]));\n // Important! Add the absolute path of the file to the query as a prefix!\n queriesArr[j].url = location + i.toString() + '/' + queriesArr[j].url;\n // Replace query data by actual jqXHR object\n queriesArr[j] = $.ajax(queriesArr[j]);\n j++;\n }\n\n // When all the queries are completed...\n $.when(...queriesArr).done(function(...resultsArr) {\n\n // Back from array to object\n var results = {};\n for(var j = 0; j < resultsArr.length; j++) {\n results[indices[j]] = resultsArr[j];\n }\n\n // Call to manager function with processed data\n manage(location, results, i);\n\n nextMedia(i + 1); // Keep going\n\n }).fail(final); // Call after everything is done\n\n } // nextMedia(i)\n\n nextMedia(0); // Initial call\n\n}", "function execute() {\n return gapi.client.photoslibrary.mediaItems.list({}).then(\n function(response) {\n // Handle the results here (response.result has the parsed body).\n console.log(\"Response\", response);\n },\n function(err) {\n console.error(\"Execute error\", err);\n }\n );\n}", "function mediaLocStorage() {\n // assign media object to a variable\n var mediaObj = memory.media,\n // create an empty object\n mediaLinks = {};\n // loop through media object\n for (var i = 0; i < mediaObj.length; i++) {\n\n if (mediaLinks[mediaObj[i].post] == mediaObj.post) {\n // assign object keys and values\n // \"the key will be the post id, and the value will be the image link\"\n mediaLinks[mediaObj[i].post] = mediaObj[i].source_url;\n }\n }\n // save the object in local storage\n storage.write('postImg', mediaLinks);\n }", "images() {\n // console.log('thumbnails helper');\n return Images.find({\n thumbnail: { $exists: 1 },\n // subscriptionId: ThumbnailsHandle.subscriptionId,\n }, {\n limit: ImagesPerPage,\n sort: { created: -1 }\n });\n }", "function list( url, requestArguments ) {\n\t\t\tvar getter = {},\n\t\t\t\taction = {\n\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\ttransformResponse: function( data ) {\n\t\t\t\t\t\treturn convertJsonToObj( data );\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t// Setup API $resource\n\t\t\tgetter.api = apiService.request( url, { 'get': action } );\n\n\t\t\t// Add Wistia authentication to the request arguments\n\t\t\tangular.merge( requestArguments, apiKey );\n\n\t\t\t// Make request to list media\n\t\t\tgetter.request = getter.api.get( requestArguments ).$promise.then(\n\n\t\t\t\t// SUCCESS\n\t\t\t\tfunction( response ) {\n\t\t\t\t\tvar eventArgs = {\n\t\t\t\t\t\tuploads: {}\n\t\t\t\t\t};\n\n\t\t\t\t\t// Received list successfully (account for $promise and $resolved objects)\n\t\t\t\t\tif ( response && Object.keys( response ).length > 2 ) {\n\t\t\t\t\t\tconsole.log( 'Successfully received the list of media' );\n\n\t\t\t\t\t\teventArgs.uploads = response;\n\t\t\t\t\t\tdelete eventArgs.uploads.$promise;\n\t\t\t\t\t\tdelete eventArgs.uploads.$resolved;\n\n\t\t\t\t\t\t$rootScope.$emit( 'videoListReturned', eventArgs );\n\n\t\t\t\t\t// Could not receive list\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconsole.warn( 'Could not receive list.', response );\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\t// FAILURE\n\t\t\t\tfunction( error ) {\n\t\t\t\t\tconsole.error( error.data );\n\t\t\t\t}\n\t\t\t);\n\t\t}", "function getNodeMediaItems(title, commonLocation, eventId, eventHtml) {\n var url = 'http://localhost:8001/search/combined/';\n url += encodeURIComponent(title + ' ' + commonLocation);\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState == 4) {\n requestReceived();\n if (xhr.status == 200) {\n var data = JSON.parse(xhr.responseText);\n retrieveNodeMediaItemsResults(data, eventId, eventHtml);\n } else {\n console.log('Error: Getting media items for the query failed.');\n }\n }\n }\n xhr.open('GET', url, true);\n xhr.send();\n requestSent();\n}", "function mediaList(req,res,template,block,next) { \n \n // Render the item via the template provided above\n calipso.theme.renderItem(req,res,template,block,{}); \n next();\n \n}", "function populateStorages(storageModels) {\n var queues = [],\n response = $q.defer(),\n results = _.where(storageModels, {type: 'areaimage'});\n\n // $scope.AreaImages = _.where(storageModels, {type: 'areaimage'});\n\n _.each(results, function(image){\n //populateImage(image);\n queues.push(Storage.GetFileImageString(image.id));\n });\n\n $q.all(queues)\n .then(function(images){\n _.each(results, function(image, i){\n image.data = images[i];\n });\n return response.resolve(results);\n\n },\n function(error){\n return response.reject(error);\n });\n return response.promise;\n /*\n $scope.Signature = _.where(storageModels, {type: 'signature'})[0];\n\n if ($scope.Signature && $scope.Signature.id.length === 36) {\n populateImage($scope.Signature);\n }*/\n\n }", "function getMediasFiles(path, cb) {\n var medias = {};\n glob(path, function (err, files) {\n files.forEach(function (filename) {\n var infos = pathinfo(filename);\n medias[infos.basename.toUpperCase()] = {\n filename: filename,\n products: []\n };\n });\n cb(medias);\n })\n }", "function queryMediaInfo(paramData) {\n let url = jjkgalleryRoot + \"getMediaInfo.php\"\n fetch(url, {\n method: 'POST',\n headers: {'Content-Type': 'application/json'},\n body: JSON.stringify(paramData)\n })\n .then(response => response.json())\n .then(responseMediaInfo => {\n // Save media information in a variable in a module (that can be imported into other modules)\n loadMediaInfo(responseMediaInfo)\n\n getMenu = paramData.getMenu\n if (getMenu) {\n // Save the menu lists\n setMenuList(mediaInfo.menuList)\n categoryList = mediaInfo.categoryList\n menuFilter = mediaInfo.menuFilter\n setAlbumList(mediaInfo.albumList)\n peopleList = mediaInfo.peopleList\n }\n\n // Save the parameters from the laste query\n queryCategory = paramData.MediaFilterCategory\n querySearchStr = \"\"\n if (paramData.MediaFilterSearchStr != null && paramData.MediaFilterSearchStr != \"\") {\n querySearchStr = paramData.MediaFilterSearchStr\n }\n queryMenuItem = \"\"\n if (paramData.MediaFilterMenuItem != null & paramData.MediaFilterMenuItem != \"\") {\n queryMenuItem = paramData.MediaFilterMenuItem\n }\n\n createMediaPage()\n });\n }", "function paintMedias(){\n $.couch.urlPrefix = \"https://socpa.cloudant.com\";\n $.couch.login({\n name: \"socpa\",\n password: \"asdargonnijao\",\n success: function(data) {\n console.log(data);\n\n },\n error: function(status) {\n console.log(status);\n }\n });\n\n $.couch.db(\"media\").view(\"media/media\", {\n startkey: [canvas_id],\n endkey: [canvas_id,{}],\n reduce: false,\n success: function(data) {\n setMedia(data.rows,0)\n },\n error: function(status) {\n console.log(status);\n }\n\n });\n}", "function AppMeasurement_Module_Media(q) {\n var b = this;\n b.s = q;\n q = window;\n q.s_c_in || (q.s_c_il = [], q.s_c_in = 0);\n b._il = q.s_c_il;\n b._in = q.s_c_in;\n b._il[b._in] = b;\n q.s_c_in++;\n b._c = \"s_m\";\n b.list = [];\n b.open = function (d, c, e, k) {\n var f = {},\n a = new Date,\n l = \"\",\n g;\n c || (c = -1);\n if (d && e) {\n b.list || (b.list = {});\n b.list[d] && b.close(d);\n k && k.id && (l = k.id);\n if (l)\n for (g in b.list) !Object.prototype[g] && b.list[g] && b.list[g].R == l && b.close(b.list[g].name);\n f.name = d;\n f.length = c;\n f.offset = 0;\n f.e = 0;\n f.playerName = b.playerName ? b.playerName : e;\n f.R = l;\n f.C = 0;\n f.a = 0;\n f.timestamp =\n Math.floor(a.getTime() / 1E3);\n f.k = 0;\n f.u = f.timestamp;\n f.c = -1;\n f.n = \"\";\n f.g = -1;\n f.D = 0;\n f.I = {};\n f.G = 0;\n f.m = 0;\n f.f = \"\";\n f.B = 0;\n f.L = 0;\n f.A = 0;\n f.F = 0;\n f.l = !1;\n f.v = \"\";\n f.J = \"\";\n f.K = 0;\n f.r = !1;\n f.H = \"\";\n f.complete = 0;\n f.Q = 0;\n f.p = 0;\n f.q = 0;\n b.list[d] = f;\n }\n };\n b.openAd = function (d, c, e, k, f, a, l, g) {\n var h = {};\n b.open(d, c, e, g);\n if (h = b.list[d]) h.l = !0, h.v = k, h.J = f, h.K = a, h.H = l;\n };\n b.M = function (d) {\n var c = b.list[d];\n b.list[d] = 0;\n c && c.monitor && clearTimeout(c.monitor.interval);\n };\n b.close = function (d) {\n b.i(d, 0, -1);\n };\n b.play = function (d, c, e, k) {\n var f = b.i(d, 1, c, e, k);\n f && !f.monitor &&\n (f.monitor = {}, f.monitor.update = function () {\n 1 == f.k && b.i(f.name, 3, -1);\n f.monitor.interval = setTimeout(f.monitor.update, 1E3);\n }, f.monitor.update());\n };\n b.click = function (d, c) {\n b.i(d, 7, c);\n };\n b.complete = function (d, c) {\n b.i(d, 5, c);\n };\n b.stop = function (d, c) {\n b.i(d, 2, c);\n };\n b.track = function (d) {\n b.i(d, 4, -1);\n };\n b.P = function (d, c) {\n var e = \"a.media.\",\n k = d.linkTrackVars,\n f = d.linkTrackEvents,\n a = \"m_i\",\n l, g = d.contextData,\n h;\n c.l && (e += \"ad.\", c.v && (g[\"a.media.name\"] = c.v, g[e + \"pod\"] = c.J, g[e + \"podPosition\"] = c.K), c.G || (g[e + \"CPM\"] = c.H));\n c.r && (g[e + \"clicked\"] = !0, c.r = !1);\n g[\"a.contentType\"] = \"video\" + (c.l ? \"Ad\" : \"\");\n g[\"a.media.channel\"] = b.channel;\n g[e + \"name\"] = c.name;\n g[e + \"playerName\"] = c.playerName;\n 0 < c.length && (g[e + \"length\"] = c.length);\n g[e + \"timePlayed\"] = Math.floor(c.a);\n 0 < Math.floor(c.a) && (g[e + \"timePlayed\"] = Math.floor(c.a));\n c.G || (g[e + \"view\"] = !0, a = \"m_s\", b.Heartbeat && b.Heartbeat.enabled && (a = c.l ? b.__primetime ? \"mspa_s\" : \"msa_s\" : b.__primetime ? \"msp_s\" : \"ms_s\"), c.G = 1);\n c.f && (g[e + \"segmentNum\"] = c.m, g[e + \"segment\"] = c.f, 0 < c.B && (g[e + \"segmentLength\"] = c.B), c.A && 0 < c.a && (g[e + \"segmentView\"] = !0));\n !c.Q && c.complete && (g[e + \"complete\"] = !0, c.S = 1);\n 0 < c.p && (g[e + \"milestone\"] = c.p);\n 0 < c.q && (g[e + \"offsetMilestone\"] = c.q);\n if (k)\n for (h in g) Object.prototype[h] || (k += \",contextData.\" + h);\n l = g[\"a.contentType\"];\n d.pe = a;\n d.pev3 = l;\n var q, s;\n if (b.contextDataMapping)\n for (h in d.events2 || (d.events2 = \"\"), k && (k += \",events\"), b.contextDataMapping)\n if (!Object.prototype[h]) {\n a = h.length > e.length && h.substring(0, e.length) == e ? h.substring(e.length) : \"\";\n l = b.contextDataMapping[h];\n if (\"string\" == typeof l)\n for (q = l.split(\",\"), s = 0; s < q.length; s++) l =\n q[s], \"a.contentType\" == h ? (k && (k += \",\" + l), d[l] = g[h]) : \"view\" == a || \"segmentView\" == a || \"clicked\" == a || \"complete\" == a || \"timePlayed\" == a || \"CPM\" == a ? (f && (f += \",\" + l), \"timePlayed\" == a || \"CPM\" == a ? g[h] && (d.events2 += (d.events2 ? \",\" : \"\") + l + \"=\" + g[h]) : g[h] && (d.events2 += (d.events2 ? \",\" : \"\") + l)) : \"segment\" == a && g[h + \"Num\"] ? (k && (k += \",\" + l), d[l] = g[h + \"Num\"] + \":\" + g[h]) : (k && (k += \",\" + l), d[l] = g[h]);\n else if (\"milestones\" == a || \"offsetMilestones\" == a) h = h.substring(0, h.length - 1), g[h] && b.contextDataMapping[h + \"s\"][g[h]] && (f && (f += \",\" + b.contextDataMapping[h +\n \"s\"][g[h]]), d.events2 += (d.events2 ? \",\" : \"\") + b.contextDataMapping[h + \"s\"][g[h]]);\n g[h] && (g[h] = 0);\n \"segment\" == a && g[h + \"Num\"] && (g[h + \"Num\"] = 0);\n }\n d.linkTrackVars = k;\n d.linkTrackEvents = f;\n };\n b.i = function (d, c, e, k, f) {\n var a = {},\n l = (new Date).getTime() / 1E3,\n g, h, q = b.trackVars,\n s = b.trackEvents,\n t = b.trackSeconds,\n u = b.trackMilestones,\n v = b.trackOffsetMilestones,\n w = b.segmentByMilestones,\n x = b.segmentByOffsetMilestones,\n p, n, r = 1,\n m = {},\n y;\n b.channel || (b.channel = b.s.w.location.hostname);\n if (a = d && b.list && b.list[d] ? b.list[d] : 0)\n if (a.l && (t = b.adTrackSeconds,\n u = b.adTrackMilestones, v = b.adTrackOffsetMilestones, w = b.adSegmentByMilestones, x = b.adSegmentByOffsetMilestones), 0 > e && (e = 1 == a.k && 0 < a.u ? l - a.u + a.c : a.c), 0 < a.length && (e = e < a.length ? e : a.length), 0 > e && (e = 0), a.offset = e, 0 < a.length && (a.e = a.offset / a.length * 100, a.e = 100 < a.e ? 100 : a.e), 0 > a.c && (a.c = e), y = a.D, m.name = d, m.ad = a.l, m.length = a.length, m.openTime = new Date, m.openTime.setTime(1E3 * a.timestamp), m.offset = a.offset, m.percent = a.e, m.playerName = a.playerName, m.mediaEvent = 0 > a.g ? \"OPEN\" : 1 == c ? \"PLAY\" : 2 == c ? \"STOP\" : 3 == c ? \"MONITOR\" :\n 4 == c ? \"TRACK\" : 5 == c ? \"COMPLETE\" : 7 == c ? \"CLICK\" : \"CLOSE\", 2 < c || c != a.k && (2 != c || 1 == a.k)) {\n f || (k = a.m, f = a.f);\n if (c) {\n 1 == c && (a.c = e);\n if ((3 >= c || 5 <= c) && 0 <= a.g && (r = !1, q = s = \"None\", a.g != e)) {\n h = a.g;\n h > e && (h = a.c, h > e && (h = e));\n p = u ? u.split(\",\") : 0;\n if (0 < a.length && p && e >= h)\n for (n = 0; n < p.length; n++) (g = p[n] ? parseFloat(\"\" + p[n]) : 0) && h / a.length * 100 < g && a.e >= g && (r = !0, n = p.length, m.mediaEvent = \"MILESTONE\", a.p = m.milestone = g);\n if ((p = v ? v.split(\",\") : 0) && e >= h)\n for (n = 0; n < p.length; n++) (g = p[n] ? parseFloat(\"\" + p[n]) : 0) && h < g && e >= g && (r = !0, n = p.length, m.mediaEvent =\n \"OFFSET_MILESTONE\", a.q = m.offsetMilestone = g);\n }\n if (a.L || !f) {\n if (w && u && 0 < a.length) {\n if (p = u.split(\",\"))\n for (p.push(\"100\"), n = h = 0; n < p.length; n++)\n if (g = p[n] ? parseFloat(\"\" + p[n]) : 0) a.e < g && (k = n + 1, f = \"M:\" + h + \"-\" + g, n = p.length), h = g;\n } else if (x && v && (p = v.split(\",\")))\n for (p.push(\"\" + (0 < a.length ? a.length : \"E\")), n = h = 0; n < p.length; n++)\n if ((g = p[n] ? parseFloat(\"\" + p[n]) : 0) || \"E\" == p[n]) {\n if (e < g || \"E\" == p[n]) k = n + 1, f = \"O:\" + h + \"-\" + g, n = p.length;\n h = g;\n }\n f && (a.L = !0);\n } (f || a.f) && f != a.f && (a.F = !0, a.f || (a.m = k, a.f = f), 0 <= a.g && (r = !0));\n (2 <= c || 100 <= a.e) && a.c < e &&\n (a.C += e - a.c, a.a += e - a.c);\n if (2 >= c || 3 == c && !a.k) a.n += (1 == c || 3 == c ? \"S\" : \"E\") + Math.floor(e), a.k = 3 == c ? 1 : c;\n !r && 0 <= a.g && 3 >= c && (t = t ? t : 0) && a.a >= t && (r = !0, m.mediaEvent = \"SECONDS\");\n a.u = l;\n a.c = e;\n }\n if (!c || 3 >= c && 100 <= a.e) 2 != a.k && (a.n += \"E\" + Math.floor(e)), c = 0, q = s = \"None\", m.mediaEvent = \"CLOSE\";\n 7 == c && (r = m.clicked = a.r = !0);\n if (5 == c || b.completeByCloseOffset && (!c || 100 <= a.e) && 0 < a.length && e >= a.length - b.completeCloseOffsetThreshold) r = m.complete = a.complete = !0;\n l = m.mediaEvent;\n \"MILESTONE\" == l ? l += \"_\" + m.milestone : \"OFFSET_MILESTONE\" == l && (l +=\n \"_\" + m.offsetMilestone);\n a.I[l] ? m.eventFirstTime = !1 : (m.eventFirstTime = !0, a.I[l] = 1);\n m.event = m.mediaEvent;\n m.timePlayed = a.C;\n m.segmentNum = a.m;\n m.segment = a.f;\n m.segmentLength = a.B;\n b.monitor && 4 != c && b.monitor(b.s, m);\n b.Heartbeat && b.Heartbeat.enabled && 0 <= a.g && (r = !1);\n 0 == c && b.M(d);\n r && a.D == y && (d = {\n contextData: {}\n }, d.linkTrackVars = q, d.linkTrackEvents = s, d.linkTrackVars || (d.linkTrackVars = \"\"), d.linkTrackEvents || (d.linkTrackEvents = \"\"), b.P(d, a), d.linkTrackVars || (d[\"!linkTrackVars\"] = 1), d.linkTrackEvents || (d[\"!linkTrackEvents\"] =\n 1), b.s.track(d), a.F ? (a.m = k, a.f = f, a.A = !0, a.F = !1) : 0 < a.a && (a.A = !1), a.n = \"\", a.p = a.q = 0, a.a -= Math.floor(a.a), a.g = e, a.D++);\n }\n return a;\n };\n b.O = function (d, c, e, k, f) {\n var a = 0;\n if (d && (!b.autoTrackMediaLengthRequired || c && 0 < c)) {\n if (b.list && b.list[d]) a = 1;\n else if (1 == e || 3 == e) b.open(d, c, \"HTML5 Video\", f), a = 1;\n a && b.i(d, e, k, -1, 0);\n }\n };\n b.attach = function (d) {\n var c, e, k;\n d && d.tagName && \"VIDEO\" == d.tagName.toUpperCase() && (b.o || (b.o = function (c, a, d) {\n var e, h;\n b.autoTrack && (e = c.currentSrc, (h = c.duration) || (h = -1), 0 > d && (d = c.currentTime), b.O(e, h, a,\n d, c));\n }), c = function () {\n b.o(d, 1, -1);\n }, e = function () {\n b.o(d, 1, -1);\n }, b.j(d, \"play\", c), b.j(d, \"pause\", e), b.j(d, \"seeking\", e), b.j(d, \"seeked\", c), b.j(d, \"ended\", function () {\n b.o(d, 0, -1);\n }), b.j(d, \"timeupdate\", c), k = function () {\n d.paused || d.ended || d.seeking || b.o(d, 3, -1);\n setTimeout(k, 1E3);\n }, k());\n };\n b.j = function (b, c, e) {\n b.attachEvent ? b.attachEvent(\"on\" + c, e) : b.addEventListener && b.addEventListener(c, e, !1);\n };\n void 0 == b.completeByCloseOffset && (b.completeByCloseOffset = 1);\n void 0 == b.completeCloseOffsetThreshold && (b.completeCloseOffsetThreshold =\n 1);\n b.Heartbeat = {};\n b.N = function () {\n var d, c;\n if (b.autoTrack && (d = b.s.d.getElementsByTagName(\"VIDEO\")))\n for (c = 0; c < d.length; c++) b.attach(d[c]);\n };\n b.j(q, \"load\", b.N);\n }", "function handleMediaManagerSelect(fileData){\n quill.insertEmbed(insertPointIndex, 'image', fileData.url);\n}", "async findSoundtrack(ctx, payload) {\n let music = [];\n if(payload.title != '' && payload.artist != '') {\n music = await axios.get('https://api.discogs.com/database/search?release_title='+payload.title+'&genre=Stage+&+Screen&artist='+payload.artist+'&token='+token.token)\n } else if(payload.title == '' && payload.artist != '') {\n music = await axios.get('https://api.discogs.com/database/search?genre=Stage+&+Screen&artist='+payload.artist+'&token='+token.token)\n } else if(payload.title != '' && payload.artist == '') {\n music = await axios.get('https://api.discogs.com/database/search?release_title='+payload.title+'&genre=Stage+&+Screen&token='+token.token)\n }\n let list = music.data.results.slice(music.data.results[0]);\n ctx.commit('setSoundtrackSearchResult', list);\n }", "function getAllImages(){\n var contents = Contents_Live.find({ \"code\": Session.get(\"UserLogged\").code });\n var imagesArray = [];\n contents.forEach(function(doc){\n var res = doc.contentType.split(\"/\");\n if(res[0] == \"image\"){\n var obj = {\n '_id': doc._id,\n 'imageName': doc.contentName\n };\n imagesArray.push(obj);\n }\n });\n if(imagesArray.length > 0){\n return imagesArray;\n }else{\n return null;\n }\n}", "static getMedium(id){\n return fetch(`${BASE_URL}media/${id}`)\n .then(res => res.json())\n }", "function getSongs(callback) {\n\n}", "function getMediaItems(title, commonLocation, lat, long, eventId, eventHtml) {\n getNodeMediaItems(title, commonLocation, eventId, eventHtml);\n // getTeleportdMediaItems(title, lat, long, eventId, eventHtml); // ficken\n}", "function retrieveNodeMediaItemsResults(data, eventId, eventHtml) {\n var socialNetworks = Object.keys(data);\n // check if we have media at all, a bit ugly, but works\n var mediaExist = false;\n for (var i = 0, len = socialNetworks.length; i < len; i++) {\n var media = data[socialNetworks[i]];\n if (media.length) {\n mediaExist = true;\n break;\n }\n }\n if (mediaExist) {\n var html = '';\n socialNetworks.forEach(function(socialNetwork) {\n var media = data[socialNetwork];\n media.forEach(function(mediaItem) {\n if (mediaItem.type === 'photo') {\n if ((!eventMediaItems[eventId][mediaItem.mediaurl]) &&\n // TODO: very lame way to remove spammy messages with just too\n // much characters\n (mediaItem.micropost.plainText.length <= 500)) {\n html += htmlFactory.media(\n mediaItem.mediaUrl,\n mediaItem.micropost.plainText,\n mediaItem.micropostUrl);\n eventMediaItems[eventId][mediaItem.mediaUrl] = true;\n addBackgroundImage(eventPages[eventId], mediaItem.mediaUrl);\n }\n }\n });\n });\n addPageContent(eventPages[eventId], html);\n }\n // no media exist\n else {\n // ugly hack: getMediaItems gets called two times,\n // so only delete the second time we get no media\n var page = eventPages[eventId];\n var times = page.data('noMediaExistTimes') || 0;\n times++;\n page.data('noMediaExistTimes', times);\n\n // remove the page from the flipbook\n if (times == 2) {\n // find the right pagenumber by looping through all pages (sigh…)\n var pages = $('#flipbook').data('pageObjs');\n for (var pageNumber in pages) {\n if (pages[pageNumber][0] === page[0]) {\n $('#flipbook').turn('removePage', pageNumber);\n break;\n }\n }\n }\n }\n}", "function getMedia() {\n\tvar results = [];\n\n\tif (extensions && extensions.hasOwnProperty('media')) {\n\t\tvar sourceArray = extensions.media;\n\n\t\tfor (index = 0; index < sourceArray.length; ++index) {\n\t\t results.push(sourceArray[index]);\n\t\t}\n\t}\n\n\treturn results;\n}", "function getMediaInfos() {\n var mediaInfos = adapter.getAllMediaInfoForType(streamInfo, constants.VIDEO);\n mediaInfos = mediaInfos.concat(adapter.getAllMediaInfoForType(streamInfo, constants.AUDIO));\n mediaInfos = mediaInfos.concat(adapter.getAllMediaInfoForType(streamInfo, constants.TEXT)); // mediaInfos = mediaInfos.concat(adapter.getAllMediaInfoForType(streamInfo, constants.MUXED));\n // mediaInfos = mediaInfos.concat(adapter.getAllMediaInfoForType(streamInfo, constants.IMAGE));\n\n eventBus.trigger(events.OFFLINE_RECORD_LOADEDMETADATA, {\n id: manifestId,\n mediaInfos: mediaInfos\n });\n }", "function getProductMedia(id, media_type) {\n var deferred = $q.defer();\n var query = \"SELECT * FROM product_media WHERE product_id = ? AND product_media_type = ?\";\n mysql.query(query, [id, media_type], function (err, rows) {\n if (err) deferred.reject(err);\n deferred.resolve(rows);\n });\n return deferred.promise;\n }", "function getMediaQueryString(refreshToken) {\n let csrfToken = getCookie('csrf-token')\n\tlet mediaToken = refreshToken ? md5(refreshToken) : '';\n return '_csrf='+csrfToken+'&_media='+mediaToken\n}", "function deleteMedias(){\n imagesToRemove = []\n console.log(\"BORRANDO\")\n $.couch.urlPrefix = \"https://socpa.cloudant.com\";\n $.couch.login({\n name: \"socpa\",\n password: \"asdargonnijao\"\n });\n\n return $.couch.db(\"media\").view(\"todelete/todelete\", {\n key: canvas_id,\n reduce: false,\n success: function(data) {\n\n },\n error: function(status) {\n console.log(status);\n }\n\n })\n}", "function getSongs() {\n\n var spotify = new Spotify(keys.spotify);\n\n var songName = process.argv[3];\n\n spotify.search({ type: 'track', query: songName, limit: 1 }, function (err, data) {\n if (err) {\n return console.log('Error occurred: ' + err);\n }\n\n console.log(data.tracks.items[0].artists[0].name);\n console.log(data.tracks.items[0].album.name);\n console.log(data.tracks.items[0].name);\n console.log(data.tracks.items[0].external_urls.spotify);\n });\n\n\n}", "getAllSongs() {\n Utils.get('/allSongs')\n .then((response) => {\n return response.json();\n })\n .then((json) => {\n Dispatcher.dispatch({\n type: ActionType.RECEIVE_ALL_SONGS,\n songs: json\n })\n })\n .catch((err) => {\n console.error('failed: ', err)\n })\n }", "function addMedia(type,media){\n //assumption ki tabhi chlega jb dbAccess hoga\n let tx = dbAccess.transaction(\"gallery\",\"readwrite\");\n let galleryObjectStore = tx.objectStore(\"gallery\");\n let data={\n mId : Date.now(),\n type,\n media,\n };\n galleryObjectStore.add(data);\n}", "function getMedia() {\n\tvar results = [];\n\n\tif (config.hasOwnProperty('extensions') && config.extensions.hasOwnProperty('media')) {\n\t\tvar sourceArray = config.extensions.media;\n\n\t\tfor (index = 0; index < sourceArray.length; ++index) {\n\t\t results.push(sourceArray[index]);\n\t\t}\n\t}\n\n\treturn results;\n}", "function addAlbum(albumID) {\n var query = \" SELECT concat('file://','/', u.rpath)\";\n query += \" FROM tracks t, urls u\";\n query += \" where t.album=\"+albumID;\n query += \" and t.url=u.id\";\n query += \" order by t.discnumber, t.tracknumber\";\n var result = sql(query);\n for (var i=0; i < result.length; i++) {\n Amarok.Playlist.addMedia(new QUrl(result[i]));\n }\n}", "function mediaHandler ( info, tab ) {\n sendItem( { 'imageUrl': info.srcUrl } );\n}", "async function getMedia() {\n let results = res.map(post => { \n // return fetchMediaWithUrl(post[\"_links\"][\"wp:featuredmedia\"][0].href).then(images => {\n // const thumb = images[\"media_details\"].sizes.thumbnail.source_url;\n const title = post.title.rendered;\n const postId = post.id;\n const thumb = post.featured_media_src_url;\n // console.log(post.featured_media_src_url);\n // console.log(thumb);\n return { title: title, thumb: thumb, id: postId };\n //});\n });\n //return Promise.all(results);\n return results;\n}", "function pubMedia(req, res) {\n return _media2.default.find({ 'pub': req.user.email },null, {sort: {created_at: -1}}).exec().then(respondWithResult(res)).catch(handleError(res));\n}", "function filter (type,id_carousel){\n $(id_carousel + \" ol\").empty();\n $(id_carousel + \" .carousel-inner\").empty();\n var url;\n if (type !== \"all\"){\n url = 'https://api.spotify.com/v1/artists/'+artist_selected+'/albums?market=ES&album_type='+type+'&limit=40';\n }else{\n url = 'https://api.spotify.com/v1/artists/'+artist_selected+'/albums?market=ES&limit=40';\n }\n \n request(url,\"load_albums\",id_carousel);\n}", "static addSongs() {\n fetch(\"https://itunes.apple.com/us/rss/topalbums/limit=100/json\")\n .then(resp => resp.json())\n .then(data => {\n let i = 1;\n data.feed.entry.forEach(album => {\n let newCard = new Album(i, album[\"im:image\"][0].label, album[\"im:name\"].label, album[\"im:artist\"].label, album[\"id\"].label, album[\"im:price\"].label, album[\"im:releaseDate\"].label)\n i++;\n Album.all.push(newCard);\n });\n })\n }", "function allAccessSearch() {\n var deferred = Q.defer();\n\n that.pm.search(query, 25, function(err, data) {\n if (err) { deferred.reject(err); return; }\n\n var songs = (data.entries || []).map(function(res) {\n var ret = {};\n\n ret.score = res.score;\n\n if (res.type == \"1\") {\n ret.type = \"track\";\n ret.track = that._parseTrackObject(res.track);\n }\n else if (res.type == \"2\") {\n ret.type = \"artist\";\n ret.artist = res.artist;\n }\n else if (res.type == \"3\") {\n ret.type = \"album\";\n ret.album = res.album;\n }\n\n return ret;\n });\n\n deferred.resolve(songs);\n });\n\n return deferred.promise;\n }", "function AppMeasurement_Module_Media(s){var m=this;m.s=s;s=window;if(!s.s_c_in)s.s_c_il=[],s.s_c_in=0;m._il=s.s_c_il;m._in=s.s_c_in;m._il[m._in]=m;s.s_c_in++;m._c=\"s_m\";m.list=[];m.open=function(w,b,c,h){var d={},a=new Date,g=\"\",e;b||(b=-1);if(w&&c){if(!m.list)m.list={};m.list[w]&&m.close(w);if(h&&h.id)g=h.id;if(g)for(e in m.list)!Object.prototype[e]&&m.list[e]&&m.list[e].S==g&&m.close(m.list[e].name);d.name=w;d.length=b;d.u=0;d.c=0;d.playerName=m.playerName?m.playerName:c;d.S=g;d.L=0;d.f=0;d.timestamp=\r\n\t\tMath.floor(a.getTime()/1E3);d.j=0;d.r=d.timestamp;d.a=-1;d.B=\"\";d.k=-1;d.C=0;d.H={};d.F=0;d.m=0;d.e=\"\";d.A=0;d.K=0;d.z=0;d.D=0;d.l=!1;d.v=\"\";d.I=\"\";d.J=0;d.q=!1;d.G=\"\";d.complete=0;d.Q=0;d.o=0;d.p=0;m.list[w]=d}};m.openAd=function(w,b,c,h,d,a,g,e){var f={};m.open(w,b,c,e);if(f=m.list[w])f.l=!0,f.v=h,f.I=d,f.J=a,f.G=g};m.M=function(w){var b=m.list[w];m.list[w]=0;b&&b.monitor&&clearTimeout(b.monitor.R)};m.close=function(w){m.g(w,0,-1)};m.play=function(w,b,c,h){var d=m.g(w,1,b,c,h);if(d&&!d.monitor)d.monitor=\r\n\t\t{},d.monitor.update=function(){d.j==1&&m.g(d.name,3,-1);d.monitor.R=setTimeout(d.monitor.update,1E3)},d.monitor.update()};m.click=function(w,b){m.g(w,7,b)};m.complete=function(w,b){m.g(w,5,b)};m.stop=function(w,b){m.g(w,2,b)};m.track=function(w){m.g(w,4,-1)};m.P=function(w,b){var c=\"a.media.\",h=w.linkTrackVars,d=w.linkTrackEvents,a=\"m_i\",g,e=w.contextData,f;if(b.l){c+=\"ad.\";if(b.v)e[\"a.media.name\"]=b.v,e[c+\"pod\"]=b.I,e[c+\"podPosition\"]=b.J;if(!b.F)e[c+\"CPM\"]=b.G}if(b.q)e[c+\"clicked\"]=!0,b.q=!1;e[\"a.contentType\"]=\r\n\t\t\"video\"+(b.l?\"Ad\":\"\");e[\"a.media.channel\"]=m.channel;e[c+\"name\"]=b.name;e[c+\"playerName\"]=b.playerName;if(b.length>0)e[c+\"length\"]=b.length;e[c+\"timePlayed\"]=Math.floor(b.f);Math.floor(b.f)>0&&(e[c+\"timePlayed\"]=Math.floor(b.f));if(!b.F)e[c+\"view\"]=!0,a=\"m_s\",b.F=1;if(b.e){e[c+\"segmentNum\"]=b.m;e[c+\"segment\"]=b.e;if(b.A>0)e[c+\"segmentLength\"]=b.A;b.z&&b.f>0&&(e[c+\"segmentView\"]=!0)}if(!b.Q&&b.complete)e[c+\"complete\"]=!0,b.T=1;if(b.o>0)e[c+\"milestone\"]=b.o;if(b.p>0)e[c+\"offsetMilestone\"]=b.p;if(h)for(f in e)Object.prototype[f]||\r\n\t\t(h+=\",contextData.\"+f);g=e[\"a.contentType\"];w.pe=a;w.pev3=g;var s,n;if(m.contextDataMapping){if(!w.events2)w.events2=\"\";h&&(h+=\",events\");for(f in m.contextDataMapping)if(!Object.prototype[f]){a=f.length>c.length&&f.substring(0,c.length)==c?f.substring(c.length):\"\";g=m.contextDataMapping[f];if(typeof g==\"string\"){s=g.split(\",\");for(n=0;n<s.length;n++)g=s[n],f==\"a.contentType\"?(h&&(h+=\",\"+g),w[g]=e[f]):a==\"view\"||a==\"segmentView\"||a==\"clicked\"||a==\"complete\"||a==\"timePlayed\"||a==\"CPM\"?(d&&(d+=\",\"+\r\n\t\tg),a==\"timePlayed\"||a==\"CPM\"?e[f]&&(w.events2+=(w.events2?\",\":\"\")+g+\"=\"+e[f]):e[f]&&(w.events2+=(w.events2?\",\":\"\")+g)):a==\"segment\"&&e[f+\"Num\"]?(h&&(h+=\",\"+g),w[g]=e[f+\"Num\"]+\":\"+e[f]):(h&&(h+=\",\"+g),w[g]=e[f])}else if(a==\"milestones\"||a==\"offsetMilestones\")f=f.substring(0,f.length-1),e[f]&&m.contextDataMapping[f+\"s\"][e[f]]&&(d&&(d+=\",\"+m.contextDataMapping[f+\"s\"][e[f]]),w.events2+=(w.events2?\",\":\"\")+m.contextDataMapping[f+\"s\"][e[f]]);e[f]&&(e[f]=0);a==\"segment\"&&e[f+\"Num\"]&&(e[f+\"Num\"]=0)}}w.linkTrackVars=\r\n\t\th;w.linkTrackEvents=d};m.g=function(w,b,c,h,d){var a={},g=(new Date).getTime()/1E3,e,f,s=m.trackVars,n=m.trackEvents,o=m.trackSeconds,p=m.trackMilestones,q=m.trackOffsetMilestones,r=m.segmentByMilestones,t=m.segmentByOffsetMilestones,k,j,l=1,i={},u;if(!m.channel)m.channel=m.s.w.location.hostname;if(a=w&&m.list&&m.list[w]?m.list[w]:0){if(a.l)o=m.adTrackSeconds,p=m.adTrackMilestones,q=m.adTrackOffsetMilestones,r=m.adSegmentByMilestones,t=m.adSegmentByOffsetMilestones;c<0&&(c=a.j==1&&a.r>0?g-a.r+a.a:\r\n\t\ta.a);a.length>0&&(c=c<a.length?c:a.length);c<0&&(c=0);a.u=c;if(a.length>0)a.c=a.u/a.length*100,a.c=a.c>100?100:a.c;if(a.a<0)a.a=c;u=a.C;i.name=w;i.ad=a.l;i.length=a.length;i.openTime=new Date;i.openTime.setTime(a.timestamp*1E3);i.offset=a.u;i.percent=a.c;i.playerName=a.playerName;i.mediaEvent=a.k<0?\"OPEN\":b==1?\"PLAY\":b==2?\"STOP\":b==3?\"MONITOR\":b==4?\"TRACK\":b==5?\"COMPLETE\":b==7?\"CLICK\":\"CLOSE\";if(b>2||b!=a.j&&(b!=2||a.j==1)){if(!d)h=a.m,d=a.e;if(b){if(b==1)a.a=c;if((b<=3||b>=5)&&a.k>=0)if(l=!1,s=n=\r\n\t\t\"None\",a.k!=c){f=a.k;if(f>c)f=a.a,f>c&&(f=c);k=p?p.split(\",\"):0;if(a.length>0&&k&&c>=f)for(j=0;j<k.length;j++)if((e=k[j]?parseFloat(\"\"+k[j]):0)&&f/a.length*100<e&&a.c>=e)l=!0,j=k.length,i.mediaEvent=\"MILESTONE\",a.o=i.milestone=e;if((k=q?q.split(\",\"):0)&&c>=f)for(j=0;j<k.length;j++)if((e=k[j]?parseFloat(\"\"+k[j]):0)&&f<e&&c>=e)l=!0,j=k.length,i.mediaEvent=\"OFFSET_MILESTONE\",a.p=i.offsetMilestone=e}if(a.K||!d){if(r&&p&&a.length>0){if(k=p.split(\",\")){k.push(\"100\");for(j=f=0;j<k.length;j++)if(e=k[j]?parseFloat(\"\"+\r\n\t\tk[j]):0){if(a.c<e)h=j+1,d=\"M:\"+f+\"-\"+e,j=k.length;f=e}}}else if(t&&q&&(k=q.split(\",\"))){k.push(\"\"+(a.length>0?a.length:\"E\"));for(j=f=0;j<k.length;j++)if((e=k[j]?parseFloat(\"\"+k[j]):0)||k[j]==\"E\"){if(c<e||k[j]==\"E\")h=j+1,d=\"O:\"+f+\"-\"+e,j=k.length;f=e}}if(d)a.K=!0}if((d||a.e)&&d!=a.e){a.D=!0;if(!a.e)a.m=h,a.e=d;a.k>=0&&(l=!0)}if((b>=2||a.c>=100)&&a.a<c)a.L+=c-a.a,a.f+=c-a.a;if(b<=2||b==3&&!a.j)a.B+=(b==1||b==3?\"S\":\"E\")+Math.floor(c),a.j=b==3?1:b;if(!l&&a.k>=0&&b<=3&&(o=o?o:0)&&a.f>=o)l=!0,i.mediaEvent=\r\n\t\t\"SECONDS\";a.r=g;a.a=c}if(!b||b<=3&&a.c>=100)a.j!=2&&(a.B+=\"E\"+Math.floor(c)),b=0,s=n=\"None\",i.mediaEvent=\"CLOSE\";if(b==7)l=i.clicked=a.q=!0;if(b==5||m.completeByCloseOffset&&(!b||a.c>=100)&&a.length>0&&c>=a.length-m.completeCloseOffsetThreshold)l=i.complete=a.complete=!0;g=i.mediaEvent;g==\"MILESTONE\"?g+=\"_\"+i.milestone:g==\"OFFSET_MILESTONE\"&&(g+=\"_\"+i.offsetMilestone);a.H[g]?i.eventFirstTime=!1:(i.eventFirstTime=!0,a.H[g]=1);i.event=i.mediaEvent;i.timePlayed=a.L;i.segmentNum=a.m;i.segment=a.e;i.segmentLength=\r\n\t\ta.A;m.monitor&&b!=4&&m.monitor(m.s,i);b==0&&m.M(w);if(l&&a.C==u){w={};w.contextData={};w.linkTrackVars=s;w.linkTrackEvents=n;if(!w.linkTrackVars)w.linkTrackVars=\"\";if(!w.linkTrackEvents)w.linkTrackEvents=\"\";m.P(w,a);w.linkTrackVars||(w[\"!linkTrackVars\"]=1);w.linkTrackEvents||(w[\"!linkTrackEvents\"]=1);m.s.track(w);if(a.D)a.m=h,a.e=d,a.z=!0,a.D=!1;else if(a.f>0)a.z=!1;a.B=\"\";a.o=a.p=0;a.f-=Math.floor(a.f);a.k=c;a.C++}}}return a};m.O=function(w,b,c,h,d){var a=0;if(w&&(!m.autoTrackMediaLengthRequired||\r\n\t\tb&&b>0)){if(!m.list||!m.list[w]){if(c==1||c==3)m.open(w,b,\"HTML5 Video\",d),a=1}else a=1;a&&m.g(w,c,h,-1,0)}};m.attach=function(w){var b,c,h;if(w&&w.tagName&&w.tagName.toUpperCase()==\"VIDEO\"){if(!m.n)m.n=function(b,a,w){var c,f;if(m.autoTrack){c=b.currentSrc;(f=b.duration)||(f=-1);if(w<0)w=b.currentTime;m.O(c,f,a,w,b)}};b=function(){m.n(w,1,-1)};c=function(){m.n(w,1,-1)};m.i(w,\"play\",b);m.i(w,\"pause\",c);m.i(w,\"seeking\",c);m.i(w,\"seeked\",b);m.i(w,\"ended\",function(){m.n(w,0,-1)});m.i(w,\"timeupdate\",\r\n\t\tb);h=function(){!w.paused&&!w.ended&&!w.seeking&&m.n(w,3,-1);setTimeout(h,1E3)};h()}};m.i=function(m,b,c){m.attachEvent?m.attachEvent(\"on\"+b,c):m.addEventListener&&m.addEventListener(b,c,!1)};if(m.completeByCloseOffset==void 0)m.completeByCloseOffset=1;if(m.completeCloseOffsetThreshold==void 0)m.completeCloseOffsetThreshold=1;m.N=function(){var w,b;if(m.autoTrack&&(w=m.s.d.getElementsByTagName(\"VIDEO\")))for(b=0;b<w.length;b++)m.attach(w[b])};m.i(s,\"load\",m.N)}", "function AppMeasurement_Module_Media(s){var m=this;m.s=s;s=window;if(!s.s_c_in)s.s_c_il=[],s.s_c_in=0;m._il=s.s_c_il;m._in=s.s_c_in;m._il[m._in]=m;s.s_c_in++;m._c=\"s_m\";m.list=[];m.open=function(w,b,c,h){var d={},a=new Date,g=\"\",e;b||(b=-1);if(w&&c){if(!m.list)m.list={};m.list[w]&&m.close(w);if(h&&h.id)g=h.id;if(g)for(e in m.list)!Object.prototype[e]&&m.list[e]&&m.list[e].S==g&&m.close(m.list[e].name);d.name=w;d.length=b;d.u=0;d.c=0;d.playerName=m.playerName?m.playerName:c;d.S=g;d.L=0;d.f=0;d.timestamp=\r\nMath.floor(a.getTime()/1E3);d.j=0;d.r=d.timestamp;d.a=-1;d.B=\"\";d.k=-1;d.C=0;d.H={};d.F=0;d.m=0;d.e=\"\";d.A=0;d.K=0;d.z=0;d.D=0;d.l=!1;d.v=\"\";d.I=\"\";d.J=0;d.q=!1;d.G=\"\";d.complete=0;d.Q=0;d.o=0;d.p=0;m.list[w]=d}};m.openAd=function(w,b,c,h,d,a,g,e){var f={};m.open(w,b,c,e);if(f=m.list[w])f.l=!0,f.v=h,f.I=d,f.J=a,f.G=g};m.M=function(w){var b=m.list[w];m.list[w]=0;b&&b.monitor&&clearTimeout(b.monitor.R)};m.close=function(w){m.g(w,0,-1)};m.play=function(w,b,c,h){var d=m.g(w,1,b,c,h);if(d&&!d.monitor)d.monitor=\r\n{},d.monitor.update=function(){d.j==1&&m.g(d.name,3,-1);d.monitor.R=setTimeout(d.monitor.update,1E3)},d.monitor.update()};m.click=function(w,b){m.g(w,7,b)};m.complete=function(w,b){m.g(w,5,b)};m.stop=function(w,b){m.g(w,2,b)};m.track=function(w){m.g(w,4,-1)};m.P=function(w,b){var c=\"a.media.\",h=w.linkTrackVars,d=w.linkTrackEvents,a=\"m_i\",g,e=w.contextData,f;if(b.l){c+=\"ad.\";if(b.v)e[\"a.media.name\"]=b.v,e[c+\"pod\"]=b.I,e[c+\"podPosition\"]=b.J;if(!b.F)e[c+\"CPM\"]=b.G}if(b.q)e[c+\"clicked\"]=!0,b.q=!1;e[\"a.contentType\"]=\r\n\"video\"+(b.l?\"Ad\":\"\");e[\"a.media.channel\"]=m.channel;e[c+\"name\"]=b.name;e[c+\"playerName\"]=b.playerName;if(b.length>0)e[c+\"length\"]=b.length;e[c+\"timePlayed\"]=Math.floor(b.f);Math.floor(b.f)>0&&(e[c+\"timePlayed\"]=Math.floor(b.f));if(!b.F)e[c+\"view\"]=!0,a=\"m_s\",b.F=1;if(b.e){e[c+\"segmentNum\"]=b.m;e[c+\"segment\"]=b.e;if(b.A>0)e[c+\"segmentLength\"]=b.A;b.z&&b.f>0&&(e[c+\"segmentView\"]=!0)}if(!b.Q&&b.complete)e[c+\"complete\"]=!0,b.T=1;if(b.o>0)e[c+\"milestone\"]=b.o;if(b.p>0)e[c+\"offsetMilestone\"]=b.p;if(h)for(f in e)Object.prototype[f]||\r\n(h+=\",contextData.\"+f);g=e[\"a.contentType\"];w.pe=a;w.pev3=g;var s,n;if(m.contextDataMapping){if(!w.events2)w.events2=\"\";h&&(h+=\",events\");for(f in m.contextDataMapping)if(!Object.prototype[f]){a=f.length>c.length&&f.substring(0,c.length)==c?f.substring(c.length):\"\";g=m.contextDataMapping[f];if(typeof g==\"string\"){s=g.split(\",\");for(n=0;n<s.length;n++)g=s[n],f==\"a.contentType\"?(h&&(h+=\",\"+g),w[g]=e[f]):a==\"view\"||a==\"segmentView\"||a==\"clicked\"||a==\"complete\"||a==\"timePlayed\"||a==\"CPM\"?(d&&(d+=\",\"+\r\ng),a==\"timePlayed\"||a==\"CPM\"?e[f]&&(w.events2+=(w.events2?\",\":\"\")+g+\"=\"+e[f]):e[f]&&(w.events2+=(w.events2?\",\":\"\")+g)):a==\"segment\"&&e[f+\"Num\"]?(h&&(h+=\",\"+g),w[g]=e[f+\"Num\"]+\":\"+e[f]):(h&&(h+=\",\"+g),w[g]=e[f])}else if(a==\"milestones\"||a==\"offsetMilestones\")f=f.substring(0,f.length-1),e[f]&&m.contextDataMapping[f+\"s\"][e[f]]&&(d&&(d+=\",\"+m.contextDataMapping[f+\"s\"][e[f]]),w.events2+=(w.events2?\",\":\"\")+m.contextDataMapping[f+\"s\"][e[f]]);e[f]&&(e[f]=0);a==\"segment\"&&e[f+\"Num\"]&&(e[f+\"Num\"]=0)}}w.linkTrackVars=\r\nh;w.linkTrackEvents=d};m.g=function(w,b,c,h,d){var a={},g=(new Date).getTime()/1E3,e,f,s=m.trackVars,n=m.trackEvents,o=m.trackSeconds,p=m.trackMilestones,q=m.trackOffsetMilestones,r=m.segmentByMilestones,t=m.segmentByOffsetMilestones,k,j,l=1,i={},u;if(!m.channel)m.channel=m.s.w.location.hostname;if(a=w&&m.list&&m.list[w]?m.list[w]:0){if(a.l)o=m.adTrackSeconds,p=m.adTrackMilestones,q=m.adTrackOffsetMilestones,r=m.adSegmentByMilestones,t=m.adSegmentByOffsetMilestones;c<0&&(c=a.j==1&&a.r>0?g-a.r+a.a:\r\na.a);a.length>0&&(c=c<a.length?c:a.length);c<0&&(c=0);a.u=c;if(a.length>0)a.c=a.u/a.length*100,a.c=a.c>100?100:a.c;if(a.a<0)a.a=c;u=a.C;i.name=w;i.ad=a.l;i.length=a.length;i.openTime=new Date;i.openTime.setTime(a.timestamp*1E3);i.offset=a.u;i.percent=a.c;i.playerName=a.playerName;i.mediaEvent=a.k<0?\"OPEN\":b==1?\"PLAY\":b==2?\"STOP\":b==3?\"MONITOR\":b==4?\"TRACK\":b==5?\"COMPLETE\":b==7?\"CLICK\":\"CLOSE\";if(b>2||b!=a.j&&(b!=2||a.j==1)){if(!d)h=a.m,d=a.e;if(b){if(b==1)a.a=c;if((b<=3||b>=5)&&a.k>=0)if(l=!1,s=n=\r\n\"None\",a.k!=c){f=a.k;if(f>c)f=a.a,f>c&&(f=c);k=p?p.split(\",\"):0;if(a.length>0&&k&&c>=f)for(j=0;j<k.length;j++)if((e=k[j]?parseFloat(\"\"+k[j]):0)&&f/a.length*100<e&&a.c>=e)l=!0,j=k.length,i.mediaEvent=\"MILESTONE\",a.o=i.milestone=e;if((k=q?q.split(\",\"):0)&&c>=f)for(j=0;j<k.length;j++)if((e=k[j]?parseFloat(\"\"+k[j]):0)&&f<e&&c>=e)l=!0,j=k.length,i.mediaEvent=\"OFFSET_MILESTONE\",a.p=i.offsetMilestone=e}if(a.K||!d){if(r&&p&&a.length>0){if(k=p.split(\",\")){k.push(\"100\");for(j=f=0;j<k.length;j++)if(e=k[j]?parseFloat(\"\"+\r\nk[j]):0){if(a.c<e)h=j+1,d=\"M:\"+f+\"-\"+e,j=k.length;f=e}}}else if(t&&q&&(k=q.split(\",\"))){k.push(\"\"+(a.length>0?a.length:\"E\"));for(j=f=0;j<k.length;j++)if((e=k[j]?parseFloat(\"\"+k[j]):0)||k[j]==\"E\"){if(c<e||k[j]==\"E\")h=j+1,d=\"O:\"+f+\"-\"+e,j=k.length;f=e}}if(d)a.K=!0}if((d||a.e)&&d!=a.e){a.D=!0;if(!a.e)a.m=h,a.e=d;a.k>=0&&(l=!0)}if((b>=2||a.c>=100)&&a.a<c)a.L+=c-a.a,a.f+=c-a.a;if(b<=2||b==3&&!a.j)a.B+=(b==1||b==3?\"S\":\"E\")+Math.floor(c),a.j=b==3?1:b;if(!l&&a.k>=0&&b<=3&&(o=o?o:0)&&a.f>=o)l=!0,i.mediaEvent=\r\n\"SECONDS\";a.r=g;a.a=c}if(!b||b<=3&&a.c>=100)a.j!=2&&(a.B+=\"E\"+Math.floor(c)),b=0,s=n=\"None\",i.mediaEvent=\"CLOSE\";if(b==7)l=i.clicked=a.q=!0;if(b==5||m.completeByCloseOffset&&(!b||a.c>=100)&&a.length>0&&c>=a.length-m.completeCloseOffsetThreshold)l=i.complete=a.complete=!0;g=i.mediaEvent;g==\"MILESTONE\"?g+=\"_\"+i.milestone:g==\"OFFSET_MILESTONE\"&&(g+=\"_\"+i.offsetMilestone);a.H[g]?i.eventFirstTime=!1:(i.eventFirstTime=!0,a.H[g]=1);i.event=i.mediaEvent;i.timePlayed=a.L;i.segmentNum=a.m;i.segment=a.e;i.segmentLength=\r\na.A;m.monitor&&b!=4&&m.monitor(m.s,i);b==0&&m.M(w);if(l&&a.C==u){w={};w.contextData={};w.linkTrackVars=s;w.linkTrackEvents=n;if(!w.linkTrackVars)w.linkTrackVars=\"\";if(!w.linkTrackEvents)w.linkTrackEvents=\"\";m.P(w,a);w.linkTrackVars||(w[\"!linkTrackVars\"]=1);w.linkTrackEvents||(w[\"!linkTrackEvents\"]=1);m.s.track(w);if(a.D)a.m=h,a.e=d,a.z=!0,a.D=!1;else if(a.f>0)a.z=!1;a.B=\"\";a.o=a.p=0;a.f-=Math.floor(a.f);a.k=c;a.C++}}}return a};m.O=function(w,b,c,h,d){var a=0;if(w&&(!m.autoTrackMediaLengthRequired||\r\nb&&b>0)){if(!m.list||!m.list[w]){if(c==1||c==3)m.open(w,b,\"HTML5 Video\",d),a=1}else a=1;a&&m.g(w,c,h,-1,0)}};m.attach=function(w){var b,c,h;if(w&&w.tagName&&w.tagName.toUpperCase()==\"VIDEO\"){if(!m.n)m.n=function(b,a,w){var c,f;if(m.autoTrack){c=b.currentSrc;(f=b.duration)||(f=-1);if(w<0)w=b.currentTime;m.O(c,f,a,w,b)}};b=function(){m.n(w,1,-1)};c=function(){m.n(w,1,-1)};m.i(w,\"play\",b);m.i(w,\"pause\",c);m.i(w,\"seeking\",c);m.i(w,\"seeked\",b);m.i(w,\"ended\",function(){m.n(w,0,-1)});m.i(w,\"timeupdate\",\r\nb);h=function(){!w.paused&&!w.ended&&!w.seeking&&m.n(w,3,-1);setTimeout(h,1E3)};h()}};m.i=function(m,b,c){m.attachEvent?m.attachEvent(\"on\"+b,c):m.addEventListener&&m.addEventListener(b,c,!1)};if(m.completeByCloseOffset==void 0)m.completeByCloseOffset=1;if(m.completeCloseOffsetThreshold==void 0)m.completeCloseOffsetThreshold=1;m.N=function(){var w,b;if(m.autoTrack&&(w=m.s.d.getElementsByTagName(\"VIDEO\")))for(b=0;b<w.length;b++)m.attach(w[b])};m.i(s,\"load\",m.N)}", "static getDerivedStateFromProps({ media }) {\n let photos = [];\n\n if (media && media.photos && media.photos.photo) {\n photos = media.photos.photo.filter(photo => photo[\"@size\"] === \"pn\");\n }\n\n return { photos };\n }", "function similarItems(media_type, id){\n tmdb_url = `https://api.themoviedb.org/3/${media_type}/${id}/similar?api_key=${api_key}&language=en-US&page=1`;\n try{\n const promise = axios.get(tmdb_url);\n const pm_data = promise.then(response => processSmallCarousel(response.data, media_type));\n return pm_data;\n } catch(error) {\n console.error(error);\n }\n}", "static listMusic() {\n let music = new Array();\n\n music.push('sounds/music/incompetech/delightful_d.ogg');\n music.push('sounds/music/incompetech/twisting.ogg'); // Moody, good for cave.\n music.push('sounds/music/incompetech/pookatori_and_friends.ogg');\n music.push('sounds/music/incompetech/getting_it_done.ogg');\n music.push('sounds/music/incompetech/robobozo.ogg');\n music.push('sounds/music/incompetech/balloon_game.ogg');\n music.push('sounds/music/incompetech/cold_sober.ogg');\n music.push('sounds/music/incompetech/salty_ditty.ogg');\n music.push('sounds/music/incompetech/townie_loop.ogg'); // Very peaceful, flute.\n music.push('sounds/music/incompetech/mega_hyper_ultrastorm.ogg'); // Super energetic. Maybe for special.\n // Legacy\n music.push('sounds/music/music_peaceful_contemplative_starling.ogg');\n music.push('sounds/music/twinmusicom_8_bit_march.ogg');\n music.push('sounds/music/twinmusicom_nes_overworld.ogg');\n music.push('sounds/music/music_juhanijunkala_chiptune_01.ogg');\n\n return music;\n }", "function mediaqueryresponse(mql){\n\t\t\t\tif (mql.matches) { // if media query matches\n\t\t\t\t\t\n\t\t\t\t} else if (!mql.matches) {\n\t\t\t\t\tsetupServices();\n\t\t\t\t}\n\t\t\t}", "get media () {\n\n\t\tif (typeof this.elements === 'undefined') {\n\t\t\tthrow Error('Cannot access media until publication is loaded');\n\t\t}\n\n\t\treturn this.elements.filter(({ type }) => {\n\t\t\treturn type === 'media';\n\t\t}).map(({ data }) => {\n\t\t\treturn new Media(data);\n\t\t});\n\t}", "function findSong(savedArrayOfChoices) {\n // declaring all vars according to savedArrayOfChoices \n var pickCountry = savedArrayOfChoices[0];\n var pickArtist = savedArrayOfChoices[1];\n var pickRelatedArtist = savedArrayOfChoices[2];\n var pickAlbum = savedArrayOfChoices[3];\n var pickSong = savedArrayOfChoices[4];\n\n // pushing country into chartQuery, returns artist\n var chartQuery = `chart.artists.get?page=1&page_size=4&country=${pickCountry}`;\n var musixUrl = `https://api.musixmatch.com/ws/1.1/${chartQuery}&format=jsonp&callback=callback&quorum_factor=1&apikey=${musixApikey}`;\n\n $.ajax({\n url: musixUrl,\n method: \"GET\",\n dataType: \"jsonp\"\n\n }).then(function (music) {\n\n // declaring artistId and artistname\n var artistId = music.message.body.artist_list[pickArtist].artist.artist_id;\n var artistName = music.message.body.artist_list[pickArtist].artist.artist_name;\n\n // pushing artistid, returns related artist\n var chartQuery = `artist.related.get?artist_id=${artistId}&page_size=4&page=1`;\n var musixUrl = `https://api.musixmatch.com/ws/1.1/${chartQuery}&format=jsonp&callback=callback&quorum_factor=1&apikey=${musixApikey}`;\n\n $.ajax({\n url: musixUrl,\n method: \"GET\",\n dataType: \"jsonp\"\n\n }).then(function (music) {\n\n // declaring related artist id and name\n var relatedArtistId;\n var relatedArtistName;\n\n // if no related artists, just use artist\n if (music.message.body.artist_list.length === 0) {\n relatedArtistId = artistId;\n relatedArtistName = artistName;\n }\n // otherwise use the related artist\n else {\n relatedArtistId = music.message.body.artist_list[pickRelatedArtist].artist.artist_id;\n relatedArtistName = music.message.body.artist_list[pickRelatedArtist].artist.artist_name;\n\n }\n\n // pushing relatedArtistId, returns album\n var chartQuery = `artist.albums.get?artist_id=${relatedArtistId}&s_release_date=desc&page_size=4`;\n var musixUrl = `https://api.musixmatch.com/ws/1.1/${chartQuery}&format=jsonp&callback=callback&quorum_factor=1&apikey=${musixApikey}`;\n\n $.ajax({\n url: musixUrl,\n method: \"GET\",\n dataType: \"jsonp\"\n\n }).then(function (music) {\n\n // declaring album id\n var albumId\n\n // if statements for if the artist doesn't have 4 albums\n if (music.message.body.album_list.length === pickSong) {\n albumId = music.message.body.album_list[pickAlbum].album.album_id;\n }\n else if (music.message.body.album_list.length === 3) {\n albumId = music.message.body.album_list[2].album.album_id;\n\n }\n else if (music.message.body.album_list.length === 2) {\n albumId = music.message.body.album_list[1].album.album_id;\n }\n else {\n albumId = music.message.body.album_list[0].album.album_id;\n\n }\n\n // pushing albumID, returns song\n var chartQuery = `album.tracks.get?album_id=${albumId}&page=1&page_size=4`;\n var musixUrl = `https://api.musixmatch.com/ws/1.1/${chartQuery}&format=jsonp&callback=callback&quorum_factor=1&apikey=${musixApikey}`;\n\n $.ajax({\n url: musixUrl,\n method: \"GET\",\n dataType: \"jsonp\"\n\n }).then(function (music) {\n // declaring song name\n var songName;\n\n // if statements for if the album doesn't have 4 songs\n if (music.message.body.track_list.length === pickSong) {\n songName = music.message.body.track_list[pickSong].track.track_name;\n\n }\n else if (music.message.body.track_list.length === 3) {\n songName = music.message.body.track_list[2].track.track_name;\n\n }\n else if (music.message.body.track_list.length === 2) {\n songName = music.message.body.track_list[1].track.track_name;\n\n }\n else {\n songName = music.message.body.track_list[0].track.track_name;\n\n }\n // finds video with youtube api\n getVideo(`${songName} ${relatedArtistName}`);\n\n // sets the text of final-artist-song to the song and artist that is found\n $(\"#final-artist-song\").text(`${songName} by ${relatedArtistName}`);\n });\n });\n });\n });\n}", "function getEmbededMedia(item, cb) {\n\tvar oembed,\n\t\tu = '',\n\t\thost = url.parse(item.url).host,\n\t\t\to = {\n\t\t\t\turl: item.url,\n\t\t\t\tmaxwidth: item.maxwidth//435,\n\t\t\t\t//maxheight: 244\n\t\t\t};\n\t\n\tif (host.match(/vimeo.com/ig)) {\n\t\tu = config.vimeo.oembed_url + '?' + qs.stringify(o);\n\t} else if (host.match(/youtube.com|youtu.be/ig)) {\n\t\to.format = 'json';\n\t\tu = config.youtube.oembed_url + '?' + qs.stringify(o);\n\t} else if (host.match(/instagr.am|instagram/)) {\n\t\tu = config.instagram.oembed_url + '?' + qs.stringify(o);\n\t}\n\telse return cb(null, {});\n\t\n\tr.get({url: u, json: true}, function(err, resp, body) {\n\t\tif (!err && resp.statusCode === 200) {\n\t\t\treturn cb(null, body);\n\t\t} else {\n\t\t\tif (err) return cb(err);\n\t\t\telse if (err instanceof Error) return cb(new Error(err));\n\t\t\telse return cb(new Error(body.errors[0].message));\n\t\t}\n\t});\n}", "function getRecentMediaByTag(tag) {\r\n\tvar url = \"https://api.instagram.com/v1/tags/\"\r\n\t\t\t+ tag\r\n\t\t\t+ \"/media/recent\"\r\n\t\t\t+ \"?callback=?&access_token=539668504.2c39d74.5b6021beec4048f0bdba845c38919103&client_id=97bf64bca67344afbbe8ea64caa8e617\";\r\n\r\n\t$.getJSON(url, cacheData);\r\n}", "function findAll(done) {\n _connect(function(err, db) {\n if (err) return done(err);\n db.collection('mediaentries').find({}, done);\n });\n }", "function getMediaElements(where) {\n return getElementsByTagName(\"media:content\", where).map((elem) => {\n const { attribs } = elem;\n const media = {\n medium: attribs[\"medium\"],\n isDefault: !!attribs[\"isDefault\"],\n };\n for (const attrib of MEDIA_KEYS_STRING) {\n if (attribs[attrib]) {\n media[attrib] = attribs[attrib];\n }\n }\n for (const attrib of MEDIA_KEYS_INT) {\n if (attribs[attrib]) {\n media[attrib] = parseInt(attribs[attrib], 10);\n }\n }\n if (attribs[\"expression\"]) {\n media.expression = attribs[\"expression\"];\n }\n return media;\n });\n}", "medias() {\n\t\treturn this.recentlyAddedMedias.concat(this.initialMedias)\n\t}", "function getMedia(event) {\n event.preventDefault();\n\n let url = `/media/${this.getAttribute('href')}`;\n\n fetch(url)\n .then(res => res.json())\n .then(data => {\n showMedia(data);\n })\n .catch((err) => console.log(err));\n\n\n for (let i = 0; i < navLink.length; i++) {\n navLink[i].classList.remove('navSelected'); // Removes selected class from all nav links\n }\n this.classList.add('navSelected'); // Adds selected class to chosen nav link\n }", "function html5media() {\n scanElementsByTagName(\"video\");\n scanElementsByTagName(\"audio\");\n }", "function getItems(lat, lng, miles, imagelist) {\n //console.log(\"search service\", imagelist);\n var distance=\"false\";\n if (miles) {\n distance=\"true\";\n }\n // return items.query({lat: lat, lng: lng, miles: miles, 'imagelist[]':imagelist, distance:distance, order:\"asc\"});\n return Image.query({lat: lat, lng: lng, miles: miles, 'imagelist[]':imagelist, distance:distance, order:\"asc\"});\n\n }", "function cmd(a,b,c){var d=\"\";if(b.mode==\"user\"){d=\"https://api.instagram.com/v1/users/\"+c+\"/media/recent/?callback=?\"}else{d=\"https://api.instagram.com/v1/media/popular?callback=?\"}$.getJSON(d,a,function(a){onPhotoLoaded(a,b)})}", "function html5media() {\r\n scanElementsByTagName(\"video\");\r\n scanElementsByTagName(\"audio\");\r\n }", "async list(queryObj) {\n const result = await this.doRequest({\n path: \"/files\",\n method: \"GET\",\n params: {\n path: (queryObj === null || queryObj === void 0 ? void 0 : queryObj.path) || \"/\",\n pagination_token: queryObj === null || queryObj === void 0 ? void 0 : queryObj.paginationToken,\n qty: (queryObj === null || queryObj === void 0 ? void 0 : queryObj.quantity) || 300,\n },\n });\n return result;\n }", "function mediaMgmt()\r\n{\r\n this.ucatMediaClass();\r\n this.setupMedia = function (containerElement, options)\r\n {\r\n //AUDIO OR VIDEO\r\n $(containerElement).find(\"audio, video\").each(function ()\r\n {\r\n var tag = $(this);\r\n //Only convert media if not already converted;\r\n if(!$(this).hasClass(\"ucatMEdiaTag\")){\r\n $(this).addClass(\"ucatMEdiaTag\");\r\n var mediaType = tag.prop(\"tagName\").toLowerCase();//Audio or video\r\n var argumentOptions = mediaType == 'audio' ? options.audio : options.video;\r\n var transcriptHighlights = options.transcriptHighlights;\r\n var defaultOptions = mediaType == 'audio' ? defaultUcatAudioOptions : defaultUcatVideoOptions\r\n reconcileGlobalVariable(argumentOptions, defaultOptions);\r\n var tagOptions = copyGlobalVariable(argumentOptions);\r\n $.each(tag[0].dataset, function (key, value)\r\n {\r\n var valueType = typeof (defaultOptions[key]);\r\n switch (valueType)\r\n {\r\n case \"boolean\":\r\n value = parseBoolean(value);\r\n break;\r\n case \"number\":\r\n value = parseInt(value);\r\n break;\r\n default:\r\n value = String(value);\r\n break;\r\n }\r\n tagOptions[key] = value;\r\n });\r\n //The media browser plug-in passes the videosizetitle as a data-attribute;\r\n //legacy media should use standard playersize as fallback\r\n tagOptions.videosize = tagOptions.videosizetitle ? window[tagOptions.videosizetitle] : standardVideoPlayer;\r\n tagOptions.transcriptHighlights = transcriptHighlights;\r\n for (var th = 0; th < tagOptions.transcriptHighlights.length; th++)\r\n {\r\n tagOptions.transcriptHighlights[th].visible = true;\r\n }\r\n //Addded to force complete download of media\r\n // tag.attr(\"preload\",\"auto\");\r\n\r\n //simply means that the browser has loaded enough meta-data to know the media’s .duration\r\n tag.on('loadedmetadata', { o: tagOptions }, function (e)\r\n {\r\n ucatAudioVideo(containerElement, this, e.data.o)\r\n });\r\n }\r\n });\r\n\r\n //Other file types\r\n $(containerElement).find(\".doc, .xls, .ppt, .pdf, .file\").each(function ()\r\n {\r\n setupDocumentLink($(this));\r\n });\r\n }\r\n\r\n return this;\r\n}", "function getAll(){\n\tvar pictures = document.getElementById(\"picture\");\n\taudio.src = SingleList[i].audio;\n\tpictures.src = SingleList[i].picture;\n\t$('#nowplay').html(SingleList[i].artistSong());\n\t\n\taudio.play();\n\n}", "function getTracks(searchTerm, limit, tracksDiv, ids, playlistID) {\n\n if(!ids) {\n var filter = {\n q : searchTerm,\n limit : limit\n }\n } else {\n var filter = {\n ids : ids\n }\n }\n\n SC.get('/tracks/', filter, function(tracks, error) {\n if(tracks) {\n tracksDiv.html('');\n\n $.each(tracks, function(key, track){\n\n var pictureUrl;\n var genre;\n var wrapper;\n\n if(track.artwork_url == null)\n pictureUrl = 'includes/imgs/no-image.jpg';\n else\n pictureUrl = track.artwork_url;\n\n if(track.genre == null)\n genre = \"Undefined\";\n else\n genre = track.genre.trunc(15);\n\n var title = $('<span class=\"title\">'+track.title.trunc(40)+'</span>');\n var stats = $('<div class=\"stats\">'+track.playback_count+' <img src=\"includes/imgs/plays.png\"> '+track.comment_count+' <img src=\"includes/imgs/comments.png\"> '+track.favoritings_count+' <img src=\"includes/imgs/favourites.png\"> '+genre+' <img src=\"includes/imgs/gerne.png\"></div>');\n var player = $('<div></div>');\n var clear = $('<div class=\"clear\"></div>');\n var wrapper = $('<li class=\"trackClass\" data-trackID=\"'+track.id+'\"><img src=\"'+pictureUrl+'\" border=\"0\" alt=\"'+track.title+'\" align=\"left\" class=\"img\"/></li>');\n \n wrapper.append(title).append(player).append(stats).append(clear);\n if(playlistID) {\n var remove = $('<div class=\"removeTrack\" data-playlistID=\"'+playlistID+'\"></div>');\n wrapper.append(remove);\n }\n tracksDiv.append(wrapper);\n\n player.scPlayer({\n links: [{url: track.permalink_url, title: track.title}]\n });\n\n wrapper.draggable({\n stack: '#tracks li',\n revert: true,\n cursor: 'move',\n containment: '#content'\n });\n });\n\n if(error)\n tracksDiv.html('<p align=\"center\">No tracks found.</p>');\n\n } else {\n console.log(\"The get statement must be wrong.\");\n //triggerNotification(error);\n }\n\n });\n}", "function processMulti(response){\n response = response.results;\n results_list = [];\n var i = 0;\n while(results_list.length < 7 && i < response.length){\n if(response[i].media_type === 'movie' || response[i].media_type === 'tv'){\n\n if(response[i].backdrop_path !== undefined && response[i].backdrop_path !== null\n\t && response[i].poster_path !== undefined && response[i].poster_path !== null){\n m_item = {}\n m_item['id'] = response[i].id;\n m_item['backdrop_path'] = \"https://image.tmdb.org/t/p/w500\" + response[i].backdrop_path\n m_item['media_type'] = response[i].media_type;\n\n field_name = \"title\";\n if(response[i].media_type === \"tv\"){\n field_name = \"name\";\n }\n if(response[i][field_name] !== undefined && response[i][field_name] !== null){\n m_item['name'] = response[i][field_name];\n }\n results_list.push(m_item);\n }\n }\n i++;\n }\n\n\n query_results = {'data': results_list};\n return query_results;\n}", "function readAlbumsFromDb() {\n musicDb.allDocs({\n include_docs: true,\n startkey: 'album_',\n endkey: 'album_\\uffff'\n }).then(function (resultFromDb) {\n processInfoFromDb(resultFromDb)\n }).catch(function (err) {\n console.log(err)\n })\n }", "async fetchYourSoundtracks(ctx) {\n let docRef = await db.collection(auth.currentUser.uid).doc(ctx.getters.getSoundtracksId);\n let data = []\n await docRef.get().then(e => {\n data.push(e.data())\n });\n delete data[0].soundtracks;\n let resultArray = Object.keys(data[0]).map(function(key) {\n return [Number(key), data[0][key]];\n });\n resultArray.sort((a, b) => (a[1].soundtrackTitle > b[1].soundtrackTitle) ? 1 : -1)\n ctx.commit('setSoundtrackList', resultArray);\n localStorage.setItem('userSoundtracks', JSON.stringify(resultArray));\n }", "get mediaListView() {\n return this._mediaListView;\n }", "function media(){\n qtd_args = arguments.length;\n soma = 0;\n console.log('total args: '+qtd_args);\n for (i=0;i<qtd_args;i++){\n soma += arguments[i];\n console.log('soma: '+soma);\n }\n\n media = soma / qtd_args;\n console.log('Meida: '+media);\n}", "function setMedia(m) {\n\t m.name = '';\n\t m.loc = '';\n\t m.relLoc = '';\n\t m.type = '';\n\t m.duration = '';\n\t\tm.realFile = '';\n\t\tm.maxLinkingTime = 0;\n}", "getFiles() {\n return Resource.find({})\n }", "remoteDataQuery(value) {\n // Check if query should be applied now\n if (this.validExtension(value)) {\n return;\n }\n\n // Get file listing\n this.fileQueryFn(value, this.fileExt, this.fileOptions).subscribe(\n ({ data }) => {\n if (data.length) {\n this.setItems(data);\n }\n }\n );\n }", "static getAllArtists(){\n try{\n\n const data = connection.query(`select distinct artist from music`);\n\n return {status: 0, message: 'Ok', results: data};\n } catch (error){\n return{ status: 1, message: 'Error: ' + error, error}\n }\n }", "function addTrack(ID) {\n var query = \" SELECT concat('file://','/', u.rpath)\";\n query += \" FROM tracks t, urls u\";\n query += \" where t.id=\"+ID;\n query += \" and t.url=u.id\";\n var result = sql(query);\n Amarok.Playlist.addMedia(new QUrl(result[0]));\n}", "function spotifysong(song) {\n\n spotify.search({ type: 'track', query: song, limit: 20 }, function (err, data) {\n if (err) {\n return console.log('Error occurred: ' + error);\n }\n for (var i = 0; i < data.tracks.items.length; i++) {\n console.log(i);\n console.log(\"artist(s) : \" + data.tracks.items[i].album.artists[0].name);\n console.log(\"song name : \" + data.tracks.items[i].name);\n console.log(\"preview song : \" + data.tracks.items[i].preview_url)\n console.log(\"album : \" + data.tracks.items[i].album.name)\n console.log(\"----------------------------------------------\")\n }\n // console.log(data.tracks.items)\n\n });\n\n}", "async function __prepareFiles() {\n const files = albumDetails.pictures,\n preparedFiles = [];\n\n for (let url of preSignedUrls) {\n let obj = files.find((file) => file.name === url.fileName)\n preparedFiles.push({ rawFile: obj.file, uploadUrl: url.url })\n }\n\n return preparedFiles;\n }", "_loadSongs(selectContainer) {\n const PATH='https://fullstackccu.github.io/homeworks/hw4/songs.json';\n const onJsonReady=(json)=>{\n this.songList=json;\n this._createSongs(selectContainer);\n };\n\n fetch(PATH)\n .then(response => response.json())\n .then(onJsonReady);\n }", "media(key, path) {\n console.log('[Media]', 'cache', `${key} (${path})`);\n\n this.game.cache.addSound(key, '', {\n path,\n }, false, false);\n\n return this;\n }", "function getSong(track) {\n // If there is no track listed display the default of \"The Sign, by Ace of Base\"\n if (track === \"\" || track === undefined || track === null) {\n var defaultTrack = \"The Sign\";\n spotify.search({ type: \"track\", query: defaultTrack, limit: 10 }, function (err, response) {\n if (err) {\n return console.log('It seems you have an error:: ' + err);\n }\n //the default was displaying The Sign by Ty Dolla Sign so I just hard coded the default\n console.log('---------------------------------------------\\nArtist: \"' + \"Ace of Base\" +\n '\"\\nTrack: \"' + \"The Sign\" +\n '\"\\nAlbum: \"' + \"The Sign (US Album) [Remastered]\" +\n '\"\\nLink: \"' + \"https://p.scdn.co/mp3-preview/4c463359f67dd3546db7294d236dd0ae991882ff?cid=731f3e4c779047e89b0f836152cd61cc\" + '\"\\n');\n });\n }\n else {\n //run if a track is listed\n spotify.search({ type: \"track\", query: track, limit: 3 }, function (err, response) {\n if (err) {\n return console.log('It seems you have an error:: ' + err);\n }\n for (i = 0; i < response.tracks.items.length; i+=1) {\n // if there is no preview default a link\n if (response.tracks.items[i].preview_url === null) {\n console.log('---------------------------------------------\\nArtist: \"' + response.tracks.items[i].album.artists[0].name +\n '\"\\nTrack: \"' + response.tracks.items[i].name +\n '\"\\nAlbum: \"' + response.tracks.items[i].album.name +\n '\"\\nLink: \"' + response.tracks.items[i].album.external_urls.spotify + '');\n }\n else {\n console.log('---------------------------------------------\\nArtist: \"' + response.tracks.items[i].album.artists[0].name +\n '\"\\nTrack: \"' + response.tracks.items[i].name +\n '\"\\nAlbum: \"' + response.tracks.items[i].album.name +\n '\"\\nLink: \"' + response.tracks.items[i].preview_url + '\"');\n }\n }\n });\n }\n}", "async getSharedAlbums(){\n const token = await GoogleSignin.getTokens();\n await this.getDbUserData();\n data = {\n URI: 'https://photoslibrary.googleapis.com/v1/sharedAlbums?excludeNonAppCreatedData=true',\n method: 'GET',\n headers: {\n 'Authorization': 'Bearer '+ token.accessToken,\n 'Content-type': 'application/json'\n },\n }\n response = await this.APIHandler.sendRequest(data);\n return response\n }", "function spotifyThisSong() {\n let song = \"The Sign Ace of Base\";\n if (searchTerm) {\n song = searchTerm;\n }\n spotify.request('https://api.spotify.com/v1/search?q=track:' + song + '&type=track&limit=10', function (error, response) {\n for (i = 0; i < 3; i++) {\n if (error) {\n return console.log(error);\n }\n console.log(\"\\nArtist: \" + response.tracks.items[i].artists[0].name + \"\\nSong: \" + response.tracks.items[i].name + \"\\nPreview: \" + response.tracks.items[i].preview_url + \"\\nAlbum: \" + response.tracks.items[i].album.name);\n };\n });\n}", "function spotifySearch(){\n spotify.search({ type: 'track', query: songToSearch}, function(error, data){\n if(!error){\n for(var i = 0; i < data.tracks.items.length; i++){\n var song = data.tracks.items[i];\n console.log(\"Artist: \" + song.artists[0].name);\n console.log(\"Song: \" + song.name);\n console.log(\"Preview: \" + song.preview_url);\n console.log(\"Album: \" + song.album.name);\n console.log(\"-----------------------\");\n }\n } else{\n console.log('Error occurred.');\n }\n });\n }", "async getAlbums(){\n const token = await GoogleSignin.getTokens();\n await this.getDbUserData();\n data = {\n URI: 'https://photoslibrary.googleapis.com/v1/albums?excludeNonAppCreatedData=true',\n method: 'GET',\n headers: {\n 'Authorization': 'Bearer '+ token.accessToken,\n 'Content-type': 'application/json'\n },\n }\n response = await this.APIHandler.sendRequest(data);\n return response\n }", "read({ sponsor, user }, res) {\n const where = {sponsorId: sponsor.id}\n Promise.all([\n SponsorLike.findOne({where:{...where,\n userId: user.id,\n }}),\n SponsorLink.findAll({where}),\n SponsorMedia.findAll({where}),\n ])\n .then(([like, links, mediaObjs])=>{\n let s = resolveUploadSrc(sponsor.toJSON(), ['logo']);\n if (like) {\n s.like = true;\n }\n links = links.map( ({name, url}) => ({name, url}) );\n const media = mediaObjs.map( ({url}) => url);\n\n res.json({...s, links, media, mediaObjs});\n })\n }", "function getAudio(device_id) {\n $.ajax({\n url: \"https://api.spotify.com/v1/me/player/play?device_id=\" + device_id,\n type: \"PUT\",\n data: '{\"uris\": [\"spotify:track:' + track + '\"]}',\n beforeSend: function (xhr) {\n xhr.setRequestHeader('Authorization', 'Bearer ' + _token)\n },\n success: function (data) {\n /*console.log(data)*/\n }\n })\n }", "function callAPI(query) {\n\t$.get(\"https://api.soundcloud.com/tracks?client_id=b3179c0738764e846066975c2571aebb\",\n\t\t{'q': query,\n\t\t'limit': '20'},\n\t\tfunction(data) {\n\n\t\t\tresetTable('searchBody')\n\t\t\t$.each(data, function(i, v) {\n\t\t\t\tvar artwork = '_css/artwork.jpg'\n\t\t\t\tif (v.artwork_url != null){\n\t\t\t\t\tartwork = v.artwork_url;\n\t\t\t\t} \n\t\t\t\tvar title = v.title;\n\t\t\t\tvar artist = v.artist;\n\t\t\t\tvar artist = v.user.username;\n\t\t\t\tvar url = v.permalink_url;\n\t\t\t\taddSong(artwork, title, url, artist);\n\t\t\t\t// console.log(data);\n\t\t\t});\n\t\t},'json'\n\t);\n}", "componentDidMount() {\n client.photos.search({ query: 'cats', locale: 'en-US', per_page: 24 }).then(res => {\n this.setState({\n catPics: res.photos\n });\n })\n .catch(error => {\n console.log('Error fetching and parsing data', error);\n });\n\n client.photos.search({ query: 'dogs', locale: 'en-US', per_page: 24 }).then(res => {\n this.setState({\n dogPics: res.photos\n });\n })\n .catch(error => {\n console.log('Error fetching and parsing data', error);\n });\n\n client.photos.search({ query: 'computers', locale: 'en-US', per_page: 24 }).then(res => {\n this.setState({\n computerPics: res.photos\n });\n })\n .catch(error => {\n console.log('Error fetching and parsing data', error);\n });\n }", "function parseImage(items) {\n var curr_data = [];\n items.forEach(function (element, index, array) {\n console.log(element.media_key.S);\n getImage(element.media_key.S).then((img) => {\n curr_data.push(img);\n if (curr_data.length == items.length) {\n displayImages(curr_data);\n }\n })\n })\n }", "async cleanUpMusic() {\n const docs = await this.db.getDocuments('music');\n const hashes = {};\n \n for(let i = 0; i < docs.length; i++) {\n const doc = docs[i];\n \n if(\n !doc.fileHash || \n typeof doc.fileHash != 'string' ||\n (\n !this.isFileAdding(doc.fileHash) && \n !await this.hasFile(doc.fileHash) &&\n await this.db.getMusicByFileHash(doc.fileHash)\n )\n ) {\n await this.db.deleteDocument(doc);\n continue;\n }\n\n hashes[doc.fileHash] = true;\n }\n\n await this.iterateFiles(async filePath => {\n try {\n const hash = path.basename(filePath);\n\n if(!hashes[hash] && !this.isFileAdding(hash) && !await this.db.getMusicByFileHash(hash)) {\n await this.removeFileFromStorage(hash);\n }\n }\n catch(err) {\n this.logger.warn(err.stack);\n }\n });\n }", "static getFilmsFromStorage()\n {\n let films;\n if(localStorage.getItem('films') === null)\n {\n films = [];\n }else{\n films = JSON.parse(localStorage.getItem('films'));\n }\n return films;\n }", "function getMusic(songName) {\n\n // If no song name, defaults The Sign by Ace\n if (!songName) {\n var songName = \"The Sign Ace\";\n }\n\n spotify.search({ type: 'track', query: songName }, function (err, data) {\n if (err) {\n return console.log('Error occurred: ' + err);\n }\n\n var trackObj = data.tracks.items[0];\n\n // Artist(s)\n console.log(`Artist: ${trackObj.artists[0].name}`);\n\n // The song's name\n console.log(`Song Name: ${trackObj.name}`);\n\n // A preview link of the song from Spotify\n console.log(`Preview Link: ${trackObj.external_urls.spotify}`);\n\n // The album that the song is from\n console.log(`Album Name: ${trackObj.album.name}`);\n });\n}", "getInitialData() {\n GalleriesService.findById(this.props.match.params.id, (error, item) => {\n if (error) {\n console.log(error);\n } else if (item == null) {\n // Gallery not found.\n this.setState({ alertText: `La gallerie qui a pour id ${this.state.match.params.id} n'a pas été trouvée.` });\n } else {\n this.setState({ gallery: item,\n editGallery : {\n name: item.name,\n description: item.description\n }});\n\n // Get medias\n MediasService.find({ _id: { $in: item.medias } }, (error, items) => {\n if (error) {\n console.log(error);\n } else {\n this.setState({ images: [...items] });\n }\n });\n }\n });\n }", "function s3ListObjects(token, collection = []) {\n return listObjects({\n Bucket: bucket,\n Prefix: 'sound-sync/',\n ContinuationToken: token,\n }).then(({ IsTruncated, Contents, NextContinuationToken }) => {\n const contents = collection.concat(Contents);\n return IsTruncated\n ? s3ListObjects(NextContinuationToken, contents)\n : contents;\n });\n}", "function playThatFunkyMusic(songName) {\n spotify\n .search({ type: \"track\", query: songName, limit: 5 })\n .then(function(response) {\n response.tracks.items.forEach(function(song) {\n console.log(\n `\n Artist(s): ${song.album.artists[0].name}\n Song Name: ${song.name}\n Preview Link: ${song.preview_url}\n Album: ${song.album.name}\n `\n );\n });\n\n // console.log(\n // `\n // Artist(s): ${response.tracks.items[0].album.artists[0].name}\n // Song Name: ${response.tracks.items[0].name}\n // Preview Link: ${response.tracks.items[0].preview_url}\n // Album: ${response.tracks.items[0].album.name}\n // `\n // );\n })\n .catch(function(err) {\n console.log(err);\n });\n}" ]
[ "0.644103", "0.60938877", "0.60685694", "0.5915229", "0.5886536", "0.58821404", "0.5860882", "0.58383995", "0.58078915", "0.5766396", "0.57354265", "0.5735394", "0.5730848", "0.5702633", "0.5676882", "0.5661672", "0.565121", "0.5624092", "0.5617748", "0.55673903", "0.55485564", "0.5543492", "0.5510039", "0.54589474", "0.54459655", "0.54404575", "0.54318106", "0.54238063", "0.54079646", "0.53980654", "0.5394063", "0.5392118", "0.539198", "0.5381139", "0.53767186", "0.53573453", "0.5349493", "0.5339832", "0.5332852", "0.53283346", "0.5319658", "0.53094155", "0.5307648", "0.5296523", "0.5286214", "0.5278963", "0.5264334", "0.5242244", "0.52401435", "0.52377754", "0.5236433", "0.52275544", "0.52254087", "0.52101237", "0.51953113", "0.5194759", "0.519405", "0.51764894", "0.51737654", "0.517142", "0.51654077", "0.51520264", "0.51480186", "0.5131591", "0.51253575", "0.5112893", "0.51126075", "0.5108026", "0.51072127", "0.5096206", "0.5094088", "0.50915873", "0.509156", "0.509133", "0.5085427", "0.50769705", "0.507545", "0.50751007", "0.50702417", "0.5068622", "0.5066688", "0.5066341", "0.5065881", "0.5062226", "0.5062016", "0.50599426", "0.5057911", "0.5042189", "0.50411534", "0.5040732", "0.50391996", "0.50389546", "0.5030863", "0.5023062", "0.5018265", "0.5015098", "0.50123495", "0.500945", "0.5003204", "0.5000657", "0.5000095" ]
0.0
-1
redirect from createRoom page to joinRoom page or viceVersa
function redirect(param) { const value = param; if(value === 'createroom'){ location.href = "createRoom.html"; } else if (value === 'joinroom') { location.href = "index.html"; } else if (value === 'permissionGranted') { // location.href = "homepage"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function goToRoom(e) {\n\te.preventDefault();\n\n\tvar roomName = $.trim($('#roomName').val());\n\n\tif(!roomName){ return; } \n\n window.location.href = '/covert/room/' + roomName;\n}", "async function createChatroomAndRedirect(e) {\n setLoading(true);\n try {\n let roomId = profileData.chatRoomId;\n if (!roomId) {\n roomId = await createChatRoomInDB(profileData.id, profileData.displayName);\n }\n\n history.push('/chatRoom/' + roomId);\n } catch (error) {\n setLoading(false);\n }\n }", "function leaveRoom() {\n window.location = routeHome()\n }", "function clickRoom(room) {\n\tvar elem = document.getElementById(ROOM_ID_PREFIX + room);\n\t// var item = findRoomById(room);\n\t// var btn = document.getElementById(room + \"_button\");\n\n\tpage_1.style.display = \"none\";\n\tpage_2.style.display = \"block\";\n\t// room_header_2.innerHTML = item.name;\n\tregister(loggedInUser, room);\n\twindow.history.replaceState('test', '', \"?room=\" + room);\n\t// TODO\n\tmapInit();\n}", "function joinedRoom( room ) {\n}", "function addRoom() {\n\tvar roomName = $('#add-room-name').val();\n\tvar posting = $.post(roomsAddURI, {\n\t\tname : roomName\n\t});\n\tposting.done(function(data) {\n\t\t//Add room via rest api then join it\n\t\tvar room = JSON.parse(JSON.stringify(data));\n\t\tjoinRoom(room.roomId, true);\n\t});\n}", "function join() {\n var roomName = roomField.value\n , userName = userField.value\n\n roomStore.set(\"room-name\", roomName)\n roomStore.set(\"user-name\", userName)\n\n roomField.value = \"\"\n userField.value = \"\"\n\n room.emit(\"join\", roomName, userName)\n}", "function handleJoinRoom(room_name){\n clearErrors();\n socket.emit(\"join_room\", room_name);\n }", "function createRoom() {\n db.Room.create({\n room_id: req.body.room_id,\n property_id: req.body.property_id,\n price: req.body.price,\n roomType: req.body.roomType,\n aboutRoom: req.body.aboutRoom,\n status: req.body.status,\n closeDate: req.body.closeDate,\n HotelId: thisId\n })\n .then(function() {\n res.send(\"/choice/\" + lastSegment);\n })\n .catch(function(err) {\n console.log(err);\n res.json(err);\n });\n }", "function joinRoom(e, roomAlreadyCreated) {\n e.preventDefault();\n if (roomAlreadyCreated) {\n if (!document.getElementById(\"username_shareableRoom\").value.length < 1) {\n userName = document.getElementById(\"username_shareableRoom\").value;\n socket.open();\n var enteredRoomName = document.getElementById(\"roomToJoin\").value;\n userName = document.getElementById(\"username_shareableRoom\").value;\n socket.emit(\"joinRoom\", enteredRoomName, userName);\n currentRoom = enteredRoomName;\n MicroModal.close(\"shareableRoomCreatedModal\");\n // showStartGameButton();\n } else {\n document.getElementById(\"username_shareableRoom\").style.border =\n \"2px solid red\";\n setTimeout(function () {\n document.getElementById(\"username_shareableRoom\").style.border =\n \"2px solid black\";\n }, 3000);\n }\n } else {\n if (username()) {\n socket.open();\n var enteredRoomName = document.getElementById(\"enteredRoomName\").value;\n userName = document.getElementById(\"userName\").value;\n socket.emit(\"joinRoom\", enteredRoomName, userName);\n currentRoom = enteredRoomName;\n }\n }\n}", "function setRoom(name) {\n $('form').remove();\n $('h1').text(name);\n $('#subTitle').text('Link to join: ' + location.href);\n $('body').addClass('active');\n }", "instanciateRoom()\n { \n //this.createRoom();\n $(\"#GP-btn_2\").text(\"Eliminar sala\")\n $(\"#GP-btn_1\").css(\"display\", \"block\");\n pageIndex = 4;\n app.goToPage(\"Game-Roulete\");\n }", "function _joinRoom() {\n roomId = rooms[0].id;\n // Join the room\n socketInstance.post('/room/' + roomId + '/onlineUsers', { id: myChatId });\n }", "function navigateToTickets(roomId){\n window.location.href = \"tickets.html?roomId=\" + roomId; \n}", "function createNewRoom() {\r\n // Generate room id.\r\n const newID = uuidv4().substring(0, 8);\r\n\r\n // Join room\r\n socket.join(newID);\r\n\r\n // Update corressponding object in usersArray\r\n updateUserRoom(socket, newID);\r\n\r\n // Send room data to socket\r\n io.to(socket.id).emit(\"roomData\", {\r\n roomId: newID,\r\n });\r\n }", "function goChatRoomList(id){\n $(location).attr(\"href\",\"/chat/chatRoomList/\"+id);\n }", "function leaveRoom() {\n socketRef.current.emit(\"user clicked leave meeting\", socketRef.current.id);\n props.history.push(\"/\");\n }", "function joinRoom(id)\n{\n console.log('Request joinRoom: ' + id);\n if (inRoom == false)\n {\n _warpclient.joinRoom(id);\n } else {\n console.warn('Already in another room: ' + roomId);\n }\n}", "function joinRoom(room)\r\n{\r\n //TODO erase... Name must be known previously\r\n var name = '';\r\n while(name == '')\r\n {\r\n name = prompt(\"Wie heißt du?\");\r\n }\r\n\r\n socket.emit('requestRoom', room, name);\r\n document.getElementById(\"chooseRoom\").classList.add('hidden');\r\n \r\n //TODO: maybe show loading icon...\r\n}", "function loadEventRoom(id)\n{\n localStorage.setItem(\"roomId\",id);\n if(check_login())\n window.location.replace('event_room.html');\n else\n window.location.replace('unauth_event_room.html');\n}", "function go() {\r\n\tvar name = document.getElementById(\"roomName\").value;\r\n\tif(name !== \"\") {\r\n\t\twindow.location.replace(\"/?\" + name);\r\n\t}\r\n}", "function joinUserRoom(name) {\r\n divHome.hide();\r\n divRoom.show();\r\n socket.emit(\"joinRoom\", name);\r\n currentRoom = name;\r\n}", "function createRoomButton(){\n clearErrors();\n if(newRoomName.length > 1){\n createNewRoom(newRoomName)\n .then(res => {\n handleJoinRoom(res.data.room)\n refreshButton();\n })\n setNewRoomName(\"\");\n } else{\n props.dispatch({type: ACTIONS.ERROR, payload: {errors: [\"Room name must be greater than 1 character\"]}})\n }\n }", "function createUserRoom(data) {\r\n inputRoomName.value('');\r\n divHome.hide();\r\n divRoom.show();\r\n currentRoom = data;\r\n}", "function leaveRoom() {\n const leaveRoom = confirm('Are you sure you want to leave the chatroom?');\n if (leaveRoom) {\n window.location = '../index.html';\n }\n}", "function handleRoomSetup() {\n app.log(2, 'handleRoomSetup entered');\n var room_to_create = $.getUrlVar('roomname') || '',\n item;\n\n room_to_create = room_to_create.replace(/ /g, '');\n app.log(2, 'room_to_create ' + room_to_create);\n\n Callcast.CreateUnlistedAndJoin(room_to_create, function(new_name) {\n var jqDlg, newUrl;\n // We successfully created the room.\n // Joining is in process now.\n // trigger of joined_room will happen upon join complete.\n\n app.user.scheduleName = 'Place to meet up';\n app.user.scheduleJid = new_name + Callcast.AT_CALLCAST_ROOMS;\n app.user.scheduleTitle = 'Open room';\n\n // set local spot nick todo find a better place for this\n item = app.carousel.getItem(0);\n app.carousel.setSpotName(item, app.user.name);\n\n app.log(2, \"Room named '\" + new_name + \"' has been created. Joining now.\");\n app.log(2, 'window.location ' + window.location);\n if (room_to_create !== new_name)\n {\n newUrl = window.location.pathname + '?roomname=' + new_name;\n app.log(2, 'replacing state ' + newUrl);\n history.replaceState(null, null, newUrl);\n }\n\n // warn user if room name changed (overflow)\n if (room_to_create.length > 0 && room_to_create.toLowerCase() !== new_name.toLowerCase())\n {\n // display warning\n jqDlg = $(app.STATUS_PROMPT_LEFT).css({\"display\": \"block\",\n \"background-image\": 'url(images/warning.png)'});\n $('#message', jqDlg).text('Room ' + room_to_create + ' overflowed. You are now in room ' + new_name);\n $('#stop-showing', jqDlg).css('display', 'none');\n $('#stop-showing-text', jqDlg).css('display', 'none');\n }\n\n // initialize video, audio state here since this method\n // is called after the local plugin is loaded\n // use fb profile pick as bg image if it exists\n if (!Callcast.IsVideoDeviceAvailable())\n {\n if (app.user.fbProfilePicUrl)\n {\n $('#meeting > #streams > #scarousel #mystream')\n .css('background-image', 'url(' + app.user.fbProfilePicUrl + ')');\n }\n }\n else // video available\n {\n if (typeof (Storage) !== 'undefined' && sessionStorage.bUseVideo === 'false') {\n changeVideo(false);\n }\n else {\n changeVideo(true); // do this unconditionally so ui gets updated\n }\n }\n if (Callcast.IsMicrophoneDeviceAvailable())\n {\n if (typeof (Storage) !== 'undefined' && sessionStorage.bUseMicrophone === 'false') {\n changeAudio(false);\n }\n else {\n changeAudio(true); // do this unconditionally so ui gets updated\n }\n }\n },\n function(iq)\n {\n var errorMsg;\n if ($(iq).find('roomfull'))\n {\n errorMsg = \"Sorry, the room \" + room_to_create + \" is full. Please try again later.\";\n }\n else\n {\n errorMsg = 'There was a problem entering the room ' + room_to_create;\n }\n\n // display error\n app.log(4, \"handleRoomSetup Error \" + iq.toString());\n $('#errorMsgPlugin > h1').text('Oops!!!');\n $('#errorMsgPlugin > p#prompt').text(errorMsg);\n closeWindow();\n openWindow('#errorMsgPlugin');\n });\n}", "createPoll(req, res){ \n let roomID = req.params.roomId;\n\n //idea: to have only one link use session and store in object {session id: room id} if curr session and room found in object render\n res.render('./teacher/create_poll', {roomID: roomID});\n }", "joinRoom({state}, { roomId }) {\n return state.currentUser.joinRoom({ roomId });\n }", "function joinPersonalRoom() {\n const roomName = createPrivateRoomName(drone.clientId);\n const myRoom = drone.subscribe(roomName);\n myRoom.on('open', error => {\n if (error) {\n return console.error(error);\n }\n console.log(`Successfully joined room ${roomName}`);\n });\n\n myRoom.on('message', message => {\n const {data, clientId} = message;\n const member = members.find(m => m.id === clientId);\n if (member) {\n addMessageToRoomArray(createPrivateRoomName(member.id), member, data);\n if (selectedRoom === createPrivateRoomName(clientId)) {\n DOM.addMessageToList(data, member);\n }\n } else {\n /* Message is sent from golang using the REST API.\n * You can handle it like a regular message but it won't have a connection\n * session attached to it (this means no member argument)\n */\n }\n });\n}", "joinRoom(room) {\n if (room === undefined) return;\n\n console.log('Attempting to joinRoom. room: ', room);\n\n if (!this.isRoomEnterable())\n {\n console.log('Not already in a locked room. Cannot join. Giving up...');\n return;\n }\n\n // TODO: call some join room action\n\n $.ajax(\n {\n type: 'get',\n url: 'skylink_api_key'\n })\n .done((apiKey) => {\n\n console.log('AJAX retrieved successfully.');\n\n this.skylink.init(\n {\n apiKey: apiKey,\n defaultRoom: room\n },\n (error) => {\n\n if (error)\n {\n alert('An error has occurred while connecting to SkylinkJS.');\n return;\n }\n\n this.skylink.joinRoom({\n audio: true,\n video: true\n })\n });\n })\n .fail((err) => {\n alert('An error has occurred while retrieving the Skylink API key from the server.');\n });\n }", "function func_join_room() {\n var room_number = document.getElementById('input_text').value;\n var list_length = list_of_joined.length++;\n list_of_joined[list_length] = room_number;\n $(\"#div_body_joinedRoom\").append(create_room(room_number, 1));\n func_populate(room_number);\n func_close_join_room_pop();\n func_add_room_to_database(room_number);\n}", "function setRoom(name) {\r\n $('#createRoom').remove();\r\n $('h1').text(name);\r\n // $('#subTitle').text(name + \" || link: \"+ location.href);\r\n $('body').addClass('active');\r\n}", "function continueClick(){\n window.location = nextRoom;\n}", "function joinroom(data) {\n\tvar tmproom = data;\n\tif (player != \"\" && passcode != \"\" && tmproom >= 0) {\n\n\t\tvar geturl = \"/sanaruudukko/rest/sr/process?func=joinroom&player=\" + player + \"&passcode=\" + passcode + \"&room=\" + tmproom;\n\t\t$.ajax({\n\t\t\tcache: false,\n\t\t\tdataType : 'xml',\n\t\t\ttype : 'GET',\n\t\t\turl : geturl,\n\t\t\tsuccess : function(data) {\n\t\t\t\tstartRoom(data);\n\t\t\t},\n\t\t});\n\t}\n}", "function joinRoom(obj) {\r\n modal.style.display = \"block\";\r\n room = obj.id;\r\n}", "function joinRoom() {\n const roomId = this.id.substr(5, this.id.length-5)\n player.updatePlayer1(false);\n //player.setPlayerType(false);\n socket.emit('joinGame', { name: player.name, room: this.id });\n\n //player = new Player(player.name, P2);\n }", "render() {\r\n return (\r\n <Router>\r\n <Switch>\r\n <Route\r\n exact\r\n path=\"/\"\r\n render={() => {\r\n return this.state.roomCode ? (\r\n <Redirect to={`/room/${this.state.roomCode}`} />\r\n ) : (\r\n this.renderFirstPage()\r\n );\r\n }}\r\n />\r\n <Route path=\"/start\" component={HomePage} />\r\n <Route path=\"/create\" component={CreateRoomPage} />\r\n <Route path='/main' component={Main}></Route>\r\n <Route path=\"/watch\" component={YoutubePlayer}></Route>\r\n <Route\r\n path=\"/room/:roomCode\"\r\n render={(props) => {\r\n return <Room {...props} leaveRoomCallback={this.clearRoomCode} />;\r\n }}\r\n />\r\n </Switch>\r\n </Router>\r\n );\r\n }", "function createRoom(e) {\n e.preventDefault();\n if (username()) {\n // $.ajax({\n // url: '/createRoom',\n // type: 'POST',\n // beforeSend: function (xhr) {\n // if (localStorage.getItem(appName)) {\n // xhr.setRequestHeader('Authorization', localStorage.getItem(appName));\n // }\n // },\n // data: {\n // username: userName\n // },\n // success: function (token) {\n // console.log(token);\n // localStorage.setItem(appName, token.token);\n // },\n // error: function () {},\n // });\n\n // TODO: Use this params to send token to server on new connection\n // check if socket is valid and within time limit\n socket.io.opts.query = {\n token: alreadyPlayed(),\n };\n socket.open();\n // FIXME: Delet Test emit\n socket.emit(\"newMessage\", \"lol\", function (err, message) {\n if (err) {\n return console.error(err);\n }\n console.log(message);\n });\n socket.on(\"newMessage\", function (data) {\n console.log(data);\n });\n\n // Asking to create a new room\n socket.emit(\"createRoom\", { username: userName });\n // socket replies back with created room name (which should be sent to other user who wants to play together)\n socket.on(\"roomNameIs\", function (roomName) {\n // console.log(roomName);\n document.getElementById(\"createdRoomName\").innerHTML =\n \"Room name : \" + roomName;\n $(\"#createdRoomName\").show();\n currentRoom = roomName;\n $(\".joinRoom\").hide();\n $(\".createRoom\").hide();\n $(\".generatRoomLink\").hide();\n $(\".singleplayerMode\").hide();\n showStartGameButton();\n currentlyPlaying = true;\n });\n console.log(socket);\n }\n}", "function newroom() {\n\t$(\"#warning2\").html(\"\");\n\tvar tmproomname = document.roomform.roomname.value;\n\tif (tmproomname.search(/[^a-zA-Z0-9]/) != -1 || tmproomname.length > 16) {\n\t\t$(\"#warning2\").html(\"Viallinen huoneen nimi.\");\n\t\treturn;\n\t}\n\tvar roomname = tmproomname;\n\tif (player != \"\" && passcode != \"\" && roomname != \"\") {\n\n\t\tvar geturl = \"/sanaruudukko/rest/sr/process?func=newroom&player=\" + player + \"&passcode=\" + passcode + \"&roomname=\" + roomname;\n\t\t$.ajax({\n\t\t\tcache: false,\n\t\t\tdataType : 'xml',\n\t\t\ttype : 'GET',\n\t\t\turl : geturl,\n\t\t\tsuccess : function(data) {\n\t\t\t\tstartRoom(data);\n\t\t\t},\n\t\t});\n\t}\n}", "function newRoom($id)\n{\n\tif(groupRooms == 0)\n\t{\n\t\tshowInfoBox(\"system\",\"220\",\"300\",\"200\",\"\",lang6);\n\t\treturn false;\t\t\t\n\t}\n\n\tif($id == '1')\n\t{\n\t\t// show create room\n\t\tdocument.getElementById(\"roomCreate\").style.visibility = 'visible';\n\t}\n\telse\n\t{\n\t\t// hide create room\n\t\tdocument.getElementById(\"roomCreate\").style.visibility = 'hidden';\n\t}\n return false;\n}", "function dial (room){\n if (room !== '') {\n socket.emit('create or join', room);\n console.log('Attempted to create or join room', room);\n }\n}", "joinRoom(data) {\n socket.emit('join-room', data);\n }", "function joinRoom(socket, room) {\n // If the close timer is set, cancel it\n // if (closeTimer[room]) {\n // clearTimeout(closeTimer[room]);\n // }\n\n // Create Paperjs instance for this room if it doesn't exist\n var project = projects.projects[room];\n if (!project) {\n console.log(\"made room\");\n projects.projects[room] = {};\n // Use the view from the default project. This project is the default\n // one created when paper is instantiated. Nothing is ever written to\n // this project as each room has its own project. We share the View\n // object but that just helps it \"draw\" stuff to the invisible server\n // canvas.\n projects.projects[room].project = new paper.Project();\n projects.projects[room].external_paths = {};\n db.join(socket, room);\n } else { // Project exists in memory, no need to load from database\n loadFromMemory(room, socket);\n }\n}", "function joinRoom(roomName) {\n disableElements('joinRoom');\n\n // Check if roomName was given or if it's joining via roomName input field\n if(typeof roomName == 'undefined'){\n roomName = document.getElementById('roomName').value;\n }\n document.getElementById('roomName').value = roomName;\n\n var data = {\n id: \"joinRoom\",\n roomName: roomName\n };\n sendMessage(data);\n}", "function joinAndConnectRoom (roomId) {\n $.post(\"/chatroom/joinedRooms\", {username:username}, function(data) {\n let joinedRoomsGroup = $(\"#joinedRooms\");\n joinedRoomsGroup.empty();\n if (data == null) return;\n for(let i = 0; i < data.length ;i++) {\n let room = data[i];\n let type = room.type;\n let roomTemp = templateJoinedRoom;\n roomTemp = roomTemp.replace('ROOM-NAME', room.name);\n roomTemp = roomTemp.replace('ROOM-ID',room.id);\n roomTemp = roomTemp.replace('all-room-ROOM-ID','joined-room' + room.id);\n if(type === \"Public\") {\n if(room.name === \"General\") {\n roomTemp = roomTemp.replace('ROOM-STYLE',\"list-group-item-success\");\n } else {\n roomTemp = roomTemp.replace('ROOM-STYLE',\"list-group-item-primary\");\n }\n } else if (type === \"Private\") {\n roomTemp = roomTemp.replace('ROOM-STYLE',\"list-group-item-secondary\");\n } else {\n return null;\n }\n roomTemp = roomTemp.replace('ROOM-GROUP-NAME',\"joined-room\");\n joinedRoomsGroup.append(roomTemp);\n }\n $('#joined-room' + roomId).prop(\"checked\", true);\n connectToRoom();\n },\"json\");\n}", "function requestCreateRoom() {\r\n if (inputRoomName.value()) {\r\n socket.emit(\"createRoomRequest\", inputRoomName.value(), (response) => {\r\n if(!response){\r\n errorNameUsed(inputRoomName.value());\r\n } else{\r\n createUserRoom(inputRoomName.value());\r\n }\r\n });\r\n currentRoom = inputRoomName.value();\r\n }\r\n}", "function generateNewRoom(name) {\n\t\n\t//send the request to the server\n\tvar posting = $.post(roomsURI + \"/add\", {\n\t\tname : name\n\t});\n\t\n\t//Send new room to server\n\tposting.done(function(data) {\n\t\tvar room = JSON.parse(JSON.stringify(data));\n\t\t//$(\"#chat-rooms-list\").children(\"li[room_id!=2]\").remove(); //remove the last room\n\t\t//$(\"#chat-rooms-list\").append(createRoomElement(room)); //add this in it's place\n\t\t$(\"#chat-rooms-dropdown-list\").append(createRoomElement(room));\n\t\troom_id_list.push(room.roomID);\n\t\tjoinRoom(room.roomID,true);\n\t});\n}", "joinRoom(roomId) {\n this.socket.emit('create or join', roomId)\n console.log(`joinRoom ${roomId}`)\n this.roomId = roomId\n }", "function getRoom(request, response) {\n let roomName = request.params.roomName;\n // Chatroom.find({chatroom_name: roomName}, function (err, docs) {\n // if (err) {\n // console.log(err);\n // } else {\n // let roomId;\n // // If a chatroom with that name exists get it, else create one\n // if (docs.length > 0) {\n // roomId = docs[0].chatroom_id;\n // } else {\n // roomId = roomGenerator.roomIdGenerator()\n // const newChatroom = new Chatroom ({\n // chatroom_id: roomId,\n // chatroom_name: roomName\n // });\n\n // newChatroom\n // .save()\n // .then(item => console.log(item))\n // .catch(err => console.log(err));\n // }\n\n // TODO: Get the messages and submit to room.hbs\n Messages.find({ chatroom_name: roomName })\n .lean()\n .then((items) => {\n response.render(\"room\", {\n title: \"chatroom\",\n roomName,\n messages: items,\n isAvailable: true,\n // newRoomId: roomId\n });\n });\n}", "function goToRoster()\n{\n saveTeam();\n window.location.href = \"roster.html\";\n}", "connectToRoom() {\n const activeRoom = get(this, 'roomId');\n if (activeRoom) {\n const sessionManager = get(this, 'webrtc');\n sessionManager.joinRoom(activeRoom);\n }\n }", "function roomover(){\n createtoast('u have been kicked out by ADMIN');\n showfeedbackscreen();\n //window.location.href = window.location.origin;\n}", "function newRoom() {\n socket.emit(\"newRoom\");\n}", "function createNewRoom() {\n console.log(nextRoomId);\n createRoomDOM(nextRoomId);\n signalRoomCreated(nextRoomId);\n\n nextRoomId++;\n}", "enterRoom(room) {\n console.warn(\"Cannot enter room different room from InBrowserBot\")\n }", "join(room){\n \tthis.room[room] = true;\n\t}", "goToAjout() {\n history.push(\"/main/clients/ajout\");\n }", "joinRoom(room, hostExist, listensers) {\n trace(`Entering room '${room}'...`);\n this.socket.emit('join', room, hostExist, listensers);\n }", "function joinRoom() {\n var u = document.getElementById(\"username\").value;\n if(u === \"\") {\n setJoinError(\"Please choose a username\");\n return;\n }\n var r = document.getElementById(\"room\").value;\n if(r === \"\") {\n setJoinError(\"Please enter a room\");\n return;\n }\n var c = document.getElementById(\"color\").value;\n if(c === \"\") {\n setJoinError(\"Please choose a color\");\n return;\n }\n r = r.replace(/\\s+/g, ''); // Remove whitespace from room name\n r = r.toLowerCase();\n var join_message = {username: u, room: r, color: c};\n Game = new MultiplayerGame(u, r);\n socket.emit('join', join_message)\n}", "function joinRoom() {\r\n let roomID = $(\"#joinRoomID\").val();\r\n socket.emit(\"joinByRoomID\", roomID);\r\n}", "function joinRoom(event){\n \tvar x = $(event.target).text();\n if(x == roomIn){\n\n } else {\n socketio.emit(\"join_room\", {roomName:x, password:\"\"});\n }\n }", "function createOrAddToRoom(){\n\n if(!socketClients[clientId]){\n\n //if user does not exist\n return getUserData( msg.cookie ).then(function(userObject,error){//what if cookie is invalid\n if (error) return sendError('invalid cookie')\n socketClients[clientId] = {user:{id:userObject.id, username:userObject.username}, socket:ws}\n\n createOrAddToRoom()\n })\n\n \n }\n\n //also broadcast on join and leave and also joined member\n // console.log(clientId,'creating room or adding:'+roomLabel)\n function createRoom(){\n roomToken = random()\n roomsRegistry[roomLabel].notFull[roomToken] = {clients:[],limit:roomLimit}\n roomsRegistry[roomLabel].notFull[roomToken].clients.push(clientId)\n }\n\n if (!roomsRegistry[roomLabel]){ //room not constructed \n roomsRegistry[roomLabel] = { full:{},notFull:{} }\n createRoom()\n }else{\n\n if ( Object.keys(roomsRegistry[roomLabel].notFull).length === 0 ) {\n createRoom()\n }else{\n\n roomToken = Object.keys(roomsRegistry[roomLabel].notFull)[0]\n roomsRegistry[roomLabel].notFull[roomToken].clients.push(clientId)\n broadcast(roomToken,socketClients[clientId].user,'onjoin',roomLabel)\n\n let notFullRoomLimit = roomsRegistry[roomLabel].notFull[roomToken].limit\n let membersCountOfNotFull = roomsRegistry[roomLabel].notFull[roomToken].clients.length\n\n \n\n // if(membersCountOfNotFull > notFullRoomLimit) console.log('limit exceeded', membersCountOfNotFull, notFullRoomLimit)\n\n if(membersCountOfNotFull === notFullRoomLimit){\n roomsRegistry[roomLabel].full[roomToken] = roomsRegistry[roomLabel].notFull[roomToken]\n roomsRegistry[roomLabel].notFull = removeKey(roomsRegistry[roomLabel].notFull,roomToken)\n }\n\n }\n\n }\n\n broadcast(roomToken,null,'onopen',roomLabel)\n\n }", "function join ( room, username ) {\n \n var id = getRoomId ( room );\n \n mapUserRooms ( id, username );\n \n return id;\n}", "function createBoard() {\n\tsocket.close();\n\tdocument.location.href = 'crear-partida.xhtml?session=' + session + '&player=' + player;\n}", "function leaveRoom() {\n let chatLink = server + '/chat/' + roomId;\n Swal.fire({ background: background, position: \"top\", title: \"Leave this room?\",\n html: `<p>If you want to continue to chat,</br> go to the main page and</br> click on chat of this room</p>`,\n showDenyButton: true, confirmButtonText: `Yes`, confirmButtonColor: 'black', denyButtonText: `No`, denyButtonColor: 'grey',\n }).then((result) => { if (result.isConfirmed) window.location.href = \"/main\"; });\n}", "function bookRoom(roomTypeId, checkIn, checkOut) {\n // if the user isn't signed in, prompt them to do so (or create an account)\n if(localStorage.getItem('userLogin') == null) {\n document.getElementById(\"sectLogin\").style['display'] = \"block\";\n showSignIn();\n } else {\n // the user is already signed in, so go to the checkout page\n window.location.assign(\"bookReservation.html?roomTypeId=\" + roomTypeId + \"&checkIn=\" + checkIn + \"&checkOut=\" + checkOut);\n }\n}", "function switchRoom(room){\n\t\tsocket.emit('switchRoom', room);\n\t}", "function findRoom(req, res, next) {\n if (req.query.Name == null) res.redirect(\"/rooms\");\n else {\n room\n .findOne({ Name: req.query.Name })\n .populate({\n path: \"Detail\",\n populate: {\n path: \"Reserve\",\n match: {\n $or: [\n { DateIn: { $gt: req.query.from, $lt: req.query.to } },\n { DateOut: { $gt: req.query.from, $lt: req.query.to } }\n ]\n }\n }\n })\n .exec(function(err, Room) {\n if (err) console.error(err);\n var counter = 0;\n for (var i = 0; i < Room.Detail.length; i++) {\n if (Room.Detail[i].Reserve.length == 0) {\n counter++;\n req.session.ReserveInfo = Room.Detail[i];\n req.session.RoomInfo = Room;\n break;\n }\n }\n if (counter == 0) {\n console.log(\"No room left\");\n res.redirect(\"/rooms/\" + req.query.Name, {\n info: { message: \"No Room Left\" }\n });\n } else {\n return next();\n }\n });\n }\n}", "function joinOrCreateRoom(roomCode) {\n socket.join(roomCode, () => {\n // Sets the socket's room code\n socket.roomCode = roomCode\n // Sends room code to client\n socket.emit('room_joined', roomCode)\n // Updates GM's player list\n updateGMRoomMembers()\n })\n }", "getRoomURL() {\n return location.protocol + \"//\" + location.host + (location.path || \"\") + \"?room=\" + this.getRoom();\n }", "function enter(role) {\r\n\r\n\tdisableNameInput();\r\n\tvar message = {\r\n\t\tid: 'joinRoom',\r\n\t\tname: name,\r\n\t\troomName: roomId,\r\n\t\trole: role,\r\n\t\t// Flags for use cases, where user did not give the permissions to his media devices.\r\n\t\t// Constraints to the connection to KMS should be in the same way e.g. audio:true; video:false.\r\n\t\taudioOn: acceptAudio,\r\n\t\tvideoOn: acceptVideo,\r\n\t\tvideoBeforeEnterTheRoom: videoBeforeEnterTheRoom\r\n\t}\r\n\tsendMessage(message);\r\n\ttoggleEnterLeaveButtons();\r\n\r\n}", "function name_validate(roomParam) {\n roomParam.child(\"people/\" + $(\"#input_name\").val()).once('value', snapshot => {\n if (!snapshot.exists()) {\n let name = $(\"#input_name\").val();\n roomParam.child(\"people/\" + name).set(true); //adds username to the database, within the room they are joining\n myStorage.setItem(\"name\", name);\n myStorage.setItem(\"roomCode\", $(\"#input_number\").val());\n window.location.href = \"activity.html\";\n // a comment\n } else {\n $(\".join_room_popup_content\").css(\"height\",\"14em\");\n $(\"#pop_message\").html(\"Sorry, that name is taken.\");\n }\n });\n }", "function renderRoom(req, res) {\n res.render('pages/room', {connectedUsers: connectedUsers});\n}", "function changeRoom() {\n if (currentRoom !== undefined) {\n var desired_room = rotateRoom(currentRoom, this.id);\n\n initialState();\n setMqttRoom(desired_room);\n get_backend(room_list[desired_room]);\n\n }\n}", "function buttonClicked(event) {\n var button = event.target;\n var room = button.parentElement.parentElement.parentElement;\n console.log(room);\n localStorage.setItem(\"bookingRoom\", room.id);\n window.location.assign(\"bookingPage.html\")\n}", "function setJoinCallBtn() {\n joinCallBtn.addEventListener(\"click\", async (e) => {\n window.location.href='/join/' + roomId;\n });\n}", "function connectToRoom() {\n let roomId = $(\"#joinedRooms\").find('input[name=\"joined-room\"]:checked').val();\n if(!checkElement(roomId)) return;\n\n startChatArea();\n\n $.post(\"/chatroom/connect\", {username: username, chatroomId: roomId}, function (data) {\n chatroomId = roomId;\n chatroomType = data.type;\n chatroomName = data.name;\n adminList = data.admins;\n $(\"#chatRoomName\").html(data.name + \" (\" + data.type + \")\");\n $(\"#chatRoomDescription\").html(data.description);\n\n loadUser();\n\n displayMessages(roomId);\n getChatRoomUsers();\n\n //Clear unread notification\n let unread = $(\"#joined-room\" + chatroomId + \" + span .badge-danger\");\n unread.addClass(\"d-none\");\n unread.html(0);\n\n $('#collapseTwo').removeClass('show');\n $('#collapseOne').addClass('show');\n $(\"#joinedRooms\").find('input[name=\"joined-room\"]:checked').prop(\"checked\", false);\n }, \"json\");\n}", "redirectToMeetings(ev) {\n ev.preventDefault();//prevent form submittion(delete team)\n loadMeetings(this.props.params.teamId,this.loadMeetings);\n }", "function joinRoom() {\n\tif (state == null) {\n\t\t// var campname = document.querySelector('#incoming').value;\n\t\tvar campname = 'dgnby';\n\t\t// TODO: check name is valid, alert() if not\n\t\tdatabase.ref('hosts/' + campname + '/').update({\n\t\t\t// add client signal data to database\n\t\t\tjoinData: signalClient,\n\t\t});\n\n\t\tvar hostData = firebase.database().ref('hosts/' + name + '/hostData');\n\t\t// wait for host to respond to client signal data\n\t\thostData.on('value', function(snapshot) {\n\t\t\tif(state == \"client\"){\n\t\t\t\tsetTimeout(function(){ readAnswer(campname); }, 200);\n\t\t\t}\n\t\t});\n\t\tstate = \"client\";\n\t}\n\tdocument.getElementById('hostbox').style.animation='0.2s fadeOut forwards';\n}", "function loadLobby(){\n window.location.href = \"/lobby\";\n}", "function connectToRoomNew(roomData) {\n var data = roomData;\n roomNo = roomData.roomID\n\n //Checking the database\n getRoomData(roomNo).then(result => {\n //If it is a new room\n if(!result){\n //Store the data in indexedDB\n storeRoomData(data);\n //Open socket and display chat\n socket.emit('create or join', roomNo, data.accessedBy, data.imageSrc);\n displayLoadedMessages([]);\n hideLoginInterface(roomNo, data.accessedBy);\n initCanvas(socket, data.imageSrc, \"\");\n //Initialise annotation modal\n annotationCanvasInit();\n }\n\n //If room already exists\n else{\n //Open socket\n socket.emit('create or join', result.roomID, result.accessedBy, result.imageSrc);\n //Load data from indexedDB\n displayLoadedMessages(result.messages);\n //Display chat\n hideLoginInterface(result.roomID, result.accessedBy);\n initCanvas(socket, result.imageSrc, result.canvas);\n //Initialise annotation modal\n annotationCanvasInit();\n }\n });\n\n //Refresh annotations\n refreshAnnotations(roomNo);\n}", "onLeave(client, consented) {\n\t\tthis.state.history.push(`${client.sessionId} left AreaRoom.`);\n\t}", "function reloadRoom(){\n\twindow.location.assign('https://www.c4cstream.com/?room='+tag_no); \n}", "startCommunication(room) {\n this.debug && console.log('Attempted to create or join room: ', room);\n const joinApi = this.joinUrl + `/api/v1/im/join`;\n fetch(joinApi, {\n method: 'POST',\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8'\n },\n body: JSON.stringify({\n roomId: room,\n userId: this.userId\n })\n })\n .then(async data => {\n const { code } = await data.json(); // maybe:ok: false status: 504\n if (code === 200) {\n this.debug && console.log('call join room api successfully!', room);\n this._handleCreateAndJoin(room);\n this.socket.send(this.encodeMsg('create-join'));\n }\n })\n .catch(error => {\n console.error('[lsp join room api occurred]', error);\n });\n }", "function handleCreateRoomEnter(e){\n if(e.key === \"Enter\"){\n createRoomButton();\n }\n }", "function joinRoom() {\n remoteStream = new MediaStream();\n document.querySelector('#localVideo').srcObject = localStream;\n document.querySelector('#remoteVideo').srcObject = remoteStream;\n document.querySelector('#confirmJoinBtn').addEventListener('click', async() => {\n roomId = document.querySelector('#room-id').value;\n console.log('Join room: ', roomId);\n document.querySelector(\n '#currentRoom').innerText = `Room ID: ${roomId} `;\n await joinRoomById(roomId);\n }, { once: true });\n roomDialog.open();\n}", "function leaveRoom() {\n\tif (player != \"\") {\n\t\troundEnded();\n\t\tvar geturl = \"/sanaruudukko/rest/sr/process?func=leaveroom&player=\" + player + \"&passcode=\" + passcode;\n\t\t$.ajax({\n\t\t\tcache: false,\n\t\t\tdataType : 'xml',\n\t\t\ttype : 'GET',\n\t\t\turl : geturl,\n\t\t\tsuccess : function(data) {\n\t\t\t\tinitRoomList();\n\t\t\t},\n\t\t});\n\t}\n}", "function showRoomListPage() {\n\tleaveRoom();\n\tpage_1.style.display = \"block\";\n\tpage_2.style.display = \"none\";\n\twindow.history.replaceState('test', '', '?main=true');\t\n}", "createRoom() {\n const room = this.currentUser.createRoom({\n id: this.props.items.name,\n name: this.props.items.name,\n private: false,\n }) .catch(err => {\n console.log(\"nope\");\n }); \n }", "async adminJoinRoom(room) {\n //Fetch the currently logged in user\n let user = firebase.auth().currentUser\n\n //Retrieve an instance of our Firestore Database\n const db = firebase.firestore()\n\n //Save the room in the database that the admin just joined\n let adminUsersRef = await db.collection('admin-users').doc(user.uid)\n let adminUsersSnapShot = await adminUsersRef.get()\n\n if (adminUsersSnapShot.exists) {\n adminUsersRef.update({\n \"admin_room_location\": room\n })\n .then(() => {\n this.props.history.push('/chat')\n })\n this.context.triggerAdminJoinRoom(room)\n } \n }", "function partingFromRoom( room ) {\n}", "function generatRoomLink() {\n MicroModal.show(\"generateShareableRoomLinkModal\");\n\n // if (true) {\n if (!shareableRoomLinkAlreadyGenerated()) {\n $.ajax({\n url: \"/api/game/generateroom\",\n type: \"GET\",\n beforeSend: function (xhr) {\n // TODO: Send user IP ? for throttling purpose\n },\n data: {},\n success: function (data) {\n console.log(data);\n localStorage.setItem(\n appName + \"_GENERATED_ROOM_ID\",\n JSON.stringify(data)\n );\n $(\"#shareableRoomLink\").text(\n window.location.host + \"/?\" + GAMEURLPARAMS + \"=\" + data.gameKey\n );\n },\n error: function (err) {\n console.log(err);\n },\n });\n } else {\n $(\"#shareableRoomLink\").text(\n window.location.host +\n \"/?\" +\n GAMEURLPARAMS +\n \"=\" +\n JSON.parse(localStorage.getItem(appName + \"_GENERATED_ROOM_ID\")).gameKey\n );\n }\n}", "function oneOnone() {\n return (\n <div className=\"oneOnone\">\n <BrowserRouter>\n <Switch>\n <Route path=\"/\" exact component={CreateRoom} />\n </Switch>\n </BrowserRouter>\n </div> \n );\n}", "function requestJoin(type) {\n let roomId;\n if (type === \"public\") {\n roomId = $('input[name=\"all-public-room\"]:checked').val();\n } else {\n roomId = $('input[name=\"all-private-room\"]:checked').val();\n }\n\n if (requestRoomsList.indexOf(parseInt(roomId)) < 0) {\n requestRoomsList.push(parseInt(roomId));\n $.post(\"/chatroom/requestJoin\", {username: username, chatroomId: roomId}, function (data) {\n if (data === \"failure\") {\n $(\"#all-room\" + roomId).parent().parent().removeClass(\"list-group-item-success\");\n $(\"#all-room\" + roomId).parent().parent().addClass(\"list-group-item-danger\");\n }\n if (type === \"public\") {\n joinAndConnectRoom(roomId);\n getChatRoomUsers();\n getJoinedRooms();\n } else {\n requestRoomId = roomId;\n isWaitingAccept = true;\n }\n }\n , \"json\");\n }\n}", "function AlumnoCrear() {\n window.location = `./AlumnoCrear.html?usu_id=${params.get('usu_id')}`;\n}", "function getRoomURL() {\n\treturn location.protocol + \"//\" + location.host + (location.pathname || \"\") + \"?room=\" + getRoom();\n}", "function joinDemo()\n{\n\tuserName = document.getElementById(\"txtUserName\").value;\n\tvLocation = document.getElementById(\"DDLocation\").value;\n\tvSubscribe = document.getElementById(\"DDChat\").value;\n\tif(userName == \"\" || userName == \"null\" || userName == null || userName == \"undefined\" || userName == undefined)\n\t{\n\t\talert(\"Please Enter Username.\")\n\t\treturn;\n\t}\n\twindow.location.href = \"/home.html\";\n}", "function addUnit(class_room_id) {\n\n\t\twindow.location.href = web+\"classroom-unit/create\" + \"?class_room_id=\" + class_room_id + \"\";\n\n }", "function createRoom(){\n roomToken = random()\n roomsRegistry[roomLabel].notFull[roomToken] = {clients:[],limit:roomLimit}\n roomsRegistry[roomLabel].notFull[roomToken].clients.push(clientId)\n }", "function setRoom(name) {\n\t$('#joinRoom').remove();\n\t$('h1').text('Room name : ' + name);\n\t$('body').append('<input type=\"hidden\" id=\"roomName\" value=\"'+name+'\"/>');\n\t$('body').addClass('active');\n}" ]
[ "0.7536238", "0.7142537", "0.69698006", "0.6648515", "0.66118354", "0.6590052", "0.6523262", "0.6497811", "0.6487846", "0.64606035", "0.64541465", "0.6422784", "0.64120525", "0.6398517", "0.6353128", "0.63165313", "0.6307308", "0.6282584", "0.62794757", "0.6279065", "0.6278614", "0.6270213", "0.62675977", "0.6231085", "0.62234706", "0.62189525", "0.6204589", "0.61960244", "0.6188422", "0.6168727", "0.616249", "0.61623615", "0.6137989", "0.61029524", "0.6079226", "0.6076468", "0.605391", "0.6038186", "0.6035048", "0.6033718", "0.6026491", "0.6017686", "0.60140616", "0.6001554", "0.5997513", "0.59725136", "0.5946879", "0.594426", "0.5938398", "0.5920583", "0.59199315", "0.5910556", "0.59079903", "0.59034896", "0.5898235", "0.5896199", "0.58884984", "0.58780384", "0.5870305", "0.58653665", "0.5864065", "0.58530974", "0.5839909", "0.58370584", "0.5830843", "0.58117104", "0.5810467", "0.5793948", "0.5781513", "0.57730097", "0.57648164", "0.5746945", "0.5738096", "0.5731701", "0.57200056", "0.571905", "0.57117164", "0.57088935", "0.570082", "0.56966776", "0.566946", "0.56525093", "0.56455785", "0.5643858", "0.5638147", "0.56369054", "0.56265193", "0.562536", "0.5623882", "0.56192", "0.5617838", "0.56053215", "0.5603824", "0.5603807", "0.5592171", "0.55889916", "0.55787575", "0.55783176", "0.5568709", "0.55669" ]
0.6787807
3
used by collapsible() to hide elements
function hideElements() { let elementsToHide = document.querySelectorAll(".elementToHide"); elementsToHide.forEach((item) => { item.classList.toggle("hide-element"); }) // console.log(elementsToHide); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "hide() {}", "function hideElements() {\n $(\"#collapse_icon\").html(\"show\");\n $(\".sidebar_elements\").addClass(\"hidden\").fadeTo(600, 0).css('dispaly', 'flex');\n $(\"#cross\").removeClass(\"hidden\").fadeTo(600, 1).css('dispaly', 'flex');\n}", "function hide() {\n $.forEach(this.elements, function(element) {\n element.style.display = 'none';\n });\n\n return this;\n }", "_hide() {\n this.panelElem.addClass(\"hidden\");\n }", "hide ()\n\t{\n\t\t//hide the elements of the view\n\t\tthis.root.style.display= 'none';\n\t}", "function xHide(e){return xVisibility(e,0);}", "_hideAll() {\n this.views.directorySelection.hide();\n this.views.training.hide();\n this.views.messages.hide();\n this.views.directorySelection.css('visibility', 'hidden');\n this.views.training.css('visibility', 'hidden');\n this.views.messages.css('visibility', 'hidden');\n }", "hide() {\n this.isVisible = false;\n }", "function hideElements(){\n\t$(\".trivia\").toggle();\n\t$(\".navbar\").toggle();\n\t$(\".end\").toggle();\n}", "function hideAll(){\n $$('.contenido').each(function(item){\n item.hide();\n })\n}", "hide() {\n\t\tthis.style.display = \"none\";\n\t}", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm\n ];\n elementsArr.forEach(val => val.hide());\n }", "onHide() {}", "onHide() {}", "function hide() {\n that.isSelected = false;\n // change class to default\n that.row.className = 'maqaw-visitor-list-entry';\n that.row.style.display = 'none';\n // tell the VisitorList that we are going to hide this visitor so that it can deselect\n // it if necessary\n that.visitorList.hideVisitor(that);\n // clear chat window\n that.visitorList.chatManager.clear(that);\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n $sectionUserProfile\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "hide (element){\n element.style.display = \"none\";\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "function collapseContainers( containers ){\n containers.classed(\"hidden\", true);\n }", "hide(){\r\n this.containerElement.style.display=\"none\";\r\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n $favoritedArticles\n ];\n elementsArr.forEach($elem => $elem.hide());\n }", "function hideItems(){\n $(\".bap-objective\").each(function(){\n $(this).css({'display' : 'none'});\n });\n \n $(\".bap-actions\").each(function(){\n $(this).css({'display' : 'none'});\n });\n \n return false;\n}", "hideContent() {\n this.content.attr('hidden', 'hidden');\n }", "hide() {\n ELEM.setStyle(this.elemId, 'visibility', 'hidden', true);\n this.isHidden = true;\n return this;\n }", "hide () {\n this.showing = false\n this.element ? this.element.update(this) : null\n }", "function unhide(x){\n\t\tdocument.getElementById(x).style.display=\"inline-block\";\n\t}", "hide({ state }) {\n state.visable = false;\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n // **** added favorite article, submit story, user profile hide\n $submitStoryForm,\n $favoriteArticles,\n $userProfile,\n // ****\n ];\n elementsArr.forEach(($elem) => $elem.hide());\n }", "function hideAllContent() {\n $(\"#overview\").hide();\n $(\"#tips\").hide();\n $(\"#sample1\").hide();\n $(\"#sample2\").hide();\n $(\"#sample3\").hide();\n }", "setVisible() {\n element.removeClass('hidden');\n }", "setVisible() {\n element.removeClass('hidden');\n }", "function hideElement(e) {\n e.style.display = \"none\";\n }", "function hide(el) {\n\t\tel.style.display = 'none';\n\t}", "function hide_all() {\n $('#punctual-table-wrapper').collapse(\"hide\")\n $(\"#meta-info\").hide()\n $(\"#progress_bar\").hide()\n $(\"#arrived-late\").hide()\n $(\"#punctual\").hide()\n $(\"#left-early\").hide()\n $(\"#punctual-day-chart\").hide()\n $(\"#breakdown p\").hide()\n}", "hide(){\n const listElements = this.el.childNodes;\n for(let i = 0; i < listElements.length; i++){\n listElements[i].removeEventListener('click',this.onItemClickedEvent);\n }\n this.el.innerHTML = '';\n }", "function unhide(el) {\n $(el).removeClass(\"hidden\");\n }", "unhide() {\n document.getElementById(\"guiArea\").classList.remove(\"hideMe\");\n document.getElementById(\"guiAreaToggle\").classList.remove(\"hideMe\");\n }", "_hide() {\n $.setDataset(this._target, { uiAnimating: 'out' });\n\n $.fadeOut(this._target, {\n duration: this._options.duration,\n }).then((_) => {\n $.removeClass(this._target, 'active');\n $.removeClass(this._node, 'active');\n $.removeDataset(this._target, 'uiAnimating');\n $.setAttribute(this._node, { 'aria-selected': false });\n $.triggerEvent(this._node, 'hidden.ui.tab');\n }).catch((_) => {\n if ($.getDataset(this._target, 'uiAnimating') === 'out') {\n $.removeDataset(this._target, 'uiAnimating');\n }\n });\n }", "function showElements() {\n $(\"#collapse_icon\").html(\"hide\");\n $(\".sidebar_elements\").removeClass(\"hidden\").fadeTo(600, 1);\n $(\".range_options\").css('display', 'flex');\n $(\"#cross\").addClass(\"hidden\").fadeTo(600, 0);\n}", "function hide() {\n\t\tdashboardContent.empty();\n\n\t}", "hide() {\n\t\tthis.panelEl.classList.remove(classes.panel.open);\n\t\tthis.panelEl.classList.add(classes.panel.closed);\n\t}", "hide() {\n if (this[$visible]) {\n this[$visible] = false;\n this[$updateVisibility]({ notify: true });\n }\n }", "onHide() {\n\t}", "function hide(event) { event.target.style.visibility = \"hidden\"; }", "function hide(el){\r\n el = getList(el);\r\n\r\n for(var i = 0; i<el.length; i++){\r\n el[i].style.display = 'none';\r\n }\r\n return el;\r\n }", "function hide(el){\r\n el = getList(el);\r\n\r\n for(var i = 0; i<el.length; i++){\r\n el[i].style.display = 'none';\r\n }\r\n return el;\r\n }", "function hideElements() {\n const elementsArr = [\n $submitForm,\n $allStoriesList,\n $loadMore ,\n $favoriteStoriesList,\n $filteredArticles,\n $ownStories,\n $loginForm,\n $createAccountForm,\n $userProfile\n ];\n elementsArr.forEach(($elem) => $elem.addClass(\"hidden\"));\n }", "hide_() {\n this.adapter_.setAttr(strings.ARIA_HIDDEN, 'true');\n }", "function hideStartingInfo() {\r\n // Hides savings/checking info and transaction info.\r\n hideToggle(checking_info); \r\n hideToggle(savings_info); \r\n hideToggle(transactions); \r\n}", "function hide(el){\n el = getList(el);\n\n for(var i = 0; i<el.length; i++){\n el[i].style.display = 'none';\n }\n return el;\n }", "function hide(el){\n el = getList(el);\n\n for(var i = 0; i<el.length; i++){\n el[i].style.display = 'none';\n }\n return el;\n }", "function hide(el){\n el = getList(el);\n\n for(var i = 0; i<el.length; i++){\n el[i].style.display = 'none';\n }\n return el;\n }", "function hideAll(){\n $$('.contenido').each(function(item){\n item.hide();\n //console.log(item);\n })\n counter=0;\n}", "function hideElement() {\n // let li=this.parentNode.nodeName;\n // if (!body.firstElementChild) {\n if (ob1.style.display == 'none') {\n ob1.style.display = 'block';\n } else {\n ob1.style.display = 'none';\n }\n\n // }\n }", "function hide(){\r\n // change display style from block to none\r\n details.style.display='none';\r\n}", "function hideAll() {\n $(\"#header\").hide();\n $(\"#keyword-type\").hide();\n $(\"#url\").hide();\n $(\"#option-choose\").hide();\n $(\"#submit\").hide();\n $(\"#name\").addClass('hide');\n}", "function hideStuff(){\n\t$('#layout').fadeOut();\n\tparent.$(\"#exclusionTableWrapper\").hide();\n\t// hide plate exclusion divs\n\t$('.excludedPlateContainer').hide();\n}", "function unhideControls() {\n\tdocument.querySelector('.hidden').style.visibility = 'visible';\n}", "static hide(obj) {\n obj.setAttribute('visibility', 'hidden');\n }", "hide_labels() {\n let labels;\n return labels = this.vis.selectAll(\".top_labels\").remove();\n }", "hide_() {\n this.adapter_.setAttr(strings$f.ARIA_HIDDEN, 'true');\n }", "function hideAllDetails( altShow ) {\n // hide descriptions\n $( \".citationDetails\" ).hide( function() {\n resizeFrame();\n }\n );\n \n // show proper toggle icon\n $( \".toggleIcon\" ).each( function() {\n this.src = \"/library/image/sakai/expand.gif?panel=Main\";\n this.alt = altShow;\n } );\n}", "toggleHidden() {\n if (this.isHidden) this.show();\n else this.hide();\n }", "function hideAll(){\n\t$('#legendCompare').addClass('hide');\n\t$(\"#setupInfos\").hide(\"blind\");\n\t$(\"#compareDemos\").hide(\"blind\");\n\t$(\"#loadSeeConfig\").hide(\"blind\");\n}", "hide()\n\t{\n\t\t// hide the decorations:\n\t\tsuper.hide();\n\n\t\t// hide the stimuli:\n\t\tif (typeof this._items !== \"undefined\")\n\t\t{\n\t\t\tfor (let i = 0; i < this._items.length; ++i)\n\t\t\t{\n\t\t\t\tif (this._visual.visibles[i])\n\t\t\t\t{\n\t\t\t\t\tconst textStim = this._visual.textStims[i];\n\t\t\t\t\ttextStim.hide();\n\n\t\t\t\t\tconst responseStim = this._visual.responseStims[i];\n\t\t\t\t\tif (responseStim)\n\t\t\t\t\t{\n\t\t\t\t\t\tresponseStim.hide();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// hide the scrollbar:\n\t\t\tthis._scrollbar.hide();\n\t\t}\n\t}", "hide() {\n\t\t\tif ( this._container ) {\n\t\t\t\tthis._container.style = 'display:none';\n\t\t\t}\n\t\t}", "doHidden( root ) {\n root.style.display = 'none';\n }", "function hideContents(){\n $(\".js-contents .row\").addClass(\"d-none\");\n}", "function hidePanels(){\n\tvar controller = abRepmAddEditLeaseInABuilding_ctrl;\t\n\tcontroller.abRepmAddEditLeaseInABuildingLeaseInfo_form.show(false);\n\tcontroller.abRepmAddEditLeaseInABuildingDocs_grid.show(false);\n\tcontroller.abRepmAddEditLeaseInABuildingBaseRents_grid.show(false);\n}", "hideInitially() {\n\t\tthis.itemsToReveal.addClass(\"reveal-item\");\n\t}", "function hide(elem)\n{\n\telem.style.visibility= 'hidden';\n}", "hide_children() { \n for (var key of this.keys) {\n try { this.elements[key].hide(); }\n catch (e) {}\n }\n }", "hide_() {\n this.adapter_.setAttr(strings$17.ARIA_HIDDEN, 'true');\n }", "hide() {\n const that = this,\n ownerElement = that.closest('jqx-splitter');\n\n that.$.addClass('jqx-hidden');\n\n if (ownerElement) {\n const ownerItems = ownerElement.items;\n\n if (ownerElement.hasAnimation) {\n let animatedItem;\n\n for (let i = 0; i < ownerItems.length; i++) {\n if (ownerItems[i].$.hasClass('animate')) {\n animatedItem = true;\n ownerItems[i].addEventListener('transitionend', function () {\n that.closest('jqx-splitter')._autoFitItems();\n }, { once: true });\n }\n }\n\n if (animatedItem) {\n return;\n }\n }\n\n ownerElement._autoFitItems();\n }\n }", "isHidden() {\n return false;\n }", "function showHide()\r\n{\r\n var showHides = jQ(\"fieldset.showHide\");\r\n for(var x=0; x<showHides.size(); x++)\r\n {\r\n showHide = showHides.eq(x);\r\n legend = showHide.children(\"legend\");\r\n legendText = legend.text();\r\n legend.html(\"Hide \" + legendText);\r\n legend.css(\"cursor\", \"pointer\");\r\n legend.css(\"color\", \"blue\");\r\n //div = showHide.children(\"div\")\r\n show = jQ(\"<span style='cursor:pointer;color:blue;padding-left:1ex;'>Show \" + legendText + \"</span>\");\r\n showHide.wrap(\"<div/>\");\r\n showHide.before(show);\r\n showHide.hide();\r\n function showFunc(event)\r\n {\r\n target = jQ(event.target);\r\n target.hide();\r\n target.next().show();\r\n }\r\n function hideFunc(event)\r\n {\r\n target = jQ(event.target).parent();\r\n target.hide();\r\n target.prev().show();\r\n }\r\n show.click(showFunc);\r\n legend.click(hideFunc);\r\n }\r\n showHides = jQ(\"div.showHideToggle\");\r\n showHides.each(function() {\r\n var showHideDiv = jQ(this);\r\n var toggleText = showHideDiv.find(\"input[@name='toggleText']\").val();\r\n var contentDiv = showHideDiv.find(\">div\");\r\n var cmd = showHideDiv.find(\">span.command\");\r\n cmd.click(function(){ contentDiv.toggleClass(\"hidden\"); var t=cmd.html(); cmd.html(toggleText); toggleText=t; });\r\n });\r\n}", "hide() {\n for (var dependent of this.get_dependents()) {\n try { dependent.hide(); }\n catch (e) {}\n }\n }", "function collapseHide() {\n $( \".slide-collapse\" ).click(function() {\n collapse($(this));\n });\n}", "function hideSelectorContainers(){\n\thideTypeSelector();\n\thidePlayerSelector();\n\thideYearSelector();\n\thideWeekSelector();\n\thideStatNameSelector();\n\thideTeamSelector();\n}", "static hide(v) {\n // Set style to none\n UI.find(v).setAttribute(\"hidden\", \"true\");\n }", "showContent() {\n this.content.removeAttr('hidden');\n }", "function hideTreeExpandCollapseButtons(hide) {\n\tif(hide) {\n\t\t$('#tree-expand').hide();\n\t\t$('#tree-collapse').hide();\n\t\t$('#save-as-profile-btn').hide();\n\t}\n\telse {\n\t\t$('#tree-expand').show();\n\t\t$('#tree-collapse').show();\n\t\t$('#save-as-profile-btn').show();\n\t}\n\t\n}", "function invisible(item) {\n item.css(\"visibility\", \"hidden\");\n }", "function hideSlides(){\n $('.caps').hide()\n $('.headers').hide();\n}", "static hide(obj) {\n obj.setAttribute('visibility', 'hidden');\n }", "function hideElement () {\n if(this instanceof HTMLCollection || this instanceof NodeList) {\n for(var i = 0; i < this.length; i++) {\n this[i].style.display = 'none';\n }\n }\n else if(this instanceof HTMLElement) {\n this.style.display = 'none';\n }\n\n return this;\n }", "function hideElement() {\n header.setAttribute(\"style\", \"visibility: hidden\");\n text.setAttribute(\"style\", \"visibility: hidden\");\n startBtn.setAttribute(\"style\", \"visibility: hidden\");\n}", "hide() {\n if (\n $.getDataset(this._target, 'uiAnimating') ||\n !$.hasClass(this._target, 'active') ||\n !$.triggerOne(this._node, 'hide.ui.tab')\n ) {\n return;\n }\n\n this._hide();\n }", "function hideAll() {\n\t\t// Hide counter\n\t\t$('.counter').animate({\n\t\t\ttop: \"-18em\"\n\t\t}, 600, \"swing\", function() {\n\t\t});\n\t\t\n\t\t// Hide highlight\n\t\t$('.highlight, .glow').addClass('highlight-hide');\n\t\tsetTimeout(function() {\n\t\t\t// Slide away main content\n\t\t\t$('.main').animate({\n\t\t\t\tmarginTop: \"150vh\"\n\t\t\t}, 1200, \"swing\", function() {\n\t\t\t\tlocation.reload();\n\t\t\t});\n\t\t}, 400);\n\t\t\n\t\t// Hide nav button and menu\n\t\t$('.collapse').collapse('hide');\n\t\t$('.navbar-toggle').animate({\n\t\t\tbottom: \"-100vh\"\n\t\t}, 800, \"swing\", function() {\n\t\t});\n\t}", "_hideItems () {\n const firstFour = this.listItems.filter(notHidden => !notHidden.classList.contains(\"responsive-hidden\") && notHidden.querySelector(SELECTORS.SUB) === null && this._el.querySelector(\"UL\") === notHidden.parentElement);\n\n if (this.submenus.length > 0) {\n this.submenus.forEach(levelTwo => {\n levelTwo.parentElement.classList.add(\"responsive-hidden\");\n });\n\n if (firstFour.length > 4) {\n firstFour.slice(4).forEach(item => {\n item.parentElement.classList.add(\"responsive-hidden\");\n });\n }\n } else {\n this.listItems.slice(4).forEach(items => {\n items.classList.add(\"responsive-hidden\");\n });\n }\n }", "function hideElements() {\n document.getElementById(\"pt1\").hidden = true;\n document.getElementById(\"pt2\").hidden = true;\n document.getElementById(\"intercept\").hidden = true;\n document.getElementById(\"slopeLabel\").hidden = true;\n document.getElementById(\"yIntLabel\").hidden = true;\n document.getElementById(\"pt1Label\").hidden = true;\n document.getElementById(\"pt2Label\").hidden = true;\n document.getElementById(\"riseRun1\").hidden = true;\n document.getElementById(\"riseRun2\").hidden = true;\n}", "function hide() {\n $( \"#target\" ).hide();}", "function hideSelectedHideables(hideables){\n for (let hideMe of hideables){\n if(document.getElementById(hideMe)){\n document.getElementById(hideMe).classList.add(\"displayNone\");\n }\n }\n }", "hide() {\n if (this.div) {\n // The visibility property must be a string enclosed in quotes.\n this.div.style.visibility = \"hidden\";\n }\n }", "function hide(el) {\n el = getList(el);\n\n for (var i = 0; i < el.length; i++) {\n el[i].style.display = 'none';\n }\n\n return el;\n }", "hide() {\n this.visible = false;\n this.closed.emit();\n }", "function hideItems() {\r\n piecesSlider.hidePieces({items: [currentImageIndex, currentTextIndex, currentNumberIndex]});\r\n }", "function unHideComponents(){\r\n tank.style.visibility = \"visible\";\r\n missile.style.visibility = \"visible\";\r\n score.style.visibility = \"visible\";\r\n}", "hide() {\n checkPresent(this.containerDiv, 'not present when hiding');\n // The visibility property must be a string enclosed in quotes.\n this.containerDiv.style.visibility = 'hidden';\n }", "hide() {\n\t\tthis.isVisible = false;\n this.element.classList.remove('hide')\n\t\tthis.element.classList.remove('showCarousel')\n\t\tthis.element.classList.add('hideCarousel')\n\t\tthis.buttons.style.paddingTop = \"72px\"\n\t\t\n\t}" ]
[ "0.7696056", "0.7422398", "0.7333384", "0.7272602", "0.7221115", "0.72023773", "0.7200048", "0.7130635", "0.7071157", "0.7068182", "0.70546514", "0.7046007", "0.69858533", "0.69858533", "0.69854015", "0.69841826", "0.6978578", "0.6970021", "0.6970021", "0.6947223", "0.6942153", "0.692611", "0.6895606", "0.6893231", "0.6889195", "0.68792444", "0.68756956", "0.68439895", "0.6832524", "0.68209696", "0.6814604", "0.6814604", "0.6807444", "0.6802476", "0.67963713", "0.6790067", "0.6772159", "0.67690897", "0.67583334", "0.6749301", "0.673435", "0.67303985", "0.67272764", "0.6724263", "0.672103", "0.67143965", "0.67143965", "0.6712388", "0.6706834", "0.6702502", "0.6681244", "0.6681244", "0.6681244", "0.66799504", "0.6673951", "0.66724277", "0.66656995", "0.66623", "0.6660685", "0.66588485", "0.6658655", "0.6657188", "0.6656102", "0.6650987", "0.6650449", "0.6645278", "0.6643279", "0.66353595", "0.66343594", "0.6633934", "0.6632975", "0.66321003", "0.663001", "0.66252065", "0.6625052", "0.66156673", "0.6615058", "0.66124934", "0.660639", "0.6601757", "0.65988356", "0.658861", "0.65745556", "0.65744066", "0.65642047", "0.65632606", "0.6560708", "0.65578705", "0.65535265", "0.65499836", "0.654783", "0.65435266", "0.65409064", "0.65400064", "0.65394217", "0.6534932", "0.6531314", "0.6530837", "0.65261877", "0.65238833", "0.6522114" ]
0.0
-1
output message to DOM
function outputMessage(msg) { const div = document.createElement('div'); div.classList.add('message'); div.innerHTML = `<p class="meta"> ${msg.username}•<span>${msg.time}</span></p> <p class="text"> ${msg.text} </p>`; const chatSection = document.getElementById('chat-message'); chatSection.appendChild(div); // console.log(div); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function outputMesssage(message) {\n const div = document.createElement('div');\n div.innerHTML = `${message}`;\n document.querySelector('.messages').appendChild(div);\n}", "function output(message) {\n const para = document.createElement('p');\n para.innerHTML = message;\n outputDiv.appendChild(para);\n}", "function print(message) {\n\t var outputDiv = document.getElementById(\"output\").innerHTML = message;\n\t}", "function message(msg){\n\tdocument.getElementById('output').innerHTML = msg + \" event\"\n}", "function outputMessage(message) {\n //Creates div\n const div = document.createElement(\"div\");\n // adds div to classList\n div.classList.add(\"message\");\n //Formatting message\n div.innerHTML =\n `<div id=\"username time\">\n ${message.username} today at: ${message.time}\n <div id=\"text\">\n ${message.text}\n </div>\n </div>`\n document.getElementById(\"c-messages\").appendChild(div)\n}", "logOutput (msg) {\n this.DOMNodes.runMessage.className = \"hidden\";\n let node = document.createElement(\"div\");\n node.innerHTML = msg;\n this.DOMNodes.log.appendChild(node);\n }", "function message(msg){\n document.getElementById('message').innerHTML = msg;\n }", "function outputMessage(message) {\r\n //Manipulaciond el DOM\r\n const div = document.createElement(\"div\");\r\n div.classList.add(\"message\");\r\n div.innerHTML = `<p class=\"meta\">${message.username}<span>${message.time}</span></p>\r\n <p class=\"text\">\r\n ${message.text}\r\n </p>`;\r\n document.querySelector(\".chat-messages\").appendChild(div);\r\n}", "function print(message) {\n\t var outputDiv = document.getElementById('output');\n\t outputDiv.innerHTML = message;\n}", "function outputMessage(message){\n const div = document.createElement('div');\n div.classList.add('messages');\n div.innerHTML= `<p class = \"text\">\n ${message} \n </p>`;\n document.querySelector('.chat-messages').appendChild(div);\n}", "function writeMessage(message) {\r\n\tvar li = document.createElement(\"li\");\r\n\r\n\tsetElementText(li, message);\r\n\r\n\r\n output.appendChild(li);\r\n}", "function outputMessage(message) {\n const div = document.createElement('div');\n div.classList.add('message'); // message comes from <div class=\"message\"> in chat.html\n div.innerHTML = `<p class=\"meta\">${message.username} <span>${message.time}</span></p>\n <p class=\"text\">\n ${message.text}\n </p>`\n document.querySelector('.chat-messages').appendChild(div) // should add a new div to the chat.html when we csubmit a new message\n}", "function _print(message) {\n if (_output) {\n _output.innerHTML += message + \"<br />\";\n }\n }", "function writeMessage(message) {\n var li = document.createElement(\"li\");\n\n setElementText(li, message);\n output.appendChild(li);\n}", "function outputMessage(msg) {\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\">${msg.username} <span>${msg.time}</span></p>\n <p class=\"text\">${msg.text}</p>`;\n document.querySelector('.chat-messages').appendChild(div);\n}", "function outputMessage(message){\n\nconst div=document.createElement('div');\ndiv.classList.add('message');\ndiv.innerHTML=`<p class=\"meta\">${message.username}<span></span>${message.time}</p>\n<p class=\"text\">\n${message.text}\n\n</p>`\n\ndocument.querySelector('.chat-messages').appendChild(div)\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 outputMessage(msg) {\n const div = document.createElement('div');\n\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\">${msg.username} <span>${msg.time}</span></p>\n <p class=\"text\">${msg.text}</p>`;\n chatMessages.appendChild(div);\n}", "function writeToPage(msg) {\n results.innerHTML = msg;\n}", "function output(message) {\n document.getElementById(\"output\").innerHTML += message + \"<br/>\";\n}", "function outputMessage(message){\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\"> ${message.username} <span> ${message.time} </span></p>\n <p class=\"text\">\n ${message.text}\n </p>`;\n document.querySelector('.chat-messages').appendChild(div);\n}", "function outputMessage(message){\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\"><b><i>${message.username} <span>${message.time}</i></b></span>\n <br />\n ${message.text}\n </p>`;\n\n document.querySelector('.chat-messages').appendChild(div);\n\n}", "function outputMessage(message) {\n\tconst div = document.createElement(\"div\");\n\tdiv.classList.add(\"message\");\n\tdiv.innerHTML = `<p class=\"meta\">${message.username} <span>${message.time}</span>\n\t<p className=\"text\">${message.text}</p>`;\n\tdocument.querySelector(\".chat-messages\").appendChild(div);\n}", "function userMessage(message) {\n output(message);\n try {\n document.getElementById('user_message').innerText = message;\n }\n catch (error) {}\n}", "function outputMessage(message){\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\">${message.username} <span>${message.time}</span></p>\n <p class=\"text\">\n ${message.text}\n </p>`;\n document.querySelector('.chat-messages').appendChild(div);\n}", "function outputMessage(msg) {\n const div = document.createElement(\"div\");\n div.classList.add(\"message\");\n div.innerHTML = `<p class=\"meta\">${msg.username} <span>${msg.time}</span></p>\n <p class=\"text\">${msg.text}</p>`;\n document.querySelector(\".chat-messages\").appendChild(div);\n}", "function outputMessage(message){\n const div = document.createElement(\"div\");\n div.classList.add(\"message\");\n div.innerHTML = `<p class=\"meta\">${message.username}<span> ${message.time}</span></p>\n <p class=\"text\">\n ${message.text}\n </p>`; \n document.querySelector('.chat-messages').appendChild(div);\n}", "function outputMessage(message) {\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = ` <p class=\"meta\">${message.username} <span>${message.time}</span></p>\n <p class=\"text\">\n ${message.text}\n </p>`;\n document.querySelector('.chat-messages').appendChild(div);\n}", "function outputMessage(message){\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\">${message.username} <span> ${message.time}</span></p>\n <p class=\"text\">\n ${message.text}\n </p>`;\n\n document.querySelector('.chat-messages').appendChild(div);\n}", "function outputMessage(message){\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\">${message.username} <span>${message.time}</span></p>\n <p class=\"text\">\n ${message.text}\n </p>`;\n document.querySelector('.chat-messages').appendChild (div);\n\n}", "function outputMessage(message){\n const div= document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\">${message.username} <span>${message.time}</span></p>\n <p class=\"text\">\n ${message.text}\n </p>`;\n //here we select the chat-messages\n document.querySelector('.chat-messages').appendChild(div); // 9\n}", "function outputMessage(message) {\n const div = document.createElement(\"div\");\n div.classList.add(\"message\");\n div.innerHTML = ` <p class=\"meta\">${message.username} <span>${message.time}</span></p>\n <p class=\"text\">\n ${message.message}\n </p>`;\n document.querySelector(\".chat-messages\").appendChild(div);\n}", "function outputMessage(message) {\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\">${message.username}<span>${message.time}</span></p>\n <p class=\"text\">\n ${message.text}\n </p>`;\n document.querySelector('.divscroll').appendChild(div);\n }", "function print(message) {\r\n var outputDiv = document.getElementById(\"output\");\r\n outputDiv.innerHTML = message;\r\n}", "function print(message){\n var outputDiv = document.getElementById('output');\n outputDiv.innerHTML = message;\n}", "function print(message) {\n var outputDiv = document.getElementById('output');\n outputDiv.innerHTML = message;\n}", "function printToPage(msg) {\n\t\tif(document.getElementById(\"message\") != null){\n\t\t\tdocument.getElementById(\"message\").innerHTML = msg;\n\t\t}\n\t\telse{\n\t\tvar message = \"<p id=\\\"message\\\">\" + msg + \"<\\p>\";\n\t\t$(\"#result\").append(message);\n\t\t}\n\t}", "function outputMessage(message) {\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\">${message.username} <span>${message.time}</span><p class=\"text\">${message.text}</p>`;\n document.querySelector('.chat-messages').appendChild(div);\n}", "function print(message) {\n var outputDiv = document.getElementById('output');\n outputDiv.innerHTML = message;\n}", "function print(message) {\n var outputDiv = document.getElementById('output');\n outputDiv.innerHTML = message;\n}", "function outputMessage(message) {\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = `<p class=\"meta\">${message.username} <span>${message.time}</span></p>\n <p class=\"text\">\n ${message.text}\n </p>`;\n document.querySelector('.chat-messages').appendChild(div);\n}", "function outputMessage(message) {\n const div = document.createElement(\"div\");\n div.innerHTML = ` <div class=\"incoming_msg\">\n <div class=\"incoming_msg_img\"> <img src=\"https://ptetutorials.com/images/user-profile.png\" alt=\"sunil\">\n </div>\n <div class=\"received_msg\">\n <div class=\"received_withd_msg\"> \n <p>${message.text}</p>\n \n <span class=\"time_date\"> ${message.username} at ${message.time}</span>\n </div>\n </div>\n </div>\n `;\n document.querySelector(\".chat-messages\").appendChild(div);\n}", "function outputMessage(message) {\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = '<p class=\"meta\">'+ message.username + '<span>' + message.time +'</span' +'</p>'+\n '<p class=\"text\">' + message.text + '</p>'\n document.querySelector(\".chat-messages\").appendChild(div)\n}", "function writeMsg(msg){\n msgEl.innerHTML = `\n <div>You Said: </div>\n <span class = \"box\">${msg}</span>\n `\n}", "setMessage(msg) \n {\n document.getElementById('message').innerHTML = msg;\n }", "function outputMessage(payload) {\n const div = document.createElement('div');\n const p = document.createElement('p');\n p.innerText = payload.text;\n let time = moment(payload.unixTime).format('MMMM Do YYYY, h:mm a');\n p.innerHTML += `<span> ${time}</span>`;\n div.appendChild(p);\n chatForm.appendChild(div);\n}", "function printhtml(dom,msg)\r\n{\r\n\t$(dom).html(msg);\r\n\t$(dom).removeClass('hide');\r\n}", "function tell(msg) {\n $(\".output\").val(msg);\n }", "function outputMessage(message) {\r\n const div = document.createElement('div');\r\n div.classList.add('message');\r\n\r\n const p = document.createElement('p');\r\n p.classList.add('meta');\r\n p.innerText = message.username;\r\n if(message.username == 'server'){\r\n p.innerText += ' | ';\r\n p.style.color = 'red';\r\n }else{\r\n p.innerText += ' @ ';\r\n }\r\n p.innerHTML += `<span>${message.time}</span>`;\r\n div.appendChild(p);\r\n\r\n const para = document.createElement('p');\r\n para.classList.add('text');\r\n para.innerText = message.text;\r\n if(message.username == 'server'){\r\n para.style.color = 'red';\r\n para.style.fontFamily = 'Courier New';\r\n }\r\n div.appendChild(para);\r\n\r\n document.querySelector('.chat-messages').appendChild(div);\r\n}", "function render_msg(msg) {\r\n ///This function gets a msg in the form\r\n /// author:\r\n /// msg:\r\n // var divEl = xo.getDom('');\r\n // var el = xo.DomHelper.createDom({\r\n // \"tag\": \"div\",\r\n // \"class\": \"message\",\r\n // \"html\": \"User \" + msg.author + \": \" + msg.data\r\n // }, divEl);\r\n // \r\n }", "function tell(msg) {\n $(\".output\").val(msg);\n }", "function display(message){\n\tdataElement.innerHTML = dataElement.innerHTML+'<br>'+message;\n}", "function print ( message ) {\r\n viewDiv.innerHTML = message;\r\n}", "function outputMessage(message){\n //each emssage has a div\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = '<p class=\"meta\">'+\n message.username + '<span> '+\n message.time +'</span></p><p class=\"text\">'+\n message.text +\n '</p>';\n document.querySelector('.chat-messages').appendChild(div);\n}", "function outputMessage(message) {\n const div = document.createElement(\"div\");\n div.classList.add(\"message\");\n const p = document.createElement(\"p\");\n p.classList.add(\"meta\");\n p.innerText = `${message.playername} `;\n p.innerHTML += `<span>${message.time}</span>`;\n div.appendChild(p);\n const para = document.createElement(\"p\");\n para.classList.add(\"text\");\n para.innerText = message.text;\n div.appendChild(para);\n chatMessages.appendChild(div);\n}", "function postMessage(message) {\n const newMessage = document.createElement('p');\n newMessage.textContent = message;\n\n messageOutput.appendChild(newMessage);\n}", "function outputMessage(message) {\n const div = document.createElement(\"div\");\n message.username === \"You\"\n ? div.setAttribute(\"class\", \"ui positive message\")\n : div.setAttribute(\"class\", \"ui info message\");\n const p = document.createElement(\"p\");\n message.username === \"You\"\n ? p.setAttribute(\"class\", \"ui red horizontal label\")\n : p.setAttribute(\"class\", \"ui blue horizontal label\");\n p.innerText = message.username;\n p.innerHTML += `<span class=\"${\n message.username === \"You\" ? \"orange-text\" : \"teal-text text-lighten-2\"\n }\"> at ${message.time}</span>`;\n div.appendChild(p);\n const para = document.createElement(\"p\");\n para.classList.add(\"text\");\n para.innerHTML = message.content;\n div.appendChild(para);\n document.querySelector(\".chat-messages\").appendChild(div);\n}", "function _addOutput(msg) {\r\n var output = document.getElementById('outputArea');\r\n output.value += msg + \"\\n\";\r\n\r\n // Move cursor to the end of the output area.\r\n output.scrollTop = output.scrollHeight;\r\n }", "function renderMessage(text) {\n document.getElementById('res').innerHTML = text;\n}", "function showHtmlMsg() {\r\n msg.innerText = ''\r\n disableButton()\r\n message.style.display = 'none'\r\n innerMsg.style.display = 'block'\r\n // var htmlmsg = document.createElement('p')\r\n msg.innerText = \"HTML stands for Hyper Text Markup Language. HTML describes the structure of a Web page.\"\r\n innerMsg.appendChild(msg)\r\n innerMsg.appendChild(hr)\r\n}", "function displayMessage(message) {\n document.querySelector('.message').textContent = message;\n}", "function outputMessage(message) {\n\n const div = document.createElement('div');\n div.classList.add('message');\n div.innerHTML = \n `\n <div class=\"d-flex justify-content-start mb-4\">\n <div class=\"img_cont_msg\">\n <img src=\"https://image.flaticon.com/icons/png/128/3135/3135715.png\" class=\"rounded-circle user_img_msg\">\n </div>\n <div class=\"d-flex justify-content-start mb-4\">\n <div class=\"msg_cotainer\">\n ${message.username} - ${message.text}\n <span class=\"msg_time\">${message.time}</span>\n </div>\n </div>\n </div>\n `;\n\n document.querySelector('.chat-messages').appendChild(div);\n\n}", "function outputMessage(message) {\n const div = document.createElement('div');\n div.classList.add('message');\n const p = document.createElement('p');\n p.classList.add('meta');\n p.innerText = message.username;\n p.innerHTML += `<span>${message.time}</span>`;\n div.appendChild(p);\n const para = document.createElement('p');\n para.classList.add('text');\n para.innerText = message.text;\n div.appendChild(para);\n document.querySelector('.chat-messages').appendChild(div);\n}", "function Message(msg){\r\n const mes_ele = document.createElement('div');\r\n mes_ele.innerText = msg;\r\n mes.append(mes_ele);\r\n }", "function outputMessage(message) {\n const div = document.createElement('div')\n div.classList.add('alert','alert-dark','my-2','ml-2','mr-5')\n div.innerHTML = `<div class=\"row\">\n <div class=\"col\"><span><strong>${message.username} </strong>at ${message.time}</span></div>\n </div>\n <p style=\"font-size: smaller;\">${message.text}</p>`\n\n document.getElementById('chat-messages').appendChild(div);\n}", "function message(message){\n let results = document.querySelector(\".results\");\n let p = document.createElement(\"p\");\n p.innerHTML = message;\n results.innerHTML = \"\";\n results.appendChild(p);\n }", "function writeP2(message_2) {\r\n document.getElementById('message_2').innerHTML += message_2 + '<br/>';\r\n}", "function appendOutputDiv(message) {\n var pre = document.getElementById('output');\n var textContent = document.createTextNode(message + '\\n');\n if(DEBUG) {\n pre.appendChild(textContent);\n } else {\n pre.textContent = message + \"\\n\";\n }\n}", "function outputMessage(message) {\n const li = document.createElement('li');\n li.textContent = message;\n li.classList.add('message');\n document.getElementById('chat-field').appendChild(li);\n}", "function display(message) {\n document.querySelector('.message').textContent = message;\n}", "function writeMsg(txt) {\n document.getElementById('gameMsg').innerHTML = txt;\n showGameMsg();\n}", "function output(message) {\n browser.runtime.sendMessage({ action: 'output', message });\n}", "function ilm_display(msg) {\r\n\tdocument.querySelector('#ilm_container .ilm_msg').textContent = msg;\r\n}", "function displayMessage() {\n mainEl.textContent = message;\n}", "function outputOwnMessage(message) {\n const div = document.createElement('div')\n div.classList.add('alert','alert-success','my-2','mr-2','ml-5')\n div.innerHTML = `<div class=\"row\">\n <div class=\"col\"><span><strong>${message.username} </strong>at ${message.time}</span></div>\n </div>\n <p style=\"font-size: smaller;\">${message.text}</p>`\n\n document.getElementById('chat-messages').appendChild(div);\n}", "function print(out){\n msg = document.createElement(\"p\");\n msg.textContent = out.toString();\n output.appendChild(msg);\n}", "renderMessage_() {\n const messsageEl = create(\"div\", {\n classname: cssClass.MESSAGE_WRAPPER,\n copy: copy.NO_SUBSCRIPTIONS,\n });\n\n this.appendChild(messsageEl);\n }", "function displayOutputMessage(text) {\n const outputElem = goog.dom.getElement('output');\n outputElem.innerHTML = outputElem.innerHTML + text + '\\n';\n}", "function setMessage(msg) {\n\n\tdocument.getElementById(\"message\").innerHTML = msg;\n}", "function ShowMessage(msg) {\n\tdocument.getElementById(\"message\").innerHTML += \"<p>\"+msg+\"</p>\";\n}", "function setMessage (msg){\n document.getElementById(\"message\").innerHTML=msg;\n}", "function displayMessage(type,message)\n{\n messageEL.text(message);\n messageEL.attr(\"class\",type);\n\n}", "function outputStatus(message) {\n const div = document.createElement('div')\n div.classList.add('message')\n div.innerHTML = `<li style=\"color: slateblue;margin:0px\">\n <p>${message.text}</p>\n <p>${message.time}</p>\n </li>`\n document.querySelector('.chat-messages').appendChild(div)\n}", "function addOutput(msg) {\n var output = document.getElementById('script_output');\n output.value += msg + \"\\n\";\n\n // Move cursor to the end of the output area.\n output.scrollTop = output.scrollHeight;\n }", "function setMessage(msg) {\n\t\tdocument.getElementById(\"message\").innerText = msg;\n\t}", "function OutputLine(msg) {\n $(\"output\").value += msg + \"\\n\";\n}", "function outputMessage(message,position) {\n const div = document.createElement('div');\n div.classList.add('message');\n div.classList.add(position);\n const p = document.createElement('p');\n p.classList.add('time');\n p.innerText = message.time;\n div.appendChild(p);\n \n const para = document.createElement('p');\n para.classList.add('text');\n if(message.username == 'ChatWid')\n para.innerHTML = `<b>${message.text}</b>`;\n else\n para.innerHTML = `<b>${message.username}</b>: ${message.text}`;\n div.appendChild(para);\n\n document.querySelector('.chat_messages').appendChild(div);\n}", "function displayMessage(message){\n document.getElementById('ui').innerHTML = message;\n}", "displayMessage(message) {\n this.messageContainerEl.innerHTML = `<div class='message'>${message}</div>`;\n this.messageContainerEl.classList.add('visible');\n }", "function setMessage(msg){\n document.getElementById(\"message\").innerHTML = msg;\n}", "function setMessage(str) {\n\tdocument.getElementById(\"Messages\").innerHTML = \"<h2>\" + str + \"</h2>\";\n}", "function output(message) {\n var consoleMessage = \"<div><span class='time'>\" + Date.now() + \" \" + message + \"</span></div>\";\n var element = $(consoleMessage);\n addToArrayStorage('wellData', consoleMessage)\n $('#console').append(element);\n }", "function printClientInput(msg){\r\n\r\nvar messagelogtxt = document.getElementById('messagelog');\r\n\r\nmessagelogtxt.innerHTML += 'Client : ' + msg + '\\n';\r\nconsole.log(msg);\r\n}", "printMessage(input, msg) {\n //Quantidade de erros\n let errorsQty = input.parentNode.querySelector('.error-validation')\n if(errorsQty === null) {\n let template = document.querySelector('.error-validation').cloneNode(true)\n template.textContent = msg\n let inputParent = input.parentNode\n template.classList.remove('template')\n inputParent.appendChild(template)\n }\n }", "function t_print(message) {\r\n t_printRaw(\"<div>\" + message + \"</div>\");\r\n}", "function print(infoMessage, asHtml) {\n var $msg = $('<div class=\"info\">');\n if (asHtml) {\n $msg.html(infoMessage);\n } else {\n $msg.text(infoMessage);\n }\n $chatWindow.append($msg);\n }", "function print(infoMessage, asHtml) {\n var $msg = $('<div class=\"info\">');\n if (asHtml) {\n\n $msg.html(infoMessage);\n\n } else {\n\n $msg.text(infoMessage);\n\n }\n $chatWindow.append($msg);\n }", "function setMessage(msg) {\n document.getElementById(\"message\").innerText = msg;\n}", "function outputMessage(message) {\n const div = document.createElement('div')\n div.classList.add('message')\n if (message.username === username) {\n div.innerHTML = `<li class=\"replies\">\n <span class=\"user-name\" style=\"float:right\">${message.username}</span>\n <p>${message.text} <span style=\"text-align:right;font-size:9px; display:block\">${message.time}</span></p>\n </li>`\n document.querySelector('.chat-messages').appendChild(div)\n } else {\n div.innerHTML = `<li class=\"sent\">\n <span class=\"user-name\" style=\"float:left; margin-right: 10px;\">${message.username}</span>\n <p>${message.text} <span style=\"text-align:left;font-size:9px; display:block\">${message.time}</span></p>\n </li>`\n document.querySelector('.chat-messages').appendChild(div)\n }\n}", "function print(infoMessage, asHtml) {\n var $msg = $('<div class=\"info\">');\n if (asHtml) {\n $msg.html(infoMessage);\n } else {\n $msg.text(infoMessage);\n }\n $chatWindow.append($msg);\n\n }" ]
[ "0.7349049", "0.7335071", "0.71537566", "0.70986444", "0.7090382", "0.7079102", "0.7029552", "0.70211124", "0.6986701", "0.6970532", "0.6938852", "0.6931121", "0.68999714", "0.68598974", "0.68533146", "0.68473786", "0.68436587", "0.68171614", "0.68057007", "0.6804204", "0.67987967", "0.6793894", "0.67919785", "0.67907906", "0.67887115", "0.6781171", "0.67730784", "0.67640454", "0.675726", "0.67515326", "0.67512375", "0.6715463", "0.6713512", "0.67076945", "0.670067", "0.6700665", "0.6698528", "0.6696692", "0.66930187", "0.66930187", "0.66858774", "0.6681792", "0.6681009", "0.6671216", "0.6669642", "0.6663156", "0.6657877", "0.6647146", "0.6646911", "0.6634889", "0.6625496", "0.6616759", "0.660278", "0.6598213", "0.6595484", "0.6590413", "0.65831685", "0.65612155", "0.6550998", "0.65505075", "0.6534918", "0.65265894", "0.6525591", "0.65245265", "0.6521987", "0.6516475", "0.65106046", "0.6499613", "0.6481182", "0.64683753", "0.6453471", "0.64522797", "0.6435572", "0.6424349", "0.6418317", "0.6400467", "0.63942975", "0.6390499", "0.6389481", "0.6383705", "0.63812476", "0.635399", "0.6342505", "0.63389593", "0.6335228", "0.63258433", "0.6325411", "0.6318565", "0.63085943", "0.6303471", "0.62923104", "0.62918985", "0.6287476", "0.628464", "0.6277287", "0.6277256", "0.62721664", "0.62420946", "0.62280613", "0.6215863" ]
0.68937236
13
Prompt the user before leave chat room
function leaveRoom() { const leaveRoom = confirm('Are you sure you want to leave the chatroom?'); if (leaveRoom) { window.location = '../index.html'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function leaveRoom() {\n let chatLink = server + '/chat/' + roomId;\n Swal.fire({ background: background, position: \"top\", title: \"Leave this room?\",\n html: `<p>If you want to continue to chat,</br> go to the main page and</br> click on chat of this room</p>`,\n showDenyButton: true, confirmButtonText: `Yes`, confirmButtonColor: 'black', denyButtonText: `No`, denyButtonColor: 'grey',\n }).then((result) => { if (result.isConfirmed) window.location.href = \"/main\"; });\n}", "function leaveUserRoom() {\r\n divHome.show();\r\n divRoom.hide();\r\n allMessageNb = 0;\r\n socket.emit(\"leaveRoom\", currentRoom);\r\n}", "function leaveRoom(channel) {\n socket.emit(\"leave\", {\"channel\": channel, \"username\": username})\n document.getElementById(\"messages\").innerHTML = \"\"\n }", "function leaveRoom() {\n socketRef.current.emit(\"user clicked leave meeting\", socketRef.current.id);\n props.history.push(\"/\");\n }", "function commandLeave(msg) {\n if (!canManageGuild(msg.member)) return;\n\n let guild = msg.guild.id.toString();\n let vc = client.voiceConnections.get(guild);\n if (!vc) {\n return msg.channel.sendMessage('Bot is not in a channel!');\n } else {\n vc.leaveSharedStream();\n vc.disconnect();\n writeGuildConfig(guild, { vc: null });\n\n return msg.channel.sendMessage(';_; o-okay...');\n }\n}", "function leaveroom(room) {\n document.querySelector('.chat').innerHTML = '';\n socket.emit('leave', { \"user\": user, \"room\": curr_room })\n}", "function leaveChat(){\n\tplayTitleFlag = false;\n\txmlHttp3 = GetXmlHttpObject();\n\n\tif (xmlHttp3 == null){\n\t\talert(\"Browser does not support HTTP Request\");\n\t\treturn;\n\t}\n\n\tvar url = base_url+\"keluarChat/\" + userId;\n\txmlHttp3.open(\"POST\", url, true);\n\txmlHttp3.onreadystatechange = stateChanged3;\n\txmlHttp3.send(null);\n}", "function leaveRoom()\n {\n // Leave room\n $(this).removeClass(\"joined\");\n socket.send(JSON.stringify({\n \"command\": \"leave\", // determines which handler will be used (see chat/routing.py)\n \"room\": room_id\n }));\n }", "function leaveRoom() {\n Swal.fire({ background: background, position: \"top\", title: \"Leave this room?\",\n showDenyButton: true, confirmButtonText: `Yes`, confirmButtonColor: 'black', denyButtonText: `No`, denyButtonColor: 'grey',\n }).then((result) => { if (result.isConfirmed) window.location.href = \"/main\"; });\n}", "function leaveRoom() {\n // Call the server to leave the room\n socketInstance.delete('/room/' + roomId + '/onlineUsers', { id: myChatId });\n\n }", "function LeaveRoom(room, username) {\n socket.leave(room);\n socket.broadcast.to(room).emit('ModRoomChangeReceive', { username: username, active: false });\n }", "function handleExit() {\r\n\tif (confirm('Are you sure you want to leave the game?')) {\r\n\t\tsocket.emit('toLeave');\r\n\t\tlocation.reload();\r\n\t}\r\n}", "async leaveGroupChat(parent, args, ctx, info) {\n // check login\n if (!ctx.request.userId) {\n throw new Error('You must be logged in to do that!');\n }\n // check that the user is the member of the group chat\n const where = { id: args.id };\n const chat = await ctx.db.query.talk({ where }, `{ members {id} }`);\n const isChatMember = chat.members\n .map(member => member.id)\n .includes(ctx.request.userId);\n if (!isChatMember) {\n throw new Error(`You are not a member of the chat!`);\n }\n\n // disconnect the current user\n return ctx.db.mutation.updateTalk(\n {\n data: {\n members: {\n disconnect: { id: ctx.request.userId },\n },\n },\n where: {\n id: args.id,\n },\n },\n info\n );\n }", "function C012_AfterClass_Amanda_EndChat() {\n\tif (ActorGetValue(ActorPose) == \"Kneel\") ActorSetPose(\"Shy\");\n\tLeaveIcon = \"Leave\";\n}", "function leaveRoom() {\n localStorage.removeItem(\"currentRoom\");\n setCurrentRoom(\"\");\n\n }", "function leaveCommand(player, message) {\n\troom.kickPlayer(player.id, \"Bye !\", false);\n}", "function leaveMeet() {\n\t// remove screen share stream if the user is sharing screen as well\n\tif (IsscreenShareActive) {\n\t\tStopScreenShare();\n\t}\n\n\tclientinstance.leave(\n\t\tfunction () {\n\t\t\tconsole.log(\"client leaves channel\");\n\t\t\tStreamsContainer.camera.stream.stop(); // stop the camera stream playback of the user\n\t\t\tclientinstance.unpublish(StreamsContainer.camera.stream); // unpublish the camera stream of the user\n\t\t\tStreamsContainer.camera.stream.close(); // clean up and close the camera stream of the user\n\t\t\t$(\"#remote-streams\").empty();\n\t\t\t//disable the UI elements which were enabled when the stream was received first time\n\t\t\t$(\"#mic-btn\").prop(\"disabled\", true);\n\t\t\t$(\"#video-btn\").prop(\"disabled\", true);\n\t\t\t$(\"#screen-share-btn\").prop(\"disabled\", true);\n\t\t\t$(\"#exit-btn\").prop(\"disabled\", true);\n\t\t\ttoggleVisibility(\"#mute-overlay\", false);\n\t\t\ttoggleVisibility(\"#no-local-video\", false);\n\t\t\tResizeGrid(); // resize grid after the user leaves\n\t\t\tredir(); // redirect back to meet room\n\t\t},\n\t\tfunction (err) {\n\t\t\tconsole.log(\"client failed to leave\", err); //error handling in case user couldnt leave properly\n\t\t}\n\t);\n}", "function leaveGame() {\n console.log(\"Leaving game...\");\n channelLeaveGame();\n }", "function SarahKickPlayerOut() {\n\tDialogLeave();\n\tSarahRoomAvailable = false;\n\tCommonSetScreen(\"Room\", \"MainHall\");\n}", "function leaveRoom(id, name) {\n var newMessage = {\n receiverId: id,\n body: `${getel('myName').value} has left!`,\n senderName: getel('myName').value,\n roomName: name\n }\n\n socket.emit('leave', name, newMessage)\n renderMessage(newMessage)\n}", "async function leaveChat(e) {\n if (roomId) {\n const db = window.firebase.firestore();\n window.roomRef = db.collection('rooms').doc(roomId);\n const messages = await window.roomRef.collection('messages').get();\n messages.forEach(async candidate => {\n await candidate.ref.delete();\n });\n await window.roomRef.delete();\n }\n //automatically signs out user on hangup.\n window.firebase.auth().signOut();\n window.location.reload();\n}", "function OnTriggerExit(col: Collider){\n\tif(col.gameObject.tag == \"Player\") {\n\t\thasEntered = false;\n\t\tif(stateManager != null) {\n\t\t\tstateManager.UpdateContextualState(ContextualState.None, false);\t\t\t\t// false = message does not disappear after a while\n\t\t}\n\t}\n}", "function leaveRoom() {\n\tif (player != \"\") {\n\t\troundEnded();\n\t\tvar geturl = \"/sanaruudukko/rest/sr/process?func=leaveroom&player=\" + player + \"&passcode=\" + passcode;\n\t\t$.ajax({\n\t\t\tcache: false,\n\t\t\tdataType : 'xml',\n\t\t\ttype : 'GET',\n\t\t\turl : geturl,\n\t\t\tsuccess : function(data) {\n\t\t\t\tinitRoomList();\n\t\t\t},\n\t\t});\n\t}\n}", "function leaveGame() {\n var gameID = currentGame.id;\n currentGame = undefined;\n socket.emit('boardleave', {\n gameID: gameID,\n boardID: boardID\n });\n openHomeScreen($(\"#gameLobbyScreen\"));\n}", "leave(id) {\n this.sock.send(JSON.stringify({action: 14, channel: 'room:' + id, presence: {action: 1, data: {}}}));\n }", "doLeave() {\n logger.log('do leave', this.myroomjid);\n const pres = Object(strophe_js__WEBPACK_IMPORTED_MODULE_1__[\"$pres\"])({\n to: this.myroomjid,\n type: 'unavailable'\n });\n this.presMap.length = 0; // XXX Strophe is asynchronously sending by default. Unfortunately, that\n // means that there may not be enough time to send the unavailable\n // presence. Switching Strophe to synchronous sending is not much of an\n // option because it may lead to a noticeable delay in navigating away\n // from the current location. As a compromise, we will try to increase\n // the chances of sending the unavailable presence within the short time\n // span that we have upon unloading by invoking flush() on the\n // connection. We flush() once before sending/queuing the unavailable\n // presence in order to attemtp to have the unavailable presence at the\n // top of the send queue. We flush() once more after sending/queuing the\n // unavailable presence in order to attempt to have it sent as soon as\n // possible.\n // FIXME do not use Strophe.Connection in the ChatRoom directly\n\n !this.connection.isUsingWebSocket && this.connection.flush();\n this.connection.send(pres);\n this.connection.flush();\n }", "function leaveRoom(connection) {\n\tif(connection&&connection.room) {\n\t\tvar index=connection.room.players.indexOf(connection.player);\n\t\tif(-1!==index) {\n\t\t\tconnection.room.players.splice(index,1);\n\t\t\troomsConnects[connection.room.id].splice(\n\t\t\t\troomsConnects[connection.room.id].indexOf(connection.sessid),1);\n\t\t\t// notifying players\n\t\t\troomsConnects[connection.room.id].forEach(function(destId) {\n\t\t\t\tconnections[destId].connection.sendUTF(JSON.stringify(\n\t\t\t\t\t{'type':'leave','player':connection.player.id})\n\t\t\t\t);\n\t\t\t});\n\t\t\tconnection.room=null;\n\t\t}\n\t}\n}", "function leaveRoom(){\n\n disableElements(\"leaveRoom\");\n var message = {\n id: \"leaveRoom\"\n };\n\n participants[sessionId].rtcPeer.dispose();\n sendMessage(message);\n participants = {};\n\n var myNode = document.getElementById(\"video_list\");\n while (myNode.firstChild) {\n myNode.removeChild(myNode.firstChild);\n }\n}", "function logoutUsr(){\r\n \t\t\r\n if(confirm(\"You will logged out of Chat\")){\r\n var usrName=\"\";\r\n \t if(document.getElementById(\"pageType\").value==\"chat\"){\r\n \t usrName =document.getElementById(\"usrName\").value;\r\n \t emitLogoutMsg(usrName);\r\n document.getElementById(\"usrName\").value=\"\";\r\n eraseCK(chatCK);\r\n window.location=chatUrl; \r\n \r\n \t }else {\r\n \t usrName =document.getElementById(\"usrAdmName\").value;\r\n \t emitLogoutMsg(usrName);\r\n document.getElementById(\"usrAdmName\").value=\"\";\r\n eraseCK(adminCK);\r\n window.location=adminUrl;\r\n \r\n }\r\n\r\n } \r\n }", "leave() {\n if (this.client.browser) return;\n const connection = this.client.voice.connections.get(this.guild.id);\n if (connection && connection.channel.id === this.id) connection.disconnect();\n }", "leaveChat() {\n return () => {\n this.bbmMessenger.chatLeave(this.chatId).then(() => {\n console.log(\"bbm-chat-header: left the chat\");\n });\n };\n }", "function handleUserLeaveRoom({ roomId }) {\r\n socket.leave(roomId);\r\n // Update corressponding object in usersArray\r\n updateUserRoom(socket, \"\");\r\n const [user, index] = findUserObject(socket);\r\n io.to(roomId).emit(\"userLeave\", {\r\n name: user.name,\r\n });\r\n }", "function leaveThanks(){\r\n\t//need to be able to feed back to 'edit', 'start', and 'confirm' :):)\r\n}", "function leaveRoom() {\n window.location = routeHome()\n }", "leaveRoom() {\n debug('videoChat:leaveRoom');\n const localMedia = this.get('stream');\n if (localMedia) {\n (localMedia.getTracks() || []).forEach(t => t.stop());\n }\n get(this, 'webrtc').leaveRoom(this.get('roomId'));\n get(this, 'webrtc').disconnect();\n (get(this, 'webrtc.webrtc.localStreams') || []).forEach(stream => stream.getTracks().forEach(t => t.stop()));\n }", "function SarahSophieFreePlayerAndAmandaTheyLeave() {\n\tif (LogQuery(\"RentRoom\", \"PrivateRoom\") && (PrivateCharacter.length < PrivateCharacterMax) && !LogQuery(\"LockOutOfPrivateRoom\", \"Rule\")) {\n\t\tSarahTransferAmandaToRoom();\n\t\tCommonSetScreen(\"Room\", \"Private\");\n\t}\n\telse {\n\t\tDialogLeave();\n\t\tCommonSetScreen(\"Room\", \"MainHall\");\n\t}\n\tSarahRoomAvailable = false;\n}", "Leave() {\n this.channel.leave();\n this.joined = false;\n this.isPlaying = false;\n delete globals.connections[this.channel.guild.id];\n }", "leaveRoom()\n {\n this.setRoom(null);\n }", "function leave() {\n document.getElementById(\"leave\").disabled = true;\n document.getElementById(\"join\").disabled = false;\n\n client.unpublish(localStream, function (err) {\n console.log(\"Unpublish local stream failed\" + err);\n });\n\n client.leave(function () {\n console.log(\"Leavel channel successfully\");\n }, function (err) {\n console.log(\"Leave channel failed\");\n });\n}", "onLeave(client, consented) {\n\t\tthis.state.history.push(`${client.sessionId} left AreaRoom.`);\n\t}", "function leaveClient() {\n\tsocket.emit('leave', {name: playerId});\n}", "function endGame(winner) {\n\tdisableAll();\t\n\tif(winner === 'user'){\n\t\tif (userName == ''){\n\t\t\tResult.render('winner','The winner is YOU!');\t\t\t\n\t\t}\n\t\telse{ \n\t\t\tvar msg = 'The winner is '+ userName;\n\t\t\tResult.render('winner',msg);\t\t\t\t\t\n\t\t}\t\t\n\t}\n\telse{\n\t\tResult.render('loser','The winner is a Computer!!!');\t\t\n\t}\t\t\n}", "function leaveRoom() {\n socket.emit('leave', {'username': username, 'room': room});\n\n document.querySelectorAll('.select-room').forEach(p => {\n p.style.color = \"black\";\n });\n}", "function leaveConversation() {\n var confirm = window.confirm(\"Are you sure you want to leave this conversation?\");\n if (confirm) {\n xhttp(\"POST\", \"leave-conversation.php\", {conversation: right.num}, (response) => {\n if (!response) {\n alert(\"There's a problem leaving this conversation.\");\n } else {\n alert(\"You have left this conversation.\");\n //Removes the entry from data.\n delete data.conversations[right.num];\n document.getElementById(\"right\").innerHTML = \"\";\n }\n });\n } \n}", "function chatOut (msg) {\n var nickname = $(\"#nickname\")[0].value;\n if (msg == \"\" || !msg)\n return;\n chatRef.push({\n id: id,\n name: (nickname ? nickname : id),\n message: msg,\n timestamp: new Date().getTime()\n })\n}", "function confirmExit() {\n if (g_IsNetworked && !g_IsNetworkedActive) return;\n\n closeOpenDialogs();\n\n // Don't ask for exit if other humans are still playing\n let askExit =\n !Engine.HasNetServer() ||\n g_Players.every(\n (player, i) =>\n i == 0 ||\n player.state != \"active\" ||\n g_GameAttributes.settings.PlayerData[i].AI != \"\"\n );\n\n let subject = g_PlayerStateMessages[g_ConfirmExit];\n if (askExit) subject += \"\\n\" + translate(\"Do you want to quit?\");\n\n messageBox(\n 400,\n 200,\n subject,\n g_ConfirmExit == \"won\" ? translate(\"VICTORIOUS!\") : translate(\"DEFEATED!\"),\n askExit ? [translate(\"No\"), translate(\"Yes\")] : [translate(\"OK\")],\n askExit ? [resumeGame, leaveGame] : [resumeGame]\n );\n\n g_ConfirmExit = false;\n}", "leaveVc(msg, bot, lang) {\r\n if (this.voiceConnection) {\r\n this.musicChannel.send(\r\n {\r\n embed: {\r\n type: 'rich',\r\n description: `⛔ Musique arrétée. Je part du channel : **${this.voiceConnection.channel.name}**.`,\r\n color: 3447003\r\n }}\r\n );\r\n\r\n this.musicChannel = null;\r\n if (this.dispatch) this.dispatch.end('leave');\r\n this.voiceConnection.disconnect();\r\n this.voiceConnection.removeAllListeners();\r\n\r\n this.changeStatus(Statustype.OFFLINE);\r\n\r\n this.voiceConnection = null;\r\n this.dispatch = null;\r\n } else {\r\n msg.channel.send(\r\n `I'm not in a voice channel! `\r\n );\r\n }\r\n }", "function detachPlayerFromRoom(request)\n {\n var diff_lvl = request.session.player.diff_lvl;\n var tag = request.session.player.player_tag;\n\n roomCount[diff_lvl]--;\n request.io.leave(diff_lvl);\n console.log('LEAVE [' + diff_lvl + '] (' + tag + '): roomCount=' + roomCount[diff_lvl] );\n \n if (roomCount[diff_lvl] > 0)\n {\n var player = { player_tag: tag };\n request.io.room('' + diff_lvl).broadcast('gamer_exited_room', player );\n console.log(\"BROADCAST [\" + diff_lvl + \"]: gamer_exited_room (\" + tag + \")\");\n }\n else\n {\n console.log(\"...not BROADCASTing, since room [\" + diff_lvl + \"] is empty\");\n }\n }", "handleClose() {\n this.room.leave(this);\n this.room.broadcast({\n type: 'note',\n text: `${this.name} left ${this.room.name}.`\n });\n }", "function cancelForgotUsername(){\n\tcloseWindow();\n}", "function endGame(msg) {\n //pop up alert message\n alert (`${msg}`);\n}", "function endGame(msg) {\n\t// TODO: pop up alert message\n\t// this delivers a special pop up alert when a player wins the game\n\tSwal.fire('Good job!', msg, 'success');\n}", "function leaveGame(sockId) {\n GameLobby.leftGame(sockId);\n}", "function hangUpCall() {\n closeVideoCall();\n\n sendToServer({\n // caller: my_profile?.userId,\n sendto: params?.userId,\n type: \"leave\",\n });\n }", "function leaveAllRooms() {\n reloadChatArea();\n $.post(\"/chatroom/leaveAll\", {username: username, reasonCode: 0}, function () {\n chatroomId = -1;\n getJoinedRooms();\n getChatRoomUsers();\n }, \"json\");\n}", "function denyTournament() {\n\tdocument.getElementById('askTournament').style.display = \"none\";\n\tvar data = JSON.stringify({\n\t\t'name' : PlayerName,\n\t\t'participate_tournament' : false\n\t});\n\tsocketConn.send(data);\n\tvar serverMsg = document.getElementById('serverMsg');\n\tserverMsg.value += (\"\\n> waiting for other players to finish tournament\");\n}", "function clientDisconnect(data) {\n\tshowNewMessage(\"notification\", {msg: '<b> ~ '+data.username+' left the chatroom. ~</b>'});\n\tMaterialize.toast(data.username+' left the chatroom.', 2000);\n\tremoveUserFromList(data);\n}", "function leaveBooking() {\n if (localStorage.getItem(\"bookingRoom\")) {\n localStorage.removeItem(\"bookingRoom\");\n }\n // return \"Leaving booking page !\";\n}", "function notifyLogout(userFound){\n if(userFound !== false){\n // echo globally that this client has left\n socket.broadcast.emit('user left', {\n username: socket.username,\n numUsers: 1\n });\n userFromMemory.isOnline = false;\n sendPlayer(userFromMemory);\n }\n }", "function endGame(msg) {\n\t// TODO: pop up alert message\n\talert(msg);\n\tgameLive = false;\n}", "function OnLeaveTeamPressed () {\n Game.PlayerJoinTeam(DOTATeam_t.DOTA_TEAM_NOTEAM);\n}", "function endChat() {\n\t\t\t\tlogger.debug(\"endChat\", \"...chatState=\"+chatState);\n\t\t\t\t\n\t\t\t\tif (chat && (chatState == chat.chatStates.CHATTING || chatState == chat.chatStates.RESUMING \n\t\t\t\t\t|| chatState == chat.chatStates.WAITING)) { //|| chatState == chat.chatStates.NOTFOUND\n\t\t\t\t\t\n\t\t\t\t\tvar endChatParam = {\n\t\t\t\t\t\t\t\tdisposeVisitor : true,\n\t\t\t\t\t\t\t\tcontext : myChatWiz,\n\t\t\t\t\t\t\t\tskill : skill,\n\t\t\t\t\t\t\t\terror: function(data) {\n\t\t\t\t\t\t\t\t\tlogger.debug(\"endChat.error\", data);\n\t\t\t\t\t\t\t\t\tchatWinCloseable = true;\n\t\t\t\t\t\t\t\t\tendChatHandler();\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t/* send endChat request and waiting for endChat event call back */\n\t\t\t\t\tvar failedRequest = chat.endChat(endChatParam);\n\t\t\t\t\t\t\t\n\t\t\t\t\tif (failedRequest && failedRequest.error) {\n\t\t\t\t\t\tlogger.debug(\"endChat.error2\", failedRequest);\n\t\t\t\t\t\tchatWinCloseable = true;\n\t\t\t\t\t\tendChatHandler();\t\n\t\t\t\t\t}\n\t\t\t\t}else if(chatState == chat.chatStates.INITIALISED){\n\t\t\t\t\tendChatHandler();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}", "function SarahAmandaLeaveRoom() {\n\tfor (let C = 1; C < SarahCharacter.length; C++)\n\t\tif (SarahCharacter[C].Name == \"Amanda\")\n\t\t\tSarahCharacter.splice(C, 1);\n\tAmandaInside = false;\n\tDialogLeave();\n}", "function leavePageWith(stateString) {\n socketRef.current.emit('leave-room-silently', currentUser.uid, room);\n history.push('/after', {\n state: { match_id: match_id, type: stateString },\n });\n }", "function leaveTeam(context) {\n teamsService.leaveTeam()\n .then(function (res) {\n sessionStorage.clear();\n auth.saveSession(res);\n auth.showInfo(`Successfully leave the team!`);\n context.redirect('#/catalog');\n }).catch(auth.handleError);\n }", "sendLeavePortalRequest() {\n log.debug('Sending request to leave portal.');\n const msgHeader = new MessageBuilder().\n setType(LEAVE_PORTAL_REQUEST).\n setPortalHostPeerId(this.portalHostPeerId).\n setTargetPeerId(this.portalHostPeerId).\n setSenderPeerId(this.localPeerId).\n getResult();\n const message = new MessageBuilder().\n setHeader(msgHeader).\n getResult();\n this.emitter.emit('enqueue-message', message);\n }", "function joinRoom(room)\r\n{\r\n //TODO erase... Name must be known previously\r\n var name = '';\r\n while(name == '')\r\n {\r\n name = prompt(\"Wie heißt du?\");\r\n }\r\n\r\n socket.emit('requestRoom', room, name);\r\n document.getElementById(\"chooseRoom\").classList.add('hidden');\r\n \r\n //TODO: maybe show loading icon...\r\n}", "function send_off_game_message() {\n var chat_msg = $('#chat_msg').val();\n var chat_to = $('#chat_to').val();\n if (check_field_empty(chat_msg, 'message, cannot send empty message'))\n return false;\n if (check_field_empty(chat_to, 'recipient, no recipient specified'))\n return false;\n var dataObj = {\n \"content\" : [\n { \"session_id\" : get_cookie() },\n { \"to\" : chat_to },\n { \"content\" : chat_msg }\n ]\n };\n call_server('user_msg', dataObj);\n}", "exitHandler() {\n this.saveUser(this.user);\n Channel.botMessage(`\\nGoodbye, ${this.user}!\\n\\n`);\n database.save(chatDB);\n process.exit(0);\n }", "function disappear(){\n\tif (document.getElementById(\"prompt\")){\n\t\tvar prompt = document.getElementById(\"prompt\");\n\t\tprompt.parentNode.removeChild(prompt);\n\t}\n}", "leaveCourt() {\n // User is not queued and is thus playing on this court\n this.props.removeUserFromActive();\n }", "function OnLeaveTeamPressed()\n{\n\tGame.PlayerJoinTeam( DOTATeam_t.DOTA_TEAM_NOTEAM );\n}", "function SarahLeaveRoom() {\n\tfor (let C = 1; C < SarahCharacter.length; C++)\n\t\tif (SarahCharacter[C].Name == \"Sarah\")\n\t\t\tSarahCharacter.splice(C, 1);\n\tSarahInside = false;\n\tDialogLeave();\n}", "function handleDisconnect() {\r\n console.log(\"disconect received\", { socket });\r\n // Find corressponding object in usersArray\r\n const [user, index] = findUserObject(socket);\r\n\r\n // Emit to room\r\n io.to(user.room).emit(\"userLeave\", {\r\n name: user.name,\r\n });\r\n\r\n // Remove user object\r\n removeUserObject(socket);\r\n }", "function leaveRoom(socket, userId) {\n const roomID = socketToRoom[userId];\n let room = users[roomID];\n if (room) {\n room = room.filter(user => user.id !== userId);\n users[roomID] = room;\n }\n socket.broadcast.emit('user left', userId);\n}", "function cancel_function() {\n var testV = 1;\n var pass1 = prompt('Please Enter Your Password','password');\n while (testV < 3) {\n if (pass1.toLowerCase() == \"letmein\") {\n cancel_rn = prompt(\"Which room would you like to cancel reservation?\");\n for (var i = 0; i < rooms.length; i++) {\n if(cancel_rn == rooms[i].number){\n rooms[i].duration_start = \"-\";\n rooms[i].duration_end = \"-\";\n rooms[i].open = \"Open\";\n rooms[i].breakTime = 0;\n break;\n }\n }\n loadRooms();\n \n break;\n } \n else {\n testV+=1;\n var pass1 = prompt('Access Denied - Password Incorrect, Please Try Again.','Password');\n }\n }\n if (pass1.toLowerCase()!=\"password\" & testV ==3)\n history.go(-1);\n return \" \";\n}", "function handleMessage(){\n if(currentRoom != old){\n \n var message = $('.chat-input input').val().trim();\n if(message){\n // send the message to the server with the room name\n var msg = new Messaging.Message(JSON.stringify({nickname: nickname, message: message, timestamp: Date.now()}));\n msg.destinationName = atopicName(currentRoom);\n msg.qos = 1;\n mqttClient.send(msg);\n \n $('.chat-input input').val('');\n } \n }}", "function endgame() {\n inquirer\n //ask if the user would like to continue via a y or n prompt \n .prompt({\n name: \"continue\",\n type: \"confirm\",\n message: \"Would you like to order more beans?\",\n })\n .then(function(answer) {\n // based on their answer, either run queryBeans function (i.e. start over) or end the connection and exit the app\n if (answer.continue === true) {\n queryBeans();\n }\n else{\n connection.end();\n return;\n }\n });\n }", "handleOpponentLeaving()\n {\n console.log(\"opponent left\")\n playSound(\"oppLeft\");\n if(game.state.current===\"ticTac\")\n {\n Client.disconnectedFromChat({\"opponent\": game.opponent});\n game.state.start(\"waitingRoom\");\n }\n else\n {\n game.challengingFriend = false\n game.firstPlay = true\n }\n game.opponentLeft = true;\n $('#opponentCard').css({ 'right': '0px', 'right': '-20%' }).animate({\n 'right' : '-20%'\n });\n }", "function quit() {\n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"menu\",\n message: \"Would you like to go back to the main menu?\"\n }\n ]).then(function (arg) {\n if (arg.menu === false) {\n connection.end();\n process.exit();\n } else {\n userPrompt();\n }\n });\n}", "function PromptNotActive(){}", "function prepsend() {\n\tvar text = Chatbox.input.value;\n\tChatbox.input.value = null;\n\tswitch (text) {\n\tcase \"/version\":\n\t\tAPI.version();\n\t\treturn;\n\t}\n\tAPI.sendMsg(text);\n}", "function endGame() {\r\n\t\tgameOver = true;\r\n\t\tsetMessage2(\"Game Over\");\r\n\t}", "leaveRoom(roomName, ack) {\n /**\n * Leave the room. The leave method is internal to the socket.io\n * socket instance.\n */\n this.socket.leave(roomName);\n\n /**\n * Log the leave room action.\n */\n this.logger.info([this.socket.id, 'left room', roomName].join(' '));\n \n /**\n * Update the list of created rooms.\n */\n this.socketManager.updateRooms();\n\n /**\n * This acknowledge function essentially sends a message back to the client\n * acknowledging that the server received the send event. This particular\n * ack returns true that the server successfully removed the client from\n * the room.\n */\n ack(roomName);\n }", "quit_game(){\n this.room = DEFAULT_CHATROOM;\n this.socket.emit('game:stop', { chatroom: this.room });\n delete this.game;\n }", "function confirmClose()\r\n{\r\n if (g_bActive && event.clientY < 0)\r\n {\r\n event.returnValue = 'And do you want to quit this chat session also?';\r\n// setTimeout('myclose=false',100);\r\n// myclose=true;\r\n }\r\n}", "function logOut() {\n input = readline.question(\"Are you sure you want to log out? (yes / no)\\n>> \");\n if (input === \"yes\") {\n console.log(\"Logging out, thanks for using MustGet Banking CLI!\");\n // Clear user\n user = {};\n // If user wants to logout, return back to beginning of program\n currentLoc = \"start\";\n } else if (input === \"no\") {\n console.log(\"Ok, returning to menu\");\n // If user doesn't want to logout, return back to menu.\n currentLoc = \"menu\";\n }\n}", "function func_close_join_room_pop() {\n join_room.css(\"display\", \"none\");\n}", "function endGame(msg) {\n\t// TODO: pop up alert message\n\talert(msg);\n}", "function userMsgSend(e){\n\tif(e.which==13){\n\t\tif($('#userText').val()!=0){\n\t\t\topenAdminOpChat();\n\t\t}\n\t}\n}", "function leaveClassroomClientSide(id) {\n\tvar classroomid = clients[id].classroomid;\n\tsendMessage(id, new Message(\"*\", \"server\", \"classroomid,undefined\"));\n\tsendMessage(id, new Message(\"*\", \"server\", \"permissions,undefined\"));\n\tsendMessage(id, new Message(\"message\", \"server\", \"Disconnecting from classroom\"));\n}", "function endGame(msg) {\n // TODO: pop up alert message\n alert(msg)\n}", "function SarahSophieLeaveRoom() {\n\tfor (let C = 1; C < SarahCharacter.length; C++)\n\t\tif ((SarahCharacter[C].Name == \"Sophie\") || (SarahCharacter[C].Name == \"Mistress Sophie\"))\n\t\t\tSarahCharacter.splice(C, 1);\n\tSophieInside = false;\n\tDialogLeave();\n}", "function main(msg) {\n // Check if user types 'leave\n if (msg.content === '\\'leave') {\n // Check if the user is in the same voice channel\n if (msg.member.voice.channel) {\n // Make the bot leave\n msg.member.voice.channel.leave();\n // Delete the user's message\n msg.delete();\n }\n } else if (msg.content === '\\'stop') {\n // Play nothing\n play(msg, '', volume);\n } else if (msg.content === '\\'cmd') {\n // Run the commands method\n commands(msg);\n }\n}", "function endConversationReceived(param) {\r\n\tendConversation(param);\r\n\tnotifyToolbar();\r\n}", "function leave_channel(message, channel)\n{\n\tlet c = find_channel(channel);\n\tlet role = message.guild.roles.find(r => r.name === c.role);\n\t//let role = message.member.roles.find(r => r.name === c.role);\n\n\tif (role == undefined) {\n\t\treturn false;\n\t}\n\n\tif (!c.optout) {\n\t\tif (!message.member.roles.has(role.id)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tmessage.member.removeRole(role);\n\t} else {\n\t\tmessage.member.addRole(role);\n\t}\n\treturn true;\n}", "closeChat() {\n if (this.messagesRef ) {\n this.messagesRef.off();\n }\n }", "socketsLeave(room) {\r\n this.adapter.delSockets({\r\n rooms: this.rooms,\r\n except: this.exceptRooms,\r\n }, Array.isArray(room) ? room : [room]);\r\n }", "function endConversationHandler() {\r\n endConversation(tabs.getActiveTab().title);\r\n\r\n //send end conversation system message'\r\n conn.request({\r\n url: CONTACT_LIST_JSON_URL,\r\n method: 'POST',\r\n params: { method: \"endConversation\", userId:tabs.getActiveTab().title},\r\n success: function(responseObject) {\r\n },\r\n failure: function() {\r\n\t Ext.Msg.alert(getLocalizationValue('application.javascript.messagingWindow.alert.errorTitle'), getLocalizationValue('application.javascript.messagingWindow.alert.errorMsg'));\r\n }\r\n });\r\n}", "function endGame(msg) {\n // TODO: pop up alert message\n alert(msg);\n}" ]
[ "0.7367518", "0.7307474", "0.72227997", "0.7046869", "0.6863847", "0.68358433", "0.68050003", "0.6736533", "0.66827023", "0.66460466", "0.6634746", "0.6505397", "0.6496834", "0.6462929", "0.6460044", "0.64054745", "0.6391411", "0.6321094", "0.6310152", "0.62895876", "0.62817484", "0.6198753", "0.613407", "0.6119738", "0.6105933", "0.6100672", "0.6092192", "0.60802233", "0.6076658", "0.60501844", "0.6024035", "0.59923023", "0.5973529", "0.5972423", "0.59267", "0.5924167", "0.5899115", "0.5892778", "0.5878221", "0.58633256", "0.58608836", "0.5850646", "0.5845452", "0.58444387", "0.5829315", "0.5825856", "0.57990414", "0.5794012", "0.5788164", "0.5780917", "0.5779853", "0.5778756", "0.57551295", "0.5732102", "0.57315254", "0.5725374", "0.56952757", "0.5672169", "0.56717753", "0.5625015", "0.561606", "0.561373", "0.5611756", "0.5593723", "0.5589702", "0.5588916", "0.55855805", "0.5578352", "0.5577689", "0.5561705", "0.5561209", "0.5561171", "0.5553398", "0.5544924", "0.5542591", "0.5537021", "0.5512005", "0.5507795", "0.5500571", "0.55001706", "0.5499985", "0.54980934", "0.54947335", "0.54913", "0.5488004", "0.5484479", "0.5484116", "0.5482841", "0.54770094", "0.54770076", "0.5470186", "0.54696256", "0.5455271", "0.5452669", "0.54515994", "0.5450089", "0.54493284", "0.54436445", "0.5437331", "0.54362696" ]
0.72276896
2
Add room name to DOM
function outputRoomName(room) { const roomName = document.getElementById('room-name'); roomName.innerHTML = room; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function outputRoomName(room) {\n roomName.innerHTML = `<li class=\"contact\">\n <div class=\"wrap\">\n <div class=\"meta\">\n <p class=\"name\">${room}</p>\n </div>\n </div>\n </li>`\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room) {\n \n roomName.innerText = room;\n}", "function outputRoomName(room) {\r\n roomName.innerText = room;\r\n}", "function outputRoomName(room) {\r\n roomName.innerText = room;\r\n}", "function outputRoomName(room){\n roomName.innerHTML = room;\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room) {\n roomName.innerText = room;\n}", "function outputRoomName(room){\n roomName.innerText = room;\n}", "function outputRoomName(room){\n roomName.innerHTML = room;\n }", "function outputRoomName(room){\n roomName.innerText = room;\n}", "function outputRoomName(room){\n roomName.innerText=room;\n}", "function outputRoomname(room){\n roomName.innerText = room;\n}", "function outputRoomname(room){\n roomName.innerText= room;\n}", "function outputRoomName(room){\n\n roomName.innerText=room;\n\n}", "function setRoom(name) {\n\t$('#joinRoom').remove();\n\t$('h1').text('Room name : ' + name);\n\t$('body').append('<input type=\"hidden\" id=\"roomName\" value=\"'+name+'\"/>');\n\t$('body').addClass('active');\n}", "function setChatroom(room) {\n $('#chatroom h1').append(room);\n}", "function createRoom(name)\n\t{\n\t\tdocument.getElementsByClassName('dropdown-item selected')[0].className = 'dropdown-item'\n\n\t\tvar room = document.createElement('div')\n\t\troom.className = 'dropdown-item selected'\n\t\troom.innerText = name\n\t\tcreateDropdownClickMethod(room)\n\t\tget('create-room-name').value = ''\n\n\t\tdropdown.appendChild(room)\n\t\tdropdown.className = 'dropdown closed'\n\t}", "function setRoom(name) {\r\n $('#createRoom').remove();\r\n $('h1').text(name);\r\n // $('#subTitle').text(name + \" || link: \"+ location.href);\r\n $('body').addClass('active');\r\n}", "function addRoom(room){\n $outer.append(Mustache.render(roomTemplate, room));\n }", "function populateRoomListView(user) {\n var name = document.getElementById(\"roomName\");\n var desc = document.getElementById(\"roomDesc\");\n var destroydate = document.getElementById(\"roomDest\");\n //var privacy = document.getElementById(\"privacy\");\n name.innerHTML = \"<strong>\"+room.Name+\"</strong>\";\n desc.innerHTML = room.Description;\n}", "function setRoom(name) {\n $('form').remove();\n $('h1').text(name);\n $('#subTitle').text('Link to join: ' + location.href);\n $('body').addClass('active');\n }", "function createRoomButton(roomInfo) {\n var header = roomInfo.name.charAt(0);\n\n var id = roomInfo.id;\n var room = `<li>\n <a href=\"#\" data-id=`+ roomInfo.id + `>\n <input type=\"hidden\" id=`+ id +` value=`+ roomInfo.name +` />\n <div class=\"media\" data-id=`+ roomInfo.id + ` class=\"list-group-item\">\n <div class=\"chat-user-img online align-self-center mr-3\" data-id=`+ roomInfo.id + ` >\n <div class=\"avatar-xs\" data-id=`+ roomInfo.id + `>\n <span class=\"avatar-title rounded-circle bg-soft-primary text-primary\" data-id=`+ roomInfo.id + `>\n ` + header.toUpperCase() + `\n </span>\n </div>\n </div>\n <div class=\"media-body overflow-hidden\" data-id=`+ roomInfo.id + `>\n <h5 class=\"text-truncate font-size-15 mb-1\" data-id=`+ roomInfo.id + `>` + roomInfo.name + `</h5>\n <p class=\"chat-user-message text-truncate mb-0\" data-id=`+ roomInfo.id + `>Hey! there I'm available</p>\n </div>\n </div>\n </a>\n </li>`;\n\n return room;\n}", "function createRoomElement(room){\n\tvar room_li = \n\t$(document.createElement(\"li\"))\n\t.attr(\"class\",\"\")\n\t.attr(\"room_id\", room.roomID)\n\t.append(\n\t\t\t$(document.createElement(\"a\"))\n\t\t\t.attr(\"data-toggle\", \"tab\")\n\t\t\t.text(room.name + \" (\" + room.userCount + \")\" )\n\t\t\t.click(function (event){\n\t\t\t\t//Pauses message fetching, joins the room\n\t\t\t\tjoinRoom($(event.target).parent().attr(\"room_id\"), true);\n\t\t\t})\n\t);\n\treturn room_li;\n}", "room({id, title}) {\n return $('<a class=\"xmpp-room\">')\n .attr({\n title: id,\n href: '#' + id,\n 'data-room': id,\n })\n .text(title || id)\n .addClass((id == xmpp.room.current) && 'xmpp-room-current');\n }", "function writeNameNE() {\n\t\tvar namesp = document.createElement(\"span\");\n\t\tnamesp.setAttribute(\"id\", this.id + \"name\");\n\t\tvar elem = document.getElementById(this.id).appendChild(namesp);\n\t\telem.style.position = \"absolute\";\n\t\tif (this.nameLocation == NAME_UP) {\n\t\t\telem.style.top = 0;\n\t\t\telem.style.paddingTop = \"1px\";\n\t\t} else if (this.nameLocation == NAME_DOWN) {\n\t\t\telem.style.top = this.height - 20;\n\t\t\telem.style.paddingTop = \"7px\";\n\t\t} else if (this.nameLocation == NAME_CENTER) {\n\t\t\telem.style.top = this.height / 2 - 10;\n\t\t\telem.style.paddingTop = \"5px\";\n\t\t}\n\t\telem.style.left = 0;\n\t\telem.style.width = this.width;\n\t\telem.style.height = 20;\n\t\telem.style.zIndex = 7;\n\t\telem.style.cursor = \"move\";\n\t\telem.style.color = this.textColor;\n\t\telem.style.textAlign = \"center\";\n\t\telem.style.fontFamily = \"Arial\";\n\t\telem.style.fontSize = \"10px\";\n\t\telem.innerText = this.name;\n\t\telem.parentObj = this;\n\t}", "function generateNewRoom(name) {\n\t\n\t//send the request to the server\n\tvar posting = $.post(roomsURI + \"/add\", {\n\t\tname : name\n\t});\n\t\n\t//Send new room to server\n\tposting.done(function(data) {\n\t\tvar room = JSON.parse(JSON.stringify(data));\n\t\t//$(\"#chat-rooms-list\").children(\"li[room_id!=2]\").remove(); //remove the last room\n\t\t//$(\"#chat-rooms-list\").append(createRoomElement(room)); //add this in it's place\n\t\t$(\"#chat-rooms-dropdown-list\").append(createRoomElement(room));\n\t\troom_id_list.push(room.roomID);\n\t\tjoinRoom(room.roomID,true);\n\t});\n}", "function addUNameToDom(name) {\r\n\tconst paraElement = document.createElement('p')\r\n\tparaElement.innerHTML = '<strong>From user: </strong>' + name\r\n\treturn paraElement\r\n}", "function user_name(){\n\t\tvar name = document.createElement(\"div\");\n\t\tname.textContent = \"NAME\";\n\t\tname.setAttribute(\"class\", \"user_name\");\n\t\tdiv.appendChild(name);\n\t}", "function createRoomEntry(room) {\n\t\tvar roomHtml = creationRoomWidgetHeader(room.name);\n\t\troomHtml += createImageWidget(room.images);\n\t\troomHtml += createRoomWidgetFooter(room.price);\n\t\t// create room HTML\n\n\n\t\treturn roomHtml;\n\t}", "function addPersonToRoom (room_name, id, person_name) {\n \t// we store the person name in the socket session as people of the current room\n\t// e.g. { socket.id: nameOfThePerson }\n \tfor (var i=0; i<chatRooms.length; i++) {\n \t\tif (chatRooms[i]['roomname'] === room_name) {\n \t\t\tchatRooms[i].people[id] = person_name;\n \t\t}\n \t}\n }", "function changeStateRoom(room) {\n let roomSelector = $(room.$el);\n let roomName = roomSelector.find(\".room-name\");\n\n roomName.text(\"Réserver la salle \" + roomName.text() + \" ?\");\n roomName.after('<select name=\"duration\">' +\n ' <option value=\"0.5\">30 min</option>' +\n ' <option value=\"1\">1H</option>' +\n ' <option value=\"2\">2H</option>' +\n ' <option value=\"3\">3H</option>' +\n ' <option value=\"4\">4H</option>' +\n ' </select>');\n roomSelector.find(\".room-book\").hide();\n roomSelector.find(\".room-confirm\").show();\n}", "function displayRoom (room) {\n let occupantMsg = ''\n if (room.character === '') {\n occupantMsg = ''\n } else {\n occupantMsg = room.character.describe() + '. '\n }\n\n const textContent = room.describe() +\n '</p>' + '<p>' + occupantMsg + '</p>' + '<p>' + room.getDetails() + '</p>'\n\n document.getElementById('textarea').innerHTML = textContent\n document.getElementById('ui').focus()\n}", "function displayRoomInfo(room) {\r\n document.body.style.background = room.background;\r\n document.body.style.backgroundSize = `cover`;\r\n document.getElementById(`errors`).style.display = `none`;\r\n document.getElementById(`items`).style.display = `none`;\r\n document.getElementById(`health`).style.display = `none`;\r\n document.getElementById(\r\n `title`\r\n ).innerHTML = `<h1>${room.name.toUpperCase()}</h1>`;\r\n document.getElementById(`location`).innerHTML = room.location();\r\n document.getElementById(`description`).innerHTML = `${room.description}`;\r\n document.getElementById(`directions`).innerHTML = `${room.directions}`;\r\n document.getElementById(`buttonarea`).style.display = `none`;\r\n document.getElementById(`health-area`).style.display = `inline-block`;\r\n document.getElementById(`inventory-area`).style.display = `inline-block`;\r\n document.getElementById(`userinput`).style.display = `inline-block`;\r\n document.getElementById(`usertext`).focus();\r\n}", "function appendName(identity, container) {\n const name = document.createElement(\"p\");\n name.id = `participantName-${identity}`;\n name.className = \"instructions\";\n name.textContent = identity;\n container.appendChild(name);\n}", "function updateName1OnDOM() {\n db.ref('Names/player1').once('value', function (snapshot) {\n name = snapshot.val();\n if (name !== null) {\n var a = $('<h3>').html(name).addClass('center-block');\n $('.player1-name').empty().append(a);\n }\n });\n }", "function getNewContactHtml(jid, name) {\n var jid_id = XMPP_client.jid_to_id(jid);\n\n return $(\"<li id='\" + jid_id + \"'>\"\n + \"<input type='hidden' class='jid_value' value=\"\n + jid +\n \" /><div class='roster-contact offline'>\" +\n \"<div class='roster-name'>\" +\n name +\n \"</div><button class='btn btn-mini btn-primary roster-jid \"\n + jid\n + \"' type='button'>\" +\n \"Open chat\" +\n \"</button>\"\n + \" <button class='btn btn-mini get-inbox' id='msg|\"+ jid +\"' type='button'>Recent messages</button>\"\n + \"</div><button class='close' id='removeContact'>&times;</button>\" +\n \"</li>\");\n}", "function showRoomList(data) {\n\tvar $room = $(data).find(\"room\");\n\n\tvar roomlist = \"\";\n\n\t$room.each(function () {\n\t\troomlist += \"<div><a href='#' onclick='joinroom(\" + $(this).find(\"id\").text() + \n\t\t \");'>Room: \" + $(this).find(\"roomname\").text() + \n\t\t \", Players: \" + $(this).find(\"players\").text() + \"</a></div>\";\n\t});\n\t\n\tif (roomlist == \"\") { roomlist = \"Ei aktiivisia huoneita.\"; }\n\t\n\t$(\"#roomlist\").html(roomlist);\n}", "function updateName2OnDOM() {\n db.ref('Names/player2').once('value', function (snapshot) {\n name = snapshot.val();\n if (name !== null) {\n var a = $('<h3>').html(name).addClass('center-block');\n $('.player2-name').empty().append(a);\n }\n });\n }", "function assignName() {\n var locationNameHolder = scope.querySelectorAll(\"[data-vf-js-location-nearest-name]\");\n if (!locationNameHolder) {\n // exit: container not found\n return;\n }\n if (locationNameHolder.length == 0) {\n // exit: content not found\n return;\n }\n // console.log('assignName','pushing the active location to the dom')\n locationNameHolder[0].innerHTML = locationName;\n }", "function buildRoomInfoHtmlBlock() {\n var roomHtml = \"<li class='list-unstyled'>Adults\";\n roomHtml += \"<select class='adultQty'></select></li>\";\n roomHtml += \"<li class='list-unstyled'>Children\";\n roomHtml += \"<select class='childrenQty'></select></li>\";\n return roomHtml;\n }", "function addRoomList(data) {\r\n let room = createElement('li', data);\r\n room.class('rooms');\r\n room.id(data);\r\n rooms.push(room);\r\n roomsName.push(data);\r\n room.parent(\"#activeRooms\");\r\n}", "function joinUserRoom(name) {\r\n divHome.hide();\r\n divRoom.show();\r\n socket.emit(\"joinRoom\", name);\r\n currentRoom = name;\r\n}", "function createNameNode(newName){\n var nameDiv = document.createElement(\"div\");\n nameDiv.setAttribute(\"class\", \"col-lg-2\");\n //console.log(\"nameDiv: \", nameDiv);\n var nameSpan = document.createElement(\"span\");\n nameSpan.setAttribute(\"class\", \"product-name\");\n nameSpan.innerHTML = newName;\n nameDiv.appendChild(nameSpan);\n \n return nameDiv\n }", "function createName(name) {\n const nameElement = createElement({ tagName: 'span', className: 'name' });\n nameElement.innerText = name;\n \n return nameElement;\n }", "EnterRoom(id, name, room, img){\n var roomName = {id, name, room, img}; //object disractury \n this.globalRoom.push(roomName);\n return roomName;\n }", "function getRoom(){\n\tvar chatName = document.getElementById(\"chatName\");\n\tif(!chatName)\n\t\treturn null;\n\treturn chatName.innerText;\n}", "function joinRoom(room)\r\n{\r\n //TODO erase... Name must be known previously\r\n var name = '';\r\n while(name == '')\r\n {\r\n name = prompt(\"Wie heißt du?\");\r\n }\r\n\r\n socket.emit('requestRoom', room, name);\r\n document.getElementById(\"chooseRoom\").classList.add('hidden');\r\n \r\n //TODO: maybe show loading icon...\r\n}", "function makeName(role) {\n\tlet title = getTitle(role);\n\tif (role == \"default\") { role = \"Committee\"; }\n\tlet member = document.createElement(\"p\");\n\tmember.setAttribute(\"style\", \"font-weight: bold\");\n\tlet memberText = document.createTextNode(title);\n\tmember.setAttribute(\"class\", \"member\");\n\tmember.appendChild(memberText);\n\t\n\treturn member;\n}", "function create_game_room_card(name, players_in_game, max_players) {\r\n\r\n const card = document.createElement(\"div\");\r\n card.setAttribute('class', 'room-card');\r\n\r\n const room_name = document.createElement(\"h2\");\r\n room_name.innerText = name;\r\n card.appendChild(room_name);\r\n\r\n const ctj_text = document.createElement(\"h5\");\r\n ctj_text.innerText = \"Click to join!\"\r\n card.appendChild(ctj_text);\r\n\r\n const player_in_room = document.createElement(\"p\");\r\n player_in_room.innerText = \"Players: \" + players_in_game + \"/\" + max_players;\r\n player_in_room.setAttribute(\"class\", \"numOfPlayers\");\r\n card.appendChild(player_in_room);\r\n\r\n\r\n card.classList.add(\"room-card\");\r\n\r\n room_card_container.appendChild(card);\r\n\r\n}", "function characterName() {\n var characterName = document.getElementById('characterName');\n if (characterName) {\n characterName.innerHTML = userName + ' the ' + avatarClass;\n }\n}", "function append(location, name, value) {\n\tdocument.querySelector('.' + location + ' .' + name).innerHTML += value;\n}", "function Shopper(shopperName){\n document.getElementById(\"shopperName\").appendChild(document.createTextNode(shopperName))\n}", "function add_room(creator, name){\n const room = {creator, name};\n // save room info to room list\n rooms.push(room);\n}", "function renderName (name, level, icon) {\n\tconst result = \n\t`\n\t<div class=\"container border\">\n\t\t<h1><img src=${iconURL+ icon}.png alt='Player Icon' class='icon'> ${name} Level: ${level}</h1>\n\t</div>\n\t`;\n\t$('div.player-name').html(result);\n}", "function appendNewDoor(tap) {\n \n appendNewElement(tap, doorstrings, DoorsConfiguration);\n \n \n \n \n \n // var newListItem = createElement(\"div\",{\"id\":\"name\"},tap.Name);\n \n \n /*\n <div class=\"tap\" id=\"tap-000\">\n <label>Good Beer</label>\n <div class=\"status\"> </div>\n <button type=\"submit\" id=\"open-tap-000\">Open Tap</button>\n </div>\n */\n}", "function addRoom() {\n\tvar roomName = $('#add-room-name').val();\n\tvar posting = $.post(roomsAddURI, {\n\t\tname : roomName\n\t});\n\tposting.done(function(data) {\n\t\t//Add room via rest api then join it\n\t\tvar room = JSON.parse(JSON.stringify(data));\n\t\tjoinRoom(room.roomId, true);\n\t});\n}", "function enterRoom(name)\n{\n document.getElementById('classSearchResults').style.display = 'none';\n document.getElementById('classSearch').value = '';\n setClassSearchBoxValue(); //reset the search box to say \"Search Classes\"\n name = name.split(' - '); \n pfc.sendRequest('/join ' + name[0]); //name the room {DEP} {Class#} Sec. {Section#}\n}", "function addRoom(room) {\n\n // Get a handle to the room list <select> element\n var select = $('#rooms-list');\n\n // Create a new <option> for the <select> with the new room's information\n //var users = room.users || [];\n //var numUsers = users.length;\n var option = $('<option id=\"' + \"room-\" + room.id + '\" data-name=\"' + room.Product.name + '\" value=\"' + room.id + '\" onClick=\"chooseRoom(' + room.id + ')\">' + room.Product.name + ' (' + room.LastMessage.message + ')</option>');\n\n // Add the new <option> element\n select.append(option);\n}", "function getRoomTitle(sRoomTitle) {\n var sResult = \"\";\n if (showRoomTitles) {\n if (sRoomTitle !== \"\") {\n sResult = \" (\" + sRoomTitle + \")\";\n }\n }\n return sResult;\n}", "function createUserRoom(data) {\r\n inputRoomName.value('');\r\n divHome.hide();\r\n divRoom.show();\r\n currentRoom = data;\r\n}", "function setName(username) {\n const usernamediv = document.querySelector('#name');\n usernamediv.innerHTML = `<i class=\"fa fa-user-circle\"></i>${username}`;\n}", "function _create_name_sec(res, section) {\n let { name, id, order, weight } = res;\n section.appendChild(Utils.make_h5(`${name}`));\n section.appendChild(Utils.make_p(`${Utils.make_strong_string('Id: ')}${id}`));\n section.appendChild(Utils.make_p(`${Utils.make_strong_string('Order: ')}${order}`));\n section.appendChild(Utils.make_p(`${Utils.make_strong_string('Weight: ')}${weight}`));\n\n }", "async function showroom(){\n\n let list = await fetch ('/api/rooms').then(r=>r.text());\n list = JSON.parse(list);\n if (list !== null){\n list.forEach(el=>{\n console.log(el);\n let g = document.createElement('div')\n g.innerHTML = `<div class=\"chat\" id=\"3\"><a href=\"#\">\n <i class=\"far fa-comments fa-5x\"></i>\n <p class=\"chatroomName\">Chatroom</p>\n </a></div>`\n g.addEventListener('click',function(e){\n console.log(el.roomname)\n chooseroom(el.roomname)\n window.location = 'chatroom.html'\n })\n $('.chatroom').append(g)\n\n })\n }\n}", "function accName(name) {\n\tlet temp = document.createElement(\"SPAN\");\n\ttemp.className = \"account-name\";\n\ttemp.innerHTML = `<a href=\"#\">${name}</a>`;\n\treturn temp;\n}", "createMemberElement(member) {\n const { name, color } = member.authData;\n const el = document.createElement('div');\n el.appendChild(document.createTextNode(name));\n el.className = 'member';\n el.style.color = color;\n if (member !== me) {\n // Listen to user clicking on another user\n el.addEventListener('click', () =>\n changeRoom(member.authData.name, createPrivateRoomName(member.id))\n );\n }\n return el;\n }", "function buildRoomNumBlock(i) {\n var listRoomVal = \"<ul class='list-inline'></ul><li class='list-unstyled'>Room \" + i + \"</li>\";\n return listRoomVal;\n }", "function showMembersOfCurrentRoom(usersInRoom) {\n usersOfRoom = usersInRoom;\n const onlineMembersArea = document.getElementById('online_members');\n onlineMembersArea.innerHTML = '';\n usersInRoom.forEach((user) => {\n const userDiv = document.createElement('div');\n userDiv.classList.add('room_member');\n userDiv.setAttribute('id', `roomMember_${user.userId}`);\n const smallCircle = document.createElement('div');\n smallCircle.classList.add('small_circle');\n const userName = document.createElement('p');\n userName.textContent = user.name;\n userDiv.appendChild(smallCircle);\n userDiv.appendChild(userName);\n onlineMembersArea.appendChild(userDiv);\n })\n}", "function definirNomeJogador(nome) {\n document.getElementById('jogador-nome').innerHTML = nome;\n}", "printSectionHeader(obj,sectionName){\n obj.insertAdjacentHTML('beforeend',`\n <div class= \"section\">\n <h2 class=\"section-name\">${sectionName}</h2>\n </div>\n `)\n\n }", "function joinRoom(roomName) {\n disableElements('joinRoom');\n\n // Check if roomName was given or if it's joining via roomName input field\n if(typeof roomName == 'undefined'){\n roomName = document.getElementById('roomName').value;\n }\n document.getElementById('roomName').value = roomName;\n\n var data = {\n id: \"joinRoom\",\n roomName: roomName\n };\n sendMessage(data);\n}", "function createRoomName() {\n return faker.PhoneNumber.phoneNumberFormat(6).split('-').splice(2).join('-');\n}", "function selectRoom(element) {\n\n\tif(selectedRoom == element.innerHTML)\n\t\treturn;\n\t\t\n\t//closeBucket();\n\tbucketArray = [];\n\tbucket.close();\n\tbucket.calm();\n\t\n\tvar last = document.getElementById(selectedRoom);\n\tlast.className = \"inline room unselectedRoom\";\n\t\n\tsocket.emit('left room');\n\tchatBoxDiv.innerHTML += \"<hr class='fadeout'>\";\n\t\n\telement.className = \"inline room selectedRoom\";\n\tselectedRoom = element.innerHTML;\n\n\troomMembersUL.innerHTML = \"\"\n\t\n\tusernames = socket.emit('request join room', selectedRoom);\n}", "function convertRoomName(info) {\n var roomName = \"\";\n\n if (info.type == 0) {\n // in channel\n roomName = info.type + \"@\" + info.to;\n } else {\n // in DM\n var temp = [info.from, info.to];\n temp.sort();\n roomName = info.type + \"@\" + temp[0] + \"_\" + temp[1];\n }\n\n return roomName;\n}", "function parseRooms(data, target) {\n $(data).find(\"hotelRoom\").each(function () {\n var number = $(this).find(\"number\")[0].textContent;\n var type = $(this).find(\"roomType\")[0].textContent;\n var decription = $(this).find(\"description\")[0].textContent;\n var ppn = $(this).find(\"pricePerNight\")[0].textContent;\n $(target).append(\"<dl><dt>\" + number + \":\" + \" \" + type + \"</dt><dd>\" + decription + \".\" + \" $\" + ppn + \" per night\" + \"</dd></dl>\");\n });\n\n }", "function addCharacterToDom(character) {\n // TO DO: Create new <div> element\n\n // Append the newly created <div> element to #main\n\n // Create a new <h5> element for characters' name\n\n // Append the newly created <h5> element to your new div\n\n // Set the textContent to the character's name\n\n\n // Do the same for house, probability of survival, and status using <p> element instead of <div> element\n\n}", "function showCityName () {\n var city = document.createTextNode(apiResult.name),\n displayCity = document.getElementById('city');\n\n displayCity.appendChild(city);\n }", "function changeRoom(name, newRoom,atualRoom){\n clients.forEach(function(client){\n if(client.name == name){\n client.roomName = newRoom;\n rooms.push(newRoom)\n }\n })\n broadcast(colors.red(name) + \" Desconectou da sala(\"+ colors.yellow(atualRoom) +\").\\n\", name, atualRoom)\n }", "function joinedRoom( room ) {\n}", "updateName() {\n App.elements.name.html(App.state.name);\n }", "function recipeName(response) {\n var name = $(\"<h3>\").text(response.title); \n recipeTitle.append(name);\n }", "function buildRouteListItem(name, src, grade, area, crag) {\n $(\"#route-table\").append($(\"<li>\").addClass(\"collection-item avatar\")\n .append($(\"<i>\").addClass(\"material-icons circle\").text(\"landscape\"))\n .append($(\"<a>\").addClass(\"route-name\").text(name).attr(\"href\", src).attr(\"target\", \"_blank\"))\n .append($(\"<p>\").text(\"Grade: \" + grade))\n .append($(\"<p>\").text(\"Area: \" + area))\n .append($(\"<p>\").text(\"Crag: \" + crag))\n );\n}", "function updateRoom() {\n\talert(\"Update Function\");\n\tvar room=this.dataset.name;\n\talert(room);\n\tvar price = this.dataset.price;\n\talert(price);\nroomOutput.innerHTML=room;\npriceOutput.innerHTML=price;\n}", "function changeName() {\n player1.innerHTML =\n `<span>\n ${nameInput.value}\n </span>\n `\n player2.innerHTML =\n `<span>\n Computer\n </span>\n `\n}", "function setLoginName (name) {\n document.getElementById(\"loginName\").innerHTML = `<strong>${name}</strong>`;\n }", "function alterarNomePersonagemSelecionado(personagem) {\r\n\tconst nomePersonagem = document.getElementById(\"nome-personagem\");\r\n\tnomePersonagem.innerText = personagem.getAttribute(\"data-name\");\r\n}", "function addName(fname){\n if(fname.length <= 0) {\n $(\"#name\").html(\"________\");\n }\n else {\n $('#name').html(fname);\n }\n}", "function create_name_cell(name) {\n return $(\"<td>\", {\n class: \"objects-name\",\n }).append(\n $(\"<span>\", {\n text: name,\n })\n );\n}", "function addNamePanel() {\n _namePanel = document.createElement( \"div\" );\n _namePanel.className = \"NamePanel\"\n _namePanel.style.width = container.style.width;\n _namePanel.innerHTML = userName;\n \n container.appendChild( _namePanel );\n }", "function updateTagNameDisplayer(element) {\n $(\"#tag-name\").text(\"<\" + element.tagName + \">\");\n}", "function updateGameName(name) {\n\n var text = document.getElementById(\"GameName\");\n\n if (name !== null && typeof name !== \"undefined\") {\n text.innerHTML = name;\n }\n\n}", "function currentRoomName(currentRoomIndex) {\n if (currentRoomIndex > rooms.length) {\n return \"Nowhere\";\n } else {\n return rooms[currentRoomIndex];\n }\n }", "function addListGenre2(name, id){\n\n var genre = document.createElement(\"a\");\n var textGenre = document.createTextNode(name);\n\n\n genre.href = \"genres.html?name=\"+ name;\n genre.className = \"list-group-item list-group-item-action\";\n genre.id = name;\n\n genre.appendChild(textGenre);\n document.getElementById(id).appendChild(genre);\n}" ]
[ "0.7907107", "0.7804841", "0.7804841", "0.7804841", "0.7804841", "0.7804841", "0.7804841", "0.77756387", "0.7764691", "0.7764691", "0.77535206", "0.7694868", "0.7694868", "0.7694868", "0.7694868", "0.76699555", "0.7601553", "0.7549329", "0.7530662", "0.74739176", "0.7458124", "0.73475415", "0.72127086", "0.70887303", "0.69283646", "0.67928314", "0.66517746", "0.6555788", "0.65383327", "0.6499427", "0.64608574", "0.634589", "0.62716764", "0.6208458", "0.6149537", "0.61142755", "0.6098943", "0.60858446", "0.6075258", "0.60664654", "0.6049954", "0.6027129", "0.5992438", "0.59860367", "0.5985567", "0.5973271", "0.5945312", "0.59291553", "0.59229136", "0.5897641", "0.5884595", "0.58810645", "0.5874542", "0.58689356", "0.5861695", "0.5838068", "0.5834509", "0.5821158", "0.581108", "0.57994014", "0.57965297", "0.57890093", "0.5760016", "0.57442665", "0.57240194", "0.57186073", "0.5715057", "0.5694216", "0.5665167", "0.56633073", "0.5662184", "0.56619626", "0.56436324", "0.564236", "0.5641915", "0.5616106", "0.56122303", "0.5609015", "0.56010807", "0.55966985", "0.5594038", "0.5581428", "0.55797863", "0.55682105", "0.5547992", "0.5547652", "0.55471414", "0.55383396", "0.55198383", "0.5515551", "0.5508959", "0.5507505", "0.5487683", "0.547598", "0.547103", "0.54689986", "0.54680616", "0.54485816", "0.54425037", "0.54403776" ]
0.7851127
1
Add users to DOM
function outputUsers(users) { const userList = document.getElementById('users'); userList.innerHTML = ` ${users.map(user => `<li>${user.username}</li>`).join('')} `; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addUserToDom( user ) {\n var user = new User( user );\n var html = user.getUserHtmlString();\n $('#users-window').append(html);\n }", "function users(arr) {\n arr.forEach(element => {\n fragment.appendChild(renderUsers(element));\n });\n elUserListWrapper.appendChild(fragment)\n }", "function outputUsers(users) {\n elim();\n let ul = document.createElement(\"ul\");\n ul.setAttribute(\"id\", \"users\");\n document.getElementById(\"list\").appendChild(ul);\n users.forEach(user=>{\n const li = document.createElement('li');\n li.className = 'list-group-item';\n li.innerText = user.username;\n ul.appendChild(li);\n });\n }", "function addUser(newUser) {\n userDataArray.push(newUser);\n updateDOM();\n}", "function putUsersOnPage(users) {\n // debugger\n\n userSection.innerHTML = \"\"\n\n // const userArray = []\n\n users.forEach(function (user) {\n// debugger\n // userSection\n\n addUserToUI(user)\n\n \n // const updatedArray = userArray.push(user.name)\n })\n\n\n \n\n}", "function populateUsers (users, container, userName) {\n for(var i = 0, iL = users.length; i < iL; i++) {\n var _userCheckbox = _document.createElement('input');\n _userCheckbox.type = \"checkbox\";\n _userCheckbox.name = userName;\n _userCheckbox.value = users[i].name;\n\n var _userLabel = _document.createElement('label');\n _userLabel.innerHTML = users[i].name;\n\n var _userContainer = _document.createElement('div');\n _userContainer.appendChild(_userCheckbox);\n _userContainer.appendChild(_userLabel);\n\n $U(container).appendChild(_userContainer);\n }\n }", "function addUser(user) {\n\tdata.push(user);\n\tupdateDOM();\n}", "function addOnlineUsers(username){\n \n const onlineUsers=document.getElementById('online-users');\n const onlineUser=document.createElement('div');\n onlineUser.className='online-user';\n onlineUser.innerHTML=username;\n\n onlineUsers.appendChild(onlineUser);\n}", "function renderUsers(data) {\r\n data.forEach((element) => {\r\n const newUserInfo = userInfoTemp.cloneNode(true);\r\n\r\n newUserInfo.querySelector(\".user-name\").textContent = element.name;\r\n newUserInfo.querySelector(\".user-name\").dataset.name_id = element.id;\r\n newUserInfo.querySelector(\".user-name_2\").textContent = element.username;\r\n newUserInfo.querySelector(\".user-email\").textContent = element.email;\r\n newUserInfo.querySelector(\".user-address\").textContent =\r\n element.address.street +\r\n \" \" +\r\n element.address.suite +\r\n \" \" +\r\n element.address.city +\r\n \" \" +\r\n element.address.zipcode;\r\n newUserInfo\r\n .querySelector(\".link\")\r\n .setAttribute(\r\n \"href\",\r\n \"https://www.google.com/maps/place/\" +\r\n element.address.geo.lat +\r\n element.address.geo.lng\r\n );\r\n newUserInfo.querySelector(\".user-phone\").textContent = element.phone;\r\n newUserInfo.querySelector(\".user-website\").textContent = element.website;\r\n newUserInfo\r\n .querySelector(\".user-website\")\r\n .setAttribute(\"href\", \"https://www.\" + element.website);\r\n newUserInfo.querySelector(\".company\").textContent =\r\n element.company.name +\r\n \" \" +\r\n element.company.catchPhrase +\r\n \" \" +\r\n element.company.bs;\r\n\r\n userLists.appendChild(newUserInfo);\r\n });\r\n}", "function populate_userInfo() {\n // User name\n const nameContainer = document.querySelector(\"#user-name\");\n nameContainer.setAttribute('class', 'card-subsection-name')\n const name = document.createTextNode(user.getFName() + \" \" + user.getLName());\n const nameElement = document.createElement('h4');\n nameElement.appendChild(name);\n nameContainer.appendChild(nameElement);\n\n // Contact info\n const contactInfoContainer = document.querySelector('.contact-info');\n const phoneNumNode = document.createTextNode(user.getPhoneNum());\n contactInfoContainer.appendChild(phoneNumNode);\n const emailElement = document.createElement('span');\n const emailNode = document.createTextNode(user.getEmail());\n emailElement.setAttribute('class', 'scaling-text-size');\n emailElement.appendChild(emailNode);\n contactInfoContainer.appendChild(document.createElement('br'));\n contactInfoContainer.appendChild(emailElement);\n}", "function renderUsers (doc) {\n let li = $('<li>')\n let username = $('<span>')\n\n li.attr('data-id', doc.id)\n username.text(doc.data().username)\n\n li.append(username)\n\n userList.append(li)\n}", "function add_user_ui(u) {\n //a = `<div id=\"${name_to_id(u.first_name)}\" onClick=\"update_person(this)\" class=\"person\"><div class=\"person-name\">${u.first_name}</div><div class=\"person-date\">${u.last}</div></div>`\n a = `<div id=\"${name_to_id(u.first_name + u.last_name)}\" onClick=\"update_person(this)\" class=\"person\"><div class=\"person-name\">${u.first_name}</div><div class=person-lastname>${u.last_name}</div></div>`\n $(\"#contact_list\").append(a);\n}", "function renderUsers(users) {\n users.forEach(function(user) {\n var container = document.createElement('div') // creates an empty div for each user\n // inserts an image for each user - img found in json file\n var img = document.createElement('img')\n img.style = \"float: left; margin-right: 12px;\"\n img.src = user.picture.medium\n container.appendChild(img)\n // inserts user title, name and last name\n var username = document.createElement('h3')\n username.textContent = user.name.title + \" \" + user.name.first + \" \" + user.name.last\n container.appendChild(username)\n // insert cell phone numbers\n var cell = document.createElement('a')\n cell.textContent = user.cell\n cell.href = \"tel:\" + user.cell\n container.appendChild(cell)\n // insert emails\n var email = document.createElement('a')\n email.textContent = user.email\n email.href = \"mailto:\" + user.email\n container.appendChild(email)\n // create a line below each div\n container.appendChild(document.createElement('hr'))\n\n usersEl.appendChild(container)\n })\n}", "function renderUser(doc){\r\n let li = document.createElement('li');\r\n let username = document.createElement('span');\r\n let password = document.createElement('span');\r\n\r\n li.setAttribute('data-id', doc.id);\r\n username.textContent = doc.data().username;\r\n password.textContent = doc.data().password;\r\n\r\n li.appendChild(username);\r\n li.appendChild(password);\r\n\r\n userList.appendChild(li);\r\n}", "function createNewUser(userObj) {\r\n var node = document.createElement(\"LI\");\r\n var innerElement = document.createTextNode(userObj.username + ' (' + userObj.email + ')');\r\n node.appendChild(innerElement);\r\n document.getElementById(\"users\").appendChild(node);\r\n }", "function outputUsers(users) {\r\n userList.innerHTML = '';\r\n users.forEach((user) => {\r\n const li = document.createElement('li');\r\n li.innerText = user.username;\r\n userList.appendChild(li);\r\n });\r\n}", "function addingListUsers(users){\n for(let i = 0; i < users.length; i++){\n const HTMLString = playListTemplate(users[i])\n const HTMLTemplate = playListHTMLTemplate(HTMLString);\n $playlist.append(HTMLTemplate);\n }\n }", "function createUserElements() {\n for (let i = 1; i <= 100; i++) {\n document.body.appendChild(creatUserElement());\n }\n}", "function outputUsers(users) {\n userList.innerHTML = '';\n users.forEach(user=>{\n const li = document.createElement('li');\n li.innerText = user.username;\n userList.appendChild(li);\n });\n }", "function outputUsers(users) {\n userList.innerHTML = '';\n users.forEach(user=>{\n const li = document.createElement('li');\n li.innerText = user.username;\n userList.appendChild(li);\n });\n }", "function outputUsers(users) {\n userList.innerHTML = '';\n users.forEach(user=>{\n const li = document.createElement('li');\n li.innerText = user.username;\n userList.appendChild(li);\n });\n }", "function outputUsers(users) {\n userList.innerHTML = '';\n users.forEach((user) => {\n const li = document.createElement('li');\n li.innerText = user.username;\n userList.appendChild(li);\n });\n}", "function addUser() {\n const userFirstName = document.querySelector(' #fname ').value;\n const userLastName = document.querySelector(' #lname ').value;\n const userDateOfBirth = document.querySelector(' #dob ').value;\n const inputForm = document.querySelector(' #userInfo ');\n users.push(createUserObject(userFirstName, userLastName, userDateOfBirth));\n console.table(users);\n inputForm.reset();\n}", "function addData(newUser){\n data.push(newUser);\n updateDOM();\n}", "function addData(newUser) {\n data.push(newUser);\n updateDOM();\n}", "function addUser(data) {\n var node = document.createElement('span');\n node.className = 'user';\n node.textContent = data[3];\n node.dataset.user = data[0];\n\n var deleteNode = document.createElement('span');\n deleteNode.className = 'delete';\n deleteNode.innerHTML = '&times;';\n node.appendChild(deleteNode);\n\n userList.insertBefore(node, input);\n\n input.placeholder = '';\n sendButton.disabled = false;\n\n sendView.resize();\n }", "function populate_userInfo() {\n // User name\n const nameContainer = document.querySelector(\"#user-name\");\n nameContainer.innerHTML = \"\";\n nameContainer.setAttribute('class', 'card-subsection-name')\n const name = document.createTextNode(user.getFName() + \" \" + user.getLName());\n const nameElement = document.createElement('h4');\n nameElement.appendChild(name);\n nameContainer.appendChild(nameElement);\n\n // Contact info\n const contactInfoContainer = document.querySelector('.contact-info');\n contactInfoContainer.innerHTML = \"\";\n const phoneNumNode = document.createTextNode(user.getPhoneNum());\n contactInfoContainer.appendChild(phoneNumNode);\n const emailElement = document.createElement('span');\n const emailNode = document.createTextNode(user.getEmail());\n emailElement.setAttribute('class', 'scaling-text-size');\n emailElement.appendChild(emailNode);\n contactInfoContainer.appendChild(document.createElement('br'));\n contactInfoContainer.appendChild(emailElement);\n}", "function appendUser(user) {\n let li = document.createElement(\"li\");\n li.innerHTML = user;\n document.querySelector(\"#users\").append(li);\n var chatWindow = document.getElementById(\"chatWindow\");\n chatWindow.scrollIntoView({ behavior: 'smooth', block: 'end' });\n chatWindow.scrollTop = chatWindow.scrollHeight;\n }", "function addLoggedUserInterfaceElements(jsonUser) {\n $('.btn-signreg').remove();\n $('#bs-example-navbar-collapse-1 li:last')\n .after(\n \"<li>\" +\n \"<a class=\\\"page-scroll\\\" href=\\\"#user\\\">User</a>\" +\n \"</li>\"\n +\n \"<li id=\\\"logout\\\">\" +\n \"<a id=\\\"btn-logout\\\" class=\\\"page-scroll\\\" href=\\\"logout\\\">Logout</a>\" +\n \"</li>\");\n\n var image;\n if (!jsonUser.hasOwnProperty('image')) {\n image = \"resources/img/default.jpg\"\n } else {\n image = \"../images/\" + jsonUser.image;\n }\n\n $('#user').removeClass('hidden');\n $('#userInfo').append(\"Name: \" + jsonUser.name + \" \" + jsonUser.surname + \", email: \" + jsonUser.email);\n $('#userInfo').after(\"<img src=\\\"\" + image + \"\\\" class=\\\"img-responsive\\\" alt=\\\"\\\">\");\n}", "function show_list(user){\n let usrList = document.getElementsByClassName(\"user-list\")[0];\n let usrUl = document.createElement(\"ul\");\n for(let i = 0;i < user.items.length ; i++){\n let usrLi = document.createElement(\"li\");\n let usrRepo = document.createTextNode(user.items[i].name+\" _\");\n usrLi.appendChild(usrRepo);\n usrUl.appendChild(usrLi);\n }\n usrList.appendChild(usrUl);\n}", "function renderUsers(users) {\n\n users.forEach(user => {\n const li = document.createElement('li');\n li.classList.add('userName');\n li.textContent = user.name;\n ul.appendChild(li);\n\n });\n\n const getUserInfo = document.querySelector('.userInfo');\n\n const userLink = document.querySelector('.userList');\n userLink.addEventListener('click', event => {\n const {target} = event;\n if (target.classList.contains('userName')) {\n\n const user = users.find(user => user.name === target.textContent);\n\n if (user !== undefined) {\n console.log(user);\n let userBoxInfo = '<p> <b>Name:</b> ' + user.name + '</p>';\n userBoxInfo += '<p> Username: ' + user.username + '</p>';\n userBoxInfo += '<p> Email: ' + user.email + '</p>';\n userBoxInfo += '<p> Phone: ' + user.phone + '</p>';\n getUserInfo.innerHTML = userBoxInfo;\n }\n }\n });\n}", "function renderUsers(el, users){\n $.each(users, function(key, user){\n el.append(\n '<tr><td>' + (parseInt(key, 10) + 1) + '</td>' +\n '<td>' + user.first_name + '</td>' +\n '<td>' + user.last_name + '</td>' +\n '<td>' + user.username + '</td>' +\n '<td>' + user.position + '</td>' +\n '<td><span class=\"fa fa-info-circle\" id=\"' + user.url + '\" ></span></td>' +\n '</tr>'\n );\n });\n }", "function add_all_members(members, acc_owner) {\n\tvar users = g_members.split(\"&#39;\");\n\t// Removes the [] parantheses.\n\tusers.splice(0, 1);\n\tusers.pop();\n\n\t// Removes all comma values.\n\tfor (var i = users.length - 1; i--;) {\n\t\tif (users[i].match(\",\")) users.splice(i, 1);\n\t}\n\n\tfor (var i = 0; i < users.length; i++) {\n\t\tconsole.log(users[i]);\n\t\tconsole.log(acc_owner);\n\t\tif(users[i] == acc_owner) {\n\t\t\tvar list = document.createElement(\"li\");\n\t\t\tvar textnode = document.createTextNode(users[i]);\n\t\t\tvar ul_len = document.getElementById(members).childNodes.length;\n\t\t\n\t\t\t// create input element\n\t\t\tvar input = document.createElement(\"input\");\n\t\t\tinput.setAttribute(\"type\", \"hidden\");\n\t\t\tinput.setAttribute(\"name\", members + ul_len);\n\t\t\tinput.setAttribute(\"id\", members + ul_len);\n\t\t\tinput.setAttribute(\"value\", users[i]);\n\t\t\tlist.appendChild(input);\n\t\t\tlist.appendChild(textnode);\n\t\t\tlist.setAttribute('class', 'pr-5');\n\t\t\tdocument.getElementById(members).appendChild(list);\n\t\t} else {\n\t\t\tadd(users[i], members)\n\t\t}\t\n\t}\n\n}", "function display() {\n ul.innerHTML = '';//clear all users\n //Other way to remove all user\n // while (ul.hasChildNodes()) {\n // ul.removeChild(ul.lastChild);\n // }\n var newuser;\n var users = JSON.parse(request.responseText);\n if (request.readyState == 4 && request.status == \"200\") {\n for (var i = 0; i < users.results.length; i++) {//create new html elements\n newuser = users.results[i];\n var li = createNode('li'),\n img = createNode('img'),\n span = createNode('span');\n img.src = users.results[i].picture.medium;\n span.innerHTML = capital_letter(newuser.name.first) + ' ' + capital_letter(newuser.name.last) +\n '<br>' + newuser.cell + '<br>' + capital_letter(newuser.location.city);\n append(li, img);\n append(li, span);\n append(ul, li);\n }\n } else {\n alert('An error occurred fetching the JSON from ' + url);\n }\n}", "function displayUser(user){\n let userLi = document.createElement('li')\n let username = document.createElement('h3')\n username.textContent = user.login\n let avatar = document.createElement('img')\n avatar.src = user.avatar_url\n avatar.classList.add('avatar-img')\n avatar.addEventListener('click', () => fetchUsersRepos(user))\n\n let linkHolder = document.createElement('p')\n let link = document.createElement('a')\n link.href = `https://github.com/${user.login}`\n link.target = 'blank'\n link.textContent = \"View profile on Github\"\n\n linkHolder.appendChild(link)\n userLi.appendChild(username)\n userLi.appendChild(avatar)\n userLi.appendChild(linkHolder)\n\n userList.appendChild(userLi)\n}", "function createUser() {\n var modal = getById(\"modal\");\n removeChilds(modal);\n let header = createNode('h3')\n inputUser = createNode('input'),\n inputPass = createNode('input'),\n btnCreate = createNode('button'),\n btnCancel = createNode('button');\n\n header.setAttribute('class', \"w3-container w3-center\")\n header.innerHTML = \"Skapa användare\";\n\n inputUser.setAttribute('class', \"w3-input w3-border\")\n\n\n append(modal, header)\n}", "function displayUser(users) {\n\tPromise.all(users.map(function(user) {\n\t\tconst userDisplay = document.createElement('div');\n\t\tuserDisplay.className= \"user\"\n\t\tuserDisplay.innerHTML = user.login;\n\t\tdocument.body.appendChild(userDisplay);\n\t}))\n}", "function addUserElement(request,user_json){\n var element = userElementArray(user_json);\n addElement(element,dataTable_users);\n updateUserSelect();\n}", "function outputUsers(users) {\n userList.innerHTML = `\n ${users.map(user => `<li class=\"contact\">\n <div class=\"wrap\">\n <div class=\"meta\">\n <p class=\"name\">${user.username}</p>\n </div>\n </div>\n </li>`).join('')}\n `\n}", "function userList(){\n users.innerHTML = \"\";\n \n DATA.users.forEach(function(user){\n \n user.messages.forEach(function(el){\n \n if(el.id==user.messages.length){\n let newuser = `<ul class=\"user\" active=\"${user.id}\" ><li><div class=\"user-list-info\"> <img src=${user.avatar} alt=\"foto\"><div><h4>${user.first_name}</h4><span style=\"color: #419FD9\">${el.is_from_me? \"You\": user.first_name} : </span>\n <span>${el.text.slice(0,20)}...</span></div></div></li>\n <li><p>${el.time}</p></ul></li>`;\n users.innerHTML += newuser; \n } \n }) \n })\n \n \n}", "function displayUsers(users) {\n users.forEach(function(user) {\n var $container = $('.container');\n var $tile = $('<div class=\"tile\"></div>');\n var name = user.name.first + ' ' + user.name.last;\n var $name = $('<p></p>');\n $name.text(name);\n\n var location = user.location.city + ', ' + user.location.state;\n var $location = $('<p></p>');\n $location.text(location);\n\n var $img = $('<img>');\n $img.attr('src', user.picture.large);\n\n $tile.append($img, $name, $location);\n $container.append($tile);\n });\n }", "function streamUser() {\n var $body = $('.people-follow');\n for(var key in streams) {\n if(key === 'users') {\n for(var key in streams.users) {\n var user = key;\n var $user = $('<a id='+user+'></a><br>');\n $user.text('@' + user);\n $user.appendTo($body);\n }\n } \n }\n}", "function setUser() {\n user = new User($(\"#idh\").html(),$(\"#nameh\").html());\n}", "function add(user, members) {\n\tvar list = document.createElement(\"li\");\n\tvar textnode = document.createTextNode(user);\n\tvar ul_len = document.getElementById(members).childNodes.length;\n\n\t// create input element\n\tvar input = document.createElement(\"input\");\n\tinput.setAttribute(\"type\", \"hidden\");\n\tinput.setAttribute(\"name\", members + ul_len);\n\tinput.setAttribute(\"id\", members + ul_len);\n\tinput.setAttribute(\"value\", user);\n\tlist.appendChild(input);\n\tlist.appendChild(textnode);\n\tlist.setAttribute('class', 'pr-5');\n\n\t// add remove button\n\tvar remove = removeBtn();\n\tlist.appendChild(remove);\n\tdocument.getElementById(members).appendChild(list);\n\tremove.onclick = function () {\n\t\tdocument.getElementById(members).removeChild(list);\n\t}\n}", "function addAnotherUser() {\n // Need a unique id, will monotomically increase\n var id = getNextUserId();\n\n // Create and add the user to DOM\n createNewUser(id);\n\n // Make sure message about no users is hidden\n document.getElementById('no-added-users').style.display = 'none';\n\n // Always return false to disable the default action\n return false;\n}", "function getPageUsers(){\n \n let usersList = document.querySelectorAll('._3cb8');\n\n exportPageUsersInfo(usersList);\n \n\n}", "function addUser(firstName, lastName, userID) {\n\n var li = document.createElement(\"li\");\n li.className = \"list-group-item\";\n li.id = userID;\n var nameString = firstName + \" \" + lastName;\n if (document.getElementById(\"adminID\").value == userID) {\n var adminString = \"(Administrator)\";\n nameString += \" \" + adminString;\n }\n li.appendChild(document.createTextNode(nameString));\n\n if (document.getElementById(\"isAdmin\").value == \"admin\") {\n var xSpan = document.createElement(\"SPAN\");\n xSpan.className = \"glyphicon glyphicon-remove removeUser\";\n xSpan.setAttribute('data-userID', userID);\n $(xSpan).css(\"float\", \"right\");\n $(xSpan).css(\"color\", \"red\");\n\n li.appendChild(xSpan);\n\n }\n\n var ul = document.getElementById(\"userList\");\n ul.appendChild(li);\n\n}", "function outputUsers(users){\n userList.innerHTML = `\n ${users.map(user=>`<h6>${user.username}</h6>`).join('')}\n `;\n}", "function outputUsers(users) {\n userList.innerHTML = \"\";\n users.map((user) =>\n userList.insertAdjacentHTML(\n \"beforeend\",\n `<li>\n <img src=\"${data[Math.floor(user.score / 60)][\"img-small\"]}\" width=30> \n <span>${user.username} (${user.score}P)</span>\n </li>`\n )\n );\n}", "function renderUsers(users) {\n tbody.empty();\n for(var i=0; i<users.length; i++) {\n var user = users[i];\n var clone = template.clone();\n clone.attr('id', user.id);\n clone.find('.wbdv-delete').click(deleteUser);\n clone.find('.wbdv-edit').click(editUser);\n clone.find('.wbdv-username')\n .html(user.username);\n clone.find('.wbdv-first-name')\n .html(user.firstName);\n clone.find('.wbdv-last-name')\n .html(user.lastName);\n clone.find('.wbdv-role')\n .html(user.role);\n tbody.append(clone);\n }\n }", "function outputUsers(users) {\n userList.innerHTML = `<ul>\n ${users.map(user => `<li>${user.username}</li>`).join('')}\n </ul>`;\n}", "function render(users) {\n console.log(\"here\");\n const container = document.querySelector('.js-users');\n container.innerHTML = '';\n console.log(users)\n for (const user of users.users) {\n console.log(user);\n\n const div = document.createElement('div');\n div.innerHTML =\n `\n <div class=\"row\">\n <div class=\"col s6 m6\">\n <div class=\"card\">\n <div class=\"card-image\">\n <img src=${user.ACTIVITY_PAYLOAD}>\n </div>\n <div class=\"card-content\">\n <span class=\"card-title\">${user.EMAIL}</span>\n <a class=\"waves-effect waves-light btn right\">Follow</a>\n </div>\n </div>\n </div>\n </div>\n `\n div.classList.add('row')\n container.appendChild(div)\n }\n }", "function render(users) {\n console.log(\"here\");\n const container = document.querySelector('.js-users');\n container.innerHTML = '';\n console.log(users)\n for (const user of users.users) {\n console.log(user);\n\n const div = document.createElement('div');\n div.innerHTML =\n `\n <div class=\"row\">\n <div class=\"col s6 m6\">\n <div class=\"card\">\n <div class=\"card-image\">\n <img src=${user.ACTIVITY_PAYLOAD}>\n </div>\n <div class=\"card-content\">\n <span class=\"card-title\">${user.EMAIL}</span>\n <a class=\"waves-effect waves-light btn right\">Follow</a>\n </div>\n </div>\n </div>\n </div>\n `\n div.classList.add('row')\n container.appendChild(div)\n }\n }", "function outputUsers(users) {\n userList.innerHTML = `\n ${users.map(user => `<li>${user.username}</li>`).join(\"\")}\n `;\n}", "function addUser(user) {\n var slElement = $(document.createElement(\"option\"));\n slElement.attr(\"value\", user);\n slElement.text(user);\n $(\"#usersList\").append(slElement);\n}", "function addUserToGamePlayerList(username) {\n console.log(\"adding \" + username);\n var thisPlayer = document.createElement('li');\n thisPlayer.classList.add('list-group-item','justify-content-between');\n thisPlayer.appendChild(document.createTextNode(username));\n if(gamePlayerList.children().length === 0) {\n var leaderBadge = document.createElement('span');\n leaderBadge.classList.add('badge','badge-success','badge-pill');\n leaderBadge.appendChild(document.createTextNode('Leader'));\n thisPlayer.appendChild(leaderBadge);\n }\n\n gamePlayerList.append(thisPlayer);\n}", "function outputUsers(users) {\n userList.innerHTML = `\n ${users.map(user => `<li>${user.username}</li>`).join('')}\n `;\n}", "function renderUsers() {\n // clear the list for a fresh start look (innerHTML: use to modify/replace HTML elements)\n ulEl.innerHTML = \"\";\n\n // showing a new highscore\n for (var i = 0; i < users.length; i++) {\n // Create a new user object that pulls from the user array\n var user = users[i];\n\n // using text content to show user's initials and score\n var li = document.createElement(\"li\");\n li.textContent = user.userNum + \". \" + user.initials + \" - \" + user.score;\n\n // Append the element to the unordered list\n ulEl.appendChild(li);\n }\n}", "function addToOnlineUsers(nickname) {\n var onlineList = $('#online_now');\n var onlineUsers = $('<li>', {\n html : nickname,\n id : nickname\n });\n onlineList.append(onlineUsers);\n }", "function appendData(data) {\n // get the div id where data will be placed\n let allUsers = document.getElementById('userData');\n\n for (let i = 0; i < data.length; i++) {\n // append each user/person to the html page\n // create a class based on odd or even index number\n let rowClass = 'odd';\n if (i % 2 == 0) {\n rowClass = 'even';\n } else {\n rowClass = 'odd';\n }\n // new div element\n let div = document.createElement('div');\n // fill the new div with a user/persons data\n // div.innerHTML = 'User Name: ' + data[i].username + ' Full Name: ' + data[i].name;\n div.innerHTML = `<div class=\"${rowClass}\"><span class=\"fw-bold\">Full Name: </span>${data[i].name} <br>\n <span class=\"fw-bold\">Email: </span>${data[i].email} <br>\n <span class=\"fw-bold\"><a href=\"app_details.html?${data[i].id}\">User Details</a></span><br>\n </div>`;\n\n // append div to the allUsers div\n allUsers.appendChild(div);\n\n }\n}", "function outputUsers(users) {\r\n userList.innerHTML = `\r\n ${users.map((user) => `<li>${user.username}</li>`).join(\"\")}\r\n `;\r\n}", "function outputUsers(users) {\n userList.innerHTML = `${users.map(user => `<li><i class=\"fa fa-user-circle\"></i>${user.username}</li>`).join('')}`\n}", "function appendList(user) {\n \t$('#unordList').append('<li>' + user + '</li>');\n\n }", "function showData(user) {\n \n let userImage = document.createElement('img');\n userImage.src = user.avatar;\n userImage.alt = 'User Avatar';\n\n sectionInfo.appendChild(userImage);\n\n let userIntro = document.createElement('h5');\n userIntro.innerText = `Hi! My name is ${user.first_name} ${user.last_name}.`\n\n sectionInfo.appendChild(userIntro);\n\n let userContact = document.createElement('h6');\n userContact.innerText = `You can reach me at ${user.email}`;\n\n sectionInfo.appendChild(userContact);\n\n}", "function addUserOnClick (e) {\n if (e.target.id != 'add-user') {\n return;\n }\n newUserForm = document.querySelector('#new-user-form');\n newUserForm.style.display = 'block';\n var newUserRoleSelect = document.querySelector('#new-user-form .new-user-role');\n getRoles(newUserRoleSelect);\n var newUserUserSelect = document.querySelector('#new-user-form .new-user-user');\n getUsers(newUserUserSelect);\n}", "function createUsersList(usersArray) {\r\n addDogsImgs(usersArray.length).then (dogs => {\r\n usersArray.forEach( (oldUser,index) => {\r\n const { id, name, username, email, address: { city, zipcode }, phone, website, company: { name: Company_name, catchPhrase, bs } } = oldUser;\r\n let user = { id, name, username, email, city, zipcode, phone, website, Company_name, catchPhrase, bs };\r\n \r\n let currentLi = document.createElement(\"li\");\r\n let dogImgContainer = document.createElement(\"img\");\r\n dogImgContainer.setAttribute(\"src\", dogs[index]);\r\n currentLi.append(dogImgContainer);\r\n \r\n for (prop in user) {\r\n let infospan = document.createElement(\"span\");\r\n infospan.setAttribute(\"data-content\", prop);\r\n infospan.textContent = user[prop];\r\n currentLi.append(infospan);\r\n }\r\n currentLi.innerHTML += `<button class = \"edit\">Edit</button> <button class = \"delete\">Delete</button>`;\r\n usersUl.append(currentLi);\r\n });\r\n })\r\n}", "function outputUsers(users) {\n userList.innerHTML = `\n ${users.map(user => `<li>${user.username}</li>`).join('')}`;\n}", "function addFriendEntry(el) {\n let template = document.querySelector(\"#friends-current\").content;\n let parent = document.querySelector(\".friends_current-parent\");\n let clone = template.cloneNode(true);\n clone.querySelector(\".paragraph\").textContent = el.username;\n // Add id to user\n clone.querySelector(\".button\").dataset.uuid = el._id;\n clone.querySelector(\"button\").addEventListener(\"click\", removeFriend);\n parent.appendChild(clone);\n // Create array for the friend for later use\n fluidFriendObject = {};\n}", "function newUser() { // Ajout d'un nouvel utilisateur\n\n // Cible le container des profils\n const userProfileContainer = document.querySelector(\".user-profile-container\");\n\n let myName = prompt(\"Prénom de l'utilisateur\");\n\n if (myName.length !== 0) { // On vérifie que le prompt ne soit pas vide\n\n usersNumber+=1; // Incrémente le nombre d'utilisateurs\n\n // 1 - Créer un nouveau user-profile\n const userProfile = document.createElement(\"div\");\n // Lui assigner la classe userProfileContainer\n userProfile.classList.add(\"user-profile\");\n // Lui assigner un ID\n userProfile.id = `user-profile-${usersNumber}`; \n // L'ajouter au DOM \n userProfileContainer.insertBefore(userProfile, document.querySelector(\"#add-user\"));\n\n // 2 - Créer un nouveau user portrait\n const userPortrait = document.createElement(\"div\");\n // Lui assigner la classe portrait\n userPortrait.classList.add(\"user-portrait\");\n // Lui assigner un ID\n userPortrait.id = `user-portrait-${usersNumber}`;\n // L'ajouter au DOM\n document.getElementById(`user-profile-${usersNumber}`).appendChild(userPortrait);\n\n // 3 - Créer un nouveau user-portrait__image\n const userPortraitImage = document.createElement(\"img\");\n // Lui assigner la classe userImage\n userPortraitImage.classList.add(\"user-portrait__image\");\n // Lui assigner un ID\n userPortraitImage.id = `user-portrait-image-${usersNumber}`;\n // Ajouter une image automatiquement\n userPortraitImage.src = \"assets/img/new_user_added.png\";\n // L'ajouter au DOM\n document.getElementById(`user-portrait-${usersNumber}`).appendChild(userPortraitImage);\n\n // 4 - Créer un nouveau user-name\n const userName = document.createElement(\"h2\");\n // Lui assigner la classe profileName\n userName.classList.add(\"user-name\");\n // Utiliser un innerHTML pour afficher le nom\n userName.innerHTML = myName;\n // L'ajouter au DOM\n document.getElementById(`user-portrait-${usersNumber}`).appendChild(userName);\n }\n}", "function renderUserListElement(user) {\n var table = document.getElementById('user_list');\n var row = table.insertRow(-1);\n\n var username = row.insertCell(0);\n var name = row.insertCell(1);\n username.innerHTML = user.username;\n name.innerHTML = user.name;\n\n row.addEventListener('click', function(e) {\n window.location.href = basePath + 'user/edit.html?user_id=' + user.user_id;\n });\n}", "function createUsers(name, last, phone, email) {\n var user = {\n name: name,\n last: last,\n phone: phone,\n email: email\n }\n users.push(user);\n console.log(users)\n readUser();\n document.getElementById('form').reset();\n}", "function UpdateUsers(userList) {\n users.empty();\n for (var i = 0; i < userList.length; i++) {\n if (userList[i].username != myName) {\n users.append('<li class=\"player\" id=\"' + userList[i].id + '\"><a href=\"#\">' + userList[i].username + '</a></li>')\n }\n }\n }", "function addUNameToDom(name) {\r\n\tconst paraElement = document.createElement('p')\r\n\tparaElement.innerHTML = '<strong>From user: </strong>' + name\r\n\treturn paraElement\r\n}", "function getAllUsers() {\n $.get(\"/api/getAllUsers\").then(function(allUsers) {\n for( let i = 0; i < allUsers.length; i++) {\n usersHolder.append(\"<a id =\" + allUsers[i].id + \" href='#'\" + \" class='testOne'\"+\">\" + allUsers[i].email + \"</a>\" + \" \")\n }\n })\n}", "function fillUserData(response) {\n\tvar users = response.payload;\n\tfor (var i = 0; i < users.length; i++) {\n\t\tvar user = users[i];\n\t\tif (user.username == managedUser) {\n\t\t\tdocument.getElementById(\"user-header\").innerHTML =\n\t\t\t\tS(\"edit-user-header\", user.first_name, user.last_name, user.username);\n\t\t\tdocument.getElementById(\"first-name-field\" ).value = user.first_name;\n\t\t\tdocument.getElementById(\"last-name-field\" ).value = user.last_name;\n\t\t\tdocument.getElementById(\"current-credit-amount\").value = user.assets;\n\t\t\tdocument.getElementById(\"new-credit-amount\" ).value = user.assets;\n\t\t\tdocument.getElementById(\"credit-add-amount\" ).value = 0;\n\t\t\tdocument.getElementById(\"new-credit-amount\" ).min = user.assets;\n\t\t\tbreak;\n\t\t}\n\t}\n}", "addUsers(state, users) {\n for (let u of users) {\n Vue.set(state.allUsers, u.id,\n new User(u.id, u.first_name, u.last_name, u.picture_url));\n }\n }", "function author(e) {\n fetch(\"https://jsonplaceholder.typicode.com/users/\")\n .then((res) => res.json())\n .then((data) => {\n let usercontainer = \"<h2>Author</h2>\";\n data.forEach(function (users) {\n usercontainer += `<div class=\"user\">\n <div>${users.name}</div>\n <br/>\n <div>${users.email}</div>\n <br/>\n <div>Phone: ${users.phone}</div>\n <br/>\n </div>`;\n });\n document.getElementById(\"user\").innerHTML = usercontainer;\n });\n}", "function uploadwizard_newusers() {\n if ( mw.config.get( 'wgNamespaceNumber' ) === 4 && mw.config.get( 'wgTitle' ) === 'Upload' && mw.config.get( 'wgAction' ) === 'view' ) {\n var oldDiv = document.getElementById( 'autoconfirmedusers' ),\n newDiv = document.getElementById( 'newusers' );\n if ( oldDiv && newDiv ) {\n var userGroups = mw.config.get( 'wgUserGroups' );\n if ( userGroups ) {\n for ( var i = 0; i < userGroups.length; i++ ) {\n if ( userGroups[i] === 'autoconfirmed' ) {\n oldDiv.style.display = 'block';\n newDiv.style.display = 'none';\n return;\n }\n }\n }\n oldDiv.style.display = 'none';\n newDiv.style.display = 'block';\n return;\n }\n }\n}", "function outputUsers(users){\n let userlist=document.querySelector('.current-room')\n userlist.innerHTML=`\n ${users.map(user=>`<li class=\"room-name\">${user.username}</li>`).join('')}\n `;\n \n}", "function renderUsers(users) {\n $tbody.empty();\n for(var u = 0; u < users.length; u++) {\n var user = users[u];\n $tbody.append(\n `<tr class=\"wbdv-template wbdv-user\">\n <td class=\"wbdv-username pt-4 pl-3\">${user.username}</td>\n <td class=\"pt-4 pl-3\">*****</td>\n <td class=\"wbdv-first-name pt-4 pl-3\">${user.firstName}</td>\n <td class=\"wbdv-last-name pt-4 pl-3\">${user.lastName}</td>\n <td class=\"wbdv-role pt-4 pl-3\">${user.role}</td>\n <td class=\"wbdv-actions\">\n <span class=\"text-nowrap float-right\">\n <button class=\"btn wbdv-remove fa-2x fa fa-times\" id=\"removeBtn-${u}\"></button>\n <button class=\"btn wbdv-edit fa-2x fa fa-pencil\" id=\"editBtn-${u}\"></button>\n </span>\n </td>\n </tr>`\n );\n }\n $removeBtn = $(\".wbdv-remove\");\n $removeBtn.click(deleteUser);\n $editBtn = $(\".wbdv-edit\");\n $editBtn.click(selectUser);\n }", "function addUser () {\r\n document.querySelector(\".add-user form\").addEventListener(\"submit\", (e) => {\r\n e.preventDefault();\r\n\r\n var value = e.target.querySelector(\"#user-name\").value;\r\n value = value.trim();\r\n value = value.length == 0 ? null : value;\r\n\r\n if(value === null) return;\r\n\r\n var newElem = document.createElement(\"li\");\r\n newElem.setAttribute(\"draggable\", true);\r\n newElem.innerHTML = value;\r\n\r\n e.target.querySelector(\"#user-name\").value = \"\";\r\n document.querySelector(\".user-list ul\").appendChild(newElem);\r\n\r\n // update events for new elements\r\n sortableList1.update(newElem);\r\n });\r\n}", "function addUserToDisplay(userName, userNumb, userImg, userColor, animate) {\n\n // nice other function that mapps the usernumb to a name as they join:)\n players[userNumb] = userName;\n const playerCountDisplay = document.getElementById('playerCount');\n playerCountDisplay.innerHTML = playerCount + \"/8\";\n const parent = document.getElementById('userList');\n\n const userBadge = document.createElement('div');\n userBadge.className = 'user';\n userBadge.id = `user-${userNumb}`;\n\n const profileHeaderContainer = document.createElement('div');\n profileHeaderContainer.className = 'profile-header-container';\n\n const profileHeaderImg = document.createElement('div');\n profileHeaderImg.className = 'profile-header-img';\n\n const imgCircle = document.createElement('img');\n imgCircle.className = 'img-circle';\n imgCircle.id = `userImage-${userNumb}`;\n imgCircle.src = `${userImg}`;\n imgCircle.style.border = `2px solid ${userColor}`;\n\n const rankLabelContainer = document.createElement('div');\n rankLabelContainer.className = 'rank-label-container';\n rankLabelContainer.style.background = `${userColor}`;\n rankLabelContainer.style.borderRadius = \"27px\";\n\n const nameLabel = document.createElement('span');\n nameLabel.className = 'name-label';\n nameLabel.id = `userName-${userNumb}`;\n if (userNumb == playerNumb) {\n nameLabel.innerHTML = userName + \" (You)\";\n } else {\n nameLabel.innerHTML = userName;\n }\n\n parent.appendChild(userBadge);\n userBadge.appendChild(profileHeaderContainer);\n profileHeaderContainer.appendChild(profileHeaderImg);\n profileHeaderImg.appendChild(imgCircle);\n profileHeaderImg.appendChild(rankLabelContainer);\n rankLabelContainer.appendChild(nameLabel);\n\n if (animate) {\n profileHeaderContainer.classList.add('jello-vertical');\n }\n}", "function addUserToList(user_name, user_list) {\r\n if (!user_list) {\r\n user_list = document.getElementById('user_list');\r\n }\r\n\r\n var li = document.createElement(\"li\");\r\n var span_name = document.createElement(\"span\");\r\n\r\n li.id = user_name;\r\n span_name.className += \"chat_name\";\r\n span_name.onclick = function() {\r\n var text_box = document.getElementById('msg');\r\n text_box.value = text_box.value + user_name + \": \";\r\n document.getElementById('msg').focus();\r\n };\r\n span_name.appendChild(document.createTextNode(user_name));\r\n\r\n li.appendChild(span_name);\r\n user_list.appendChild(li);\r\n}", "function displayUsers(users) {\r\n\t/* TODO: Pre-compile. */\r\n\tvar liTemplate = Handlebars.compile($(\"#user-list-template\").html());\r\n\tvar liHtml = liTemplate({\r\n\t\tusers : users\r\n\t});\r\n\t$(\"ul.users\").html(liHtml);\r\n\t$(\"#user-add-button\").bind(\"click\", function() {\r\n\t\tdisplayAddUserForm();\r\n\t});\r\n\t$(\"#user-add-form\").bind(\"submit\", function() {\r\n\t\tcreateUser();\r\n\t\treturn false;\r\n\t});\r\n}", "function displayUserEvents() {\n for (user of website.users) {\n //would be hilarious, if this worked\n let userEvents = user.savedEvents.map(e => `<li>${e.title}<br>${e.location} - ${e.date}<br>${e.description}</li>`)\n $('#my-events').append(`${user.title}'s saved events:<br>${userEvents}`)\n\n }\n }", "function addDeliquentToPage(user) {\n var deliquentHTML = '<li>\\\n \t\t\t<ul id=\"photos_' + user.username + '\" class=\"cd-item-wrapper\">\\\n \t\t\t\t<!-- <li class=\"cd-item-out\">...</li> -->\\\n \t\t\t</ul> <!-- cd-item-wrapper -->\\\n \t\t\t<div class=\"cd-item-info\">\\\n \t\t\t\t<b><a href=\"#0\">' + user.displayName + '</a></b>\\\n <div class=\"pull-right\" style=\"padding-top:10px\">\\\n <input type=\"text\" id=\"' + user.username + '-chart\" value=\"' + user.percentLogged + '\">\\\n </div>\\\n </div> <!-- cd-item-info -->\\\n \t\t\t<nav>\\\n \t\t\t\t<ul class=\"cd-item-navigation\">\\\n \t\t\t\t\t<li><a class=\"cd-img-replace\" href=\"#0\">Prev</a></li>\\\n \t\t\t\t\t<li><a class=\"cd-img-replace\" href=\"#0\">Next</a></li>\\\n \t\t\t\t</ul>\\\n \t\t\t</nav>\\\n \t\t\t<a class=\"cd-3d-trigger cd-img-replace\" href=\"#0\">Open</a>\\\n \t\t</li>';\n\n $('#cd-gallery-items').append(deliquentHTML);\n\n var photoDiv = $('#photos_' + user.username);\n var i = 0;\n var className = \"\";\n while (i < user.photos.length && i < 4) {\n switch(i) {\n case 0:\n className = \"cd-item-front\";\n break;\n case 1:\n className = \"cd-item-middle\";\n break;\n case 2:\n className = \"cd-item-back\";\n break;\n case 3:\n className = \"cd-item-out\";\n break;\n }\n $(photoDiv).append('<li class=\"' + className + '\"><a href=\"#0\"><img src=\"' + user.photos[i] + '\"></a></li>');\n i++;\n }\n // user.photos.forEach(function(photo) {\n // photoDiv.append('<li class=\"cd-item-front\"><a href=\"#0\"><img src=\"' + photo + '\"></a></li>');\n // });\n\n $('#' + user.username + '-chart').knob({\n readOnly: true,\n width: 50,\n height: 50,\n thickness: 0.1,\n fgColor: '#7385ad',\n bgColor: '#d8d8d8'\n });\n }", "function renderUsers(users) {\r\n\tvar body = document.getElementsByTagName('body')[0];\r\n\tvar table = document.createElement('table');\r\n\r\n\ttable.setAttribute('class', 'table table-striped table-hover');\r\n\ttable.setAttribute('id', 'usersTable');\r\n\r\n\tvar thead = document.createElement('thead');\r\n\r\n\tvar thFirstName = document.createElement('th');\r\n\tthFirstName.innerHTML = \"First Name\";\r\n\tthead.appendChild(thFirstName);\r\n\r\n\tvar thLastName = document.createElement('th');\r\n\tthLastName.innerHTML = \"Last name\";\r\n\tthead.appendChild(thLastName);\r\n\r\n\ttable.appendChild(thead);\r\n\r\n\tvar tbody = document.createElement('tbody');\r\n\ttable.appendChild(tbody);\r\n\r\n\tfor (var i = 0; i < users.length; i++) {\r\n\t\tvar user = users[i];\r\n\t\tvar tr = document.createElement('tr');\r\n\r\n\t\tvar tdFirstName = document.createElement('td');\r\n\t\ttdFirstName.innerHTML = user.firstName;\r\n\t\ttr.appendChild(tdFirstName);\r\n\r\n\t\tvar tdLastName = document.createElement('td');\r\n\t\ttdLastName.innerHTML = user.lastName;\r\n\t\ttr.appendChild(tdLastName);\r\n\r\n\t\ttbody.appendChild(tr);\r\n\r\n\t}\r\n\r\n\tbody.appendChild(table);\r\n}", "function renderUsers() {\n // Clear the list element so that its a clean slate every time\n ulEl.innerHTML = \"\";\n\n // Render a new li for each highscore\n for (var i = 0; i < users.length; i++) {\n // Create a new user object that pulls from the user array\n var user = users[i];\n\n // Set the text content of the list element to the user's information\n var li = document.createElement(\"li\");\n li.textContent = user.userNum + \". \" + user.initials + \" - \" + user.score;\n\n // Append the list element to the unordered list\n ulEl.appendChild(li);\n }\n}", "function renderUserList(doc){\r\n \r\n // Creates elements.\r\n let li = document.createElement('li');\r\n let name = document.createElement('span');\r\n let user_id = document.createElement('span');\r\n \r\n // Sets specific content in id to each element.\r\n li.setAttribute(\"data-id\", doc.id);\r\n name.textContent = doc.data().firstName + \" \" + doc.data().lastName;\r\n user_id.textContent = \" :: \" + doc.data().userID;\r\n\r\n // Appends content into li.\r\n li.appendChild(name);\r\n li.appendChild(user_id);\r\n\r\n // Appends li to the user_list (ul)\r\n user_list.appendChild(li);\r\n\r\n // Adds \"onclick\" function to each element in the list.\r\n li.onclick = function goToStaff(){\r\n user_selector = li.getAttribute('data-id');\r\n localStorage.setItem(\"user_selector\", user_selector);\r\n console.log(user_selector);\r\n window.open(\"staff/staff_default.html\", \"_self\");\r\n \r\n }\r\n // Enables scrolling inside of a spescific div.\r\n document.addEventListener(\"touchstart\", function(){}, true)\r\n}", "createUser () {\n this.sendButton.textContent = 'Go'\n this.form.setAttribute('class', 'userContainer')\n this.form.addEventListener('submit', this.saveUser)\n }", "function outputUsers(users){\n userList.innerHTML = `\n ${users.map(user => `<li>${user.username}</li>`).join('')}\n `;\n}", "function ChangeDOMBySession(LoadUser) {\n\n let idContainer = \"IDUser\";\n let removeAref = document.getElementById(\"Changelogin\");\n let father = removeAref.parentNode;\n \n father.removeChild(removeAref);\n\n let Container = document.getElementById(idContainer);\n const fragment = document.createDocumentFragment();\n const NameUser = document.createElement('p');\n NameUser.setAttribute(\"id\", \"IDNameUser\");\n NameUser.setAttribute(\"style\", \"color: black;\");\n NameUser.style.fontSize = \"25px\";\n NameUser.textContent = LoadUser.firstName;\n fragment.appendChild(NameUser);\n Container.appendChild(NameUser);\n Container.style.paddingLeft = \"28px\";\n Container.style.marginLeft = \"10px\";\n Container.style.marginTop = \"8.5px\";\n}", "function showMembersOfCurrentRoom(usersInRoom) {\n usersOfRoom = usersInRoom;\n const onlineMembersArea = document.getElementById('online_members');\n onlineMembersArea.innerHTML = '';\n usersInRoom.forEach((user) => {\n const userDiv = document.createElement('div');\n userDiv.classList.add('room_member');\n userDiv.setAttribute('id', `roomMember_${user.userId}`);\n const smallCircle = document.createElement('div');\n smallCircle.classList.add('small_circle');\n const userName = document.createElement('p');\n userName.textContent = user.name;\n userDiv.appendChild(smallCircle);\n userDiv.appendChild(userName);\n onlineMembersArea.appendChild(userDiv);\n })\n}", "function escucha_users(){\n\t/*Activo la seleccion de usuarios para modificarlos, se selecciona el usuario de la lista que\n\tse muestra en la pag users.php*/\n\tvar x=document.getElementsByTagName(\"article\");/*selecciono todos los usuarios ya qye se encuentran\n\tdentro de article*/\n\tfor(var z=0; z<x.length; z++){/*recorro el total de elemtos que se dara la capacidad de resaltar al\n\t\tser seleccionados mediante un click*/\n\t\tx[z].onclick=function(){//activo el evento del click\n\t\t\t/*La funcion siguiente desmarca todo los articles antes de seleccionar nuevamente a un elemento*/\n\t\t\tlimpiar(\"article\");\n\t\t\t$(this).css({'border':'3px solid #f39c12'});\n\t\t\tvar y=$(this).find(\"input\");\n\t\t\tconfUsers[indice]=y.val();\n\t\t\tconsole.log(confUsers[indice]);\n\t\t\t/* indice++; Comento esta linea dado que solo se puede modificar un usuario, y se deja para \n\t\t\tun uso posterior, cuando se requiera modificar o seleccionar a mas de un elemento, que se\n\t\t\talmacene en el arreglo de confUser los id que identifican al elemento*/\n\t\t\tsessionStorage.setItem(\"conf\", confUsers[indice]);\n\t\t};\n\t}\n}", "function appendUsers() {\n queryRequest(uniqueProjectUsers);\n usersWithNumberOfIssues.length = 0;\n uniqueProjectUsers.forEach(function (user) {\n var numberOfIssues = 0;\n issuesOfProject.forEach(function (issue) {\n if (issue.assignee == user) {\n numberOfIssues++;\n }\n })\n if (user == 'Unassigned') {\n usersWithNumberOfIssues.push({\n user: user,\n numberOfIssues: numberOfIssues,\n color: 'color: #1678CC'\n })\n } else {\n usersWithNumberOfIssues.push({\n user: user,\n numberOfIssues: numberOfIssues\n })\n }\n })\n buildPieChart();\n}", "function outputUsers(users){\n userList.innerHTML=`\n ${users.map(user => `<li>${user.username}</li>`).join(\"\")}`;\n}", "function outputUsers(links) {\n userList.innerHTML = `\n ${links.map(link => `<li>${link.username}</li>`).join('')}\n `;\n}", "function addUser() {\n }", "function outputUsers(users){\n userList.innerHTML=`\n ${users.map(user=>`<li>${user.username}</li>`).join('')}\n `\n}", "function updateUserList(nicknames) {\n var $userListDiv = $('.user-list');\n var $userList;\n $userListDiv.empty();\n $userListDiv.append('<span class=\"user-count\">' + nicknames.length + ' users currently connected</span>');\n $userList = $('<ul></ul>').appendTo($userListDiv);\n for (var i = 0; i < nicknames.length; i++) {\n $userList.append('<li>' + nicknames[i] + '</li>');\n }\n}" ]
[ "0.7952884", "0.7369776", "0.70811844", "0.69950676", "0.69260037", "0.6859463", "0.68376815", "0.6807424", "0.6793708", "0.6773879", "0.6771808", "0.6758447", "0.67424613", "0.6739701", "0.67254215", "0.66942924", "0.6682839", "0.6682308", "0.66621274", "0.66621274", "0.66621274", "0.6647247", "0.6647071", "0.66219413", "0.65999955", "0.65975434", "0.6586078", "0.657853", "0.652538", "0.65149397", "0.64880514", "0.647484", "0.6460935", "0.6440008", "0.6436895", "0.64341944", "0.64297396", "0.6394776", "0.6342428", "0.634202", "0.63346356", "0.63307136", "0.63211244", "0.6303352", "0.6300536", "0.62930954", "0.62872", "0.62855184", "0.62852526", "0.62749845", "0.6243346", "0.6241933", "0.6241933", "0.6236873", "0.62353855", "0.6231499", "0.6218247", "0.6216333", "0.6212636", "0.62120223", "0.6205065", "0.61990416", "0.6188973", "0.6182341", "0.61745465", "0.6172362", "0.6171067", "0.61484796", "0.6136351", "0.61351806", "0.6124474", "0.61112696", "0.6110568", "0.61019933", "0.6099972", "0.60961896", "0.60882443", "0.6088116", "0.6083538", "0.6082827", "0.6078638", "0.60777617", "0.60663146", "0.6066058", "0.60623306", "0.60549533", "0.6049319", "0.60444576", "0.6042352", "0.60387325", "0.60383046", "0.60290664", "0.6028974", "0.602297", "0.60165", "0.6013535", "0.60081315", "0.60056025", "0.60030323", "0.6001025" ]
0.62353987
54
same as first func
function initDragula() { dragger.destroy(); dragger = dragula([ document.getElementById("required"), document.getElementById("1A"), document.getElementById("1B"), document.getElementById("2A"), document.getElementById("2B"), document.getElementById("3A"), document.getElementById("3B"), document.getElementById("4A"), document.getElementById("4B"), document.getElementById("5A"), document.getElementById("5B"), document.getElementById("6A"), document.getElementById("6B"), document.getElementById("7A"), document.getElementById("7B"), document.getElementById("8A"), document.getElementById("8B"), document.getElementById("9A"), document.getElementById("9B"), document.getElementById("10A"), document.getElementById("10B"), document.getElementById("trash") ]); dragger.on('drop', function (el, target, source) { const term = $(target).attr("id"); const src = $(source).attr("id"); let draggedId = el.id; let termIndex = 0; if (term === "trash") { emptyTrash(); checkSchedule(termIndex); } else if (term === "required") { // no operations if courses are dragged back to required courses // need to change in future because all course needs to be validated again document.getElementById(draggedId).style.color = "darkslateblue"; // back to original color checkSchedule(termIndex); } else { if (src === "required") { //only check schedule for course after term has been dropped termIndex = terms.indexOf(term); } else { //src is Term Number termIndex = Math.min(terms.indexOf(src), terms.indexOf(term)); } // else needs to check all schedule again` checkSchedule(termIndex); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function firstFunc(funcParam){\n funcParam();\n}", "function first(func, array){\n for (var i=0; i<array.length; i++){\n\t if (func(array[i])) return array[i];\n }\n return undefined;\n }", "function firstFunction(array) {\n return array[0];\n }", "function first(arr, cb) { // chose \"arr\" because if you look below, they are passing in an array of names\n cb(arr[0]);\n}", "function first(a, fn) {\n for (var i = 0, l = a.length; i < l; i++) {\n if (fn(a[i]))\n return a[i];\n }\n return;\n }", "function first(arr) {\n return arr[0]; // complete this statement\n}", "first(){\n return this.first; \n }", "first(func = (item) => item) {\n if (this.rootNode.length >= 1) {\n func(this.get(0), 0);\n return this.get(0);\n }\n return this;\n }", "first(func = (item) => item) {\n if (this.rootNode.length >= 1) {\n func(this.get(0), 0);\n return this.get(0);\n }\n return this;\n }", "function first(a){\n return (a[0]);\n }", "function first(names, cb){\n return cb(names[0]);\n }", "function first(value,callback){\n callback(value+2,false);\n}", "function first() {\n console.log('I am first!');\n}", "function returnFirst(arr) {\n // return the first item from the array\n\nreturn arr[0] ;\n \n}", "function first(value){\n return value[0];// returns first value sequence\n}", "function firstFunc(input, callback){\n console.log(input);\n callback();\n}", "function firstFunction() {\r\n console.log(\"This is the first item\");\r\n}", "function first(a, fn) {\n var i, l;\n for (i = 0, l = a.length; i < l; i++) {\n if (fn(a[i]))\n return a[i];\n }\n return;\n}", "function first() {\n console.log(1);\n}", "function P_first (p, q) {\n return P.bind(p, v => P.next(q, P.always(v)));\n}", "function first(arr) {\n return arr[0];\n}", "function getFirst(arr){\r\n return arr[0]\r\n}", "first(returnNode) {\n let node = this[this._start][this._next];\n return returnNode ? node : node.data;\n }", "function first(arr) {\n return arr[0];\n }", "function getFirst(x){\n\nactions[i]\n y.first = x[0]\nreturn x\n}", "function firstOfArray(arr){\nreturn (arr[0]);\n}", "function car(f) {\n function first(a, b) {\n return a;\n }\n return f(first);\n}", "first() {\n return this._first && this._first.value;\n }", "function second() {\r\n return third();\r\n }", "one(fn) {\n return this._one(fn);\n }", "function first(arr) {\n console.log(arr[0]);\n}", "function fun1(){} //toda a função de js retorna alguma coisa", "function firstFunction() {\n console.log(\"Functions don't have to return values.\");\n}", "function first(input) {\n return input[0];\n }", "function once(fn) {\n var first = true;\n return function(...args) {\n if (first) {\n first = false;\n return fn(...args);\n }\n }\n}", "function one(){\n \n}", "function getFirstElem(arr) {\r\n\r\n // -------------------- Your Code Here --------------------\r\n\r\n\r\n\r\n return arr[0];\r\n\r\n // --------------------- End Code Area --------------------\r\n}", "function fun1 ( ) {}", "function firstTrue(array) {\n for (var element of array) {\n if (args[1](element)){\n return element;\n }\n }\n return undefined;\n }", "function defineFirstArg(func, arg) {\n return function(args) {\n return func(arg, args)\n }\n}", "function doFirst(request,response,next){\n\tconsole.log('doFirst is called');\n\t//you can implement something using request and response also.\n\tnext();\n}", "function doSth(fn) {\n fn(1);\n}", "function firstArg() {\n\treturn arguments != \"\" ? [...arguments].shift() : undefined;\n}", "function first() {\n array = ['1', '2', '3'];\n return array.shift()\n}", "one(fn) {\r\n return this._one(fn);\r\n }", "function addg(first) {\n function more(next) {\n if (next === undefined) {\n return first;\n };\n first += next;\n return more;\n };\n if (first !== undefined) {\n return more;\n };\n}", "function firstToMaybe(first) {\n if(isFunction(first)) {\n return function(x) {\n var m = first(x)\n\n if(!isSameType(First, m)) {\n throw new TypeError('firstToMaybe: First returing function required')\n }\n\n return applyTransform(m)\n }\n }\n\n if(isSameType(First, first)) {\n return applyTransform(first)\n }\n\n throw new TypeError('firstToMaybe: First or First returing function required')\n}", "function fun1(){}", "function fun1(){}", "function first(a) { return (a instanceof Array) ? a[0] : a; }", "function first(array) {\n return array[0];\n}", "function miFuncion (){}", "function fn() {\n\t\t }", "function get_first_elmt() {\n return obj[0];\n}", "function f2(arr){\n return arr[0];\n }", "firstDraw() {}", "_firstRendered() { }", "function firstItemReturn(arry) {\n return arry[0];\n }", "function first(){\n console.log(\"I'm the first to be called\")\n second();\n}", "function fun1() {}", "function fun1() {}", "function fun1( ) { }", "function first(){\n\tvar numbers=[1,2,3,4,5];\n\tvar first=_.first(numbers,3);\n\tconsole.log(first);\n}", "first() {\n this.reset();\n return this.next();\n }", "function one() {\n return 1;\n}", "function one() {\n return 1;\n}", "function one() {\n\t// this 'a' var only belongs to the one() fn\n\tvar a = 1;\n\tconsole.log(a);\n}", "function first() {\n\t var clean = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : filter.ignoreMissing;\n\t\n\t return function (values) {\n\t var cleanValues = clean(values);\n\t if (!cleanValues) return null;\n\t return cleanValues.length ? cleanValues[0] : undefined;\n\t };\n\t}", "function first(func){\n var run = true; \n return function second(){ \n if (run === true) {\n func();\n run = false;\n }\n }\n}", "function dummy(){}", "function dummy(){}", "function dummy(){}", "function firstToAsync(left, first) {\n if(isFunction(first)) {\n return function(x) {\n var m = first(x)\n\n if(!isSameType(First, m)) {\n throw new TypeError('firstToAsync: First returing function required for second argument')\n }\n\n return applyTransform(left, m)\n }\n }\n\n if(isSameType(First, first)) {\n return applyTransform(left, first)\n }\n\n throw new TypeError('firstToAsync: First or First returing function required for second argument')\n}", "function firstVal(arr, callback) {\n callback(arr[0], 0, arr);\n}", "function addg(first) {\n function more(next) {\n if (next === undefined) {\n return first\n }\n first += next;\n return more; // return itself\n }\n if (first !== undefined) {\n return more; //return itself\n }\n}", "_firstButtonClickHandler() {\n const that = this;\n\n that.first();\n }", "function func1() {}", "function miFuncion(){}", "function miFuncion(){}", "function miFuncion(){}", "function first(two, N) {\n return function() {\n if (N > 1) {\n console.log('STAHHP');\n }\n else {\n N++;\n return two();\n }\n }\n}", "firstRun() { }", "function fun1( /*parametros opcionais*/ ){ /*retorno opcional*/ }", "function one(){\n\treturn 4\n}", "function rest(func, start) {\n\t return overRest$1(func, start, identity);\n\t}", "function firstOfArray(array){\n\n return array[0] ;\n}", "function firstOrNth() {\n\n }", "function firstElement(array) {\r\n return array[0];\r\n}", "function func1(){ // Em funções normais, não se pode omitir seus blocos, denotados por chaves. Apenas em arrow-functions.\r\n \r\n // O retorno de valor é facultativo. Caso você não ponha, ele retornará 'undefined'.\r\n }", "function firstElement(array) {\r\n return array[0];\r\n}", "function fst(tuple){\r\n return tuple[0];\r\n}", "function firstFunction() //abhi argument zero hai \n{//function body open\n\n //here we write a task\n console.log(\"Hello , \");\n console.log(\"How are you?\");\n console.log(\"What are you doing\");\n\n}", "function firstVal(data, callback) {\n if (data === 'array') {\n callback(data[0], 0, data);\n } else if (data === 'object') {\n var object = Object.keys(data);\n callback(object[0], 0, data);\n }\n}", "function s(){}", "function f1() {}", "function once(fn){\n\tvar firstExecution = true;\n\tvar result;\n\treturn function(){\n\t\tif(firstExecution){\n\t\t\tresult = fn();\n\t\t\tfirstExecution = false;\n\t\t\treturn result;\n\t\t} else {\n\t\t\treturn result;\n\t\t}\n\t}\n}", "function BOT_first(list) {\r\n\tif(list.length>0) return list[0]\r\n\telse return (undefined);\r\n}", "function head(array) {\n var firstElement = array[0];\n return firstElement;\n}", "function first(next, common) {\n\t\t\tvar defer = $.Deferred();\n\n\t\t\t// first started at:\n\t\t\tstarted.first = new Date();\n\n\t\t\t// check if common is equal to the original common\n\t\t\tdeepEqual(common, commonData, 'common correctly passed to first')\n\n\t\t\t// set a value on common\n\t\t\tcommon.first = 'apple';\n\n\t\t\tsetTimeout(defer.resolve, 500);\n\n\t\t\treturn defer;\n\t\t}", "function fun1() { }", "function fun1() { }" ]
[ "0.71622723", "0.6917423", "0.6829868", "0.666389", "0.6551532", "0.6531658", "0.6525417", "0.6499219", "0.6499219", "0.6491045", "0.6417933", "0.6415121", "0.6395186", "0.6393414", "0.63775855", "0.63620055", "0.632454", "0.6301253", "0.6288463", "0.6282723", "0.6275193", "0.6252467", "0.622124", "0.6217571", "0.62002486", "0.6180491", "0.61667097", "0.61650896", "0.6135335", "0.61075413", "0.6096385", "0.60862464", "0.6084577", "0.60505205", "0.60487026", "0.60414183", "0.6040219", "0.6033564", "0.60231113", "0.6001128", "0.6000972", "0.5999325", "0.5988243", "0.5987439", "0.596196", "0.5945443", "0.59308946", "0.592951", "0.592951", "0.5925502", "0.5922887", "0.58944064", "0.58842754", "0.58773804", "0.58767277", "0.58624446", "0.58591706", "0.58517194", "0.5837182", "0.583028", "0.583028", "0.58276796", "0.5825423", "0.58132446", "0.57964844", "0.57964844", "0.579523", "0.57918257", "0.579165", "0.5783276", "0.5783276", "0.5783276", "0.57826304", "0.57727057", "0.57580113", "0.57444066", "0.573856", "0.57302594", "0.57302594", "0.57302594", "0.57279164", "0.5726422", "0.57223934", "0.5711959", "0.57023764", "0.56985784", "0.5678509", "0.56640965", "0.56531566", "0.5649271", "0.5642034", "0.56287414", "0.56239986", "0.56070834", "0.56068134", "0.5606535", "0.55980754", "0.55976146", "0.55956465", "0.5592348", "0.5592348" ]
0.0
-1
Vanilla JS to add a new task
function addTask() { /* Get task text from input */ const inputTask = document.getElementById("taskText").value.toUpperCase(); let id = inputTask + "(" + Math.round(Math.random() * 100) + ")"; //generate random number to prevent unique id id = id.replace(" ", ""); // check if inputTask has whitespace if (/\S/.test(inputTask)) { /* Add task to the 'Required' column */ $.ajax({ url: 'http://127.0.0.1:8000/api/course-info/get/' + inputTask, type: 'get', // This is the default though, you don't actually need to always mention it success: function (data) { document.getElementById("required").innerHTML += "<li class='task' id='" + id + "' onclick='popupWindow(\"" + id + "\",-1)'>" + "<p>" + inputTask + "</p></li>"; }, error: function (data) { document.getElementById("required").innerHTML += "<li class='task' id='" + id + "' onclick='popupWindow(\"" + id + "\",-1)'>" + "<p>" + inputTask + " *</p></li>"; } }); /* Clear task text from input after adding task */ document.getElementById("taskText").value = ""; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addTask() {\n Task.addTask(info.newTask);\n info.newTask = \"\";\n }", "addTask() {\n const input = qs('#addTask');\n saveTask(input.value, this.key);\n this.showList();\n }", "addNewTask() {\n let task = new Task(this.newTaskName);\n task.id = new Date().getMilliseconds();\n this.tasks.push(task);\n }", "function addTask() {\r\n\r\n var taskId = \"task_\" + taskCount++;\r\n\r\n var task = createTask(taskId, \"\", \"\");\r\n taskList[taskId] = task;\r\n\r\n var domElement = createNewTaskDOMElement(task);\r\n taskListDOMElements[taskId] = domElement;\r\n\r\n showTaskDetail(task);\r\n}", "function addTask() {\n // Create task\n let newTask;\n \n // Get task name from form\n taskName = $(\"#task-input\").val()\n\n // Add caracteristics to newTask\n newTask = new Task(taskName, false, tasks.length);\n\n // Add task to list of tasks\n tasks.push(newTask);\n\n // Reset value of field\n $(\"#task-input\").val(\"\")\n updateUI();\n\n}", "function add_task() {\n const task = NEW_TASK.value.trim();\n if (task !== '') {\n COMPLETE_ALL.checked = false;\n TASK_LIST.appendChild(create_task(task, false));\n }\n NEW_TASK.value = '';\n save();\n}", "function addTask(e) {\n\tvar inputEl = document.getElementById(\"input-task\");\n\t\n\tif (!inputEl.value.isNullOrWhitespace())\n\t{\n\t\t// Create a unique ID\n\t\tvar id = \"item-\" + tasks.length;\n\t\t\n\t\t// Create a new task\n\t\tvar task = new Task(id, inputEl.value, taskStatus.active);\n\t\t\n\t\t// Append the task to the DOM\n\t\taddTaskElement(task);\n\t\t\n\t\t// Reset input\n\t\tinputEl.value = \"\";\n\t}\n}", "function addNewTask(task) {\n let uniqueID = timeStamp();\n let data = {\n text: task,\n isDone: false,\n idNum: uniqueID,\n };\n toDoList.push(data);\n addTask(data);\n commitToLocalStorage(toDoList);\n}", "function add_new_task()\n {\n //get task text\n let tmp_tsk_txt = document.getElementById(\"new_tsk_txt\").value;\n \n //check that task text not empty-cells\n if(tmp_tsk_txt == \"\")\n {\n doc_alert(\"You cannot submit a blank task.\");\n return false;\n }\n else\n {\n \n let tmp_task = create_new_task(tmp_tsk_txt);\n add_task(tmp_task);\n //add task to the task list\n curr_list.todos.push(tmp_task);\n update_list(curr_list);\n return true;\n }\n }", "function addTask() {\n\t\t\tvm.totalTime = 0;\n\t\t\ttaskDo.service.addTask(vm).then(function (response) {\n\t\t\t\tvm.sample=\"vamsi\";\n\t\t\t});\n\t\t}", "function AddTask()\n{\n\t// get to do item from user input\n\tvar name = document.getElementsByName('task')[0].value;\n\n\tif(name == \"\") {\n\t\talert('Please enter task name.');\n\t\treturn;\n\t}\n\n\tvar status = false;\n\tvar completeDate = \"\";\n\n\t// create new task\n\tvar newTask = new task(name, status, completeDate);\n\t// add new task to list\n\ttodos.push(newTask);\n\t\t\n\t//update view\n\tthis.view();\n}", "function addTask () {\r\n tasks.setSelected(tasks.add())\r\n taskOverlay.hide()\r\n\r\n tabBar.updateAll()\r\n addTab()\r\n}", "function addTask(task){\n\ttasks.push(task);\n}", "addTask(description){\n var task = new Task(description);\n this.push(task);\n task.addToDom();\n }", "function addTask(newTask) {\n //create list element and set its class\n const newTaskItem = document.createElement('li');\n newTaskItem.setAttribute('class', 'task_item');\n\n // create checkbox element and set its type and class\n const newCheckBtn = document.createElement('div');\n newCheckBtn.setAttribute('class', 'task_check_btn');\n\n // create span element and set its class and add new task input\n const newTaskBio = document.createElement('span');\n newTaskBio.setAttribute('class', 'task_bio');\n\n // add input value to li\n newTaskBio.innerText = newTask;\n\n // insert li tag inside the ul tag\n taskList.appendChild(newTaskItem);\n\n // insert checkbox to li\n newTaskItem.appendChild(newCheckBtn);\n\n // insert newTask into li\n newTaskItem.appendChild(newTaskBio);\n\n // run Function when task is completed and checkbox is check.\n onTaskComplete(newCheckBtn);\n}", "addTask(e) {\n e.preventDefault();\n const value = this.addTaskForm.querySelector('input').value;\n if (value === '') return;\n this.tasks.createTask(new Task(value));\n this.renderTaskList(this.tasks.tasks);\n this.clearInputs();\n }", "function onclick_add_new_task() {\n insertNewTask();\n}", "function addTask(task) {\n task.elapsed = task.elapsed.hours + \":\" + task.elapsed.minutes + \":\" + task.elapsed.seconds;\n task.color = task.color.replace('#', '');\n task.description = \"(No description)\";\n task._csrf = document.getElementById('csrf').value;\n delete task.color;\n var req = new XMLHttpRequest();\n req.open('post', '/tasks');\n req.setRequestHeader('Content-Type', 'application/json');\n req.setRequestHeader('csrfToken', task._csrf);\n req.send(JSON.stringify(task));\n var taskAmt = document.getElementById('task-amt');\n taskAmt.value = taskAmt.placeholder = document.getElementById('hidden-value').value; //Set the value and placeholder to the projects default value\n}", "function insertNewTask() {\n let newTask = document.getElementById(\"input_new_task\").value;\n let obj = {};\n obj['id'] = taskCount;\n obj['task'] = newTask;\n obj['complete'] = false;\n tasksList.push(obj);\n taskCount += 1;\n const finalData = generateTasksList();\n document.getElementById(\"divTasksList\").innerHTML = finalData;\n document.getElementById(\"input_new_task\").value = '';\n}", "function addNewTask() {\n buttonAdd.onclick = function () {\n if (!newText.value || !newText.value.trim()) return alert('Please, input your text')\n newContainer.classList.add(hiddenClass)\n let id = listTask.length ? listTask[listTask.length - 1].id + 1 : 0\n let date = new Date().toJSON()\n const task = {\n id,\n text: newText.value.trim(),\n date,\n completed: false\n }\n listTask.push(task)\n addTaskToDom(task, listBlock)\n newText.value = ''\n setTaskValue()\n localStorage.setItem('listTask', JSON.stringify(listTask))\n }\n }", "function addTask() {\n values={};\n values.task=$('#task').val();\n\n $.ajax({\n type: 'POST',\n url: '/task',\n data: values,\n success: function(){\n updateTaskList();\n }\n });\n}", "function addTask(task){\n return db.insert(task,\"*\").into(\"tasks\");\n}", "function addToDo() {\n let tasks = document.getElementById('tasks')\n let newTask = document.createElement('li')\n let lastTask = tasks.appendChild(newTask)\n lastTask.innerHTML = document.getElementById('new-task-description').value;\n }", "function addTask(task){\n var txt = document.createTextNode(task);\n var li = document.createElement(\"LI\");\n li.appendChild(txt);\n li.id=counter;\n counter++;\n myTaskList.incomplete.push(li);\n addCloseButton(li);\n addChecked(li);\n updateTaskList();\n}", "function addTask(name) {\n // Construct the Object from the given name\n let newTask = { title: name, isCompleted: 0 };\n\n todoListService.addTask(newTask).then((response) => {\n newTask.id = response.data.data[\"insertId\"];\n // Update the state\n setTasks([...tasks, newTask]);\n });\n\n // Update the server\n }", "addTask() {\n\t\tif (taskTitle.value !== undefined && taskTitle.value !== '') {\n\t\t\t//This next line adds the newly defined goal to an array of goals created in this session\n\t\t\tnewTaskList.push(taskTitle.value);\n\t\t\tconsole.log(`New Task List: ${newTaskList}`); //Goals are stored correctly\n\t\t\tthis.addTaskDOM(taskTitle.value, false);\n\t\t\tfetch('/items', {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t 'Accept': 'application/json',\n\t\t\t\t 'Content-Type': 'application/json'\n\t\t\t\t},\n\t\t\t\t body: JSON.stringify({\n\t\t\t\t\t title: taskTitle.value, \n\t\t\t\t\t goal_id: userGoals.goals[userGoals.goalIndex].id\n\t\t\t\t\t})\n\t\t\t })\n\t\t\t .then(res => res.json())\n\t\t\t .then(res => {\n\t\t\t\t userGoals.goals[userGoals.goalIndex].items.push(res);\n\t\t\t\t this.setId(res.id);\n\t\t\t\t})\n\t\t\t .catch(error => console.error(error));\n\n\t\t\ttaskTitle.value = '';\n\t\t\t\n\t\t\tcloseTaskForm();\n\t\t}\n\t\telse{\n\t\t\talert('Please enter new tasktitle');\n\t\t}\n\t\t// this.edit();\n\t}", "async function addTask() {\n\n // the next line is only for testing purposes\n allTasks = await getArrayFromBackend('allTasks');\n\n let task = getValues();\n allTasks.push(task);\n\n saveArrayToBackend('allTasks', allTasks);\n\n // the next line is only for testing purposes\n allTasks = await getArrayFromBackend('allTasks');\n\n clearFields();\n showSnackbar(\"Task pushed to backlog!\");\n\n //Show backlog page with new task added\n setTimeout(function () {\n document.location.href = \"../pages/backlog.html\";\n }, 3000);\n}", "function addTask(taskName) {\n // Use templateList.content.querySelector to select the component of the template.\n const taskElement = document.importNode(templateList.content.querySelector('.taskItem'), true);\n // Assign the class name\n taskElement.className = 'activeItem';\n // Select the components from the list.\n const activeItem = taskElement.querySelector('input');\n const activeIcon = taskElement.querySelector('label');\n // Change the icon and text.\n activeIcon.innerHTML = '&#10065';\n activeItem.value = taskName;\n // Append to ul\n taskList.appendChild(taskElement);\n}", "function addTask(task) {\n return toDoList.push(task);\n}", "function addTask(taskID, task)\n{\n const table = $(\"#tasklist\");\n // create a new row\n const newRow = makeTasklistRow(taskID, task);\n // finally, stick the new row on the table\n const firstTask = tasksExist(\"tasklist\");\n if (firstTask)\n {\n firstTask.before(newRow);\n }\n else\n {\n table.append(newRow);\n }\n}", "function addTask(title) {\n info.tasks.push({title: title, added: new Date()});\n }", "addTask(newTask){\n this.tasks.push(newTask);\n }", "function addTask(event) {\n event.preventDefault();\n const taskDiv = document.createElement(\"div\");\n taskDiv.classList.add(\"task\");\n\n //List - append\n const newTask = document.createElement(\"li\");\n newTask.innerText = inpTask.value;\n newTask.classList.add(\"task-item\");\n taskDiv.appendChild(newTask);\n\n //Legg til i liste lokalt på pc\n\n saveLocalTasks(inpTask.value);\n\n\n //Done-button\n const doneBtn = document.createElement(\"button\");\n doneBtn.innerHTML = \"Done\";\n doneBtn.classList.add(\"done-btn\");\n taskDiv.appendChild(doneBtn);\n\n //Delete-button\n const deleteBtn = document.createElement(\"button\");\n deleteBtn.innerHTML = \"Delete\";\n deleteBtn.classList.add(\"del-btn\");\n taskDiv.appendChild(deleteBtn);\n\n //Add div to list\n taskList.appendChild(taskDiv);\n\n //Remove inp value\n inpTask.value = \"\";\n\n}", "addTask(name, description, assignedTo, dueDate, status) {\n // increment id\n let id = this.currentId++;\n\n // push to tasks array\n this.tasks.push({\n id,\n name,\n description,\n assignedTo,\n dueDate,\n status,\n });\n }", "function addTask(e){\n e.preventDefault();\n \n // 3. read what is inside the input / validate input\n const taskName = inputTask.value.trim();\n const taskDescr = inputDescription.value.trim();\n const taskDate = inputDate.value.trim();\n \n \n if (taskName.length > 0 && taskDescr.length > 0 && taskDate.length > 0) {\n const startBtn = el(\"button\", \"Start\", {className: \"green\"});\n const finishBtn = el(\"button\", \"Finish\", {className: \"orange\"});\n const deleteBtn = el(\"button\", \"Delete\", {className: \"red\"});\n \n const btnDiv = el(\"div\", [\n startBtn,\n deleteBtn,\n ], {className: \"flex\"});\n const task = el(\"article\", [\n el(\"h3\", taskName),\n el(\"p\", `description: ${taskDescr}`),\n el(\"p\", `Due Date: ${taskDate}`),\n btnDiv\n ])\n startBtn.addEventListener(\"click\", () => {\n progressDiv.appendChild(task);\n startBtn.remove();\n btnDiv.appendChild(finishBtn);\n })\n finishBtn.addEventListener(\"click\", () => {\n finishDiv.appendChild(task);\n btnDiv.remove();\n })\n deleteBtn.addEventListener(\"click\", () => {\n task.remove();\n })\n openDiv.appendChild(task);\n }\n }", "static newTaskSubmit() {\n const newTaskData = document.querySelector('#newTaskData').elements;\n const name = newTaskData[0].value;\n const dueDate = newTaskData[2].value;\n const priority = () => {\n const radioHigh = document.querySelector('#radioTaskHigh')\n const radioMed = document.querySelector('#radioTaskMed')\n const radioLow = document.querySelector('#radioTaskLow')\n if (radioHigh.checked) return 3;\n else if (radioMed.checked) return 2;\n else if (radioLow.checked) return 1;\n }\n const notes = newTaskData[1].value;\n const _currentTask = new Task(currentProject.id, currentTask.id, `${name}`, `${notes}`, `${dueDate}`, +priority(), false);\n const overlay2 = document.querySelector('#overlay2');\n overlay2.style.display = 'none';\n currentProject.addTask(_currentTask);\n ProjectLibrary.getSharedInstance().saveProject(currentProject);\n DomOutput.loadTaskList(currentProject);\n document.querySelector('#newTaskData').reset();\n }", "addTask(taskObj) {\n\t\tconst todos = this.getAndParse('tasks');\n\t\ttodos.push(taskObj);\n\t\tthis.stringifyAndSet(todos, 'tasks');\n\t}", "async addTask(input = { tasklistId: '0' }) {\n\n return await this.request({\n name: 'task.add',\n args: [input.tasklistId],\n params: {\n 'todo-item': input['todo-item']\n }\n });\n\n }", "addTask(name, description, assignedTo, dueDate, createdDay, status, rating) {\n this.currentId++;\n const task = {\n Id: this.currentId,\n name,\n description,\n assignedTo,\n dueDate,\n createdDay,\n status,\n rating,\n };\n this.tasks.push(task);\n }", "function addTask(task) {\n let html = '<div class=\"task-container flexbox\" id=\"' + task.ID + '\" ' + (task.isToday == true ? ' data-is-Today=\"true\">' : ' data-is-Today=\"false\">');\n html += '<a class=\"fa fa-circle icon complete-circle\"></a>';\n html += '<div class=\"task-text\">';\n html += '<div class=\"task-desc\">' + task.description + '</div>';\n if (task.dueDate != \"\") {\n html += '<div class=\"task-dueDate\">' + getDisplayDate(task.dueDate) + '</div>';\n } else {\n html += '<div class=\"task-dueDate hidden\"></div>';\n }\n html += '</div>';\n html += '<a class=\"fa fa-star icon important-star' + (task.isImportant == true ? ' important\">' : '\">') + '</a>';\n html += '</div>';\n\n let noTasksMsg = document.getElementsByClassName('no-tasks-msg')[0]\n if (noTasksMsg.classList.contains('hidden') == false) {\n noTasksMsg.classList.add('hidden');\n }\n\n document.getElementsByClassName('uncompleted-tasks')[0].innerHTML += html;\n}", "function assignmentsAddTask() {\n\tvar idx = assignmentsGetCurrentIdx();\n\tif (idx == -1) {\n\t\talert(\"Please select a folder first.\");\n\t\treturn;\n\t}\n\twhile (!assignments[idx].folder) idx--;\n\t\n\tvar taskNo = 1, i = idx + 1, level = assignments[idx].level + 1;\n\tvar namePart = \"Zadatak\";\n\twhile (i<assignments.length && assignments[i].level >= level) {\n\t\tif (assignments[i].level == level && assignments[i].name == namePart+\" \"+taskNo)\n\t\t\ttaskNo++;\n\t\ti++;\n\t}\n\t\n\tvar newId = assignmentsGetNewId();\n\tvar assignment = {\n\t\tid: newId,\n\t\ttype: \"task\",\n\t\tname: namePart+\" \"+taskNo,\n\t\tpath: \"Z\"+taskNo,\n\t\tfolder: false,\n\t\tfiles: [],\n\t\thomework_id: null,\n\t\thidden: false,\n\t\tauthor: authorName,\n\t\tlevel: level,\n\t\tvisible: 1,\n\t\tselected: 1\n\t};\n\tif (i == assignments.length)\n\t\tassignments.push(assignment);\n\telse\n\t\tassignments.splice(i, 0, assignment);\n\t\n\t// If path is already use, prepend Z\n\twhile(!assignmentValidatePath(i, false))\n\t\tassignments[i].path = \"Z\" + assignments[i].path;\n\t\n\tassignmentsRender();\n\tassignmentsClickOn(newId);\n\tassignmentsSendToServer();\n}", "function addTask() {\n //criou um elemento item\n const tarefa = document.createElement('li')\n //adicionou o conteudo do input ao item\n tarefa.innerText = input.value\n //adicionou o item à div listaTarefas\n listaTarefas.appendChild(tarefa)\n }", "function addTask(){\n\t\tif (item.value.length >= 1) {\n\t\t\tincompleteUl.append('<li>' + '<p>' + item.value + '</p>' + complete + remove + '</li>');\n\t\t\ttoDoList.push(item.value);\n\t\t}else {\n\t\t\talert(\"Please add a task\");\n\t\t}\n\n\t\ttoDoCount();\n\t\tnotToDoCount();\n\t\tcompleteTask();\n\t\tremoveTask();\n\t\taddClear();\n\t\titem.value = \"\";\n\t}", "function placeTasks(){\n let app = $(\"#current-tasks\");\n let taskList = document.createElement('ul');\n app.append(taskList);\n loadTasks().then((tasks)=>{\n tasks.forEach(task=>{\n newTask(task.name, task.id);\n });\n });\n }", "function addTask(event) {\n\tevent.preventDefault();\n\tvar array = ['Title', 'Name', 'Description'];\n\tfor (i=0;i < array.length;i++) {\n\t\tdocument.getElementById('add' + array[i]).value = '';\n\t}\n\tif(form.style.display == \"block\") {\n\t\tform.style.display = \"none\";\n\t} else {\n\t\tpanel.style.display = 'none';\n\t\tform.style.display = \"block\";\n\t\tvar add = document.createElement('a');\n\t\tfunction setAttributes(el, attrs) {\n\t\t for(var key in attrs) {\n\t\t el.setAttribute(key, attrs[key]);\n\t\t }\n\t\t}\n\t\tsetAttributes(add, {\"href\": \"#\", \"id\": \"saveTask\", \"class\": \"todo__btn\"});\n\t\tadd.innerHTML = 'Save changes';\n\t\tform.insertBefore(add, form.children[4]);\n\t}\n\tdocument.getElementById('saveTask').addEventListener('click', saveTask);\n}", "function newTask(e) {\n e.preventDefault();\n\n if(taskContent.trim() === \"\"){\n notifyError()\n return\n }\n\n const newTask = {\n content: taskContent,\n taskId: Math.random() * 10,\n checked: false,\n };\n\n setTasks([...tasks, newTask]);\n setTaskContent(\"\");\n }", "function addtask(task) {\n event.preventDefault()\n $.ajax({\n type: 'POST',\n url: '/tasks',\n data: task\n }).then(function(response){\n console.log('back from POST', response);\n $('#listedTasks').empty();\n getTask();\n task = {\n task: $('#nameTask').val(''),\n notes: $('#notes').val('')\n };\n }).catch(function(error) {\n console.log('error in POST', error)\n alert('cannot to add');\n });\n}", "addTasks(newTask)\n {\n this._tasks.push(newTask);\n }", "function Task(task) {\n this.task = task;\n this.id = 'new';\n }", "function addTaskElement(task) {\n\t// Create elements\n\tvar listEl = document.getElementById(\"active-list\");\n\tvar taskEl = document.createElement(\"li\");\n\tvar textEl = document.createTextNode(task.name);\n\t\n\t// Set ID attribute\n\ttaskEl.setAttribute(\"id\", task.id);\n\t\n\t// Add text to task element\n\ttaskEl.appendChild(textEl);\n\t\n\t// Add task element to list\n\tlistEl.appendChild(taskEl);\n}", "function createTask(v,t){\r\n \r\n }", "function addTask(){\n //update localstorage\n todos.push({\n item: $newTaskInput.val(),\n done: false\n })\n localStorage.setItem('todos', JSON.stringify(todos))\n //add to ui\n renderList()\n $newTaskInput.val('')\n $newTaskInput.toggleClass('hidden')\n $addTask.toggleClass('hidden')\n $addBtn.toggleClass('hidden')\n}", "addTask(name, description, assignedTo, dueDate) {\n const task = {\n // Increment the currentId property\n id: this.currentId++,\n name: name,\n description: description,\n assignedTo: assignedTo,\n dueDate: dueDate,\n status: \"TODO\",\n };\n\n // Push the task to the tasks property\n this.tasks.push(task);\n }", "function addTask(task) {\n var appTaskList = $('[phase-id=' + task.phase + '] .list');\n var allTasksList = $('.tasks-Pending .list');\n var taskItem ={\n _id: task._id,\n phase: task.phase,\n completed: task.completed,\n description: task.description,\n dueDate: task.dueDate\n };\n\n // if no tasks in pending list, create the pending list\n if(allTasksList.children().length==0) {\n var list = $('#task-list');\n list.prepend(Handlebars.templates['tasks']({\n label: 'Pending Tasks',\n tasks: [taskItem]\n })); \n } else {\n allTasksList.append(Handlebars.templates['task'](taskItem));\n }\n\n appTaskList.append(Handlebars.templates['task'](taskItem));\n $('.ui.checkbox').checkbox();\n}", "function addTask() {\n event.preventDefault();\n currentTask = {\n name: document.getElementById('newTaskForm').elements.taskName.value,\n status: document.getElementById('newTaskForm').elements.taskStatus.value,\n date: document.getElementById('newTaskForm').elements.taskDate.value,\n };\n // adding this object to the overall array\n console.log(currentTask);\n myTasks.push(currentTask);\n \n alert(\"Task added: \" + currentTask.name + \".\");\n document.getElementById('newTaskForm').reset();\n \n // updating/replacing the localStorage version.\n updateTasks();\n\n deleteDisplayList(-1);\n createTaskList(myTasks);\n \n // collapse the Property form\n document.getElementById('btnAddTaskCollapser').nextElementSibling.style.display = \"none\";\n}", "function addTasks() {\n const text =\n document.getElementById('enter-task').value;\n if (text) {\n tasks.push(new Task(text)); // somehow connect the tasks to the list they are in (optional-ish)\n showTasks();\n }\n // window.localStorage.setItem(lists, JSON.stringify(text));\n }", "function add() {\n var task = document.getElementById(\"task\").value;\n\n document.getElementById(\"task\").value = \"\";\n\n var d = new Date();\n var h = d.getHours();\n var m = d.getMinutes();\n var s = d.getSeconds();\n if (m < 10) {\n m = `0${m}`;\n }\n if (s < 10) {\n s = `0${s}`;\n }\n var text = `(${h}:${m}:${s})`;\n\n var todos = get_todos();\n\n if (task !== \"\") {\n todos.push(`${task} - ${text}`);\n localStorage.setItem(\"todo\", JSON.stringify(todos));\n show();\n }\n\n return false;\n}", "function addTask(task){\r\n let ul = document.querySelector('ul');\r\n let li = document.createElement('li');\r\n\r\n li.innerHTML = `<span class = \"delete\">x</span><input type=\"checkbox\"><label>${task}</label>`;\r\n ul.appendChild(li);\r\n document.querySelector('.tasksWrapper').style.display = 'block';\r\n}", "function addTask() {\n 'use strict';\n\n // Get the task:\n var task = document.getElementById('task');\n\n // Reference to where the output goes:\n var output = document.getElementById('output');\n\n \n // For the output:\n var message = '';\n\n if (task.value) {\n \n // Add the item to the array:\n tasks.push(task.value);\n \n // Update the page:\n message = '<h2>To-Do</h2><ol>';\n for (var i = 0, count = tasks.length; i < count; i++) {\n message += '<li>' + tasks[i] + '</li>';\n }\n message += '</ol>';\n output.innerHTML = message;\n \n } // End of task.value IF.\n\n \n\n // Return false to prevent submission:\n return false;\n \n} // End of addTask() function.", "function addTaskToDom({id, text, completed, date}, parent) {\n const newList = parent.appendChild(document.createElement('li'))\n newList.classList.add(listItemClass)\n newList.id = id\n newList.innerHTML = template\n .replace('@@text', text)\n .replace('@@date', new Date(date).toLocaleString('en-GB', {\n year: 'numeric',\n month: 'short',\n day: 'numeric'\n }))\n .replaceAll('@@id', id)\n .replace('@@checked', completed ? 'checked' : '')\n\n saveTask()\n checkedList()\n deleteTask()\n editTask()\n showInfoNoTask()\n }", "function addTask(inputTask = document.getElementById(\"task-input\").elements[0].value, location = getLocation()) {\n var newCheck = document.createElement(\"input\");\n newCheck.setAttribute(\"type\", \"checkbox\")\n newCheck.setAttribute(\"value\", \"finished\")\n newCheck.addEventListener('change', function() {\n if (this.checked) {\n removeTasks(newCheck, newTask, newBreak);\n } else {\n console.log(\"error removing item\");\n }\n });\n\n var newTask = document.createElement(\"label\");\n newTask.setAttribute(\"id\", index)\n var node = document.createTextNode(\" \" + inputTask);\n newTask.appendChild(node);\n\n var newBreak = document.createElement(\"br\");\n\n var section = document.getElementById(location);\n section.appendChild(newCheck);\n section.appendChild(newTask);\n section.append(newBreak);\n\n //save task to local storage\n localStorage.setItem(index, inputTask + \"$*!\" + location);\n newIndex();\n\n document.getElementById('task').value=''; \n}", "function addTask(bot, message, text) {\n // add a reaction so the user knows we're working on it\n bot.addReaction(message, 'thinking_face')\n\n // create a task object from the user input\n const newTask = taskFunctions.cl2task(text)\n\n // get the token for the user\n getIntheamToken(bot, message, message.user, (token) => {\n const settings = prepareAPI('tasks', 'POST', token);\n\n settings.body = newTask;\n\n // call the inthe.am API to add the new task\n apiRequest(bot, message, settings, (err, response, task) => {\n // remove the reaction again\n bot.removeReaction(message, 'thinking_face')\n\n bot.botkit.log(`added task for ${message.user}`);\n let priority;\n if (task.priority === 'L') {\n priority = 'low\" :blue_book:';\n } else if (task.priority === 'M') {\n priority = 'medium\" :notebook_with_decorative_cover:'\n } else {\n priority = 'high\" :closed_book:'\n }\n\n const answer = {\n channel: message.channel,\n as_user: true,\n }\n\n const attachment = {}\n\n attachment.title = `Alright, I've added task <https://inthe.am/tasks/${task.id}|${task.short_id}> to the list with priority ${priority}`\n attachment.callback_id = task.short_id\n\n const actions = [\n {\n name: 'done',\n text: ':white_check_mark: Done',\n value: 'done',\n type: 'button',\n style: 'primary',\n },\n ]\n\n const startStopButton = {\n type: 'button',\n }\n if (task.start) {\n startStopButton.name = 'stop'\n startStopButton.value = 'stop'\n startStopButton.text = ':stopwatch: Stop'\n } else {\n startStopButton.name = 'start'\n startStopButton.value = 'start'\n startStopButton.text = ':stopwatch: Start'\n }\n actions.push(startStopButton)\n\n actions.push({\n name: 'details',\n text: ':information_source: Details',\n value: 'details',\n type: 'button',\n })\n\n actions.push({\n type: 'button',\n name: 'task',\n value: 'task',\n text: ':exclamation: Top 3',\n })\n\n actions.push({\n type: 'button',\n name: 'list',\n value: 'list',\n text: ':notebook: List',\n })\n\n attachment.actions = actions;\n\n answer.attachments = [attachment];\n\n bot.api.chat.postMessage(answer, (postErr, postResponse) => {\n if (!postErr) {\n // bot.botkit.log('task details sent');\n } else {\n bot.botkit.log('error sending task added message', postResponse, postErr);\n }\n })\n })\n });\n}", "function addTask(projectid) {\n const task_name = document.querySelector('.todo_name').value; //get input data from dom\n const task_description = document.querySelector('.todo_description').value;\n const task_date = document.querySelector('.todo_date').value;\n let task_priority = '';\n\n if (document.querySelector('.todo_priority1').checked)\n task_priority = '1';\n else if (document.querySelector('.todo_priority2').checked)\n task_priority = '2';\n else if (document.querySelector('.todo_priority3').checked)\n task_priority = '3';\n else if (document.querySelector('.todo_priority4').checked)\n task_priority = '4';\n\n if (task_name == '' || task_description == '' || task_date == '' || task_priority == '')\n return;\n\n data.projects[projectid].tasks.push(new task(task_name, task_description, task_date, task_priority)) //add new project with name and id to list\n\n }", "function addTask(e) {\n e.preventDefault();\n if (taskInput.value === \"\") {\n swal(\"Task can't be Empty, Please add a Task!\");\n } else {\n let noTaskToShow = document.querySelector(\".noTask-Msg\");\n if (noTaskToShow) {\n noTaskToShow.remove();\n }\n \n let newTaskContainer = document.createElement(\"div\");\n newTaskContainer.classList =\n \"displayed-tasks padding-10px flex-elements width-65 border-Rad\";\n\n let newAddedTask = document.createElement(\"div\");\n newAddedTask.classList = \"added-task borderRad wow slideInLeft\";\n\n let newTaskText = document.createTextNode(taskInput.value);\n\n let taskDeleteButton = document.createElement(\"i\");\n taskDeleteButton.classList = \"fas fa-trash delete wow slideInRight\";\n\n newAddedTask.appendChild(newTaskText);\n newTaskContainer.appendChild(newAddedTask);\n newTaskContainer.appendChild(taskDeleteButton);\n container.appendChild(newTaskContainer);\n saveToLocalStorage(taskInput.value);\n taskInput.value = \"\";\n taskInput.focus();\n\n}\n}", "function AddTask() {\n const valid = validateForm()\n if (valid) {\n const newTaskInput = document.getElementById('newItem')\n const tagNameInput = document.getElementById('Tag')\n const tagColorInput = document.querySelector('input[name=\"inlineRadioOptions\"]:checked')\n\n const task = {\n title: newTaskInput.value,\n tag: {\n name: tagNameInput.value,\n color: tagColorInput.value\n },\n type: 'todo',\n state: false\n }\n\n list.items.push(task)\n localStorage.setItem('lists', JSON.stringify(allLists))\n resetForm()\n renderTasks()\n } else {\n const toast = new bootstrap.Toast(document.querySelector('.toast'))\n toast.show()\n }\n}", "function addNewTask() {\r\n let textInput = document.querySelector(\"#taskInput\");\r\n let allTasksFromMemory = JSON.parse(localStorage.getItem(\"tasks\"));\r\n\r\n if (textInput.value == \"\") {\r\n return;\r\n }\r\n\r\n // dio za kreiranje novog taska:\r\n let newLi = document.createElement(\"li\");\r\n let textNode = document.createTextNode(\"\");\r\n newLi.appendChild(textNode);\r\n newLi.classList.add(\"task\", \"unfinished\");\r\n\r\n //dole je novo\r\n newLi.innerHTML =\r\n '<img class=\"emptyCircle\" src=\"SVG/empty-circle.svg\" onclick=\"completeTask(this)\"/><img class=\"tickedCircle\" src=\"SVG/ticked-circle.svg\"/><div class=\"textPartofTask\"><p class=\"taskText\">' +\r\n textInput.value +\r\n '</p><p class=\"taskDate\"></p></div><div class=\"right-task-buttons\"><img src=\"SVG/edit-circle.svg\" class=\"right-hidden-button editCircle\" onclick=\"footerVisibilitySwitch(\\'edit\\',this)\"/><img src=\"SVG/thrash-circle.svg\" class=\"right-hidden-button thrashCircle\" onclick=\"deleteTask(this)\"/><img src=\"SVG/date-circle.svg\" class=\"right-hidden-button dateCircle\" onclick=\"showCalendar(this)\"/><img src=\"SVG/options-circle.svg\" class=\"optionsCircle\" onclick=\"expandRightButton(this)\"/></div>';\r\n\r\n newLi.setAttribute(\"id\", taskCounter);\r\n document.querySelector(\".allTasksUl\").appendChild(newLi);\r\n\r\n let attrib;\r\n if (allTasksFromMemory) {\r\n attrib = {\r\n id: taskCounter,\r\n taskText: textInput.value,\r\n state: \"unfinished\",\r\n };\r\n } else {\r\n attrib = [\r\n {\r\n id: taskCounter,\r\n taskText: textInput.value,\r\n state: \"unfinished\",\r\n },\r\n ];\r\n }\r\n\r\n if (allTasksFromMemory) {\r\n allTasksFromMemory.push(attrib);\r\n localStorage.setItem(\"tasks\", JSON.stringify(allTasksFromMemory));\r\n } else {\r\n localStorage.setItem(\"tasks\", JSON.stringify(attrib));\r\n }\r\n\r\n //skrivanje footera i clear-anje input forme\r\n taskCounter++;\r\n localStorage.setItem(\"taskCounter\", taskCounter);\r\n textInput.value = \"\";\r\n footerVisibilitySwitch(\"default\");\r\n}", "function newTask() {\n td.addTask(document.getElementById(\"new-task-text\").value);\n document.getElementById(\"new-task-text\").value = \"\";\n}", "function addTask(input_todo) {\n let todo_list = document.getElementById(\"todo_list\");\n \n addButton(\"check\", todo_list);\n \n let li = addListItem(todo_list);\n \n // Assign the value to the new item\n li.innerHTML = input_todo;\n\n // Store the task in localStorage\n localStorage.setItem(\"index\", index++);\n localStorage.setItem(\"task\" + index, li);\n\n addButton(\"delete_item\", todo_list);\n}", "function createTaskInDatabase (task) {\n firebase.database().ref('tasks').push(task)\n}", "function addTask() {\n\n // TODO: look javascript with the dom(document || javascript with html)\n let taskInput = document.getElementById(\"taskinput\");\n\n // TODO: look up conditionals if else\n if (taskInput.value === \"\") {\n alert(\"Invalid Value\")\n } else {\n taskList.push(taskInput.value)\n\n taskinput.value = \"\";\n }\n\n listTasks();\n\n // returns false for form so it doesn't reload\n return false;\n}", "function addTask() {\n 'use strict';\n var task = document.getElementById('task'); // Get form references\n // If task is entered, add it to the array and print array\n if (task.value) {\n tasks.push(task.value);\n printArray();\n // Update task input field with the blank string:\n document.getElementById('task').value = '';\n }\n return false;\n } // End of addTask() function.", "push(task){\n task.id = this.list.length;\n this.list.push(task); \n }", "function createTask(e) {\n /* the data that is stored in allTasks variable is updated here with the localstorage */\n allTasks = JSON.parse(localStorage.getItem('data'));\n if (allTasks === null) {\n allTasks = [];\n }\n const newTask = {\n description: '',\n completed: false,\n index: allTasks.length + 1,\n };\n newTask.description = e;\n /* This procedure here verify if input text value contains nothing. */\n if (newTask.description === '') {\n document.getElementById('task').placeholder = 'this field cannot be blank';\n } else {\n allTasks.push(newTask);\n updateTasks(allTasks);\n }\n}", "function addTask() {\n console.log('addTask called')\n if (!!taskInputValue) { // makes sure that taskInputValue is not blank\n setToDoArray(toDoArray.concat(taskInputValue))\n setTaskInputValue('')\n }\n }", "function addTask(newTask) {\n\n console.log('in addTask', newTask);\n $.ajax({\n type: 'POST',\n url: '/todo',\n data: newTask,\n }).then(function (response) {\n console.log('Response from server-side:', response);\n getList();\n }).catch(function (error) {\n console.log('Error in POST client side', error);\n });\n}", "function addTask (description, callback) {\n var taskKey = datastore.key('Task');\n\n datastore.save({\n key: taskKey,\n data: [\n {\n name: 'created',\n value: new Date().toJSON()\n },\n {\n name: 'description',\n value: description,\n excludeFromIndexes: true\n },\n {\n name: 'done',\n value: false\n }\n ]\n }, function (err) {\n if (err) {\n return callback(err);\n }\n\n var taskId = taskKey.path.pop();\n console.log('Task %d created successfully.', taskId);\n return callback(null, taskKey);\n });\n}", "function agregar(e) {\n\t\tsetTasks(e);\n\t}", "function addTask(event) {\n event.preventDefault();\n const number = form.task.value;\n const task = {\n userId: 1,\n title: form.task.value,\n completed: false\n }\n const data = JSON.stringify(task);\n const url = 'https://jsonplaceholder.typicode.com/todos';\n const headers = new Headers({\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n });\n const request = new Request(url,\n {\n method: 'POST',\n header: headers,\n body: data\n }\n )\n fetch(request)\n .then( response => response.json() )\n .then( task => console.log(`Task saved with an id of ${task.id}`) )\n .catch( error => console.log('There was an error:', error))\n}", "addTask(event){\n if(this.newTask == ''){\n return;\n }\n this.loading = true;\n insertTask({subject: this.newTask})\n .then(result => {\n console.log(result);\n this.todos.push({\n id: this.todos[this.todos.length - 1] ? this.todos[this.todos.length - 1].id + 1 : 0,\n name: this.newTask,\n recordId: result.Id\n });\n this.newTask = '';\n })\n .catch(error => console.log(error))\n .finally(() => this.loading = false);\n\n \n }", "function addTaskToDom ( task ) {\n jqueryMap.$list_box.prepend(\n '<li data-id=\"' + task.id + '\" >' + task.desc + '</li>'\n );\n }", "function addTask() {\n // let table = document.getElementById('table');\n\n // Inputs\n let inputEstimate = document.getElementById(\"estimate\");\n let inputDesc = document.getElementById(\"task-description\");\n\n // Clears values\n let newID = createPomodoro(sanitizeHTML(inputDesc.value), sanitizeHTML(inputEstimate.value));\n updateTable();\n inputDesc.value = \"\";\n inputEstimate.value = \"1\";\n return false;\n}", "function addTask(isDone, text) {\n let listItem = document.createElement(\"li\");\n listItem.appendChild(createCheckbox(isDone));\n listItem.appendChild(createSpan(text));\n listItem.appendChild(createDeleteBtn());\n\n let taskList = document.getElementById(\"task-list\");\n taskList.appendChild(listItem);\n}", "function handleAdd(){\n console.log('clicked on Submit button');\n\n let newTask = {\n task: $('#taskIn').val()\n }\n // run addTask with newTask variable\n addTask(newTask);\n\n // empty input task\n $('#taskIn').val('')\n} // end handleAdd", "function addTaskToDisplay(task) {\n // Create li element to store task display\n const taskElement = document.createElement('li');\n\n // create checkbox\n const taskCompleteCheckbox = document.createElement('input');\n taskCompleteCheckbox.type = 'checkbox';\n // Set the ID of the checkbox to the id of the task\n taskCompleteCheckbox.id = task._id;\n // Set the checked property to the completion status of the task\n // (Completed tasks will be checked)\n taskCompleteCheckbox.checked = task.completed;\n // Add event handler to each item for clicking on the checkbox\n // When the checkbox is clicked, we will make a server call to toggle completed\n taskCompleteCheckbox.addEventListener('change', updateTask);\n // Add checkbox to li created earlier\n taskElement.appendChild(taskCompleteCheckbox);\n \n // Create label for the task\n const taskLabel = document.createElement('label');\n // Set the for attribute so the checkbox is toggled when the label is clicked\n taskLabel.setAttribute('for', task._id);\n // Set the text to the title of the task\n taskLabel.innerText = task.title;\n // Set the completed CSS class if the task is completed\n taskLabel.className = task.completed ? 'completed' : '';\n // Add the label to the end of the li element\n taskElement.appendChild(taskLabel);\n\n // Get the ul element from the page\n const taskListElement = document.getElementById('task-list');\n // Add the new task to the list on the page\n taskListElement.appendChild(taskElement);\n}", "async addTask(id, text) {\n const res = await fetch(`/courses/${id}/tasks`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({ text }),\n });\n if (res.ok) return;\n else throw new Error(\"Something went wrong\");\n }", "function addTask(id, taskManager, projectName) {\n \n //content HTML parent\n const content = document.getElementById(\"content\");\n\n //the container\n const addNewTaskDiv = document.createElement(\"div\");\n addNewTaskDiv.id = \"add-new\";\n \n //contains the form with display-none\n const hiddenContainer = document.createElement(\"div\");\n hiddenContainer.classList.add(\"hidden-container\");\n hiddenContainer.style.display = \"none\";\n \n //contains submit and cancel btns\n const hiddenButtons = document.createElement(\"div\");\n hiddenButtons.classList.add(\"hidden-buttons\");\n hiddenButtons.style.display = \"flex\";\n \n //the form where user inputs task info\n const form = formConstructor(\"add-task\");\n hiddenContainer.appendChild(form);\n \n //add task btn\n const addNewBtn = btnConstructor(\"add-new-btn\", \"+\", \"block\");\n \n //on click display hidden form and hide add task btn\n addNewBtn.addEventListener('click',() => {\n\n toogleVisibility(hiddenContainer, \"block\");\n toogleVisibility(addNewBtn, \"none\");\n });\n addNewTaskDiv.appendChild(addNewBtn);\n \n //submit btn\n const submitBtn = btnConstructor(\"submit-btn\", \"Submit\", \"block\");\n \n //on click event triggers task creation logic\n submitBtn.addEventListener(\"click\", () => {\n //gets values from the input fields and returns and array\n const valuesArray = getValuesForm(\"add-task\");\n //if input != empty\n if(formValidation(valuesArray)) {\n \n taskItem(id, projectName); //create the DOM element \n const taskObj = new Task (id, valuesArray[0], valuesArray[1], valuesArray[2], valuesArray[3]); //create the coresponding object\n taskManager.set(`task-${id}`, taskObj); //map() stores the obj\n localStorage.setItem(nameForLocalStorage(projectName), JSON.stringify(Array.from(taskManager.entries())));//localy store map() with the projects name\n id ++;\n localStorage.setItem(\"id\", id); //localy store id\n setTask(taskObj); //fills the DOM element with the taskobj values\n clearForm(\"add-task\"); //clears form\n toogleVisibility(hiddenContainer, \"none\");\n toogleVisibility(addNewBtn, \"block\");\n document.getElementById(\"all-required\").style.display = \"none\";\n\n }else {\n\n document.getElementById(\"all-required\").style.display = \"block\";\n }\n });\n hiddenButtons.appendChild(submitBtn);\n \n //cancel button\n const cancelBtn = btnConstructor(\"cancel-btn\", \"Cancel\", \"block\");\n \n //cancels the form and hides it\n cancelBtn.addEventListener(\"click\", () => {\n\n document.getElementById(\"all-required\").style.display = \"none\";\n toogleVisibility(hiddenContainer,\"none\");\n toogleVisibility(addNewBtn, \"block\");\n clearForm(\"add-task\");\n });\n hiddenButtons.appendChild(cancelBtn);\n \n //append all elements to the DOM element\n hiddenContainer.appendChild(hiddenButtons);\n addNewTaskDiv.appendChild(hiddenContainer);\n content.appendChild(addNewTaskDiv);\n}", "function addTask() {\n let t = gererateTaskObject();\n allTasks.push(t);\n document.getElementById('loading').classList.remove('d-none');\n tasksString = JSON.stringify(allTasks);\n saveJSONToServer(allTasks)\n .then(function (result) { //then(function (variable vom server))\n console.log('Laden erfolgreich!', result);\n document.getElementById('loading').classList.add('d-none');\n load(); \n })\n .catch(function (error) { // Fehler\n console.error('Fehler beim laden!', error);\n document.getElementById('loading').classList.add('d-none');\n document.getElementById('error').classList.remove('d-none');\n });\n \n //localStorage.setItem('data', tasksString); disabled - the JSON is saved on the Server\n\n emptyFields();\n \n /**\n * The following 5 lines would be a popup which shows the name and the category of the added Tast.\n * It has been replaced by the loading screen\n */\n //let html = \"<div id='popup' class='transparentgray'><div class='popup'><h5>A new Task with the Title \" + t.title + \" has been added!</h5>You have set \" + t.importance + \" and \" + t.urgency + \"!</div></div>\";\n //document.getElementById(\"mainWindow\").insertAdjacentHTML('beforeEnd', html);\n //setTimeout(function () {\n // document.getElementById('popup').remove();\n //}, 5000);\n}", "function addTask(task) {\n let newTask = document.createElement(\"li\");\n let taskText = document.createElement(\"label\");\n let delBtn = document.createElement(\"button\");\n let editBtn = document.createElement(\"button\");\n let checkBox = document.createElement(\"input\");\n\n newTask.setAttribute(\"data-task-id\", task.idNum);\n newTask.setAttribute(\"draggable\", true);\n // taskText.setAttribute(\"contenteditable\", true);\n checkBox.type = \"checkbox\";\n\n // taskText.addEventListener(\"click\", editText);\n delBtn.addEventListener(\"click\", removeHandler);\n editBtn.addEventListener(\"click\", editHandler);\n checkBox.addEventListener(\"change\", checkBoxHandler);\n\n // Draggable Listeners\n newTask.addEventListener(\"dragstart\", dragStart);\n newTask.addEventListener(\"dragend\", dragEnd);\n\n // Adding appropriate classes to each element\n taskText.classList.add(\"lbl\");\n newTask.classList.add(\"new-task\");\n newTask.classList.add(\"draggable\");\n delBtn.classList.add(\"del-btn\");\n editBtn.classList.add(\"edit-btn\");\n checkBox.classList.add(\"check-box\");\n\n delBtn.appendChild(document.createTextNode(\"Delete\"));\n editBtn.appendChild(document.createTextNode(\"Edit\"));\n taskText.appendChild(document.createTextNode(task.text));\n\n // Appending each element to document\n document.querySelector(\"body > section > ul\").appendChild(newTask);\n newTask.appendChild(checkBox);\n newTask.appendChild(taskText);\n newTask.appendChild(editBtn);\n newTask.appendChild(delBtn);\n}", "function createAddTaskHandler() {\n let btnAddTask = document.getElementById(\"add-task-button\");\n if (btnAddTask) {\n btnAddTask.addEventListener(\"click\", function () {\n AddTask();\n });\n }\n}", "async addTask({ commit }, { title, date }) {\n await db.collection('tasks').add({\n id: new Date().getTime(),\n title: title,\n date: date,\n done: false\n });\n\n await commit('getTasks');\n }", "function addTask(list) {\n console.log(task);\n createList(task).then((data) => {\n if (data.error) {\n console.log(data.error);\n } else {\n console.log(data.data);\n setItems((prevValues) => {\n return [...prevValues, data.data];\n });\n setTask('');\n }\n });\n }", "function addTasktoLocalStorage(task){\n // init tasks\n let tasks;\n // Check if LS has tasks\n if (localStorage.getItem(\"tasks\") === null){\n // Init tasks as an array\n tasks = [];\n } else {\n tasks = JSON.parse(localStorage.getItem(\"tasks\"));\n }\n tasks.push(task)\n\n localStorage.setItem(\"tasks\", JSON.stringify(tasks));\n}", "function appendListItem(task) {\n const list = document.querySelector('ul');\n const template = document.querySelector('#template-task');\n const domFragment = template.content.cloneNode(true);\n\n domFragment.querySelector('li p').textContent = task;\n list.appendChild(domFragment);\n\n domUpdate();\n}", "function addTask(someTask, id, done, trash) {\n // preventing the item code to work\n if (trash) {\n return;\n }\n\n const taskProgress = done ? check_Icon : uncheck_Icon;\n const lineThrough = done ? lineThrough_Icon : \"\";\n\n const item = `\n <li class=\"item\">\n <i class=\"far ${taskProgress} co\" job=\"complete\" id=\"${id}\"></i>\n <p class=\"text ${lineThrough}\">${someTask}</p>\n <i class=\"fas fa-trash de\" job=\"delete\" id=\"${id}\"></i>\n \n </li>\n \n `;\n const position = \"beforeend\";\n myList.insertAdjacentHTML(position, item);\n}", "function addTaskActivity() {\n activityTaskName = document.getElementById('currentTask').innerHTML;\n var taskActivity = `<activity-item taskName=\"${activityTaskName}\" actualPomos=\"${actualPomos}\" estimatedPomos=\"${estimatedPomos}\">`;\n document\n .getElementById('completedTasks')\n .insertAdjacentHTML('beforeend', taskActivity);\n actualPomos = 0;\n document.getElementById(\n 'totalCompletedTasks',\n ).innerHTML = document.getElementById('completedTasks').children.length;\n document.getElementById('worktimes').innerHTML = totalPomos;\n localStorage.setItem('totalPomos', `${totalPomos}`);\n}", "function addTask(e){\n e.preventDefault();\n \n if(!taskInput.value) {\n alert('add a task')\n return\n }\n let li = document.createElement('li')\n li.className = 'collection-item'\n li.appendChild(document.createTextNode(taskInput.value))\n let a = document.createElement('a')\n a.className = 'delete-item secondary-content'\n let i = document.createElement('i')\n i.className = ' fa fa-remove'\n a.appendChild(i)\n li.appendChild(a)\n taskList.appendChild(li)\n taskInput.value = ''\n\n}", "function addTask(e) {\n if (taskInput.value === \"\") {\n return alert(\"Add a task\");\n }\n //Create li elements\n const listElements = document.createElement(\"li\");\n //Add class\n listElements.className = \"collection-item\";\n //Create text node and append to li\n listElements.appendChild(document.createTextNode(taskInput.value));\n //Create New Link elements\n const link = document.createElement(\"a\");\n link.className = \"delete-item secondary-content\";\n //Add icon html\n link.innerText = `❌`;\n //Append the link to list Elements\n listElements.appendChild(link);\n // console.log(listElements);\n taskList.appendChild(listElements);\n //Remove Task\n link.addEventListener(\"click\", () => {\n if (confirm(\"Are you sure to delete this item ? \")) {\n removeTaskFromLS(listElements);\n listElements.remove();\n }\n });\n storeTaskInLocalStorage(taskInput.value);\n taskInput.value = \"\";\n e.preventDefault();\n}", "function G_Add_New_Task( _fileId, \n _i_id_new_task_name, \n _i_id_new_task_desc, \n i_id_new_task_responcer_id, \n i_id_new_task_controller_id, \n i_id_new_task_project_id, \n i_id_new_task_creator_id,\n __sender) {\n var sheet = F_Get_Sheet_By_Name( _fileId, \"active\" );\n var date = new Date();\n var task_id = Math.random().toString(36).substring(0);\n var task_dedline = \"\";\n var control_deadline = \"\";\n var events = [];\n// var _event = {\n// date: date,\n// event: \"New Task Created\",\n// comment: ( task_id + \" | \" + _i_id_new_task_name + \" | \" + _i_id_new_task_desc )\n// };\n// events.push( _event );\n events = G_ADD_JOURNAL_EVENT(events, date, \"New Task Created\", ( task_id + \" | \" + _i_id_new_task_name + \" | \" + _i_id_new_task_desc ), __sender );\n sheet.appendRow( \n [\n task_id,\n date, \n _i_id_new_task_name, \n _i_id_new_task_desc,\n i_id_new_task_responcer_id, \n JSON.stringify([i_id_new_task_controller_id]), \n i_id_new_task_project_id,\n i_id_new_task_creator_id,\n task_dedline,\n control_deadline,\n JSON.stringify( events ),\n \"last_cell\"\n ] \n );\n return G_UpdateTasksList( _fileId );\n}", "function createNewTask(taskInput) {\n var newTask = document.createElement('li');\n var newTaskHeader = document.createElement('h1');\n var newTaskButtonDelete = document.createElement('button');\n var newTaskButtonComplete = document.createElement('button');\n\n newTaskButtonDelete.innerText = 'Delete';\n newTaskButtonDelete.classList.add('deleteTaskButton');\n newTaskButtonComplete.innerText = 'Complete';\n newTaskButtonComplete.classList.add('completeTaskButton');\n newTaskHeader.innerText = taskInput.value;\n newTask.appendChild(newTaskHeader);\n newTask.appendChild(newTaskButtonDelete);\n newTask.appendChild(newTaskButtonComplete);\n\n //cross out complete tasks on click of 'Complete' button\n newTaskButtonComplete.addEventListener('click',function(event) {\n\n //if it is not completed\n var taskText = this.parentElement.querySelector('h1');\n if (this.parentElement.className.indexOf('done') == -1) {\n taskText.style.textDecoration = 'line-through';\n taskText.style.color = 'grey';\n this.parentElement.classList.add('done');\n subtractCount();\n } else {\n taskText.style.textDecoration = 'none';\n taskText.style.color = 'initial';\n this.parentElement.classList.remove('done');\n addCount();\n }\n });\n\n //remove list item on click of 'Delete' button\n newTaskButtonDelete.addEventListener('click',function(event) {\n this.parentElement.parentElement.removeChild(this.parentElement);\n subtractCount();\n });\n\n addCount();\n\n return newTask;\n }", "attachTask(message) {\n if (this._repeatOnList(message)) {\n $(\"#taskInput\").attr(\"placeholder\", \"Ja existe uma task identica!\")\n .parent().addClass(\"has-error\");\n return;\n }\n\n $(\"#taskInput\").attr(\"placeholder\", \"Insita sua tarefa...\")\n .parent().removeClass(\"has-error\");\n\n let task = {\n date : new Date(),\n open : true,\n message : message\n }, list = ls.getList();\n\n if(list[list.length - 1] != undefined) {\n var x = this.list[this.list.length - 1];\n task.id = x[\"id\"] + 1;\n } else {\n task.id =0;\n }\n\n ls.setItem(task);\n if (this.order == \"DESC\") {\n this.list.push(task)\n } else {\n let list = this.list.reverse();\n list.push(task);\n this.list = list.reverse();\n }\n }", "function createTaskElement(taskID, text) {\n const tasksContainer = document.getElementById('tasks');\n const box = document.createElement('div');\n box.classList.add('box', 'content');\n box.id = taskID;\n\n const task = document.createElement('p');\n task.classList.add('is-size-4');\n task.innerText = text;\n\n // allow users to edit existing tasks by clicking on them\n task.addEventListener('click', function() {\n const input = createInputElement('');\n input.classList.add('edit-input');\n input.value = task.innerText;\n\n input.addEventListener('keypress', (e) => { if (e.keyCode === 13) saveTaskEdit(); });\n input.addEventListener('blur', saveTaskEdit);\n\n function saveTaskEdit() {\n task.innerText = input.value;\n storeTask(box.id, input.value);\n input.replaceWith(task);\n }\n\n task.replaceWith(input);\n });\n\n const deleteButton = document.createElement('button');\n deleteButton.classList.add('btn-delete', 'is-hidden');\n deleteButton.innerHTML = '<i class=\"fas fa-lg fa-trash\"></i>';\n\n deleteButton.addEventListener('click', function() {\n deleteTask(box.id);\n tasksContainer.removeChild(box);\n });\n\n box.addEventListener('mouseover', function() {\n deleteButton.classList.remove('is-hidden');\n });\n\n box.addEventListener('mouseout', function() {\n deleteButton.classList.add('is-hidden');\n });\n\n box.append(deleteButton);\n box.append(task);\n\n tasksContainer.prepend(box);\n}" ]
[ "0.8582499", "0.83260816", "0.82045835", "0.8187", "0.80332613", "0.7992455", "0.7992383", "0.7912743", "0.7834776", "0.7806132", "0.7794268", "0.7776513", "0.7737798", "0.77044237", "0.77003527", "0.764926", "0.764752", "0.7641587", "0.7582123", "0.7576442", "0.75711054", "0.75635636", "0.75316775", "0.7517367", "0.7502557", "0.7500752", "0.7495894", "0.74916303", "0.7484962", "0.7449858", "0.74496424", "0.74294406", "0.7418474", "0.7392421", "0.73718536", "0.73703295", "0.7370201", "0.7350484", "0.73488814", "0.73123693", "0.7308582", "0.7305874", "0.7305409", "0.7295968", "0.7274299", "0.72534597", "0.7235258", "0.7224467", "0.7222165", "0.72183484", "0.7213918", "0.7208673", "0.71953887", "0.7186075", "0.71851087", "0.7179468", "0.7167882", "0.7151713", "0.7149009", "0.7139633", "0.7129649", "0.712719", "0.7115264", "0.7112316", "0.71019214", "0.70976555", "0.70948046", "0.70814264", "0.70796764", "0.707318", "0.7063459", "0.7044739", "0.70406276", "0.7039889", "0.7038277", "0.70304143", "0.70282286", "0.70212215", "0.7020521", "0.7015207", "0.7014587", "0.70133686", "0.69850355", "0.69776994", "0.69631946", "0.6959508", "0.6957551", "0.69540334", "0.69469106", "0.6945696", "0.69437456", "0.69433206", "0.6942781", "0.69416356", "0.69374293", "0.69312215", "0.6927023", "0.69268346", "0.69267404", "0.69233215", "0.6920218" ]
0.0
-1
Vanilla JS to delete tasks in 'Trash' column
function emptyTrash() { /* Clear tasks from 'Trash' column */ document.getElementById("trash").innerHTML = ""; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteTasks() {\n const mutateCursor = getCursorToMutate();\n if (mutateCursor) {\n clickTaskMenu(mutateCursor, 'task-overflow-menu-delete', false);\n } else {\n withUnique(\n openMoreMenu(),\n 'li[data-action-hint=\"multi-select-toolbar-overflow-menu-delete\"]',\n click,\n );\n }\n }", "function deleteTask()\n {\n var child = this.parentNode.parentNode;\n var parent = child.parentNode;\n parent.removeChild(child);\n var id= parent.id;\n var value = child.innerText;\n if (id == \"taskList\")\n {\n obj.taskListArr.splice(obj.taskListArr.indexOf(value), 1);\n }\n else \n {\n obj.taskCompletedArr.splice(obj.taskCompletedArr.indexOf(value), 1);\n } \n dataStorageUpdt();\n }", "function emptyTrash() {\n /* Clear tasks from 'Trash' column */\n document.getElementById(\"monday\").innerHTML = \"\";\n document.getElementById(\"tuesday\").innerHTML = \"\";\n document.getElementById(\"wednesday\").innerHTML = \"\";\n document.getElementById(\"thursday\").innerHTML = \"\";\n document.getElementById(\"friday\").innerHTML = \"\";\n document.getElementById(\"saturday\").innerHTML = \"\";\n}", "function deleteTask(e) {\n let index = this.dataset.index;\n let tyList = this.parentElement.parentElement.parentElement;\n if (tyList.getAttribute(\"id\") == \"lists\") {\n tasks.splice(index, 1);\n localStorage.setItem(\"tasks\", JSON.stringify(tasks));\n render(lists, tasks);\n }\n if (tyList.getAttribute(\"id\") == \"listOfChecked\") {\n tasksChecked.splice(index, 1);\n localStorage.setItem(\"tasksChecked\", JSON.stringify(tasksChecked));\n render(listOfChecked, tasksChecked);\n }\n}", "function removeTask(event){\n // Get the index of the task to be removed\n let index = findIndexById(event.target.parentElement.id);\n\n // Confirm if the user wants to remove said task\n if(confirm(`Do you want to remove this task? \"${toDos[index].content}\"`)){\n // Use splice to delete the task object and reorder the array then update local storage\n toDos.splice(index, 1);\n ls.setJSON(key, JSON.stringify(toDos));\n\n // Update the list displayed to the user\n displayList();\n }\n}", "function deleteTask() {\n const buttonDelete = document.querySelectorAll('.button-delete')\n buttonDelete.forEach(button => {\n button.onclick = function (event) {\n event.path.forEach(el => {\n if (el.classList?.contains(listItemClass)) {\n let id = +el.id\n listTask = listTask.filter(task => {\n if (task.id === id) {\n el.remove()\n return false\n }\n return true\n })\n showInfoNoTask()\n }\n })\n setTaskValue()\n localStorage.setItem('listTask', JSON.stringify(listTask))\n }\n })\n }", "removeTask () {\n\t\tthis.deleter.addEventListener('click', (e) => {\n\t\t\tfetch('/items/'+e.target.parentNode.parentNode.parentNode.childNodes[0].getAttribute('data-task'), {\n\t\t\t\tmethod: 'DELETE',\n\t\t\t\theaders: {\n\t\t\t\t'Accept': 'application/json',\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t\t},\n\t\t\t\t\n\t\t\t})\n\t\t\t.then(res => res.text()) \n\t\t\t.then(res => console.log(res))\n\t\t\t.catch(error => console.error(error));\n\t\t\te.target.parentNode.parentNode.parentNode.remove();\n\t\t\tupdateProgess(numberOfCompletedTasks());\n\t\t});\n\n\t\t// We need to also remove tasks from the backend\n\t}", "function removeTask(elem) {\n elem.parentNode.parentNode.removeChild(elem.parentNode);\n LIST[elem.id].trash = true;\n}", "function deleteTask (e){\n for (var i = 0 ; i< loginUser.tasks.length; i ++){\n if(parseInt(loginUser.tasks[i].id) === parseInt(e.target.getAttribute('data-id'))){\n if(loginUser.tasks[i].status === false){\n taskToDo--;\n $('#countOfTask').text('').text('Task to do: '+ taskToDo);\n }\n loginUser.tasks.splice(i, 1);\n $('#task' + e.target.getAttribute('data-id')).remove();\n collectionOfUser.update(\n {\n id : loginUser.id,\n tasks : loginUser.tasks\n },\n function(user){\n loginUser = user;\n },\n error \n );\n }\n }\n }", "function delete_task(e) {\n console.log('delete task btn pressed...');\n e.target.parentElement.remove();\n\n }", "function deleteLS(delItem){\n console.log(\"delete activated\");\n let task;\n if(localStorage.getItem('task') === null)\n {\n task=[];\n }\n else\n {\n task=JSON.parse(localStorage.getItem('task'));\n\n\n }\n\n \n task.forEach(function(tasks,index){\n \n if(delItem.innerHTML === tasks){\n \n\n \n \n task.splice(index,1);\n }\n })\n localStorage.setItem('task',JSON.stringify(task));\n}", "function deleteTask(id) {\r\n let Note = document.getElementById(id); \r\n //removes note from page\r\n document.getElementById(\"shoeNotesFromLS\").removeChild(Note); \r\n let indexOfTaskToRemove = tasks.findIndex(task => task.id === id);\r\n //removes from array of tasks\r\n tasks.splice(indexOfTaskToRemove, 1);\r\n //removes from array in local storage\r\n if (tasks.length != 0) {\r\n localStorage.tasks = JSON.stringify(tasks);\r\n }\r\n else {\r\n localStorage.removeItem(\"tasks\");\r\n }\r\n \r\n}", "function deleteTask(e) {\n e.preventDefault();\n if (e.target.className === 'delete-task') {\n e.target.parentElement.remove();\n deleteTaskLocalStorage(e.target.parentElement.textContent);\n\n //alert('Tweet eliminado')\n }\n\n}", "function removeTask(e) {\n if (e.target.parentElement.classList.contains('delete-item')) {\n if (confirm('Are you sure?')) {\n e.target.parentElement.parentElement.remove();\n\n removeTaskFromLocalStorage(Number(e.target.parentElement.parentElement.id.substring(5)))\n }\n }\n}", "function deleteTask(event) {\n const taskListItem = this.parentNode.parentNode;\n const keyValue = taskListItem.querySelector('input').dataset.key\n taskListItem.parentNode.removeChild(taskListItem);\n\n\n manageTasksAjax(event, '', keyValue, 'delete')\n}", "function removeTask(e) {\n // Clicking on the delete button causes the removal of that list item\n if (e.target.parentElement.classList.contains('delete-item')){\n e.target.parentElement.parentElement.remove();\n removeLocalStorage(e.target.parentElement.parentElement.textContent);\n // Refresh the list to mirror local storage contents as all duplicates are removed\n getTasks(e);\n }\n e.preventDefault();\n}", "function deleteList(c) {\n\tconst taskDel = document.querySelector(`.item-${c}`);\n\ttaskDel.firstElementChild.addEventListener(\"click\", () => {\n\t\tif (confirm(\"Are you sure?\")) {\n\t\t\ttaskDel.remove();\n\t\t\tconsole.log(taskDel.textContent);\n\t\t\tremoveFromStorage(taskDel.textContent);\n\t\t}\n\t});\n}", "function removeTask(e){\n if (e.target.parentElement.classList.contains('delete-item')){\n if(confirm('u sure, dude?')){\n e.target.parentElement.parentElement.remove(); \n\n //remove from local storage\n removeTaskFromLocalStorage(e.target.parentElement.parentElement);\n }\n }\n}", "function removeTask(e) {\n\tif (e.target.parentElement.classList.contains('delete-item')) {\n\t\tif (confirm('Are You Sure?')) {\n\t\t\te.target.parentElement.parentElement.remove();\n\t\t\t/*Ako parentElement ima klasu delete-item onda hocu da...*/\n\n\t\t\t//-Remove from LS-//\n\t\t\tremoveTasksFromLocalStorage(e.target.parentElement.parentElement);//Funkcija za brisanje iz LS\n\t\t}\n\t}\n}", "function deleteTask(description) {\n\tvar username = localStorage.getItem(\"username\"); \n\tdatabase.ref('/task/'+username+'/'+description).remove();\n\tswal('Task deleted','','success').then((result) => {\n\t\twindow.location.reload();\n\t});\n\t\n\t\n}", "function removeTask(e) {\n if(e.target.parentElement.classList.contains\n ('delete-item')) {\n if(confirm('Are You Sure?')) {\n e.target.parentElement.parentElement.remove();\n //Remove from LS\n removeTaskFromLocalStorage\n (e.target.parentElement.parentElement);\n\n \n }\n}\n\n}", "function clearTasks(e){\n //taskList.innerHTML = '';\n while(taskList.firstChild){\n taskList.removeChild(taskList.firstChild);\n }\n let deletedTasks;\n \n deletedTasks = localStorage.getItem('tasks')\n \n localStorage.setItem('deletedTasks',deletedTasks)\n localStorage.removeItem('tasks')\n //localStorage.clear()\n e.preventDefault()\n}", "function removeTask(e) {\r\n let li = e.target.parentElement.parentElement;\r\n let a = e.target.parentElement;\r\n if (a.classList.contains('delete-item')) {\r\n if (confirm('Are You Sure ?')) {\r\n li.remove();\r\n removeFromLS(li);\r\n }\r\n }\r\n}", "function deleteTask() {\n this.parentNode.parentNode.removeChild(this.parentNode);\n }", "function deleteTaskFromToDoList(event) {\n event.target.parentElement.remove();\n}", "function deleteTask(event)\n{\n //gets button id\n let id = event.target.id;\n\n //gets task position from button id\n let taskPosition = id.replace(/\\D/g,'');\n\n //removes task from task array\n taskArr.splice(taskPosition - 1, 1); \n\n //loop through task array to adjust position\n for(let i = 0; i < taskArr.length; i++)\n {\n taskArr[i].position = i + 1;\n };\n\n //rewrites task list\n rewritesList();\n}", "function removeTask(e) {\n\n if (e.target.parentElement.classList.contains('delete-item')) {\n if (confirm('Are you sure!!')) {\n e.target.parentElement.parentElement.remove();\n }\n }\n removeItemFromLocalStorage(e.target.parentElement.parentElement);\n}", "function removeTask(){\n\t\t$(\".remove\").unbind(\"click\").click(function(){\n\t\t\tvar single = $(this).closest(\"li\");\n\t\t\t\n\t\t\ttoDoList.splice(single.index(), 1);\n\t\t\tsingle.remove();\n\t\t\ttoDoCount();\n\t\t\tnotToDoCount();\n\t\t\taddClear();\n\t\t});\n\t}", "function deleteAllCompletedTodos() {\n // Write your code here...\n}", "function deleteAllCompletedTodos() {\n // Write your code here...\n}", "function deleteAllCompletedTodos() {\n // Write your code here...\n}", "function deleteTask(event) {\n\n let idDelete = event.target.getAttribute('data-id')\n\n let keyId = listTask.findIndex(element => {\n if (element.id == idDelete) {\n return element\n }\n })\n\n if (keyId != -1) {\n listTask.splice(keyId, 1)\n saveData()\n }\n\n openModalDel()\n}", "removeTask(e) {\n const index = e.target.parentNode.dataset.key;\n this.tasks.removeTask(index);\n this.renderTaskList(this.tasks.tasks);\n this.clearInputs();\n }", "deleteTask(taskId) {\n\t\tconst todos = this.getAndParse('tasks');\n\t\tconst filteredTodos = todos.filter(task => task.id !== taskId);\n\t\tthis.stringifyAndSet(filteredTodos, 'tasks');\n\t}", "function deleteTask() {\n this.parentNode.parentNode.removeChild(this.parentNode);\n}", "function delOne(event) {\n if (confirm(\"Are you sure you want to delete this task?\")) {\n let newtParent = event.target.parentElement;\n\n // delete selected elements\n for (let i = 0; i < arrayTask.length; i++) {\n if (newtParent.getElementsByTagName(\"SPAN\")[0].innerHTML === arrayTask[i]) {\n arrayTask.splice(i, 1);\n localStorage.setItem(\"task\", arrayTask);\n }\n }\n newtParent.remove();\n displayTasks();\n }\n}", "function removeTask(e){\r\n\r\nif(e.target.parentElement.classList.contains('delete-item')){\r\n if(confirm('Are you sure?')){\r\n e.target.parentElement.parentElement.remove();\r\n \r\n //Remove task from Local Storage - as removing from DOM wil not remove it from local storage and hence it will re-appear on reload\r\n removeTaskFromLocalStorage(e.target.parentElement.parentElement); ////since we dont have any id for each element, we will directly pass the element \r\n\r\n } \r\n} \r\n}", "deleteAllTasks () {\r\n this.eliminatedTask.splice(0, this.eliminatedTask.length);\r\n }", "function deleteTask(e){\n const taskID = document.getElementById('id').value;\n http\n .delete(`http://localhost:3000/Tasks/${taskID}`)\n .then(task=>{\n //clearing field\n ui.clearFiled();\n //showing message\n ui.showAlertMessage('Task deleted','alert alert-warning');\n //getting task\n getTasks();\n })\n}", "function deleteToDoRow(){\n\t\tif(tableRowToDo.parentNode != toDoTable){\n\t\t\treturn;\n\t\t}\n\t\tclock.inProgress = true;\n\t\ttoDoTable.removeChild(tableRowToDo);\n\t}", "function clearTasks(e) {\n const tasks = Array.from(taskList.children);\n if (tasks.length > 0){\n if (confirm('Clear all tasks?')) {\n tasks.forEach(function (task){\n task.remove();\n });\n }\n }\n taskInput.value = '';\n filter.value = '';\n localStorage.removeItem('tasks');\n\n e.preventDefault();\n}", "deleteTask(task) {\n const taskArray = [...this.state.tasks];\n const index = taskArray.map(t => t.text).indexOf(task);\n\n taskArray.splice(index, 1);\n\n this.setState({ tasks: taskArray });\n }", "deleteTask(task) {\n const deleteItem = task.key;\n const deleteRef = firebase.database().ref(`${this.props.userId}/${deleteItem}`);\n deleteRef.remove();\n }", "function delTask(e) {\n e.parentNode.remove()\n}", "function deleteTask() {\n\t$(tdID).css({\n\t\t\"background-color\" : \"white\",\n\t\t\"color\" : \"black\"\n\t});\n\t$(tdID).html(\"\");\n\t$(modal).css(\"display\",\"none\");\n}", "function deleteTask(event) {\n //confirm action from used with confirmation alert\n var doDelete = confirm (\"Do you really want to remove selected task?\")\n //if user clicks \"ok\" this returns true and task is removed from the list\n if (doDelete === true) {\n this.parentElement.parentElement.removeChild(this.parentElement);\n } \n //Both done and todo are possible to be removed from list\n this.parentElement.removeEventListener(\"click\", markDone)\n this.parentElement.removeEventListener(\"click\", markTodo)\n //saved into local storage and taskCount is updated\n updateLocalStorage();\n taskCount();\n}", "function removeTaskLocalStorage(task) {\n //Get Tasks from storage\n let tasks = getTaskFromStorage();\n\n //Remove the X from the remove button\n\n const taskDelete = task.substring(0, task.length - 1);\n // console.log(taskDelete);\n\n //Look through the all tasks & delete them\n tasks.forEach(function (taskLS, index) {\n if (taskDelete === taskLS) {\n tasks.splice(index, 1);\n }\n });\n\n //Save the new array data to Local Storage\n localStorage.setItem('tasks', JSON.stringify(tasks));\n\n}", "function removeItem(e) {\n\n // getting the item to be deleted \n let todoItem = e.target.previousSibling.textContent;\n let idx = allItems.indexOf(todoItem); // looking for item's index in the tasks list\n allItems.splice(idx, 1); // removing the found index from the tasks list\n // console.log(allItems);\n localStorage.setItem(\"tasks\", JSON.stringify(allItems)); // updating the local storage \n list.innerHTML = \"\"; \n show(); \n}", "function removeTask(e) {\n\n\n if (confirm('Are you sure')) {\n e.target.parentElement.parentElement.remove()\n\n\n //Remove from Ls\n removeTaskFromLocalStorage(e.target.parentElement.parentElement)\n }\n\n // tasks.forEach(function (item, index) {\n // if (e.target.closest(\"li\").innerText == item) {\n // tasks.splice(index, 1)\n\n // }\n\n // })\n //.log(e.target.parentElement.parentElement)\n}", "async handleDeleteTask(task) {\n let removeIndex = this.state.tasks.findIndex((t) => (task.id === t.id));\n\n let oldTasks = Array.from(this.state.tasks);\n let newTasks = this.state.tasks.concat();\n newTasks.splice(removeIndex, 1);\n\n // provisional update of state to reflect deletion before request has been sent\n await this.setState({\n tasks: newTasks,\n undoContent: oldTasks,\n undoType: 'deleted'\n });\n\n // if undo button has been pressed, don't send deletion request and revert state instead\n let undoTimer = setTimeout(async () => {\n if (this.state.confirmDelete) {\n await Helpers.fetch(`/api/tasks/${task.id}`, {\n method: 'DELETE'\n });\n } else {\n await this.setState({\n tasks: this.state.undoContent,\n });\n }\n\n await this.setState({\n undoContent: null,\n undoType: null,\n confirmDelete: true\n });\n }, 3000);\n\n this.setState({\n undoTimer: undoTimer\n });\n }", "function deleteButtonPressed(todo) {\n db.remove(todo);\n}", "function deleteNewTask(e){\r\n const item = e.target;\r\n \r\n if(item.classList[0] === 'btnDelete'){\r\n const todo = item.parentElement;\r\n todo.remove();\r\n }\r\n if(item.classList[0] === 'imp-task'){\r\n \r\n item.classList.toggle('fas');\r\n }\r\n}", "function removeTask(event) {\n\n let id = event.target.dataset.id;\n let tareaEliminar = event.target.parentNode;\n console.log(tareaEliminar);\n\n tareaEliminar.parentNode.removeChild(tareaEliminar)\n\n //buscar en el array la posicion\n let posicionBorrar = tasks.findIndex(task => {\n return task.titulo == id\n })\n\n console.log(posicionBorrar);\n tasks.splice(posicionBorrar, 1)\n}", "function deleteAllCompletedTodos() {\nlet allLis = document.getElementsByTagName(\"li\");\n for (let i = 0; i < allLis.length; i++) {\n if (allLis[i].classList.contains(\"apply-line-through\")) {\n let removedItem = { task: `${allLis[i].value}`, completed: `${todos[i].completed}` }\n let index = todos.indexOf(removedItem)\n todos.splice(index, 1)\n allLis[i].remove();\n return todos;\n }\n }\n \n}", "function removeTask(e){\n //Choosing our target : class \"delet-item\"\n /* const target = e.target.closest('.delete-item')// closest() with class\n if(target){\n if(confirm('Are you sure?')){\n target.parentElement.remove()\n }\n } */\n if(e.target.parentElement.classList.contains('delete-item')){\n if(confirm('Are you sure?')){\n e.target.parentElement.parentElement.remove(); \n }\n }\n removeTaskFromLocalStorage(e.target.parentElement.parentElement)\n \n}", "function deleteButtonPressed(todo) {\n db.remove(todo);\n }", "function remove(task, clicked) {\n // initiate variables\n var create = document.getElementById(\"create\"), listC = document.getElementById(\"complete\"), listO = document.getElementById(\"ongoing\");\n var table, type;\n \n if (!muted && !clicked) {\n var audio = new Audio(\"audio/trash.mp3\");\n audio.play();\n }\n \n // determine which table to remove the task from\n if ((task.children[4].firstChild.checked && !clicked) || (!task.children[4].firstChild.checked && clicked)) {\n type = \"complete\";\n table = listC;\n } else {\n type = \"ongoing\";\n table = listO;\n }\n var index = task.firstChild.firstChild.selectedIndex;\n table.removeChild(task);\n \n count();\n \n // delete task from chrome storage\n chrome.storage.sync.get(type, function (tasks) {\n var keys = Object.keys(tasks);\n \n // decrease the selected index of all tasks above the deleted task\n for (var i = table.children.length - 1; i >= index; i -= 1) {\n table.children[i].firstChild.firstChild.selectedIndex -= 1;\n }\n\n // delete the last option from all selects\n for (var i = 0; i < table.children.length; i += 1) {\n table.children[i].firstChild.firstChild.removeChild(table.children[i].firstChild.firstChild.lastChild);\n }\n \n tasks[keys[0]].splice(index, 1);\n chrome.storage.sync.set(tasks);\n });\n \n // prevent incorrect deletion of alarm\n if (table == listC) {\n return 0;\n }\n \n // delete alarm\n var current, next, last;\n \n // replace each old alarm with the one above it\n for (var i = index; i < listO.children.length; i += 1) {\n for (var j = 0; j < pings.length; j += 1) {\n current = i + \" \" + pings[j], next = (i + 1) + \" \" + pings[j];\n shift(current, next);\n }\n }\n \n // delete the alarms related to the last task\n for (var i = 0; i < pings.length; i += 1) {\n last = listO.children.length + \" \" + pings[i];\n chrome.alarms.clear(last);\n }\n \n // resize table\n table.style.maxHeight = table.scrollHeight + \"px\";\n}", "function removeTask(e){\n if(e.target.parentElement.classList.contains('delete-item'))\n {\n if(confirm('Are you sure about that ?')){\n e.target.parentElement.parentElement.remove(); \n } \n }\n}", "function removeHandler(e) {\n const removeId = e.target.parentElement.getAttribute(\"data-task-id\");\n\n if (confirm(\"Are you sure ?!\")) {\n const foundIndex = toDoList.findIndex((el) => {\n return el.idNum === removeId;\n });\n\n toDoList.splice(foundIndex, 1);\n\n commitToLocalStorage(toDoList);\n reRender();\n }\n}", "function removeTask(e){\r\n // checking if the parent of the i we clicked (the li) has this class in the class list\r\n if(e.target.parentElement.classList.contains('delete-item')){\r\n //asking for confirmation from the user to delete\r\n if(confirm('Are you sure?')){\r\n //deleting the item\r\n e.target.parentElement.parentElement.remove()\r\n\r\n // Remove from LS\r\n removeTaskFromLocalStorage(e.target.parentElement.parentElement);\r\n }\r\n \r\n }\r\n}", "function removeTask(e) {\n console.log(\"yep\");\n if (e.target.parentElement.classList.contains(\"delete-item\")) {\n console.log(\"yep del\");\n if (confirm(\"Are You Sure about that ? \")) {\n e.target.parentElement.parentElement.remove();\n }\n }\n}", "function removeTask2(e) {\n console.log(\"yep\");\n if (e.target.parentElement.classList.contains(\"delete-item\")) {\n console.log(\"yep del\");\n e.target.parentElement.parentElement.remove();\n \n }\n}", "function clearTasks(){\n item.parentNode.removeChild(item);\n }", "function deleteItem(e) {\n // retrieve the name of the task we want to delete. We need\n // to convert it to a number before trying it use it with IDB; IDB key\n // values are type-sensitive.\n let noteId = Number(e.target.parentNode.getAttribute('data-note-id'));\n\n // open a database transaction and delete the task, finding it using the id we retrieved above\n let transaction = db.transaction(['notes_os'], 'readwrite');\n let objectStore = transaction.objectStore('notes_os');\n let request = objectStore.delete(noteId);\n\n // report that the data item has been deleted\n transaction.oncomplete = function() {\n // delete the parent of the button\n // which is the list item, so it is no longer displayed\n e.target.parentNode.parentNode.removeChild(e.target.parentNode);\n console.log('Note ' + noteId + ' deleted.');\n\n // Again, if list item is empty, display a 'No notes stored' message\n if(!list.firstChild) {\n let listItem = document.createElement('li');\n listItem.textContent = 'No notes stored.';\n list.appendChild(listItem);\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 }", "function deleteButtonHandler(obj)\n{\n\tconst row = getGrandparent($(obj));\n const taskType = getRowsTable(row);\n\tconst taskNameBox = getNameBox(row);\n\tconst taskName = $(taskNameBox.children()[2]).html();\n const taskID = getSavedTaskID(row);\n\tconst confirmString = \"Really delete \" + taskName + \"?\";\n\tconst r = confirm(confirmString);\n\tif (r == true)\n {\n\t\trow.remove();\n removeTaskData(taskType, taskID);\n\t}\n // TODO: remove the task data from the DOM\n}", "function remove(){ //removes task from array\n var id = this.getAttribute('id');\n var todos = getTodos();\n todos.splice(id,1);\n todos.pop(task); //removes from array\n localStorage.setItem('todo', JSON.stringify(todos));\n\n show(); //how to display a removed item on screen\n\n return false;\n\n}", "function delTask(index) {\n let getLocalStorage = localStorage.getItem(\"New Todo\"); // Getting the localstorage\n listArr = JSON.parse(getLocalStorage);\n listArr.splice(index, 1);\n\n localStorage.setItem(\"New Todo\", JSON.stringify(listArr));\n showTasks();\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}", "function removeTask(e) {\n if (e.target.classList.contains('remove-task')) {\n e.target.parentElement.remove();\n }\n\n //Remove from Storage \n removeTaskLocalStorage(e.target.parentElement.textContent);\n}", "function deleteTask(key,element) {\n firebase.database().ref('todoList').child(key).remove();\n element.parentElement.parentElement.remove();\n}", "function clearTasks(e) {\n //taskList.innerHTML = ''\n while (taskList.firstChild) {\n taskList.removeChild(taskList.firstChild)\n }\n //clear all tasks from local storage\n clearAllTasksFromLS()\n}", "function queryDeleteAllTask() {\n\tnavigator.notification.confirm(\n 'Вы действительно хотите удалить все задачи из этого списка?', // message\n deleteAllTask, // callback to invoke with index of button pressed\n 'Удаление задач', // title\n ['Да','Нет'] // buttonLabels\n\t);\t\n}", "function onDelete(work_item_id) {\n // Use Ajax to start deleting task from the database\n $.ajax({\n url: `https://localhost:5001/api/v1/WorkItem?workItemId=${work_item_id}`,\n type: 'DELETE',\n cache: false,\n data: JSON.stringify({\n \"Title\": \"delete\",\n \"Content\": \"delete\",\n \"DateCreated\": \"delete\"\n }),\n contentType: \"application/json\",\n success: function (responseData) {\n // At this point, task is deleted in the database, we will now need to remove it from\n // current list of tasks (work item)\n $(\"div\").remove(`#${work_item_id}`);\n }\n })\n}", "function removeTask(e) {\n\tupdateSidebar(e);\n\t\n\t//updating task description\n\tupdateTaskDescription(e);\n\t\n\te.target.parentElement.parentNode.removeChild(e.target.parentElement);\n}", "deleteTask(task) {\n this.setState({\n toDo: this.state.toDo.filter((e, i) => {\n return i !== task;\n })\n });\n }", "function removeToDo(element){\r\n element.parentNode.parentNode.removeChild(element.parentNode);\r\n SIDELIST[activeid].list[element.id].trash = true;\r\n}", "function removeTask(e) {\n e.stopPropagation();\n /*\n e.target || this === <i class=\"fas fa-times\"></i>\n e.target.parentElement === <a class=\"delete-item secondary-content\">\n e.target.parentElement.parentElement === <li>\n */\n if(confirm('Are you sure?') === true) { \n\n e.target.parentElement.parentElement.remove(); \n }\n }", "function deleteTask(index) {\n\tlet getLocalStorage = localStorage.getItem(\"New Todo\"); //getting localStorage\n listArr = JSON.parse(getLocalStorage);\n listArr.splice(index, 1)//remove or delete the particuler indexed li\n //after remove li again update localStorage\n localStorage.setItem(\"New Todo\", JSON.stringify(listArr)); // transforming js objcet into a json string\n\tshowTasks();\n}", "function deleteTask(deleteButton) {\n var task = deleteButton.closest(\"task\");\n var tasks = document.getElementsByTagName(\"task\");\n for (i = 0; i < tasks.length; i++) {\n var currentTask = tasks[i];\n if (currentTask === task) {\n localStorage.removeItem(i);\n task.parentNode.removeChild(task);\n }\n }\n }", "function delete_task(task_id) {\n fetch(`delete/${task_id}`, {\n method: 'DELETE'\n })\n var task = document.getElementById(`${task_id}`);\n task.remove();\n }", "function removeTask2(e) {\n console.log(\"yep\");\n if (e.target.parentElement.classList.contains(\"delete-item\")) {\n console.log(\"yep del\");\n if (confirm(\"Are You Sure about that ? \")) {\n e.target.parentElement.parentElement.remove();\n }\n }\n}", "function removeTask(e) {\n\n const elementValue = e.target.parentNode.getElementsByTagName(\"p\")[0].innerHTML;\n \n const tasksArray = Array.from(getLocalStorageTasks());\n\n tasksArray.forEach(task => {\n if (task == elementValue) {\n const filteredArray = tasksArray.filter(item => item != elementValue);\n \n setLocalStorage(filteredArray);\n\n // we need to fetch done tasks from local storage\n // then copy the elements + add the completed one\n // set new array to localStorage complete tasks\n //setCompleteTasksLocalStorage()\n refreshTasks();\n }\n })\n}", "function removeLocalTasks(todo) {\n let todos;\n if(localStorage.getItem('todos') === null){\n todos = [];\n } else {\n todos = JSON.parse(localStorage.getItem(\"todos\"));\n }\n const todoIndex = todo.children[0].innerText;\n todos.splice(todos.indexOf(todoIndex), 1);\n localStorage.setItem(\"todos\", JSON.stringify(todos));\n}", "removeTask(taskId) {\n const dbRef = firebase.database().ref();\n dbRef.child(taskId).remove();\n }", "function deleteToDo(event){\n //console.log(event.target);\n const btn = event.target;\n const li = btn.parentNode;\n toDoList.removeChild(li);\n// filter는 해당 함수가 toDos의 모든 items들에게 실행하도록 하여 treu인 item으로 다시 배열 구성\n// ex. 클릭하여 제거된 버튼의 부모 요소인 li의 id 값이 3일 경우, 나머지 id 들은 다시 배열 정렬 \n const cleanToDos = toDos.filter(function(toDo){\n //toDo.id 는 integer, li.id 는 string\n console.log(toDo);\n console.log(toDo.id, li.id);\n/*필터함수는 각 항목을 확인하면서( 어떻게 확인 할지는 function으로 만들었죠?) return값이 true인 항목만 모아서 반환합니다.\n\ntoDos에 6개의 항목이 있다고 가정하면 id가 1부터 6까지 있겠죠?\n4번째 삭제버튼을 누르면, 삭제버튼의 parentNode (삭제버튼이 있는 li태그) 의 id값은 4겠죠?\n\n그러면 toDos가 가진 아이템들(6개)을 하나씩 확인하면서 각 아이템의 id와 삭제버튼 (li.id) 의 아이디인 4를 비교해서 return 합니다.\n그럼 return 이 총 6번 이루어지는데 이때 리턴값이 false이면 필터함수가 걸러냅니다.\nreturn toDo.id !== parseInt(li.id)\n조건식이 toDos의 id와 삭제버튼의 parentNode인 li의 id와 달라야지 true 이므로\n하나씩 돌면서 toDos의 id가 4일때 li.id의 id가 4이면 같으므로 false를 리턴합니다.\n\n그러면 id값이 4인 항목만 건너뛰고 cleanToDos 에 5개의 아이템으로 이루어진 배열이 반환되어 할당됩니다.\n*/\n\n\n return toDo.id != parseInt(li.id);\n });\n //cleanToDos는 지우고 나서 남은애들이 저장되어있음.\n console.log(cleanToDos);\n \n toDos = cleanToDos;\n saveToDos();\n}", "function CompleteTask() \n{ \n var listItem = this.parentNode;\n var ul = listItem.parentNode;\n var tarInd = listItem.querySelector(\"p\");\n\n ul.removeChild(listItem);\n\n taskArr.splice([tarInd.value],1);\n\n console.log(taskArr);\n}", "function deleteCheck(e) {\r\n const item = e.target;\r\n\r\n // Deleting the particular task if the user clicks on the trash button:\r\n if (item.classList[0] === \"trash-btn\") {\r\n const todo = item.parentElement;\r\n todo.classList.add(\"fall\");\r\n todo.addEventListener(\"transitionend\", function () {\r\n todo.remove();\r\n })\r\n\r\n }\r\n\r\n // If the user clicks on check button we toggle a class of 'completed' to add the necessary styles:\r\n if (item.classList[0] === \"completed-btn\") {\r\n const todo = item.parentElement;\r\n todo.classList.toggle(\"completed\");\r\n }\r\n}", "function clearTasks(e) {\n taskList.innerHTML = \"\";\n}", "function removeTrash() {\n var i = 0;\n var list;\n while (that.data.lists[i] !== undefined) {\n list = that.data.lists[i];\n if (list.tChecked) {\n that.data.lists.splice(i, 1);\n removeListOnStorage(list.id, that.config.listKey);\n } else {\n i++;\n }\n }\n }", "delete() { all = all.filter(task => task.id !== this.id) }", "todo_delete(todo){\n todosRef.child(todo['.key']).remove();\n this.activity_add(\"Todo with text \" + todo.task + \" removed\");\n var index = this.todos.indexOf(todo);\n if(index > -1){\n this.todos.splice(index, 1);\n }\n }", "deleteTask(taskId) {\n const newTasks = [];\n this.tasks.forEach((item) => {\n if (item.Id !== taskId) {\n newTasks.push(item);\n }\n });\n this.tasks = newTasks;\n }", "function deleteAndCheck (occasion){\n const item = occasion.target;\n if (item.classList[0] === 'deleted-btn'){ //delete trashcan\n const todo = item.parentElement;\n todo.classList.add('collapse');\n removeLocalTodos(todo);\n todo.addEventListener('transitionend', function(){\n todo.remove();\n })\n };\n// marks as complete\n if (item.classList[0] === 'completed-btn'){\n const todo = item.parentElement;\n todo.classList.toggle(\"completed\");\n }\n }", "function removeTask(e){\n // get the parent list item to remove\n var taskItem = e.target.parentElement;\n taskList.removeChild(taskItem);\n}", "function removeTask(Event) {\n //Set animation to fade-out\n Event.path[2].style.animationName = \"fade-out\";\n\n //Remove task from the board after 1.6s\n setTimeout(function() {\n Event.path[2].remove();\n }, 1600);\n\n //Remove task from tasks array\n for (var i = 0; i < tasks.length; i++) {\n if (tasks[i].id == Event.target.id) {\n console.log(\n \"*REMOVED* task id: \" + tasks[i].id + \" task title: \" + tasks[i].title\n );\n tasks.splice(i, 1);\n }\n }\n\n //Update the local storage with the new tasks array\n localStorage.setItem(\"task\", JSON.stringify(tasks));\n}", "deleteTask(taskId) {\n let newTasks = [];\n this.tasks.forEach(task => {\n if (task.id !== taskId) {\n newTasks.push(task);\n }\n });\n this.tasks = newTasks;\n }", "delete(id, item) {\n this.tasks = this.tasks.filter(task => task.id !== id);\n\n localStorage.setItem(this.storageList, JSON.stringify(this.tasks));\n item.remove();\n }", "function removeFromLS(taskItem) {\r\n //Copy Get Task Function//\r\n let tasks;//All Task Will Be Include//\r\n if (localStorage.getItem('tasks') === null) {\r\n tasks = [];//Checking local Storage If Tasks Exist Or Not//\r\n } else {\r\n tasks = JSON.parse(localStorage.getItem('tasks'));\r\n\r\n }\r\n let li = taskItem;\r\n li.removeChild(li.lastChild);//<a>x</a>\r\n tasks.forEach((task, index) => {\r\n if (li.textContent.trim() === task) {\r\n tasks.splice(index, 1);\r\n }\r\n });\r\n localStorage.setItem('tasks', JSON.stringify(tasks));\r\n}", "function deleteTask(event){\n child = event.target.parentElement;\n count--;\n if(child.getElementsByTagName(\"input\")[0].checked==false){\n checked--;\n }\n list.removeChild(child);\n updateItemCount();\n updateCheckedCount();\n \n}" ]
[ "0.7403256", "0.72473013", "0.7158116", "0.7153182", "0.71489525", "0.7123197", "0.70864403", "0.70445865", "0.70080054", "0.6972743", "0.6972021", "0.69592506", "0.6953322", "0.69066185", "0.6871405", "0.68564725", "0.6838206", "0.6827074", "0.68257725", "0.6818862", "0.68032724", "0.6795183", "0.6789422", "0.67869186", "0.6783482", "0.67824054", "0.67822033", "0.67680055", "0.6765169", "0.6765169", "0.6765169", "0.67595494", "0.67584306", "0.67518336", "0.6731551", "0.6725537", "0.67079324", "0.67051417", "0.6698465", "0.6693133", "0.6656353", "0.6650481", "0.6631349", "0.66249895", "0.6617884", "0.66166514", "0.6613463", "0.65955245", "0.6585409", "0.6572075", "0.6568842", "0.6568342", "0.65654325", "0.6563398", "0.65570843", "0.6556921", "0.65510064", "0.6548156", "0.65403116", "0.65402377", "0.653964", "0.6533815", "0.6516853", "0.6513717", "0.65045536", "0.64964664", "0.64897996", "0.64841735", "0.6482519", "0.6482146", "0.64801604", "0.6475547", "0.6459795", "0.6451758", "0.6447509", "0.64472795", "0.6441757", "0.64402735", "0.643255", "0.6425998", "0.642455", "0.6420045", "0.6419767", "0.6419086", "0.64152616", "0.6413747", "0.6388686", "0.63884366", "0.63868254", "0.6383798", "0.638191", "0.6367846", "0.63662213", "0.63582915", "0.635593", "0.6355884", "0.6355093", "0.63533235", "0.63517714", "0.6351766" ]
0.7694405
0
handleMessage: do the entire sequence for this message. subscribe: send the machine if available, else send error. any other command: send error. This method returns a promise that usually resolves. It rejects only if there is a bug or internal error.
handleMessage(clientId, data) { return new Promise( (resolve, reject) => { log(`client ${clientId}: |${data}|`); if (data.match(/^\s*subscribe\s+/)) { const m = data.match(/subscribe\s+(\w+)/); if (m) { let machine = m[1]; this.subscribe(clientId, machine) .then( () => { log(`subscribed ${clientId} to machine ${machine}`); resolve(); }) .catch( errMsg => { const fullMsg = `error: ${errMsg}`; log(fullMsg); this.sendMessage(clientId, fullMsg) .then(resolve) .catch(reject); }); } else { const msg = `error: bad subscribe command`; log(`sending ${msg} to client ${clientId}`); this.sendMessage(clientId, `${msg}`) .then(resolve) .catch(reject); } } else if (data.match(/^command\s+/)) { const m = data.match(/^\s*command\s+(\w+)/); const arr = data.split('\n').filter( e => e.length > 0); if (!m) { log(`did not match command pattern`); return reject(`bad command line: ${arr[0]}`); } log(`emitting command ${m[1]} ${clientId}: |${arr.slice(1)}|`); this.emit('command', m[1], clientId, arr.slice(1)); return resolve(); } else { const msg = `bad command: |${trunc(data)}|`; console.log(`sending ${msg} to client ${clientId}`); this.sendMessage(clientId, msg) .then(resolve) .catch(reject); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function handleMessage(msg, reply) {\n let response = 'success';\n try {\n if (msg.command == 'capture') {\n if (!msg.streamId) {\n throw new Error('No stream ID received');\n }\n await startCapture(msg.streamId);\n } else if (msg.command == 'stop') {\n stopCapture();\n } else {\n throw new Error(\n `Unexpected message: ${JSON.stringify(message)}`);\n }\n } catch (e) {\n response = e.toString();\n }\n reply(response);\n}", "function sendMessage(message) {\n return new RSVP.Promise(function (resolve, reject) {\n spec._processor.onmessage = function (event) {\n if (event.data.error) {\n return reject(event.data.error);\n } else {\n return resolve(event.data.data);\n }\n };\n return spec._processor.postMessage(message);\n });\n }", "receiveMessage(message) {\n return new Promise((resolve, reject) => {\n if (message instanceof Message){\n this.messageEventCallbacks.forEach(cb=>{\n cb(message);\n });\n }\n resolve();\n })\n }", "function handleMessage(message) {\n if (closed)\n fail(new Error('Client cannot send messages after being closed'));\n\n //TODO for debugging purposes\n pubsub.emit('message', message);\n\n const commandName = message.command;\n delete message.command;\n\n //look for command in list of commands and check if exists\n const commandModule = commands[commandName];\n if (commandModule) {\n //TODO move this into the command modules\n //check params\n try {\n ow(message, commandModule.paramType);\n } catch (error) {\n throw new MyaError(`Invalid arguments passed to ${commandModule}`, 'INVALID_ARGUMENTS', error);\n }\n\n //run the command\n commandModule.run(client, message);\n } else {\n throw new MyaError(`Command ${commandName} does not exist`, 'COMMAND_NOT_FOUND');\n }\n }", "_handleMessage(message) {\n // command response\n if (message.id) {\n const callback = this._callbacks[message.id];\n if (!callback) {\n return;\n }\n // interpret the lack of both 'error' and 'result' as success\n // (this may happen with node-inspector)\n if (message.error) {\n callback(true, message.error);\n } else {\n callback(false, message.result || {});\n }\n // unregister command response callback\n delete this._callbacks[message.id];\n // notify when there are no more pending commands\n if (Object.keys(this._callbacks).length === 0) {\n this.emit('ready');\n }\n }\n // event\n else if (message.method) {\n const {method, params, sessionId} = message;\n this.emit('event', message);\n this.emit(method, params, sessionId);\n this.emit(`${method}.${sessionId}`, params, sessionId);\n }\n }", "function handleShellMessage(kernel, msg) {\n var future;\n try {\n future = kernel.sendShellMessage(msg, true);\n }\n catch (e) {\n return Promise.reject(e);\n }\n return new Promise(function (resolve) { future.onReply = resolve; });\n }", "function handleShellMessage(kernel, msg) {\n var future;\n try {\n future = kernel.sendShellMessage(msg, true);\n }\n catch (e) {\n return Promise.reject(e);\n }\n return new Promise(function (resolve, reject) {\n future.onReply = function (reply) {\n resolve(reply);\n };\n });\n }", "async __receiveMsg() {\n let msg;\n try {\n msg = await this.sqs.receiveMessage({\n QueueUrl: this.queueUrl,\n MaxNumberOfMessages: this.maxNumberOfMessages,\n WaitTimeSeconds: this.waitTimeSeconds,\n VisibilityTimeout: this.visibilityTimeout,\n }).promise();\n } catch (err) {\n this.emit('error', err, 'api');\n return;\n }\n\n let msgs = [];\n if (msg.Messages) {\n if (!Array.isArray(msg.Messages)) {\n this.emit('error', new Error('SQS Api returned non-list'), 'api');\n return;\n }\n msgs = msg.Messages;\n }\n this.debug('received %d messages', msgs.length);\n\n // We never want this to actually throw. The __handleMsg function should\n // take care of emitting the error event\n try {\n if (this.sequential) {\n for (let msg of msgs) {\n await this.__handleMsg(msg);\n }\n } else {\n await Promise.all(msgs.map(x => this.__handleMsg(x)));\n }\n } catch (err) {\n let error = new Error('__handleMsg is rejecting when it ought not to. ' +\n 'This is a programming error in QueueListener.__handleMsg()');\n error.underlyingErr = err;\n error.underlyingStack = err.stack || '';\n this.debug('This really should not happen... %j', error);\n this.emit('error', error, 'api');\n }\n\n if (this.running) {\n // Same as the call in .start(), but here we do a small timeout of 50ms\n // just to make sure that we're not totally starving eveything\n setTimeout(async () => {\n await this.__receiveMsg();\n }, 50);\n } else {\n this.emit('stopped');\n }\n }", "_sendCommMessages() {\n let topMessage;\n return Promise.try(() => {\n if (!this.comm) {\n // TODO: try to init comm channel here\n throw new Error('Comm channel not initialized, not sending message.');\n }\n while (this.messageQueue.length) {\n topMessage = this.messageQueue.shift();\n this.comm.send(this._transformMessage(topMessage));\n this.debug(`sending comm message: ${COMM_NAME} ${topMessage.msgType}`);\n }\n }).catch((err) => {\n console.error('ERROR sending comm message', err.message, err, topMessage);\n throw new Error('ERROR sending comm message: ' + err.message);\n });\n }", "send(message) {\n\n\n return new Promise((resolve, reject) => {\n if (this._connected) {\n\n let delivery = false;\n\n\n if (!message.id) {\n message.id = this.autoId();\n }\n\n this._ws.send(JSON.stringify(message));\n\n const cb = (data) => {\n delivery = true;\n return resolve(data);\n };\n\n\n const key = `__reply__${get(message, 'id')}`;\n\n this.on(key, cb);\n\n this._timeout = setTimeout(() => {\n if (!delivery) {\n this._event.off(key, cb);\n return reject(\"Unable send message to the server.\");\n } else {\n clearTimeout(this._timeout);\n }\n\n }, 10000);\n\n } else {\n return reject(\"You are not connected\");\n }\n });\n }", "async function handleMessage(message){\n\t\tconsole.debug(\"[DEBUG] Message from: \", message);\n\t\tif (message.request === \"GETACTIVETASKS\"){ // get all tasks and return them\n console.debug(\"[BACKEND] Message received: \", message);\n\t\t\tawait returnActiveTasks(message, sendResponse);\t\t\t\n } \n else if (message.request === 'ADDNEWTASK'){ // add the payload as new data\n let payload = message.payload;\n let hash = \"\" + payload.title + payload.creationDate;\n payload.hash = hash;\n saveNewTaskToDatabase(payload);\n }\n else if (message.request === 'DELETETASK'){ // delete task from database\n await delteTaskFromDatabase(message);\n }\n else if (message.request === 'RESOLVETASK'){ // move task from active to resolved store\n await resolveTask(message);\n }\n else if (message.request === 'GETRESOLVEDTASKS'){ // get all removed tasks and return them\n await returnResolvedTasks(message, sendResponse);\n }\n else if (message.request === 'GETRESOLVEDTASKBYHASH'){\n await returnResolvedTaskByHash(message, sendResponse);\n }\n \n else {\n\t\t\tconsole.error(\"[ERROR] Unable to handle request from: \", message);\n\t\t}\n\t}", "joinSystemMsgRoom() {\n\n // Received direct message from cloud\n io.socket.on( 'sysmsg:' + _deviceUDID, ( data ) => {\n if ( _sysMsgCb ) {\n this.$rootScope.$apply( () => {\n _sysMsgCb( data );\n } );\n } else {\n console.log( 'Dropping sio DEVICE_DM message rx (no cb)' );\n }\n } )\n\n return new Promise( ( resolve, reject ) => {\n\n io.socket.post( '/ogdevice/subSystemMessages', {\n deviceUDID: _deviceUDID\n }, ( resData, jwres ) => {\n this.$log.debug( resData );\n if ( jwres.statusCode !== 200 ) {\n reject( jwres );\n } else {\n this.$log.debug( \"Successfully joined sysmsg room for this device\" );\n resolve();\n }\n } );\n } );\n\n }", "function handleMessage(msg) { // process message asynchronously\n setTimeout(function () {\n messageHandler(msg);\n }, 0);\n }", "async _onMessage(connection, message) {\n switch (message.type) {\n case signalr.MessageType.Invocation:\n try {\n var method = this._methods[message.target.toLowerCase()];\n var result = await method.apply(this, message.arguments);\n connection.completion(message.invocationId, result);\n }\n catch (e) {\n connection.completion(message.invocationId, null, 'There was an error invoking the hub');\n }\n break;\n case signalr.MessageType.StreamItem:\n break;\n case signalr.MessageType.Ping:\n // TODO: Detect client timeout\n break;\n default:\n console.error(`Invalid message type: ${message.type}.`);\n break;\n }\n }", "function doSendMessage(message) {\n return new Promise(resolve => {\n chrome.runtime.sendMessage(chrome.runtime.id, message, {}, resolve);\n });\n}", "waitForMessage_() {\n this.wait_(4, buffer => {\n this.wait_(buffer.readUInt32BE(0), buffer => {\n this.push(this.getMessage_(buffer));\n process.nextTick(() => this.waitForMessage_());\n });\n });\n }", "function simulate(messageHandler, message) {\n console.log('[In]', message);\n return processMessage(messageHandler, message).then(response => {\n if (response === false) {\n console.log('-');\n }\n else {\n console.log('[Out]', response);\n }\n });\n}", "function consume({ connection, channel }) {\n return new Promise((resolve, reject) => {\n channel.consume(\"processing.results\", async function (msg) {\n // parse message\n let msgBody = msg.content.toString();\n let data = JSON.parse(msgBody);\n let requestId = data.requestId;\n let processingResults = data.processingResults;\n console.log(\"[x]Received a result message, requestId:\", requestId, \"processingResults:\", processingResults);\n\n\n // acknowledge message as received\n await channel.ack(msg);\n // send notification to browsers\n app.io.sockets.emit(requestId + '_new message', \"SUCESS\");\n\n });\n\n // handle connection closed\n connection.on(\"close\", (err) => {\n return reject(err);\n });\n\n // handle errors\n connection.on(\"error\", (err) => {\n return reject(err);\n });\n });\n }", "onMessage(data) {\n const {id, error, result} = JSON.parse(data);\n const promise = this.currentMessages[id];\n if(!promise) return;\n \n if(error) {\n promise.reject(error);\n } else {\n promise.resolve(result);\n }\n\n delete this.currentMessages[id];\n }", "subscribeToMessageChannel() {\n this.subscription = subscribe(\n this.messageContext,\n RECORD_SELECTED_CHANNEL,\n (message) => {\n console.log(message);\n this.handleMessage(message); \n }\n );\n \n\n }", "function sendMessage(message) {\r\n return new Promise( (resolve, reject) => {\r\n console.log(\"sendMessage\", message);\r\n setTimeout(() => {\r\n if(!ALLOW_RANDOM_FAILURE || Math.random < 0.5){\r\n echoServer.emit(\"sendMessage\", {\r\n name: MY_USER_NAME,\r\n message,\r\n });\r\n console.log(\"message sent\", message);\r\n resolve(\"OK\");\r\n } else {\r\n reject(\"TIMEOUT\");\r\n }\r\n }, Math.random() * 150);\r\n });\r\n}", "__receiveMessage(msg) {\n var implCmdName = '_cmd_' + msg.type;\n if (!(implCmdName in this)) {\n logic(this, 'badMessageTypeError', { type: msg.type });\n return;\n }\n try {\n let namedContext = msg.handle &&\n this.bridgeContext.maybeGetNamedContext(msg.handle);\n if (namedContext) {\n if (namedContext.pendingCommand) {\n console.warn('deferring', msg);\n namedContext.commandQueue.push(msg);\n } else {\n let promise = namedContext.pendingCommand =\n this._processCommand(msg, implCmdName);\n if (promise) {\n this._trackCommandForNamedContext(namedContext, promise);\n }\n }\n } else {\n let promise = this._processCommand(msg, implCmdName);\n // If the command went async, then it's also possible that the command\n // grew a namedContext and that we therefore need to get it and set up the\n // bookkeeping so that if any other commands come in on this handle before\n // the promise is resolved that we can properly queue them.\n if (promise && msg.handle) {\n namedContext = this.bridgeContext.maybeGetNamedContext(msg.handle);\n if (namedContext) {\n namedContext.pendingCommand = promise;\n this._trackCommandForNamedContext(namedContext, promise);\n }\n }\n }\n } catch (ex) {\n logic(this, 'cmdError', { type: msg.type, ex, stack: ex.stack });\n }\n }", "function promiseMessage(messageName, params = {}, paramsAsCPOW = {}) {\n let requestName, responseName;\n\n if (typeof messageName === 'string') {\n requestName = responseName = messageName;\n }\n else {\n requestName = messageName.request;\n responseName = messageName.response;\n }\n\n // A message manager for the current browser.\n let mm = gBrowser.selectedBrowser.messageManager;\n\n return new Promise((resolve) => {\n // TODO: Make sure the response is associated with this request.\n mm.sendAsyncMessage(requestName, params, paramsAsCPOW);\n\n let onMessage = (message) => {\n mm.removeMessageListener(responseName, onMessage);\n\n resolve(message.data);\n };\n\n mm.addMessageListener(responseName, onMessage);\n });\n }", "send(message) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!this.gatewayInstance) {\n throw new Error('No gateway instance initialized for the Text messages service');\n }\n else if (!message) {\n throw new Error('No message provided for the Text gateway service');\n }\n return this.gatewayInstance.send(message);\n });\n }", "async process(message, phrase) {\n const commandDefs = this.command.argumentDefaults;\n const handlerDefs = this.handler.argumentDefaults;\n const optional = Util_1.default.choice(typeof this.prompt === \"object\" && this.prompt && this.prompt.optional, commandDefs.prompt && commandDefs.prompt.optional, handlerDefs.prompt && handlerDefs.prompt.optional);\n const doOtherwise = async (failure) => {\n const otherwise = Util_1.default.choice(this.otherwise, commandDefs.otherwise, handlerDefs.otherwise);\n const modifyOtherwise = Util_1.default.choice(this.modifyOtherwise, commandDefs.modifyOtherwise, handlerDefs.modifyOtherwise);\n let text = await Util_1.default.intoCallable(otherwise).call(this, message, {\n phrase,\n failure\n });\n if (Array.isArray(text)) {\n text = text.join(\"\\n\");\n }\n if (modifyOtherwise) {\n text = await modifyOtherwise.call(this, message, text, {\n phrase,\n failure: failure\n });\n if (Array.isArray(text)) {\n text = text.join(\"\\n\");\n }\n }\n if (text) {\n const sent = await message.channel.send(text);\n if (message.util)\n message.util.addMessage(sent);\n }\n return Flag_1.default.cancel();\n };\n if (!phrase && optional) {\n if (this.otherwise != null) {\n return doOtherwise(null);\n }\n return Util_1.default.intoCallable(this.default)(message, {\n phrase,\n failure: null\n });\n }\n const res = await this.cast(message, phrase);\n if (Argument.isFailure(res)) {\n if (this.otherwise != null) {\n return doOtherwise(res);\n }\n if (this.prompt != null) {\n return this.collect(message, phrase, res);\n }\n return this.default == null ? res : Util_1.default.intoCallable(this.default)(message, { phrase, failure: res });\n }\n return res;\n }", "async function receiveMessage() {\n const sqs = new AWS.SQS();\n\n try {\n // to simplify running multiple workers in parallel, \n // fetch one message at a time\n const data = await sqs.receiveMessage({\n QueueUrl: config.queue.url,\n VisibilityTimeout: config.queue.visibilityTimeout,\n MaxNumberOfMessages: 1\n }).promise();\n\n if (data.Messages && data.Messages.length > 0) {\n const message = data.Messages[0];\n const params = JSON.parse(message.Body);\n\n // while processing is not complete, update the message's visibilityTimeout\n const intervalId = setInterval(_ => sqs.changeMessageVisibility({\n QueueUrl: config.queue.url,\n ReceiptHandle: message.ReceiptHandle,\n VisibilityTimeout: config.queue.visibilityTimeout\n }), 1000 * 60);\n\n // processMessage should return a boolean status indicating success or failure\n const status = await processMessage(params);\n clearInterval(intervalId);\n \n // if message was not processed successfully, send it to the\n // error queue (add metadata in future if needed)\n if (!status) {\n await sqs.sendMessage({\n QueueUrl: config.queue.errorUrl,\n MessageBody: JSON.stringify(params),\n }).promise();\n }\n\n // remove original message from queue once processed\n await sqs.deleteMessage({\n QueueUrl: config.queue.url,\n ReceiptHandle: message.ReceiptHandle\n }).promise();\n }\n } catch (e) {\n // catch exceptions related to sqs\n logger.error(e);\n } finally {\n // schedule receiving next message\n setTimeout(receiveMessage, config.queue.pollInterval);\n }\n}", "function send_message_to_client(client, msg){\n return new Promise((resolve, reject) => {\n var msg_chan = new MessageChannel();\n msg_chan.port1.onmessage = function(event){\n if(event.data.error){\n reject(event.data.error);\n }else{\n resolve(event.data);\n }\n };\n\n client.postMessage(\"SW Says: '\"+msg+\"'\", [msg_chan.port2]);\n });\n}", "handleMessage(msg) {\n return __awaiter(this, void 0, void 0, function* () {\n if (!msg.author)\n return; // this is a bug and shouldn't really happen\n if (this.ignoreBots && msg.author.bot)\n return;\n // Construct a partial context (without prefix or command name)\n const partialContext = Object.assign({\n client: this,\n }, this.contextAdditions);\n // Is the message properly prefixed? If not, we can ignore it\n const matchResult = yield this.splitPrefixFromContent(msg, partialContext);\n if (!matchResult)\n return;\n // It is! We can\n const [prefix, content] = matchResult;\n // If there is no content past the prefix, we don't have a command\n if (!content) {\n // But a lone mention will trigger the default command instead\n if (!prefix || !prefix.match(this.mentionPrefixRegExp))\n return;\n const defaultCommand = this.defaultCommand;\n if (!defaultCommand)\n return;\n defaultCommand.execute(msg, [], Object.assign({\n client: this,\n prefix,\n }, this.contextAdditions));\n return;\n }\n // Separate command name from arguments and find command object\n const args = content.split(' ');\n const commandName = args.shift();\n if (commandName === undefined)\n return;\n const command = this.commandForName(commandName);\n // Construct a full context object now that we have all the info\n const fullContext = Object.assign({\n prefix,\n commandName,\n }, partialContext);\n // If the message has command but that command is not found\n if (!command) {\n this.emit('invalidCommand', msg, args, fullContext);\n return;\n }\n // Do the things\n this.emit('preCommand', command, msg, args, fullContext);\n const executed = yield command.execute(msg, args, fullContext);\n if (executed)\n this.emit('postCommand', command, msg, args, fullContext);\n });\n }", "message(msg) {\n const sessionPath = this.sessionClient.sessionPath(projectId, sessionId);\n const request = {\n session: sessionPath,\n queryInput: {\n text: {\n text: msg,\n languageCode: languageCode,\n },\n },\n };\n\n const processMessage = (resolve, reject) => {\n this.sessionClient\n .detectIntent(request)\n .then(responses => {\n if (responses.length === 0 || !responses[0].queryResult) {\n reject(new Error('incorrect Dialog Flow answer'));\n } else {\n resolve(responses[0].queryResult);\n }\n })\n .catch(err => {\n console.error('ERROR:', err);\n reject(err);\n });\n }\n return new Promise(processMessage);\n }", "subscribeToMessageChannel() {\n if (!this.subscription) {\n this.subscription = subscribe(\n this.messageContext,\n sObjectSelected,\n (message) => this.handleMessage(message),\n { scope: APPLICATION_SCOPE }\n );\n }\n }", "subscribeToMessageChannel() {\n this.subscription = subscribe(\n this.messageContext,\n SIMPLE_MESSAGE_CHANNEL,\n (message) => this.handleMessage(message)\n );\n }", "async receive() {\n return new Promise((resolve) => this.once('message', (data) => {\n const msg = deserialise(data);\n this._logger.push({ msg }).log('Received');\n resolve(msg);\n }));\n }", "handleMessage(message) {\n console.log('Came to handleMessage in SubscriberLWC. Message: ' + message.textMessage);\n this.receivedMessage = message.textMessage;\n }", "async add_message(status, message) {\n var return_value = false;\n return new Promise((resolve, reject) => {\n this.db().run(\"INSERT INTO messages (status, message) VALUES (?, ?);\", [status, message], async (error) => {\n if(!error) {\n let last_message_id = await this.get_last_message_id();\n if(last_message_id) {\n let last_message = await this.get_message(last_message_id);\n resolve(last_message);\n } else {\n resolve(false);\n }\n } else {\n // Provide feedback for the error\n console.log(error);\n resolve(false);\n }\n });\n }); \n }", "async function handleMsg(data) {\n let response;\n switch (data.message) {\n case \"pub(authorize.tab)\":\n // always approve extension auth\n return _postResponse({ id: data.id, response: true });\n case \"pub(accounts.list)\":\n // get accounts from host app\n response = await requestApp(data);\n // then send result back to dapp page\n return _postResponse({ id: data.id, response });\n case \"pub(accounts.subscribe)\":\n // we dont need this function, so return true\n return _postResponse({ id: data.id, response: true });\n case \"pub(bytes.sign)\":\n case \"pub(extrinsic.sign)\":\n try {\n response = await requestApp(data);\n return _postResponse({ id: data.id, response });\n } catch (err) {\n return _postResponse({ id: data.id, error: err.message });\n }\n default:\n throw new Error(`Unable to handle message: ${data.message}`);\n }\n}", "async function pubsubMessage(channel, message) {\n const { name, data, options } = JSON.parse(message)\n const { clientid, cbid } = options\n const client = [...app.websocket.clients].find(c => c.id == clientid)\n const callback = callbacks[cbid]\n delete callbacks[cbid]\n await state.handlers[name](data, client)\n if (typeof callback == 'function') callback()\n }", "async handle (msg) {\n if (this.test(msg)) {\n this.run(msg)\n }\n }", "function sendToRouterService(message) {\n if (!transport || (transport instanceof Promise)) {\n Logger.system.warn(\"RouterClient: Queuing message since router initialization not complete\", message);\n queue.push(message);\n }\n else {\n transport.send(message);\n }\n }", "function readMessage(destinationDeviceName) {\n var publish = true;\n rl.question('enter the cmd to send to ' + destinationDeviceName + ':\\r\\n', function (message) {\n // Calling function to publish to IoT Topic\n switch (message) {\n case 'kill':\n case 'stop':\n message = 'kill';\n console.log('killing node ' + destinationDeviceName + '!');\n break;\n case 'restart':\n case 'reset':\n message = 'restart';\n console.log('restarting the node ' + destinationDeviceName + '!');\n break;\n case 'sleep':\n case 'pause':\n message = 'pause';\n console.log('putting the ' + destinationDeviceName + ' to deep sleep / pausing it');\n break;\n case 'start':\n case 'wake':\n message = 'start';\n console.log('starting / waking up the ' + destinationDeviceName + ' from deep sleep');\n break;\n case 'emergency':\n case 'eme':\n message = 'emergency';\n console.log('updating the duty cycle of ' + destinationDeviceName + ' to send constant updates');\n break;\n case 'normal':\n message = 'normal';\n console.log('updating the duty cycle of ' + destinationDeviceName + ' to work as usual');\n break;\n case 'plugin':\n case 'charge':\n message = 'plugin';\n console.log('hard charging the ' + destinationDeviceName);\n break;\n case 'letdie':\n case 'unplug':\n case 'discharge':\n message = 'unplug';\n console.log('setting ' + destinationDeviceName + ' to not charge and die');\n break;\n default:\n console.log('incorrect cmd please enter again!');\n publish = false;\n break;\n }\n if (publish) {\n publishToIoTTopic(cmdTopic + destinationDeviceName, message);\n }\n readConsoleInput();\n });\n}", "function Messager( busConnection){\n\tvar pending= {}\n\tbusConnection.on( \"message\", function( msg){\n\t\t// find serial\n\t\tif( !msg.replySerial) return\n\t\tvar defer= pending[ msg.replySerial]\n\t\tif( !defer) return\n\n\t\t// resolve \n\t\tdefer.resolve( msg)\n\t})\n\n\treturn function message( m){\n\t\tvar serial= m.serial|| _random()\n\t\tif( !m.serial){\n\t\t\tm.serial= serial\n\t\t}\n\t\t// create deferred\n\t\tvar defer= pending[ serial]= Promise.defer()\n\n\t\t// cleanup `pending` after message resolves\n\t\tfunction cleanup(){\n\t\t\tdelete pending[ serial]\n\t\t}\n\t\tdefer.promise.then(cleanup, cleanup)\n\n\t\t// send message\n\t\tbusConnection.message( m)\n\n\t\t// return\n\t\treturn defer.promise\n\t}\n}", "function requestMessage() {\n asbService.receiveQueueMessage((queureName + '-recieve'), handleMessage);\n}", "function requestMessage() {\n asbService.receiveQueueMessage((queureName + '-recieve'), handleMessage);\n}", "handleMessage(message) {\r\n console.log('Received message', message.payloadString);\r\n this.callbacks.forEach((callback) => callback(message));\r\n }", "handleMessage() {\n let event = this.webhookEvent;\n\n let responses;\n\n try {\n if (event.message) {\n let message = event.message;\n if (message.quick_reply) {\n responses = this.handleQuickReply();\n } else if (message.attachments) {\n responses = this.handleAttachmentMessage();\n } else if (message.text) {\n responses = this.handleTextMessage();\n }\n } else if (event.postback) {\n responses = this.handlePostback();\n } else if (event.referral) {\n responses = this.handleReferral();\n }\n } catch (error) {\n //console.error(error);\n responses = {\n text: `An error has occured: '${error}'. We have been notified and \\\n will fix the issue shortly!`\n };\n }\n\n if (Array.isArray(responses)) {\n let delay = 0;\n for (let response of responses) {\n if(typeof response.then == 'function'){\n Promise.resolve(response).then(data => {\n this.sendMessage(data, delay * 1000);\n }).catch(err => {\n console.log(\"error from A \", err)\n })\n }else{\n this.sendMessage(response, delay * 1000);\n }\n delay++;\n }\n } else {\n if(typeof responses.then == 'function'){\n Promise.resolve(responses).then(data => {\n this.sendMessage(data);\n }).catch(err =>{\n console.log(\"error from B\", err)\n })\n } else{\n this.sendMessage(responses);\n }\n }\n }", "async receiveFor(messageListener) {\r\n let queue = this.queue();\r\n let ack = this.ack.bind(this);\r\n queue.on(Constant_1.default.MESSAGE_CONSUMER_ERROR_EVENT_NAME, (e) => {\r\n if (!this.isAutoAcknowledged()) {\r\n if (e instanceof MessageException_1.default) {\r\n queue.nack(messageListener.message(), e.isRetry());\r\n }\r\n else {\r\n queue.nack(messageListener.message(), true);\r\n }\r\n }\r\n });\r\n try {\r\n await queue.consume(messageListener, ack, {\r\n noAck: this.isAutoAcknowledged()\r\n });\r\n }\r\n catch (e) {\r\n debugError(Constant_1.default.CONSUMER_ERROR + e);\r\n return Promise.reject();\r\n }\r\n return Promise.resolve();\r\n }", "subscribe(clientId, machine) {\n return new Promise( (resolve, reject) => {\n if (typeof machine !== 'string' || !machine.match(/^[a-z0-9]+$/)) {\n\treturn reject(`subscribe: bad machine name: ${machine}`);\n }\n const rec = this._clientMap.get(clientId);\n if (! rec) {\n\treturn reject(`subscribe(${machine}): no such client: ${clientId}`);\n } else if (rec.machines.includes(machine)) {\n\tlog(`subscribe(${machine}): already subscribed`);\n\treturn resolve();\n } else if (! this._machineMap.has(machine)) {\n\treturn reject(`subscribe: no such machine: ${machine}`);\n }\n rec.machines.push(machine);\n log(`sending machine ${machine} to client ${clientId}`);\n this.sendMachine(machine, rec.wse)\n\t.then( resolve )\n\t.catch( errMsg => reject(`failed sending ${machine}: ${errMsg}`) );\n });\n }", "function handleMessage(msgEvent) {\n var ev, h;\n\n try {\n ev = JSON.parse(msgEvent.data);\n } catch (e) {\n $log.error('Message.data is not valid JSON', msgEvent.data, e);\n return null;\n }\n if (fs.debugOn('txrx')) {\n $log.debug(' << *Rx* ', ev.event, ev.payload);\n }\n\n if (h = handlers[ev.event]) {\n try {\n h(ev.payload);\n } catch (e) {\n $log.error('Problem handling event:', ev, e);\n return null;\n }\n } else {\n $log.warn('Unhandled event:', ev);\n }\n\n }", "subscribe() {\n if(this.subscription) {\n return;\n }\n this.subscription = subscribe(this.messageContext, MESSAGE_CHANNEL, (message) => {\n this.handleMessage(message);\n });\n }", "send (message) {\n return this.receive(this.reporter(message))\n }", "function handleMessage(evt) {\n var message = JSON.parse(evt.data);\n\n if (!pc && (message.sessionDescription || message.sdp || message.candidate))\n start(false);\n\n if (message.sessionDescription || message.sdp) {\n var desc = new RTCSessionDescription({\n \"sdp\": SDP.generate(message.sessionDescription) || message.sdp,\n \"type\": message.type\n });\n pc.setRemoteDescription(desc, function () {\n // if we received an offer, we need to create an answer\n if (pc.remoteDescription.type == \"offer\")\n pc.createAnswer(localDescCreated, logError);\n }, logError);\n } else if (!isNaN(message.orientation) && remoteView) {\n var transform = \"rotate(\" + message.orientation + \"deg)\";\n remoteView.style.transform = remoteView.style.webkitTransform = transform;\n } else {\n var d = message.candidate.candidateDescription;\n if (d && !message.candidate.candidate) {\n message.candidate.candidate = \"candidate:\" + [\n d.foundation,\n d.componentId,\n d.transport,\n d.priority,\n d.address,\n d.port,\n \"typ\",\n d.type,\n d.relatedAddress && (\"raddr \" + d.relatedAddress),\n d.relatedPort && (\"rport \" + d.relatedPort),\n d.tcpType && (\"tcptype \" + d.tcpType)\n ].filter(function (x) { return x; }).join(\" \");\n }\n pc.addIceCandidate(new RTCIceCandidate(message.candidate), function () {}, logError);\n }\n}", "async __handleMsg(msg) {\n let msgId = msg.MessageId;\n let rh = msg.ReceiptHandle;\n this.debug('handling message %s', msgId);\n\n // This is passed into the handler to change the current visibility\n // timeout. This can be used to allow for a short initial visibility\n // timeout. The shorter initial timeout would be used for processing the\n // message, but the handler should call this message with however long it\n // thinks that it needs to process the message. The `newTimeout` parameter\n // is the number of seconds that the message should be visible after the\n // call is made.\n //\n // https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SQS.html#changeMessageVisibility-property.\n let changetimeout = async (newTimeout) => {\n assert(typeof newTimeout === 'number');\n assert(newTimeout >= 0);\n // I suspect that the API doesn't honour a setting of 0, so using something simliar :(\n let newSetting = newTimeout || 1;\n try {\n let outcome = await this.sqs.changeMessageVisibility({\n QueueUrl: this.queueUrl,\n ReceiptHandle: rh,\n VisibilityTimeout: newSetting,\n }).promise();\n this.debug('message %s now expires %s (+%ds)', msgId, new Date(Date.now() + newSetting * 1000), newSetting);\n } catch (err) {\n this.debug('error changing message %s visibility', msgId);\n this.debug(err);\n this.emit('error', err, 'api');\n throw new Error('Failed to change timeout');\n }\n }\n\n // Delete this message\n let deleteMsg = async () => {\n try {\n await this.sqs.deleteMessage({\n QueueUrl: this.queueUrl,\n ReceiptHandle: rh,\n }).promise();\n this.debug('removed message %s from queue', msgId);\n } catch (err) {\n this.debug('error deleting message %s visibility', msgId);\n this.debug(err);\n this.emit('error', err, 'api');\n }\n }\n\n // Parse the message.\n let body;\n if (this.decodeMessage) {\n try {\n body = __decodeMsg(msg.Body);\n } catch (err) {\n this.emit('error', err, 'payload');\n // Let's pretty print some debugging information\n let contentPreview = msg.Body;\n // not perfect, but meh, i don't care\n if (contentPreview.length > 100) {\n contentPreview = contentPreview.slice(0, 97) + '...';\n }\n this.debug('message %s has malformed payload, deleting: %s', msgId, contentPreview);\n\n // We now know that this message isn't valid on this instance of\n // QueueListener. Since we might have a mixed pool of listeners and\n // another one might be able to understand this, let's mark the message\n // as a failure and put it back into the queue. This is mainly to\n // support gradual upgrades\n try {\n await changeTimeout(0);\n } catch(err) { }\n return;\n }\n } else {\n body = msg.Body;\n }\n\n // Run the handler. If the handler promise rejects, then we'll delete the\n // message and return. If the handler promise resolves, then we'll delete\n // the message and return. If the deletion on handler resolution or\n // changetimeout on handler rejection failes, then we return then.\n try {\n await this.handler(body, changetimeout);\n try {\n await deleteMsg();\n } catch(err) { }\n this.debug('handler successfully processed message %s', msgId);\n return;\n } catch (err) {\n debug('handler failed to process message %s', msgId);\n try {\n await changetimeout(0);\n } catch(err) { } \n this.emit('error', err, 'handler');\n return;\n }\n }", "function handleCallback(id, message) {\n\tconst promise = this._promises[id]\n\tif (promise) {\n\t\tif (message.status === 'error') {\n\t\t\tpromise.reject(message)\n\t\t} else {\n\t\t\tpromise.resolve(message)\n\t\t}\n\t\tdelete this._promises[id]\n\t} else if (message.status === 'error') {\n\t\tthis.emit('error', message.error, message)\n\t}\n}", "sendMsg(msg) {\n this.messages.next(msg);\n }", "_sendAsync(msg, port, address) {\n return new Promise((resolve, reject) => {\n this.socket.send(msg, port, address, (err, bytes) => {\n if (err) {\n reject(err)\n }\n else {\n resolve(bytes)\n } \n })\n })\n }", "function doMessage(msg) {\n logging.debug('sending message', msg.toObject())\n return co(function * () {\n yield msg.save()\n var payload = {\n verificationToken: kip.config.queueVerificationToken,\n message: msg.toObject()\n }\n\n logging.debug('token', kip.config.queueVerificationToken)\n\n logging.debug('sending message to', kip.config.slack.internal_host)\n yield request({\n uri: kip.config.slack.internal_host + '/incoming',\n method: 'POST',\n body: payload,\n json: true\n })\n })\n}", "function handleEvent(event) {\n if (event.type !== 'message' || event.message.type !== 'text') {\n // ignore non-text-message event\n return Promise.resolve(null);\n }\n // create a echoing text message\n const echo = { type: 'text', text: event.message.text };\n\n // use reply API\n return client.replyMessage(event.replyToken, echo);\n}", "function emitCreateMsg(message) {\n return new Promise((resolve) => {\n socket.emit('createMessage', {\n from: 'User',\n text: message,\n }, (data) => {\n resolve(data);\n });\n });\n }", "function send_message_to_sw(msg){\n return new Promise(function(resolve, reject){\n // Create a Message Channel\n var msg_chan = new MessageChannel();\n\n // Handler for recieving message reply from service worker\n msg_chan.port1.onmessage = function(event){\n if(event.data.error){\n reject(event.data.error);\n }else{\n resolve(event.data);\n }\n };\n\n // Send message to service worker along with port for reply\n if(navigator.serviceWorker.controller){\n navigator.serviceWorker.controller.postMessage(msg, [msg_chan.port2]);\n }else{\n alert('Please restart the app to use this feature')\n }\n });\n }", "receive(sender, message){\n setTimeout(()=>{\n let response = false;\n try {\n if(response !== true) throw \"Communication failed - message not received\";\n this.mailbox.push(message);\n console.log(this.nestName + \" successfully received message from: \" + sender);\n }\n catch(err){\n console.log(\"ERROR: \" + err);\n }\n }, 3000);\n }", "SOCKET_ONMESSAGE(state, message) {\n state.socket.message = message;\n\n if (message.commandId === undefined || message.commandRes === undefined || message.ok === undefined) {\n console.error('Malformed message', message);\n return;\n }\n\n const stateMessage = state.messages[message.commandId];\n state.messages[message.commandId] = null;\n\n switch (message.commandId) {\n // client -> server events\n case COMMAND_LOGIN:\n case COMMAND_REGISTER:\n case COMMAND_CREATE_ROOM:\n case COMMAND_JOIN_ROOM:\n case COMMAND_MAKE_STAKE:\n case COMMAND_MAKE_MOVE:\n case COMMAND_GET_ROOM:\n console.log('Received message', message);\n\n if (message.ok) {\n stateMessage.resolve(message);\n } else {\n stateMessage.reject(message);\n }\n break;\n // server -> client events\n case 1000:\n case 1001:\n case 1002:\n case 1003:\n case 1004:\n case 1005:\n case 1006:\n case 1007:\n case 1008:\n case 1009:\n case 1010:\n case 1011:\n console.log('Received message', message);\n\n state.roomEvent = message;\n break;\n default:\n console.error('Unknown message commandId', message);\n }\n }", "subscribeToMessageChannel() {\n if (!this.subscription) {\n this.subscription = subscribe(\n this.messageContext,\n locationSelected,\n (message) => {\n console.log('---> subscribing to location selected message', 'start')\n this.handleMessage(message)\n console.log('---> subscribing to location selected message', 'end')\n },\n { scope: APPLICATION_SCOPE }\n );\n }\n }", "async _consumer_connect(queue, messageHandler) {\n let q = await this._connect();\n this.cq = q;\n if (!queue) return q; // this is the pull model\n // push model\n for(;;) {\n let messages = await this._dequeue(queue);\n for(let i=0; i<messages.length; i++) {\n let message = messages[i];\n let handle = message.handle;\n let msg = message.msg;\n await messageHandler(msg).then(async() => {\n await this._remove(queue, handle);\n }).catch(err => {\n this.log.error(err);\n });\n }\n }\n }", "handlePublish() {\n let message = {message: this.message};\n publish(this.messageContext, messageChannel, message);\n }", "async function aMessageWithResponse(content)\n{\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n });\n\n return new Promise((suc,err)=>\n {\n return rl.question(\"\\n\"+content+'\\n', (answer) => {\n rl.close();\n suc(answer) \n });\n })\n}", "handleWebMessage(message) {\n console.log('Mensaje desde Web: ' + message);\n if (message === 'estado'){\n this.verificarEstado();\n return;\n }\n serverClient.publish('Espino/commands', message);\n }", "async function handleIncomingMessage( xmpp, redis, stanza ) {\n const origin = {\n from: stanza.attrs.from.split(\"/\")[0],\n to: stanza.attrs.to,\n }\n const body = stanza.getChild( 'body' )\n if ( body ) {\n origin.text = body.text()\n console.log( `FROM ${origin.from} TO ${origin.to}: ${origin.text}` )\n \n if ( origin.to == config.COMPONENT_DOMAIN ) {\n handleBot( xmpp, redis, origin )\n } else if ( /^\\+\\d+$/.test( origin.to.split(\"@\")[0] ) ) {\n forwardXmppToSms( xmpp, redis, origin )\n }\n }\n}", "function handleMessage(evt) {\n\tvar message = JSON.parse(evt.data);\n\n\tif (!pc && (message.sessionDescription || message.candidate))\n\t\tstart(false);\n\n\tif (message.sessionDescription) {\n\t\tpc.setRemoteDescription(new RTCSessionDescription({\n\t\t\t\"sdp\": SDP.generate(message.sessionDescription),\n\t\t\t\"type\": message.type\n\t\t}), function () {\n\t\t\t// if we received an offer, we need to create an answer\n\t\t\tif (pc.remoteDescription.type == \"offer\")\n\t\t\t\tpc.createAnswer(localDescCreated, logError);\n\t\t}, logError);\n\t} else if (!isNaN(message.orientation) && remoteView) {\n\t\tvar transform = \"rotate(\" + message.orientation + \"deg)\";\n\t\tremoteView.style.transform = remoteView.style.webkitTransform = transform;\n\t} else {\n\t\tvar d = message.candidate.candidateDescription;\n\t\tmessage.candidate.candidate = \"candidate:\" + [\n\t\t\td.foundation,\n\t\t\td.componentId,\n\t\t\td.transport,\n\t\t\td.priority,\n\t\t\td.address,\n\t\t\td.port,\n\t\t\t\"typ\",\n\t\t\td.type,\n\t\t\td.relatedAddress && (\"raddr \" + d.relatedAddress),\n\t\t\td.relatedPort && (\"rport \" + d.relatedPort),\n\t\t\td.tcpType && (\"tcptype \" + d.tcpType)\n\t\t].filter(function (x) { return x; }).join(\" \");\n\t\tpc.addIceCandidate(new RTCIceCandidate(message.candidate), function () {}, logError);\n\t}\n}", "async run() {\n while (true) {\n const userInput = await this.getMessage();\n const response = this.handleMessage(userInput);\n this.handleResponse(response);\n }\n }", "relayMsgToDevice(imsi, message){\n\n let self = this;\n log.L3(dl,'Sending message to device: ', message);\n let path = '/api/device/' + imsi + '/message';\n\n return new Promise(function (resolve, reject) {\n let postRequest = null,\n data = JSON.stringify({\"message\": message.trim()});\n let postOptions = {\n hostname: self.url,\n path: path,\n method: 'POST',\n headers:\n {\n 'Cache-Control': 'no-cache',\n Authorization: self.bearerToken,\n 'Content-Type': 'application/json',\n 'Content-Length': data.length\n }\n };\n postRequest = https.request(postOptions, function (res) {\n res.setEncoding('utf8');\n res.on('data', function (chunk) {\n log.L3(dl, 'Response from the NB-IoT Relay Service: ', chunk);\n resolve([res.statusCode, chunk])\n });\n });\n postRequest.on('error', function (e) {\n log.Err(dl, imsi, ': Problem with POST request: ' + e.message);\n reject(e)\n });\n log.L3(dl, 'Sending POST request to NRS - data: ', data);\n postRequest.write(data);\n postRequest.end();\n\n });\n\n }", "function promtAndInput(message){\n\tvar returnData;\n\treturn new Promise(function(fulfill, reject){\n\t\tprocess.stdout.write(message);\n\t\tprocess.stdin.once('data', function(data) {\n\t\t\treturnData = data.toString().trim(); \n\t\t\tfulfill(returnData);\n\t\t});\n\t});\n}", "onMessage(message) {\n log('received %s', message.type, message)\n this.emit('message', message)\n\n switch (message.type) {\n case 'ack':\n this.in.emit(`ack:${message.id}`, message)\n // No need to send an ack in response to an ack.\n return\n case 'data':\n if (message.data) this.emit('data', message.data)\n break\n default:\n }\n\n // Lets schedule an confirmation.\n this.multiplexer.add({\n type: 'ack',\n id: message.id\n })\n }", "async function consumeMessages(messagingChannel, queueName, handler) {\n function consumeCallback(msg) {\n console.log(\"Handling \" + queueName);\n\n const messagePayload = JSON.parse(msg.content.toString())\n\n try {\n const promise = handler(messagePayload);\n if (promise) {\n promise.then(() => {\n messagingChannel.ack(msg); //TODO: Need to understand how ack works.\n console.log(queueName + \" async handler done.\");\n })\n .catch(err => {\n console.error(queueName + \" async handler errored.\");\n console.error(err && err.stack || err);\n });\n }\n else {\n messagingChannel.ack(msg);\n console.log(queueName + \" handler done.\");\n }\n }\n catch (err) {\n console.error(queueName + \" handler errored.\");\n console.error(err && err.stack || err);\n }\n };\n\n console.log(\"Receiving messages for queue \" + queueName);\n\n await messagingChannel.consume(queueName, consumeCallback);\n}", "handleMessage(message) {\n console.log('lmsDemo2: message received:' + JSON.stringify(message));\n if(message.FromWhom == 'lmsdemo1'){\n this.msgrcvd = message.ValuePass;\n }\n }", "async webSocketReceiveMessage(message, id) {\n let msgType = message.replace(\" \", \"\").split(\":\")[0];\n if (msgType === \"ping\") {\n const claimResponseBundle = await this.getLatestResponse();\n const claimResponse = this.getClaimResponse(claimResponseBundle);\n if (\n claimResponse.outcome === \"complete\" ||\n claimResponse.outcome === \"error\"\n ) {\n this.setState({\n subscribeMsg: \"Updated ClaimResponse loaded\"\n });\n this.deleteSubscription(id);\n }\n } else if (msgType === \"bound\") {\n this.setState({\n subscribeMsg: \"WebSocket Subscription Successful!\"\n });\n } else {\n this.setState({\n subscribeMsg: message\n });\n }\n }", "function handleMessage(channel, message) {\n console.log('Received a message: %s', message)\n\n var payload = JSON.parse(message);\n\n acquireLock(payload, 1, lockCallback);\n}", "receive() {\n if (this.stopMe) {\n return;\n }\n this.mq.receiveMessage({qname: config.queueName}, (err, msg) => {\n if (err) {\n throw err;\n }\n if (msg.id) {\n this.errorDetection(msg);\n this.mq.deleteMessage({qname: config.queueName, id: msg.id}, () => {\n this.receive();\n });\n process.stdout.write('\\x1B[2KReceiving: <<< [' + msg.message + ']\\r');\n }\n else {\n // console.log(\"No messages for me...\");\n this.receive();\n }\n });\n }", "async get_message(msgid) { \n var return_value = false;\n return new Promise((resolve, reject) => {\n this.db().get(\"SELECT * FROM messages WHERE msgid = ?\", [msgid], (error, row) => {\n if(!error) {\n resolve(row);\n } else {\n // Provide feedback for the error\n console.log(error);\n resolve(false);\n }\n });\n }); \n }", "reply(messageObj) {\n let vcc = this._vcc\n return new Promise((resolve, reject) => {\n vcc.$qewd.send(messageObj, function(responseObj) {\n responseObj.data = responseObj.message ? responseObj.message : {}\n resolve(responseObj);\n });\n })\n }", "function handleMessage(message) {\n const {type, data, id} = message.data;\n let workerShouldPause = numStack.length > 0;\n\n switch (type) {\n case CHECK:\n if (workerShouldPause) {\n sendMessage({type: ADD_NUMBER, data: numStack.pop()});\n } else {\n sendMessage({type: CONTINUE});\n }\n break;\n case ACKNOWLEDGEMENT:\n const resolvedMessage = resolveMessage(id);\n const messageType = resolvedMessage.type;\n if (messageType === RESET || messageType === SET_DATA || messageType === START_SORT) {\n createLog(resolvedMessage);\n totalMessageCount--;\n } else if (Date.now() - resolvedMessage.startTime > 13) {\n createLog(resolvedMessage);\n nonStableMessageCount++;\n }\n totalMessageCount++;\n break;\n case DONE:\n createLog({type: DONE, duration: data.duration});\n resetWorker();\n clearInterval(interval);\n createReport({...data, originalArraySize: arrSize, intervalDuration, totalMessageCount, nonStableMessageCount});\n clearInputs();\n resetMessageCounters();\n enableSorter();\n window.WWInsertionSort = data;\n break;\n default:\n console.warn(`Unknow Action Type: '${type}'`);\n break;\n }\n}", "function transmitMessage(evt) {\n debug('SHIM SW executing transmitMessage...');\n\n // In theory,\n // evt.ports[0] should correspond to the MessagePort that was transferred\n // as part of the controlled page's call to controller.postMessage().\n // Therefore, evt.ports[0].postMessage() will trigger the onmessage\n // handler from the controlled page.\n // THIS DOESN'T WORK YET!\n // So much of the code of this function is a workaround around that...\n\n // We can get two kind of messages here: connection requests, and messages\n // on a (previously accepted) connection. As such, we should keep a table\n // of previously accepted connections to know which 'channel' should get the\n // message. Again, this should not be needed. Alas, MessageChannel doesn't\n // work. I think I'm going to say that a lot.\n\n // Maybe we would need to do something with this...\n if (evt.data.isConnectionRequest) {\n debug('SHIM SW - isConnectionRequest msg:'+JSON.stringify(evt.data));\n var connectionMessage = evt.data.dataToSend || {};\n // We need to construct here what we will pass to onconnect, based on what\n // we have received onconnect will need a way to return data to the source\n // http://mkruisselbrink.github.io/navigator-connect/\n // if it's a connect message, then we have to add an acceptConnection\n // method to the event we dispatch.\n connectionMessage.targetURL = evt.data.originURL;\n\n // We will invoke a onconnect handler here. This onconnect must call\n // acceptCondition(with a promise or a boolean) and can set an onmessage\n // on the source we pass to it. We must store that as a reference to\n // process messages at a later point. Again, that would not be needed if\n // MessageChannel worker. Told you I was going to say that a lot.\n debug('SHIM SW creating connectionMessage');\n connectionMessage.source = {\n postMessage: msg => {\n // Either here or on sendMessage, we should have a way to\n // distinguish our internal messages. Currently we're using the uuid\n // (if it has an uuid field and a data field it's internal)\n debug('connectionMessage.source.postMessage');\n sendMessage({uuid: evt.data.uuid, data: msg});\n }\n };\n\n // And here we should have a way to tell the parent that hey, we've\n // accepted the connection:\n connectionMessage.acceptConnection = aPromise => {\n if (typeof aPromise.then !== 'function') {\n // We got a value instead of a promise...\n aPromise = Promise.resolve(aPromise);\n }\n aPromise.then(accepted => {\n debug('SHIM SW then for acceptConnection accepted:' + accepted);\n sendMessage({ uuid: evt.data.uuid,\n data: {\n accepted: accepted\n }\n });\n // Now if we've *not* accepted the connection, we can clean up here\n if (!accepted) {\n delete _messageChannels[evt.data.uuid];\n // Just in case someone kept this. We could check this also on the\n // original postMessage function.\n connectionMessage.source.postMessage = function() {};\n }\n });\n };\n\n // On this object the onconnect handler add an event listener/set a\n // handler and it will use it to postMessages to the other side of the\n // connection, so we need to store it. Again, we wouldn't need to do this\n // if... yeah yeah.\n _messageChannels[evt.data.uuid] = connectionMessage.source;\n\n if (sw.onconnect && typeof sw.onconnect == \"function\") {\n debug('SHIM SW executing onConnect with --> ' +\n JSON.stringify(connectionMessage));\n sw.onconnect(connectionMessage);\n }\n } else {\n debug('SHIM SW - msg with isConnectionRequest false');\n // This should come from an accepted connection. So evt.data.uuid has the\n // channel id\n var messageChannel = _messageChannels[evt.data.uuid];\n if (!messageChannel) {\n debug(\"transmitMessage: Didn't get a valid uuid: \" + evt.data.uuid);\n return;\n }\n // To-Do: Check that dataToSend has what we expect it to have\n // Also check if this needs a source or whatever (with the spec!)\n messageChannel.onmessage &&\n typeof messageChannel.onmessage === 'function' &&\n messageChannel.onmessage(evt.data.dataToSend);\n // Once again, if MessageChannel worked, this would be a NOP.\n }\n }", "function captureMessage(message, level) {\r\n var syntheticException;\r\n try {\r\n throw new Error(message);\r\n } catch (exception) {\r\n syntheticException = exception;\r\n }\r\n return callOnHub('captureMessage', message, level, {\r\n originalException: message,\r\n syntheticException: syntheticException\r\n });\r\n}", "static sendMessage(webSocket, message, timeout){\n\n let promiseSocketId = uuid();\n message.promiseSocketId = promiseSocketId;\n\n if(typeof message !== 'string'){\n message = JSON.stringify(message);\n }\n\n return new Promise((resolve, reject) => {\n PromiseSocket.listen(webSocket, timeout, { promiseSocketId })\n .then(messageEvent => resolve(JSON.parse(messageEvent.data)))\n .catch(() => reject());\n\n webSocket.send(message);\n });\n }", "async _handler(event, processMsg, concurrent) {\n console.log('Handling %s', event);\n\n await this._channel.assertExchange('app', 'topic', { durable: false, alternateExchange: 'deadletter' });\n await this._channel.assertQueue(event, { durable: false, autoDelete: true, deadLetterExchange: 'deadletter' });\n await this._channel.bindQueue(event, 'app', event);\n\n if(concurrent > 0)\n await this._channel.prefetch(concurrent);\n\n this._channel.consume(event, (msg) => this._handleMsg(event, msg, processMsg).catch(err => console.log(err.stack)));\n }", "function handleMessage(message_event) {\n var data = message_event.data;\n if ((typeof(data) === 'string' || data instanceof String)) {\n check_if_pexe_7778_working(data);\n common.logMessage(data);\n }\n else if (data instanceof Object)\n {\n var pipeName = data['pipe']\n if ( pipeName !== undefined )\n {\n // Message for JavaScript I/O pipe\n var operation = data['operation'];\n if (operation == 'write') {\n $('pipe_output').value += ArrayBufferToString(data['payload']);\n } else if (operation == 'ack') {\n common.logMessage(pipeName + \": ack:\" + data['payload']);\n } else {\n common.logMessage('Got unexpected pipe operation: ' + operation);\n }\n }\n else\n {\n // Result from a function call.\n var params = data.args;\n var funcName = data.cmd;\n var callback = funcToCallback[funcName];\n if (!callback)\n {\n common.logMessage('Error: Bad message ' + funcName + ' received from NaCl module.');\n return;\n }\n delete funcToCallback[funcName];\n callback.apply(null, params);\n }\n } else {\n common.logMessage('Error: Unknow message `' + data + '` received from NaCl module.');\n }\n}", "async function handleAnswer (msg) {\n var peer = peers.get(msg.from);\n var pc = peer.conn;\n var pid = msg.from;\n await pc.setRemoteDescription(msg.data);\n document.getElementById('status').value = pc.signalingState\n console.log('set Answer to Remote Desc', pc.signalingState);\n}", "function captureMessage(message, level) {\n var syntheticException;\n try {\n throw new Error(message);\n }\n catch (exception) {\n syntheticException = exception;\n }\n return callOnHub('captureMessage', message, level, {\n originalException: message,\n syntheticException: syntheticException,\n });\n}", "function captureMessage(message, level) {\n var syntheticException;\n try {\n throw new Error(message);\n }\n catch (exception) {\n syntheticException = exception;\n }\n return callOnHub('captureMessage', message, level, {\n originalException: message,\n syntheticException: syntheticException,\n });\n}", "_onProcessMessage(message: ProcessMessage): void {\n switch (message.kind) {\n case 'stdout':\n break;\n case 'stderr':\n logger.warn(`${this._name} - error from stderr received: `, message.data.toString());\n break;\n case 'exit':\n // Log exit code if process exited not as a result of being disposed.\n if (!this._disposed) {\n logger.error(`${this._name} - exited before dispose: `, message.exitCode);\n }\n this.dispose();\n this._exitCode.next(message);\n this._exitCode.complete();\n break;\n case 'error':\n logger.error(`${this._name} - error received: `, message.error.message);\n this.dispose();\n break;\n default:\n // This case should never be reached.\n invariant(false, `${this._name} - unknown message received: ${message}`);\n }\n }", "function handler(buffer) {\n let chunks = buffer.toString().split(\"\\n\");\n\n for (let chunk of chunks) {\n chunk = chunk.replace(/(\\r\\n|\\n|\\r)/gm, \"\").trim();\n\n if (chunk == \"OK\") {\n // if end of message stop listner and return result\n this.removeListener(\"data\", handler);\n resolve(answer);\n\n // if line is busy or another but not error\n } else if (chunk == \"BUSY\" || chunk == \"NO DIAL TONE\" || chunk == \"NO CARRIER\") {\n resolve();\n\n } else if (chunk == \"ERROR\") {\n this.removeListener(\"data\", handler);\n reject(`ERROR result on command - ${command}. Answer - ${chunk}`);\n\n } else {\n // if message is not fully get add to result this chunk\n answer += chunk;\n };\n };\n }", "async getMessage() {\n return Channel.unpromptedMessage();\n }", "function handleMessage(message, sender) {\n if (message && message.type) {\n switch (message.type) {\n case 'xhr-capture':\n store.dispatch('fetchFromStorage', 'settings')\n .then(() => {\n switch (message.arrayType) {\n case 'rawTopics':\n store.dispatch('updateTopics', message.arrayObject);\n break;\n case 'rawResults':\n // NOTE: only update topic results if main switch is on\n if (store.getters.settings.ui.auto.isOn === true) {\n store.dispatch('updateTopicResults', {\n topicId: message.topicId,\n results: message.arrayObject\n })\n .catch(err => { utils.logErr(err); });\n }\n break;\n }\n });\n break;\n case 'activate_icon':\n // this guarantees popup click works correctly for page action\n store.dispatch('fetchFromStorage', 'settings')\n .then( () => {\n browser.pageAction.show(sender.tab.id);\n let settings = store.getters.settings\n let ui = store.getters.settings.ui\n utils.updateLastTabId(store, sender.tab.id)\n utils.setPageActionIcon(store.getters.settings) \n })\n break;\n }\n //utils.logMsg({ 'msg. from content script': message });\n }\n // \"Dummy response to keep the console quiet\" see: https://github.com/mozilla/webextension-polyfill/issues/130\n return Promise.resolve('dummy');\n}", "async function sendMessage(message) {\n await admin\n .messaging()\n .send(message)\n .then(response => {\n // Response is a message ID string.\n console.log('Successfully sent message:', response);\n return response;\n })\n .catch(error => {\n console.log('Error sending message:', error);\n return error;\n });\n}", "async _trySendBatch(rheaMessage, options = {}) {\n const abortSignal = options.abortSignal;\n const retryOptions = options.retryOptions || {};\n const timeoutInMs = getRetryAttemptTimeoutInMs(retryOptions);\n retryOptions.timeoutInMs = timeoutInMs;\n const sendEventPromise = async () => {\n var _a, _b;\n const initStartTime = Date.now();\n const sender = await this._getLink(options);\n const timeTakenByInit = Date.now() - initStartTime;\n logger.verbose(\"[%s] Sender '%s', credit: %d available: %d\", this._context.connectionId, this.name, sender.credit, sender.session.outgoing.available());\n let waitTimeForSendable = 1000;\n if (!sender.sendable() && timeoutInMs - timeTakenByInit > waitTimeForSendable) {\n logger.verbose(\"%s Sender '%s', waiting for 1 second for sender to become sendable\", this._context.connectionId, this.name);\n await delay(waitTimeForSendable);\n logger.verbose(\"%s Sender '%s' after waiting for a second, credit: %d available: %d\", this._context.connectionId, this.name, sender.credit, (_b = (_a = sender.session) === null || _a === void 0 ? void 0 : _a.outgoing) === null || _b === void 0 ? void 0 : _b.available());\n }\n else {\n waitTimeForSendable = 0;\n }\n if (!sender.sendable()) {\n // let us retry to send the message after some time.\n const msg = `[${this._context.connectionId}] Sender \"${this.name}\", ` +\n `cannot send the message right now. Please try later.`;\n logger.warning(msg);\n const amqpError = {\n condition: ErrorNameConditionMapper.SenderBusyError,\n description: msg\n };\n throw translate(amqpError);\n }\n logger.verbose(\"[%s] Sender '%s', sending message with id '%s'.\", this._context.connectionId, this.name);\n if (timeoutInMs <= timeTakenByInit + waitTimeForSendable) {\n const desc = `${this._context.connectionId} Sender \"${this.name}\" ` +\n `with address \"${this.address}\", was not able to send the message right now, due ` +\n `to operation timeout.`;\n logger.warning(desc);\n const e = {\n condition: ErrorNameConditionMapper.ServiceUnavailableError,\n description: desc\n };\n throw translate(e);\n }\n try {\n const delivery = await sender.send(rheaMessage, {\n format: 0x80013700,\n timeoutInSeconds: (timeoutInMs - timeTakenByInit - waitTimeForSendable) / 1000,\n abortSignal\n });\n logger.info(\"[%s] Sender '%s', sent message with delivery id: %d\", this._context.connectionId, this.name, delivery.id);\n }\n catch (err) {\n throw err.innerError || err;\n }\n };\n const config = {\n operation: sendEventPromise,\n connectionId: this._context.connectionId,\n operationType: RetryOperationType.sendMessage,\n abortSignal: abortSignal,\n retryOptions: retryOptions\n };\n try {\n await retry(config);\n }\n catch (err) {\n const translatedError = translate(err);\n logger.warning(\"[%s] Sender '%s', An error occurred while sending the message %s\", this._context.connectionId, this.name, `${translatedError === null || translatedError === void 0 ? void 0 : translatedError.name}: ${translatedError === null || translatedError === void 0 ? void 0 : translatedError.message}`);\n logErrorStackTrace(translatedError);\n throw translatedError;\n }\n }", "receiveMessage (sender, buffer, skipAuth) {\n const y = this.y;\n const userID = y.userID;\n skipAuth = skipAuth || false;\n if (!(buffer instanceof ArrayBuffer || buffer instanceof Uint8Array)) {\n return Promise.reject(new Error('Expected Message to be an ArrayBuffer or Uint8Array!'))\n }\n if (sender === userID) {\n return Promise.resolve()\n }\n let decoder = new BinaryDecoder(buffer);\n let encoder = new BinaryEncoder();\n let roomname = decoder.readVarString(); // read room name\n encoder.writeVarString(roomname);\n let messageType = decoder.readVarString();\n let senderConn = this.connections.get(sender);\n this.log('User%s from User%s: Receive \\'%s\\'', userID, sender, messageType);\n this.logMessage('User%s from User%s: Receive %Y', userID, sender, [y, buffer]);\n if (senderConn == null && !skipAuth) {\n throw new Error('Received message from unknown peer!')\n }\n if (messageType === 'sync step 1' || messageType === 'sync step 2') {\n let auth = decoder.readVarUint();\n if (senderConn.auth == null) {\n senderConn.processAfterAuth.push([messageType, senderConn, decoder, encoder, sender]);\n // check auth\n return this.checkAuth(auth, y, sender).then(authPermissions => {\n if (senderConn.auth == null) {\n senderConn.auth = authPermissions;\n y.emit('userAuthenticated', {\n user: senderConn.uid,\n auth: authPermissions\n });\n }\n let messages = senderConn.processAfterAuth;\n senderConn.processAfterAuth = [];\n\n messages.forEach(m =>\n this.computeMessage(m[0], m[1], m[2], m[3], m[4])\n );\n })\n }\n }\n if ((skipAuth || senderConn.auth != null) && (messageType !== 'update' || senderConn.isSynced)) {\n this.computeMessage(messageType, senderConn, decoder, encoder, sender, skipAuth);\n } else {\n senderConn.processAfterSync.push([messageType, senderConn, decoder, encoder, sender, false]);\n }\n }", "async function createMessage(handle, message) {\n try {\n const result = await PostgresUtil.pool.query('INSERT INTO reviews (created_by, message) VALUES ($1::text, $2::text);', [handle, message])\n return result\n } catch (exception) {\n if (exception.code === '42P01') { // 42P01 - Table is missing so we'll create it and try again\n await createMessageTable()\n return createMessage(handle, message)\n } else { // Unrecognized...throw error to caller\n console.error(exception)\n throw exception\n }\n }\n}", "async do() {\n return new Promise((resolve, reject) => {\n this.readable.on(\"data\", (data) => {\n data = typeof data === \"string\" ? Buffer.from(data, this.encoding) : data;\n this.appendUnresolvedData(data);\n if (!this.resolveData()) {\n this.readable.pause();\n }\n });\n this.readable.on(\"error\", (err) => {\n this.emitter.emit(\"error\", err);\n });\n this.readable.on(\"end\", () => {\n this.isStreamEnd = true;\n this.emitter.emit(\"checkEnd\");\n });\n this.emitter.on(\"error\", (err) => {\n this.isError = true;\n this.readable.pause();\n reject(err);\n });\n this.emitter.on(\"checkEnd\", () => {\n if (this.outgoing.length > 0) {\n this.triggerOutgoingHandlers();\n return;\n }\n if (this.isStreamEnd && this.executingOutgoingHandlers === 0) {\n if (this.unresolvedLength > 0 && this.unresolvedLength < this.bufferSize) {\n const buffer = this.shiftBufferFromUnresolvedDataArray();\n this.outgoingHandler(() => buffer.getReadableStream(), buffer.size, this.offset)\n .then(resolve)\n .catch(reject);\n }\n else if (this.unresolvedLength >= this.bufferSize) {\n return;\n }\n else {\n resolve();\n }\n }\n });\n });\n }", "async do() {\n return new Promise((resolve, reject) => {\n this.readable.on(\"data\", (data) => {\n data = typeof data === \"string\" ? Buffer.from(data, this.encoding) : data;\n this.appendUnresolvedData(data);\n if (!this.resolveData()) {\n this.readable.pause();\n }\n });\n this.readable.on(\"error\", (err) => {\n this.emitter.emit(\"error\", err);\n });\n this.readable.on(\"end\", () => {\n this.isStreamEnd = true;\n this.emitter.emit(\"checkEnd\");\n });\n this.emitter.on(\"error\", (err) => {\n this.isError = true;\n this.readable.pause();\n reject(err);\n });\n this.emitter.on(\"checkEnd\", () => {\n if (this.outgoing.length > 0) {\n this.triggerOutgoingHandlers();\n return;\n }\n if (this.isStreamEnd && this.executingOutgoingHandlers === 0) {\n if (this.unresolvedLength > 0 && this.unresolvedLength < this.bufferSize) {\n const buffer = this.shiftBufferFromUnresolvedDataArray();\n this.outgoingHandler(() => buffer.getReadableStream(), buffer.size, this.offset)\n .then(resolve)\n .catch(reject);\n }\n else if (this.unresolvedLength >= this.bufferSize) {\n return;\n }\n else {\n resolve();\n }\n }\n });\n });\n }", "handleMessage(message){\n console.log(COMPONENT +' handleMessage()', message);\n if(message.TYPE === 'OrderItems' ){\n this.handleAddProduct(message.Array);\n }else if(message.TYPE === 'Confirmation'){\n this.disabled = true;\n\n /* Refresh record data. */\n refreshApex(this.getRecordResponse);\n }\n }", "async say(message) {\n // window.APP.hubChannel.sendMessage(message)\n }", "receive() {\n if(this.receiveDataQueue.length !== 0) return Promise.resolve(this.receiveDataQueue.shift());\n\n if(!this.connected) return Promise.reject(this.closeEvent || new Error('Not connected.'));\n\n const receivePromise = new Promise((resolve, reject) => this.receiveCallbacksQueue.push({ resolve, reject }));\n\n return receivePromise;\n }" ]
[ "0.62991405", "0.6008539", "0.58747715", "0.581249", "0.57012355", "0.5655519", "0.5601487", "0.55965835", "0.55960613", "0.5570987", "0.554621", "0.55416393", "0.55300313", "0.54769", "0.54657245", "0.5454042", "0.54484653", "0.53516346", "0.5329301", "0.5327847", "0.5322457", "0.5315284", "0.52806383", "0.52544695", "0.5227921", "0.52278745", "0.5221724", "0.5216168", "0.52104986", "0.51834863", "0.5160238", "0.5133041", "0.5122006", "0.511197", "0.51082116", "0.5107292", "0.50782406", "0.50763917", "0.5066", "0.5065363", "0.5063215", "0.5063215", "0.5054913", "0.5054394", "0.5051193", "0.50492936", "0.5047643", "0.50416094", "0.50330466", "0.50303644", "0.50300604", "0.50293005", "0.50253266", "0.5025275", "0.5023322", "0.5022985", "0.49827445", "0.49814528", "0.49715132", "0.49694774", "0.49693686", "0.4968949", "0.4963408", "0.49427593", "0.4941601", "0.49366266", "0.49321246", "0.49254963", "0.49214816", "0.489132", "0.48862627", "0.4884548", "0.4883641", "0.48828185", "0.48790264", "0.4869687", "0.48689178", "0.48662367", "0.48433435", "0.48311353", "0.48277405", "0.48230204", "0.4821012", "0.4816113", "0.4813716", "0.48098043", "0.48098043", "0.48089272", "0.47976524", "0.47894412", "0.47862032", "0.47805098", "0.4778388", "0.47684988", "0.47668642", "0.47644502", "0.47644502", "0.47605065", "0.47458896", "0.47436216" ]
0.6933967
0
subscribe() returns a promise. write a "provide" command followed by the serialization of the indicated machine. If no such machine, then reject.
subscribe(clientId, machine) { return new Promise( (resolve, reject) => { if (typeof machine !== 'string' || !machine.match(/^[a-z0-9]+$/)) { return reject(`subscribe: bad machine name: ${machine}`); } const rec = this._clientMap.get(clientId); if (! rec) { return reject(`subscribe(${machine}): no such client: ${clientId}`); } else if (rec.machines.includes(machine)) { log(`subscribe(${machine}): already subscribed`); return resolve(); } else if (! this._machineMap.has(machine)) { return reject(`subscribe: no such machine: ${machine}`); } rec.machines.push(machine); log(`sending machine ${machine} to client ${clientId}`); this.sendMachine(machine, rec.wse) .then( resolve ) .catch( errMsg => reject(`failed sending ${machine}: ${errMsg}`) ); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ProductionEngineSubscription(machine) {\n //console.log('created pe subs: ', machine.id);\n\n let pesMachine = machine;\n let peState = null;\n\n this.getPeState = () => peState;\n this.getMachine = () => pesMachine;\n\n this.makeUpdater = function () {\n return function(newState) {\n //console.log('update Pe state for machine', pesMachine.id);\n peState = newState;\n clients.forEach(callback => { callback(peState, pesMachine.id); });\n pesMachine.connected = true;\n }\n }\n}", "function startPeSubscription(m) {\n\n peSubcription = peSubcriptions.find( s => s.getMachine().id === m.id)\n if(!peSubcription) {\n peSubcription = new ProductionEngineSubscription(m)\n peSubcriptions.push(peSubcription);\n }\n\n grpcConnection = grpcConnections.find( c => c.machineId === m.id)\n\n channel = grpcConnection.connection.subscribeProdEngineStatus({ n: -1 });\n channel.on(\"data\", peSubcription.makeUpdater()); \n\n channel.on(\"error\", () => {\n //console.log('Connection lost to ', m.machineId)\n m.connected = false;\n }); \n channel.on(\"end\", () => {\n //console.log('Connection lost to ', m.machineId)\n m.connected = false;\n }); \n\n}", "async add_provider(params) {\n\n var schema = {\n name: { required: 'string', format: 'lowercase' }\n }\n\n if (!(params = this.utils.validator(params, schema))) return false; \n\n var name = params.name;\n\n var provider_uuid = this.encryption.new_uuid();\n\n var data = {\n uuid: provider_uuid,\n name: name,\n whitelist: [],\n exchanges: []\n }\n\n var result = await this.settings.set('signalprovider', provider_uuid, data);\n if (result) {\n this.output.success('add_provider', [name]);\n return provider_uuid;\n }\n return this.output.error('add_provider', [name]);\n\n }", "async publish () {}", "function myCodeService(req, resp){\n var client = new MQTT.Client();\n client.publish(\"analytics\", JSON.stringify(payload))\n .then(function (resolve) {\n resp.success(\"success\");\n }, function (reason) {\n log(reason)\n resp.error('failure');\n });\n\n }", "ping(machine) {\n return new Promise((resolve, reject) => {\n tcpp.probe(machine.ipaddress, machine.sshPort, (err, available) => {\n //console.log(`${machine.destination} - ssh ${available}`);\n if (err) {\n logger.error(err);\n resolve({name:machine.name, sshStatus: false})\n } else {\n resolve({name:machine.name, sshStatus: available})\n }\n });\n }).then((res) => {\n var args = [\"-q\", \"-n\", \"-w 2\", \"-c 1\", machine.ipaddress];\n return new Promise((resolve, reject) => {\n var ps = cp.spawn('/bin/ping', args);\n ps.on('error', (e) => {\n logger.error(e);\n res.pingStatus = false;\n resolve(res);\n });\n ps.on('exit', (code) => {\n res.pingStatus = (code == 0);\n resolve(res);\n });\n });\n })\n }", "handleSubscribe() {\n // Callback invoked whenever a new event message is received\n const messageCallback = (response) => {\n console.log('Segment Membership PE fired: ', JSON.stringify(response));\n // Response contains the payload of the new message received\n this.notifier = JSON.stringify(response);\n this.refresh = true;\n // refresh LWC\n if(response.data.payload.Category__c == 'Segmentation') {\n this.getData();\n }\n \n\n\n };\n\n // Invoke subscribe method of empApi. Pass reference to messageCallback\n subscribe(this.channelName, -1, messageCallback).then(response => {\n // Response contains the subscription information on subscribe call\n console.log('Subscription request sent to: ', JSON.stringify(response.channel));\n this.subscription = response;\n this.toggleSubscribeButton(true);\n });\n }", "checkMachineReady(){\n\t\tvar machineReady = new Promise((resolve, reject) => {\n\t\t setTimeout(() => {\n\t\t\t if (this.apiReady) {\n\t\t\t\tresolve(true);\n\t\t\t }else if (!this.apiReady) {\n\t\t\t\t reject(false)\n\t\t\t }\n\t\t }, 3000);\n\t\t}); \n\t\t\n\t\treturn Promise.resolve(machineReady);\n\t}", "createSubscription(topic, range, duration, selector, deviceId, completion) {\n return this.withDevice(deviceId)(deviceId => {\n let p = new Promise((resolve, reject) => {\n let api = new ScalpsCoreRestApi.SubscriptionApi();\n let callback = function (error, data, response) {\n if (error) {\n reject(\"An error has occured while creating subscription '\" +\n topic +\n \"' :\" +\n error);\n }\n else {\n // Ensure that the json response is sent as pure as possible, sometimes data != response.text. Swagger issue?\n resolve(JSON.parse(response.text));\n }\n };\n let subscription = {\n worldId: this.token.sub,\n topic: topic,\n deviceId: deviceId,\n range: range,\n duration: duration,\n selector: selector || \"\"\n };\n api.createSubscription(deviceId, subscription, callback);\n });\n return p.then((subscription) => {\n this._persistenceManager.add(subscription);\n if (completion)\n completion(subscription);\n return subscription;\n });\n });\n }", "requestSubscription(options) {\n if (!this.sw.isEnabled || this.pushManager === null) {\n return Promise.reject(new Error(ERR_SW_NOT_SUPPORTED));\n }\n const pushOptions = { userVisibleOnly: true };\n let key = this.decodeBase64(options.serverPublicKey.replace(/_/g, '/').replace(/-/g, '+'));\n let applicationServerKey = new Uint8Array(new ArrayBuffer(key.length));\n for (let i = 0; i < key.length; i++) {\n applicationServerKey[i] = key.charCodeAt(i);\n }\n pushOptions.applicationServerKey = applicationServerKey;\n return this.pushManager.pipe(switchMap(pm => pm.subscribe(pushOptions)), take(1))\n .toPromise()\n .then(sub => {\n this.subscriptionChanges.next(sub);\n return sub;\n });\n }", "publish(what, data) {\n\t logging.assertExists(this._frontend).send(`publish${what}`, [data]);\n\t }", "provisionedMachine() {\n const namespace = this.metadata?.annotations?.[CAPI_ANNOTATIONS.CLUSTER_NAMESPACE];\n const name = this.metadata?.annotations?.[CAPI_ANNOTATIONS.MACHINE_NAME];\n\n if ( namespace && name ) {\n return this.$rootGetters['management/byId'](CAPI.MACHINE, `${ namespace }/${ name }`);\n }\n }", "function provisionBroker(){\n let timestamp = (new Date()).getTime();\n let brokerId = `broker${timestamp}`\n let brokerDeploy = JSON.parse(JSON.stringify(deployTemplate));\n brokerDeploy.metadata.name = brokerId;\n brokerDeploy.spec.template.metadata.labels.app = brokerId;\n\n return writeFile(`/tmp/deploy-${brokerId}.json`, JSON.stringify(brokerDeploy), 'utf8').then(() => {\n return exec(`kubectl create -f /tmp/deploy-${brokerId}.json`);\n }).then((res) => {\n if(res.stderr) {\n console.log(res.stderr);\n throw new Error('error occurred provisioning broker');\n }\n console.log(res.stdout);\n return exposeBroker(timestamp);\n }).then(() => {\n return timestamp;\n })\n}", "define(topics, cb) {\n const publisher = this.eventContext.stageContext(topics);\n if (typeof cb === 'function') {\n const ret = cb(publisher, this);\n // keep cb returns something, treat is as a response\n if (ret !== undefined) {\n publisher.pub(ret);\n }\n return this; // to allow cascading style\n }\n if (cb instanceof Promise) {\n cb.then(data => publisher.pub(data))\n .catch(err => publisher.pub(err));\n return this;\n }\n if (cb !== undefined) {\n // assume it is a response\n publisher.pub(cb);\n return this;\n }\n // otherwise, it is sync mode, hence return publisher\n return publisher;\n }", "function readMessage(destinationDeviceName) {\n var publish = true;\n rl.question('enter the cmd to send to ' + destinationDeviceName + ':\\r\\n', function (message) {\n // Calling function to publish to IoT Topic\n switch (message) {\n case 'kill':\n case 'stop':\n message = 'kill';\n console.log('killing node ' + destinationDeviceName + '!');\n break;\n case 'restart':\n case 'reset':\n message = 'restart';\n console.log('restarting the node ' + destinationDeviceName + '!');\n break;\n case 'sleep':\n case 'pause':\n message = 'pause';\n console.log('putting the ' + destinationDeviceName + ' to deep sleep / pausing it');\n break;\n case 'start':\n case 'wake':\n message = 'start';\n console.log('starting / waking up the ' + destinationDeviceName + ' from deep sleep');\n break;\n case 'emergency':\n case 'eme':\n message = 'emergency';\n console.log('updating the duty cycle of ' + destinationDeviceName + ' to send constant updates');\n break;\n case 'normal':\n message = 'normal';\n console.log('updating the duty cycle of ' + destinationDeviceName + ' to work as usual');\n break;\n case 'plugin':\n case 'charge':\n message = 'plugin';\n console.log('hard charging the ' + destinationDeviceName);\n break;\n case 'letdie':\n case 'unplug':\n case 'discharge':\n message = 'unplug';\n console.log('setting ' + destinationDeviceName + ' to not charge and die');\n break;\n default:\n console.log('incorrect cmd please enter again!');\n publish = false;\n break;\n }\n if (publish) {\n publishToIoTTopic(cmdTopic + destinationDeviceName, message);\n }\n readConsoleInput();\n });\n}", "function registerDevice() {\n // Register device\n var registerPromise = provision.register();\n\n registerPromise.then((result) => {\n console.log(`connectionString: ${result}`);\n connectionString = result;\n\n deviceStart();\n\n // save connection string to file \n connectionStringInfo.save(result).then((saveresult) => {\n console.log(`connection string saved.`);\n }, (saveerr) => {\n console.error(`Error: save connection string: ${saveerr}`);\n });\n }, (error) => {\n console.error(`DPS register error: ${error}`);\n });\n}", "createOffer() {\n this.pc.createOffer()\n .then(this.getDescription.bind(this))\n .catch(err => console.log(err));\n return this;\n }", "subscribe() {}", "publish () {}", "onDiscover(data) {\n console.log(\"onDiscover\");\n self.emit('ready', data.metadata);\n }", "function publish(selector) {\n return selector ?\n multicast(function () { return new Subject/* Subject */.xQ(); }, selector) :\n multicast(new Subject/* Subject */.xQ());\n}", "function subscribe(data) {\n\t\t\t\tconsole.log(data);\n\t\t\t\treturn Subscriber.save(data).$promise.then(function(success) {\n\t\t\t\t\tconsole.log(success);\n\t\t\t\t}, function(error) {\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t});\n\t\t\t}", "function Scall() {\n this.available = false;\n this.platform = null;\n this.version = null;\n this.uuid = null;\n this.cordova = null;\n this.model = null;\n this.manufacturer = null;\n this.isVirtual = null;\n this.serial = null;\n\n var me = this;\n console.log(\"scall subscribe\");\n channel.onCordovaReady.subscribe(function() {\n console.log(\"scall ready\");\n\t\t// channel.onCordovaInfoReady.fire();\n channel.initializationComplete('onCordovaScallReady'); \n });\n}", "createOffer () {\n this.pc.createOffer()\n .then(this.getDescription.bind(this))\n .catch(err => console.log(err))\n return this\n }", "constructor(cloud) {\n this.cloud = cloud;\n this.requests = new rxjs_1.Subject();\n // this.cloud = new CloudObject(client);\n this.requests.asObservable().pipe(operators_1.concatMap(([name, type, resolve]) => new rxjs_1.Observable(subs => {\n fetch(\"twits-5-1-17/\" + type + \"s/\" + name + \"/plugin.txt\").then((res) => {\n if (res.status < 400)\n return res.text().then(data => {\n const split = data.indexOf('\\n');\n const meta = JSON.parse(data.slice(0, split)), text = data.slice(split + 2);\n meta.text = text;\n resolve(res);\n subs.complete();\n });\n else {\n resolve(false);\n subs.complete();\n }\n });\n }))).subscribe();\n }", "_subscribe(subscription) {\n return new Promise((resolve, reject) => {\n let watcherInfo = this._getWatcherInfo(subscription);\n\n // create the 'bare' options w/o 'since' or relative_root.\n // Store in watcherInfo for later use if we need to reset\n // things after an 'end' caught here.\n let options = watcherInfo.watchmanWatcher.createOptions();\n watcherInfo.options = options;\n\n // Dup the options object so we can add 'relative_root' and 'since'\n // and leave the original options object alone. We'll do this again\n // later if we need to resubscribe after 'end' and reconnect.\n options = Object.assign({}, options);\n\n if (this._relative_root) {\n options.relative_root = watcherInfo.relativePath;\n }\n\n options.since = watcherInfo.since;\n\n this._client.command(\n ['subscribe', watcherInfo.root, subscription, options],\n (error, resp) => {\n if (error) {\n reject(error);\n } else {\n resolve(resp);\n }\n }\n );\n });\n }", "function subscribe(){\n performance.mark('subscribing');\n client.subscribe('payload/empty', function (err) {});\n performance.mark('subscribed');\n performance.measure('subscribing to subscribed', 'subscribing', 'subscribed');\n}", "produce(energyOut, out){}", "findRegisters() {\n if (this.meterId) {\n this._registerService.getRegisters(this.meterId).subscribe(response => {\n if (response.registers) {\n console.log(response.registers);\n this.registers = response.registers;\n }\n else {\n this.registers = null;\n }\n }, error => {\n console.log(error);\n });\n }\n }", "bus_rx(data) { this.send('bus-rx', data); }", "subscribe(pubName: string, params: Array<any> = []) {\n if (params && !_.isArray(params)) {\n console.warn('Params must be passed as an array to subscribe');\n }\n return new Promise((resolve, reject) => {\n this.getConnection().then((ddpClient) => {\n if (global.__DEV__) console.log('DDP subscribing to ', pubName, 'params: ', params);\n try {\n const id = ddpClient.subscribe(pubName, params, () => {\n if (global.__DEV__) console.log('DDP subscribed! to ', pubName, 'params: ', params);\n });\n this._subs[id] = { pubName, params };\n resolve(id);\n } catch (err) {\n bugsnag.notify(err);\n reject(err);\n }\n });\n });\n }", "acceptOffer(jingle, success, failure) {}", "search(value) {\n this.channel.publish(\"start\");\n const results = this.providers.map(provider => provider.search(value));\n Promise.all(results)\n .catch(err => {\n this.channel.publish(\"error\", err);\n this.channel.publish(\"complete\");\n })\n .then(() => this.channel.publish(\"complete\"));\n results.forEach(result => {\n result\n .catch(reason => {\n this.onError(reason);\n })\n .then(result => {\n if (!result)\n throw \"response expected\";\n this.onSuccess(result);\n });\n });\n }", "async subscribe (room, fn) {\n await this.connecting()\n this.connection.client.send(JSON.stringify({\n action: 'SUBSCRIBE',\n room\n }))\n this.connection.subscriptions.push({ room, fn })\n }", "_registerCustomer(command) {\n this.myProcessDependency();\n\n if (command.customerName === 'MyStrangeCustomerName') {\n throw new Test.InvalidCustomerName(command.customerName);\n }\n\n this.trigger(new Test.CreateCustomer({\n targetId: command.customerId,\n name: command.customerName\n }));\n\n this.record(new Test.RegistrationInitiated({\n sourceId: this.getId(),\n customerId: command.customerId,\n customerName: command.customerName\n }));\n }", "handleMessage(clientId, data) {\n return new Promise( (resolve, reject) => {\n log(`client ${clientId}: |${data}|`);\n if (data.match(/^\\s*subscribe\\s+/)) {\n\tconst m = data.match(/subscribe\\s+(\\w+)/);\n\tif (m) {\n\t let machine = m[1];\n\t this.subscribe(clientId, machine)\n\t .then( () => {\n\t log(`subscribed ${clientId} to machine ${machine}`);\n\t resolve();\n\t })\n\t .catch( errMsg => {\n\t const fullMsg = `error: ${errMsg}`;\n\t log(fullMsg);\n\t this.sendMessage(clientId, fullMsg)\n\t\t.then(resolve)\n\t\t.catch(reject);\n\t });\n\t} else {\n\t const msg = `error: bad subscribe command`;\n\t log(`sending ${msg} to client ${clientId}`);\n\t this.sendMessage(clientId, `${msg}`)\n\t .then(resolve)\n\t .catch(reject);\n\t}\n } else if (data.match(/^command\\s+/)) {\n const m = data.match(/^\\s*command\\s+(\\w+)/);\n const arr = data.split('\\n').filter( e => e.length > 0);\n if (!m) {\n log(`did not match command pattern`);\n return reject(`bad command line: ${arr[0]}`);\n }\n log(`emitting command ${m[1]} ${clientId}: |${arr.slice(1)}|`);\n this.emit('command', m[1], clientId, arr.slice(1));\n return resolve();\n } else {\n\tconst msg = `bad command: |${trunc(data)}|`;\n\tconsole.log(`sending ${msg} to client ${clientId}`);\n\tthis.sendMessage(clientId, msg)\n\t .then(resolve)\n\t .catch(reject);\n }\n });\n }", "subscribe(event, callback) {\n if (this.connection) {\n emitter.on(event, callback);\n return this.connection.subscribe(event, emitter)\n }\n return Promise.reject({code: 'qi-call/no-connection', message: 'Connection object not found.'})\n }", "watch(uuid, callback) {\n this.network.watch`\n ${this.model}.find_by(uuid: ${JSON.stringify(uuid)})\n `(response => {\n response\n .json()\n .then(r => this.information = r)\n .then(() => { if(callback) callback() })\n .catch(e => console.log(e))\n })\n }", "joinSystemMsgRoom() {\n\n // Received direct message from cloud\n io.socket.on( 'sysmsg:' + _deviceUDID, ( data ) => {\n if ( _sysMsgCb ) {\n this.$rootScope.$apply( () => {\n _sysMsgCb( data );\n } );\n } else {\n console.log( 'Dropping sio DEVICE_DM message rx (no cb)' );\n }\n } )\n\n return new Promise( ( resolve, reject ) => {\n\n io.socket.post( '/ogdevice/subSystemMessages', {\n deviceUDID: _deviceUDID\n }, ( resData, jwres ) => {\n this.$log.debug( resData );\n if ( jwres.statusCode !== 200 ) {\n reject( jwres );\n } else {\n this.$log.debug( \"Successfully joined sysmsg room for this device\" );\n resolve();\n }\n } );\n } );\n\n }", "async get_providers(params) {\n\n var providers = await this.settings.get('signalprovider');\n var result = {};\n if (this.utils.is_array(providers)) {\n providers.forEach(provider => {\n result[provider.uuid] = provider;\n })\n } \n if (providers != null && providers != false && this.utils.is_object(providers) && providers.hasOwnProperty('uuid')) {\n result[providers.uuid] = providers;\n }\n return result;\n\n }", "createPublication(topic, range, duration, properties, deviceId, completion) {\n return this.withDevice(deviceId)(deviceId => {\n let p = new Promise((resolve, reject) => {\n let api = new ScalpsCoreRestApi.PublicationApi();\n let callback = function (error, data, response) {\n if (error) {\n reject(\"An error has occured while creating publication '\" +\n topic +\n \"' :\" +\n error);\n }\n else {\n // Ensure that the json response is sent as pure as possible, sometimes data != response.text. Swagger issue?\n resolve(JSON.parse(response.text));\n }\n };\n let publication = {\n worldId: this.token.sub,\n topic: topic,\n deviceId: deviceId,\n range: range,\n duration: duration,\n properties: properties\n };\n api.createPublication(deviceId, publication, callback);\n });\n return p.then((publication) => {\n this._persistenceManager.add(publication);\n if (completion)\n completion(publication);\n return publication;\n });\n });\n }", "registerDeviceEndpoint() {\n this.SNS = new AWS.SNS();\n return this.SNS.createPlatformEndpoint({\n Token: this.deviceId,\n PlatformApplicationArn: this.applicationArn\n }, (err, data) => {\n if (err) {\n console.log('error registering device', err);\n return;\n }\n\n const params = {\n Protocol: 'application',\n TopicArn: this.topicArn,\n Endpoint: data.EndpointArn\n };\n\n this.subscribeToTopic(params);\n });\n }", "discover(thing_name) {\n return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {\n this.connection_manager.acquire()\n .then((connection) => {\n const request = new aws_crt_1.http.HttpRequest('GET', `/greengrass/discover/thing/${thing_name}`, new aws_crt_1.http.HttpHeaders([['host', this.endpoint]]));\n const stream = connection.request(request);\n let response = '';\n const decoder = new util_1.TextDecoder('utf8');\n stream.on('response', (status_code, headers) => {\n if (status_code != 200) {\n reject(new DiscoveryError(`Discovery failed (headers: ${headers})`, status_code));\n }\n });\n stream.on('data', (body_data) => {\n response += decoder.decode(body_data);\n });\n stream.on('end', () => {\n const json = JSON.parse(response);\n const discover_response = model.DiscoverResponse.from_json(json);\n resolve(discover_response);\n });\n stream.on('error', (error) => {\n reject(new DiscoveryError(error.toString()));\n });\n stream.activate();\n })\n .catch((reason) => {\n reject(new aws_crt_1.CrtError(reason));\n });\n }));\n }", "async function pnSubscribed() {\r\n var swReg;\r\n if (pnAvailable()) {\r\n swReg = await navigator.serviceWorker.getRegistration();\r\n }\r\n return (swReg !== undefined);\r\n}", "init_client(pubsub){\n return new Promise((resolve, reject) => {\n pubsub.subscribe('client', (req) => {\n if(req.sender === 'master'){\n console.log(req.message);\n console.log(\"Connected to master successfully\")\n pubsub.unsubscibe('client');\n resolve(\"Connected to master successfully\")\n }\n });\n\n pubsub.publish('client', {\n sender: client + `clientid`,\n type: 'Connect',\n message: `client${clientid} connecting to master`\n });\n })\n }", "loadVehiclesList(){\n PubSub.publish('loadVehiclesList', {});\n }", "subscribeMC() {\n // local boatId must receive the recordId from the message\n if (!this.subscription) {\n this.subscription = subscribe(\n this.messageContext,\n BOATMC,\n (message) => {this.boatId = message.recordId},\n { scope: APPLICATION_SCOPE }\n );\n }\n }", "produce() {}", "function publish(params) {\n // console.log(\"val\", params.value)\n return new Promise((resolve, reject) => {\n var response;\n var key = params.key;\n var hexstring;\n var value = params.value;\n console.log(value)\n let bufStr = Buffer.from(value, 'utf8');\n hexstring = bufStr.toString('hex')\n var streamName = params.stream;\n multichain.publish({\n stream: streamName,\n key: key,\n data: hexstring\n }, (err, res, key) => {\n if (err == null) {\n return resolve({\n response: res,\n key : key,\n message: \"data is stored into Blockchain\"\n });\n } else {\n console.log(err)\n return reject({\n status: 500,\n message: 'Internal Server Error !'\n });\n }\n })\n })\n}", "async subscribe() {\n var subscription = await this.getSubscription();\n if (!subscription) {\n subscription = await this.registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: urlBase64ToUint8Array(this.params.PUBLIC_KEY),\n }).then(subscription => {\n console.log('Subscribed to', subscription.endpoint);\n return subscription;\n });\n return await fetch(this.params.REGISTRATION_URL, {\n method: 'post',\n headers: {'Content-type': 'application/json', Accept: 'application/json'},\n body: JSON.stringify({subscription,}),\n }).then(response => response.json()).then(response => {\n console.log('Subscribed with Notifications server', response);\n return response;\n });\n }\n }", "subscribeToPlatformEvent() {\n // Callback invoked whenever a new event message is received\n const messageCallback = (response) => {\n console.log('LTV message callback ', JSON.stringify(response));\n console.log(new Date(), '------- LTV payload start------');\n console.log(response.data.payload.Category__c);\n this.refresh = true;\n if(response.data.payload.Category__c == 'LTV') {\n console.log(new Date(), '------- before LTV refresh start------' + this.refresh);\n this.getLTVData(this.unifiedId);\n console.log(new Date(), '------- after LTV refresh start------' + this.refresh);\n }\n \n \n console.log(new Date(), '------- LTV payload end ------');\n // Response contains the payload of the new message received\n\n };\n\n // Invoke subscribe method of empApi. Pass reference to messageCallback\n subscribe(this.channelName, -1, messageCallback).then(response => {\n // Response contains the subscription information on subscribe call\n console.log('LTV Subscription request sent to: ', JSON.stringify(response.channel));\n this.subscription = response;\n });\n }", "subscribe () {}", "function retrieveProvider(registry, host, callback) {\n\t // console.log('retrieveProvider:', host);\n\t const api = registry.api;\n\t api.sendQuery(host, '/provider', (status, data) => {\n\t const providerData = data;\n\t let convertedData;\n\t let error = 'error';\n\t switch (status) {\n\t case 'success':\n\t // Validate\n\t if (typeof providerData !== 'object') {\n\t break;\n\t }\n\t // Check if API supports provider\n\t if (typeof providerData.provider !== 'string') {\n\t error = 'unsupported';\n\t break;\n\t }\n\t // Convert data\n\t convertedData = lib.convertProviderData(host, providerData);\n\t if (!convertedData) {\n\t // console.log('Failed to convert data');\n\t break;\n\t }\n\t const provider = providerData.provider;\n\t // Check if provider exists\n\t const list = lib.listProviders();\n\t if (list.indexOf(provider) !== -1) {\n\t error = 'exists';\n\t break;\n\t }\n\t // Add provider\n\t lib.addProvider(provider, convertedData);\n\t callback(host, true, provider);\n\t return;\n\t }\n\t callback(host, false, error);\n\t });\n\t}", "async register(options = {}) {\n if(await this.db.getBacklink()) {\n return;\n }\n\n const slaveHashes = {};\n const timer = this.createRequestTimer(options.timeout);\n const slaves = await this.db.getSlaves(); \n let timeout = timer();\n let provider = this.initialNetworkAddress;\n slaves.forEach(s => slaveHashes[s.address] = true);\n\n if(this.initialNetworkAddress === this.address && !await this.db.getMastersCount()) {\n slaves.length && (provider = slaves[0].address);\n }\n \n let result = await this.requestNode(provider, 'provide-registration', {\n body: {\n target: this.address,\n timeout,\n timestamp: Date.now()\n },\n timeout,\n responseSchema: schema.getProvideRegistrationResponse()\n });\n \n const results = result.results;\n const networkSize = result.networkSize;\n const syncLifetime = result.syncLifetime;\n const coef = await this.getNetworkOptimum(networkSize);\n let freeMasters = [];\n let candidates = [];\n let failed = false;\n let winner;\n\n const checkState = server => {\n if(server.address == this.address) {\n return false;\n }\n\n if(networkSize > 2 && slaveHashes[server.address]) {\n return false;\n }\n\n return true;\n }\n \n for(let i = results.length - 1; i >= 0; i--) {\n const res = results[i]; \n const behavior = await this.db.getBehaviorDelay('registration', res.address);\n \n if(res.networkSize != networkSize) {\n await this.db.addBehaviorDelay('registration', res.address);\n \n if(behavior && behavior.createdAt + syncLifetime > Date.now()) {\n results.splice(i);\n continue;\n }\n else {\n failed = true;\n break;\n }\n }\n else if(behavior) {\n await this.db.removeBehaviorDelay('registration', res.address);\n }\n \n if(!await this.isAddressAllowed(res.address)) {\n results.splice(i, 1);\n continue;\n }\n\n res.appropriate = checkState(res);\n \n for(let k = res.candidates.length - 1; k >= 0; k--) {\n const candidate = res.candidates[k];\n \n if(!await this.isAddressAllowed(candidate.address)) {\n res.candidates.splice(k, 1);\n continue;\n }\n\n if(!checkState(candidate)) {\n res.candidates.splice(k, 1);\n }\n }\n }\n\n if(failed) {\n const msg = `Network hasn't been normalized yet, try later`;\n throw new errors.WorkError(msg, 'ERR_SPREADABLE_NETWORK_NOT_NORMALIZED');\n }\n\n for(let i = 0; i < results.length; i++) {\n const res = results[i];\n const coef = await this.getNetworkOptimum(res.networkSize);\n candidates.push(utils.getRandomElement(res.candidates));\n res.appropriate && res.candidates.length < coef && freeMasters.push(res);\n }\n \n if(freeMasters.length > coef) {\n freeMasters = _.orderBy(freeMasters, ['size', 'address'], ['desc', 'asc']); \n freeMasters = freeMasters.slice(0, coef);\n }\n\n freeMasters = freeMasters.filter(m => m.address != this.address);\n winner = utils.getRandomElement(freeMasters.length? freeMasters: candidates); \n const behavior = await this.getBehavior('registration'); \n \n if(!winner) {\n const msg = 'No available server to register the node';\n throw new errors.WorkError(msg, 'ERR_SPREADABLE_NETWORK_NO_AVAILABLE_MASTER');\n }\n\n try {\n timeout = timer();\n result = await this.requestNode(winner.address, 'register', {\n body: {\n target: this.address,\n timeout,\n timestamp: Date.now()\n },\n responseSchema: schema.getRegisterResponse(),\n timeout\n });\n await behavior.sub(winner.address);\n }\n catch(err) { \n await behavior.add(winner.address);\n throw err;\n }\n \n await this.db.cleanBehaviorDelays('registration'); \n await this.db.setData('registrationTime', Date.now());\n await this.db.addBacklink(winner.address);\n await this.db.addMaster(winner.address, result.size); \n }", "function stub(register, publish) {\n return function() {\n this.register = register;\n this.publish = publish;\n this.start = function() {\n return when.resolve();\n };\n this.stop = function() {\n return when.resolve();\n };\n this.unregister = function() {\n return when.resolve();\n };\n };\n}", "rediscover(metadata) {\n console.log(\"rediscover\");\n var self = this;\n metadata = metadata || {};\n self.socket.emit('discover', metadata);\n }", "subscribeInventory() {\n if (Meteor.isClient) {\n return Meteor.subscribe(inventoryPublications.inventory);\n }\n return null;\n }", "function registerWithCommMgr() {\n commMgrClient.send({\n type: 'register-msg-handler',\n mskey: msKey,\n mstype: 'msg',\n mshelp: [\n { cmd: '/wallet_set_trustline', txt: 'setup EVER trustline' },\n { cmd: '/wallet_save_keys', txt: 'save/export wallet keys' },\n ],\n }, (err) => {\n if(err) u.showErr(err)\n })\n}", "publish(eventName, payload, afterwards) {\n if (!this.ready) {\n return this.queue.push({op: 'publish', eventName, payload, afterwards });\n }\n if (!this.socket.connected) {\n return this.notifyConnectionLoss(afterwards);\n }\n this.socket.emit(eventName, payload);\n if (afterwards) afterwards();\n }", "function subscribe(params) {\n return new Promise((resolve, reject) => {\n var response;\n var streamName = params.stream;\n multichain.subscribe({\n \"stream\": streamName,\n \"rescan\": true\n },\n (err, res) => {\n console.log(res)\n if (err == null) {\n return resolve({\n response: res,\n message: \"Assets/Streams craeted and subscribed\"\n });\n } else {\n console.log(err)\n return reject({\n status: 500,\n message: 'Internal Server Error !'\n });\n }\n }\n )\n\n })\n}", "init() {\n // Create a channel using a particular for notificarions\n this.kafkaMessenger.createChannel(config.kafkaMessenger.dojot.subjects.notification, \"rw\");\n\n // Create a channel using a particular for FTP\n this.kafkaMessenger.createChannel(config.kafkaMessenger.dojot.subjects.ftp, \"rw\");\n\n return auth.getTenants(config.kafkaMessenger.auth.url).then((tenants) => {\n return this.deviceCache.populate(tenants).then(() => {\n //tenancy subject\n logger.debug(\"Registering callbacks for tenancy subject...\");\n this.kafkaMessenger.on(config.kafkaMessenger.dojot.subjects.tenancy,\n config.kafkaMessenger.dojot.events.tenantEvent.NEW_TENANT, (_tenant, newtenant) => {\n node.addTenant(newtenant, this.kafkaMessenger).catch((error) => {\n logger.error(`Failed to add tenant ${newtenant} to node handler (${error}). Bailing out...`);\n process.kill(process.pid, \"SIGTERM\");\n });\n }\n );\n logger.debug(\"... callbacks for tenancy registered.\");\n\n //device-manager subject\n logger.debug(\"Registering callbacks for device-manager device subject...\");\n this.kafkaMessenger.on(config.kafkaMessenger.dojot.subjects.devices,\n \"message\", (tenant, message) => {\n message = hotfixTemplateIdFormat(message);\n let event = {\n source: 'device-manager',\n message: message\n };\n this._enqueueEvent(event).then(() => {\n logger.debug(`Queued event ${event}`);\n }).catch((error) => {\n logger.warn(`Failed to enqueue event ${event}. Error: ${error}`);\n });\n }\n );\n logger.debug(\"... callbacks for device-manager registered.\");\n\n // device-data subject\n logger.debug(\"Registering callbacks for device-data device subject...\");\n this.kafkaMessenger.on(config.kafkaMessenger.dojot.subjects.deviceData,\n \"message\", (tenant, message) => {\n let event = {\n source: \"device\",\n message: message\n };\n this._enqueueEvent(event).then(() => {\n logger.debug(`Queued event ${event}`);\n }).catch((error) => {\n logger.warn(`Failed to enqueue event ${event}. Error: ${error}`);\n });\n }\n );\n logger.debug(\"... callbacks for device-data registered.\");\n\n // Initializes flow nodes by tenant ...\n logger.debug(\"Initializing flow nodes for current tenants ...\");\n for (const tenant of this.kafkaMessenger.tenants) {\n logger.debug(`Initializing nodes for ${tenant} ...`)\n node.addTenant(tenant, this.kafkaMessenger).catch((error) => {\n logger.error(`Failed to add tenant ${tenant} to node handler (${error}). Bailing out...`);\n process.kill(process.pid, \"SIGTERM\");\n });\n logger.debug(`... nodes initialized for ${tenant}.`)\n }\n logger.debug(\"... flow nodes initialized for current tenants.\");\n\n const amqpTaskProducerPromises = [];\n const amqpEventProducerPromises = [];\n const amqpEventConsumerPromises = [];\n // create array of promises to connect to rabbitmq\n for (let i = 0; i < this.taskQueueN; i++) {\n amqpTaskProducerPromises.push(this.amqpTaskProducer[i].connect());\n }\n for (let i = 0; i < this.eventQueueN; i++) {\n amqpEventProducerPromises.push(this.amqpEventProducer[i].connect());\n amqpEventConsumerPromises.push(this.amqpEventConsumer[i].connect());\n }\n\n // Connects to RabbitMQ\n return Promise.all([...amqpTaskProducerPromises,\n ...amqpEventProducerPromises,\n ...amqpEventConsumerPromises]).then(() => {\n logger.debug('Connections established with RabbitMQ!');\n }).catch(errors => {\n logger.error(`Failed to establish connections with RabbitMQ. Error = ${errors}`);\n process.exit(1);\n });\n });\n });\n }", "async publish () {\n if (this._client) {\n const state = await this._client.publish(...arguments)\n return state\n } else {\n throw new Error('Client is empty')\n }\n }", "find(params) {\n return Promise.resolve(\n availableGateway\n );\n }", "_createSerialPort(comName) {\n return new Promise((resolve, reject) => {\n if (comName === null) return;\n\n //----------------------- create OSC serial port -----------------------//\n this.serialPort = new osc.SerialPort({\n devicePath: comName, \n bitrate: 115200,\n });\n\n //------------------------- when port is ready -------------------------//\n this.serialPort.once('ready', () => {\n\n ////////// route and emit messages that are not hello\n this.serialPort.on('message', (message) => {\n\n //--------------------------------------------------------------------\n if (message.address === '/movuino') {\n this.emit('osc', 'serial', { address: message.address, args: message.args});\n //--------------------------------------------------------------------\n } else if (message.address === '/wifi/state' && message.args.length > 0) {\n this.info.wifiState = message.args[0];\n if (this.info.wifiState === 1) {\n // when wifiState becomes 1, we need to check the new ip address\n this._serialRpc('/hello')\n .then((hello) => {\n // this.info.name = hello[1];\n this.info.movuinoip = hello[3];\n return this.attachUDPPort();\n })\n .then(() => {\n this.emit('state', {\n wifiState: this.info.wifiState,\n movuinoip: this.info.movuinoip,\n });\n });\n } else {\n this.emit('state', { wifiState: this.info.wifiState });\n }\n //--------------------------------------------------------------------\n } else if (message.address === '/wifi/set' && message.args.length > 3) {\n this.info.ssid = message.args[0];\n this.info.password = message.args[1];\n this.info.hostip = message.args[2];\n\n this.emit('settings', {\n ssid: this.info.ssid,\n password: this.info.password,\n hostip: this.info.hostip,\n });\n }\n });\n\n ////////// catch osc errors and simply ignore them\n this.serialPort.on('error', (err) => { console.log('osc error : ' + err.message); });\n\n ////////// say hello, set ports and config, get wifi credentials \n this._serialRpc('/hello')\n .then((hello) => {\n console.log(hello);\n if (hello[0] === 'movuino') {\n this.info.name = hello[1];\n this.info.wifiState = hello[2];\n this.info.movuinoip = hello[3];\n this.info.movuinoid = hello[4];\n this.info.firmwareVersion = hello[5];\n return this._serialRpc('/ports/get');\n } \n })\n .then((ports) => {\n const inputPort = config.movuinoOscServer.remotePort;\n const outputPort = config.movuinoOscServer.localPort;\n\n if (ports[0] !== inputPort || ports[1] !== outputPort) {\n return this._serialRpc('/ports/set', [\n { type: 'i', value: inputPort },\n { type: 'i', value: outputPort },\n ]);\n }\n\n return Promise.resolve();\n })\n .then(() => {\n return this._serialRpc('/range/set', [\n { type: 'i', value: config.movuinoSettings.accelRange }, // +/- 16g // * 9.81 / 16\n { type: 'i', value: config.movuinoSettings.gyroRange }, // +/- 2000 deg/sec // * 36 / 200\n ]);\n })\n .then(() => { return this._serialRpc('/serial/enable', [{ type: 'i', value: 1 }]); })\n .then(() => { return this._serialRpc('/magneto/enable', [{ type: 'i', value: 1 }]); })\n .then(() => { return this._serialRpc('/frameperiod/set', [{ type: 'i', value: 10 }]); })\n .then(() => { return this._serialRpc('/wifi/get'); })\n .then((credentials) => {\n ////////// if everything went well, emit all needed information and resolve\n this.info.ssid = credentials[0];\n this.info.password = credentials[1];\n this.info.hostip = credentials[2];\n\n this.info.serialPortReady = true;\n\n this.emit('settings', {\n ssid: this.info.ssid,\n password: this.info.password,\n hostip: this.info.hostip,\n name: this.info.name\n });\n\n this.emit('state', {\n serialPortReady: this.info.serialPortReady,\n wifiState: this.info.wifiState,\n movuinoip: this.info.movuinoip,\n });\n\n resolve();\n });\n });\n\n this.serialPort.open();\n });\n }", "subscribeToGetShadowAccepted(request, qos, messageHandler) {\n return __awaiter(this, void 0, void 0, function* () {\n let topic = \"$aws/things/{thingName}/shadow/get/accepted\";\n topic = topic.replace(\"{thingName}\", request.thingName);\n const on_message = (topic, payload) => {\n let response;\n let error;\n try {\n const payload_text = this.decoder.decode(payload);\n response = JSON.parse(payload_text);\n }\n catch (err) {\n error = new IotShadowError(err.message, payload);\n }\n finally {\n messageHandler(error, response);\n }\n };\n return this.connection.subscribe(topic, qos, on_message);\n });\n }", "function buyEquipment(equipmentID) {\n socket.emit(\"buy\", equipmentID);\n}", "subscribeToGetNamedShadowAccepted(request, qos, messageHandler) {\n return __awaiter(this, void 0, void 0, function* () {\n let topic = \"$aws/things/{thingName}/shadow/name/{shadowName}/get/accepted\";\n topic = topic.replace(\"{thingName}\", request.thingName);\n topic = topic.replace(\"{shadowName}\", request.shadowName);\n const on_message = (topic, payload) => {\n let response;\n let error;\n try {\n const payload_text = this.decoder.decode(payload);\n response = JSON.parse(payload_text);\n }\n catch (err) {\n error = new IotShadowError(err.message, payload);\n }\n finally {\n messageHandler(error, response);\n }\n };\n return this.connection.subscribe(topic, qos, on_message);\n });\n }", "function make_subscription() {\n var status = UNRESOLVED,\n outcome,\n waiting = [],\n dreading = [],\n result;\n\n function vouch(deed, func) {\n switch (status) {\n case UNRESOLVED:\n (deed === FULFILLED ? waiting : dreading).push(func);\n break;\n case deed:\n func(outcome);\n break;\n }\n };\n\n function resolve(deed, value) {\n status = deed;\n outcome = value;\n (deed == FULFILLED ? waiting : dreading).forEach(function (func) {\n func.apply(func, outcome);\n });\n };\n\n result = {\n subscribe: function (func) {\n vouch(FULFILLED, func);\n },\n miss: function (func) {\n vouch(SMASHED, func);\n },\n deliver: function () {\n var args = Array.prototype.slice.call(arguments);\n resolve(FULFILLED, args);\n },\n hold: function () {\n var args = Array.prototype.slice.call(arguments);\n resolve(SMASHED, args);\n },\n status: function () {\n return status;\n }\n };\n\n result.passable = function () {\n return {\n when: function (f) {\n result.when(f);\n return this;\n },\n fail: function (f) {\n result.fail(f);\n return this;\n }\n };\n }\n\n return result;\n}", "function main() {\n findCharacteristics([heartRateServiceUUID],\n [heartRateMeasurementCharacteristicUUID],\n (err, characteristics) => {\n if (err) throw err\n\n const first_characteristic = characteristics[0]\n\n const serialize = process.argv.includes('--json') ? serializeJSON : serializeLineProtocol\n\n first_characteristic.notify(true, err => {\n if (err) {\n console.error('characteristic.notify error', err)\n }\n first_characteristic.on('data', data => {\n const now = new Date()\n const hrv = parseHeartRateData(data)\n const output = serialize(hrv, now)\n console.log(output)\n })\n })\n })\n}", "function subscribable() {\n var args = Array.prototype.slice.call(arguments),\n p,\n original_result,\n result;\n // TODO \"this\" needs to be the same as the original\n // maybe add it as a property?\n live_promise = promisable.apply(promisable, args);\n p = live_promise;\n p.withResult(function (r) {\n original_result = r;\n });\n p.when(s.deliver);\n p.fail(s.hold);\n result = {\n when: function(func) {\n p.when(func);\n return this;\n },\n fail: function(func) {\n p.fail(func);\n return this;\n }\n }\n return (no_conflict ? original_result : result);\n }", "_talk_to_mstream (cmd, data, expect_response = true) {\n return new Promise((resolve, reject) => {\n if (!this._mstream_has_no_data())\n reject(new CMilterError('state', `Residual data in mstream before invoking a command.`))\n\n this.mstream.write(\n {cmd, data, expect_response},\n (err) => {\n dbgclog(`_talk: mstream write() call completed.` + (err ? ` err=${err}` : ''))\n if (err) return reject(err)\n\n if (expect_response) {\n this._read_response((err, data) => {\n if (err) return reject(err)\n resolve(data)\n })\n } else {\n resolve()\n }\n })\n })\n }", "getPickedCard() {\n let observable = new rxjs__WEBPACK_IMPORTED_MODULE_2__[\"Observable\"](observer => {\n this.socket.on('serverSendCardPicked', (cardObject) => {\n if (cardObject) {\n observer.next(cardObject.card_text);\n }\n else {\n observer.next(null);\n }\n });\n return () => {\n this.disconnectSocket();\n };\n });\n return observable;\n }", "function simulateWMProvider() {\n console.log(\"connected to the user's WM provider!\");\n // set the monetization state\n document.monetization.state = 'started';\n document.monetization.dispatchEvent(monetizationstartEvent);\n console.log(\"got the first micro-payment from the client!\");\n \n setInterval(() => {\n document.monetization.dispatchEvent(monetizationprogressEvent);\n console.log(\"received micro-payment!\");\n },2000); \n }", "async waitFor(search) {\n const searchImplementation = typeof search === \"function\" ? search : (value) => value === search;\n return new Promise((resolve, reject) => {\n const subscription = this.updates.subscribe({\n next: (newValue) => {\n if (searchImplementation(newValue)) {\n resolve(newValue);\n // MemoryStream.subscribe() calls next with the last value.\n // Make async to ensure the subscription exists\n setTimeout(() => subscription.unsubscribe(), 0);\n }\n },\n complete: () => {\n subscription.unsubscribe();\n reject(\"Update stream completed without expected value\");\n },\n error: (error) => {\n reject(error);\n },\n });\n });\n }", "function getMachinePoller(params) {\n var pollerKey = params.user + ':' + params.dataCenter + ':' + params.id;\n var poller = pollers[pollerKey];\n\n if (!poller) {\n logger.info('Creating new Machine poller for %j.', pollerKey);\n\n poller = pollers[pollerKey] = {\n key: pollerKey,\n sockets: [],\n hash: null,\n timerId: setInterval(function () {\n client.getMachine(params.user, params.dataCenter, params.id)\n .then(function (machine) {\n var newHash = sigmund(machine);\n\n if (poller.hash === newHash) {\n return;\n }\n\n poller.hash = newHash;\n\n machine = Machine.createMachine(machine);\n machine.loadExtendedData(client.getChild({\n user: params.user,\n dataCenter: params.dataCenter\n }))\n .then(function () {\n logger.debug('Broadcasting Machine update:', machine);\n\n poller.sockets.forEach(function (ws) {\n ws.send(JSON.stringify(machine));\n });\n });\n });\n }, 1000)\n };\n }\n\n return poller;\n}", "async _onMessage (address, heads) {\n await this.stores[address].ready\n super._onMessage(address, heads)\n }", "function publishResults() {\n pb.publish({\n channel: chan,\n message: pollOptions,\n callback: function(m) {\n console.log(\"publishing!\");\n }\n });\n} //publishResults()", "checkOnPremisesSubscription() {\n let serverPromise = this.remoteImsAPI.checkSubscription().$promise;\n this.promise = serverPromise.then(response => this._gotSubscription(response)).catch(response => this._failedSubscription(response));\n return this.promise;\n }", "function checkIfReady (peer) {\n if (peer && peer.isWritable) {\n peer.sendUnsubscriptions(topics)\n } else {\n setImmediate(checkIfReady.bind(peer))\n }\n }", "function checkIfReady (peer) {\n if (peer && peer.isWritable) {\n peer.sendUnsubscriptions(topics)\n } else {\n setImmediate(checkIfReady.bind(peer))\n }\n }", "async function createAVMInAnAvailabilitySet() {\n const credential = new DefaultAzureCredential();\n const client = createComputeManagementClient(credential);\n const subscriptionId = \"\";\n const resourceGroupName = \"myResourceGroup\";\n const vmName = \"myVM\";\n const options = {\n body: {\n location: \"westus\",\n properties: {\n availabilitySet: {\n id: \"/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/availabilitySets/{existing-availability-set-name}\",\n },\n hardwareProfile: { vmSize: \"Standard_D1_v2\" },\n networkProfile: {\n networkInterfaces: [\n {\n id: \"/subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Network/networkInterfaces/{existing-nic-name}\",\n properties: { primary: true },\n },\n ],\n },\n osProfile: {\n adminPassword: \"{your-password}\",\n adminUsername: \"{your-username}\",\n computerName: \"myVM\",\n },\n storageProfile: {\n imageReference: {\n offer: \"WindowsServer\",\n publisher: \"MicrosoftWindowsServer\",\n sku: \"2016-Datacenter\",\n version: \"latest\",\n },\n osDisk: {\n name: \"myVMosdisk\",\n caching: \"ReadWrite\",\n createOption: \"FromImage\",\n managedDisk: { storageAccountType: \"Standard_LRS\" },\n },\n },\n },\n },\n queryParameters: { \"api-version\": \"2022-08-01\" },\n };\n const initialResponse = await client\n .path(\n \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}\",\n subscriptionId,\n resourceGroupName,\n vmName\n )\n .put(options);\n const poller = getLongRunningPoller(client, initialResponse);\n const result = await poller.pollUntilDone();\n console.log(result);\n}", "function connectCallback() {\n\tclient.publish('JackIOT/yo', 'hello world', publishCallback); // publish a message to a topic, JackIOT/yo\n\tclient.subscribe('JackIOT/yo', clientSub); \n}", "function publish_hass_discovery_info() {\n mqtt.publish(\n \"homeassistant/switch/pool_heater/config\",\n '{\"name\": \"Pool Heater\", \"device_class\": \"heat\", \"state_topic\": \"pool/pool_heater/state\", \"command_topic\": \"pool/pool_heater/set\"}')\n// '{\"name\": \"Pool Heater\", \"device_class\": \"heat\", \"~\": \"pool/pool_heater\", \"state_topic\": \"~/state\", \"command_topic\": \"~/set\"}')\n }", "networkQueryOffersCollected() {\n this.socket.emit('networkQueryOffersCollected');\n }", "__broker_published(packet, client) {\n\n // quick fix moche comme MJ\n if (client != undefined) {\n console.log('[HubManager MQTT] ' + client.id + ' published \"' + JSON.stringify(packet.payload) + '\" to ' + packet.topic);\n if (that.pubCallback != null) {\n that.pubCallback(client, packet.topic, packet.payload);\n }\n }\n }", "sendMessage(topic,message,err) {\n\n try {\n this.mqttClient.publish(topic,JSON.stringify(message));\n } catch (err) {\n console.log(err);\n }\n\n }", "publish(newInfo, data) {\n // publish the new/changed data\n // datastore converts this to a 'set' method and parameter eg setAddTask(data)\n this.datastore.setRequest({\n newInfo,\n data\n });\n\n // after publishing, alert all susbscribers to new/changed data.\n // first get all subscribers interested in this newInfo, then foreach of them\n // fire the callback method requested.\n this.subscribers.filter(subscriber => (subscriber.newInfo == newInfo)).forEach((subscriber) => {\n subscriber.callback(this.datastore.getRequest(subscriber));\n });\n }", "register(queryFormat, responseFormat, queryFee, ttl, fee) {\n let data = {\n 'target': targets.ORACLE,\n 'action': actions.REGISTER,\n 'payload': {\n 'type': 'OracleRegisterTxObject',\n 'vsn': 1,\n 'query_format': queryFormat,\n 'response_format': responseFormat,\n 'query_fee': queryFee,\n 'ttl': {'type': 'delta', 'value': ttl},\n 'fee': fee\n }\n }\n\n let promise = new Promise((resolve, reject) => {\n let subscription = new AeSubscription({\n pendingOracleId: undefined,\n matches: (data) => {\n return (data.action === actions.MINED_BLOCK)\n || (data.action === actions.NEW_BLOCK)\n || (data.action === actions.REGISTER && data.origin === origins.ORACLE)\n },\n update: (data) => {\n if ([actions.MINED_BLOCK, actions.NEW_BLOCK].includes(data.action)) {\n if(this.pendingOracleId) {\n this.wsProvider.removeSubscription(subscription)\n this.subscribe(this.pendingOracleId)\n resolve(this.pendingOracleId)\n }\n } else {\n this.pendingOracleId = data.payload['oracle_id']\n }\n }\n })\n this.wsProvider.addSubscription(subscription)\n })\n this.wsProvider.sendJson(data)\n return promise\n }", "async set_provider(uuid, data) {\n return await this.settings.set('signalprovider', uuid, data);\n }", "function publishToChannel(channel, { routingKey, exchangeName, data }) {\n return new Promise((resolve, reject) => {\n channel.publish(exchangeName, routingKey, Buffer.from(JSON.stringify(data), 'utf-8'), { persistent: true }, function (err, ok) {\n if (err) {\n return reject(err);\n }\n console.log(\"[x] push to process\");\n\n\n resolve();\n })\n });\n }", "subscribe(topic, cb) {\n if (this.connected()) {\n this.pubsub.subscribe(topic, cb ? cb : null);\n } else {\n this.queue.push({\n type: 'subscribe',\n topic: topic,\n cb: cb ? cb : null\n });\n }\n }", "async function pincodeServiceable() {\n var self = this;\n var data = self.body;\n var nosql = new Agent();\n if (!data) {\n self.json({\n status: false,\n message: \"Please provide pincode\"\n })\n } else {\n nosql.select('getwarehouse', 'pincodes').make(function (builder) {\n builder.where('pincode', data.pincode);\n builder.first();\n });\n\n var getwarehouse = await nosql.promise('getwarehouse');\n console.log(\"getwarehouse\", getwarehouse);\n if (getwarehouse != null) {\n if (getwarehouse.wid != \"notAllocated\") {\n\n return self.json({ stockStatus: true })\n\n //console.log(\"vstock\", vstock);\n } else {\n return self.json({ stockStatus: false })\n //return { status: false, message: \"Pincode is not available for delivery\" }\n }\n\n } else {\n console.log(\"NO WAREHOUSE FOUND\")\n return self.json({ stockStatus: false })\n //return { status: false, message: \"Pincode is not available for delivery\" }\n }\n }\n}", "async push_subscribe(reg) {\n\t\tif (navigator.onLine) {\n\t\t\tthis.push_subscription = await reg.pushManager.subscribe({\n\t\t\t\tuserVisibleOnly: true,\n\t\t\t\tapplicationServerKey: urlBase64ToUint8Array(this.PUBLIC_VAPID_KEY)\n\t\t\t});\n\t\t\n\t\t\tawait fetch('/api/notifications/subscription', { \n\t\t\t\tmethod: 'POST',\n\t\t\t\tbody: JSON.stringify(this.push_subscription),\n\t\t\t\theaders: { \"Content-Type\": \"application/json\" }\n\t\t\t}).catch(e => { console.error(e); });\n\t\t}\n\t}", "publish({channel, message}){\n\n //so publisher doesnt recieve its own subsriber\n this.subscriber.unsubscribe(channel, () =>{\n\n this.publisher.publish(channel,message, () =>{\n\n this.subscriber.subscribe(channel);\n });\n });\n\n \n\n }", "RegisterEventSource() {\n\n }", "async function createOffer (pc, pid) {\n var offer = await pc.createOffer();\n var plain = JSON.stringify(offer);\n document.getElementById('offerText').value = plain;\n await pc.setLocalDescription(offer);\n document.getElementById('status').value = pc.signalingState;\n console.log('created Offer for ', pid, pc.signalingState);\n var data = {\n direct:true,\n to: pid,\n from: peerId,\n offer: true,\n data: offer\n };\n var msg = JSON.stringify(data);\n ws.send(msg)\n}", "deviceUpdate () {\n this.channel && this.deviceSN && this.channel.publish(`device/${ this.deviceSN }/info`, JSON.stringify({ \n lanIp: Device.networkInterface().address,\n name: Device.deviceName()\n }))\n }", "function call(topic, payload, options) {\n options = options || {};\n payload = payload || null;\n if(options.qos === undefined) options.qos = 1;\n let timeout = options.timeout || 15000;\n let willRespond = new Promise(\n function(resolve, reject) {\n let resp_topic = response_topic();\n let wid = \"wid-\" + Math.random();\n\n let timer = setTimeout(function() {\n unsubscribe(resp_topic, { wid: wid });\n let reason = new Error(\"Timeout waiting for response on \" + topic);\n reject(reason);\n }, timeout);\n\n subscribe(resp_topic, function(msg) {\n clearTimeout(timer);\n unsubscribe(resp_topic, { wid: wid });\n resolve(msg);\n }, { wid: wid });\n\n options.properties = options.properties || {};\n options.properties.response_topic = resp_topic;\n publish(topic, payload, options);\n });\n return willRespond;\n}", "function explore(error, services, characteristics) {\n console.log(\"explore\");\n // list the services and characteristics found:\n console.log('services: ' + services);\n //console.log('characteristics: ' + characteristics);\n\n // check if each characteristic's UUID matches the shutter UUID:\n for (c in characteristics) {\n \n \t// console.log(characteristics[9].uuid);\n \t// console.log('6e400003b5a3f393e0a9e50e24dcca9e');\n\n // if the uuid matches, copy the whole characteristic into timeCharacteristic:\n if (characteristics[c].uuid == '6e400003b5a3f393e0a9e50e24dcca9e'){ //would I change this to TX or RX???\n \tconsole.log(\"uuid matches\");\n characteristics[c].subscribe(); \n console.log(\"subscribed\"); // subscribe to the characteristic\n \n characteristics[c].on('data', readData); // set a listener for it\n }\n }\n}", "function checkoutSubscriptionPipe() {\r\n checkoutSubscription();\r\n}" ]
[ "0.5257558", "0.51723474", "0.4928612", "0.48542452", "0.48314035", "0.48277408", "0.48249453", "0.47648463", "0.47130254", "0.47021812", "0.4699739", "0.46977046", "0.46927583", "0.46921438", "0.46291152", "0.46257806", "0.46217126", "0.45902544", "0.4585775", "0.45815372", "0.45782486", "0.45452338", "0.45427555", "0.45421016", "0.4528943", "0.4528781", "0.45248878", "0.452048", "0.4519789", "0.44978303", "0.449562", "0.448118", "0.4469795", "0.4448096", "0.44447324", "0.4443085", "0.44400823", "0.4438973", "0.44371843", "0.44311723", "0.4428344", "0.44169512", "0.44154298", "0.441407", "0.4412562", "0.440669", "0.43772954", "0.43667814", "0.43666124", "0.43638325", "0.4363127", "0.43613943", "0.43529892", "0.43469092", "0.4345791", "0.43457535", "0.43342173", "0.43317252", "0.4331182", "0.43285882", "0.4328275", "0.43133074", "0.43096226", "0.43040517", "0.42974517", "0.42889327", "0.42884797", "0.42872277", "0.42846546", "0.42845276", "0.42802057", "0.4279992", "0.4274997", "0.4274012", "0.4269777", "0.42676398", "0.42659843", "0.42624602", "0.4258852", "0.4258852", "0.42582452", "0.42554015", "0.42536014", "0.42501163", "0.42494133", "0.4247092", "0.42429382", "0.42427558", "0.42357942", "0.42351902", "0.4234902", "0.42272055", "0.4218528", "0.42155436", "0.4213281", "0.42081028", "0.4207278", "0.42025954", "0.41918027", "0.4188984" ]
0.68615836
0
variable para manejar la reproduccion de sonido de notificacion
function actualizarNotificaciones(){ $.ajax({ url : "ajax/campana-notificaciones.php", method: "POST", success: function(datos){ var cantNoti=datos; if(cont!=cantNoti && cont<cantNoti){ document.getElementById('player').play(); cont = cantNoti; } $('#cantidad_notificaciones').html(datos); if(datos == 0){ $('#cantidad_notificaciones').css('background-color','gray'); }else{ $('#cantidad_notificaciones').css('background-color','red'); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function galerijRechts(){\r\n\tlengthExtensie = getImgPad(\"plaatjeFrame\");\r\n\tif (Number(lengthExtensie[3]) < totaalPlaatjes){\r\n\t\tplaatjeNummer = Number(lengthExtensie[3]) + 1;\r\n\t}\r\n\telse{\r\n\t\tplaatjeNummer = 1;\r\n\t}\r\n\tsetPlaatjeNaam(lengthExtensie, plaatjeNummer, \"plaatjeFrame\");\r\n\treturn\r\n}", "function getInitialNotes() {\n\tlet vector = new Matrix(1,NOTE_RANGE);\n\treturn vector.withFunction(x => Math.floor(2*Math.random()));\n}", "replay(){\n if(!this.pente.active_game && this.pente.winner != null && !this.pente.film){\n this.board.reset();\n this.pente.timeout = 2000;\n \n this.camera = this.views[\"game_view\"];\n this.interface.setActiveCamera(this.camera);\n \n let updateBoard = (board, currentTimeOut) => {\n if(this.pente.film)\n this.board.updateBoard(board);\n\n if(this.pente.timeout == currentTimeOut){\n this.pente.film = false;\n }\n }\n this.pente.replay(updateBoard);\n }\n }", "function resetAll(){theSacredSequence = []; //this is the full sequence to repeat, it changes only at new game;\n\t\t\t\t\t\t\t\t\t thePartialSequence = [];//this is the portion to repeat of the full sequence, it increments during the game it starts of 4 notes then adds one by one\n\t\t\t\t\t\t\t\t\t thePlayerSequence = []; // this is the player sequence , it increments during the game and needs to be equal to thePartialSequence to proceed with the game\n\t\t\t\t\t\t\t\t\t clickCounter = 0;// step-click counter\n\t\t\t\t\t\t\t\t\t stepCounter = 0; // step-click counter\n\t\t\t\t\t\t\t\t\t Limit = 1; // number of notes to play\n\t\t\t\t\t\t\t\t\t Goal = 4; // limit to next level\n\t\t\t\t\t\t\t\t\t Played = \"note\"; // this is the active user played note, it varies continuosly\n\t\t\t\t\t\t\t\t\t runningFunction = \"--\"; // check in webpage for running function\n\t\t\t\t\t\t\t\t\t }", "function burning_crop_residues(){\n a_FAO_i='burning_crop_residues';\n initializing_change();\n change();\n}", "function zerarTransformacao () {\n botaoT = 0; \n botaoS = 0;\n botaoR = 0;\n}", "generateBindPoseData() {\n//-------------------\n// We need to retain TR xforms for both the bind pose and its inverse.\nthis.bindPoseTRX.copyTRX(this.globalTRX);\nthis.invBindPoseTRX.copyTRX(this.globalTRX);\nreturn this.invBindPoseTRX.setInvert();\n}", "function intialisation() {\n console.log(\"Reintialisation\");\n initialiser = 1;\n fin = 0;\n tabPlaying = [0,0,0,0,0]; //Tableau à 0 quand le son est stoppé\n enCours = false; //Si les numéros sont entrain de tourner\n selectMatricule; //Matricule sélectionné\n pointsFixes = []; //Tableau comportant les coordonées des pastilles\n seuil = 1; //Seuil pour la fusion de détections trop proches\n suppresion = 0; //Variable pour compter le nombre de détections fusionées\n nbMatricule = 14; //Nombre de matricule\n numPrecedent = 10; //Retient le dernier nombre d'occurence\n //Scanne les tâches pour initialiser\n initialiserPointsFixes();\n if(debutCache) {\n debutCache = 0;\n setTimeout(function() {\n startNumber();\n cacheGomettes();\n }, 3000);\n }\n}", "function verRepeticion(cadena) {\n cargarCadenaMovimientos(cadena);\n // Muestro el primer movimiento de la partida\n crearEventosMovRepeticion();\n cargarTablero(1);\n estilosMovActualRep(0);\n}", "async _setSequenceNo(wrappedMessage) {\n logger.debug(`MessageSender._setSequenceNo(): ${this.sequenceNoData[\"sequence-no\"]}`)\n wrappedMessage[\"_id\"] = `${this.config[\"originator\"]}-${this.sequenceNoData[\"sequence-no\"]}`\n wrappedMessage[\"sequence-no\"] = this.sequenceNoData[\"sequence-no\"]\n logger.debug(`MessageSender._setSequenceNo(): _id=${wrappedMessage._id} seq-no=${wrappedMessage[\"sequence-no\"]}`)\n return await this._incrementSequenceNo()\n }", "function resetSpecialReplay() {\r\n\tfor (i = 0; i < specialGuest.length; i++) {\r\n\t\tspecialGuest[i] = 0;\r\n\t}\r\n\tspecialPre = specialGuest.slice();\r\n}", "function reproduccionActual(texto){\n\tdocument.getElementById('currentPlay').innerText=texto\n}", "function storePreviuosCoordinates(currentWorm)\r\n{\r\n\tfor(var i = histotyDotsSaved; i > 0; i--)\r\n\t{\r\n\t\tcurrentWorm.previousX[i] = currentWorm.previousX[i-1];\r\n\t\tcurrentWorm.previousY[i] = currentWorm.previousY[i-1];\r\n\t}\r\n\tcurrentWorm.previousX[0] = currentWorm.x;\r\n\tcurrentWorm.previousY[0] = currentWorm.y;\r\n\t\r\n}", "function reproduccionActual(texto){\r\n\tdocument.getElementById('currentPlay').innerText=texto\r\n}", "function limpiarCapturaNuevaRuta(){\n contadorPuntos = 0;\n contadorHoras = 1;\n storePuntosRuta.removeAll();\n puntosLineaRuta.splice(0,puntosLineaRuta.length);\n}", "resetVars() {\r\n this._current = undefined;\r\n this._nextRevisionNr = exports.INITIAL_REVISION_NEXT_NR;\r\n }", "function amelioration(){\n return nbMultiplicateurAmelioAutoclick +9;\n}", "function mostraNotas(){}", "function prendre_photo(mymavlink){\n\treturn \"coucou\";\n}", "function crops_processed(){\n a_FAO_i='crops_processed';\n initializing_change();\n change();\n}", "function recordStep3( gifoId ){ \n\n if(gifoId){\n // armo la url del gifo nuevo\n let gifoURL = `${GIPHY_DIRECT_URL}${gifoId}/giphy.gif`;\n // se hara el almacenamiento en local storage del nuevo gifo\n let myGif;\n myLocalStorage = window.localStorage;\n creations = JSON.parse(myLocalStorage.getItem(\"myOwnGifos\"));\n if(creations === null){\n creations = [];\n myGif = new Gif( gifoId, gifoURL, \"my-gifo-1\", \"own gifo\");\n }\n else{\n let id = creations.length + 1;\n myGif = new Gif( gifoId, gifoURL, `my-gifo-${id}`, \"own gifo\" ); \n }\n creations.push(myGif)\n myLocalStorage.setItem(\"myOwnGifos\", JSON.stringify(creations));\n\n let finalOptions = document.getElementById(\"final-options\");\n finalOptions.style.display = \"block\"; \n }\n // finalizo la utilizacion de la camara\n stream.getTracks().forEach(track => track.stop());\n}", "function augmenterMultiplicateur (){\n multiplicateur = multiplicateur + 1;\n }", "function resetLastNotified() {\n lastNotified = new Date();\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}", "function getsequence(mpr,rpr){\r\n\tvar sq = (rhythmpresets[rpr])();\r\n\tfor(var i=0; i<sq.length; i++){ sq[i][2] = getrandomnote(mpr); }\r\n\treturn sq;\r\n}", "function resetClipboardNote() {\n if ($clip_note) {\n $clip_note.text('');\n toggleHidden($clip_note, true);\n }\n }", "repetitionCoordinates(numberOfRepetitions) {\n const basis = new Made.Basis({\n ...this.basis.toJSON(),\n elements: [\"Si\"],\n coordinates: [[0, 0, 0]],\n });\n // avoid repeating in z direction if boundaries are enabled.\n const repetitions = [\n numberOfRepetitions,\n numberOfRepetitions,\n this.areNonPeriodicBoundariesPresent ? 1 : numberOfRepetitions,\n ];\n return Made.tools.basis.repeat(basis, repetitions).coordinates.map((c) => c.value);\n }", "function GetReprompt() {\r\n //console.log(\"in GetReprompt\");\r\n var rand = repromts[Math.floor(Math.random() * repromts.length)];\r\n return rand;\r\n}", "function karinaFaarNotifikation() {\n\n\n\n}", "function restore_default_descrip ( ) {\n\tget_orig_prob_descrip( problem_id_selected );\n}", "function reconstructNotification(data) {\n\t\t\t//console.log(\"reconstructNotification\");\n\t\t\t//console.log(\"data.jobGuid:\" + data.jobGuid);\n\t\t\t//console.log(\"data.destinationMetaData:\" + JSON.stringify(data.destinationMetaData));\n\t\t\t//console.log(\"data.payload:\" + data.payload);\n\t\t\tvar retval = new Notification(data.jobGuid, data.destinationMetaData, data.payload);\n\t\t\tretval.originatingMetaData = data.originatingMetaData;\n\t\t\t//console.log(\"reconstructNotification will return :\" + JSON.stringify(retval));\n\t\t\treturn retval;\t\t\t\n\t\t}", "function resetSpecial(){\n if (specialReboot < 3){\n specialReboot++;}\n if (specialReboot===3){\n if(classeChoisie === \"mage\"){\n personnage.esquive=Number(65);\n document.getElementById(\"esquivePerso\").innerHTML=personnage.esquive;\n }\n }\n}", "function Basic_SetBackImage_GetRepeat(repeat)\n{\n\t//switch on the repeat\n\tswitch (repeat)\n\t{\n\t\tcase \"N\":\n\t\tcase \"No\":\n\t\t\trepeat = \"no-repeat\";\n\t\t\tbreak;\n\t\tcase \"R\":\n\t\tdefault:\n\t\t\trepeat = \"repeat\";\n\t\t\tbreak;\n\t\tcase \"X\":\n\t\t\trepeat = \"repeat-x\";\n\t\t\tbreak;\n\t\tcase \"Y\":\n\t\t\trepeat = \"repeat-y\";\n\t\t\tbreak;\n\t}\n\t//return it\n\treturn repeat;\n}", "prevImg(){\r\n (this.contatore == 0 ) ? this.contatore = this.immagini.length - 1 : this.contatore--;\r\n console.log(this.contatore);\r\n }", "function NotaFinal() {\r\n\r\n pregunta1();\r\n pregunta3();\r\n cor =\r\n parseFloat(tpre1) +\r\n parseFloat(tpre3);\r\n Calculo_nota();\r\n}", "function resetGifValues(){\n event.preventDefault();\n l=10;\n console.log(l);\n // displayGif();\n}", "replay(){\n\n }", "getDefaultPose() {\nreturn CASFrame.create(0, 40, this.defaultPose, null);\n}", "function replaceNotes(master) {\n const timer = Math.random() * 15000;\n setTimeout(async () => {\n const { length } = replaceableNotes;\n if (length) {\n try {\n const oldNote = replaceableNotes.pop();\n const newNote = new Note(oldNote.note.emissor, oldNote.note.taxNumber);\n newNote.replaceOldNote(oldNote.txid);\n const address = oldNote.note.emissor;\n const txid = master.node.issueMoreFrom([\n address,\n oldNote.name,\n 0,\n 0,\n note.note.json,\n ]);\n newNote.registerTxId(txid);\n newNote.registerName(oldNote.name);\n console.log(`Nota substituída | TxId: ${txid} | taxNumber: ${oldNote.note.taxNumber} | Address: ${address}`);\n if (Math.random() > 0.9) replaceNotes.push(newNote);\n } catch (e) {\n console.log('Error | Registrar nota fiscal substituta');\n }\n }\n replaceNotes();\n }, timer);\n}", "function desclickear(e){\n movible = false;\n figura = null;\n}", "function prevSnip() {\n if (mixSplits != null && mixSplits != undefined) {\n splitPointer--;\n if ((splitPointer < mixSplits.length) && (splitPointer >= 0)) {\n preview(mixSplits[splitPointer], mixSplits[splitPointer] + snipWin, function () {\n });\n } else {\n splitPointer++;\n }\n }\n}", "replicate() {\n this.copyCount++\n console.log(`\n New copy of ${this.original} produced succesfully.\n Current count: ${this.copyCount}\n `)\n }", "function guardarReproduccion_old ( reproduccion ){\n return $q.when( reproduccion )\n //.then( buscarLibroEnBiblioteca ) //Si ya existe el registro, no guardar nada.\n .then( generarIdReproduccion ) //Generar el id que se usara para el registro en la DB\n .then( prepararRegistroReproduccion ) //crear el objeto (registro) cuyas propiedades son los campos\n .then( persistirReproduccionEnDB ) //metodo que invoca al servicio de base de datos para INSERT/UPDATE/DELETE\n .then(\n\n function guardarDatosExito( id ) {\n return $q.resolve( id );\n }\n\n ).catch(\n\n function Error(error) {\n console.log('guardarDatos()->error: ' + error)\n }\n\n )\n\n }", "getEmptyPose() {\nreturn CASFrame.create(0, 40, [], null);\n}", "function initNote(rankTweak){\n var note = new cosmo.model.Note();\n note.setRank(note.getRank() - rankTweak);\n return note;\n}", "function atras() {\n num --;\n if (num<1){\n num=4;\n }\n setTimeout(ocultarImg_izda, 500);\n}", "repeatReverse() {\r\n repeatTimes += 1\r\n reverse = true\r\n }", "__crearDummy(annoMesDia, idLocal, auditor){\n return {\n idDummy: this.idDummy++, // asignar e incrementar\n aud_idAuditoria: null,\n aud_fechaProgramada: annoMesDia,\n aud_fechaProgramadaFbreve: '',\n aud_fechaProgramadaDOW: '',\n aud_idAuditor: auditor,\n local_idLocal: idLocal,\n local_ceco: '-',\n local_direccion: '',\n local_comuna: '',\n local_region: '',\n local_nombre: '-',\n local_stock: '',\n local_horaApertura: '',\n local_horaCierre: '',\n local_fechaStock: '',\n cliente_nombreCorto: ''\n }\n }", "function reply_click(a1) {\n //a1 = Number(a1);\n if (type == 1 && flag1 == 1) {\n if (prev == -1) {\n prev = a1;\n p1 = Math.floor((a1 - 1) / 12);\n p2 = Math.floor((a1 - 1) / 12);\n } else {\n document.getElementById(prev).style.backgroundColor = \"#282828\";\n prev = a1;\n p1 = Math.floor((a1 - 1) / 12);\n p2 = Math.floor((a1 - 1) / 12);\n }\n document.getElementById(a1).style.backgroundColor = \"#76C470\";\n source = { first: Math.floor((a1 - 1) / 12), second: (a1 - 1) % 12 };\n } else if (type == 2 && flag2 == 1) {\n if (prev == -1) {\n prev = a1;\n p1 = Math.floor((a1 - 1) / 12);\n p2 = Math.floor((a1 - 1) / 12);\n } else {\n document.getElementById(prev).style.backgroundColor = \"#282828\";\n prev = a1;\n p1 = Math.floor((a1 - 1) / 12);\n p2 = Math.floor((a1 - 1) / 12);\n }\n document.getElementById(a1).style.backgroundColor = \"#F25050\";\n dest = { first: Math.floor((a1 - 1) / 12), second: (a1 - 1) % 12 };\n\n count = 0;\n } else if (type == 4) {\n document.getElementById(a1).style.backgroundColor = \"#c4f6ff\";\n console.log(a1, Math.floor((a1 - 1) / 12), (a1 - 1) % 12);\n grid[Math.floor((a1 - 1) / 12)][(a1 - 1) % 12] = 0;\n } else if (type == 3 && flag3 == 1) {\n if (prev == -1) {\n prev = a1;\n p1 = Math.floor((a1 - 1) / 12);\n p2 = Math.floor((a1 - 1) / 12);\n } else {\n document.getElementById(prev).style.backgroundColor = \"#282828\";\n prev = a1;\n p1 = Math.floor((a1 - 1) / 12);\n p2 = Math.floor((a1 - 1) / 12);\n }\n document.getElementById(a1).style.backgroundColor = \"#F25050\";\n dest1 = { first: Math.floor((a1 - 1) / 12), second: (a1 - 1) % 12 };\n count = 1;\n } else {\n }\n}", "function Awake() {\n\tnoteNumber = noteNumberFirst + noteNumberNext;\n}", "function reset(){\n cuenta = 1;\n numero1 = 0;\n numero2 = 0;\n numeroFinal = 0;\n limpiar();\n}", "function duplicarTreinta(){\n return 30*2;\n}", "function modifyRunningOrder(ro)\n{\n for (var i = 0; i < ro.length; ++i)\n {\n if (i % 24 == 1\n && i > 23\n && i < 250)\n {\n ro[i].push(new DynamicElement(\n \"Message\",\n {html: \"<p>Vă rugăm să luaţi o mică pauză. Apăsaţi orice tastă când sunteţi gata să începeţi din nou.</p>\", transfer: \"keypress\"},\n true));\n ro[i].push(new DynamicElement(\n \"Separator\",\n {transfer: 4000, normalMessage: \"Atenţie! Primul fragment de propoziţie din acest set va apărea pe ecran în curând.\"},\n true));\n }\n }\n return ro;\n}", "function modifyRunningOrder(ro)\n{\n for (var i = 0; i < ro.length; ++i)\n {\n if (i % 24 == 1\n && i > 23\n && i < 250)\n {\n ro[i].push(new DynamicElement(\n \"Message\",\n {html: \"<p>Vă rugăm să luaţi o mică pauză. Apăsaţi orice tastă când sunteţi gata să începeţi din nou.</p>\", transfer: \"keypress\"},\n true));\n ro[i].push(new DynamicElement(\n \"Separator\",\n {transfer: 4000, normalMessage: \"Atenţie! Primul fragment de propoziţie din acest set va apărea pe ecran în curând.\"},\n true));\n }\n }\n return ro;\n}", "function arretNumber() {\n if (this.enCours) {\n this.sonMatricule.stop();\n this.sonAmbiance.fade(0.8 , 1) //Volume son ambiance\n this.sonAmbiance.loop();\n numPrecedent = 10;\n this.enCours = false;\n clearInterval(this.changeNumber);\n // On se bloque sur un matricule connu\n selectMatricule = (this.recupererMatriculeAlea()).toString();\n ordre = (tabMatricule.indexOf(selectMatricule))+1;\n afficherMatricule(selectMatricule);\n }\n}", "function palestra_de_literatura_caminho(N_evento)\n{\n var caminho = '';\n\n switch (N_evento) {\n \n case 1:\n caminho = \"Imagens/Palestra_Literatura_1.jpg\";\n break;\n\n case 2:\n caminho = \"Imagens/Palestra_Literatura_2.jpg\";\n break; \n \n }\n\n return(caminho);\n}", "function generateNumCommande() {\n var random = Math.floor(100000000 + Math.random() * 900000000);\n num_commande = 'NH'+random\n }", "function revisar(x){\r\n\tif(document.getElementById(\"pregunta\").innerHTML==\"¿Cual sera el siguiente continente a conquistar?\")\r\n\t{\r\n\t\tcontinente = x;\r\n\t\tasignar();\r\n\t}\r\n\telse{\r\n\t\tif(respuesta == x+1){\r\n\t\t\t//banderas para reconocer si el usuario ya conquisto algun continente.\r\n\t\t\tbanderas[continente] = true;\r\n\t\t\t//coloca una bandera en el continente\r\n\t\t\taux = canvas.getContext(\"2d\");\r\n\t\t\t//dibuja la bandera en (dibujo, x,y, ancho, alto)\r\n\t\t\taux.drawImage(flagD,posCont[continente][0],posCont[continente][1],40,40);\r\n\t\t}else{\r\n\t\t\tvidas--;\r\n\t\t}\t\r\n\t\treset();\r\n\t}\r\n}", "function stampa(cosa_voglio_stampare) {\r\n console.log(cosa_voglio_stampare);\r\n}", "function stampa(cosa_voglio_stampare) {\r\n console.log(cosa_voglio_stampare);\r\n}", "function setPlaatjeNaam(lengthExtensie, plaatjeNummer, plaatjeFrame){\r\n\tplaatjeNaamLengte = lengthExtensie[1] - lengthExtensie[4];\r\n\tplaatjeNaam = document.getElementById(plaatjeFrame).src.toString().substr(0,plaatjeNaamLengte);\r\n\tdocument.getElementById(plaatjeFrame).src = plaatjeNaam + plaatjeNummer + \".jpg\";\r\n}", "function newMsgId() {\n let Id = 'MS' + Date.now()\n return Id\n}", "presupuestoRestante(cantidad = 0){\n return this.restante -= Number(cantidad);\n }", "function getrandomnote(mpreset){\r\n\tif(melodypresets[mpreset]){\r\n\t\tvar acc=0; for(var i=0;i<melodypresets[mpreset].length;i++){ acc += melodypresets[mpreset][i][0]; }\r\n\t\tvar rn = Math.random()*acc; acc = 0;\r\n\t\tfor(var i=0;i<melodypresets[mpreset].length;i++){ \r\n\t\t\tacc += melodypresets[mpreset][i][0];\r\n\t\t\tif(acc>rn){ return melodypresets[mpreset][i][1]; }\r\n\t\t}\r\n\t\treturn melodypresets[mpreset][0][1];\r\n\t}else{ return 0; }\r\n}", "recibirDisparo(potencia) {\n this.escudo = this.escudo - potencia;\n return this.escudo;\n }", "getNuevaRecompensa() {\r\n\t\t// le asigna la textura correspondiente\r\n\t\tvar recompensa = new THREE.Mesh(\r\n\t\t\tnew THREE.BoxBufferGeometry(2,2,2),\r\n\t\t\tnew THREE.MeshPhongMaterial({\r\n\t\t\t\topacity: 0.5,\r\n\t\t\t\ttransparent: true,\r\n\t\t\t\tmap: this.texturaRecompensa\r\n\t\t\t})\r\n\t\t);\r\n\r\n\t\t// Generar tipo de recompensa aleatoriamente\r\n\t\trecompensa.tipo = Math.floor( Math.random() * TipoRecompensa.NUM_TIPOS );\r\n\r\n\t\treturn recompensa;\r\n\t}", "function reestablece(){\n colector = \"0\";\n operacion = \"\";\n operador0 = 0;\n operador1 = 0;\n resultado = 0;\n iteracion = 0;\n }", "function nuevoFin(){\n let previo = fin;\n fin = mapa[inputFinalX.value()][inputFinalY.value()];\n fin.obstaculo = false;\n fin.corrienteFuerte = false;\n fin.corriente = false;\n fin.pintar(0);\n previo.pintar(255);\n}", "function setNotes() {\n var base = 260;\n var board_height = Rooms.findOne().board.height;\n var board_width = Rooms.findOne().board.width;\n var notes = getScaleNotes(SCALE_VALUES.MAJOR, base, board_height);\n for(x = 0; x < board_width; x++) {\n for(y = 0; y < board_height; y++) {\n boardData[x][y].frequency = notes[board_height-x-1];\n boardData[x][y].title = notes[board_height-x-1];\n }\n }\n}", "function generateSeq() {\r\n\r\n}", "getRegistroLimpo() {\n return {\n cod_forma_pagamento_comanda: '',\n nome_forma_pagamento_comanda: '',\n status_cheque: '',\n status_troco: '',\n status_fatura: '',\n qtde_dias: '',\n cod_operadora_cartao: '',\n status_cartao: '',\n nfce_tpag: '',\n status_ativo: '',\n status_garcom_automatico: '',\n seq: '', \n };\n }", "function tacoTimeOver() {\n for (var i = 0; i < startingImages.length; i++) {\n var key = Object.keys(startingImages[i])[0];\n window[key] = startingImages[i][key];\n }\n tacoTimeActivated = false;\n}", "presupuestoRestante(cantidad) {\n const valorRestante = cantidadPresupuesto.presupuestoRestante(cantidad);\n restanteSpan.innerHTML = `${valorRestante}`;\n this.comprobarPresupuesto();\n }", "function NoRepetition (desc) {\n }", "function nuevoInicio(){\n let previo = inicio;\n inicio = mapa[inputInicioX.value()][inputInicioY.value()];\n inicio.obstaculo = false;\n inicio.corrienteFuerte = false;\n inicio.corriente = false;\n inicio.pintar(0);\n previo.pintar(255);\n}", "function clube_Pinheiros_caminho(N_evento)\n{\n var caminho = '';\n\n switch (N_evento) {\n \n case 1:\n caminho = \"Imagens/Clube_Pinheiros_1.jpg\";\n break;\n\n case 2:\n caminho = \"Imagens/Clube_Pinheiros_2.jpg\";\n break; \n \n case 3:\n caminho = \"Imagens/Clube_Pinheiros_3.jpg\";\n break; \n \n }\n\n return(caminho);\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 }", "nota(tipo) {\n let valObj = {\n estado: 'P'\n },\n whereObj = {\n id_ticket: this.$stateParams.id\n };\n this.$bi.ticket().update(valObj, whereObj);\n //Async same time\n let hoy = this.moment().format('YYYY[-]MM[-]D'),\n ahora = this.moment().format('h:mm:ss'),\n nombreUsuario = `${this.$cookieStore.get('user').apellido} ${this.$cookieStore.get('user').nombre}`,\n arrVal = [\n hoy,\n ahora,\n this.model.texto,\n tipo,\n nombreUsuario,\n this.$stateParams.id\n ];\n\n if (this.model.images) {\n return this.$bi.documentacion().insert(arrVal).then(response => {\n this.$imagenix.save(this.model.images, response.data[0].id_documentacion)\n });\n } else {\n return this.$bi.documentacion().insert(arrVal);\n }\n }", "resetTime(){\r\n this.pInput = new Array();\r\n this.pHidden = new Array();\r\n this.pOutput = new Array();\r\n this.pc = new Array();\r\n this.pf = new Array();\r\n this.pi = new Array();\r\n this.pg = new Array();\r\n this.po = new Array();\r\n //Fill pHidden with 0's.\r\n let temp = new Matrix(this.netconfig[1]);\r\n temp.fill(0);\r\n this.pHidden.push(temp);\r\n this.pc.push(temp);\r\n this.c = new Matrix(this.netconfig[1]);\r\n this.c.fill(0);\r\n }", "function setIndiceAndPlayRecientes(indice,a_pagina_cancion,recientes){\n sessionStorage.setItem(\"indiceLista\",indice);\n var listaAux;\n //Si actual es distinta a Aux se establece Aux\n if(recientes==1){\n listaAux = sessionStorage.getItem(\"listaRecientes\");\n }\n else{\n listaAux = sessionStorage.getItem(\"listaRecomendadas\");\n }\n var listaActual = sessionStorage.getItem(\"listaActual\");\n if(listaActual != listaAux){\n sessionStorage.setItem(\"listaActual\",listaAux);\n }\n reproducirCancion(a_pagina_cancion);\n}", "function updateRotorWindows(){\n\tlet x = enigmaMachine.readRotorWindow(\"all\");\n\tvar i; \n\tfor(i=1;i<=3;i++){\n\t\tdocument.getElementById(\"window_\"+i).innerHTML=String.fromCharCode(x[i-1]+65);\n\t}\n}", "function newButValue() {\n picOne = Math.floor(Math.random() * 12) + 1;\n picTwo = Math.floor(Math.random() * 12) + 1;\n picThree = Math.floor(Math.random() * 12) + 1;\n picFour = Math.floor(Math.random() * 12) + 1;\n}", "function reply_click(a){\n a=Number(a);\n var q=((a-1)/n);\n var rem=((a-1)%n);\n q.toFixed(0);\n rem.toFixed(0);\n q=parseInt(q);\n rem=parseInt(rem);\n \n if (v==0 && flag1==1){\n if (prev==-1){\n prev=a;\n p1=q;\n p2=rem;\n}\nelse{\n document.getElementById(prev).style.backgroundColor=\"#282828\";\n prev=a;\n p1=q;\n p2=rem;\n}\n document.getElementById(a).style.backgroundColor =\"#76C470\"; //source\n s1=q;\n s2=rem;\n \n \n }\n else if (v==1 && flag2==1){\nif (prev==-1){\n prev=a;\n p1=q;\n p2=rem;\n}\nelse{\n document.getElementById(prev).style.backgroundColor=\"#282828\";\n mat[p1][p2]=0;\n prev=a;\n p1=q;\n p2=rem;\n}\n \n document.getElementById(a).style.backgroundColor = \"#F25050\"; //dest\n d1=q;\n d2=rem;\n mat[d1][d2]=2;// 2 for destination\n \n \n }\n else if(v>=2){\n document.getElementById(a).style.backgroundColor = \"#c4f6ff\"; //blocks\n mat[q][rem]=-1;//-1 for obstacle\n v++;\n }\n \n }", "function previousA() {\n if (i==0) {\n i = numberOfpictures * 2 - 4;\n }\n else if (i==1||i==2) {\n i = numberOfpictures*2-2;\n }\n else if (i%2==0) {\n i = i - 4;\n }\n else {\n i = i - 3;\n }\n sendinformation();\n}", "projectTimeline(number){\n\n }", "static createRetransmissionInfo(messageId) {\n return {\n timeout: CoapClient.getRetransmissionInterval(),\n action: () => CoapClient.retransmit(messageId),\n jsTimeout: null,\n counter: 0,\n };\n }", "__init6() {this._lastActivity = new Date().getTime();}", "function rotor_transcribe(){\n\tfor(element in input.transcribed){\n\t\tinput.rotortranscribed = rotor.master[input.transcribed[element]];\n\t}\n\trotor.dial1 += 1;\n \tif (rotor.dial1 == 26) {\n rotor.dial1 = 0;\n \trotor.dial2 += 1;\n\t}\n if (rotor.dial2 == 26) {\n rotor.dial2 = 0;\n \trotor.dial3 += 1;\n\t}\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 reset() {\n\t$win = true;\n\t$last = 'hi';\n\t$i = 0;\n\tcurrent_val = reset_current_val;\n\t$seq = 0;\n\t$t_win = 0;\n\t$t_los = 0;\n\t$seq_count = 0;\n\tif($interval != null)\n\tclearInterval($interval);\n}", "Nr(){\n return this.Lj*12/6+1\n }", "function nextReminderId() {\n\treturn ++reminderSeq;\n}", "function createOnlineQuestionnaire() {\r\n //let robotNames = Object.keys(imgInfo);\r\n let i = Math.floor(Math.random() * imgInfo.length);\r\n changeRobot(imgInfo[i]);\r\n changeScalesOrder();\r\n }", "function restart() {\r\n alias = aliases[Math.floor(Math.random() * 40)];\r\n theme = Math.floor(Math.random() * 7);\r\n neutralColor = neutralColors[theme];\r\n correctColor = correctColors[theme];\r\n wrongImage = wrongImages[theme];\r\n backgroundImage = backgroundImages[theme];\r\n record = \"\";\r\n timeRanOut = false;\r\n currentNumber = 1;\r\n misses = 0;\r\n tempStreak = 0;\r\n errorStreak = 0;\r\n streak = 0;\r\n counter = 0;\r\n hasWon = false;\r\n var emptyList = [];\r\n numbers = emptyList;\r\n generateNumbers();\r\n go();\r\n}", "function refrigeration(situation){\n if(situation == 'R' || situation == 'r'){\n var extraInc = 1.025\n return extraInc;\n } else if(situation == 'N' || situation == 'n'){\n var extraInc = 1;\n return extraInc;\n } else {\n throw new Error(`\n O código digitado não corresponde à nenhuma opção de situação do produto! \n Digite R para produtos que necessitam de Refrigeração ou N para os que não precisam.\n `);\n }\n}", "resetCASTiming(fps) {\nreturn [this.ic, this.tc, this.fpsc] = [0, 0, fps];\n}", "function retrocederFoto() {\r\n // se incrementa el indice (posicionActual)\r\n\r\n // ...y se muestra la imagen que toca.\r\n }", "function setNew() {\n curPos = 4\n rndT = nextRnd\n nextRnd = Math.floor(Math.random()*tetrominoes.length)\n curT = tetrominoes[rndT][curRot]\n }", "get originalClip() {}", "function obtenerReproducciones(){\n\n\n\n\n\n return ($q.when( reproducciones_tbl ));\n }", "function makeDynamicTimeDigitMovement7() {\n\n // NOTE: makeDynamicTimeDigitMovement7 just OFFESTS ALL RUNNERS to the WHOLE equally distributed points of the screen !\n\n // Offset time-digits immediately very rarely !\n var bOffsetImmediately = Math.random() > 0.995;\n\n if (bOffsetImmediately === true) {\n\n var howManyEdgesPoints = animGS.runners.length;\n var howManyHorizontalLines = calcRndGenMinMax(3, parseInt(howManyEdgesPoints / 3, 10));\n var oneStepX = animGS.cnvWidth / (howManyEdgesPoints / howManyHorizontalLines);\n var oneStepY = animGS.cnvHeight / (howManyHorizontalLines - 1);\n var startEdgeX = 0;\n var startEdgeY = 0;\n var allEdgesPointsCounter = 0;\n\n var allDigitsDynamicOffsets = new Array(howManyEdgesPoints);\n\n for (var addo = 0; addo < allDigitsDynamicOffsets.length; addo++) {\n allDigitsDynamicOffsets[addo] = new Array(2);\n }\n\n while (allEdgesPointsCounter < howManyEdgesPoints) {\n\n allDigitsDynamicOffsets[allEdgesPointsCounter][0] = startEdgeX + (Math.random() * oneStepX);\n allDigitsDynamicOffsets[allEdgesPointsCounter][1] = startEdgeY;\n\n startEdgeX += oneStepX;\n allEdgesPointsCounter++;\n\n if (startEdgeX >= animGS.cnvWidth) {\n startEdgeX = 0;\n startEdgeY += oneStepY;\n }\n }\n\n // Randomize the order !\n allDigitsDynamicOffsets.sort(function () { return (0.5 - Math.random()); });\n\n for (var i = 0; i < animGS.runners.length; i++) {\n animGS.runners[i].runnerX = allDigitsDynamicOffsets[i][0];\n animGS.runners[i].runnerY = allDigitsDynamicOffsets[i][1];\n }\n }\n\n return;\n }" ]
[ "0.5440219", "0.5339634", "0.53384095", "0.5233856", "0.5200052", "0.5199249", "0.51917046", "0.51895845", "0.5126079", "0.51148546", "0.5114559", "0.5105019", "0.5071394", "0.50506276", "0.5014611", "0.50108767", "0.49970484", "0.4989662", "0.4980363", "0.49793032", "0.4976702", "0.4972586", "0.49587104", "0.49428034", "0.49400124", "0.49361512", "0.49235722", "0.4912947", "0.490992", "0.49065408", "0.48862192", "0.48842844", "0.488275", "0.48460332", "0.48411313", "0.48343897", "0.48228133", "0.47981694", "0.4789016", "0.47767997", "0.4776489", "0.47743365", "0.47692436", "0.47649646", "0.4757525", "0.4757337", "0.4755806", "0.4747393", "0.47419062", "0.47419053", "0.47311482", "0.47234076", "0.47136652", "0.47136652", "0.46909085", "0.4682986", "0.46752045", "0.4670379", "0.46489188", "0.46489188", "0.46477985", "0.46476644", "0.46421322", "0.464135", "0.4632906", "0.46278888", "0.46273774", "0.46261764", "0.462553", "0.4625043", "0.4623538", "0.4622555", "0.46168804", "0.4614947", "0.46139377", "0.46137065", "0.46131265", "0.4611254", "0.46094003", "0.4595087", "0.45946524", "0.45906335", "0.45882183", "0.45869255", "0.45856243", "0.45855582", "0.45820597", "0.45797575", "0.45765284", "0.45698172", "0.4567561", "0.45623168", "0.4558516", "0.45571014", "0.45514527", "0.4550015", "0.45497608", "0.45475432", "0.45459923", "0.45419824", "0.45360324" ]
0.0
-1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++ Agregar comentario ++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function agregarComentario(codigoNoticia, codigoUsuario){ data = "codigo_noticia="+codigoNoticia+"&"+ "codigoUsuario="+codigoUsuario+"&"+ "contenido="+$("#txt_comentario").val(); ; $.ajax({ url : "ajax/agregar_comentario.php?accion=4", data: data, method: "POST", dataType: "json", success:function(resultado){ if (resultado.codigo_resultado==1){ $("#txt_comentario").val(""); cargarComentarios(codigoNoticia); }else alert(resultado.mensaje); $(function () { $('[data-toggle="popover"]').popover(); }) }, error:function(){ alert("Ups, no se pudo cargar el contenido."); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_comentarios(){ // funcion de agregar comentarios\n\n var nombre = document.getElementById('nombre').value; //tomo valores que ingresa el usuario en el form\n var coment = document.getElementById('texto_coment').value;\n var puntos = document.getElementById('puntos').value;\n\n comentario.push(nombre);\n comentario.push(coment);\n comentario.push(puntos);\n \n console.log(comentario);\n mostrar(comentario);\n\n}", "function AgregarEgresos() {\n var pEgresos = new Object();\n pEgresos.IdEgresos = 0;\n pEgresos.IdCuentaBancaria = $(\"#divFormaAgregarEgresos\").attr(\"idCuentaBancaria\");\n if ($(\"#divFormaAgregarEgresos\").attr(\"idProveedor\") == \"\") {\n pEgresos.IdProveedor = 0;\n }\n else {\n pEgresos.IdProveedor = $(\"#divFormaAgregarEgresos\").attr(\"idProveedor\");\n }\n pEgresos.CuentaBancaria = $(\"#txtCuenta\").val();\n pEgresos.IdMetodoPago = $(\"#cmbMetodoPago\").val();\n pEgresos.Fecha = $(\"#txtFecha\").val();\n pEgresos.Importe = QuitarFormatoNumero($(\"#txtImporte\").val());\n pEgresos.Referencia = $(\"#txtReferencia\").val();\n pEgresos.ConceptoGeneral = $(\"#txtConceptoGeneral\").val();\n pEgresos.FechaAplicacion = $(\"#txtFechaAplicacion\").val();\n pEgresos.FechaConciliacion = $(\"#txtFechaConciliacion\").val();\n pEgresos.IdTipoMoneda = $(\"#cmbTipoMoneda\").val();\n pEgresos.TipoCambioDOF = QuitarFormatoNumero($(\"#txtTipoCambio\").val());\n \n if(pEgresos.IdTipoMoneda == 2)\n {\n pEgresos.TipoCambio = QuitarFormatoNumero($(\"#txtTipoCambio\").val());\n }\n else\n {\n pEgresos.TipoCambio = \"1\";\n }\n\n if (pEgresos.TipoCambio.replace(\" \", \"\") == \"\") {\n pEgresos.TipoCambio = 0;\n }\n \n if (pEgresos.TipoCambioDOF.replace(\" \", \"\") == \"\") {\n pEgresos.TipoCambioDOF = 0;\n }\n \n if ($(\"#chkConciliado\").is(':checked')) {\n pEgresos.Conciliado = 1;\n }\n else {\n pEgresos.Conciliado = 0;\n }\n\n if ($(\"#chkAsociado\").is(':checked')) {\n pEgresos.Asociado = 1;\n }\n else {\n pEgresos.Asociado = 0;\n }\n \n var validacion = ValidaEgresos(pEgresos);\n if (validacion != \"\")\n { MostrarMensajeError(validacion); return false; }\n var oRequest = new Object();\n oRequest.pEgresos = pEgresos;\n SetAgregarEgresos(JSON.stringify(oRequest));\n}", "async function buscarEstoque(tipoBusca, tipo) {\r\n let codigoHTML = ``, json = null, json2 = null, produtosFilterCategorias = [];\r\n\r\n if (tipo == 'produto') {\r\n if (tipoBusca == 'nome') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`itemsDesk/${$(\"#nome\").val()}`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n json.data = json.data.filter((element) => element.stock != null)\r\n json2 = await requisicaoGET(`categories`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n await aguardeCarregamento(false)\r\n for (let category of json2.data) {\r\n produtosFilterCategorias.push({ 'name': category.name, 'itens': json.data.filter((element) => category.products.findIndex((element1) => element1._id == element._id) > -1) })\r\n }\r\n } else if (tipoBusca == 'todos') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`itemsDesk`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n json.data = json.data.filter((element) => element.stock != null)\r\n json2 = await requisicaoGET(`categories`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n await aguardeCarregamento(false)\r\n for (let category of json2.data) {\r\n produtosFilterCategorias.push({ 'name': category.name, 'itens': json.data.filter((element) => category.products.findIndex((element1) => element1._id == element._id) > -1) })\r\n }\r\n }\r\n } else if (tipo == 'ingrediente') {\r\n if (tipoBusca == 'nome') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`ingredients/${$(\"#nome\").val()}`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n await aguardeCarregamento(false)\r\n } else if (tipoBusca == 'todos') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`ingredients`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n await aguardeCarregamento(false)\r\n }\r\n }\r\n\r\n VETORDEITENSESTOQUE = [];\r\n\r\n codigoHTML += `<div class=\"shadow-lg p-3 mb-5 bg-white rounded\">\r\n <div id=\"grafico\" class=\"col-10 mx-auto\" style=\"height: 50vh\"></div>\r\n </div>\r\n <div class=\"shadow-lg p-3 mb-5 bg-white rounded\">\r\n <h5 class=\"text-center\">Atualizar estoque do produto ou bebida</h5>\r\n <table class=\"table table-bordered table-sm col-12 mx-auto\" style=\"margin-top:10px\">\r\n <thead class=\"thead-dark\">\r\n <tr>\r\n <th scope=\"col\">Nome</th>\r\n <th scope=\"col\">Preço unidade</th>\r\n <th scope=\"col\">Quantidade</th>\r\n <th scope=\"col\">Adicionar quantidade</th>\r\n <th scope=\"col\">Preço de custo</th>\r\n <th scope=\"col\">#</th>\r\n </tr>\r\n </thead>\r\n <tbody>`\r\n\r\n if (tipo == 'ingrediente') {\r\n\r\n for (let item of json.data) {\r\n VETORDEITENSESTOQUE.push(item);\r\n codigoHTML += '<tr>'\r\n if (item.drink) {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-wine-glass-alt\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n } else if (item.drink == false) {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-utensils\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n } else {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-boxes\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n }\r\n codigoHTML += `<th class=\"table-warning text-dark\" style=\"width:10vw\">R$${(parseFloat(item.priceUnit ? item.priceUnit : item.cost)).toFixed(2)}</th>`\r\n if (item.unit == 'g') {\r\n codigoHTML += `<td class=\"table-${item.stock > 2000 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} g</strong></td>`\r\n } else if (item.unit == 'ml') {\r\n codigoHTML += `<td class=\"table-${item.stock > 3000 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} ml</strong></td>`\r\n } else {\r\n codigoHTML += `<td class=\"table-${item.stock > 5 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} unid.</strong></td>`\r\n }\r\n codigoHTML += `<td class=\"table-warning text-dark\" style=\"width:15vw\">\r\n <div class=\"input-group input-group-sm\">\r\n <input class=\"form-control form-control-sm mousetrap\" type=\"Number\" id=\"quantidade${item._id}\" value=10 />\r\n <div class=\"input-group-prepend\">`\r\n if (item.unit == 'g') {\r\n codigoHTML += `<span class=\"input-group-text\">g</span>`\r\n } else if (item.unit == 'ml') {\r\n codigoHTML += `<span class=\"input-group-text\">ml</span>`\r\n } else {\r\n codigoHTML += `<span class=\"input-group-text\">unid.</span>`\r\n }\r\n codigoHTML += `</div>\r\n </div> \r\n </td>\r\n <td class=\"table-warning text-dark\" style=\"width:15vw\">\r\n <div class=\"input-group input-group-sm\">\r\n <div class=\"input-group-prepend\">\r\n <span class=\"input-group-text\">R$</span>\r\n </div>\r\n <input class=\"form-control form-control-sm mousetrap\" type=\"Number\" id=\"precocusto${item._id}\" value=${tipo == 'produto' ? (parseFloat(item.cost)).toFixed(2) : (parseFloat(item.price)).toFixed(2)} />\r\n </div>\r\n </td>\r\n <td class=\"table-secondary text-dark\" style=\"width:7vw\">\r\n <button onclick=\"if(validaDadosCampo(['#quantidade${item._id}'])){confirmarAcao('Atualizar quantidade!', 'atualizarEstoque(this.value,${tipo == 'produto' ? true : false})', '${item._id}');}else{mensagemDeErro('Preencha o campo quantidade com um valor válido!'); mostrarCamposIncorrreto(['quantidade${item._id}']);}\" class=\"btn btn-success btn-sm\">\r\n <span class=\"fas fa-sync\"></span> Alterar\r\n </button>\r\n </td>\r\n </tr>`\r\n }\r\n\r\n } else if (tipo == 'produto') {\r\n\r\n for (let itemCategory of produtosFilterCategorias) {\r\n\r\n if (itemCategory.itens[0] != null) {\r\n codigoHTML += `<tr class=\"bg-warning\">\r\n <th colspan=\"6\" class=\"text-center\"> ${itemCategory.name}</th>\r\n </tr>`\r\n }\r\n\r\n for (let item of itemCategory.itens) {\r\n VETORDEITENSESTOQUE.push(item);\r\n codigoHTML += '<tr>'\r\n if (item.drink) {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-wine-glass-alt\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n } else if (item.drink == false) {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-utensils\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n } else {\r\n codigoHTML += `<td class=\"table-warning text-dark\" title=\"${item.name}\"><strong><span class=\"fas fa-boxes\"></span> ${corrigirTamanhoString(20, item.name)}</strong></td>`\r\n }\r\n codigoHTML += `<th class=\"table-warning text-dark\" style=\"width:10vw\">R$${(parseFloat(item.priceUnit ? item.priceUnit : item.cost)).toFixed(2)}</th>`\r\n if (item.unit == 'g') {\r\n codigoHTML += `<td class=\"table-${item.stock > 2000 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} g</strong></td>`\r\n } else if (item.unit == 'ml') {\r\n codigoHTML += `<td class=\"table-${item.stock > 3000 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} ml</strong></td>`\r\n } else {\r\n codigoHTML += `<td class=\"table-${item.stock > 5 ? 'success' : 'danger'} text-dark text-center\"><strong>${item.stock} unid.</strong></td>`\r\n }\r\n codigoHTML += `<td class=\"table-warning text-dark\" style=\"width:15vw\">\r\n <div class=\"input-group input-group-sm\">\r\n <input class=\"form-control form-control-sm mousetrap\" type=\"Number\" id=\"quantidade${item._id}\" value=10 />\r\n <div class=\"input-group-prepend\">`\r\n if (item.unit == 'g') {\r\n codigoHTML += `<span class=\"input-group-text\">g</span>`\r\n } else if (item.unit == 'ml') {\r\n codigoHTML += `<span class=\"input-group-text\">ml</span>`\r\n } else {\r\n codigoHTML += `<span class=\"input-group-text\">unid.</span>`\r\n }\r\n codigoHTML += `</div>\r\n </div> \r\n </td>\r\n <td class=\"table-warning text-dark\" style=\"width:15vw\">\r\n <div class=\"input-group input-group-sm\">\r\n <div class=\"input-group-prepend\">\r\n <span class=\"input-group-text\">R$</span>\r\n </div>\r\n <input class=\"form-control form-control-sm mousetrap\" type=\"Number\" id=\"precocusto${item._id}\" value=${tipo == 'produto' ? (parseFloat(item.cost)).toFixed(2) : (parseFloat(item.price)).toFixed(2)} />\r\n </div>\r\n </td>\r\n <td class=\"table-secondary text-dark\" style=\"width:7vw\">\r\n <button onclick=\"if(validaDadosCampo(['#quantidade${item._id}'])){confirmarAcao('Atualizar quantidade!', 'atualizarEstoque(this.value,${tipo == 'produto' ? true : false})', '${item._id}');}else{mensagemDeErro('Preencha o campo quantidade com um valor válido!'); mostrarCamposIncorrreto(['quantidade${item._id}']);}\" class=\"btn btn-success btn-sm\">\r\n <span class=\"fas fa-sync\"></span> Alterar\r\n </button>\r\n </td>\r\n </tr>`\r\n }\r\n }\r\n\r\n }\r\n codigoHTML += `</tbody>\r\n </table>\r\n </div>`\r\n\r\n if (json.data[0] == null) {\r\n document.getElementById('resposta').innerHTML = `<h5 class=\"text-center\" style=\"margin-top:20vh;\"><span class=\"fas fa-exclamation-triangle\"></span> Nenhum produto ou ingrediente encontrado!</h5>`;\r\n } else {\r\n document.getElementById('resposta').innerHTML = codigoHTML;\r\n setTimeout(function () { gerarGraficoEstoque(json); }, 300)\r\n }\r\n}", "function enviarComentario(){\r\n let comentarioAEnviar = {\r\n user:document.getElementById(\"comentarioUsuario\").value,\r\n description:document.getElementById(\"comentario\").value,\r\n score:parseInt(document.getElementById(\"comentarioPuntuacion\").value),\r\n dateTime:Fecha()\r\n };\r\n comentarios.push(comentarioAEnviar);\r\n showProductComments();\r\n}", "function busquedaPrincipalPorDefecto(){\n construirFiltros(\"HideDuplicateItems\", \"true\");\n buscarPorClave(\"Deporte\",12,1);\n search(\"Sports\",null,1,\"customerRating\",\"desc\",12);\n}", "function obtenerRegistroHorasSoloCategorias() {\n var params = {\n tipo: 1,\n idActividadUHorario: $scope.actividad.idActividad\n }\n serviceCRUD.TypePost('registro_horas/obtener_registro_horas', params).then(function (res) {\n if (res.data.succeed == false) {\n $scope.flgCrear = false;\n return;\n }\n else {\n //Asigno el objeto registro horas categoria al registro horas con respuestas\n\n $scope.flgCrear = true;\n $scope.regEsfuerzoHoras.idRegistroEsfuerzo = res.data.idRegistroEsfuerzo;\n $scope.regEsfuerzoHorasidAlumno = $scope.usuario.idUser;\n $scope.regEsfuerzoHoras.listaCategorias = res.data.listaCategorias;\n for (let i = 0; i < $scope.regEsfuerzoHoras.listaCategorias.length; i++) {\n $scope.regEsfuerzoHoras.listaCategorias[i].listaRespuestas = []\n }\n $scope.hayRegCategoriasActividad = true;\n }\n\n })\n }", "function registroCarrito(curso) {\n return `<p> ${curso.nombreCurso} \n <span class=\"badge bg-warning\"> Precio Unitario: $ ${curso.precioCurso}</span>\n <span class=\"badge bg-dark\">${curso.cantidad}</span>\n <span class=\"badge bg-success\"> Precio total: $ ${curso.subtotal()}</span>\n <a id=\"${curso.id}\" class=\"btn btn-info btn-add\">+</a>\n <a id=\"${curso.id}\" class=\"btn btn-warning btn-restar\">-</a>\n <a id=\"${curso.id}\" class=\"btn btn-danger btn-delete\">x</a>\n \n </p>`\n}", "async function buscarIngrediente(tipo) {\r\n let codigoHTML = ``, json = null;\r\n\r\n VETORDEINGREDIENTESCLASSEINGREDIENTE = []\r\n\r\n if (tipo == 'nome') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`ingredients/${document.getElementById('nome').value}`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n await aguardeCarregamento(false)\r\n } else if (tipo == 'todos') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`ingredients`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n await aguardeCarregamento(false)\r\n }\r\n\r\n codigoHTML += `<div class=\"shadow-lg p-3 mb-5 bg-white rounded\">\r\n <h5 class=\"text-center\"><span class=\"fas fa-carrot\"></span> Lista de ingredientes</h5>\r\n <table style=\"margin-top:5vh;\" class=\"table table-light table-sm\">\r\n <thead class=\"thead-dark\">\r\n <tr>\r\n <th scope=\"col\">Nome</th>\r\n <th scope=\"col\">Descrição</th>\r\n <th scope=\"col\">Preço por unidade</th>\r\n <th scope=\"col\">Preço de custo</th>\r\n <th scope=\"col\">Editar</th>\r\n <th scope=\"col\">Excluir</th>\r\n </tr>\r\n </thead>\r\n <tbody>`\r\n\r\n for (let item of json.data) {\r\n VETORDEINGREDIENTESCLASSEINGREDIENTE.push(item)\r\n codigoHTML += `<tr>\r\n <th class=\"table-warning\" title=\"${item.name}\"> \r\n <span class=\"fas fa-carrot\"></span> ${corrigirTamanhoString(20, item.name)}\r\n </th>\r\n <th class=\"table-warning\" title=\"${item.description}\"> \r\n ${corrigirTamanhoString(20, item.description)}\r\n </th>\r\n <th class=\"table-warning\"> \r\n R$${(parseFloat(item.priceUnit)).toFixed(2)}\r\n </th>\r\n <th class=\"table-warning text-danger\"> \r\n R$${(parseFloat(item.price)).toFixed(2)}\r\n </th>\r\n <td class=\"table-light\">\r\n <button class=\"btn btn-primary btn-sm\" onclick=\"carregarDadosIngrediente('${item._id}');\">\r\n <span class=\"fas fa-pencil-alt iconsTam\"></span> Editar\r\n </button>\r\n </td>\r\n <td class=\"table-light\">\r\n <button class=\"btn btn-outline-danger btn-sm\" onclick=\"confirmarAcao('Excluir os dados do produto permanentemente!', 'deletarProduto(this.value)', '${item._id}');\" >\r\n <span class=\"fas fa-trash-alt iconsTam\"></span> Excluir\r\n </button>\r\n </td>\r\n </tr>`\r\n }\r\n codigoHTML += `</tbody>\r\n </table>\r\n </div>`\r\n\r\n if (json.data[0] == null) {\r\n document.getElementById('resposta').innerHTML = `<h5 class=\"text-center\" style=\"margin-top:20vh;\"><span class=\"fas fa-exclamation-triangle\"></span> Nenhum produto encontrado!</h5>`;\r\n } else {\r\n document.getElementById('resposta').innerHTML = codigoHTML;\r\n }\r\n setTimeout(function () {\r\n animacaoSlideDown(['#resposta']);\r\n }, 300);\r\n\r\n}", "getMateriasProgra(ru,gestion,periodo){\n return querys.select(\"select * from consola.generar_programacion_completa(\"+ru+\",\"+gestion+\",\"+periodo+\",0)\");\n }", "function accionBuscar ()\n {\n configurarPaginado (mipgndo,'DTOBuscarMatricesDTOActivas','ConectorBuscarMatricesDTOActivas',\n 'es.indra.sicc.cmn.negocio.auditoria.DTOSiccPaginacion', armarArray());\n }", "function agregarProducto(producto) {\n const infoProducto = {\n imagen: producto.querySelector('.item').src,\n name: producto.querySelector('.name-producto').textContent,\n precio: producto.querySelector('.precio').getAttribute('value'),\n id: producto.querySelector('button').getAttribute('data-id'),\n cantidad: 1\n }\n\n //SUMANDO LA CANTIDAD TOTAL DE PRODUCTOS EN EL CARRITO\n\n cantidadTotal += infoProducto.cantidad;\n totalPagar += parseInt(infoProducto.precio); //Total a pagar bill\n totalaPagar();\n\n //revisar si ya existe un cursor: \n const existe = articulosCarrito.some(producto => producto.id === infoProducto.id);\n if (existe) {\n const producto = articulosCarrito.map(producto => {\n //Si el producto ya existe aumentar su cantidad en 1 en 1\n if (producto.id === infoProducto.id) {\n producto.cantidad++;\n producto.precio = parseInt(producto.precio);\n infoProducto.precio = parseInt(infoProducto.precio);\n precioInicial = infoProducto.precio;\n producto.precio += precioInicial;\n\n return producto;\n } else {\n return producto;\n }\n });\n articulosCarrito = [...producto];\n } else {\n articulosCarrito = [...articulosCarrito, infoProducto]\n }\n mostrarenHTML();\n actualizardisplay();\n carritoVacio();\n}", "function poeCarrinho(item){\n // percorrendo o carrinho vendo se ja tem um item\n for(let i=0; i<arrayCarrinho.length; i++){\n if(arrayCarrinho[i].id == item.id){\n // já tem um no carrinho, não precisamos add ele no carrinho\n return\n }\n }\n // o produto não existe dentro do carrinho, logo podemos add ele\n arrayCarrinho.push(item)\n}//poeCarrinho", "function agregarComentario(id_miembro){\n\n\n res= document.getElementById(\"comentar\").value; //Se toma a traves del id, el comentario realizado(valor).\n document.getElementById(\"mostrarComentario\").innerHTML+= res + \"<br>\"; //Hace visible el comentario relizado.\n\tres= document.getElementById(\"comentar\").value= \"\";//Despues que se genera el click vuelve al valor original.\n}", "function telaDeBuscarEstoque(tipo) {\r\n let codigoHTML = ``;\r\n\r\n codigoHTML += `<div class=\"shadow-lg p-3 mb-5 bg-white rounded\">`\r\n if (tipo == 'produto') {\r\n codigoHTML += `<h4 class=\"text-center\"><span class=\"fas fa-boxes\"></span> Buscar produtos</h4>`\r\n } else {\r\n codigoHTML += `<h4 class=\"text-center\"><span class=\"fas fa-boxes\"></span> Buscar ingredientes</h4>`\r\n }\r\n codigoHTML += `<div class=\"card-deck col-6 mx-auto d-block\">\r\n <div class=\"input-group mb-3\">\r\n <input id=\"nome\" type=\"text\" class=\"form-control form-control-sm mousetrap\" placeholder=\"Nome do item\">\r\n <button onclick=\"if(validaDadosCampo(['#nome'])){buscarEstoque('nome', '${tipo}');}else{mensagemDeErro('Preencha o campo nome!'); mostrarCamposIncorrreto(['nome']);}\" type=\"button\" class=\"btn btn-outline-info btn-sm\">\r\n <span class=\"fas fa-search\"></span> Buscar\r\n </button>\r\n <br/>\r\n <button onclick=\"buscarEstoque('todos', '${tipo}');\" type=\"button\" class=\"btn btn-outline-info btn-block btn-sm\" style=\"margin-top:10px;\">\r\n <span class=\"fas fa-search-plus\"></span> Exibir todos\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n <div id=\"resposta\"></div>`\r\n\r\n document.getElementById('janela2').innerHTML = codigoHTML;\r\n}", "async function buscarProdutos(tipoBusca) {\r\n let codigoHTML = ``, json = null, json2 = null, produtosFilterCategorias = [];\r\n\r\n VETORDEPRODUTOSCLASSEPRODUTO = []\r\n\r\n if (tipoBusca == 'nome') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`itemsDesk/${$('#nome').val()}`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n json2 = await requisicaoGET(`categories`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n await aguardeCarregamento(false)\r\n for (let category of json2.data) {\r\n produtosFilterCategorias.push({ 'name': category.name, 'itens': json.data.filter((element) => category.products.findIndex((element1) => element1._id == element._id) > -1) })\r\n }\r\n } else if (tipoBusca == 'todos') {\r\n await aguardeCarregamento(true)\r\n json = await requisicaoGET(`itemsDesk`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } })\r\n json2 = await requisicaoGET(`categories`, { headers: { Authorization: `Bearer ${buscarSessionUser().token}` } });\r\n await aguardeCarregamento(false)\r\n for (let category of json2.data) {\r\n produtosFilterCategorias.push({ 'name': category.name, 'itens': json.data.filter((element) => category.products.findIndex((element1) => element1._id == element._id) > -1) })\r\n }\r\n }\r\n\r\n codigoHTML += `<div class=\"shadow-lg p-3 mb-5 bg-white rounded\">\r\n <h4 class=\"text-center\" style=\"margin-top:40px;\">Lista de produtos</h4>\r\n <table style=\"margin-top:10px;\" class=\"table table-light table-sm\">\r\n <thead class=\"thead-dark\">\r\n <tr>\r\n <th scope=\"col\">Name</th>\r\n <th scope=\"col\">Descrição</th>\r\n <th scope=\"col\">Preço de custo</th>\r\n <th scope=\"col\">Preço de venda</th>\r\n <th scope=\"col\">Editar</th>\r\n <th scope=\"col\">Excluir</th>\r\n <th scope=\"col\">Disponível</th>\r\n </tr>\r\n </thead>\r\n <tbody>`\r\n\r\n for (let itemCategory of produtosFilterCategorias) {\r\n\r\n if (itemCategory.itens[0] != null) {\r\n codigoHTML += `<tr class=\"bg-warning\">\r\n <th colspan=\"7\" class=\"text-center\"> ${itemCategory.name}</th>\r\n </tr>`\r\n }\r\n\r\n for (let item of itemCategory.itens) {\r\n VETORDEPRODUTOSCLASSEPRODUTO.push(item)\r\n codigoHTML += `<tr>\r\n <th class=\"table-info\" title=\"${item.name}\">${item.drink ? '<span class=\"fas fa-wine-glass-alt\"></span>' : '<span class=\"fas fa-utensils\"></span>'} ${corrigirTamanhoString(20, item.name)}</th>\r\n <th class=\"table-info\" title=\"${item.description}\">${corrigirTamanhoString(40, item.description)}</th>\r\n <th class=\"table-warning\"><strong>R$${(item.cost).toFixed(2)}<strong></th>\r\n <th class=\"table-warning text-danger\"><strong>R$${(item.price).toFixed(2)}<strong></th>\r\n <td class=\"table-light\"><button class=\"btn btn-primary btn-sm\" onclick=\"carregarDadosProduto('${item._id}');\"><span class=\"fas fa-pencil-alt iconsTam\"></span> Editar</button></td>\r\n <td class=\"table-light\"><button class=\"btn btn-outline-danger btn-sm\" onclick=\"confirmarAcao('Excluir os dados do produto permanentemente!', 'deletarProduto(this.value)', '${item._id}');\" ><span class=\"fas fa-trash-alt iconsTam\"></span> Excluir</button></td>\r\n <td class=\"table-light\">\r\n <div class=\"custom-control custom-switch\">`\r\n if (item.available) {\r\n codigoHTML += `<input type=\"checkbox\" onclick=\"this.checked? disponibilizarIndisponibilizarProduto('${item._id}',true) : disponibilizarIndisponibilizarProduto('${item._id}',false) \" class=\"custom-control-input custom-switch\" id=\"botaoselectdisponivel${item._id}\" checked=true>`\r\n } else {\r\n codigoHTML += `<input type=\"checkbox\" onclick=\"this.checked? disponibilizarIndisponibilizarProduto('${item._id}',true) : disponibilizarIndisponibilizarProduto('${item._id}',false) \" class=\"custom-control-input custom-switch\" id=\"botaoselectdisponivel${item._id}\">`\r\n }\r\n codigoHTML += `<label class=\"custom-control-label\" for=\"botaoselectdisponivel${item._id}\">Disponível</label>\r\n </div>\r\n </td>\r\n </tr>`\r\n }\r\n }\r\n codigoHTML += `</tbody>\r\n </table>\r\n </div>`\r\n\r\n if (json.data[0] == null) {\r\n document.getElementById('resposta').innerHTML = `<h5 class=\"text-center\" style=\"margin-top:20vh;\"><span class=\"fas fa-exclamation-triangle\"></span> Nenhum produto encontrado!</h5>`;\r\n } else {\r\n document.getElementById('resposta').innerHTML = codigoHTML;\r\n }\r\n setTimeout(function () {\r\n animacaoSlideDown(['#resposta']);\r\n }, 300);\r\n\r\n}", "function dibujarComentarios(_datos)\n{\n\tvar lista = $('#lista-comentarios');\n\tlista.empty();\n\tfor(var i in _datos)\n\t{\n\t\tvar html = '<li class=\"list-group-item\">'+\n \n '<div class=\"primercommit\">'+\n '<h4><Span>'+_datos[i].name+'</Span> dice:</h4>'+\n '<span>'+_datos[i].content+'</span>'+\n '</li>';\n \n\t\tlista.append(html);\n\t}\n}", "function addPratoSelecionado() {\n let qntMedidas = medidas.length;\n let qntValorSelecionado = arrayValores.length;\n\n if (qntValorSelecionado != qntMedidas) {\n alert(\"Selecione Um valor pra cada medidas ou escolha \\\"desativado\\\"\")\n } else {\n const criaArray = (array) => {\n const arr = [];\n for (const item of array) {\n arr.push(item.prato)\n }\n return arr;\n }\n\n let arrayPratos = criaArray(listaPratosDia);\n let existeItem = arrayPratos.findIndex(i => i == valueListaPrato);\n\n if (existeItem == -1) {\n listaPratosDia.push({\n prato: valueListaPrato,\n info: arrayValores\n });\n\n setctx_SP(listaPratosDia);\n } else {\n alert('Este prato já está na lista!');\n }\n /* console.log('-------------------------------------------------------------------------')\n console.log(ctx_SP);\n //console.log(listaPratosDia);\n console.log('-------------------------------------------------------------------------') */\n }\n }", "function iniciarListaBusqueda(){\n var ciclos = selectDatoErasmu();\n for(var aux = 0, help = 0 ; aux < erasmu.length ; aux++){\n if(ciclos.indexOf(erasmu[aux].ciclo) != -1){\n crearListErasmu(erasmu[aux]);\n }\n }\n}", "function agregarAInventario(){\n\t\tvar codigoP=$('#codigoProducto').val();\n\t\tvar codigoB=$('#bodega').val();\n\t\tvar codigoE=$('#estanteria').val();\n\t\tvar codigoS=$('#seccionA').val();\n\t\tvar descripP=$('#descripcion').val();\n\t\tvar unidadM=$('#unidad').val();\n\t\tvar cantidadT=$('#cantidadTotal').val();\n\t\t$.post('AgregarProducto', {\n\t\t\tcodigop : codigoP,\n\t\t\tcodigob: codigoB,\n\t\t\tcodigoe: codigoE,\n\t\t\tcodigos: codigoS,\n\t\t\tdescrip: descripP,\n\t\t\tunidad: unidadM,\n\t\t\tcantidad: cantidadT\n\t\t}, function(responseText) {\n\t\t\t$('#notificacion').show();\n\t\t\t$('#notificacion').text(responseText);\n\t\t\t$('#codigoProducto').val(\"\");\n\t\t\t$('#descripcion').val(\"\");\n\t\t\t$('#unidad').val(\"\");\n\t\t\t$('#cantidadTotal').val(\"\");\n\t\t\tesMuestra();\n\t\t\t$('#cantidadActual').val(\"\");\n\t\t});\n\t\t\n\t\t$(\"#codigoProducto\").focus();\n\t\t\n\t}", "function agregar(usuario) {\n let data = {\n 'thing': usuario\n };\n\n fetch(`${baseUrl}/${groupID}/${collectionID}`, {\n 'method': 'POST',\n 'headers': {\n 'content-type': 'application/json'\n },\n 'body': JSON.stringify(data)\n }).then(res => {\n return res.json();\n }).then(dato => {\n precargarUsers();\n }).catch((error) => {\n console.log(error);\n })\n\n document.querySelector(\"#userName\").value = \"\";\n document.querySelector(\"#resetsUser\").value = \"\";\n document.querySelector(\"#viplevelUser\").value = \"\";\n document.querySelector(\"#levelUser\").value = \"\";\n }", "function APIObtenerConsumos(req, res) {\n const TipOsId = req.query.tiposid;\n const OsId = req.query.osid;\n var query = `select o.OSAmbito as Ambito, p.PrestCodInt as CoberturaID, ospersprestorigid, concat('LIQUIDACION;', now()) as CodigoOperacion,\n 1 as CodigoSede, ifnull (PrestNroTribut, 30546741253) as CuitEmpresa, ifnull (em.EMPRUC, o.OSRRHHDerivId) as CuitProfesionalSolicitante,\n OSfChHOR as FechaIndicacion, osrolid as IdEspecialidadSolicitante, o.osid as NumeroOrdenOriginal, '' as ObservacionesIndicacion,\n pp.PrestPlanPlanComSistExtId as PlanId, true as Acreditado, 1.00 as Cantidad, ACTASISTID as Codigo, a.ActAsistDesc as Practica, false as CodigoEstadoTransaccion,\n ifnull(em.EMPRUC, 0) as CuitProfesionalResponsable, OSfChHOR as Fecha, OSfChHOR as FechaGestion, false as HabilitaAjusteCargos, R.ROLID as IdEspecialidadResponsable,\n 0.00 as MontoIVAFinan, 0.00 as MontoIVAPaciente, 0.00 as MontoNetoFinan, 0.00 as MontoNetoPaciente, 0.00 as MontoTarifa, 0.00 as MontoTotalFinan,\n 0.00 as MontoTotalPaciente, 0.00 as PorcentajeCobertura, 0.00 as PorcentajePaciente, false as RequiereAutorizacion, 'P' as Tipo, true as Vigencia,\n pl.PERSPLANTIPCONTRATID as TipoContratacion, o.tipOSId as TipoOrdenOriginal, OSPersId as PacienteID\n from os o\n left join rrhh rh on o.osrrhhid = rh.rrhhid\n left join osindicact oi on o.tiposid = oi.tiposid and o.osid = oi.osid\n left join actasist a on a.actasistid = oi.osindicactactasistid\n left join plancom pc on o.osplancomid = pc.plancomid\n left join roles r on o.osrolid = r.rolid\n left join estos e on e.EstOSId = o.OSUltEstOsId\n left join empresas em on em.empid = rh.empid\n left join persplan pl on pl.persplanpersid = o.ospersid and pl.persplanplancomid = pc.plancomid\n left join prestadores p on pl.persplanprestid = p.prestid and o.ospersprestorigid = p.prestid\n left join prestplan pp on pc.PlanComId = pp.PlanComId and pp.PrestId = p.PrestId\n left join tipcontrat tc on tc.tipcontratid = pl.persplantipcontratid\n left join sectores s on o.ossectid = s.sectid\n where PrestSistExtId != ''\n and o.tiposid = ${TipOsId} and o.osid = ${OsId};`;\n conectarTunel().then((conexion) => {\n conexion.query(query, (error, resultado) => {\n if (error) {\n res.status(404).send(`Hubo un problema consultando los consumos: ${error}`);\n conexion.end();\n } else {\n const response = {\n 'consumos': JSON.parse(JSON.stringify(resultado))\n }\n res.send(response);\n conexion.end();\n }\n });\n }).catch((err) => {\n res.status(404).send('Hubo un error en la conexion de la BD GEOSalud', err);\n conexion.end();\n });\n}", "function insertarCarrito(infoCurso){\n\t// Crear fila con información para los elementos agregados al carrito\n\tconst row = document.createElement('tr');\n\trow.innerHTML = `\n\t\t<td><img src=\"${infoCurso.imagen}\" width=\"100\"></td>\n\t\t<td>${infoCurso.titulo}</td>\n\t\t<td>${infoCurso.precio}</td>\n\t\t<td>\n\t\t\t<a href=\"#\" class=\"borrar-curso\" data-id=\"${infoCurso.id}\">X</a>\n\t\t</td>\n\t`;\n\n\t// console.log(row);\n\t// Agregar elemento procesado a la lista de elementos en el carrito\n\tcursosCarrito.appendChild(row);\n\n\t// Almacenar los cursos agregados al carrito en Local Storage\n\tguardarCursoLocalStorage(infoCurso);\n}", "function valorEstoqueCategoria(database) {\n \n //inicializacao de uma array de objeto 'estoque', onde cada objeto representa uma categoria e recebe valor do estoque do primeiro produto\n let estoque = [{\n categoria: database[0].category,\n valEstoque: database[0].quantity * database[0].price \n }],\n index = 0;\n \n //loop para passar por todos os objetos da array de produtos\n for(i = 1; i < database.length; i++) {\n \n //caso seja uma categoria diferente, inicializa novo objeto estoque, atribui o nome e o valor de estoque \n if (estoque[index].categoria != database[i].category) {\n \n index++;\n estoque.push({\n categoria: database[i].category,\n valEstoque: database[i].quantity * database[i].price\n })\n \n } else {\n \n //sendo a mesma categoria do produto atual, apenas acumular o valor de estoque\n estoque[index].valEstoque += database[i].quantity * database[i].price; \n } \n }\n \n console.table(estoque);\n}", "function agregarCarro(nombre) {\n const añadido = cursos.find(curso => curso.nombre === nombre)\n carrito.push(añadido)\n document.getElementById(\"car\").innerHTML = carrito.length\n const compra = carrito.map(curso => curso.nombre + \" $ \" + curso.precio)\n document.getElementById(\"listaCurso\").innerHTML = compra.join(\"<br>\")\n\n localStorage.carrito = JSON.stringify(carrito);\n\n}", "function comprarCursos(e){\n e.preventDefault();\n\n//OBTENER ID DEL BOTÓN PRESIONADO\nconst idCurso = e.target.id;\n\n//OBTENER OBJETO DEL CURSO CORRESPONDIENTE AL ID\nconst seleccionado = carrito.find(p => p.id == idCurso);\n\n//SI NO SE ENCONTRO EL ID BUSCAR CORRESPONDIENTE AL ID\nif (seleccionado == undefined){\n \n carrito.push(cursosDisponibles.find(p => p.id == idCurso));\n} else{\n //SI SE ENCONTRÓ AGREGAR CANTIDAD\n seleccionado.agregarCantidad(1);\n}\n\n// carrito.push(seleccionado);\n\n// //FUNCION QUE SE EJECUTA CUANDO SE CARGA EL DOM\n// $(document).ready (function(){\n// if(\"carrito\" in localStorage){\n// const arrayLiterales = JSON.parse(localStorage.getItem(\"carrito\"));\n// for(const literal of arrayLiterales){\n\n// carrito.push(new cursos(literal.id, literal.nombreCurso, literal.precioCurso, literal.categoria))\n \n// }\n \n// }\n// });\n\n//GUARDAR EN LOCALSTORAGE \nlocalStorage.setItem(\"carrito\", JSON.stringify(carrito));\n\n//GENERAR SALIDA CURSO\ncarritoUI(carrito);\n}", "function crearDato(fecha, smallImage, username, image, comentarios) {\r\n\r\n\tvar footerMessage = '<h5>No hay comentarios</h5>';\r\n\tif(comentarios.length > 0)\r\n\t{\r\n\t\tfooterMessage = '<h5>Comentarios</h5><br><ul>' + comentarios.map(comentario => {return `<li>${comentario.authorname}: ${comentario._content}</li>`;})+'</ul>';\r\n\t}\r\n\r\n\treturn {\r\n\t\ttime: fecha,\r\n\t\theader: username,\r\n\t\tbody: [\r\n\t\t\t{\r\n\t\t\t\ttag: 'div class=\"row justify-content-center\"',\r\n\t\t\t\tcontent: '<a data-fancybox=\"single\" href=\"' + image + '\"><img class=\"img-thumbnail img-responsive\" src=\"' + smallImage + '\"></a>',\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t],\r\n\t\tfooter: footerMessage,\t\t\r\n\t}\r\n}", "function AgregarCondicionPago() {\n var pCondicionPago = new Object();\n pCondicionPago.CondicionPago = $(\"#txtCondicionPago\").val();\n pCondicionPago.NumeroDias = $(\"#txtNumeroDias\").val();\n var validacion = ValidaCondicionPago(pCondicionPago);\n if (validacion != \"\")\n { MostrarMensajeError(validacion); return false; }\n var oRequest = new Object();\n oRequest.pCondicionPago = pCondicionPago;\n SetAgregarCondicionPago(JSON.stringify(oRequest));\n}", "abrirSessao(bd, usuario, hashSenha) {\n var resLogin = [];\n var papelUsuario = \"\";\n var colunasProjetadas = [\"nomeusuario\", \"senha\", \"carteira\"];\n var nomeColunaCarteira = \"carteira\";\n\n configuracoes.tabelas.forEach(function (nomeTabela, indice) {\n var resLoginTemp = interfaceBD.select(\n bd,\n nomeTabela,\n colunasProjetadas,\n { nomeusuario: usuario, senha: hashSenha },\n 1\n );\n if (resLoginTemp != null) {\n resLogin = resLogin.concat(resLoginTemp);\n if (resLoginTemp.length && papelUsuario === \"\")\n papelUsuario = nomeTabela;\n }\n console.log(\n `A saida da tabela ${nomeTabela} foi: ${resLoginTemp}\\nE possui comprimento de ${resLoginTemp.length}`\n );\n });\n\n console.log(\n `A saida das tabelas foi: ${resLogin}\\nE possui comprimento de ${resLogin.length}`\n );\n\n if (resLogin != null && resLogin != {}) {\n if (resLogin.length > 0) {\n return {\n estado: \"aberta\",\n conteudo: resLogin,\n papelUsuario: papelUsuario,\n carteiraUsuario:\n resLogin[0][colunasProjetadas.indexOf(nomeColunaCarteira)],\n horaAbertura: new Date(),\n };\n }\n /*return ContentService.createTextOutput(\n JSON.stringify({ nome: \"isaias\" })\n ).setMimeType(ContentService.MimeType.JSON);*/\n }\n\n return { estado: \"fechada\", conteudo: [], horaAbertura: new Date() };\n }", "function exceso_agua(exceso, costo_exceso, uid_condominio, uid_condomino) {\n\n var newCobro = movimientosref.child(uid_condominio).child(uid_condomino).child('EXCESO').push();\n newCobro.set({\n valor: costo_exceso,\n tipo: true,\n detalle: \"Cobro por exceso de agua: \" + exceso,\n fecha: Date.now()\n })\n //Agregar a saldo\n var newSaldo = saldosref.child(uid_condominio).child(uid_condomino).child('EXCESO').push();\n newSaldo.set({\n valor: costo_exceso,\n tipo: true,\n detalle: \"Cobro por exceso de agua: \" + exceso,\n fecha: Date.now()\n })\n\n\n }", "async getDatosAcopio() {\n let query = `SELECT al.almacenamientoid, ca.centroacopioid, ca.centroacopionombre, \n concat('Centro de Acopio: ', ca.centroacopionombre, ' | Propietario: ', pe.pernombres, ' ', pe.perapellidos) \"detalles\"\n FROM almacenamiento al, centroacopio ca, responsableacopio ra, persona pe\n WHERE al.centroacopioid = ca.centroacopioid AND ca.responsableacopioid = ra.responsableacopioid AND ra.responsableacopioid = pe.personaid;`;\n let result = await pool.query(query);\n return result.rows; // Devuelve el array de json que contiene todos los controles de maleza realizados\n }", "function melhorEco(dados) {\n return dados;\n}", "function jogosDaDesenvolvedora(desenvolvedora){\n let jogos = [];\n\n for (let categoria of jogosPorCategoria) {\n for ( let jogo of categoria.jogos ) {\n if (jogo.desenvolvedora === desenvolvedora){\n jogos.push(jogo.titulo)\n } \n }\n }\n console.log(\"Os jogos da \" + desenvolvedora + \" são: \" + jogos)\n}", "function agregarCant() {\r\n const seleccionado = productos.find(producto => producto.id == this.id);\r\n seleccionado.agregarCantidad(1);\r\n let registroUI = $(this).parent().children();\r\n registroUI[2].innerHTML = seleccionado.cantidad;\r\n registroUI[3].innerHTML = seleccionado.subtotal();\r\n $(\"#totalCarrito\").html(`TOTAL ${totalCarrito(carrito)}`);\r\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\r\n}", "formata_dados_v2( resposta_HANA ){\n const reducer = (r, row) => {\n \n const key_caminhao = `${row.ID} - ${row.Unidade} - ${row.Nome} - ${row.Placa} - ${row.Transportadora} - ${row.Modal} - ${row.Dia} - ${row.Transportadora} - ${row.Modal} -${row.Nome}`;\n const key_entrega = `${row.Item_pedido} - ${row.Cod_Material} - ${row.Material} - ${row.Remessa} - ${row.Dia} - ${row.N_nota_fiscal} - ${row.Peso}`;\n\n const caminhoes = {\n ID: parseInt(row.ID),\n Unidade: row.Unidade,\n Status: row.Status || 'Aguardando chegada do veículo',\n Nome: row.Nome,\n Placa: row.Placa,\n Transportadora: row.Transportadora,\n Modal: row.Modal,\n Dia: row.Dia,\n Material: row.Material,\n Materiais: {},\n Assinaturas: []\n };\n\n r[key_caminhao] = r[key_caminhao] || caminhoes;\n\n const entregas = {\n Item_pedido: row.Item_pedido,\n Cod_Material: row.Cod_Material,\n Material: row.Material,\n Remessa: row.Remessa,\n Dia: row.Dia,\n N_nota_fiscal: row.N_nota_fiscal,\n Peso: parseInt(row.Peso.replace('.', ''))\n };\n\n r[key_caminhao]['Materiais'][key_entrega] = r[key_caminhao]['Materiais'][key_entrega] || entregas;\n\n return r;\n };\n\n const organizado = resposta_HANA.reduce( (r, row) => reducer(r, row), {});\n\n const obj_organizado = Object.values(organizado);\n\n const obj_organizado_2 = obj_organizado.map( item => {\n item['Materiais'] = Object.values(item['Materiais']);\n\n return item\n });\n\n return obj_organizado_2;\n }", "function agregarContextoAGrupo(gruposFechas,contexto) {\r\n var idContexto = \"\";\r\n //instante\r\n if(contexto.Periodo.Tipo == 1) {\r\n idContexto = contexto.Periodo.FechaInstante;\r\n }else if(contexto.Periodo.Tipo == 2) {\r\n //duracion\r\n idContexto = contexto.Periodo.FechaInicio + \"-\" + contexto.Periodo.FechaFin;\r\n } else {\r\n //parasiempre\r\n idContexto = \"Forever\";\r\n }\r\n for(var ictx = 0;ictx < gruposFechas.length;ictx++) {\r\n \r\n if(gruposFechas[ictx].Id == idContexto) {\r\n return;\r\n }\r\n }\r\n //periodo aún no existe\r\n var nuevoPeriodo = {\r\n Id:idContexto,\r\n Tipo:contexto.Periodo.Tipo,\r\n FechaInicio:contexto.Periodo.FechaInicio,\r\n FechaFin:contexto.Periodo.FechaFin,\r\n FechaInstante:contexto.Periodo.FechaInstante\r\n };\r\n\r\n gruposFechas[gruposFechas.length] = nuevoPeriodo;\r\n}", "function listar(ok,error){\n console.log(\"Funcionlistar DAO\")\n helper.query(sql,\"Maestro.SP_SEL_ENTIDAD_FINANCIERA\",[],ok,error)\n}", "function inserir(){\n\n\t\t\tvm.obj.ordem = vm.lista.length + 1;\n\n\t\t\treturn CRUDService.categoria().inserir(vm.obj).then(function(data) {\n\n\t\t\t\tif(data.success){\n\n\t\t\t\t\tvm.lista.push(angular.copy(vm.obj));\n\t\t\t\t\talert('Inserido');\n\t\t\t\t\t\n\n\t\t\t\t}else{\n\n\t\t\t\t\talert('Erro');\n\n\t\t\t\t};\n\n\t\t\t\treturn data;\n\n\t\t\t});\n\n\t\t}", "function crearCompetencia(req, res) {\n var nombre = req.body.nombre === '' ? null : req.body.nombre;\n var genero_id = req.body.genero;\n var director_id = req.body.director;\n var actor_id = req.body.actor;\n\n // Buscamos si existe una competencia con el mismo nombre\n var busquedaSql = 'SELECT * FROM competencia WHERE nombre = ?'\n conexionBaseDeDatos.query(busquedaSql, [nombre], function(error, resultado, campos) {\n if(resultado && resultado.length !== 0) {\n console.log('La competencia ya existe');\n return res.status(422).send('La competencia ya existe');\n } else {\n // Verificamos que la cantidad de peliculas que coinciden con los parametros seleccionados\n // sea suficiente para crear la competencia\n var sqlBuscarPeli = sqlBuscarPeliculas(genero_id, director_id, actor_id);\n conexionBaseDeDatos.query(sqlBuscarPeli, [nombre], function(error, resultado, campos) {\n if(resultado && resultado.length < 2) {\n console.log('La cantidad de resultados obtenidos no es suficiente para crear una competencia');\n return res.status(422).send('La cantidad de resultados obtenidos no es suficiente para crear una competencia');\n } else {\n var peticionSql = 'INSERT INTO competencia (nombre, genero_id, director_id, actor_id) VALUES (?, ?, ?, ?)';\n conexionBaseDeDatos.query(peticionSql, [nombre, genero_id, director_id, actor_id], function(error, resultado, campos) {\n if(error) {\n console.log('El campo NOMBRE no puede estar en blanco', error.message);\n return res.status(422).send('El campo NOMBRE no puede estar en blanco');\n }\n console.log('Competencia agregada.');\n return res.status(200).send('La competencia se ha creado con exito!');\n })\n };\n }) \n }\n })\n}", "function mostrarDatosCompra() {\n //Tomo los datos que pasé en la funcion navegar\n const unaCompra = this.data;\n if (unaCompra) {\n const idProd = unaCompra.idProducto;\n const productoComprado = obtenerProductoPorID(idProd);\n const subTotal = unaCompra.cantidad * productoComprado.precio;\n //Escribo el mensaje a mostrar\n const mensaje = `Producto <strong>${productoComprado.nombre}</strong>.\n <br> Cantidad comprada: <strong>${unaCompra.cantidad}</strong>.<br>\n Sub Total: <strong> $${subTotal}</strong>`;\n //Muestro el mensaje\n $(\"#pDetalleCompraMensaje\").html(mensaje);\n } else {\n ons.notification.alert(\"Ocurrió un error, por favor contacte al administrador\", { title: 'Oops!' });\n }\n}", "function agregarItems(opAccion) {\n var tGrid = 'PbPlanificaestudiantnew';\n //var nombre = $('#cmb_estandar_evi option:selected').text();\n //Verifica que tenga nombre producto y tenga foto\n //alert('dsasd' + $('#cmb_modalidadesth').val());\n if ($('#cmb_asignaest').val() != '0' /*&& $('#cmb_jornadaest').val() != '0'*/ && $('#cmb_bloqueest').val() != '0' && $('#cmb_modalidadesth').val() != '0' && $('#cmb_horaest').val() != '0') {\n /* var valor = $('#cmb_estandar_evi option:selected').text();*/\n if (opAccion != \"edit\") {\n //********* AGREGAR ITEMS *********\n var arr_Grid = new Array();\n if (sessionStorage.dts_datosItemplan) {\n /*Agrego a la Sesion*/\n arr_Grid = JSON.parse(sessionStorage.dts_datosItemplan);\n var size = arr_Grid.length;\n if (size > 0) {\n var vasignatura = $('#cmb_asignaest option:selected').text();\n var vbloque = $('#cmb_bloqueest option:selected').text();\n var vhora = $('#cmb_horaest option:selected').text();\n var vBloque = buscaDatoTabla(tGrid, vbloque, 'bloque');\n var vHora = buscaDatoTabla(tGrid, vhora, 'hora');\n var viguales = 0;\n console.log(vBloque);\n console.log( vHora);\n //console.log(vasignatura);\n if (vBloque && vHora ){\n viguales = 1;\n }\n //alert ('sdsds' + viguales);\n if (checkId(vasignatura, 'asignatura') /*|| (viguales === 1)*/) {\n //if (vBloque && vhora) { \n showAlert('NO_OK', 'error', { \"wtmessage\": \"Ya ha ingresado esa asignatura\", \"title\": 'Información' });\n return;\n //}\n } else if(viguales === 1){\n showAlert('NO_OK', 'error', { \"wtmessage\": \"Ya ha ingresado una asignatura en este bloque y hora\", \"title\": 'Información' });\n return;\n } \n else {\n //Varios Items \n arr_Grid[size] = objProducto(size);\n sessionStorage.dts_datosItemplan = JSON.stringify(arr_Grid);\n addVariosItem(tGrid, arr_Grid, -1);\n } \n limpiarDetalle();\n\n } else {\n /*Agrego a la Sesion*/\n //Primer Items \n arr_Grid[0] = objProducto(0);\n sessionStorage.dts_datosItemplan = JSON.stringify(arr_Grid);\n addPrimerItem(tGrid, arr_Grid, 0);\n limpiarDetalle();\n }\n } else {\n //No existe la Session\n //Primer Items\n arr_Grid[0] = objProducto(0);\n sessionStorage.dts_datosItemplan = JSON.stringify(arr_Grid);\n addPrimerItem(tGrid, arr_Grid, 0);\n limpiarDetalle();\n }\n } else {\n //data edicion\n }\n } else {\n showAlert('NO_OK', 'error', { \"wtmessage\": \"Todos los datos del detalle planificación son obligatorios\", \"title\": 'Información' });\n }\n}", "function nuevoEsquemaComision(cuadroOcultar, cuadroMostrar){\n\t\tcuadros(\"#cuadro1\", \"#cuadro2\");\n\t\tlimpiarFormularioRegistrar(\"#form_esquema_comision_registrar\");\n\t\t$(\"#id_vendedor_registrar\").focus();\n\t}", "function AgregarNuevoLibro(_titulo, _tema, _autor, _existencia, _ubicacion, _fecha_ingreso) {\n var nuevo_libro = Object.create(libro);\n if (Libros.length == 0) nuevo_libro.libro_id = 1;\n else nuevo_libro.libro_id = Libros[Libros.length - 1].libro_id + 1;\n nuevo_libro.titulo = _titulo;\n nuevo_libro.tema_id = _tema;\n nuevo_libro.autor_id = _autor;\n nuevo_libro.disponibles = _existencia;\n nuevo_libro.ubicacion = _ubicacion;\n nuevo_libro.fecha_ingreso = _fecha_ingreso;\n Libros.push(nuevo_libro);\n GuardarLibros();\n alert('Libro agregado exitosamente');\n window.location.href = 'libros.html';\n}", "function mostraAlunos() {\n var id = sessionStorage.getItem(\"idUser\");\n var idDisc = sessionStorage.getItem(\"idDisciplina\");\n var alunos = true;\n query = \"SELECT explicando.user_id as idExplicando, explicando.nome as nomeExplicando FROM explicando, explicando_tem_explicador, explicador WHERE explicando.user_id = explicando_tem_explicador.explicando_user_id AND explicando_tem_explicador.explicador_user_id = explicador.user_id AND explicando_tem_explicador.explicador_user_id = '\" + id + \"' AND explicando_tem_explicador.disciplina_id = '\" + idDisc + \"'\";\n console.log(query);\n connectDataBase();\n connection.query(query, function (err, result) {\n if (err) {\n console.log(err);\n } else {\n result.forEach((explicando) => {\n console.log(explicando);\n if (alunos != false) {\n document.getElementById(\"conteudo\").appendChild(document.createTextNode(\"Selecione o aluno:\"));\n }\n alunos = false;\n //CARD:\n var explic = document.createElement(\"div\");\n explic.value = explicando.user_id;\n explic.setAttribute(\"class\", \"wd-100 mb-1\");\n\n //NOME ALUNO:\n var nome = document.createElement(\"button\");\n nome.setAttribute(\"class\", \"card border-left-info shadow h-100 py-0 w-100\");\n var nomeAux = document.createElement(\"div\");\n nomeAux.setAttribute(\"class\", \"card-body w-100\");\n var nomeAux2 = document.createElement(\"div\");\n nomeAux2.setAttribute(\"class\", \"text-x font-weight-bold text-danger text-uppercase mb-1\");\n nomeAux2.innerHTML = explicando.nomeExplicando;\n nomeAux.appendChild(nomeAux2);\n\n nome.onclick = function () {\n var edita = \"false\";\n var idSumario = null;\n var aux;\n sessionStorage.setItem(\"idExplicando\", explicando.idExplicando);\n sessionStorage.setItem(\"idDisciplina\", idDisc);\n sessionStorage.setItem(\"edita\", edita);\n sessionStorage.setItem(\"idSumario\", idSumario);\n verificaData(1);\n };\n nome.appendChild(nomeAux);\n\n explic.appendChild(nome);\n document.getElementById(\"listaAlunos\").appendChild(explic);\n });\n if (alunos != false) {\n document.getElementById(\"conteudo\").appendChild(document.createTextNode(\"Não existe alunos inscritos nesta disciplina.\"));\n }\n }\n });\n closeConnectionDataBase();\n}", "function mostrarListadoSaldoConductor(){\n ocultarFormularios();\n \n let sListado = oDGT.listadoSaldoConductor();\n \n document.getElementById(\"areaListado\").innerHTML= sListado;\n document.getElementById(\"titulo\").innerHTML= \"Listado de conductores con saldo pendiente\";\n}", "function agregarAlCarrito(e) {\n if($(\"#formularioEnvio\").length===0){\n let producto;\n\n if($(e.target).attr(\"id\")!=undefined){\n producto=arrayProductos.find(elemento=>elemento.nombre == $(e.target).attr(\"id\").split(\"A\")[0]);\n }else{\n producto = arrayProductos.find(elemento=>elemento.nombre == $(e.target).children().attr(\"id\").split(\"A\")[0]);\n }\n \n producto.actualizarStock(1);\n\n if ($(\"#btn-finalizar\").hasClass(\"disabled\") && producto.stock>=0){\n activarBotones(\"btn-finalizar\")\n $(\"#productosCarrito\").empty();\n }\n\n if(producto.stock>=0){\n total = total + producto.precio;\n arrayCarrito.push(producto.nombre);\n mostrarTotal();\n mostrarProductoEnCarrito(producto);\n if(producto.stock===0){\n $(`#${producto.nombre}CardproductosDestacados`).css(\"opacity\", 0.5)\n $(`#${producto.nombre}CardgrillaProductos`).css(\"opacity\", 0.5)\n }\n }else {\n swal(\"Lo sentimos. No tenemos stock en este momento\");\n producto.stock = 0;\n total = total;\n }\n }\n return total;\n}", "busquedaUsuario(termino, seleccion) {\n termino = termino.toLowerCase();\n termino = termino.replace(/ /g, '');\n this.limpiar();\n let count = +0;\n let busqueda;\n this.medidoresUser = [], [];\n this.usersBusq = [], [];\n for (let index = 0; index < this.usuarios.length; index++) {\n const element = this.usuarios[index];\n switch (seleccion) {\n case 'nombres':\n busqueda = element.nombre.replace(/ /g, '').toLowerCase() + element.apellido.replace(/ /g, '').toLowerCase();\n if (busqueda.indexOf(termino, 0) >= 0) {\n this.usersBusq.push(element), count++;\n }\n break;\n case 'cedula':\n busqueda = element.cedula.replace('-', '');\n termino = termino.replace('-', '');\n if (busqueda.indexOf(termino, 0) >= 0) {\n this.usersBusq.push(element), count++;\n }\n break;\n default:\n count = -1;\n break;\n }\n }\n if (count < 1) {\n this.usersBusq = null;\n }\n this.conteo_usuario = count;\n }", "function formulario_enviar_logistica_categoria() {\n // crear icono de la categoria (si no existe) y luego guardar\n logistica_categoria_crear_icono();\n}", "function leerDatosDeProducto(productoAgregado) {\n const idProductoSeleccionado = parseInt(\n productoAgregado.querySelector(\"a\").getAttribute(\"data-id\")\n );\n\n let datoProductos = {};\n\n productosEnStock.forEach((producto) => {\n if (producto.id === idProductoSeleccionado) {\n datoProductos = { ...producto };\n datoProductos.cantidad = 1;\n }\n });\n const existe = coleccionProductos.some(\n (producto) => producto.id === datoProductos.id\n );\n\n if (existe) {\n //actualizamos la cantidad\n const productosListaSinCopia = coleccionProductos.map((producto) => {\n if (producto.id === datoProductos.id) {\n producto.cantidad++;\n return producto;\n } else {\n return producto;\n }\n });\n } else {\n //agrega elemento al arreglo de carrito\n coleccionProductos = [...coleccionProductos, datoProductos];\n }\n\n carritoHTML();\n}", "function agregarProducto() {\n // Se obtiene la cantidad, la unidad, el id de la unidad, la descripcion, el id del producto, el valor, el monto\n let cantidad = document.getElementById('inputCantidad').value;\n let unidad = document.getElementById('inputDescripcion').value.split('~')[3];\n let unidad_id = document.getElementById('inputUnidadID').value;\n let descripcion = document.getElementById('inputDescripcion').value.split('~')[2];\n let id_pro = document.getElementById('inputDescripcion').value.split('~')[0];\n let valor = document.getElementById('inputValor').value;\n let monto = document.getElementById('inputMonto').value;\n\n // Celda Cantidad\n let cell1 = document.createElement('td');\n cell1.setAttribute('id', '')\n let input1 = document.createElement('input');\n input1.name = 'cantidad';\n input1.value = cantidad;\n input1.type = 'hidden';\n\n // Celda Unidad\n let cell2 = document.createElement('td');\n cell2.className = 'vUnidad';\n let input2 = document.createElement('input');\n input2.name = 'unidad';\n input2.value = unidad_id;\n input2.type = 'hidden';\n\n // Celda Descripcion\n let cell3 = document.createElement('td');\n cell3.className = 'vDescripcion';\n let input3 = document.createElement('input');\n input3.name = 'descripcion';\n input3.value = id_pro;\n input3.type = 'hidden';\n\n // Celda Precio Unitario\n let cell4 = document.createElement('td');\n let input4 = document.createElement('input');\n input4.name = 'valor';\n input4.value = valor;\n input4.type = 'hidden';\n\n // Celda Monto Total\n let cell5 = document.createElement('td');\n let input5 = document.createElement('input');\n input5.name = 'monto';\n input5.value = monto;\n input5.type = 'hidden';\n cell5.className = \"monto_total\";\n\n // Celda Boton Añadir\n let cell6 = document.createElement('td');\n let btn_edit = document.createElement('button');\n let i_edit = document.createElement('i');\n i_edit.className = \"fa fa-edit\";\n btn_edit.className = \"btn btn-primary btn-sm mr-2\";\n btn_edit.setAttribute('type', 'button');\n btn_edit.setAttribute('data-toggle', 'modal');\n btn_edit.setAttribute('data-target', '#addModal');\n btn_edit.appendChild(i_edit);\n cell6.appendChild(btn_edit);\n\n // Celda Boton Eliminar\n let cell7 = document.createElement('td');\n let btn_delete = document.createElement('button');\n let i_delete = document.createElement('i');\n i_delete.className = \"fa fa-minus-circle\";\n btn_delete.className = \"btn btn-danger btn-sm\";\n btn_delete.setAttribute('type', 'button');\n btn_delete.setAttribute('data-toggle', 'modal');\n btn_delete.setAttribute('data-target', '#deleteModal');\n btn_delete.setAttribute('onclick', 'borrar(this.parentNode.parentNode.parentNode, this.parentNode.parentNode)');\n\n btn_delete.appendChild(i_delete);\n cell7.appendChild(btn_delete);\n\n cell1.innerHTML = cantidad;\n cell2.innerHTML = unidad;\n cell3.innerHTML = descripcion;\n cell4.innerHTML = valor;\n cell5.innerHTML = monto;\n // Se crea la fila a añadir\n let fila = document.createElement('tr');\n fila.setAttribute('id', contador);\n contador++;\n fila.append(cell1, input1, cell2, input2, cell3, input3, cell4, input4, cell5, input5, cell6, cell7);\n // Se agrega la fila a la tabla\n let tabla = document.getElementById('tabla');\n tabla.appendChild(fila);\n total();\n clean();\n}", "function accionConsultarProducto(){\n listado1.actualizaDat();\n var numSelec = listado1.numSelecc();\n if ( numSelec < 1 ) {\n GestionarMensaje(\"PRE0025\", null, null, null); // Debe seleccionar un producto.\n } else {\n var codSeleccionados = listado1.codSeleccionados();\n var arrayDatos = obtieneLineasSeleccionadas(codSeleccionados, 'listado1'); \n var cadenaLista = serializaLineasDatos(arrayDatos);\n var obj = new Object();\n obj.hidCodSeleccionadosLE = \"[\" + codSeleccionados + \"]\";\n obj.hidListaEditable = cadenaLista;\n //set('frmContenido.conectorAction', 'LPModificarGrupo');\n mostrarModalSICC('LPModificarOferta','Consultar producto',obj,795,495);\n }\n}", "function registrarDatos(ancho,grueso,varas,precioP) {\n datos[0].push(ancho);\n datos[1].push(grueso);\n datos[2].push(varas);\n datos[3].push(precioP);\n }", "function agregarProducto(id) {\n while (log.hasChildNodes()) {\n log.removeChild(log.firstChild);\n }\n\n buscador.value = \"\";\n let flag = false;\n if (lista.length > 0) {\n for (let b = 0; b < lista.length; b++) {\n if (lista[b] == id) {\n flag = true;\n }\n }\n }\n\n if (flag != true) {\n lista.push(id);\n var data = {valor: id};\n fetch('/buscar/productos/id', {\n method: 'POST', // or 'PUT'\n body: JSON.stringify(data), // data can be `string` or {object}!\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(res => res.json())\n .catch(error => console.error('Error:', error))\n .then(response => {\n console.log(response);\n let propiedades = \"\";\n let options = \"\";\n let acumuladostock = 0;\n for (let c = 0; c < response.length; c++) {\n acumuladostock = response[c]['stock'];\n for (let d = 0; d < response[c]['propiedades'].length; d++) {\n options = \"\";\n for (let e = 0; e < response[c]['propiedades'][d]['valores'].length; e++) {\n options += \"<option value='\" + response[c]['propiedades'][d]['valores'][e]['id'] + \"'>\" + response[c]['propiedades'][d]['valores'][e]['valor'] + \"</option>\";\n acumuladostock += response[c]['propiedades'][d]['valores'][e]['stock'];\n }\n propiedades += '<div class=\"col-md-3\"><div class=\"form-group\"><label for=\"' + response[c]['propiedades'][d]['nombre'] + '\" >' + response[c]['propiedades'][d]['nombre'] + '</label><select class=\"form-control\" onchange=\"cambiodeprecios(\\'' + response[c]['propiedades'][d]['nombre'] + d + '\\', ' + contpro + ')\" id=\"' + response[c]['propiedades'][d]['nombre'] + d + '\" name=\"tipodocumento\" required><option></option>' + options + '</select></div></div>';\n // ACÁkk VOYYYY document.getElementById(response[c]['propiedades'][d]['nombre'] + d).addEventListener('change', calc);\n }\n elChild = document.createElement('div');\n elChild.innerHTML = '<div class=\"row productostiend\" id=\"pro' + contpro + '\"><div class=\"col-md-12\"><div class=\"row\"><a href=\"#!\" onClick=\"elimnaproducto(\\'pro' + contpro + '\\', ' + id + ')\" style=\"position: absolute; right: 15px; z-index: 100;\" class=\"vermasproductos\"><span aria-hidden=\"true\">×</span></a><div class=\"col-md\"><div class=\"form-group\"> <input type=\"hidden\" value=\"' + response[c][\"id\"] + '\" name=\"[' + c + '][id]\"><label for=\"Cantidad\">Nombre</label><a href=\"/productos/ver/' + response[c][\"id\"] + '\" class=\"vermasproductos\" target=\"_blank\"><h5>' + response[c][\"nombre\"] + '</h5></a></div></div> <div class=\"col-md-2\"><div class=\"form-group\"><label for=\"Cantidad\">Cantidad</label><input type=\"text\" id=\"cantidadfact' + contpro + '\" class=\"form-control\" precio=\"' + response[c][\"valor\"] + '\" item=\"' + contpro + '\" name=\"[' + c + '][stock]\" placeholder=\"' + acumuladostock + '\" required></div></div><div class=\"col-md\"><div class=\"form-group\"><label for=\"Unidad\">Precio U.</label><input class=\"form-control\" type=\"text\" id=\"preciounitario' + contpro + '\" value=\"' + response[c][\"valor\"] + '\" readonly></div></div><div class=\"col-md\"><div class=\"form-group\"><label>Subtotal</label><p id=\"totalprice' + contpro + '\"></p></div></div></div><div class=\"col-md-12\"><div class=\"row\">' + propiedades + '</div></div></div></div>';\n bandeja.appendChild(elChild);\n }\n document.getElementById('cantidadfact' + contpro).addEventListener('keyup', calc);\n });\n }\n contpro++;\n}", "function consultargrupo(req,res){\n\tlet consulgrupo = new Grupoempresa(req.body.grupo)\n\n\tCONN('grupo').where('grupo',req.body.grupo).select().then(traergrupo =>{\n\t\tconsole.log(traergrupo);\n\t\tif (traergrupo == ''){\n\t\t\tCONN('grupo').insert(consulgrupo).then(insertargrupo =>{\n\t\t\t\tif (!insertargrupo){\n\t\t\t\t\tres.status(500).send({resp:'error', error: 'no se inserto grupo'});\n\t\t\t\t}else{\n\t\t\t\t\tres.status(200).send({resp: 'grupo guardado', insertargrupo:insertargrupo });\n\t\t\t\t}\n\t\t\t}).catch(error =>{\n\t\t\t\tres.status(500).send({resp:'error', error: `${error}` });\n\t\t\t});\n\t\t}else{\n\t\t\tres.status(200).send({resp: 'grupo', traergrupo:traergrupo });\n\t\t}\n\n\t}).catch(error =>{\n\t\t\t\tres.status(500).send({resp:'error', error: `${error}` });\n\t\t\t});\n}", "function cadastrarSolicitante(){\n\tvar unidade = DWRUtil.getValue(\"comboUnidade\"); \n\tvar notSolicitante = DWRUtil.getValue(\"comboUnidadesNaoSolicitantes\");\n\tif((notSolicitante==null ||notSolicitante=='')){\n\t\talert(\"Selecione uma unidade do TRE.\");\n\t}else{\n\t\tFacadeAjax.adicionaUnidadeSolicitante(unidade,notSolicitante);\n\t\tcarregaUnidadesSolicitantes()\t\n\t}\t\n}", "async function carregarDadosIngrediente(id) {\r\n\r\n await aguardeCarregamento(true)\r\n await telaIngrediente('atualizar', id);\r\n await aguardeCarregamento(false)\r\n const dado = VETORDEINGREDIENTESCLASSEINGREDIENTE.find((element) => element._id == id);\r\n try {\r\n document.getElementById('nomeingrediente').value = dado.name\r\n document.getElementById('precocustoingrediente').value = (parseFloat(dado.price)).toFixed(2)\r\n document.getElementById('quantidadeingrediente').value = parseInt(dado.stock)\r\n document.getElementById('unidademedidaingrediente').value = dado.unit\r\n document.getElementById('descricaoingrediente').value = dado.description\r\n } catch (error) {\r\n mensagemDeErro('Não foi possível carregar os dados do produto!')\r\n }\r\n}", "function contaregistrosbanco() {\n\t\t\tdb.transaction(function(tx) {\n\t\t\t\ttx.executeSql('CREATE TABLE IF NOT EXISTS checklist_gui (token text, codigo text, descricao text, secaopai text, tipo text, conforme text, obs text, latitude text, longitude text,datalimite text, entidade int, ordenacao text, codigooriginal text, atualizouservidor int, imagemanexa text)');\n\n\t\t\t\t\ttx.executeSql(\"select count(1) totalitens, sum(case when conforme is not null then 1 else 0 end) totalrespondidos, sum(case conforme when 'sim' then 1 else 0 end) totalconforme, sum(case conforme when 'nao' then 1 else 0 end) totalnaoconforme , sum(case conforme when 'nao se aplica' then 1 else 0 end) totalnaoseaplica, sum(case ifnull(atualizouservidor,0) when 0 then 1 else 0 end) totalparaatualizar, sum(case ifnull(atualizouservidor,0) when 0 then 1 else 0 end) totalparaatualizar, (select sum(case ifnull(atualizouservidor,0) when 0 then 1 else 0 end) from checklist_fotos where codigo = cg.codigo) totalfotosparaatualizar from checklist_gui cg where token=? and codigo like ? and tipo='item' \", [$scope.token, $scope.secaoPai.codigo + '.%'], function(tx, results) {\n\t\t\t\t\t\t\n\t\t\t\t\t$scope.totalitens = results.rows.item(0).totalitens;\n\t\t\t\t\t$scope.totalrespondidos = results.rows.item(0).totalrespondidos;\n\t\t\t\t\t$scope.totalconforme = results.rows.item(0).totalconforme;\n\t\t\t\t\t$scope.totalnaoconforme = results.rows.item(0).totalnaoconforme;\n\t\t\t\t\t$scope.totalnaoseaplica = results.rows.item(0).totalnaoseaplica;\n\t\t\t\t\t$scope.total_para_servidor = totalparaatualizar;\n\t\t\t\t\t$scope.total_fotos_para_servidor = totalfotosparaatualizar;\n\t\t\t\t\t$scope.$apply();\n\t\t\t\t},\n\t\t\t\tfunction(a,b) {\n\t\t\t\t\talert(b.message);\n\t\t\t\t}\n\t\t\t\t);\n\t\t\t});\n\t\t}", "function mostrarRegistrarseComoColaborador(){\n mostrarComo('colaborador')\n}", "function mostrarCarritoRecuperado()\n{\n for (const precio of carritoRecuperado)\n {\n precioRecuperado = precio.precio + precioRecuperado;\n }\n $(\"#precioDelCarrito\").text(`Total: $${precioRecuperado}`);\n\n// SI HAY ITEMS EN EL CARRITO, MUESTRA PRODUCTOS\n for (const nombre of carritoRecuperado)\n {\n listaRecuperada.push(nombre.nombre+\"<br>\");\n }\n $(\"#productosEnCarrito\").append(listaRecuperada);\n\n// VUELVO A PUSHEAR LOS ITEMS EN EL CARRITO\n for (const item of carritoRecuperado)\n {\n carrito.push(item);\n }\n\n// ACTUALIZO EL CONTADOR DEL CARRITO\n contadorCarrito();\n\n}", "function carregaNacionalidades() {\n\n\t\tnacionalidadeService.findAll().then(function(retorno) {\n\n\t\t\tcontroller.nacionalidades = angular.copy(retorno.data);\n\n\t\t\tnewOption = {\n\t\t\t\tid : \"\",\n\t\t\t\tdescricao : \"Todas\"\n\t\t\t};\n\t\t\tcontroller.nacionalidades.unshift(newOption);\n\n\t\t});\n\n\t}", "function agregar() { \n \n // Máximo pueden haber 4 personas a cargo\n if (props.personasaCargo.length < 4){ \n let result = [...props.personasaCargo];\n result.push([,\"\", \"\",])\n cambiarPersonasaCargo(result);\n }\n }", "function registrar_esquema_comision(){\n\t\tenviarFormulario(\"#form_esquema_comision_registrar\", 'EsquemaComision/registrar_esquema_comision', '#cuadro2');\n\t}", "function pegasecoes(codigopai, acao) {\n\t\t\tdb.transaction(function(tx) {\n\t\t\t\ttx.executeSql(\"select codigo, ifnull(entidade,0) entidade from checklist_gui cg where token=? and secaopai=? and tipo='secao' \", [$scope.token, codigopai],\n\t\t\t\tfunction(tx, results) {\n\t\t\t\t\tfor (var i=0; i < results.rows.length; i++) {\n\t\t\t\t\t\tvar codigosecao = results.rows.item(i).codigo;\n\t\t\t\t\t\tvar entidadesecao = results.rows.item(i).entidade;\n\t\t\t\t\t\tpegasecoes(codigosecao, entidadesecao, acao);\n\t\t\t\t\t\tif (acao == 'contar') {\n\t\t\t\t\t\t\tcontaItensSecao(codigosecao,entidadesecao);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (acao == 'deletar') {\n\t\t\t\t\t\t\tapagaItensSecao(codigosecao, entidadesecao)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tfunction(a,b) {\n\t\t\t\t\talert(b.message);\n\t\t\t\t}\n\t\t\t\t);\n\t\t\t});\n\t\t}", "async busca_todos_os_dados( caminhoes ){\n const caminhoes_c_dados = Promise.all(\n caminhoes.map( async (item) => {\n\n const caminhao = await connection('fDescarregamento')\n .select('*')\n .where( 'ID', '=', item.ID );\n\n if ( caminhao.length > 0 ){\n const [{ Status, Chegada, Saida, Peso_chegada, Peso_saida, Assinaturas }] = caminhao;\n\n return { ...item, Status, Chegada, Saida, Peso_chegada, Peso_saida, Assinaturas: JSON.parse( Assinaturas ) };\n } else return item;\n\n })\n );\n\n return caminhoes_c_dados;\n }", "function cargaDatos(){\n\tdb.transaction(cargaRegistros, errorDB);\n}", "async somaDespesasCategoria(Request, Response){\n pool.connect(async function (err, client, done){\n\n const { mes } = Request.body\n const userId = Request.headers.authorization;\n \n const despesas = await client.query(\"select c.nome, sum(d.valor) as soma from despesas d inner join categoria c using (id_categoria) where Extract('Month' From _data) = $1 and id_usuario = $2 and d.id_categoria = c.id_categoria group by c.nome;\", [mes, userId]);\n \n done();\n\n return Response.json(despesas.rows);\n });\n }", "function cargarEventos()\n{\n\n obtenerNoticiasPorCategoria(\"Eventos\", 5);\n\n}", "function MostrarRegistro(){\n //declaramos una variable para guardar los datos\n var listaproductos=Mostrar();\n //selecciono el tbody de la tabla donde voy a guardar\n tbody = document.querySelector(\"#tbRegistro tbody\");\n tbody.innerHTML=\"\";\n //Agregamos las columnas que se registren\n for(var i=0; i<listaproductos.length;i++){\n //Declaramos una variable para la fila\n var fila=tbody.insertRow(i);\n //declaramos variables para los titulos\n var titulonombre = fila.insertCell(0);\n var tituloprecio = fila.insertCell(1);\n var titulocategoria = fila.insertCell(2);\n var titulocantidad = fila.insertCell(3);\n //agregamos valores\n titulonombre.innerHTML = listaproductos[i].nombre;\n tituloprecio.innerHTML = listaproductos[i].precio;\n titulocategoria.innerHTML = listaproductos[i].categoria;\n titulocantidad.innerHTML = listaproductos[i].cantidad;\n tbody.appendChild(fila);\n }\n}", "function accionCrear()\n\t{\n\n//\t\talert(\"accionCrear\");\n\t\tif(listado1.datos.length != 0)\n\t\t{\n\t\t\tvar orden = listado1.codSeleccionados();\n//\t\t\talert(\"Linea seleccionada \" + orden);\n\t\t\tset('frmPBuscarTiposError.hidOidCabeceraMatrizSel', orden);\n\t\t\tset('frmPBuscarTiposError.accion', 'crear');\n\t\t\tenviaSICC('frmPBuscarTiposError');\n\n\t\t}else\n\t\t{\n\t\t\talert(\"no hay seleccion: \" + listado1.datos.length);\n\t\t}\n\t}", "buscarEvento(req, res) {\n let params = req.body;\n const idQueLlega = params._id;\n console.log('idQueLlega');\n console.log(params);\n evento_modelo_1.Evento.findById(idQueLlega).then((eventosDB) => {\n console.log(eventosDB);\n if (!eventosDB) {\n return res.status(200).send({\n status: 'error',\n mensaje: 'Búsqueda fallida'\n });\n }\n const eventosQueDevuelvo = new Array();\n eventosQueDevuelvo.push(eventosDB);\n console.log(eventosQueDevuelvo);\n res.status(200).send({\n status: 'ok',\n mensaje: 'Búsqueda de eventos exitosa',\n evento: eventosQueDevuelvo,\n token: token_1.default.generaToken(eventosQueDevuelvo)\n });\n });\n }", "async function agregarProducto(producto) {\n try {\n let conn = await mariaDb.getConn();\n const resp = await conn.query(\"insert into producto (nombre, porcentaje_ganancia, precio, cantidad, id_categoria) values ( ?, ?, ?, ?, ?);\", [producto.nombre, Number(producto.porcentaje), Number(producto.precio), Number(producto.cantidad), Number(producto.categoria)]);\n conn.release();\n\n if (resp.affectedRows > 0){\n return {estado:'correcto', mensaje: 'Se agrego correctamente'};\n }else {\n return {estado:'Fallo', mensaje: 'No se agrego'};\n }\n\n } catch (err) {\n console.log(err);\n return null;\n }\n}", "function comprar() {\r\n const seleccionado = productos.find(producto => producto.id == this.id);\r\n\r\n if (carrito.includes(seleccionado)) {\r\n seleccionado.agregarCantidad(1);\r\n \r\n } else {\r\n carrito.push(seleccionado);\r\n seleccionado.agregarCantidad(1);\r\n }\r\n\r\n seleccionado.stock -=1;\r\n\r\n \r\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\r\n interfazCarrito(carrito);\r\n}", "function addCantidad() {\n let curso = carrito.find(c => c.id == this.id);\n curso.agregarCantidad(1);\n $(this).parent().children()[1].innerHTML = curso.cantidad;\n $(this).parent().children()[2].innerHTML = curso.subtotal();\n\n//GUARDAR EN STORAGE\nlocalStorage.setItem(\"carrito\", JSON.stringify(carrito));\n}", "function adicionar() {\r\n \t\t\t$scope.view.selectedItem.tituloC = $scope.titulo.id;\r\n \t\t\tif($scope.result != null)\r\n \t\t\t\t$scope.view.selectedItem.imagem = $scope.result.substr(22, $scope.result.length);\r\n \t\t\tCapituloCCreateFactory.create($scope.view.selectedItem).$promise.then(function(data) {\r\n \t \t\t$scope.view.dataTable.push(data);\r\n \t\t\t\t$mdDialog.hide('O capitulo adicionado com sucesso.');\r\n \t \t}, function() {\r\n \t \t\t$mdDialog.hide('O capitulo já foi gravado ou ocorreu algum erro.');\r\n \t \t});\t \t\r\n \t\t}", "function agregarPendientes(QueContacta,Contactado,idContacto,atendido){\n var nombreQueContacta;\n var numeroQueContacta;\n var nombreContactado;\n var numeroContactado;\n if(QueContacta && Contactado && !atendido){\n var userQueContacta = refUser.doc(QueContacta);\n userQueContacta.get().then(function(doc) {\n if (doc.exists) {\n nombreQueContacta = doc.data().nombre + doc.data().apellido;\n numeroQueContacta = doc.data().numTelefono;\n console.log(\"Document data:\", doc.data());\n } else {\n // doc.data() will be undefined in this case\n console.log(\"No such document!\");\n }\n }).catch(function(error) {\n console.log(\"Error getting document:\", error);\n });\n\n // obteniendo datos del usuario\n var userContactado = refUser.doc(Contactado);\n userContactado.get().then(function(doc) {\n if (doc.exists) {\n nombreContactado = doc.data().nombre + doc.data().apellido;\n numeroContactado = doc.data().numTelefono;\n\n // colocamos aqui esta inserción de datos por que la funcion es asincrona y nodara udifined\n document.getElementById('tablaNotificaciones').innerHTML += `\n <tr>\n <td scope=\"col\">${nombreQueContacta}</td>\n <td scope=\"col\">${numeroQueContacta}</td>\n <td scope=\"col\">${nombreContactado}</td>\n <td scope=\"col\">${numeroContactado}</td>\n <td scope=\"col\">\n <button onclick=\"si_contacto('${idContacto}')\" type=\"button\" name=\"button\">Si</button>\n <button onclick=\"no_contacto('${idContacto}')\" type=\"button\" name=\"button\">Cancelar</button>\n </td>\n </tr>\n `;\n console.log(\"Document data:\", doc.data());\n } else {\n // doc.data() will be undefined in this case\n console.log(\"No such document y o ya esta atendido\");\n }\n }).catch(function(error) {\n console.log(\"Error getting document:\", error);\n });\n }else{\n console.log(\"error al consegir datos de contacto funcntion ver_notificacion() quizas Contacdato este vacio XD\");\n }\n}", "function agregarGuiasRelacion(codigoGuiarem,serie,numero,color){\n\t\t\n\t\tvar total=$('input[id^=\"accionAsociacionGuiarem\"][value!=\"0\"]').length;\n\t\tn = document.getElementById('idTableGuiaRelacion').rows.length;\n\t\t\n\t\tif(total==0){\n\t\t\t/***mmostramos el div tr de guias relacionadas**/\n\t\t\t$(\"#idDivGuiaRelacion\").show(200);\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tproveedor=$(\"#proveedor\").val();\n\t\tj=n;\n\t\tfila='<tr id=\"idTrDetalleRelacion_'+j+'\">';\n\t\tfila+='<td>';\n\t\tfila+='<a href=\"javascript:void(0);\" onclick=\"deseleccionarGuiaremision('+codigoGuiarem+','+j+')\" title=\"Deseleccionar Guia de remision\">';\n\t\tfila+='x';\n\t\tfila+='</a>';\n\t\tfila+='</td>';\n\t\tfila+='<td>'+j+'</td>';\n\t\tfila+='<td>'+serie+'</td>';\n\t\tfila+='<td>'+numero+'</td>';\n\t\t/**accionAsociacionGuiarem nuevo:1**/\n\t\tfila+='<td><div style=\"width:10px;height:10px;background-color:'+color+';border:1px solid black\"></div>';\n\t\tfila+='\t<input type=\"hidden\" id=\"codigoGuiaremAsociada['+j+']\" name=\"codigoGuiaremAsociada['+j+']\" value=\"'+codigoGuiarem+'\" />';\n\t\tfila+='<input type=\"hidden\" id=\"accionAsociacionGuiarem['+j+']\" name=\"accionAsociacionGuiarem['+j+']\" value=\"1\" />';\n\t\tfila+='<input type=\"hidden\" id=\"proveedorRelacionGuiarem['+j+']\" name=\"proveedorRelacionGuiarem['+j+']\" value=\"'+proveedor+'\" />';\n\t\tfila+='</td>';\n\t\tfila+='</tr>';\n\t\t$(\"#idTableGuiaRelacion\").append(fila);\n\t\t \n\t}", "function reservacion2(completo,\n {\n metodoPago='efectivo',\n cantidad=0,\n dias=0\n }={})\n {\n console.log(metodoPago);\n console.log(cantidad);\n console.log(dias);\n }", "function insertData(user,giorno,pasto,menu_giorno,pasto_scelto) {\n //crea un user\n user.create({\n first_name: 'Rossi',\n last_name: 'Mario'\n });\n //crea giorni\n giorno.create({\n nome_giorno: 'lun'\n });\n giorno.create({\n nome_giorno: 'mar'\n });\n giorno.create({\n nome_giorno: 'mer'\n });\n giorno.create({\n nome_giorno: 'gio'\n });\n giorno.create({\n nome_giorno: 'ven'\n });\n giorno.create({\n nome_giorno: 'sab'\n });\n giorno.create({\n nome_giorno: 'dom'\n });\n\n //crea pasti\n //crea parimi\n pasto.create({\n nome_pasto: 'Pasta al pomodoro',\n tipo: 'primo',\n dettagli: 'Scaldate in una casseruola un velo di olio con uno spicchio di aglio sbucciato. Unite i pomodori non appena l\\'aglio comincia a sfrigolare. Aggiungete quindi una generosa presa di sale. Completate con un ciuffetto di basilico e mescolate; cuocete senza coperchio per 10 circa.'\n });\n pasto.create({\n nome_pasto: 'Pasta con la ricotta in bianco',\n tipo: 'primo',\n dettagli: 'La pasta con la ricotta in bianco è un esempio di come possa essere facile e veloce preparare un piatto di pasta veramente buono.'\n });\n pasto.create({\n nome_pasto: 'Minestrone',\n tipo: 'primo',\n dettagli: 'Il minestrone di verdure è un primo piatto salutare, di semplice ma lunga realizzazione, per via della pulizia e del taglio delle molte verdure!'\n });\n pasto.create({\n nome_pasto: 'Risotto',\n tipo: 'primo',\n dettagli: 'Il risotto è un primo piatto tipico della cucina italiana, diffuso in numerose versioni in tutto il paese anche se più consumato al nord.'\n });\n pasto.create({\n nome_pasto: 'Lasagna',\n tipo: 'primo',\n dettagli: 'Le lasagne al forno sono costituite da una sfoglia di pasta madre, oggi quasi sempre all\\'uovo, tagliata in fogli grossolanamente rettangolari (losanghe), dette lasagna le quali, una volta bollite e scolate, vengono disposte in una sequenza variabile di strati, ognuno dei quali separato da una farcitura che varia in relazione alle diverse tradizioni locali.'\n });\n //create secondo\n pasto.create({\n nome_pasto: 'Bistecca alla Fiorentina',\n tipo: 'secondo',\n dettagli: 'La bistecca alla fiorentina è un taglio di carne di vitellone o di scottona che, unito alla specifica preparazione, ne fa uno dei piatti più conosciuti della cucina toscana. Si tratta di un taglio alto comprensivo dell\\'osso, da cuocersi sulla brace o sulla griglia, con grado di cottura \"al sangue\".'\n });\n pasto.create({\n nome_pasto: 'Salmone in crosta',\n tipo: 'secondo',\n dettagli: 'Il salmone in crosta con spinaci è una delle ricette tipiche della vigilia e di Capodanno: durante queste occasioni non potrà di certo mancare il salmone! '\n });\n pasto.create({\n nome_pasto: 'Pollo al forno',\n tipo: 'secondo',\n dettagli: 'Le cosce di pollo al forno sono un tipico secondo piatto della cucina italiana, un classico per gustare il pollo con contorno di patate!'\n });\n pasto.create({\n nome_pasto: 'Arrosto di lonza',\n tipo: 'secondo',\n dettagli: 'Tradizionale, genuino e ricco di gusto. La lonza arrosto al vino bianco è davvero un piatto che non può mancare nella vostra lista dei manicaretti casalinghi. '\n });\n //create contorno\n pasto.create({\n nome_pasto: 'Patatine fritte',\n tipo: 'contorno',\n dettagli: 'Patatine fritte'\n });\n pasto.create({\n nome_pasto: 'Patate al forno',\n tipo: 'contorno',\n dettagli: 'patate al forno'\n });\n pasto.create({\n nome_pasto: 'Carote',\n tipo: 'contorno',\n dettagli: 'Carote'\n });\n pasto.create({\n nome_pasto: 'Fagiolini',\n tipo: 'contorno',\n dettagli: 'Fagiolini'\n });\n pasto.create({\n nome_pasto: 'Insalata',\n tipo: 'contorno',\n dettagli: 'Insalata verde fresca'\n });\n\n //create dolce\n pasto.create({\n nome_pasto: 'Budino',\n tipo: 'dolce',\n dettagli: 'Il budino è composto da una parte liquida, generalmente costituita da latte, da zucchero e da vari ingredienti o aromi che gli danno il gusto desiderato: frutta, cioccolato, nocciole, caramello, liquori, vaniglia ed altri ancora. A questi si uniscono spesso degli ingredienti che servono a legare il composto, cioè a renderlo più corposo e solido.'\n });\n pasto.create({\n nome_pasto: 'Yogurt',\n tipo: 'dolce',\n dettagli: 'Yogurt con tanti gusti'\n });\n pasto.create({\n nome_pasto: 'Frutta',\n tipo: 'dolce',\n dettagli: 'Frutta fresca'\n });\n pasto.create({\n nome_pasto: 'Crostata',\n tipo: 'dolce',\n dettagli: 'La crostata è un dolce tipico italiano basato su un impasto di pasta frolla coperto con confettura, crema o frutta fresca. Dolci simili sono diffusi in tutta Europa.'\n });\n\n //inserire menu_giorno in modo casuale\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 1\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 2\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 3\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 4\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 5\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 6\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 7\n });\n }\n }\n}", "function agregarAlCarrito() {\n /* Función que agrega un producto al carrito. utiliza el atributo \"alt\" del botón clickeado para obtener el código del producto a agregar. Cada vez que se agrega un producto se vuelve a generar la tabla que se muestra en pantalla.*/\n var elCodigo = $(this).attr(\"alt\");\n var laPosicion = buscarCodigoProducto(elCodigo);\n var productoAgregar = listadoProductos[laPosicion];\n carrito[carrito.length] = productoAgregar;\n armarTablaCarrito();\n }", "function crearItem(producto, precio) {\n let item = {\n producto: producto,\n precio: precio,\n };\n pedidosPorMesa[mesaSeleccionada].push(item);\n return item;\n}", "function busca(busca) {\n $.ajax({\n type: \"POST\",\n url: \"acoes/select.php\",\n dataType: \"json\",\n data: {//tipo de dado\n 'busca':\"busca\"//botão pra inicia a ação\n }\n\n }).done(function (resposta) { //receber a resposta do busca\n console.log('encontrei ' + resposta.quant + ' registros');\n console.log(resposta.busca[0,'0'].id, resposta.busca[0,'0'].descri);\n if(resposta.erros){\n\n //criação das variaves apos o receber a resposta da pagina select\n for (let i = 0; i < resposta.quant; i++) {\n var id = resposta.busca[i]['0']\n var desc = resposta.busca[i]['1']\n var mar = resposta.busca[i]['2']\n var mod = resposta.busca[i]['3']\n var tpv = resposta.busca[i]['4']\n var qntp = resposta.busca[i]['5']\n var vlv = resposta.busca[i]['6']\n var vlc = resposta.busca[i]['7']\n var dtc = resposta.busca[i]['8']\n var st = resposta.busca[i]['9']\n //criação da tabela para exebição do resultado\n $('.carro td.descri').append(\" <tr><td ><p class=' text-capitalize id='des' value='\"+desc+\"'>\"+desc +'</p></td></tr>')\n $('.carro td.marca').append(\" <tr><td ><p class=' text-capitalize id='mar' value='\"+mar+\"'>\"+mar +'</p></td></tr>')\n $('.carro td.modelo').append(\" <tr><td ><p class=' text-capitalize id='mod' value='\"+mod+\"'>\"+mod +'</p></td></tr>')\n $('.carro td.tipov').append(\" <tr><td ><p class=' text-capitalize id='tpv' value='\"+tpv+\"'>\"+tpv +'</p></td></tr>')\n $('.carro td.quantp').append(\" <tr><td ><p class=' text-capitalize id='qnt' value='\"+qntp+\"'>\"+qntp +'</p></td></tr>')\n $('.carro td.vlvenda').append(\" <tr><td ><p class=' text-capitalize id='vlv' value='\"+vlv+\"'>\"+vlv +'</p></td></tr>')\n $('.carro td.vlcompra').append(\" <tr><td ><p class=' text-capitalize id='vlc' value='\"+vlc+\"'>\"+vlc +'</p></td></tr>')\n $('.carro td.dtcompra').append(\" <tr><td ><p class=' text-capitalize id='dtc' value='\"+dtc+\"'>\"+dtc +'</p></td></tr>')\n $('.carro td.estato').append(\" <tr><td ><p class=' text-capitalize id='st' value='\"+st+\"'>\"+st +'</p></td></tr>')\n $('.carro td.id').append(\" <tr><td ><button class='r btn btn-sm btn-primary nav-link' id='idvalor' type='button' data-toggle='modal' data-target='#atualFormulario' value='\"+id+\"'>\"+\"Edit\"+'</button></td></tr>')\n $('.carro td.ider').append(\"<tr><td ><button class='del btn btn-sm btn-danger nav-link' type='button' name='idel' value='\"+id+\"'>\"+\"Del\"+'</button></td></tr>')\n\n\n }\n\n\n //função pra por valores da tabela no input do formulario de atualização\n //aqui insere os o ID no formulario de atualização\n $('.r').click('button',function() {\n var idvl = $(this).val();\n $('#i1'). val(idvl);\n for (let i = 0; i < resposta.quant; i++) {\n var id = resposta.busca[i]['0']\n var desc = resposta.busca[i]['1']\n var mar = resposta.busca[i]['2']\n var mod = resposta.busca[i]['3']\n var tpv = resposta.busca[i]['4']\n var qnt = resposta.busca[i]['5']\n var vlv = resposta.busca[i]['6']\n var vlc = resposta.busca[i]['7']\n var dtc = resposta.busca[i]['8']\n var sta = resposta.busca[i]['9']\n //aqui comparamos o valor que recuperamos o id da tabela e comparfamos com o id da função busca\n if (idvl==id) {\n $('#descri1'). val(desc);\n $('#marca1'). val(mar);\n $('#modelo1'). val(mod);\n $('#tipov1'). val(tpv);\n $('#quantp1'). val(qnt);\n $('#vlvenda1'). val(vlv);\n $('#vlcompra1'). val(vlc);\n $('#dtcompra1'). val(dtc);\n $('#estato1'). val(sta);\n console.log(idvl);\n\n }\n\n\n\n\n\n }\n })\n //aqui finda\n\n //deleta via ajax\n $('.del').click('button',function() {\n var idel = $(this).val();\n console.log(idel);\n $.ajax({\n url: \"acoes/del.php\",\n type: \"POST\",\n data : { 'idel': idel },\n success: function(data)\n {\n location.reload(\".carro\");//atualiza o contener apos a execução com sucesso\n }\n });\n }); // delete close\n\n\n }\n })\n }", "async cadastroParametroFormaPagamento(req, res) {\n\n const parametroFormaPagamento = \"INSERT INTO parametro_forma_pagamento (descricao, status) VALUES ('\"+req.body.descricao+\"', '\"+req.body.status+\"'\"+\");\"\n db.query(parametroFormaPagamento);\n \n return res.json('Parametros Forma Pagamento cadastrados com sucesso!');\n\n }", "function pesquisarCategoria() {\n apiService.get('/api/produtopromocional/fornecedorcategoria', null,\n categoriaLoadCompleted,\n categoriaLoadFailed);\n }", "function insertarCarrito(curso) {\n const fragment = document.createDocumentFragment();\n const row = document.createElement('tr');\n row.innerHTML = `\n <td> <img src=\"${curso.imagen}\" width=120 /> </td>\n <td class=\"titulo\">${curso.titulo}</td>\n <td>${curso.precio}</td>\n <td> <a href=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">x</a> </td>\n `;\n fragment.appendChild(row);\n listaCursos.appendChild(fragment);\n\tguardarCursoLocalStorage(curso);\n\tcantidad(2);\n\talert.textContent=\"Curso agregado\";\n\talert.style.backgroundColor=\"green\";\n\talert.classList.add('alertAnim');\n\tsetTimeout(()=>{\n\t\talert.classList.remove('alertAnim');\n\t}, 1500);\n\treturn true;\n}", "function agregar_nuevo_producto(item_nuevo){\r\n //ALERTA DE CONFIRMACION QUE SE AGREGO UN NUEVO PRODUCTO\r\n const alert = document.querySelector('.alert');\r\n setTimeout(function(){\r\n alert.classList.add('hide')\r\n }, 2000)\r\n alert.classList.remove('hide')\r\n //AGREGANDO NUEVO ELEMENTO AL CARRITO\r\n const input_elemento = tbody.getElementsByClassName('input_elemento')\r\n for (let i =0; i< carrito.length; i++){\r\n if (carrito[i].nombre.trim() === item_nuevo.nombre.trim()){\r\n carrito[i].cantidad ++;\r\n const valor = input_elemento[i]\r\n valor.value++;\r\n total_carrito()\r\n return null;\r\n };\r\n };\r\n carrito.push(item_nuevo);\r\n tabla_carrito();\r\n}", "function mostrarRegistrarseComoOrganizacion(){\n mostrarComo('organizacion')\n}", "function GroupByProduto() {\n VendasModel.aggregate([\n {\n $group: {\n _id: '$produto_codigo',\n produto_descricao: {$first: '$produto_descricao'},\n total_de_vendas: {$sum: '$venda_valor_total'},\n quantidade_pedidos: { $sum: 1 }\n }\n },\n {\n $sort: { 'total_de_vendas': -1 }\n }\n ], (err, data) => {\n if (err) return res.json(err)\n return res.json(data)\n })\n }", "formata_dados( resposta_HANA ){\n const reducer = (r, row) => {\n const key_caminhao = `${row.ID} - ${row.Unidade} - ${row.Nome} - ${row.Placa} - ${row.Transportadora} - ${row.Modal} - ${row.Dia}`;\n const key_entrega = `${row.Item_pedido} - ${row.Cod_Material} - ${row.Material} - ${row.Remessa} - ${row.Dia} - ${row.N_nota_fiscal} - ${row.Peso}`;\n\n const caminhoes = {\n ID: parseInt(row.ID),\n Unidade: row.Unidade,\n Nome: row.Nome,\n Placa: row.Placa,\n Transportadora: row.Transportadora,\n Modal: row.Modal,\n Dia: row.Dia,\n Material: row.Material,\n Materiais: {}\n };\n\n r[key_caminhao] = r[key_caminhao] || caminhoes;\n\n const entregas = {\n Item_pedido: row.Item_pedido,\n Cod_Material: row.Cod_Material,\n Material: row.Material,\n Remessa: row.Remessa,\n Dia: row.Dia,\n N_nota_fiscal: row.N_nota_fiscal,\n Peso: parseInt(row.Peso.replace('.', ''))\n };\n\n r[key_caminhao]['Materiais'][key_entrega] = r[key_caminhao]['Materiais'][key_entrega] || entregas;\n\n return r;\n };\n\n const organizado = resposta_HANA.reduce( (r, row) => reducer(r, row), {});\n\n const obj_organizado = Object.values(organizado);\n\n const obj_organizado_2 = obj_organizado.map( item => {\n item['Materiais'] = Object.values(item['Materiais']);\n\n return item\n });\n\n return obj_organizado_2;\n }", "function buscarProjeto(idProjeto) {\n\n // atribuir a variavel projetoEncontrado o retorno do filtro\n // projeto é cada posição do array que o filtro vai acessar para buscar nossa condição\n // return é o resultado da nossa condicao\n\n // tambem poderiamos usar o metodo find\n\n /*let projetoEncontrado = listaDeProjetos.filter(function (projeto){\n return projeto.idProjeto === idProjeto;\n });*/\n let projetoEncontrado = listaDeProjetos.find(function (projeto){\n return projeto.idProjeto === idProjeto;\n });\n\n if(projetoEncontrado !== undefined){\n return projetoEncontrado;\n } else {\n return `Projeto nao encontrado`;\n }\n}", "function fAgregar(){\n if (cPermisoPag != 1){\n fAlert(\"No tiene Permiso de ejecutar esta acción\");\n return;\n }\n\n if(lBandera == true){\n fAlert(\"No puede efectuar esta operación mientras se encuentre realizando otra transacción\");\n return;\n }\n frm.iCveSistema.value = \"\";\n frm.hdCveModulo.value = \"\";\n frm.iNumReporte.value = \"\";\n\n aDocDisp = FRMListadoA.fGetObjs(0);\n\n for(cont=0;cont < aDocDisp.length;cont++){\n if(aDocDisp[cont]){\n if (frm.iCveSistema.value==\"\") frm.iCveSistema.value=aResTemp[cont][0]; else frm.iCveSistema.value+=\",\"+aResTemp[cont][0];\n if (frm.hdCveModulo.value==\"\") frm.hdCveModulo.value=aResTemp[cont][1]; else frm.hdCveModulo.value += \",\" + aResTemp[cont][1];\n if (frm.iNumReporte.value==\"\" ) frm.iNumReporte.value=aResTemp[cont][2]; else frm.iNumReporte.value+=\",\"+aResTemp[cont][2];\n }\n }\n\n if (frm.iCveSistema.value == \"\"){\n fAlert ('\\nSeleccione al menos un registro para hacer esta operación.');\n return;\n }\n\n\n frm.hdBoton.value = \"Guardar\";\n frm.hdFiltro.value = \"\";\n if(fEngSubmite(\"pgGRLReporteA.jsp\",\"idAgrega\")){\n FRMPanel.fSetTraStatus(\"UpdateComplete\");\n fDisabled(true);\n FRMListado.fSetDisabled(false);\n }\n\n fCargaListadoA();\n}", "async index(req, res){\n const {postId} = req.params;\n const postagem = await Postagem.findByPk(postId);\n if(!postagem){\n return res.status(404).send({erro: \"Solicitação não encontrada\"});\n }\n const comentarios = await postagem.getComentarios({\n include: {\n association: \"Cliente\",\n as: \"cliente\",\n attributes: [\"id\", \"nome\", \"email\", \"celular\"],\n },\n attributes: [\"id\", \"descricao\", \"created_at\"],\n order: [[\"created_at\", \"ASC\"]]\n });\n res.send(comentarios);\n }", "function AgregarUsuario(admin)\n{ \n var form;\n form='<div class=\"EntraDatos\">';\n form+='<table>';\n form+='<thead>';\n form+='<tr><th colspan=\"2\">'; \n form+='Nuevo Usuario'; \n form+='</th></tr>'; \n form+='</thead>'; \n form+='<tbody>';\n form+='<tr>';\n form+='<td width=\"50%\">'; \n form+='<label>Cédula de Identidad:</label>';\n form+='<input type=\"text\" id=\"CI\" class=\"Editable\" tabindex=\"1000\" title=\"Introduzca el Número de Cédula\"/>';\n form+='<input type=\"button\" onclick=\"javascript:BuscarUsuario()\" tabindex=\"1001\" title=\"Buscar\" value=\"Buscar\"/>';\n form+='</td>';\n form+='<td>';\n form+='<label>Correo Electrónico:</label>';\n form+='<input type=\"text\" class=\"Campos\" id=\"Correo\" title=\"Correo Electrónico\" readonly=\"readonly\"/>';\n form+='</td>';\n form+='</tr>';\n form+='<tr>';\n form+='<td>';\n form+='<label>Nombre:</label>';\n form+='<input type=\"text\" class=\"Campos\" id=\"Nombre\" title=\"Nombre\" readonly=\"readonly\"/>';\n form+='</td>';\n form+='<td>';\n form+='<label>Apellido:</label>';\n form+='<input type=\"text\" class=\"Campos\" id=\"Apellido\" title=\"Apellido\" readonly=\"readonly\"/>';\n form+='</td>';\n form+='</tr>'; \n form+='<tr>';\n form+='<td colspan=\"2\">';\n form+='<input type=\"hidden\" id=\"id_unidad\" />'; \n form+='<label>Unidad Administrativa:</label>';\n form+='<center><input type=\"text\" class=\"Campos Editable\" id=\"Unidad\" title=\"Unidad Administrativa\" tabindex=\"1002\"/></center>';\n form+='</td>'; \n form+='</tr>';\n form+='<tr>';\n form+='<td>';\n form+='<label>Nivel de Usuario:</label>';\n form+='<select class=\"Campos Editable\" id=\"Nivel\" title=\"Seleccione el Nivel del Usuario\" tabindex=\"1003\">';\n form+='<option selected=\"selected\" value=\"0\">[Seleccione]</option>';\n form+='</select>';\n form+='</td>';\n form+='<td>';\n if (admin==1)\n {\n form+='<label>Rol de Usuario:</label>';\n form+='<div class=\"ToggleBoton\" onclick=\"javascript:ToggleBotonAdmin()\" title=\"Haga clic para cambiar\">';\n form+='<img id=\"imgAdmin\" src=\"imagenes/user16.png\"/>';\n form+='</div>';\n form+='<span id=\"spanAdmin\">&nbsp;Usuario Normal</span>'; \n }\n form+='<input type=\"hidden\" id=\"hideAdmin\" value=\"f\" />'; \n form+='</td>';\n form+='</tr>'; \n form+='</tbody>';\n \n form+='<tfoot>';\n form+='<tr><td colspan=\"2\">';\n form+='<div class=\"BotonIco\" onclick=\"javascript:GuardarUsuario()\" title=\"Guardar Usuario\">';\n form+='<img src=\"imagenes/guardar32.png\"/>&nbsp;'; \n form+='Guardar';\n form+= '</div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';\n form+='<div class=\"BotonIco\" onclick=\"javascript:CancelarModal()\" title=\"Cancelar\">';\n form+='<img src=\"imagenes/cancel.png\"/>&nbsp;';\n form+='Cancelar';\n form+= '</div>';\n form+='</td></tr>';\n form+='</tfoot>';\n form+='</table>'; \n form+='</div>';\n $('#VentanaModal').html(form);\n $('#VentanaModal').show(); \n $('#CI').focus();\n \n selector_autocompletar(); \n}", "function cargarHistorialObra(req, res) {\n //Asocio la obra social al paciente\n Historial_paciente.findById(req.params.idPaciente, function (err, historial) {\n if (err) {\n return res.status(400).json({\n title: 'An error occurred',\n error: err\n });\n }\n if (!historial) {\n return res.status(404).json({\n title: 'Error',\n error: 'historial no encontrado'\n });\n }\n historial.obras.push(req.params.idObra);\n\n historial.save().then(function (historial) {\n res.status(200).json({\n message: 'Success',\n obj: historial\n });\n }, function (err) {\n return res.status(404).json({\n title: 'Error',\n error: err\n });\n });\n });\n}", "function meuEscopo(){ // tudo que estiver aqui dentro estara protegido\n \n let form=document.querySelector('.formulario'); // usando a classe\n let resultado=document.querySelector('.resultado'); \n\n let pessoas=[];\n\n\n function recebeEventoForm (evento){\n evento.preventDefault();\n\n let nome=document.querySelector(`.nome`);\n let sobrenome=document.querySelector(`.sobrenome`);\n let idade=document.querySelector(`.idade`);\n let peso=document.querySelector(`.peso`);\n let altura=document.querySelector(`.altura`);\n\n //console.log(nome,sobrenome,altura, peso, idade);\n pessoas.push({nome:nome.value,sobrenome:sobrenome.value,peso:peso.value,idade:idade.value,altura:altura.value});\n \n resultado.innerHTML += `<p>${nome.value} - ${sobrenome.value} - ${idade.value} - ${peso.value} - ${altura.value}</p>`;\n console.log(pessoas);\n }\n\n form.addEventListener('submit', recebeEventoForm);\n}", "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 asociarCursosCarrera() {\n let codigoCarrera = guardarCarreraAsociar();\n\n let carrera = buscarCarreraPorCodigo(codigoCarrera);\n\n let cursosSeleccionados = guardarCursosAsociar();\n\n\n\n let listaCarrera = [];\n\n let sCodigo = carrera[0];\n let sNombreCarrera = carrera[1];\n let sGradoAcademico = carrera[2];\n let nCreditos = carrera[3];\n let sVersion = carrera[4];\n let bAcreditacion = carrera[5]\n let bEstado = carrera[6];\n let cursosAsociados = cursosSeleccionados;\n let sedesAsociadas = carrera[8];\n\n if (cursosAsociados.length == 0) {\n swal({\n title: \"Asociación inválida\",\n text: \"No se le asignó ningun curso a la carrera.\",\n buttons: {\n confirm: \"Aceptar\",\n },\n });\n } else {\n listaCarrera.push(sCodigo, sNombreCarrera, sGradoAcademico, nCreditos, sVersion, bAcreditacion, bEstado, cursosAsociados, sedesAsociadas);\n actualizarCarrera(listaCarrera);\n\n swal({\n title: \"Asociación registrada\",\n text: \"Se le asignaron cursos a la carrera exitosamente.\",\n buttons: {\n confirm: \"Aceptar\",\n },\n });\n limpiarCheckbox();\n }\n}", "function irAAgregarMaestro(){\r\n\tvar msg = \"Desea Agregar un NUEVO REGISTRO?.. \";\r\n\tif(confirm(msg)) Cons_maestro(\"\", \"agregar\",tabla,titulo);\r\n}", "busqueda(termino, parametro) {\n // preparacion de variables //\n // ------ Uso de la funcion to lower case [a minusculas] para evitar confuciones en el proceso\n // ------/------ La busqueda distingue mayusculas de minusculas //\n termino = termino.toLowerCase();\n parametro = parametro.toLowerCase();\n // variable busqueda en la que se almacenara el dato de los usuarios que se buscara //\n var busqueda;\n // [Test] variable conteo para registar el numero de Usuarios que coinciden con la busqueda //\n var conteo = +0;\n // Se vacia el conjunto de objetos [users] para posteriormente rellenarlos con los usuarios que coincidan con la busqueda //\n this.users = [], [];\n // [forEach] = da un recorrido por los objetos de un conjunto en este caso, selecciona cada usuario del conjunto \"usuarios\" //\n this.usuarios.forEach(item => {\n // Bifurcador de Seleccion [switch] para detectar en que dato del usuario hacer la comparacion de busqueda //\n switch (parametro) {\n //------En caso de que se ingrese la opcion por defecto, es decir, no se haya tocado el menu de selecicon\n case 'null':\n {\n // Se hace un llamado a la funcion \"getUsers\" que carga los usuarios almacenados en el servidor //\n this.getUsers();\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion Nombre\n case 'nombre':\n {\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.nombre.replace(/ /g, '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion nombre: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion apellido\n case 'apellido':\n {\n console.log('entro en apellido...');\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.apellido.replace(/ /g, '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion apellido: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion cedula\n case 'cedula':\n {\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.cedula.replace('-', '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion cedula: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion cuenta\n case 'cuenta':\n {\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.cuenta.replace(/ /g, '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion nombre: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n //------ En caso de que se ingrese la opcion Buscar en Todo\n case 'todo':\n {\n // Se asigna a la variable \"busqueda\" el resultado del dato establecido dentro del objeto de \"usuarios\" ajustado a la forma optima para la busqueda //\n //------ Se realiza un replace para borrar los espacios y un toLowerCase para convertir los datos en minusculas //\n busqueda = item.nombre.replace(/ /g, '').toLowerCase() + item.apellido.replace(/ /g, '').toLowerCase() + item.cedula.replace('-', '').toLowerCase() + item.cuenta.replace(/ /g, '').toLowerCase();\n // Bifurcador para determinar que la variable \"busqueda\" contenga una o varias partes del termino a buscar //\n if (busqueda.indexOf(termino, 0) >= 0) {\n // En caso de que encuentre coincidencias dentro del conjunto de objetos, el objeto completo se almacena devuelta en la variable \"users\" //\n this.users.push(item);\n // [Test] aumento de 1 en la variable conteo para saber cuantos objetos coincidieron con la busqueda //\n conteo = conteo + 1;\n // [Test] impresion en la consola de los resultados de la comparacion de busqueda //\n console.log('<br> comprobacion nombre: ' + busqueda + ', termino: ' + termino);\n }\n // Se termina la Ejecucion del bifurcador Switch //\n break;\n }\n ;\n }\n // if (parametro == 'null') {\n // console.log('dentro de null');\n // this.getUsers();\n // this.test = 'Ingrese un Campo de busqueda!!..';\n // }\n // if (parametro == 'nombre') {\n // // preparacion de variables:\n // busqueda = item.nombre.replace(/ /g, '').toLowerCase();\n // if (busqueda.indexOf(termino, 0) >= 0) {\n // this.users.push(item);\n // conteo = conteo +1;\n // console.log('<br> comprobacion nombre: ' + busqueda + ', termino: ' + termino);\n // }\n // }\n // if (parametro == 'apellido') {\n // console.log('dentro de apellido');\n // }\n // if (parametro == 'cedula') {\n // console.log('dentro de cedula');\n // }\n // if (parametro == 'cuenta') {\n // console.log('dentro de cuenta');\n // }\n // if (parametro == 'todo') {\n // console.log('dentro de todo');\n // }\n });\n if (this.users.length >= 1) {\n console.log('existe algo.... Numero de Registros: ' + conteo);\n return;\n }\n else if (this.users.length <= 0) {\n this.getUsers();\n }\n }", "async agregar(encargado) {\n try {\n const db = await this.conexion.conectar();\n const collection = db.collection('Encargados');\n const insertOneResult = await collection.insertOne(encargado);\n await this.conexion.desconectar();\n }\n catch (e) {\n throw e;\n }\n }", "function guardarCursosAsociar() {\n\n let listaCheckboxCursos = document.querySelectorAll('#tblCursos tbody input[type=checkbox]:checked');\n let cursosSeleccionados = [];\n let codigoCurso;\n\n //Este ciclo for debe empezar en 1, ya que en el cero \"0\" se encuentra el id unico del elemento al que se le desea agregar elementos\n for (let i = 0; i < listaCheckboxCursos.length; i++) {\n codigoCurso = listaCheckboxCursos[i].dataset.codigo;\n cursosSeleccionados.push(codigoCurso);\n }\n\n return cursosSeleccionados;\n\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}" ]
[ "0.67340124", "0.6665499", "0.64305824", "0.63836443", "0.6347343", "0.62406707", "0.62374985", "0.62332064", "0.62103367", "0.6160985", "0.6156094", "0.615274", "0.6133597", "0.6125442", "0.6122164", "0.610954", "0.60880464", "0.6067993", "0.60568416", "0.60443884", "0.6034922", "0.6028644", "0.60280406", "0.602567", "0.6010597", "0.60051537", "0.60021067", "0.5992736", "0.59888464", "0.59817874", "0.59733313", "0.5962915", "0.5947383", "0.5944135", "0.59437126", "0.59415567", "0.5940574", "0.59379375", "0.5937466", "0.59359163", "0.5931694", "0.59269065", "0.5924258", "0.5920286", "0.5916544", "0.59140486", "0.5910548", "0.5906639", "0.59026766", "0.5902361", "0.59014815", "0.5899308", "0.589762", "0.5895102", "0.5894121", "0.58846676", "0.58785886", "0.5875622", "0.5872838", "0.58728117", "0.58718705", "0.58703077", "0.58581537", "0.58532745", "0.5853121", "0.5851363", "0.5848176", "0.5847178", "0.5829101", "0.5826069", "0.5824994", "0.5823908", "0.58229566", "0.5819882", "0.5814779", "0.5811859", "0.58110046", "0.5804765", "0.58014446", "0.57990646", "0.57955164", "0.57952386", "0.5794662", "0.57938", "0.5778473", "0.5775487", "0.57751983", "0.57745177", "0.5770156", "0.57682824", "0.57650423", "0.5764323", "0.57622784", "0.57593805", "0.57583195", "0.5748724", "0.5748564", "0.57393324", "0.57334805", "0.5731772" ]
0.5861529
62
$urlRouterProvider.otherwise('/blog'); $locationProvider.html5Mode(true); troubles with f5, MB I have to add 'ngadmin' to all routes on clientside
function tmpl(mdl, filename) { // return APP_ROOT_FOLDER + mdl + '/templates/' + filename + '.html'; return ROOT + mdl + '/templates/' + filename + '.html'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function config($locationProvider, $stateProvider) {\n $locationProvider\n .html5Mode({\n enabled: true,\n requireBase: false\n });\n\n $stateProvider\n .state('home', {\n url: '/',\n controller: 'HomeCtrl as home',\n templateUrl: '/templates/home.html'\n });\n }", "function config($stateProvider, $urlRouterProvider, $locationProvider) {\r\n $stateProvider\r\n .state('home', { //where user is directed to when logged in (similarly, different pages for restof states)\r\n url: '/',\r\n templateUrl: 'partials/home.html',\r\n controller: 'HomeCtrl' \r\n })\r\n .state('login', { \r\n url: '/login',\r\n templateUrl: 'partials/login.html',\r\n controller: 'LoginCtrl'\r\n })\r\n .state('register', {\r\n url: '/register',\r\n templateUrl: 'partials/register.html',\r\n controller: 'RegisterCtrl'\r\n })\r\n .state('add', {\r\n url: '/add',\r\n templateUrl: 'partials/addSite.html',\r\n controller: 'AddCtrl',\r\n restricted: true \r\n });\r\n $urlRouterProvider.otherwise('/');\r\n $locationProvider.html5Mode(true); //prevents angular from adding extra backslash or other symbols to URL\r\n }", "function enableHtml5Routing($locationProvider) {\n $locationProvider.html5Mode(true);\n }", "function config($routeProvider, $locationProvider) {\n\t$locationProvider.hashPrefix('');\n\t$routeProvider\n\t//Home page route\n\t.when('/', {\n\t\ttemplateUrl:'templates/home.html',\n\t\tcontroller: 'mainController'\t\t\n\t})\n\t//when all else fails home page\n\t.otherwise({\n\t\tredirectTo: '/'\n});\n\n\n\n\n}", "function config ($stateProvider, $urlRouterProvider) {\n\n}", "function config ($routeProvider, $locationProvider){\n $routeProvider\n .when('/', {\n templateUrl: 'home/home.view.html',\n controller: 'homeController',\n controllerAs: 'viewModel'\n })\n .when('/about', {\n templateUrl: 'about/about.view.html',\n controller: 'aboutController',\n controllerAs: 'viewModel'\n })\n .otherwise({redirectTo: '/'});\n\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false\n });\n }", "function config($locationProvider, $stateProvider, $urlRouterProvider) {\n 'ngInject';\n //$locationProvider.html5Mode(true);\n //$urlRouterProvider.otherwise('/'); //to set a default route in general used in a global context not in a component\n $stateProvider\n .state('graduationedit', {\n url: '/graduation/edit/:id',\n template: '<graduation-edit></graduation-edit>',\n //to determine whene this component should be routed \n resolve: {\n currentUser($q, $window) {\n if (Meteor.userId()) {\n Tracker.autorun(() => {\n if (Meteor.user() && Meteor.user().profile.mask != \"010\") {\n $window.location.href = \"/home\"\n } else {\n\n }\n })\n } else {\n $window.location.href = \"/login\"\n }\n }\n }\n })\n}", "function config($routeProvider, $locationProvider, $httpProvider, $compileProvider) {\n\n $locationProvider.html5Mode(false);\n\n // routes\n $routeProvider\n .when('/', {\n templateUrl: 'views/home.html',\n controller: 'MainController',\n controllerAs: 'main'\n })\n .when('/main/:id', {\n templateUrl: 'views/mangel.html',\n controller: 'mangelController',\n })\n .when('/choice', {\n templateUrl: 'views/choice.html',\n controller: 'MainController',\n controllerAs: 'choice'\n })\n .when('/management', {\n templateUrl: 'views/management.html',\n controller: 'managementController',\n controllerAs: 'management'\n })\n .otherwise({\n redirectTo: '/'\n });\n\n $httpProvider.interceptors.push('authInterceptor');\n\n }", "function mainApplicationConfig($routeProvider, $httpProvider) {\n //$httpProvider.interceptors.push('bfrTokenInterceptor');\n\n // Note that the menuKey values must match the values specified in navigation.html for each menu.\n $routeProvider.\n when('/', {\n controller: HomeController,\n templateUrl: 'partials/home.html',\n menuKey: 'HOME'\n })\n \n ;\n}", "function config($stateProvider, $urlRouterProvider) {\n $urlRouterProvider.otherwise('/home');\n\n $stateProvider\n .state('home', {\n // the rest is the same for ui-router and ngRoute...\n url: '/home',\n template: '<isn-welcome-page></isn-welcome-page>' +\n '<isn-monitor-panel></isn-monitor-panel>'\n });\n}", "function config($routeProvider) {\n\n // templates as files\n\n $routeProvider.when('/', {\n templateUrl: 'main/main.html',\n controller: 'MainController', // main/main-controller.js i loaded in index.html\n controllerAs: 'vm'\n\n }).when('/about', {\n templateUrl: 'about/about.html',\n controller: 'AboutController', // about/about-controller.js i loaded in index.html\n controllerAs: 'vm'\n\n }).when('/film/:id', {\n templateUrl: 'film/film.html',\n controller: 'FilmController', // film/film-controller.js i loaded in index.html\n controllerAs: 'vm'\n\n }).when('/404', {\n templateUrl: '404/404.html',\n }).otherwise({\n redirectTo: '/404' // go to 404\n });\n\n //$routeProvider.when('/', {\n // template: '<h1> this is the main page </h1> <a href=\"#/about\">Go to About</a>'\n // }).when('/about', {\n // template: '<h1> about page </h1> <a href=\"#/\">Go Home</a>'\n //});\n\n\n // You need to start http server to be able to run SPA with templates in files\n // php -S localhost:8887\n // and call http://localhost:8887 and works\n\n // http://localhost:8000/#/\n // http://localhost:8000/#/film/1\n // http://localhost:8000/#/about\n}", "function config($routeProvider, $locationProvider) {\n\n $locationProvider.html5Mode(false);\n $locationProvider.hashPrefix(''); // to remove ! mark from url \n\n // routes\n $routeProvider\n .when('/', {\n templateUrl: 'views/countries.html',\n controller: 'CountriesController',\n controllerAs: 'country'\n })\n .when('/country/:id', {\n templateUrl: 'views/country-map.html',\n controller: 'CountryMapController',\n controllerAs: 'map'\n })\n .otherwise({\n redirectTo: '/'\n });\n\n }", "function config($stateProvider, $urlRouterProvider, $ocLazyLoadProvider, $locationProvider, adalAuthenticationServiceProvider, $httpProvider) {\n //$locationProvider.html5Mode({\n // enabled: true,\n // requireBase: false\n //});\n //$locationProvider.html5Mode(true).hashPrefix('!');\n $urlRouterProvider.otherwise(\"/dashboards/dashboard\");\n\n $ocLazyLoadProvider.config({\n // Set to true if you want to see what and when is dynamically loaded\n debug: false\n });\n\n var endpoints = {\n \"http://localhost:48213\": \"https://avlnchdemo.azurewebsites.net\"\n // Map the location of a request to an API to a the identifier of the associated resource\n //\"Enter the root location of your To Go API here, e.g. https://contosotogo.azurewebsites.net/\":\n // \"Enter the App ID URI of your To Go API here, e.g. https://contoso.onmicrosoft.com/ToGoAPI\",\n };\n\n //adalAuthenticationServiceProvider.init(\n // {\n // instance: 'https://login.microsoftonline.com/',\n // tenant: 'safytrack.onmicrosoft.com',\n // clientId: '02fa79b9-d917-4496-93d4-8fb311611f51',\n // extraQueryParameter: 'nux=1',\n // //endpoints: endpoints,\n // //cacheLocation: 'localStorage', // enable this for IE, as sessionStorage does not work for localhost.\n // },\n // $httpProvider\n // );\n\n $stateProvider\n\n .state('dashboards', {\n abstract: true,\n url: \"/dashboards\",\n templateUrl: \"/Content/views/common/content.html\",\n })\n .state('quoka', {\n abstract: true,\n url: \"/quoka\",\n templateUrl: \"/Content/views/common/content.html\",\n })\n .state('index', {\n abstract: true,\n url: \"/index\",\n templateUrl: \"/Content/views/common/content.html\",\n })\n .state('dashboards.dashboard', {\n url: \"/dashboard\",\n templateUrl: \"/Content/views/dashboard/dashboard.html\",\n data: { pageTitle: 'dashboard' },\n\n //requireADLogin: true,\n resolve: {\n loadPlugin: function ($ocLazyLoad) {\n return $ocLazyLoad.load([\n {\n serie: true,\n name: 'angular-flot',\n files: ['/Content/js/plugins/flot/jquery.flot.js', '/Content/js/plugins/flot/jquery.flot.time.js', '/Content/js/plugins/flot/jquery.flot.tooltip.min.js', '/Content/js/plugins/flot/jquery.flot.spline.js', '/Content/js/plugins/flot/jquery.flot.resize.js', '/Content/js/plugins/flot/jquery.flot.pie.js', '/Content/js/plugins/flot/curvedLines.js', '/Content/js/plugins/flot/angular-flot.js', ]\n }\n ]);\n }\n }\n })\n .state('quoka.dashboard', {\n url: \"/dashboard\",\n templateUrl: \"/Content/views/quoka/dashboard.html\",\n data: { pageTitle: 'Dashboard' },\n resolve: {\n loadPlugin: function ($ocLazyLoad) {\n return $ocLazyLoad.load([\n {\n serie: true,\n name: 'angular-flot',\n files: ['/Content/js/plugins/flot/jquery.flot.js', '/Content/js/plugins/flot/jquery.flot.time.js', '/Content/js/plugins/flot/jquery.flot.tooltip.min.js', '/Content/js/plugins/flot/jquery.flot.spline.js', '/Content/js/plugins/flot/jquery.flot.resize.js', '/Content/js/plugins/flot/jquery.flot.pie.js', '/Content/js/plugins/flot/curvedLines.js', '/Content/js/plugins/flot/angular-flot.js', ]\n },\n {\n serie: true,\n files: ['/Content/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js', '/Content/js/plugins/jvectormap/jquery-jvectormap-2.0.2.css']\n },\n {\n serie: true,\n files: ['/Content/js/plugins/jvectormap/jquery-jvectormap-world-mill-en.js']\n },\n {\n name: 'ui.checkbox',\n files: ['/Content/js/bootstrap/angular-bootstrap-checkbox.js']\n },\n {\n serie: true,\n files: ['/Content/css/plugins/c3/c3.min.css', '/Content/js/plugins/d3/d3.min.js', '/Content/js/plugins/c3/c3.min.js']\n },\n {\n serie: true,\n name: 'gridshore.c3js.chart',\n files: ['/Content/js/plugins/c3/c3-angular.min.js']\n }\n ]);\n }\n }\n })\n .state('quoka.trader', {\n url: \"/trader\",\n templateUrl: \"/Content/views/quoka/trader.html\",\n data: { pageTitle: 'quoka trader' }\n })\n .state('index.clusters', {\n url: \"/clusters\",\n templateUrl: \"/Content/views/clusters/clusters.html\",\n data: { pageTitle: 'clusters' }\n })\n .state('index.accounts', {\n url: \"/accounts\",\n templateUrl: \"/Content/views/accounts/accounts.html\",\n data: { pageTitle: 'accounts' }\n })\n .state('index.trader', {\n url: \"/trader\",\n templateUrl: \"/Content/views/trader/trader.html\",\n data: { pageTitle: 'trader' }\n })\n .state('index.nodes', {\n url: \"/nodes\",\n templateUrl: \"/Content/views/nodes/nodes.html\",\n data: { pageTitle: 'nodes' }\n })\n .state('index.streams', {\n url: \"/streams\",\n templateUrl: \"/Content/views/streams/streams.html\",\n data: { pageTitle: 'streams' }\n })\n .state('index.doctor', {\n url: \"/doctor\",\n templateUrl: \"/Content/views/doctor/doctor.html\",\n data: { pageTitle: 'doctor' }\n })\n .state('index.admin', {\n url: \"/admin\",\n templateUrl: \"/Content/views/admin/admin.html\",\n data: { pageTitle: 'admin' }\n });\n //.state('index.main', {\n // url: \"/main\",\n // templateUrl: \"/Content/views/main.html\",\n // data: { pageTitle: 'Example view' }\n //})\n //.state('index.minor', {\n // url: \"/minor\",\n // templateUrl: \"/Content/views/minor.html\",\n // data: { pageTitle: 'Example view' }\n //})\n}", "function config($routeProvider, $locationProvider, $httpProvider, $compileProvider) {\n $locationProvider.hashPrefix('');\n // $locationProvider.html5Mode(true);\n $routeProvider.when('/', {\n templateUrl: 'views/home.html',\n controller: 'HomeController',\n controllerAs: 'main',\n label: 'Home'\n })\n .when('/sobre/', {\n templateUrl: 'views/about.html',\n controller: 'AboutController',\n controllerAs: 'about',\n label: 'Sobre nós',\n parent : '/',\n })\n .when('/cadastro/voluntario', {\n templateUrl: 'views/register.html',\n controller: 'RegisterController',\n controllerAs: 'register',\n label: 'Cadastro',\n parent : '/',\n params: {\n type: 'voluntario'\n }\n })\n .when('/cadastro/organizacao', {\n templateUrl: 'views/register.html',\n controller: 'RegisterController',\n controllerAs: 'register',\n label: 'Cadastro',\n parent : '/',\n params: {\n type: 'organizacao'\n }\n })\n .when('/oportunidades', {\n templateUrl: 'views/opportunities.html',\n controller: 'OpportunitiesController',\n controllerAs: 'opp',\n label: 'Oportunidades'\n })\n .when('/oportunidades/:id', {\n templateUrl: 'views/opportunity.html',\n controller: 'OpportunityController',\n controllerAs: 'opportunity',\n label: '{{thing}}',\n parent : '/oportunidades'\n })\n .when('/organizacoes', {\n templateUrl: 'views/organizations.html',\n controller: 'OrganizationsController',\n controllerAs: 'org',\n label: 'Organizações'\n })\n .when('/organizacoes/:id', {\n templateUrl: 'views/organization.html',\n controller: 'OrganizationController',\n controllerAs: 'org',\n label: '{{thing}}',\n parent : '/organizacoes'\n })\n .otherwise({redirectTo: '/'});\n \n $httpProvider.interceptors.push('authInterceptor');\n }", "function config($stateProvider, $urlRouterProvider) {\n \t$urlRouterProvider.otherwise(\"/login\");\n \t$stateProvider\n \t.state('login', \n \t\t{\n\t\t url: \"/login\",\n\t\t templateUrl: \"/app/pages/login/login.html\",\n\t\t controller: \"LoginController as vm\"\n \t\t}\n )\n \t.state('users', {\n url: \"/users\",\n templateUrl: \"/app/pages/users/users.html\",\n controller: \"UsersController as vm\"\n })\n }", "function config ($routeProvider, $locationProvider) {\n $routeProvider\n .when('/', {\n templateUrl: 'home/home.view.html',\n controller: 'homeCtrl',\n controllerAs: 'vm'\n })\n .when('/about', {\n templateUrl: '/common/views/genericText.view.html',\n controller: 'aboutCtrl',\n controllerAs: 'vm'\n }) \n .when('/contact', {\n templateUrl: '/common/views/genericText.view.html',\n controller: 'contactCtrl',\n controllerAs: 'vm'\n })\n .when('/problem/:problemid', {\n templateUrl: '/problemDetail/problemDetail.view.html',\n controller: 'problemDetailCtrl',\n controllerAs: 'vm'\n })\n .otherwise({\n redirectTo: '/'\n });\n \n // use the HTML5 History API\n $locationProvider.html5Mode(true);\n }", "function config($stateProvider, $urlRouterProvider, $ocLazyLoadProvider) {\r\n $urlRouterProvider.otherwise(\"/index/main\");\r\n\r\n $ocLazyLoadProvider.config({\r\n // Set to true if you want to see what and when is dynamically loaded\r\n debug: false\r\n });\r\n\r\n $stateProvider\r\n\r\n .state('index', {\r\n abstract: true,\r\n url: \"/index\",\r\n templateUrl: \"common/content.html\",\r\n })\r\n .state('index.main', {\r\n url: \"/main\",\r\n templateUrl: \"main.html\",\r\n data: { pageTitle: 'Example view' }\r\n })\r\n .state('index.minor', {\r\n url: \"/minor\",\r\n templateUrl: \"minor.html\",\r\n data: { pageTitle: 'Example view' }\r\n })\r\n}", "function fnRoute( $urlRouterProvider, $stateProvider ) {\n\t\t$urlRouterProvider.otherwise( \"/\" );\n\t\t$stateProvider.state( \"boilerplate\", {\n\t\t\turl : \"/:show_message\",\n\t\t\ttemplateUrl : \"/ui-directory-search/v0/public/app/routes/boilerplate/_.html\",\n\t\t\tcontroller : \"BoilerplateController\",\n\t\t\tcontrollerAs : \"vm\"\n\t\t});\n\t}", "function config($urlRouterProvider){\n\t\t// send to define route if not specified\n\t\t$urlRouterProvider.otherwise('/signin');\n\t}", "function config($stateProvider) {\n\t\t$stateProvider.state('unathorized', {\n\t\t\turl: '/unathorized',\n\t\t\tviews: {\n\t\t\t\t'content@': {\n\t\t\t\t\ttemplateUrl: 'views/unathorized.html',\n\t\t\t\t\tcontroller: 'UnathorizedCtrl'\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function adminCtrl ($scope,$routeParams,$http,$location) {\n \n \n }", "function AppRouterConfig($routeProvider) {\n\t$routeProvider.when('/start', {\n\t\tcontroller : 'DashBoard',\n\t\tcontrollerAs : 'dashboardCtrl', // utilizzo il nuovo formalismo controllerAs\n\t\ttemplateUrl : 'partials/dashboard.html'\n\t}).otherwise({\n\t\tredirectTo : '/start'\n\t});\n}", "function config($stateProvider, $urlRouterProvider, localStorageServiceProvider) {\n $urlRouterProvider.otherwise('/');\n\n $stateProvider\n .state('home', {\n url: '/',\n templateUrl: 'components/home/home.html'\n });\n\n $stateProvider\n .state('note', {\n url: '/note',\n templateUrl: 'components/note/note.html'\n });\n\n localStorageServiceProvider\n .setStorageCookie(0, '<path>');\n\n localStorageServiceProvider\n .setPrefix('remem');\n }", "function config($stateProvider) {\n 'ngInject';\n\n $stateProvider.state('home', {\n url: '/home',\n template: '<home></home>'\n });\n\n\n}", "function AppConfig ($stateProvider, $urlRouterProvider) {\n \n $stateProvider\n \n .state('home', {\n controller: 'HomeCtrl as vm',\n templateUrl: 'app/home/home.tpl.html',\n url: '/'\n })\n \n ;\n \n // If none of the above states are matched, use this as the fallback.\n $urlRouterProvider.otherwise('/');\n \n }", "function config($routeProvider, $httpProvider){\n // add the interceptor to config\n // interceptor will do some work at every request\n $httpProvider.interceptors.push('AuthInterceptor');\n\n $routeProvider\n .when('/', {\n templateUrl: 'angular-app/main/main.html',\n // access property, check if a user is login to be able to \n // the access route \n access: {\n restricted: false\n }\n })\n .when('/hotels', {\n templateUrl: 'angular-app/hotel-list/hotels.html',\n controller: 'HotelsController',\n controllerAs: 'vm',\n access: {\n restricted: false\n }\n })\n .when('/hotels/:id', {\n templateUrl: 'angular-app/hotel-display/hotel.html',\n controller: 'HotelController',\n controllerAs: 'vm',\n access: {\n restricted: false\n }\n })\n .when('/register', {\n templateUrl: 'angular-app/register/register.html',\n controller: 'RegisterController',\n controllerAs: 'vm',\n access: {\n restricted: false\n }\n })\n .when('/profile',{\n templateUrl: 'angular-app/profile/profile.html',\n access: {\n restricted: true\n }\n })\n .otherwise({\n redirectTo: '/'\n });\n}", "function routeConfig($stateProvider) {\n $stateProvider\n .state('od.destination', {\n url: '/destination',\n templateUrl: 'app/pages/OD/destination/destination.html',\n title: 'Destinations',\n sidebarMeta: {\n order: 3,\n },\n });\n }", "function ConfigRouteFn($stateProvider) {\n\n $stateProvider\n /*Home*/\n .state(\"home_st\", {\n url: \"/\",\n templateUrl: \"app/home/welcome/homeView.html\"\n })\n \n }", "function config($routeProvider) {\n $routeProvider.when('/', {\n templateUrl: 'main/main.html',\n controller: 'MainController',\n //specifying your controller here means you don't need to use ng-contoller in your html file\n controllerAs: 'vm'\n\n }).when('/about/:id', {\n templateUrl: 'about/about.html',\n controller: 'AboutController',\n controllerAs: 'vm'\n }).otherwise({\n redirectTo: '/'\n });\n\n\n}", "function StateConfig($stateProvider, $urlRouterProvider, $locationProvider) {\n\n $urlRouterProvider.when(\"\", \"/\");\n $stateProvider\n .state('auth', {\n url: '/',\n controller: 'authController',\n controllerAs: 'authCtrl'\n })\n .state('home', {\n templateUrl: require('../views/app.homePage.html'),\n controller: 'homeController',\n controllerAs: 'homeCtrl'\n }) \n .state('profile', {\n templateUrl: require('../views/app.profilePage.html'),\n controller: 'profileController',\n controllerAs: 'profileCtrl',\n params: { username: '', userid: null }\n })\n .state('polls', {\n url: '/polls/:url',\n templateUrl: require(\"../views/app.pollDetails.html\"),\n controller: 'pollDetailsController',\n controllerAs: 'pollDetailsCtrl'\n });\n}", "function configFunction($routeProvider) {\n $routeProvider\n .when('/register', {\n templateUrl: '/angularapp/auth/register.html',\n controller: 'AuthController',\n controllerAs: 'vm'\n })\n .when('/login', {\n templateUrl: '/angularapp/auth/login.html',\n controller: 'AuthController',\n controllerAs: 'vm'\n });\n }", "function configuration($stateProvider, $urlRouterProvider) {\n $urlRouterProvider.otherwise(\"/\");\n\n $stateProvider\n .state('search', {\n url: '',\n templateUrl: 'partials/search.html'\n })\n .state('list', {\n url: '/results?s',\n templateUrl: 'partials/list.html',\n controller: 'AppController as ctrl'\n })\n\n}", "function config($stateProvider, $urlRouterProvider) {\n $stateProvider\n .state('manager', {\n url: \"/\",\n template: \"<manager></manager>\"\n })\n .state('add', {\n url: \"/add\",\n template: \"<add></add>\"\n })\n .state('connect', {\n url: \"/connect/:repo\",\n template: \"<connect></connect>\",\n params: {\n credentials: null,\n connection: null,\n error: null\n }\n })\n .state('connecting', {\n url: \"/connecting\",\n template: \"<connecting></connecting>\",\n params: {\n credentials: null,\n connection: null\n }\n })\n .state('other', {\n url: \"/other\",\n template: \"<other></other>\",\n params: {\n type: null\n }\n })\n .state('pentaho', {\n url: \"/pentaho\",\n template: \"<pentaho></pentaho>\"\n })\n .state('database', {\n url: \"/database\",\n template: \"<database></database>\"\n })\n .state('file', {\n url: \"/file\",\n template: \"<file></file>\"\n });\n\n $urlRouterProvider.otherwise(\"/\");\n }", "function adminView(){\r\n window.location=\"/pages/Admin/admin.html\";\r\n}", "function config($routeProvider){\n\t\t$routeProvider\n\t\t\t.when('/', {\n\t\t\t\ttemplateUrl: 'views/index.html',\n\t\t\t\tcontroller: 'IndexCtrl'\n\t\t\t})\n\t\t\t.when('/login', {\n\t\t\t\ttemplateUrl: 'views/login.html',\n\t\t\t\tcontroller: 'LoginCtrl'\n\t\t\t})\n\t\t\t.when('/register', {\n\t\t\t\ttemplateUrl: 'views/register.html',\n\t\t\t\tcontroller: 'RegisterCtrl'\n\t\t\t})\n\t\t\t.otherwise({ redirectTo: '/' });\n\t}", "function breakroomRouter($routeProvider) {\n $routeProvider\n // load Home partial and insert active class to Home nav link\n .when('/',{templateUrl: 'partials/home.html',\n controller: function ($scope) {\n $scope.setActive('home');\n }})\n // load About page content from wordpress.com and insert active class to About nav link\n .when('/about',{template: '<div ng-repeat=\"post in posts.posts | filter:{ID:27}\" ng-bind-html=\"post.content\">{{post.content}}</div>',\n controller: function ($scope) {\n $scope.setActive('about');\n }})\n // load Services page content from wordpress.com and insert active class to Services nav link\n .when('/services',{template: '<div ng-repeat=\"post in posts.posts | filter:{ID:13}\" ng-bind-html=\"post.content\">{{post.content}}</div>',\n controller: function ($scope) {\n $scope.setActive('services');\n }})\n // load Portfolio page content from wordpress.com and insert active class to Portfolio nav link\n .when('/portfolio',{template: '<div ng-repeat=\"post in posts.posts | filter:{ID:15}\" ng-bind-html=\"post.content\">{{post.content}}</div>',\n controller: function ($scope) {\n $scope.setActive('portfolio');\n }})\n // load Blog page content from wordpress.com and insert active class to Blog nav link\n .when('/blog',{template: '<div ng-repeat=\"post in posts.posts | filter:{ID:17}\" ng-bind-html=\"post.content\">{{post.content}}</div>',\n controller: function ($scope) {\n $scope.setActive('blog');\n }})\n // load Contact partial and insert active class to Contact nav link\n .when('/contact',{templateUrl: 'partials/contact.html',\n controller: function ($scope) {\n $scope.setActive('contact');\n }})\n}", "function routeConfig($stateProvider) {\n $stateProvider\n .state('charts.GooglePrevision', {\n url: '/GooglePrevision',\n templateUrl: 'app/pages/charts/GooglePrevision/GooglePrevision.html',\n title: 'Comparison with GooglePrevision',\n sidebarMeta: {\n order: 40,\n },\n });\n }", "function isAdminTrue(userId){\n $location.url(\"/admin/\" + userId);\n }", "function uiRouteConfig(appConstants, $stateProvider, $urlRouterProvider){\n\t\t\t\n\t\t\t/* login app currently doesn't have any routes. This might change later...\n\t\t\t\n\t\t\t// For any unmatched url, redirect to /stores state. This partial shows a list of all resource stores.\n\t\t\t$urlRouterProvider.otherwise(\"/stores\");\n\n\t\t\t// Now set up the states\n\t\t\t$stateProvider\n\t\t\t\t.state('main_directory_icon', {\n\t\t\t\t\turl: '/directory-icon/:dirId',\n\t\t\t\t\tviews: {\n\t\t\t\t\t\t'mainContent': {\n\t\t\t\t\t\t\ttemplateUrl: appConstants.contextPath + '/assets/scripts/angular/file/modules/main/partials/directoryGridPartial.jsp'\t\t\t\t\t\n\t\t\t\t\t\t},\n\t\t\t\t\t\t'toolbarContent': {\n\t\t\t\t\t\t\ttemplateUrl: appConstants.contextPath + '/assets/scripts/angular/file/modules/main/partials/toolbarDirectoryPartial.jsp'\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}", "function config($stateProvider,$urlRouterProvider){\n $stateProvider\n .state(\n 'page_one',\n {\n url:'/page_one/:id/:name',\n templateUrl:'templates/page_one.html',\n controller:'ctrl1'\n }\n ).state(\n 'page_two',\n {\n url:'/page_two/:id/:name',\n templateUrl:'templates/page_two.html',\n controller:'ctrl2'\n }\n );\n}", "function requiresAdmin() {\n return false;\n}", "function requiresAdmin() {\n return false;\n}", "function config($routeProvider, $locationProvider, $httpProvider, $compileProvider, $provide) {\n\n $locationProvider.html5Mode(false);\n\n // routes\n $routeProvider\n .when('/', {\n templateUrl: 'views/login.html',\n controller: 'LoginController',\n controllerAs: 'login'\n })\n .when('/register', {\n templateUrl: 'views/register.html',\n controller: 'RegisterController',\n controllerAs: 'register'\n })\n .when('/manage-profile', {\n templateUrl: 'views/profile.html',\n controller: 'ManageProfileController',\n controllerAs: 'manage_profile'\n })\n .when('/invite-friends', {\n templateUrl: 'views/invite-friends.html',\n controller: 'InviteFriendsController',\n controllerAs: 'invite_friends'\n })\n .when('/home', {\n templateUrl: 'views/home.html',\n controller: 'HomeController',\n controllerAs: 'home'\n })\n .otherwise({\n redirectTo: '/'\n });\n\n $httpProvider.interceptors.push('authInterceptor');\n $compileProvider.aHrefSanitizationWhitelist(/^\\s*(https?|file|ftp|blob):|data:image\\//);\n\n $provide.decorator(\"$exceptionHandler\", [ '$delegate', function($delegate) {\n \n return function(exception, cause) {\n \n $delegate(exception, cause);\n\n var formatted = '';\n var properties = '';\n formatted += 'Exception: \"' + exception.toString() + '\"\\n';\n formatted += 'Caused by: ' + cause + '\\n';\n\n properties += (exception.message) ? 'Message: ' + exception.message + '\\n' : ''\n properties += (exception.fileName) ? 'File Name: ' + exception.fileName + '\\n' : ''\n properties += (exception.lineNumber) ? 'Line Number: ' + exception.lineNumber + '\\n' : ''\n properties += (exception.stack) ? 'Stack Trace: ' + exception.stack + '\\n' : ''\n\n if (properties) {\n formatted += properties;\n }\n\n console.log(formatted);\n };\n }]);\n\n }", "function run ($rootScope, $location, authentication) {\n $rootScope.$on('$routeChangeStart', function(event, nextRoute, currentRoute) {\n //Routes reserved for admin only\n if (($location.path() === '/beers/add' |\n $location.path() === '/users/list' |\n $location.path() === '/user/delete/:id' | \n $location.path() === '/beers/edit/:id' | \n $location.path() === '/beers/delete/:id') & !authentication.currentUserIsAdmin()){\n $location.path('/beers');\n } \n });\n }", "function Configuration ($stateProvider, $urlRouterProvider) {\n $stateProvider\n .state('app', {\n url: \"/app\",\n abstract:true,\n templateUrl: \"templates/menu.html\",\n controller: 'AppController',\n view: {\n \"mainContent\":{\n templateUrl: \"templates/main-content.html\",\n controller: \"MainContentController\"\n }\n }\n })\n .state('app.rule', {\n url: \"/rule/:titleurl\",\n views: {\n \"mainContent\":{\n templateUrl: \"templates/main-content.html\",\n controller: \"MainContentController\"\n }\n }\n });\n\n // if none of the above states are matched, use this as the fallback\n //$urlRouterProvider.when('/app', '/app/rule/Single_Responsibility');\n $urlRouterProvider.otherwise('/app/rule/');\n\n }", "function adminRoutes(){\n\t\n\t// url map to POST login details\n\tapp.post('/api/login/' ,passport.authenticate('local-login'),\n\t\t function (req, res) {\n\t\t res.json( {message: 'OK'} );\n\t\t });\n\t\n\t// logging-out\n\tapp.get('/api/logout/', isLoggedIn,\n\t\tfunction (req, res){\n\t\t req.logout();\n\t\t res.json({message : 'OK'});\n\t\t});\n\t\n\t// url map to GET admin page(list of admins)\n\tapp.get('/api/admin/', isLoggedIn,\n\t\tfunction (req, res) {\n\t\t User.find(\n\t\t\tfunction (err, admins) {\n\t\t\t if (err)\n\t\t\t\tres.send(err);\n\t\t\t\t \n\t\t\t var adminList = {};\n\t\t\t for (var i in admins)\n\t\t\t\tadminList[admins[i][\"id\"]] = admins[i][\"local\"][\"email\"]; \n\t\t\t\t \n\t\t\t res.json(adminList);\n\t\t\t});\t\t \n\t\t});\n\t// url map to add a new admin\n\tapp.post('/api/admin/',isLoggedIn,\n\t\t passport.authenticate('local-signup'),\n\t\t function (req, res) {\n\t\t res.json( {message: 'OK'} );\n\t\t });\n\t \t\t\n\t// url map to DELETE a admin\n\tapp.delete('/api/admin/:user_id', isLoggedIn,\n\t\t function (req, res) {\n\t\t User.remove({_id : req.params.user_id},\n\t\t\t\t function (err, user) {\n\t\t\t\t if (err)\n\t\t\t\t\t res.send(err);\n\t\t\t\t res.json({message : 'OK'});\n\t\t\t\t });\n\t\t });\n\t\n }", "configureRouter(config, router){\n let self = this;\n config.title = 'Aurelia';\n config.addPipelineStep('authorize', AuthorizeStep);\n config.map([\n { route: '', moduleId: 'login', title: 'Home'},\n { route: 'admindashboard', moduleId: './users/admin/admindashboard', name:'admindashboard',auth: true },\n { route: 'userdashboard', moduleId: './users/normalUser/userdashboard', name:'userdashboard', auth: true }, \n { route: 'admindashboard/uploadaccountbalance', moduleId: './users/admin/accountbalances/uploadaccountbalance', name:'admindashboard/uploadaccountbalance', nav:true, auth: true },\n { route: 'admindashboard/viewaccountbalance', moduleId: './users/admin/accountbalances/viewaccountbalance', name:'admindashboard/viewaccountbalance', nav:true, auth: true },\n { route: 'admindashboard/viewaccountbalancesummary', moduleId: './users/admin/accountbalances/viewaccountbalancesummary', name:'admindashboard/viewaccountbalancesummary', nav:true, auth: true }, \n { route: 'admindashboard/adduser', moduleId: './users/admin/users/adduser', name:'admindashboard/adduser', nav:true, auth: true }, \n { route: 'admindashboard/deleteuser', moduleId: './users/admin/users/deleteuser', name:'admindashboard/deleteuser', nav:true, auth: true } \n \n ]);\n\n this.router = router;\n }", "function Config($stateProvider, $urlRouterProvider) {\n // unknown/default routes handler\n $urlRouterProvider.otherwise('/list');\n\n $stateProvider\n .state('main', {\n // Layout/shared\n url: '',\n templateUrl: '/shared/main/main.html',\n controller: 'MainController',\n abstract: true,\n })\n .state('main.home', {\n // Home page\n url: '/home',\n templateUrl: '/components/home/home.html',\n controller: 'HomeController',\n })\n .state('main.list', {\n // List page\n url: '/list',\n templateUrl: '/components/list/list.html',\n controller: 'ListController',\n });\n }", "function Configuration($routeProvider, $locationProvider, $httpProvider) {\n $httpProvider.defaults.headers.post['Content-Type'] = 'application/json;charset=utf-8';\n $httpProvider.defaults.headers.put['Content-Type'] = 'application/json;charset=utf-8';\n\n // Define your routes here. Each \"view\" will have a route path\n // associated with it. Also, you will include a Controller for\n // each view to manipulate binded data\n $routeProvider\n /*\n When the url is root + / the webpage view loaded is the templateUrl set below.\n i.e. when on website.com/ the webpage shows the html in\n */\n .when(\"/\", {\n templateUrl: \"views/login/login.html\",\n controller: \"LoginController\",\n controllerAs: \"model\"\n })\n // Home Routes\n .when(\"/home\", {\n templateUrl: \"views/home/home-ytd.html\",\n controller: \"HomeYTDController\",\n controllerAs: \"model\",\n resolve: { currentUser: checkLoggedin }\n })\n .when(\"/home/week\", {\n templateUrl: \"views/home/home-week.html\",\n controller: \"HomeWeekController\",\n controllerAs: \"model\",\n resolve: { currentUser: checkLoggedin }\n })\n .when(\"/home/month\", {\n templateUrl: \"views/home/home-month.html\",\n controller: \"HomeMonthController\",\n controllerAs: \"model\",\n resolve: { currentUser: checkLoggedin }\n })\n .when(\"/home/year\", {\n templateUrl: \"views/home/home-year.html\",\n controller: \"HomeYearController\",\n controllerAs: \"model\",\n resolve: { currentUser: checkLoggedin }\n })\n // Scheduler Routes\n .when(\"/appointments\", {\n templateUrl: \"views/appointments/appointments-list.html\",\n controller: \"AppointmentsListController\",\n controllerAs: \"model\",\n resolve: { currentUser: checkLoggedin }\n })\n .when(\"/appointments/add\", {\n templateUrl: \"views/appointments/appointments-new.html\",\n controller: \"AppointmentsAddController\",\n controllerAs: \"model\",\n resolve: { currentUser: checkLoggedin }\n })\n // Expenses Routes\n .when(\"/expenses\", {\n templateUrl: \"views/expenses/expenses-list.html\",\n controller: \"ExpensesListController\",\n controllerAs: \"model\",\n resolve: { currentUser: checkLoggedin }\n })\n .when(\"/expenses/add\", {\n templateUrl: \"views/expenses/expenses-new.html\",\n controller: \"ExpensesAddController\",\n controllerAs: \"model\",\n resolve: { currentUser: checkLoggedin }\n })\n // Settings Routes\n .when(\"/settings\", {\n templateUrl: \"views/settings/settings.html\",\n controller: \"SettingsController\",\n controllerAs: \"model\",\n resolve: { currentUser: checkLoggedin }\n })\n .otherwise({\n redirectTo: \"/\"\n })\n }", "function registerMainRoute(\n $stateProvider\n ) {\n $stateProvider.state(\n \"main\",\n {\n abstract: true,\n url: \"/views\",\n component: \"healthBamMain\"\n }\n );\n }", "function config($routeProvider) {\n\t\t$routeProvider.when('/', {\n\t\t\t//set up the route home page\n\t\t\ttemplateUrl: 'js/phone-list.template.html',\n\t\t\tcontroller: 'PhoneListController',\n\t\t\tcontrollerAs: 'vm'\n\t\t}).\n\t\twhen('/phones/:phoneId', {\n\t\t\t//set up page to view details on a phone\n\t\t\ttemplateUrl: 'js/phone-detail.template.html',\n\t\t\tcontroller: 'PhoneDetailController',\n\t\t\tcontrollerAs: 'vm'\n\t\t}).\n\t\totherwise({\n\t\t\t//when anything else is typed redirect to home page\n\t\t\tredirectTo: '/'\n\t\t});\n\t}", "function setPrivateRoutes() {\n\n // PUT routes\n _app.put('/user-admin', UserAdminCtrl.handleRequest);\n}", "bindSPA() {\r\n if (process.env.NODE_ENV !== 'production') return;\r\n const indexPath = path.join(__dirname, '../../public/index.html');\r\n const publicPath = path.join(__dirname, '../../public');\r\n const index = fs.readFileSync(indexPath);\r\n this.app.use(koaStatic(publicPath));\r\n this.app.use(async (ctx) => {\r\n ctx.body = index.toString();\r\n });\r\n }", "function config($routeProvider, $locationProvider) {\n\n /// ---------------------------------------------------------------------------------\n /// LAZY LOADING EXAMPLE\n /// ---------------------------------------------------------------------------------\n $routeProvider\n .when('/linecharts', {\n title: 'Line Charts',\n description: 'Line charts using Flot Charts, Morris Charts & ChartJS with some Easy-Pie Charts',\n templateUrl: 'views/lineCharts.html',\n controller: 'LineChartController', \n resolve: {\n load: ['$q', function ($q) {\n var defered = $q.defer();\n /// INJECT OUR CONTROLLER\n require(['../controllers/lineChartController'], function () {\n defered.resolve();\n });\n return defered.promise;\n }]\n }\n })\n .when('/barcharts', {\n title: 'Bar Charts',\n description: 'Bar charts using Flot Charts, Morris Charts & ChartJS',\n templateUrl: 'views/barCharts.html',\n controller: 'BarChartController', \n resolve: {\n load: ['$q', function ($q) {\n var defered = $q.defer();\n require(['../controllers/barChartController'], function () {\n defered.resolve();\n });\n return defered.promise;\n }]\n }\n })\n .when('/piecharts', {\n title: 'Pie Charts',\n description: 'Pie charts using Easy-Pie Charts, Flot Charts, Morris Charts & ChartJS',\n templateUrl: 'views/pieCharts.html',\n controller: 'PieChartController',\n resolve: {\n load: ['$q', function ($q) {\n var defered = $q.defer();\n require(['../controllers/pieChartController'], function () {\n defered.resolve();\n });\n return defered.promise;\n }]\n }\n })\n .when('/areacharts', {\n title: 'Area Charts',\n description: 'Area charts using Flot Charts, Morris Charts & ChartJS with some Easy-Pie Charts',\n templateUrl: 'views/areaCharts.html',\n controller: 'AreaChartController',\n resolve: {\n load: ['$q', function ($q) {\n var defered = $q.defer();\n require(['../controllers/areaChartController'], function () {\n defered.resolve();\n });\n return defered.promise;\n }]\n }\n })\n .when('/inlinecharts', {\n title: 'In-Line Charts',\n description: 'Inline charts using Sparkline Charts',\n templateUrl: 'views/inlineCharts.html',\n controller: 'InLineChartController',\n resolve: {\n load: ['$q', function ($q) {\n var defered = $q.defer();\n require(['../controllers/inLineChartController'], function () {\n defered.resolve();\n });\n return defered.promise;\n }]\n }\n })\n .otherwise({ redirectTo: '/areacharts' });\n\n /// ---------------------------------------------------------------------------------\n /// Enable html5Mode for pushstate ('#'-less URLs)\n /// This requires a 'base' tag in the header section of the index page\n /// ---------------------------------------------------------------------------------\n $locationProvider.html5Mode(true);\n $locationProvider.hashPrefix('!');\n }", "function set (router, app){\n \n console.log('\\n');\n console.log('# Route 설정');\n\n //////////////////////////////////////\n // Route 변수 설정\n //////////////////////////////////////\n\n var PATH_ROOT = app.get('PATH_ROOT');\n var PATH_USE_STATIC = app.get('PATH_USE_STATIC');\n var PATH_SERVER = app.get('PATH_SERVER');\n\n // URL Root 설정\n var URL_HOME_PREFIX = app.get('URL_HOME_PREFIX');\n\n // 경로 매핑\n // 상대 경로는 본 파일로부터의 상대 경로임\n // var _path_prefix = (PATH_USE_STATIC) ? PATH_ROOT : '.';\n\n //************************************************************************\n\n // Hi-story Application 에 대한 index까지만 지정하고,\n // 이하 route는 Application (angular-route)에서 다시 Route한다.\n\n /*\n // Root이외의 Route 설정\n var _url_map = {\n \"/\" : '/route/index',\n // \"/auth/signup\" : \n };\n for(var key in _url_map){\n _url_map[key] = PATH_SERVER + _url_map[key];\n }\n _url_map[URL_HOME_PREFIX] = _url_map['/'];\n */\n\n //************************************************************************\n\n // 경로 매핑\n console.log('\\t * 절대경로 사용 : ', PATH_USE_STATIC);\n // console.log('\\t * root : ', _url_map[URL_HOME_PREFIX]);\n\n console.log('# Route 설정 완료.');\n console.log('\\n');\n\n //////////////////////////////////////\n // Route 미들웨어\n //////////////////////////////////////\n\n // a middleware with no mount path, gets executed for every request to the router\n // 모든 요청에 대해 DB_OBJECT객체를 참조할 수 있도록 값을 추가해준다\n router.use( function (req, res, next) {\n \n console.log('\\n');\n console.log('-------------------------------------------');\n console.log('# Request URL : ', req.originalUrl);\n console.log('\\t * time:', Date.now());\n console.log('\\t * Request Type : ', req.method);\n\n if(app){\n var db = app.get('DB_OBJECT');\n req.db = db;\n console.log(\"\\t * DB_OBJECT Setting.\");\n }\n\n console.log(\"\\t * Cookies: \", req.cookies)\n \n next();\n });\n\n //-----------------------------------\n // Middleware Test : http://expressjs.com/guide/using-middleware.html\n //-----------------------------------\n\n /*\n // a middleware sub-stack which handles GET requests to /user/:id\n\n app.get('/user/:id', function (req, res, next) {\n console.log('ID:', req.params.id);\n next();\n }, function (req, res, next) {\n res.send('User Info');\n });\n // handler for /user/:id which prints the user id\n app.get('/user/:id', function (req, res, next) {\n res.end(req.params.id);\n });\n */\n\n ////////////////////////////////////////////////////////////////////////////\n // Page Routing\n ////////////////////////////////////////////////////////////////////////////\n\n //-----------------------------------\n // Home Page\n //-----------------------------------\n\n router.get(URL_HOME_PREFIX, function(req, res, next) {\n var actualPath;\n if(PATH_USE_STATIC){\n actualPath = PATH_SERVER + '/route/index';\n }else{\n // 상대 경로는 본 파일로부터의 상대 경로임\n actualPath = './index';\n }\n\n checkServerPage(URL_HOME_PREFIX, actualPath, req, res, next);\n });\n\n /*\n router.use('/404_NOT_FOUND', function(req, res, next) {\n res_404 (req, res, next);\n });\n */\n\n //////////////////////////////////////\n // route Response가 정의된 JS 파일을 검사한다.\n //////////////////////////////////////\n\n function checkServerPage(routeString, actualPath, req, res, next) {\n var requestURL = req.originalUrl;\n var pathname = url.parse(requestURL).pathname;\n var pattern = getPattern(routeString);\n var match = pattern.test(pathname);\n\n \n // console.log('\\t - actualPath : ', actualPath);\n // console.log('pattern : ', pattern);\n // console.log('match : ', match);\n\n if(match == false){\n // 파일시스템에서 파일 링크로 읽어들여 서비스 함\n next();\n return;\n }\n\n console.log('\\n');\n console.log('\\t - pathname : ', pathname);\n console.log('\\t - actualPath : ', actualPath);\n\n // 해당 경로의 JS 파일에 링크를 연결한다.\n var file = require( actualPath );\n try{\n // 해당 파일은 response 인터페이스가 정의되어 있어야 한다.\n if(!file || !file.response){\n var msg = '해당 파일이 없거나 인터페이스가 구현되어 있지 않습니다.';\n throw new Error(msg);\n }\n // 응답\n file.response(req, res);\n return;\n }\n catch(err){\n console.log('# [Route Exception] : ' + err);\n console.log(err.stack);\n next();\n }\n }\n\n //-----------------------------------\n // Pattern 체크\n //-----------------------------------\n \n function getPatternString (word){\n // var patternString = '\\/' + word + '(\\W|$)(\\/|\\#)*(\\/)*';\n var patternString = '' + word + '(\\\\W|$)(\\\\/|\\\\#)*(\\\\/)*($|\\\\s)';\n return patternString;\n }\n function getPatternExpression (word){\n var expression = '/' + getPatternString(word) + '/gm';\n return expression;\n }\n function getPattern (word){\n var patternString = getPatternString(word);\n var pattern = new RegExp(patternString, 'gm');\n return pattern;\n }\n\n //-----------------------------------\n // 404 Page\n //-----------------------------------\n\n function res_404 (req, res) {\n console.log(\"# 404 Not found\");\n var content = \"<h1>404 Not found</h1>READ FILE ERROR: Internal Server Error!\";\n\n res.writeHead(404, 'text/html');\n res.write(content);\n res.end();\n }\n\n ////////////////////////////////////////////////////////////////////////////\n // Auth Request Routing 정의\n ////////////////////////////////////////////////////////////////////////////\n\n\n\n\n\n\n\n\n\n\n\n \n \n authRoute.set (router);\n\n dbRoute.set (router);\n\n\n\n\n\n\n\n\n\n\n ////////////////////////////////////////////////////////////////////////////\n // 마지막으로 파일시스템을 조사한다. (이미지, css등의 요청)\n ////////////////////////////////////////////////////////////////////////////\n\n\n router.use(function(req, res, next){\n\n var requestURL = req.originalUrl;\n var pathname = url.parse(requestURL).pathname;\n\n // 파일 읽기 (가상 prefix 제거)\n var prefix = URL_HOME_PREFIX + '/';\n var filePath = pathname.replace(prefix, '');\n if(filePath.indexOf('/') == 0){\n filePath = filePath.replace('/', '');\n }\n\n // var ext = path.extname(filePath);\n var mimeType = mime.lookup(pathname);\n\n console.log('\\n');\n console.log('\\t * Anonymous Request : ', pathname);\n console.log('\\t - filePath : ', filePath);\n console.log('\\t - mimeType : ', mimeType);\n console.log('\\n');\n\n var options = {\n root: PATH_ROOT,\n dotfiles: 'deny',\n // headers: {\n // 'x-timestamp': Date.now(),\n // 'x-sent': true\n // }\n };\n res.sendFile(filePath, options, function (err) {\n if (err) {\n console.log('\\n//////////////////////////////////////////////////////////////////\\n');\n console.log('-> [File Route Error] : ');\n console.log(err, err.stack);\n console.log('\\n//////////////////////////////////////////////////////////////////\\n');\n \n // res.status(err.status).end();\n res_404 (req, res);\n\n }else {\n console.log('-> Response Result success : ', filePath);\n }\n });\n });\n\n /*\n // 파일 직접 읽어 보내기\n router.use(function(req, res, next){\n\n var requestURL = req.originalUrl;\n var pathname = url.parse(requestURL).pathname;\n\n // 파일 읽기 (가상 prefix 제거)\n var prefix = URL_HOME_PREFIX + '/';\n var filePath = pathname.replace(prefix, '');\n if(filePath.indexOf('/') == 0){\n filePath = filePath.replace('/', '');\n }\n\n // 경로 변환\n var actualPath;\n if(PATH_USE_STATIC){\n actualPath = PATH_ROOT + '/' + filePath;\n }else{\n // 상대 경로는 본 파일로부터의 상대 경로임\n actualPath = './' + filePath;\n }\n\n console.log('\\t * Path : [ ', pathname, ' ]');\n console.log(\"\\t * Anonymous Request : \", actualPath);\n // console.log(\"\\t - pathname : ( \", pathname, \" )\");\n\n // 서비스\n // res.sendfile(actualPath);\n\n // non-blocking 방식 - res 이용하여 컨텐츠 리턴\n var mimeType = mime.lookup(pathname);\n fs.readFile(filePath, function(error, contents){\n\n if(error){\n\n console.log(error);\n res_404 (req, res);\n\n }else{\n\n // req.setEncoding(\"utf8\");\n // console.log(\"req query : \", req.query);\n\n // res.writeHead(200, 'text/html');\n res.setHeader('Content-Type', mimeType);\n res.writeHeader(200);\n\n // res.write(contents);\n res.end(contents);\n }\n });\n });\n */\n\n /*\n router.use(function(req, res, next){\n // req.setEncoding(\"utf8\");\n res.setHeader('Content-Type', 'text/html');\n res.writeHeader(200);\n // res.write(contents);\n res.end(contents);\n });\n */\n\n //////////////////////////////////////\n // mount the router on the app\n //////////////////////////////////////\n\n app.use('/', router);\n\n}", "render() {\n return (\n <Router>\n <div>\n <Route exact path=\"/\" component={ProjectPage}/>\n <Route path=\"/adminpage\" component={AdminPage}/>\n </div>\n </Router>\n );\n }", "function checkHtml5Route (req, res, next) {\n // 301 redirect www to non-www\n // if ( req.headers.host.match(/www\\.openlegendrpg\\.com/) ) {\n // res.setHeader('Location','http://openlegendrpg.com');\n // res.send(301);\n // }\n\n // requesting a route rather than a file (has no `.` character)\n if ( req.path().split('.').length <= 1 ) {\n req.url = 'index.html';\n req.path = function () { return req.url; };\n var serve = serveStatic(\n config.root+'/client',\n {'index': ['index.html']}\n );\n\n serve(req,res,next);\n } else {\n next();\n }\n}", "function restrictApi(req, res, next) {\n if(req){\n res.redirect('/home')\n }\n}", "function admin(){\n window.location.href=\"admin.html\";\n}", "function config($stateProvider, $urlRouterProvider, $qProvider) {\n\n $stateProvider\n .state('register', {\n url: '/register',\n templateUrl: 'angular/app/user/views/register.view.html',\n controller: 'RegisterCtrl as user',\n register: true\n })\n\n ;\n $qProvider.errorOnUnhandledRejections(false);\n\n\n }", "_adminApiSetup() {\n if ( this.#isConfigured !== true ) {\n this.log.warn('[uibuilder:web.js:_adminApiSetup] Cannot run. Setup has not been called.')\n return\n }\n\n this.adminRouter = express.Router({ mergeParams: true }) // eslint-disable-line new-cap\n\n /** Serve up the v3 admin apis on /<httpAdminRoot>/uibuilder/admin/ */\n this.adminRouterV3 = require('./admin-api-v3')(this.uib, this.log)\n this.adminRouter.use('/admin', this.adminRouterV3)\n this.routers.admin.push( { name: 'Admin API v3', path: `${this.RED.settings.httpAdminRoot}uibuilder/admin`, desc: 'Consolidated admin APIs used by the uibuilder Editor panel', type: 'Router' } )\n\n /** Serve up the package docs folder on /<httpAdminRoot>/uibuilder/techdocs (uses docsify) - also make available on /uibuilder/docs\n * @see https://github.com/TotallyInformation/node-red-contrib-uibuilder/issues/108\n */\n const techDocsPath = path.join(__dirname, '..', '..', 'docs')\n this.adminRouter.use('/docs', express.static( techDocsPath, this.uib.staticOpts ) )\n this.routers.admin.push( { name: 'Documentation', path: `${this.RED.settings.httpAdminRoot}uibuilder/docs`, desc: 'Documentation website powered by Docsify', type: 'Static', folder: techDocsPath } )\n this.adminRouter.use('/techdocs', express.static( techDocsPath, this.uib.staticOpts ) )\n this.routers.admin.push( { name: 'Tech Docs', path: `${this.RED.settings.httpAdminRoot}uibuilder/techdocs`, desc: 'Documentation website powered by Docsify', type: 'Static', folder: techDocsPath } )\n\n // TODO: Move v2 API's to V3\n this.adminRouterV2 = require('./admin-api-v2')(this.uib, this.log)\n this.routers.admin.push( { name: 'Admin API v2', path: `${this.RED.settings.httpAdminRoot}uibuilder/*`, desc: 'Various older admin APIs used by the uibuilder Editor panel', type: 'Router' } )\n\n /** Serve up the admin root for uibuilder on /<httpAdminRoot>/uibuilder/ */\n this.RED.httpAdmin.use('/uibuilder', this.adminRouter, this.adminRouterV2)\n }", "function crosswordsRoutes ($stateProvider) {\n $stateProvider.state(\n 'crossword', {\n templateUrl: 'views/fh-mgr/crosswords/crossword.view.html',\n controllerAs: 'crossword',\n abstract: true,\n authenticate: true\n }\n );\n }", "function App() {\n\n return (\n <div className=\"App\">\n <Router>\n <Home path=\"/\"/>\n <Main path=\"/admin\"/>\n {/* <AdminHome path=\"/login/hi\"/> */}\n <BuyTicket path=\"/tickets/:id\"/>\n <BuyersList path=\"/admin/info\"/>\n <MoviesAdmin path=\"/admin/movies\"/>\n </Router>\n </div>\n );\n}", "function requiresAdmin() {\n return true;\n}", "function requiresAdmin() {\n return true;\n}", "function configMainRoute($stateProvider, mainMenuProvider) {\n\t\tvar mainState = {\n\t\t\tname: 'main',\n\t\t\turl: '/',\n\t\t\tauthenticate: false,\n\t\t\ttemplateUrl: 'app/main/main.html',\n\t\t\tcontroller: 'MainController',\n\t\t\tcontrollerAs: 'vm'\n\t\t};\n\n\t\t$stateProvider.state(mainState);\n\n\t\tmainMenuProvider.addMenuItem({\n\t\t\tname: 'Home',\n\t\t\tstate: mainState.name,\n\t\t\torder: 1,\n\t\t\ticon: 'action:ic_home_24px'\n\t\t});\n\t}", "function openAdmin(){\n location.href = \"admin.html\";\n}", "function restBaseUrl() {\n return '/admin';\n }", "function routeConfig($routeProvider) {\n $routeProvider.when('/', {\n controller: 'sessionInitController',\n controllerAs: 'initCon',\n templateUrl: 'session-request.html'\n }).when('/ins-common', {\n controller: 'sessionInitController',\n controllerAs: 'initCon',\n templateUrl: 'ins-common.html'\n }).when('/ins-order', {\n controller: 'prePracticeController',\n controllerAs: 'prePracCon',\n templateUrl: 'ins-order.html'\n }).when('/ins-colour', {\n controller: 'prePracticeController',\n controllerAs: 'prePracCon',\n templateUrl: 'ins-colour.html'\n }).when('/pause', {\n controller: 'practiceController',\n controllerAs: 'pracCon',\n templateUrl: 'test.html'\n }).when('/test', {\n controller: 'practiceController',\n controllerAs: 'pracCon',\n templateUrl: 'test.html'\n }).when('/btw', {\n controller: 'practiceController',\n controllerAs: 'pracCon',\n templateUrl: 'test.html'\n }).when('/scoresheet', {\n controller: 'scoresheetController',\n controllerAs: 'scoresheetCon',\n templateUrl: 'scoresheet.html'\n }).when('/score', {\n controller: 'practiceController',\n controllerAs: 'pracCon',\n templateUrl: 'score.html'\n }).when('/endpractice', {\n controller: 'endPracticeController',\n controllerAs: 'endPracCon',\n templateUrl: 'endpractice.html'\n }).when('/break', {\n controller: 'breakController',\n controllerAs: 'breakCon',\n templateUrl: 'break.html'\n }).when('/thankyou', {\n controller: 'exportController',\n controllerAs: 'expCon',\n templateUrl: 'thankyou.html'\n })\n}", "function RouterFunction($stateProvider){\n $stateProvider\n .state(\"entryIndex\", {\n url: \"/entries\",\n controller: \"EntryIndexController\",\n controllerAs: \"vm\",\n templateUrl: \"js/ng-views/index.html\"\n }).state(\"entryNew\", {\n url: \"/entries/new\",\n templateUrl: \"js/ng-views/new.html\",\n controller: \"EntryNewController\",\n controllerAs: \"vm\"\n })\n .state(\"entryShow\", {\n url: \"/entries/:id\",\n controller: \"EntryShowController\",\n controllerAs: \"vm\",\n templateUrl: \"js/ng-views/show.html\"\n })\n .state(\"entryEdit\", {\n url: \"/entries/:id/edit\",\n templateUrl: \"js/ng-views/edit.html\",\n controller: \"EntryEditController\",\n controllerAs: \"vm\"\n })\n}", "function adminCheck(thrgfhbstdgfb,rgfrfgrgf,erthngrgf) {\n if(rgfrfgrgf.startsWith(\"admin\")){\n alert(\"Welcome \" + erthngrgf + \"!\" );\n window.location.href=\"/blog\";\n }else{\n alert(\"Welcome \" + erthngrgf + \"!\" );\n window.location.href=\"/userblog\" + thrgfhbstdgfb;\n }\n }", "function run($rootScope, $location, $window, AuthFactory) {\n $rootScope.$on('$routeChangeStart', function(event, nextRoute, currentRoute) {\n // if access.restricted exist in the object\n if (nextRoute.access !== undefined && nextRoute.access.restricted && !$window.sessionStorage.token && !AuthFactory.isLoggedIn) {\n // don't navigate to the path\n // send to / path instead\n event.preventDefault();\n $location.path('/');\n }\n });\n }", "function index(req, res) {\n // redirect to sb before spa version\n res.redirect(req.browsePrefix);\n}", "function defaultHomePage(){\n \n var dfd = $q.defer();\n \n dfd.resolve($http({\n method: 'get',\n url: './config/kibana_settings.json'\n }));\n \n \n return dfd.promise;\n \n }", "_routePageChanged(page) {\n const routes = ['repository-list'];\n this.page = page || 'repository-list'; // defaults to home route if no page\n\n // if we are trying to access anything other than / or /repository-list return 404 page\n if (routes.indexOf(this.page) === -1){\n this.page = '404';\n }\n }", "function router(app) {\n\n}", "function RoutesConfig(){\n return(<div>\n <BrowserRouter>\n <Switch>\n <PrivateRoutes path='/admin' component={Admin}/>\n <PrivateRoutes path='/user' component={User}/>\n <Route path=\"/\"> <Home></Home> </Route>\n </Switch>\n </BrowserRouter>\n </div>);\n}", "function App() {\n return (\n <HashRouter>\n <Switch>\n <Route exact path=\"/\" component={HomePage} />\n <Route exact path=\"/projects\" component={ProjectsPage} />\n <Route exact path=\"/admin\" component={AdminPage} />\n </Switch>\n </HashRouter>\n );\n}", "function routerConfig($stateProvider, $locationProvider, BUILD_VERSION, LOCALE) {\n // TODO We need a way to handle routes when refreshing. Server needs to know about these routes.\n $stateProvider\n .state('localization', { // http://stackoverflow.com/questions/32357615/option-url-path-ui-router\n url: '/{locale:(?:' + LOCALE + ')}?qid',\n abstract: true,\n template: '<div ui-view=\"main\" class=\"viewContentWrapper\"></div>',\n params: {locale: {squash: true, value: 'en'}}\n })\n .state('omniSearch', {\n parent: 'localization',\n url: '/search?q',\n views: {\n main: {\n templateUrl: '/templates/pages/search/search.html?v=' + BUILD_VERSION,\n controller: 'searchCtrl',\n controllerAs: 'rootSearch'\n }\n }\n })\n .state('betaSearch', {\n parent: 'localization',\n url: '/occurrence-search/beta',\n views: {\n main: {\n templateUrl: '/templates/pages/occurrence/beta/betaSearch.html?v=' + BUILD_VERSION,\n controller: 'betaSearchCtrl',\n controllerAs: 'betaSearch'\n }\n }\n })\n .state('occurrenceKey', {\n parent: 'localization',\n url: '/occurrence/{key:[0-9]+}',\n views: {\n main: {\n templateUrl: '/templates/pages/occurrence/key/occurrenceKey.html?v=' + BUILD_VERSION,\n controller: 'occurrenceKeyCtrl',\n controllerAs: 'occurrenceKey',\n resolve: {\n occurrence: function($stateParams, Occurrence) {\n return Occurrence.get({id: $stateParams.key}).$promise;\n },\n TRANSLATION_UNCERTAINTY: function($translate) {\n return $translate('occurrence.coordinateUncertainty');\n },\n TRANSLATION_ELEVATION: function($translate) {\n return $translate('ocurrenceFieldNames.elevation');\n }\n }\n }\n }\n })\n .state('occurrenceKeyCluster', {\n parent: 'occurrenceKey',\n url: '/cluster',\n templateUrl: '/templates/pages/occurrence/key/cluster/occurrenceKeyCluster.html?v=' + BUILD_VERSION,\n controller: 'occurrenceKeyClusterCtrl',\n controllerAs: 'occurrenceKeyCluster'\n })\n .state('occurrenceKeyPhylotree', {\n parent: 'occurrenceKey',\n url: '/phylogenies',\n templateUrl: '/templates/pages/occurrence/key/phylotree/occurrenceKeyPhylotree.html?v=' + BUILD_VERSION,\n controller: 'occurrenceKeyPhylotreeCtrl',\n controllerAs: 'occurrenceKeyPhylotree'\n })\n .state('occurrenceSearch', {\n parent: 'localization',\n // eslint-disable-next-line max-len\n url: '/occurrence?q&basis_of_record&catalog_number&collection_code&continent&country&dataset_key&decimal_latitude&decimal_longitude&depth&elevation&event_date&has_coordinate&has_geospatial_issue&institution_code&issue&last_interpreted&media_type&month&occurrence_id&publishing_country&publishing_org&recorded_by&identified_by&recorded_by_id&identified_by_id&record_number&scientific_name&taxon_key&kingdom_key&phylum_key&class_key&order_key&family_key&genus_key&sub_genus_key&species_key&year&establishment_means&type_status&organism_id&locality&water_body&state_province&protocol&license&repatriated&{advanced:bool}&geometry&event_id&parent_event_id&sampling_protocol&installation_key&network_key&programme&project_id&verbatim_scientific_name&taxon_id&organism_quantity&organism_quantity_type&sample_size_unit&sample_size_value&relative_organism_quantity&institution_key&collection_key&coordinate_uncertainty_in_meters&occurrence_status&gadm_gid&hosting_organization_key&life_stage&pathway&degree_of_establishment&is_in_cluster&dwca_extension&iucn_red_list_category&distance_from_centroid_in_meters',\n params: {\n advanced: {\n value: false,\n squash: true\n },\n repatriated: {\n type: 'string',\n value: undefined,\n squash: true,\n array: false\n }\n },\n views: {\n main: {\n templateUrl: '/templates/pages/occurrence/occurrence.html?v=' + BUILD_VERSION,\n controller: 'occurrenceCtrl',\n controllerAs: 'occurrence'\n }\n }\n })\n .state('occurrenceSearchTable', {\n parent: 'occurrenceSearch',\n url: '/search?offset&limit',\n templateUrl: '/templates/pages/occurrence/table/occurrenceTable.html?v=' + BUILD_VERSION,\n controller: 'occurrenceTableCtrl',\n controllerAs: 'occTable'\n })\n .state('occurrenceSearchMap', {\n parent: 'occurrenceSearch',\n url: '/map?center&zoom',\n templateUrl: '/templates/pages/occurrence/map/occurrenceMap.html?v=' + BUILD_VERSION,\n controller: 'occurrenceMapCtrl',\n controllerAs: 'occMap'\n })\n .state('occurrenceSearchGallery', {\n parent: 'occurrenceSearch',\n url: '/gallery',\n templateUrl: '/templates/pages/occurrence/gallery/occurrenceGallery.html?v=' + BUILD_VERSION,\n controller: 'occurrenceGalleryCtrl',\n controllerAs: 'occGallery'\n })\n .state('occurrenceSearchSpecies', {\n parent: 'occurrenceSearch',\n url: '/taxonomy',\n templateUrl: '/templates/pages/occurrence/species/occurrenceSpecies.html?v=' + BUILD_VERSION,\n controller: 'occurrenceSpeciesCtrl',\n controllerAs: 'occSpecies'\n })\n .state('occurrenceSearchDatasets', {\n parent: 'occurrenceSearch',\n url: '/datasets',\n templateUrl: '/templates/pages/occurrence/datasets/occurrenceDatasets.html?v=' + BUILD_VERSION,\n controller: 'occurrenceDatasetsCtrl',\n controllerAs: 'occDatasets'\n })\n .state('occurrenceSearchCharts', {\n parent: 'occurrenceSearch',\n url: '/charts?t&d&d2',\n templateUrl: '/templates/pages/occurrence/charts/occurrenceCharts.html?v=' + BUILD_VERSION,\n controller: 'occurrenceChartsCtrl',\n controllerAs: 'occCharts'\n })\n .state('occurrenceSearchDownload', {\n parent: 'occurrenceSearch',\n url: '/download',\n templateUrl: '/templates/pages/occurrence/download/occurrenceDownload.html?v=' + BUILD_VERSION,\n controller: 'occurrenceDownloadCtrl',\n controllerAs: 'occDownload'\n })\n .state('datasetSearch', {\n parent: 'localization',\n url: '/dataset?offset&limit&q&type&keyword&publishing_org&hosting_org&publishing_country&decade&taxon_key&project_id&license',\n views: {\n main: {\n templateUrl: '/templates/pages/dataset/search/dataset.html?v=' + BUILD_VERSION,\n controller: 'datasetCtrl',\n controllerAs: 'dataset'\n }\n }\n })\n .state('datasetSearchTable', {\n parent: 'datasetSearch',\n url: '/search',\n templateUrl: '/templates/pages/dataset/search/table/datasetTable.html?v=' + BUILD_VERSION,\n controller: 'datasetTableCtrl',\n controllerAs: 'datasetTable'\n })\n .state('datasetKey', {\n parent: 'localization',\n url: '/dataset/:key',\n views: {\n main: {\n templateUrl: '/api/template/dataset/key.html?v=' + BUILD_VERSION,\n controller: 'datasetKeyCtrl',\n controllerAs: 'datasetKey'\n }\n }\n })\n .state('datasetKeyActivity', {\n parent: 'datasetKey',\n url: '/activity?offset&limit',\n templateUrl: '/api/template/dataset/activity.html?v=' + BUILD_VERSION,\n controller: 'datasetActivityCtrl',\n controllerAs: 'datasetActivity'\n })\n .state('datasetKeyProject', {\n parent: 'datasetKey',\n url: '/project',\n templateUrl: '/api/template/dataset/project.html?v=' + BUILD_VERSION,\n controller: 'datasetProjectCtrl',\n controllerAs: 'datasetProject'\n })\n .state('datasetKeyStats', {\n parent: 'datasetKey',\n url: '/metrics',\n templateUrl: '/api/template/dataset/stats.html?v=' + BUILD_VERSION,\n controller: 'datasetStatsCtrl',\n controllerAs: 'datasetStats'\n })\n .state('datasetKeyConstituents', {\n parent: 'datasetKey',\n url: '/constituents?offset',\n templateUrl: '/api/template/dataset/constituents.html?v=' + BUILD_VERSION,\n controller: 'datasetConstituentsCtrl',\n controllerAs: 'datasetConstituents'\n })\n .state('datasetKeyPhylotree', {\n parent: 'datasetKey',\n url: '/phylogenies',\n templateUrl: '/templates/pages/dataset/key/phylotree/datasetKeyPhylotree.html?v=' + BUILD_VERSION,\n controller: 'datasetKeyPhylotreeCtrl',\n controllerAs: 'datasetKeyPhylotree'\n })\n .state('datasetEvent', {\n parent: 'localization',\n url: '/dataset/:datasetKey/event/:eventKey',\n views: {\n main: {\n templateUrl: '/api/template/dataset/event.html?v=' + BUILD_VERSION,\n controller: 'datasetEventCtrl',\n controllerAs: 'datasetEvent'\n }\n }\n })\n .state('datasetParentEvent', {\n parent: 'localization',\n url: '/dataset/:datasetKey/parentevent/:parentEventKey',\n views: {\n main: {\n templateUrl: '/api/template/dataset/parentevent.html?v=' + BUILD_VERSION,\n controller: 'datasetParentEventCtrl',\n controllerAs: 'datasetParentEvent'\n }\n }\n })\n .state('speciesSearch', {\n parent: 'localization',\n url: '/species?offset&limit&q&rank&dataset_key&constituent_key&highertaxon_key&key&name_type&origin&qField&status&issue&{advanced:bool}',\n params: {\n advanced: {\n value: false,\n squash: true\n }\n },\n views: {\n main: {\n templateUrl: '/templates/pages/species/search/species.html?v=' + BUILD_VERSION,\n controller: 'speciesCtrl',\n controllerAs: 'species'\n }\n }\n })\n .state('speciesSearchList', {\n parent: 'speciesSearch',\n url: '/search',\n templateUrl: '/templates/pages/species/search/list/speciesList.html?v=' + BUILD_VERSION,\n controller: 'speciesListCtrl',\n controllerAs: 'speciesList'\n })\n .state('speciesSearchTable', {\n parent: 'speciesSearch',\n url: '/table',\n templateUrl: '/templates/pages/species/search/table/speciesTable.html?v=' + BUILD_VERSION,\n controller: 'speciesTableCtrl',\n controllerAs: 'speciesTable'\n })\n .state('speciesKey', {\n parent: 'localization',\n url: '/species/:speciesKey?refOffset&occurrenceDatasetOffset&checklistDatasetOffset&root&vnOffset',\n params: {\n advanced: {\n value: false,\n squash: true\n }\n },\n views: {\n main: {\n templateUrl: '/api/template/species/key.html?v=' + BUILD_VERSION,\n controller: 'speciesKey2Ctrl',\n controllerAs: 'speciesKey2'\n }\n }\n })\n .state('speciesKeyVerbatim', {\n parent: 'speciesKey',\n url: '/verbatim',\n params: {\n advanced: {\n value: false,\n squash: true\n }\n },\n views: {\n main: {\n templateUrl: '/api/template/species/key.html?v=' + BUILD_VERSION,\n controller: 'speciesKey2Ctrl',\n controllerAs: 'speciesKey2'\n }\n }\n })\n .state('speciesKeyMetrics', {\n parent: 'speciesKey',\n url: '/metrics',\n views: {\n main: {\n templateUrl: '/api/template/species/key.html?v=' + BUILD_VERSION,\n controller: 'speciesKey2Ctrl',\n controllerAs: 'speciesKey2'\n }\n }\n })\n .state('speciesKeyTreatments', {\n parent: 'speciesKey',\n url: '/treatments',\n views: {\n main: {\n templateUrl: '/api/template/species/key.html?v=' + BUILD_VERSION,\n controller: 'speciesKey2Ctrl',\n controllerAs: 'speciesKey2'\n }\n }\n })\n .state('speciesKeyLiterature', {\n parent: 'speciesKey',\n url: '/literature',\n views: {\n main: {\n templateUrl: '/api/template/species/key.html?v=' + BUILD_VERSION,\n controller: 'speciesKey2Ctrl',\n controllerAs: 'speciesKey2'\n }\n }\n })\n .state('publisherSearch', {\n parent: 'localization',\n url: '/publisher?offset&limit&q&country',\n views: {\n main: {\n templateUrl: '/templates/pages/publisher/search/publisher.html?v=' + BUILD_VERSION,\n controller: 'publisherCtrl',\n controllerAs: 'publisher'\n }\n }\n })\n .state('publisherSearchList', {\n parent: 'publisherSearch',\n url: '/search',\n templateUrl: '/templates/pages/publisher/search/list/publisherList.html?v=' + BUILD_VERSION,\n controller: 'publisherListCtrl',\n controllerAs: 'publisherList'\n })\n .state('publisherConfirmEndorsement', {\n url: '/publisher/confirm'\n\n })\n .state('publisherKey', {\n parent: 'localization',\n url: '/publisher/:key',\n views: {\n main: {\n templateUrl: '/api/template/publisher/key.html?v=' + BUILD_VERSION,\n controller: 'publisherKeyCtrl',\n controllerAs: 'publisherKey'\n }\n }\n })\n .state('publisherMetrics', {\n parent: 'publisherKey',\n url: '/metrics',\n templateUrl: '/api/template/publisher/metrics.html?v=' + BUILD_VERSION,\n controller: 'publisherMetricsCtrl',\n controllerAs: 'publisherMetrics'\n })\n .state('resourceSearch', {\n parent: 'localization',\n // eslint-disable-next-line max-len\n url: '/resource?offset&limit&q&contentType&year&literatureType&language&audiences&purposes&topics&relevance&countriesOfResearcher&countriesOfCoverage&_showPastEvents&gbifDatasetKey&publishingOrganizationKey&gbifDownloadKey&peerReview&openAccess&projectId&contractCountry&publisher&source&doi&gbifDerivedDatasetDoi&gbifTaxonKey&gbifNetworkKey&gbifProjectIdentifier&gbifProgrammeAcronym',\n views: {\n main: {\n templateUrl: '/templates/pages/resource/search/resource.html?v=' + BUILD_VERSION,\n controller: 'resourceCtrl',\n controllerAs: 'resource'\n }\n }\n })\n .state('resourceSearchList', {\n parent: 'resourceSearch',\n url: '/search',\n templateUrl: '/templates/pages/resource/search/list/resourceList.html?v=' + BUILD_VERSION,\n controller: 'resourceListCtrl',\n controllerAs: 'resourceList'\n })\n .state('grscicoll', {\n parent: 'localization',\n url: '/grscicoll',\n views: {\n main: {\n templateUrl: '/api/template/grscicoll/grscicoll.html?v=' + BUILD_VERSION,\n controller: 'grscicollCtrl',\n controllerAs: 'grscicoll'\n }\n }\n })\n .state('grscicollCollectionSearch', {\n parent: 'grscicoll',\n url: '/collection/search?q&offset',\n templateUrl: '/templates/pages/grscicoll/collection/collection.html?v=' + BUILD_VERSION,\n controller: 'grscicollCollectionCtrl',\n controllerAs: 'grscicollCollection'\n })\n .state('collectionKey', {\n parent: 'localization',\n url: '/grscicoll/collection/:key',\n views: {\n main: {\n templateUrl: '/api/template/collection/key.html?v=' + BUILD_VERSION,\n controller: 'collectionKeyCtrl',\n controllerAs: 'collectionKey'\n }\n }\n })\n .state('collectionKeyMetrics', {\n parent: 'collectionKey',\n url: '/metrics',\n templateUrl: '/templates/pages/grscicoll/collection/key/metrics/collectionKeyMetrics.html?v=' + BUILD_VERSION,\n controller: 'collectionKeyMetricsCtrl',\n controllerAs: 'collectionKeyMetrics'\n })\n .state('grscicollInstitutionSearch', {\n parent: 'grscicoll',\n url: '/institution/search?q&offset',\n templateUrl: '/templates/pages/grscicoll/institution/institution.html?v=' + BUILD_VERSION,\n controller: 'grscicollInstitutionCtrl',\n controllerAs: 'grscicollInstitution'\n })\n .state('institutionKey', {\n parent: 'localization',\n url: '/grscicoll/institution/:key',\n views: {\n main: {\n templateUrl: '/api/template/institution/key.html?v=' + BUILD_VERSION,\n controller: 'institutionKeyCtrl',\n controllerAs: 'institutionKey'\n }\n }\n })\n .state('institutionKeyMetrics', {\n parent: 'institutionKey',\n url: '/metrics',\n templateUrl: '/templates/pages/grscicoll/institution/key/metrics/institutionKeyMetrics.html?v=' + BUILD_VERSION,\n controller: 'institutionKeyMetricsCtrl',\n controllerAs: 'institutionKeyMetrics'\n })\n .state('grscicollPersonSearch', {\n parent: 'grscicoll',\n url: '/person/search?q&offset',\n templateUrl: '/templates/pages/grscicoll/person/person.html?v=' + BUILD_VERSION,\n controller: 'grscicollPersonCtrl',\n controllerAs: 'grscicollPerson'\n })\n .state('grscicollPersonKey', {\n parent: 'localization',\n url: '/grscicoll/person/:key',\n views: {\n main: {\n templateUrl: '/api/template/grscicollPerson/key.html?v=' + BUILD_VERSION,\n controller: 'grscicollPersonKeyCtrl',\n controllerAs: 'grscicollPersonKey'\n }\n }\n })\n .state('contactUs', {\n parent: 'localization',\n url: '/contact-us',\n views: {\n main: {\n templateUrl: '/api/template/contactUs/contactUs.html?v=' + BUILD_VERSION + '&locale=' + LOCALE,\n controller: 'contactUsCtrl',\n controllerAs: 'contactUs'\n }\n }\n })\n .state('contactDirectory', {\n parent: 'contactUs',\n url: '/directory?personId&group',\n templateUrl: '/api/template/contactUs/directory.html?v=' + BUILD_VERSION,\n controller: 'contactDirectoryCtrl',\n controllerAs: 'contactDirectory'\n })\n .state('faq', {\n parent: 'localization',\n url: '/faq?question&q',\n views: {\n main: {\n templateUrl: '/api/template/faq.html?v=' + BUILD_VERSION,\n controller: 'faqCtrl',\n controllerAs: 'faq'\n }\n }\n })\n .state('user', {\n parent: 'localization',\n url: '/user',\n views: {\n main: {\n templateUrl: '/templates/pages/user/user.html?v=' + BUILD_VERSION,\n controller: 'userCtrl',\n controllerAs: 'user'\n }\n }\n })\n .state('userProfile', {\n parent: 'user',\n url: '/profile',\n templateUrl: '/templates/pages/user/profile/userProfile.html?v=' + BUILD_VERSION,\n controller: 'userProfileCtrl',\n controllerAs: 'userProfile'\n })\n .state('userDownloads', {\n parent: 'user',\n url: '/download?offset&limit',\n templateUrl: '/templates/pages/user/downloads/userDownloads.html?v=' + BUILD_VERSION,\n controller: 'userDownloadsCtrl',\n controllerAs: 'userDownloads'\n })\n .state('userValidations', {\n parent: 'user',\n url: '/validations?offset&limit',\n templateUrl: '/api/template/tools/dataValidator/myValidations.html?v=' + BUILD_VERSION,\n controller: 'myValidationsCtrl',\n controllerAs: 'myValidations'\n })\n .state('userSettings', {\n parent: 'user',\n url: '/settings',\n templateUrl: '/templates/pages/user/settings/userSettings.html?v=' + BUILD_VERSION,\n controller: 'userSettingsCtrl',\n controllerAs: 'userSettings'\n })\n .state('node', {\n parent: 'localization',\n url: '/node/:key?offset_datasets&offset_endorsed',\n views: {\n main: {\n templateUrl: '/api/template/node/key.html?v=' + BUILD_VERSION,\n controller: 'nodeKeyCtrl',\n controllerAs: 'nodeKey'\n }\n }\n })\n .state('participant', {\n parent: 'localization',\n url: '/participant/:key?offset_datasets&offset_endorsed',\n views: {\n main: {\n templateUrl: '/api/template/participant/key.html?v=' + BUILD_VERSION,\n controller: 'participantKeyCtrl',\n controllerAs: 'participantKey'\n }\n }\n })\n .state('installation', {\n parent: 'localization',\n url: '/installation/:key?offset',\n views: {\n main: {\n templateUrl: '/templates/pages/installation/key/installationKey.html?v=' + BUILD_VERSION,\n controller: 'installationKeyCtrl',\n controllerAs: 'installationKey'\n }\n }\n })\n .state('network', {\n parent: 'localization',\n url: '/network/:key',\n views: {\n main: {\n templateUrl: '/api/template/network.html?v=' + BUILD_VERSION,\n controller: 'networkKeyCtrl',\n controllerAs: 'networkKey'\n }\n }\n })\n .state('networkDataset', {\n parent: 'network',\n url: '/dataset?offset',\n templateUrl: '/templates/pages/network/key/dataset/networkDataset.html?v=' + BUILD_VERSION,\n controller: 'networkDatasetCtrl',\n controllerAs: 'networkDataset'\n })\n .state('networkPublisher', {\n parent: 'network',\n url: '/publisher?offset',\n templateUrl: '/templates/pages/network/key/publisher/networkPublisher.html?v=' + BUILD_VERSION,\n controller: 'networkPublisherCtrl',\n controllerAs: 'networkPublisher'\n })\n .state('networkMetrics', {\n parent: 'network',\n url: '/metrics',\n templateUrl: '/templates/pages/network/key/metrics/networkMetrics.html?v=' + BUILD_VERSION,\n controller: 'networkMetricsCtrl',\n controllerAs: 'networkMetrics'\n })\n .state('machineVision', {\n parent: 'localization',\n url: '/tools/machine-vision',\n views: {\n main: {\n templateUrl: '/api/machine-vision/machine-vision.html?v=' + BUILD_VERSION,\n controller: 'machineVisionCtrl',\n controllerAs: 'machineVision'\n }\n }\n })\n .state('machineVisionAbout', {\n parent: 'machineVision',\n url: '/about',\n templateUrl: '/templates/pages/network/key/dataset/networkDataset.html?v=' + BUILD_VERSION\n })\n .state('country', {\n parent: 'localization',\n url: '/country/:key',\n views: {\n main: {\n templateUrl: '/api/template/country.html?v=' + BUILD_VERSION,\n controller: 'countryKeyCtrl',\n controllerAs: 'countryKey'\n }\n }\n })\n .state('countrySummary', {\n parent: 'country',\n url: '/summary',\n templateUrl: '/api/template/country/summary.html?v=' + BUILD_VERSION,\n controller: 'countrySummaryCtrl',\n controllerAs: 'countrySummary'\n })\n .state('countryAbout', {\n parent: 'country',\n url: '/about',\n templateUrl: '/api/template/country/about.html?v=' + BUILD_VERSION,\n controller: 'countryAboutCtrl',\n controllerAs: 'countryAbout'\n })\n .state('countryPublishing', {\n parent: 'country',\n url: '/publishing',\n templateUrl: '/api/template/country/publishing.html?v=' + BUILD_VERSION,\n controller: 'countryPublishingCtrl',\n controllerAs: 'countryPublishing'\n })\n .state('countryParticipation', {\n parent: 'country',\n url: '/participation',\n templateUrl: '/api/template/country/participation.html?v=' + BUILD_VERSION,\n controller: 'countryParticipationCtrl',\n controllerAs: 'countryParticipation'\n })\n .state('countryResearch', {\n parent: 'country',\n url: '/publications/:relation?',\n templateUrl: '/api/template/country/publications.html?v=' + BUILD_VERSION,\n controller: 'countryResearchCtrl',\n controllerAs: 'countryResearch'\n })\n .state('countryProjects', {\n parent: 'country',\n url: '/projects',\n templateUrl: '/api/template/country/projects.html?v=' + BUILD_VERSION,\n controller: 'countryProjectsCtrl',\n controllerAs: 'countryProjects'\n })\n .state('health', {\n parent: 'localization',\n url: '/system-health',\n views: {\n main: {\n templateUrl: '/templates/pages/health/health.html?v=' + BUILD_VERSION,\n controller: 'healthCtrl',\n controllerAs: 'health'\n }\n }\n })\n .state('theGbifNetwork', {\n parent: 'localization',\n url: '/the-gbif-network/:region?',\n params: {region: {squash: true, value: 'global'}},\n views: {\n main: {\n templateUrl: '/templates/pages/theGbifNetwork/theGbifNetwork.html?v=' + BUILD_VERSION,\n controller: 'theGbifNetworkCtrl',\n controllerAs: 'vm'\n }\n }\n })\n .state('dataValidator', {\n parent: 'localization',\n url: '/tools/data-validator',\n views: {\n main: {\n templateUrl: '/api/template/tools/dataValidator.html?v=' + BUILD_VERSION,\n controller: 'dataValidatorCtrl',\n controllerAs: 'vm'\n }\n }\n })\n .state('dataValidatorAbout', {\n parent: 'dataValidator',\n url: '/about',\n templateUrl: '/api/template/tools/dataValidator/about.html?v=' + BUILD_VERSION,\n controller: 'dataValidatorAboutCtrl',\n controllerAs: 'dataValidatorAbout'\n })\n .state('myValidations', {\n parent: 'dataValidator',\n url: '/my-validations?offset&limit',\n templateUrl: '/api/template/tools/dataValidator/myValidations.html?v=' + BUILD_VERSION,\n controller: 'myValidationsCtrl',\n controllerAs: 'myValidations'\n })\n // .state('dataValidatorExtensions', {\n // parent: 'dataValidator',\n // url: '/extensions/:jobid?',\n // templateUrl: '/api/template/tools/dataValidator/extensions.html?v=' + BUILD_VERSION,\n // controller: 'dwcExtensionsCtrl',\n // controllerAs: 'vm'\n // })\n .state('dataValidatorKey', {\n parent: 'localization',\n url: '/tools/data-validator/:jobid',\n views: {\n main: {\n templateUrl: '/api/template/tools/dataValidatorKey.html?v=' + BUILD_VERSION,\n controller: 'dataValidatorKeyCtrl',\n controllerAs: 'vm'\n }\n }\n })\n\n // .state('dataValidatorExtensionsKey', {\n // parent: 'dataValidatorKey',\n // url: '/extensions',\n // templateUrl: '/api/template/tools/dataValidator/extensions.html?v=' + BUILD_VERSION,\n // controller: 'dwcExtensionsCtrl',\n // controllerAs: 'vm'\n // })\n // .state('dataValidatorAboutKey', {\n // parent: 'dataValidatorKey',\n // url: '/about',\n // templateUrl: '/api/template/tools/dataValidator/about.html?v=' + BUILD_VERSION,\n // controller: 'dataValidatorAboutCtrl',\n // controllerAs: 'dataValidatorAbout'\n // })\n .state('dataValidatorKeyDocument', {\n parent: 'dataValidatorKey',\n url: '/document',\n templateUrl: '/api/template/tools/dataValidator/document.html?v=' + BUILD_VERSION,\n controller: 'dataValidatorDocumentCtrl',\n controllerAs: 'vm'\n })\n\n\n .state('dataRepository', {\n parent: 'localization',\n url: '/data-repository',\n views: {\n main: {\n templateUrl: '/api/template/tools/dataRepository.html?v=' + BUILD_VERSION,\n controller: 'dataRepositoryCtrl',\n controllerAs: 'dataRepository'\n }\n }\n })\n .state('dataRepositoryUpload', {\n parent: 'dataRepository',\n url: '/upload',\n templateUrl: '/api/template/tools/dataRepository/upload.html?v=' + BUILD_VERSION,\n controller: 'dataRepositoryUploadCtrl',\n controllerAs: 'dataRepositoryUpload'\n })\n .state('dataRepositoryAbout', {\n parent: 'dataRepository',\n url: '/about',\n templateUrl: '/api/template/tools/dataRepository/about.html?v=' + BUILD_VERSION,\n controller: 'dataRepositoryAboutCtrl',\n controllerAs: 'dataRepositoryAbout'\n })\n .state('dataRepositoryKey', {\n parent: 'localization',\n url: '/data-repository/upload/:key',\n views: {\n main: {\n templateUrl: '/api/template/tools/dataRepository/key.html?v=' + BUILD_VERSION,\n controller: 'dataRepositoryKeyCtrl',\n controllerAs: 'dataRepositoryKey'\n }\n }\n })\n .state('derivedDataset', {\n parent: 'localization',\n url: '/derived-dataset?offset&limit',\n views: {\n main: {\n templateUrl: '/api/template/tools/derivedDataset.html?v=' + BUILD_VERSION,\n controller: 'derivedDatasetCtrl',\n controllerAs: 'derivedDataset'\n }\n }\n })\n .state('derivedDatasetUpload', {\n parent: 'derivedDataset',\n url: '/register',\n params: {\n record: null\n },\n templateUrl: '/api/template/tools/derivedDataset/upload.html?v=' + BUILD_VERSION,\n controller: 'derivedDatasetUploadCtrl',\n controllerAs: 'derivedDatasetUpload'\n })\n .state('derivedDatasetAbout', {\n parent: 'derivedDataset',\n url: '/about',\n templateUrl: '/api/template/tools/derivedDataset/about.html?v=' + BUILD_VERSION,\n controller: 'derivedDatasetAboutCtrl',\n controllerAs: 'derivedDatasetAbout'\n })\n .state('occurrenceSnapshots', {\n parent: 'localization',\n url: '/occurrence-snapshots?offset&limit',\n views: {\n main: {\n templateUrl: '/api/template/occurrenceSnapshots/index.html?v=' + BUILD_VERSION,\n controller: 'occurrenceSnapshotsCtrl',\n controllerAs: 'vm'\n }\n }\n })\n ;\n\n // if unknown route then go to server instead of redirecting to home: $urlRouterProvider.otherwise('/');\n\n // We do not support ie9 and browsers without history api https://docs.angularjs.org/error/$location/nobase\n $locationProvider.html5Mode({\n enabled: true,\n requireBase: false,\n rewriteLinks: false\n });\n $locationProvider.hashPrefix('!');\n}", "function checkAuth() {\n if (CONFIG.userLogged) {\n $location.path('/home');\n }\n }", "function _appLinkRouter(){\n $( document ).on('click', 'a[href^=\"/\"]', function(event) {\n\n var href, passThrough, url;\n href = $(event.currentTarget).attr('href');\n // passThrough = href.indexOf('sign_out') >= 0;\n if (!event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {\n event.preventDefault();\n url = href.replace('/', '');\n\n url = lang + '/' + url;\n\n if(P.FullscreenHandler.getIsFullscreen() === false){\n P.AppRouter.navigate(url, {\n trigger: true\n });\n }else{\n P.Presenter.prototype.call( url );\n }\n \n return false;\n }\n });\n }", "function ApplicationConfig($stateProvider, $urlRouterProvider, formlyConfigProvider) {\n\n $stateProvider\n .state('form', {\n url: '/form/:formTemplate'\n , params: {\n formTemplate: {\n value: 'default'\n }\n }\n , templateUrl: 'views/form.html'\n , controller: 'FormController as Form'\n })\n .state('edit', {\n url: '/edit/:formTemplate/result/:resultId'\n , templateUrl: 'views/form.html'\n , controller: 'FormEditController as Form'\n });\n\n // fallback routes\n $urlRouterProvider.otherwise('/form/default');\n\n // extend angular-formly with custom templates\n formlyConfigProvider.setTemplateUrl('multi-checkbox', 'views/multi-checkbox-template.html');\n formlyConfigProvider.setTemplateUrl('well-multi-checkbox', 'views/well-multi-checkbox-template.html');\n formlyConfigProvider.setTemplateUrl('well-text', 'views/well-text.html');\n formlyConfigProvider.setTemplateUrl('well-number', 'views/well-number.html');\n\n}", "function config($stateProvider) {\n\t\t$stateProvider.state('error', {\n\t\t\turl: '/recover',\n\t\t\tparams: {\n\t\t\t\terrorInfo: {}\n\t\t\t},\n\t\t\tviews: {\n\t\t\t\t'content@': {\n\t\t\t\t\ttemplateUrl: 'views/error.html',\n\t\t\t\t\tcontroller: 'ErrorCtrl'\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function Router ($stateProvider, $urlRouterProvider, $locationProvider) {\r\n\r\n // Default state.\r\n $urlRouterProvider.otherwise(\"/dashboard/\");\r\n\r\n // State definitions.\r\n $stateProvider\r\n .state(\"root\", {\r\n abstract: true,\r\n templateUrl: \"static/states/root.html\",\r\n controller: \"RootController as root\"\r\n })\r\n .state(\"root.signup\", {\r\n url: \"/signup/\",\r\n templateUrl: \"static/states/signup/signup.html\",\r\n controller: \"SignupController as signup\",\r\n registration: true\r\n })\r\n .state(\"root.login\", {\r\n url: \"/login/\",\r\n templateUrl: \"static/states/login/login.html\",\r\n controller: \"LoginController as login\",\r\n registration: true\r\n })\r\n .state(\"root.dashboard\", {\r\n url: \"/dashboard/\",\r\n templateUrl: \"static/states/dashboard/dashboard.html\",\r\n controller: \"DashboardController as dashboard\",\r\n protected: true\r\n });\r\n}", "function showAdmin(){\n addTemplate(\"admin\");\n userAdmin();\n}", "get adminPath() {\n const paths = this.props.location.pathname.match(cmsRegexp);\n return paths[0] ? paths[0] : '';\n }", "function appRun($rootScope, $location, logger) {\n\n //var handlingRouteChangeError = false;\n //handleRoutingErrors(); //TODO: get this working\n authRouting();\n\n //////////////////\n\n //TODO: never got this working, look at it again later\n /*function handleRoutingErrors() {\n // Route cancellation:\n // On routing error, go to the dashboard.\n // Provide an exit clause if it tries to do it twice.\n $rootScope.$on('$routeChangeError',\n function(event, current, previous, rejection) {\n //if (handlingRouteChangeError) {\n // return;\n //}\n //routeCounts.errors++;\n //handlingRouteChangeError = true;\n var destination = (current && (current.title || current.name || current.loadedTemplateUrl)) ||\n 'unknown target';\n var msg = 'Error routing to ' + destination + '. ' + (rejection.msg || '');\n logger.warning(msg, [current]);\n $location.path('/');\n }\n );\n }*/\n\n function authRouting() {\n $rootScope.$on(\"$locationChangeStart\", function (event, next, current) {\n if ($rootScope.isAuthenticated !== true && next.templateUrl !== \"/loading\") {\n logger.warning('Not authenticated, rerouting to /loading');\n $location.path('/loading');\n }\n });\n }\n }", "configureRouter(config, router) {\n config.map([\n {\n route: [\"\", \"home\"],\n moduleId: \"src/views/home/home.js\",\n nav: true,\n title: \"Home\"\n },\n {\n route: \"contacts\",\n moduleId: \"src/views/contacts/contacts.js\",\n nav: true,\n title: \"Contacts\"\n }\n ]);\n this.router = router;\n // Comment the following lines out if you don't wanna use push state\n // and just use simple # base routing instead\n // config.options.pushState = true;\n // config.options.root = \"/\";\n }", "function config($routeProvider, $locationProvider, $httpProvider, $compileProvider) {\n\n // routes\n $routeProvider\n .when('/calculator', {\n templateUrl: 'views/calculator.html',\n controller: 'CalculatorController',\n controllerAs: 'calculator'\n })\n\n }", "function setPublicRoutes() {\n}", "function routeConfig($stateProvider) {\n\n\n /* we register the states associated with the cities */\n $stateProvider\n //.state('politician-list', {\n // url: '/legislations',\n // templateUrl: 'modules/politician/client/views/legislations.list.view.html',\n // controller: 'LegislationsController',\n // controllerAs: 'vm'\n //})\n .state('politician-detail',{\n url: '/politician/:id',\n templateUrl: 'modules/politician/client/views/politician.profile.view.html',\n controller: 'PoliticianController',\n controllerAs: 'vm'\n });\n }", "function registerRoutes(moduleName, ngModule, parentStateName) {\n if (parentStateName === void 0) { parentStateName = \"\"; }\n parentStateName = parentStateName ? parentStateName + \".\" : \"\";\n ngModule\n .config(['stateHelperProvider', '$urlRouterProvider', function configRoutes(stateHelperProvider, $urlRouterProvider) {\n stateHelperProvider\n .state({\n name: parentStateName + 'xtier-Theme',\n url: '/xtier-Theme',\n abstract: true,\n templateUrl: 'app/_XTier.Theme/ngViews/wiki.html',\n children: [\n {\n name: 'wiki',\n url: '/wiki',\n views: {\n 'mainMenu': {\n templateUrl: 'app/_XTier.Theme/ngViews/menu/mainMenu.html'\n },\n 'info': {\n template: '<div ui-view class=\"themeWiki-content\"></div>'\n }\n },\n children: [\n {\n name: 'simpleElements',\n url: '/simpleElements',\n template: '<div ui-view></div>',\n children: [\n {\n name: 'blankBox',\n url: '/blankbox',\n templateUrl: 'app/_XTier.Theme/ngViews/simpleElements/blankBox.html'\n },\n {\n name: 'blankBoxTitle',\n url: '/blankboxTitle',\n templateUrl: 'app/_XTier.Theme/ngViews/simpleElements/blankBoxTitle.html'\n },\n {\n name: 'labeledContainer',\n url: '/labeledContainer',\n templateUrl: 'app/_XTier.Theme/ngViews/simpleElements/labeledContainer.html'\n },\n {\n name: 'horizontalKvps',\n url: '/horizontalKvps',\n templateUrl: 'app/_XTier.THeme/ngViews/simpleElements/horizontalKvps.html'\n }\n ]\n },\n {\n name: 'formElements',\n url: '/formElements',\n template: '<div ui-view></div>',\n children: [\n {\n name: 'textInput',\n url: '/textInput',\n templateUrl: 'app/_XTier.Theme/ngViews/formElements/formElements.html#textInput'\n },\n {\n name: 'textArea',\n url: '/textArea',\n templateUrl: 'app/_XTier.Theme/ngViews/formElements/formElements.html#textArea'\n },\n {\n name: 'submitButton',\n url: '/submitButton',\n templateUrl: 'app/_XTier.Theme/ngViews/formElements/formElements.html#submitButton'\n }\n ]\n }\n ]\n }\n ]\n });\n }]);\n }", "function htmlRoutes(app) {\n app.get('/survey', function (req, res) {\n res.sendFile(path.join(__dirname + '/../public/survey.html'));\n });\n\n // A default USE route that leads to home.html which displays the home page.\n app.use(function (req, res) {\n res.sendFile(path.join(__dirname + '/../public/home.html'));\n });\n\n}", "function AppController($scope, $state) {\n\n\t\t$scope.isLogged = function() {\n\t\t\tif ($state.current.url === '/auth') {\n\t\t\t\treturn false;\n\t\t\t} else {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t};\n\n\t}", "function App() {\n return (\n // <Admin dataProvider={springRestProvider('http://localhost:8080')} authProvider={authProvider}>\n <Admin dataProvider={springRestProvider('http://localhost:8080')}>\n <Resource name='posts' list={PostList} create={PostCreate} edit={PostEdit} />\n {/* <Resource name='users' list={UserList} create={UserCreate} edit={UserEdit} /> */}\n </Admin>\n );\n}", "function $RouteProvider() {\n\n var routes = [];\n var subscriptionFn = null;\n\n var routeMap = {};\n\n // Stats for which routes are skipped\n var skipCount = 0;\n var successCount = 0;\n var allCount = 0;\n\n function consoleMetrics() {\n return '(' + skipCount + ' skipped / ' + successCount + ' success / ' + allCount + ' total)';\n }\n\n\n /**\n * @ngdoc method\n * @name $routeProvider#when\n *\n * @param {string} path Route path (matched against `$location.path`). If `$location.path`\n * contains redundant trailing slash or is missing one, the route will still match and the\n * `$location.path` will be updated to add or drop the trailing slash to exactly match the\n * route definition.\n *\n * @param {Object} route Mapping information to be assigned to `$route.current` on route\n * match.\n */\n this.when = function(path, route) {\n //copy original route object to preserve params inherited from proto chain\n var routeCopy = angular.copy(route);\n\n allCount++;\n\n if (angular.isDefined(routeCopy.reloadOnSearch)) {\n console.warn('Route for \"' + path + '\" uses \"reloadOnSearch\" which is not implemented.');\n }\n if (angular.isDefined(routeCopy.caseInsensitiveMatch)) {\n console.warn('Route for \"' + path + '\" uses \"caseInsensitiveMatch\" which is not implemented.');\n }\n\n // use new wildcard format\n path = reformatWildcardParams(path);\n\n if (path[path.length - 1] == '*') {\n skipCount++;\n console.warn('Route for \"' + path + '\" ignored because it ends with *. Skipping.', consoleMetrics());\n return this;\n }\n\n if (path.indexOf('?') > -1) {\n skipCount++;\n console.warn('Route for \"' + path + '\" ignored because it has optional parameters. Skipping.', consoleMetrics());\n return this;\n }\n\n if (typeof route.redirectTo == 'function') {\n skipCount++;\n console.warn('Route for \"' + path + '\" ignored because lazy redirecting to a function is not yet implemented. Skipping.', consoleMetrics());\n return this;\n }\n\n\n var routeDefinition = {\n path: path,\n data: routeCopy\n };\n\n routeMap[path] = routeCopy;\n\n if (route.redirectTo) {\n routeDefinition.redirectTo = [routeMap[route.redirectTo].name];\n } else {\n if (routeCopy.controller && !routeCopy.controllerAs) {\n console.warn('Route for \"' + path + '\" should use \"controllerAs\".');\n }\n\n var componentName = routeObjToRouteName(routeCopy, path);\n\n if (!componentName) {\n throw new Error('Could not determine a name for route \"' + path + '\".');\n }\n\n routeDefinition.component = componentName;\n routeDefinition.name = route.name || upperCase(componentName);\n\n var directiveController = routeCopy.controller;\n\n var componentDefinition = {\n controller: directiveController,\n controllerAs: routeCopy.controllerAs\n\n };\n if (routeCopy.templateUrl) componentDefinition.templateUrl = routeCopy.templateUrl;\n if (routeCopy.template) componentDefinition.template = routeCopy.template;\n\n\n // if we have route resolve options, prepare a wrapper controller\n if (directiveController && routeCopy.resolve) {\n var originalController = directiveController;\n var resolvedLocals = {};\n\n componentDefinition.controller = ['$injector', '$scope', function ($injector, $scope) {\n var locals = angular.extend({\n $scope: $scope\n }, resolvedLocals);\n\n return $injector.instantiate(originalController, locals);\n }];\n\n // we resolve the locals in a canActivate block\n componentDefinition.controller.$canActivate = function() {\n var locals = angular.extend({}, routeCopy.resolve);\n\n angular.forEach(locals, function(value, key) {\n locals[key] = angular.isString(value) ?\n $injector.get(value) : $injector.invoke(value, null, null, key);\n });\n\n return $q.all(locals).then(function (locals) {\n resolvedLocals = locals;\n }).then(function () {\n return true;\n });\n };\n }\n\n // register the dynamically created directive\n $compileProvider.component(componentName, componentDefinition);\n }\n if (subscriptionFn) {\n subscriptionFn(routeDefinition);\n } else {\n routes.push(routeDefinition);\n }\n successCount++;\n\n return this;\n };\n\n this.otherwise = function(params) {\n if (typeof params === 'string') {\n params = {redirectTo: params};\n }\n this.when('/*rest', params);\n return this;\n };\n\n\n this.$get = ['$q', '$injector', function (q, injector) {\n $q = q;\n $injector = injector;\n\n var $route = {\n routes: routeMap,\n\n /**\n * @ngdoc method\n * @name $route#reload\n *\n * @description\n * Causes `$route` service to reload the current route even if\n * {@link ng.$location $location} hasn't changed.\n */\n reload: function() {\n throw new Error('Not implemented: $route.reload');\n },\n\n /**\n * @ngdoc method\n * @name $route#updateParams\n */\n updateParams: function(newParams) {\n throw new Error('Not implemented: $route.updateParams');\n },\n\n /**\n * Runs the given `fn` whenever new configs are added.\n * Only one subscription is allowed.\n * Passed `fn` is called synchronously.\n */\n $$subscribe: function(fn) {\n if (subscriptionFn) {\n throw new Error('only one subscription allowed');\n }\n subscriptionFn = fn;\n subscriptionFn(routes);\n routes = [];\n },\n\n /**\n * Runs a string with stats about many route configs were adapted, and how many were\n * dropped because they are incompatible.\n */\n $$getStats: consoleMetrics\n };\n\n return $route;\n }];\n\n }", "function Admin(){\n return(\n <BrowserRouter>\n <Fragment>\n <Switch>\n <Route path=\"/admin\" render={(props) => <DashboardAdmin {...props} />} />\n <Redirect to=\"/admin/dashboard\" />\n </Switch>\n </Fragment>\n </BrowserRouter>\n )\n}", "function adminLogin(){\n if(sessionStorage.getItem(\"isActive\")){\n window.location.replace(\"../html/admin.html\");\n }\n else{\n window.location.replace(\"../html/error/error.html\");\n }\n }", "function login(){\n debugger;\n $location.path(\"/about\" );\n }", "function generalRoutes(){\t\n\t\n\t// default GET\n\tapp.get('*',\n\t\tfunction (req, res) {\n\t\t res.sendfile('./public/index.html');\n\t\t});\n \n }", "config() {\n this.router.get('/', medicosEspecialidadesController_1.medicosEspecialidadesController.list);\n this.router.get('/:id', medicosEspecialidadesController_1.medicosEspecialidadesController.getOne);\n this.router.post('/', medicosEspecialidadesController_1.medicosEspecialidadesController.create);\n this.router.delete('/:id', medicosEspecialidadesController_1.medicosEspecialidadesController.delete);\n this.router.put('/:id', medicosEspecialidadesController_1.medicosEspecialidadesController.update);\n }" ]
[ "0.70081425", "0.67581046", "0.6521661", "0.6463842", "0.62978435", "0.6270588", "0.6248024", "0.6082253", "0.6050122", "0.603999", "0.6039961", "0.6029623", "0.6015504", "0.60119295", "0.5923023", "0.5915811", "0.59057236", "0.5884399", "0.58723426", "0.58223176", "0.5808531", "0.5799196", "0.5772271", "0.57546854", "0.57207537", "0.5680068", "0.5676607", "0.5645784", "0.56202316", "0.5595408", "0.557915", "0.55708516", "0.5526423", "0.5514908", "0.54968464", "0.54739237", "0.54674387", "0.5418058", "0.5360428", "0.5340697", "0.5332492", "0.5332492", "0.5325933", "0.53181994", "0.52951825", "0.5281279", "0.5248815", "0.5214909", "0.52059436", "0.5194611", "0.5182696", "0.5178391", "0.51772785", "0.51390195", "0.51299185", "0.51236075", "0.5116014", "0.5111491", "0.51074475", "0.5094604", "0.50778776", "0.50696784", "0.5066519", "0.5065979", "0.5065979", "0.50598943", "0.50481796", "0.5041649", "0.50398344", "0.5034149", "0.50283426", "0.50283045", "0.50274044", "0.50172156", "0.50114626", "0.5007249", "0.4998176", "0.49979815", "0.49921858", "0.4988153", "0.49871075", "0.49698287", "0.49555165", "0.49486655", "0.49484536", "0.49362257", "0.4928872", "0.4918779", "0.4911178", "0.49023965", "0.4898876", "0.48951426", "0.4875646", "0.48741397", "0.48738906", "0.48674336", "0.4866144", "0.4858248", "0.4856201", "0.4855836", "0.4855305" ]
0.0
-1
Validation for correct component functioning
componentWillMount() { const { headers } = this.props; const keys = Object.keys(this.props.data[0]); headers.forEach(h => { if (keys.indexOf(h) === -1) { throw new Error('One of the headers provided do not match a property from the row entity, please revise' + '"headers" and "data" props supplied'); } }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function validate(){\n\n\t\t//TODO: make this work\n\n\n\t}", "isValid(){\n let component = this.props.component\n let key = this.props.attribute\n return !component.state.data[key].error\n }", "isValid(): boolean {\n return this.innerComponent.isValid();\n }", "@action\n async validate() {\n if (this.args.parent === undefined) {\n if (this.args.alone) return; // if input is alone ignore\n }\n\n let value = this.args.value || this.args.selected;\n const res = await this.parent.state.validationSchema.validationFor(this.name,value,this);\n this.parent.updateState(); \n this.error = res;\n }", "validate() { }", "validate() {}", "function validation() {\r\n\t\t\r\n\t}", "validate() {\n // Als NIET (!) valide, dan error weergeven\n if (!this.isValid()) {\n this.showError();\n console.log(\"niet valide\");\n }\n else\n this.hideError();\n }", "whenValid() {\n\n }", "selfValidate(){\n\n }", "validInput(value) {\r\n let props = this.props;\r\n if (!value)\r\n return props.eReq;\r\n else if (props.eClientValidation)\r\n return props.eClientValidation(value, props.inputProps.floatingLabelText)\r\n return null;\r\n }", "checkValidity () {\n\n // Validate generic fields\n let fields = this.getFieldsForType('generic');\n for (let i in fields) {\n const valid = this.input[fields[i]].checkValidity();\n if (!valid) return false;\n };\n\n // Adjust source validation based on selected format\n const type = this.input.type.value;\n if (type === 'image' || type === 'video') {\n const format = this.input[`${type}_format`].value;\n this.input[`${type}_source`].pattern = `^.+${format}$`;\n }\n\n // Validate type specific fields\n fields = this.getFieldsForType(type);\n for (let i in fields) {\n const valid = this.input[`${type}_${fields[i]}`].checkValidity();\n if (!valid) return false;\n };\n\n return true;\n }", "validateInput()\n {\n return this.refs.date.isValid()\n && this.refs.amount.isValid()\n && this.refs.account.isValid()\n }", "function isValidStep() {\n if ($scope.inputs.enterpriseLabel === '' || !$scope.inputs.enterpriseLabel) {\n trackClientLabelFail('Missing Enterprise Name');\n $scope.setFormError('Please enter organization name.');\n return false;\n }\n if ($scope.inputs.enterpriseLabel.indexOf('.') !== -1) {\n trackClientLabelFail('Invalid Organization Name');\n $scope.setFormError('Organization names cannot contain periods.');\n return false;\n }\n if ($scope.inputs.enterpriseLabel.length > 50) {\n trackClientLabelFail('Invalid Organization Name Length');\n $scope.setFormError('Organization names cannot be longer than 50 characters.');\n return false;\n }\n return true;\n }", "_validate() {\n\t}", "function IUIControlValidateFromParent() {}", "checkValidity(context, event) {\n throw new Error('Implement in subclass');\n }", "checkValidity(context, event) {\n throw new Error('Implement in subclass');\n }", "validateForm() {\n return this.state.serviceName.length > 0 && this.state.description.length > 0 && this.state.location.length > 0 && this.state.category.length > 0 && this.state.url.length > 0\n }", "function ProposedValidation() {\n var bool = true;\n var Lo_Obj = [\"ddlProType\", \"txtProLimit\", \"txtProOutstand\", \"txtProBanker\", \"txtProCollateral\", \"txtProROI\", \"txtProTenure\"];\n var Ls_Msg = [\"Facilites Type\", \"Limit\", \"Outstand\", \"Banker\", \"Collateral\", \"ROI\", \"Tenure\"];\n\n if (!CheckMandatory(Lo_Obj, Ls_Msg)) {\n return false;\n }\n return bool;\n}", "function valid(){return validated}", "validateComponent() {\n let requiredFunctions = ['initSearch', 'openSearch', 'closeSearch', 'navigateUp', 'navigateDown'];\n for (var f in requiredFunctions) {\n if (typeof(this.searchComponent[requiredFunctions[f]]) != \"function\") {\n return false; }\n }\n return true;\n }", "function validateComponent(component) {\n const {componentUrl, componentId, requestType, payload, componentName, checkInterval} = component; \n console.log(`Validating components (${componentName})`);\n\n if (componentId && componentUrl && requestType && componentName && checkInterval){\n if(requestType.toLowerCase() == 'post' && !payload) {\n \n console.log(`The Component with url: ${componentUrl} has a requestType of post and as such must have a payload eg \n payload:{\n component: value\n }`);\n return false;\n }\n else if(checkInterval <= 60000){\n console.log(`The Component with url: ${componentUrl} must have a setInterval greater than 45secs`);\n return false;\n } else {\n console.log(`Components (${componentName}) validated`);\n return true;\n } \n } \n else{\n console.log(`your component parameters are incomplete, check to make sure these \nparameters exist\n componentUrl\n componentId \n requestType \n setInterval\n payload\n componentName\n `);\n return false;\n }\n}", "validateInputs(){\r\n if(this.state.brand === \"\" || this.state.plates === \"\" || (this.state.year===\"\" || isNaN(this.state.year)) || this.state.currentState===\"\" || this.state.model===\"\" || this.state.type===\"\" || this.state.color===\"\" || this.state.niv===\"\" || this.state.gasoline===\"\" || this.state.circulation===\"\"){\r\n return false;\r\n\r\n }\r\n else{\r\n return true;\r\n }\r\n }", "constructor() {\n super(...arguments);\n this.name = this.args.validation;\n this.parent = this.args.parent;\n\n if (this.args.parent === undefined) {\n if (this.args.alone) return; // if input is alone ignore\n\n throw new ConfigurationException(`Component '${this.constructor.name}' needs to have a 'BaseValidationFormComponent' instance as '@parent' , if you want this component without validation and parent use '@alone={{true}}' as argument to the input. Note that the validate() method will throw an error if called`);\n }else{\n if (this.parent.state.validationSchema === undefined) {\n throw new ConfigurationException(`Component '${this.constructor.name}' needs to have a 'BaseValidator' instance as '@schema' , if you want this component without validation and parent use '@alone={{true}}' as argument to the input. Note that the validate() method will throw an error if called`);\n }\n }\n\n if (!this.args.value && !this.args.selected) {\n // eslint-disable-next-line no-console\n console.warn(`Component '${this.constructor.name}' seems to have an undefined @validation attribute`);\n }\n\n if (!this.args.validation) {\n throw new ConfigurationException(`Component '${this.constructor.name}' needs to have a '@validation' attribute , if you want this component without validation and parent use '@alone={{true}}' as argument to the input. Note that the validate() method will throw an error if called`);\n }\n\n this.parent.registerChild(this);\n }", "onCheckFormValue(newSoftware) {\n let invalid = false;\n\n if (!_.trim(newSoftware.softwareType).length) {\n invalid = true;\n }\n\n if (!_.trim(newSoftware.name).length) {\n invalid = true;\n }\n\n this.setState({ formInvalid: invalid });\n return invalid;\n }", "function isECourseFormValid(){\r\n return( CourseNameField.isValid() && CourseDaysField.isValid());\r\n }", "function validateComponent(key, message) {\n\t\t\t\t\tkey = stringPrettify(key);\n\t\t\t\t\t$scope.recipeValidationMessages.push(capitalizeFirstLetter(key) + \" \" + message);\n\t\t\t\t\t$scope.isRecipeValidated = false;\n\t\t\t\t}", "checkValidity() {\n const { valid } = this.checkValidityAndDispatch();\n return valid;\n }", "function validate() {\n const element = inputField.current;\n const validityState = element.validity;\n\n if (validityState.valueMissing)\n return { message: `${props.label} is required.`, element };\n if (validityState.tooShort)\n return {\n message: `${props.label} must be at least ${minLength} characters long.`,\n element,\n };\n if (validityState.tooLong)\n return {\n message: `${props.label} must be less than or equal to ${maxLength} characters long.`,\n element,\n };\n return null;\n }", "validate(value: any): Array<string> {\n return this.innerComponent.validate(value);\n }", "handleDynamicRequired(event) {\r\n if(event.target.value === \"email\") {\r\n this.enableHasError(\"email\", true);\r\n let email = document.getElementById(\"email\");\r\n let control = \"emailControl\";\r\n // pattern match test\r\n if(this.state.employee.contactPreference===\"email\" && email.pattern){\r\n if(RegExp(email.pattern).test(email.value)){\r\n // valid\r\n this.setState(prevState => ({[control]: {\r\n touched: true,\r\n invalid: false,\r\n hasError: false,\r\n hasSuccess: true\r\n }}));\r\n } else {\r\n // invalid pattern\r\n this.setState(prevState => ({[control]: {\r\n touched: true,\r\n invalid: true,\r\n hasError: true,\r\n hasSuccess: false\r\n }}));\r\n }\r\n }\r\n this.enableHasError(\"phoneNumber\", false);\r\n } else if(event.target.value === \"phoneNumber\") {\r\n this.enableHasError(\"phoneNumber\", true);\r\n this.enableHasError(\"email\", false);\r\n }\r\n }", "validateProps() {\n validateProps(this.props);\n }", "function checkValidity() {\n if (invalidWidgetIds.length > 0) {\n msgService.showInfoRight(localization.getString('emailbuilder.error.unfilledrequiredproperties'));\n } else {\n msgService.hideInfoRight();\n }\n }", "validate( _value, _utils ) {\n\t\t\treturn false;\n\t\t}", "formValidate() {\n\t\tconst allValid = [\n\t\t\t...this.template.querySelectorAll('lightning-input, lightning-combobox')\n\t\t].reduce((validSoFar, inputCmp) => {\n\t\t\tinputCmp.reportValidity();\n\t\t\treturn validSoFar && inputCmp.checkValidity();\n\t\t}, true);\n\t\treturn allValid;\n }", "function Validate(){}", "function Validate(){}", "function validateComponents(listComponentsName, clear) {\n var listCmp = listComponentsName;\n for (var i = 0; i < listCmp.length; i++) {\n var idCmp = listCmp[i].toString();\n var element = $(\"#\" + idCmp);\n var tagName = element.prop('tagName');\n var isOk = true;\n var defaultOptions = new Object();\n defaultOptions[\"elementPaint\"] = element;\n defaultOptions[\"focus\"] = element;\n if (tagName === \"INPUT\") {\n var type = element.prop('type');\n var notification = false;\n if (type === \"text\") {\n if (element.val() === '') {\n notification = true;\n }\n } else if (type === \"date\") {\n var valueDate = $(element).val();\n if (!Date.parse(valueDate)) {\n notification = true;\n }\n }\n } else if (tagName === \"SELECT\") {\n defaultOptions[\"elementPaint\"] = element.parent();\n defaultOptions[\"focus\"] = element;\n var valueSelect = $(element).val();\n if (!valueSelect) {\n notification = true;\n }\n } else if (tagName === \"DIV\") {\n if ($(element).hasClass(\"edit\")) {\n var getTextKey = $(element).children(\".editKey\");\n defaultOptions[\"elementPaint\"] = element;\n defaultOptions[\"focus\"] = getTextKey;\n if (element.attr(\"value\") === undefined || element.attr(\"value\") === \"\") {\n notification = true;\n }\n }\n }\n if (clear === undefined) {\n if (notification) {\n $(defaultOptions[\"elementPaint\"]).css('box-shadow', '0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9');\n defaultOptions[\"focus\"].focus();\n isOk = false;\n alert(\"Este componente esta vacio\");\n break;\n } else {\n $(defaultOptions[\"elementPaint\"]).css(\"box-shadow\", \"none\");\n }\n }\n else {\n $(defaultOptions[\"elementPaint\"]).css(\"box-shadow\", \"none\");\n }\n }\n //Start validation\n return isOk;\n}", "validate() {\n this.errorMessage = \"Dit is geen text\";\n super.validate();\n }", "should_indicate_invalid()\n\t{\n\t\tconst { indicateInvalid, error } = this.props\n\t\treturn indicateInvalid && error\n\t}", "checkValidity() {\n if (this.inputElement.validate) {\n return this.inputElement.validate();\n }\n }", "function validate() {\n const element = inputField.current;\n const validityState = element.validity;\n\n if (validityState.valueMissing)\n return { message: `${labelName} is required.`, element };\n if (validityState.tooShort)\n return {\n message: `${labelName} must be at least ${minLength} characters long.`,\n element,\n };\n if (validityState.tooLong)\n return {\n message: `${labelName} must be less than or equal to ${maxLength} characters long.`,\n element,\n };\n return null;\n }", "function customValidation(input) { \n}", "should_indicate_invalid()\n\t{\n\t\tconst { indicateInvalid, error } = this.props\n\n\t\treturn indicateInvalid && error\n\t}", "afterValidChange() { }", "validate() {\n if (this.proxy instanceof HTMLElement) {\n this.setValidity(this.proxy.validity, this.proxy.validationMessage);\n }\n }", "validateForm () {\n const form = this.panelEl.querySelector('.panel-content');\n if (!form.checkValidity()) {\n this.fail('Please correct errors navmesh configuration.');\n }\n }", "validate(_value, _utils) {\n return false;\n }", "checkValidity() {\n this.validState = this.currentDataState.name && \n +this.currentDataState.amount && +this.currentDataState.maximumRides;\n }", "validate() {\n\t\t\n\t\tconst valid = (\n\t\t\tvalidatePatientID(\n\t\t\t\t'patientID', \n\t\t\t\tthis.props.patientID, \n\t\t\t\tthis.setError\n\t\t\t)\n\t\t);\n\t\t\n\t\treturn valid;\n\t}", "validateInputs() {\n let inps = [].concat(\n this.queryAll(\"lightning-combobox\"),\n this.queryAll(\"lightning-input-field\"),\n );\n return inps.filter(inp => !inp.reportValidity()).length === 0;\n }", "get validity() {\n return this.getInput().validity;\n }", "validate() {\n const { tmpTarget } = ReduxStore.getState().innerState\n const isValidSuccess = validator.target(tmpTarget)\n return isValidSuccess\n }", "validInput(value) {\n if (!value)\n return this.props.eReq;\n return null;\n }", "validateDatasetForm() {\n if(this.nameValidationState != undefined && this.descValidationState != undefined && this.attribValidationState != undefined) {\n if(this.nameValidationState == 'error' || this.descValidationState == 'error' || this.attribValidationState == 'error') {\n return true;\n } else {\n return false;\n }\n } else {\n return true;\n }\n }", "isValid() {\n return this.validation.isValid && !this.props.posting\n }", "isValidData(temp) {\n const { data } = this.state;\n\n let errorList = [];\n\n // Check ten\n if (data.Name == \"\") {\n this.refs['txtName'].setValid(false);\n\n errorList.push({\n name: 'Name',\n msg: strings('dl.contract_list.noti.err.name')\n });\n } else {\n this.refs['txtName'].setValid(true);\n }\n\n // Check phone\n if (data.Phone == \"\") {\n this.refs['txtPhone'].setValid(false);\n\n errorList.push({\n name: 'Phone',\n msg: strings('dl.contract_list.noti.err.phone')\n });\n } else {\n this.refs['txtPhone'].setValid(true);\n }\n\n // Check phone\n if (data.ReasonId == null) {\n this.refs['optChoice'].setValid(false);\n\n errorList.push({\n name: 'Reason',\n msg: strings('dl.contract_list.noti.err.reason')\n });\n } else {\n this.refs['optChoice'].setValid(true);\n }\n\n if (errorList.length == 0) {\n return true;\n }\n\n this.refs['popup'].getWrappedInstance().show(errorList[0].msg);\n return false;\n }", "checkReqFields() {\n // Check the generic name field\n if (this.state.genericName == DEFAULT_GENERIC_NAME) {\n Alert.alert(\"Please enter a value for the generic name.\");\n return (false);\n }\n\n return (true);\n }", "isValid() {\n\t\t// deconstruct the props\n\t\tconst {errors, isValid } = validateInput(this.state);\n\t\tthis.setState({ errors });\n\t\treturn isValid;\n\t}", "isValid() {\n return true;\n }", "isValid() {\n return true;\n }", "validateForm() {\r\n return (this.state.mission.missionDesc.trim().length > 0)\r\n }", "function Validate() {}", "validate() {\n // Check required top level fields\n for (const requiredField of [\n 'description',\n 'organizationName',\n 'passTypeIdentifier',\n 'serialNumber',\n 'teamIdentifier',\n ])\n if (!(requiredField in this.fields))\n throw new ReferenceError(`${requiredField} is required in a Pass`);\n // authenticationToken && webServiceURL must be either both or none\n if ('webServiceURL' in this.fields) {\n if (typeof this.fields.authenticationToken !== 'string')\n throw new Error('While webServiceURL is present, authenticationToken also required!');\n if (this.fields.authenticationToken.length < 16)\n throw new ReferenceError('authenticationToken must be at least 16 characters long!');\n }\n else if ('authenticationToken' in this.fields)\n throw new TypeError('authenticationToken is presented in Pass data while webServiceURL is missing!');\n this.images.validate();\n }", "_validate() {\n throw new Error('_validate not implemented in child class');\n }", "validate(state, setError) {\n let errmsg = null,\n minimum = state.minimum,\n maximum = state.maximum,\n start = state.start;\n\n errmsg = emptyValidator('Owner', state.seqowner);\n if (errmsg) {\n setError('seqowner', errmsg);\n return true;\n } else {\n setError('seqowner', errmsg);\n }\n\n errmsg = emptyValidator('Schema', state.schema);\n if (errmsg) {\n setError('schema', errmsg);\n return true;\n } else {\n setError('schema', errmsg);\n }\n\n if (!this.isNew(state)) {\n errmsg = emptyValidator('Current value', state.current_value);\n if (errmsg) {\n setError('current_value', errmsg);\n return true;\n } else {\n setError('current_value', errmsg);\n }\n\n errmsg = emptyValidator('Increment value', state.increment);\n if (errmsg) {\n setError('increment', errmsg);\n return true;\n } else {\n setError('increment', errmsg);\n }\n\n errmsg = emptyValidator('Minimum value', state.minimum);\n if (errmsg) {\n setError('minimum', errmsg);\n return true;\n } else {\n setError('minimum', errmsg);\n }\n\n errmsg = emptyValidator('Maximum value', state.maximum);\n if (errmsg) {\n setError('maximum', errmsg);\n return true;\n } else {\n setError('maximum', errmsg);\n }\n\n errmsg = emptyValidator('Cache value', state.cache);\n if (errmsg) {\n setError('cache', errmsg);\n return true;\n } else {\n setError('cache', errmsg);\n }\n }\n\n let min_lt = gettext('Minimum value must be less than maximum value.'),\n start_lt = gettext('Start value cannot be less than minimum value.'),\n start_gt = gettext('Start value cannot be greater than maximum value.');\n\n if (isEmptyString(minimum) || isEmptyString(maximum))\n return null;\n\n if ((minimum == 0 && maximum == 0) ||\n (parseInt(minimum, 10) >= parseInt(maximum, 10))) {\n setError('minimum', min_lt);\n return true;\n } else {\n setError('minimum', null);\n }\n\n if (start && minimum && parseInt(start) < parseInt(minimum)) {\n setError('start', start_lt);\n return true;\n } else {\n setError('start', null);\n }\n\n if (start && maximum && parseInt(start) > parseInt(maximum)) {\n setError('start', start_gt);\n return true;\n } else {\n setError('start', null);\n }\n return null;\n }", "validateForm() {\r\n if(this.getInputVal(this.inputBill) !== \"\" && \r\n this.getInputVal(this.inputPeople) !== \"\" &&\r\n (this.getInputVal(this.inputCustom) !== \"\" || \r\n this.percentageBtns.some(btn => btn.classList.contains(\"active\")))) \r\n {\r\n this.disableReset(false);\r\n return true;\r\n }\r\n else {\r\n this.disableReset(true);\r\n this.displayResult(\"__.__\", \"__.__\");\r\n return false;\r\n }\r\n }", "preValidate() { }", "verify($this) {\n let type = $this.get(0).tagName,\n _verify = function ($this) {\n let mens = '', r = true;\n if ($('#' + $this.attr('for')).val() != $this.val()) {\n mens = $this.attr('tile-error') || \"¡Los campos no coinciden!\";\n r = false;\n }\n\n $this.get(0).setCustomValidity(mens);\n return r;\n }\n switch (type) {\n case 'INPUT': return _verify($this);\n case 'FORM':\n // Vrerificamos si es un formulario\n let success = true;\n $this.find('.verify').each(function () {\n if (!_verify($(this))) {\n $(this).get(0).reportValidity();\n success = false;\n }\n })\n return success;\n }\n }", "function validation() {\r\n\t\tif ((circleRecipe.checked == true && recipeCircleArea() > 0) || (rectangleRecipe.checked == true && returnValue(lengthARecipe) > 0 && returnValue(lengthBRecipe) > 0)) {\r\n\t\t\tif ((circleUser.checked == true && userCircleArea() > 0) || (rectangleUser.checked == true && returnValue(lengthAUser) > 0 && returnValue(lengthBUser) > 0)) {\r\n\t\t\t\tconvertAlert.innerHTML = '';\r\n\t\t\t\tconvert();\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tconvertAlert.innerHTML = '<p>You must define what kind of baking mold you use and inscribe its dimensions before convert!</p>';\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tconvertAlert.innerHTML = '<p>You must define what kind of baking mold is used in the recipe and inscribe its dimensions before convert!</p>';\r\n\t\t}\r\n\t}", "runValidation() {\n try {\n var formItem = this.scope['exprForm']['literal'];\n if (formItem.$viewValue) {\n formItem.$setViewValue(formItem.$viewValue);\n formItem.$$parseAndValidate();\n }\n } catch (e) {\n }\n }", "_validate(values) {\n const constraint = this.constructor.FORM_CONSTRAINT\n const result = validate(Object.assign({}, this.state, values), constraint)\n return result\n }", "validateInit() {\n this.runValidation(true);\n }", "validateForm() {\n this.setState({ formValid: this.state.titleValidExist && this.state.titleValidLength && this.state.yearValid && this.state.runtimeValid && this.state.genreValid && this.state.directorValid });\n }", "checkValidity() {\n return this.state.name && +this.state.amount && +this.state.maximumRides;\n }", "function isObsFormValid(){\t \n var v1 = textoObsField.isValid();\n return( v1);\n }", "checkValid() {\n const input = $('#block_name').val().trim();\n const isDuplicate = this.appController.project.hasBlockDefinition(input);\n const isEmpty = !input;\n const isDefault = input == 'block_type';\n if (isEmpty) {\n this.view.showWarning(false);\n this.view.setEnabled(false);\n } else if (isDuplicate) {\n this.view.showWarning(isDuplicate, `This block name is already taken in\n this project.`);\n this.view.setEnabled(false);\n } else if (isDefault) {\n this.view.showWarning(isDefault, `Please enter something other than <i>block_type</i>.\n No block can be named the default block name.`);\n this.view.setEnabled(false);\n } else {\n this.view.showWarning(false);\n this.view.setEnabled(true);\n }\n }", "validate() {\n\t\tconst msg = this.validator ? this.validator(this.value) : '';\n\t\tthis.error = msg;\n\t}", "checkRequired() {\n if (this.isEmpty() || !this.isValid()) {\n if (this.isEmpty()) {\n this.errorMessage = \"Dit is een required field\";\n this.showError();\n }\n else {\n this.validate();\n }\n }\n else\n this.hideError();\n }", "validate() {\n this.errorMessage = \"Dit is geen nummer\";\n super.validate();\n }", "function CompanyValidation() { \n var Lo_Obj = [\"ddlCompPrefer\", \"txtCompName\", \"textCompRAddres\", \"txtCompCPIN\", \"txtCompDBE\", \"txtCompPan\", \"textCompPAddress\",\n \"txtCompPPIN\", \"textCompPermanentAddress\", \"txtCompPermanentPPIN\", \"txtCompEmail\", \"txtCompPhone\", \"txtCompCell\"];\n var Ls_Msg = [\"Constitution Type\", \"Name of Enterprice\", \"REGD Office Address\", \"Pin\", \"Date of Establishment\", \"PAN Number\",\n \"Address of Factory/Shop\", \"Pin\", \"Permanent Address\", \"Pin\", \"Email \", \"Landline\", \"Mobile\"];\n var bool = true;\n if (!CheckMandatory(Lo_Obj, Ls_Msg)) {\n return false;\n }\n return bool;\n}", "checkValidity() {\n if (this.height < 50 || this.height > 237 || this.weight < 2 || this.weight > 650) {\n return false;\n }else if(this.height ==NaN || this.weight==NaN){\n return false;\n }\n return true;\n }", "function check(e) {\n if (e.val() !== '') {\n e.closest(target.options.errorElement).removeClass(target.options.errorClass);\n // if we are using aria tags to hide content from screenreaders\n if (target.options.useAria) {\n e.closest(target.options.errorElement).find(target.options.errorMessageElement).attr('aria-hidden', true);\n }\n } else {\n e.closest(target.options.errorElement).addClass(target.options.errorClass);\n // if we are using aria tags to hide content from screenreaders\n if (target.options.useAria) {\n e.closest(target.options.errorElement).find(target.options.errorMessageElement).attr('aria-hidden', false);\n }\n }\n }", "function isValid( ) {\n\n\t\t\tif ( _widget[ \"content\" ][ \"impl\" ].value.match(_validPtn) ) {\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}", "valid() {\r\n return true\r\n }", "validate(step) {\n switch (step) {\n case 0:\n if (this.state.title.length > 2) {\n return true;\n }\n break;\n case 1:\n if (this.state.image) {\n return true;\n }\n break;\n default:\n return false;\n }\n return false;\n }", "_handleValidation(e){\n if(!CPFHelper.VerifyCPF(CPFHelper.HandleCPFStringFormat(e.target.value))){\n this._input.className += ' invalid'\n this._parentElement.append(this._validatorLabel);\n } else {\n this._input.classList.remove('invalid');\n this._validatorLabel.remove();\n }\n }", "isValid() {\n return this.refs.to.isValid() || this.refs.cc.isValid() || this.refs.bcc.isValid();\n }", "function getValidation(){\n\t\t\t\t\t\t\n\t\t\t\t\t}", "function validate() {\n //always valid\n return null;\n }", "validateInput(elem){\n\n // checking if the input field is empty and if there are any message not shown\n if (elem.value === '' && elem.nextElementSibling.nextElementSibling.tagName !== 'SPAN'){\n let name;\n if (elem.name === 'name'){\n name = 'Name';\n }else if (elem.name === 'address'){\n name = 'Address';\n }else if (elem.name === 'phone'){\n name = 'Phone';\n }else if (elem.name === 'engineNo'){\n name = 'Engine No';\n }else if (elem.name === 'licenseNo'){\n name = 'License No';\n }\n this.ui.showError(elem, `${name} can not be empty`);\n }else if (elem.value !== '' && elem.nextElementSibling.nextElementSibling.tagName === 'SPAN'){\n this.ui.clearError(elem.nextElementSibling.nextElementSibling);\n }\n }", "canSubmit() {\n return (\n this.validateOnlyLetterInput(this.state.name)==='' &&\n this.validateTelephone(this.state.telephone)==='' &&\n this.validateAddress(this.state.address)==='' &&\n this.validatePostalCode(this.state.postalCode)==='' &&\n this.validateOnlyLetterInput(this.state.city)===''\n );\n }", "static vRquired(formdata,valid) {\n for (let fm of fieldsModel) {\n for (let id in formdata) {\n if (fm.nombre == id) {\n if (fm.isRequired && !formdata[id] && id !=\"id\") {\n Validate.addError(id, \"Este Campo es oblicatorio\");\n valid = false\n }\n }\n }\n }\n return valid;\n }", "validate() {\n return null;\n }", "validateData() {\n const title = this.titleRef.current.value;\n let description = this.descriptionRef.current.state.value;\n\n let hasPhoto = this.state.photos.length;\n let hasTitle = true;\n let hasDescription = true;\n\n // Validate photos\n if (!hasPhoto) {\n this.showError('You must upload at least 1 photo');\n }\n\n // Validate title\n if (title == null || title.trim() === '') {\n hasTitle = false;\n this.showError('Title can not empty');\n }\n\n description = !!description ? description : ''\n // Remove all html tag\n const descriptionContent = description.replace(/<\\/?(?!(img)\\b)\\w+[^>]*>/gm, '');\n if (descriptionContent === '') {\n hasDescription = false;\n this.showError('Description can not empty');\n }\n\n return hasPhoto && hasTitle && hasDescription;\n }", "isAllValid() {\n return this.state.movieTitle_error || this.state.diractor_error || this.state.year_error || this.state.runtime_error || this.state.genre_error;\n }", "displayInputErrors(team) {\n if (team.sport.trim() == \"\") {\n this.refs.sport.setError(\"Please give a non-empty value\");\n }\n if (team.city.trim() == \"\") {\n this.refs.city.setError(\"Please give a non-empty value\");\n }\n if (team.name.trim() == \"\") {\n this.refs.name.setError(\"Please give a non-empty value\");\n }\n if ( isNaN(team.maxPlayers) || game.gameLength < 1 ) {\n this.refs.gameLength.setError(\"Please input a positive number\");\n }\n }", "function validateCheck() {\n\n setActivityCardRules($scope.cardRules.value());\n setSpecialUsePackages($scope.specialPackages.value());\n generateCodeAuto();\n service.validate($scope.activity).success(function () {\n $scope.save();\n }).error(function (error) {\n console.log('error -> ', error);\n });\n }", "function validate(){\n\t//if the first child does not have class disabled\n\tif(!option[0].classList.contains(\"disable\")){\n\t\talert(\"No option selected\")\n\t}\n\telse{\n\t\tenableOptions();\n\t\trandomQuestions();\n\t}\n}", "isValid() {\n if (\n this.state.isDanger ||\n this.state.apiValue === '' ||\n this.state.apiValue === undefined\n )\n return false;\n\n return true;\n }" ]
[ "0.7114409", "0.7060334", "0.68913716", "0.67783165", "0.6748929", "0.66354346", "0.6621943", "0.6493374", "0.64520377", "0.6451088", "0.64212316", "0.64124346", "0.6371954", "0.6364813", "0.635534", "0.6311542", "0.63046616", "0.63046616", "0.6302848", "0.6274953", "0.6267592", "0.6261019", "0.62413764", "0.62398934", "0.6235648", "0.6178101", "0.6168213", "0.61605555", "0.61559427", "0.61525655", "0.61478084", "0.6146625", "0.61057544", "0.6087227", "0.6080471", "0.6075815", "0.6071236", "0.6071236", "0.60625845", "0.6058426", "0.6048151", "0.6043721", "0.6037611", "0.60228556", "0.60151047", "0.60135055", "0.6011693", "0.6002481", "0.60018593", "0.6000271", "0.5989013", "0.5984556", "0.59783536", "0.5977123", "0.5976286", "0.5958878", "0.5954587", "0.59537077", "0.594312", "0.59362787", "0.59347767", "0.59347767", "0.59239703", "0.5923216", "0.59214544", "0.59207904", "0.5919574", "0.59153765", "0.5914465", "0.59144115", "0.59102315", "0.5899457", "0.5892984", "0.5890632", "0.5890358", "0.5889792", "0.5886451", "0.5886067", "0.588103", "0.5880548", "0.58790797", "0.58765674", "0.5873497", "0.5868176", "0.58578104", "0.58569235", "0.58494186", "0.5847691", "0.58473843", "0.5846915", "0.5837272", "0.5833943", "0.5832746", "0.5829799", "0.58295083", "0.58271885", "0.5825877", "0.5819969", "0.58093953", "0.58060145", "0.5805582" ]
0.0
-1
end functions for typeclass "Appendable"
function unsafeInsert(selector, selection) { return selection.insert(selector); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Append() {\r\n}", "append() {\n errors.throwNotImplemented(\"appending element to collection\");\n }", "function AppendAll() {\r\n}", "function Appendable(n, v) {\n 'use strict'\n var val = n + \"=\" + v;\n this.append = function (name, value) {\n val += (\"&\" + name + \"=\" + value);\n return this;\n }\n this.value = function () {\n return val;\n }\n}", "append(item) {\n }", "get appendOnly() {\n return this._appendOnly;\n }", "static [APPEND](f) {\n\t\t\treturn this[EXTEND](f)\n\t\t}", "canAppend(other) {\n if (other.content.size)\n return this.canReplace(this.childCount, this.childCount, other.content);\n else\n return this.type.compatibleContent(other.type);\n }", "append(target) {\n var args = Array.prototype.slice.call(arguments);\n if (!Array.isArray(target)) {\n target = [target];\n }\n return target.concat.apply(target, args);\n }", "function nonMutatingConcat(original, attach) {\n // Add your code below this line\n\n\n // Add your code above this line\n}", "append(...append) {\n return this.forEach((el => recursiveAppend(el, ...append))), this;\n }", "function append_override() {\n (function($) {\n var original_append = $.fn.append;\n\n $.fn.append = function () {\n return original_append.apply(this, arguments).trigger(\"append\", this);\n };\n })(jQuery);\n}", "function Xj(a,b){null!=a&&this.append.apply(this,arguments)}", "function BOT_appendFree(t,v) {\r\n\tif(BOT_member(t,v)) return (t);\r\n\telse return (t.concat([v]))\r\n}", "function sc_append() {\n if (arguments.length === 0)\n\treturn null;\n var res = arguments[arguments.length - 1];\n for (var i = arguments.length - 2; i >= 0; i--)\n\tres = sc_dualAppend(arguments[i], res);\n return res;\n}", "extend() {}", "extend() {}", "appendWrapped(type, props, content) {\n const wrapped = this.createWrapped(type, props, content);\n this.append(wrapped);\n }", "function Vj(a,b){null!=a&&this.append.apply(this,arguments)}", "appendData (params) {\n this.delegateMethod('appendData', params)\n }", "concat(other) {\n return this.append(other)\n }", "append(parent) {\n return parent.append(this._);\n }", "function nonMutatingConcat(original, attach) {\n // Add your code below this line\n return original.concat(attach);\n\n // Add your code above this line\n}", "function nonMutatingConcat(original, attach) {\n // Add your code below this line\n return original.concat(attach);\n // Add your code above this line\n}", "append(param, value) {\n return this.clone({\n param,\n value,\n op: 'a'\n });\n }", "function StdAppend(trusting) {\n return [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(78\n /* ContentType */\n ), Object(_conditional__WEBPACK_IMPORTED_MODULE_4__[\"SwitchCases\"])(when => {\n when(1\n /* String */\n , () => {\n if (trusting) {\n return [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(68\n /* AssertSame */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(43\n /* AppendHTML */\n )];\n } else {\n return Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(47\n /* AppendText */\n );\n }\n });\n when(0\n /* Component */\n , () => [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(82\n /* PushCurriedComponent */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(81\n /* PushDynamicComponentInstance */\n ), Object(_components__WEBPACK_IMPORTED_MODULE_1__[\"InvokeBareComponent\"])()]);\n when(3\n /* SafeString */\n , () => [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(68\n /* AssertSame */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(44\n /* AppendSafeHTML */\n )]);\n when(4\n /* Fragment */\n , () => [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(68\n /* AssertSame */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(45\n /* AppendDocumentFragment */\n )]);\n when(5\n /* Node */\n , () => [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(68\n /* AssertSame */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(46\n /* AppendNode */\n )]);\n })];\n}", "function StdAppend(trusting) {\n return [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(78\n /* ContentType */\n ), Object(_conditional__WEBPACK_IMPORTED_MODULE_4__[\"SwitchCases\"])(when => {\n when(1\n /* String */\n , () => {\n if (trusting) {\n return [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(68\n /* AssertSame */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(43\n /* AppendHTML */\n )];\n } else {\n return Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(47\n /* AppendText */\n );\n }\n });\n when(0\n /* Component */\n , () => [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(82\n /* PushCurriedComponent */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(81\n /* PushDynamicComponentInstance */\n ), Object(_components__WEBPACK_IMPORTED_MODULE_1__[\"InvokeBareComponent\"])()]);\n when(3\n /* SafeString */\n , () => [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(68\n /* AssertSame */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(44\n /* AppendSafeHTML */\n )]);\n when(4\n /* Fragment */\n , () => [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(68\n /* AssertSame */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(45\n /* AppendDocumentFragment */\n )]);\n when(5\n /* Node */\n , () => [Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(68\n /* AssertSame */\n ), Object(_encoder__WEBPACK_IMPORTED_MODULE_3__[\"op\"])(46\n /* AppendNode */\n )]);\n })];\n}", "append(value){\nconst newNode = {\n value:value,\n next:null\n}\nthis.tail.next = newNode;\nthis.tail = newNode;\nthis.length++;\n}", "function nonMutatingConcat(original, attach) {\n // Add your code below this line - done\n return original.concat(attach);\n \n // Add your code above this line\n}", "function Appendix() {\n\t/*\n\tint getSize();\n\tvoid putBytes(ByteBuffer buffer);\n\tJSONObject getJSONObject();\n\tbyte getVersion();\n\t*/\n}", "addLast(e) {\n // let { data, size } = this;\n // // last time, size become data.length\n // if ( size >= data.length ) {\n // \tthrow new Error('addLast failed. Array is stuffed');\n // }\n // data[size] = i;\n // size ++; 归并到add方法\n\n // if (this.data.length === this.size) {\n // \tthis.resize(2 * this.size);\n // } 不应该只放在这里\n this.add(this.size, e);\n }", "append(value){\nconst newNode={\n value: value,\n next: null\n}\nthis.tail.next = newNode\nthis.tail =newNode\nthis.length++;\nreturn this\n}", "append(name, value) {\n return this.clone({\n name,\n value,\n op: 'a'\n });\n }", "function appendTo(array, item) {\n\t return array.push(item), array;\n\t }", "function _getAppendContainerData()\r\n {\r\n return this.mAppendContainerData;\r\n }", "appendCeleb(element) {\n element.append(this.createElement())\n }", "add(element){\n this.addLast(element);\n }", "append(param, value) {\n return this.clone({ param, value, op: 'a' });\n }", "append(param, value) {\n return this.clone({ param, value, op: 'a' });\n }", "append(param, value) {\n return this.clone({ param, value, op: 'a' });\n }", "append(param, value) {\n return this.clone({ param, value, op: 'a' });\n }", "append(param, value) {\n return this.clone({ param, value, op: 'a' });\n }", "append(name, value) {\n return this.clone({ name, value, op: 'a' });\n }", "append(name, value) {\n return this.clone({ name, value, op: 'a' });\n }", "append(name, value) {\n return this.clone({ name, value, op: 'a' });\n }", "append(name, value) {\n return this.clone({ name, value, op: 'a' });\n }", "append(name, value) {\n return this.clone({ name, value, op: 'a' });\n }", "function append(element) {\n\tthis.dataStore[this.listSize++] = element;\n}", "function append(content){\n\tappendBuffer += content;\t\n}", "appendIntoPart(e){e.__insert(this.startNode=createMarker()),e.__insert(this.endNode=createMarker())}", "function nonMutatingConcat(original, attach) {\r\n return original.concat(attach);\r\n}", "function append(target, item) {\n if (Array.isArray(target)) {\n if (!target.includes(item)) {\n target.push(item);\n }\n }\n else {\n target.add(item);\n }\n return item;\n}", "function append(target, item) {\n if (Array.isArray(target)) {\n if (!target.includes(item)) {\n target.push(item);\n }\n }\n else {\n target.add(item);\n }\n return item;\n}", "function appendField(e,o){\n e.preventDefault();\n addField(o);\n}", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n // Add your code above this line\n}", "append(value) {\n //instancia de la clase Node y le pasamos el value\n const newNode = new Node(value);\n //le decimos a la cola que agregue el nodo, este ya tiene su propio next \n this.tail.next = newNode;\n //posicionamos el tail al nuevo nodo\n this.tail = newNode;\n //crece la longitud de la lista\n this.length++;\n\n return this;\n }", "function aappend(str){\n str += 'a'\n return str\n}", "function nonMutatingConcat(original, attach) {\n return original.concat(attach)\n}", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n\n // Add your code above this line\n}", "added(vrobject){}", "append(...elements) {\n this.elements = this.elements.concat(flatten(elements));\n }", "function append(element) {\n this.dataStore[this.listSize++] = element;\n}", "function Nothing$prototype$concat(other) {\n return other;\n }", "added() {}", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n return original.concat(newItem);\n \n // Add your code above this line\n }", "append (output) {\r\n this.output.push(output);\r\n }", "addEventListeners() {\n // Empty in base class.\n }", "append(other) {\n return this.replace(this.length, this.length, other);\n }", "append(data) {\n this.array[this.length] = data\n this.length++\n }", "append(data) {\n const newNode = new Node(data);\n\n if (this.head === null) {\n this.head = newNode;\n }\n\n if (this.tail !== null) {\n this.tail.next = newNode;\n }\n\n this.tail = newNode;\n }", "appendText(append)\n\t{\n\t\tthis.setText(this.getText() + append);\n\t}", "function appendTo(array, item) {\n return array.push(item), array;\n }", "function appendTo(array, item) {\n return array.push(item), array;\n }", "function appendElement (hander,node) {\r\n if (!hander.currentElement) {\r\n hander.doc.appendChild(node);\r\n } else {\r\n hander.currentElement.appendChild(node);\r\n }\r\n}//appendChild and setAttributeNS are preformance key", "function appendElement (hander,node) {\r\n if (!hander.currentElement) {\r\n hander.doc.appendChild(node);\r\n } else {\r\n hander.currentElement.appendChild(node);\r\n }\r\n}//appendChild and setAttributeNS are preformance key", "function appendElement (hander,node) {\r\n if (!hander.currentElement) {\r\n hander.doc.appendChild(node);\r\n } else {\r\n hander.currentElement.appendChild(node);\r\n }\r\n}//appendChild and setAttributeNS are preformance key", "function r(e){this.addendum=\"\",this.removendum=\"\",this.inputLength=0,this.outputLength=0,Array.isArray(e)||(e=arguments);for(var t=0;t<e.length;t++)this.push(e[t]),this.inputLength+=e[t].input,this.outputLength+=e[t].output}", "append(val) {\n const newNode = { value: val, next: null };\n\n // If we have a tail, update it. Otherwise just set it (below)\n // Update the next value of PREVIOUS tail points to this new node\n if (this.tail) this.tail.next = newNode;\n\n // This does not replace the old node in memory... it's still there\n // It just reassigns the tail to point to this new node. \n this.tail = newNode;\n\n // If there is no head currently, set it to newNode. Only happens for \n // first element\n if (!this.head) this.head = newNode;\n }", "function appendElement(hander, node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n } //appendChild and setAttributeNS are preformance key", "function appendElement (hander,node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n}//appendChild and setAttributeNS are preformance key", "function appendElement (hander,node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n}//appendChild and setAttributeNS are preformance key", "function appendElement (hander,node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n}//appendChild and setAttributeNS are preformance key", "function appendElement (hander,node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n}//appendChild and setAttributeNS are preformance key", "function appendElement (hander,node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n}//appendChild and setAttributeNS are preformance key", "function appendElement (hander,node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n}//appendChild and setAttributeNS are preformance key", "function appendElement (hander,node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n}//appendChild and setAttributeNS are preformance key", "static _append(str, obj) {\r\n if (Array.isArray(obj)) {\r\n return HookManager._appendArrayString(str, obj);\r\n }\r\n else if (typeof obj == \"object\") {\r\n return HookManager._appendObjectString(str, obj);\r\n }\r\n else if (typeof obj == \"function\")\r\n str += obj.toString().replace(/\\s/g, \"\");\r\n else if (typeof obj == \"bigint\")\r\n str += util.inspect(obj);\r\n else\r\n str += JSON.stringify(obj);\r\n return str;\r\n }", "function endWith() {\n var array = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n array[_i] = arguments[_i];\n }\n return function (source) { return (0,concat/* concat */.z)(source, of.of.apply(void 0, array)); };\n}", "append(_srcId, _tgtId) {\n this._elements[_tgtId].appendChild(this._elements[_srcId]);\n }", "append(_srcId, _tgtId) {\n this._elements[_tgtId].appendChild(this._elements[_srcId]);\n }", "appendChild(node) {\n return Attr_1.internalHandler.run(this, 'appendChild', [node]);\n }", "function nonMutatingPush(original, newItem) {\n // Add your code below this line\n //return original.push(newItem);\n return original.concat(newItem);\n // Add your code above this line\n }", "static get exposed() { return ['concat']; }", "append(...nodes) {\n\t\tfor (let node of nodes) {\n\t\t\tif (node instanceof BetterHTMLElement)\n\t\t\t\tthis.e.append(node.e);\n\t\t\telse\n\t\t\t\tthis.e.append(node);\n\t\t}\n\t\treturn this;\n\t\t/*if (nodes[0] instanceof BetterHTMLElement)\n\t\t\t for (let bhe of <BetterHTMLElement[]>nodes)\n\t\t\t\t this.e.append(bhe.e);\n\t\telse\n\t\t\t for (let node of <(string | Node)[]>nodes)\n\t\t\t\t this.e.append(node); // TODO: test what happens when passed strings\n\t\treturn this;*/\n\t}", "function append(elem,next){var parent=elem.parent,currNext=elem.next;next.next=currNext;next.prev=elem;elem.next=next;next.parent=parent;if(currNext){currNext.prev=next;if(parent){var childs=parent.children;childs.splice(childs.lastIndexOf(currNext),0,next);}}else if(parent){parent.children.push(next);}}", "function append(compiler, val, node) {\n if (typeof compiler.append !== 'function') {\n return compiler.emit(val, node);\n }\n return compiler.append(val, node);\n}", "function append(compiler, val, node) {\n if (typeof compiler.append !== 'function') {\n return compiler.emit(val, node);\n }\n return compiler.append(val, node);\n}", "function a(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(e.add)return void e.add.apply(e,n);if(e.set)return void e.set.apply(e,n);if(e.push)return void e.push.apply(e,n);throw new TypeError(\"Could not determine how to insert into the specified container\")}", "function append(array, toAppend) {\n array.push.apply(array, toAppend);\n}", "extendToWordEnd() {\n this.extendToWordEndInternal(false);\n }", "function appendElement$1(hander, node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n} //appendChild and setAttributeNS are preformance key" ]
[ "0.68925905", "0.667579", "0.61507356", "0.61467755", "0.6069787", "0.60099924", "0.59639144", "0.5720726", "0.56616426", "0.5654691", "0.5614543", "0.55670524", "0.5537994", "0.5528203", "0.5514664", "0.5481797", "0.5481797", "0.5412114", "0.53961855", "0.53751755", "0.5372044", "0.5343005", "0.5318076", "0.53106767", "0.53081274", "0.5293224", "0.5293224", "0.52878827", "0.52767164", "0.52702147", "0.52304894", "0.5226333", "0.52229095", "0.5207166", "0.51693606", "0.5150259", "0.51109725", "0.50991344", "0.50991344", "0.50991344", "0.50991344", "0.50991344", "0.50898653", "0.50898653", "0.50898653", "0.50898653", "0.50898653", "0.50849754", "0.50835526", "0.5077681", "0.50743395", "0.50709546", "0.50709546", "0.5062329", "0.5059726", "0.50569737", "0.50469655", "0.5046186", "0.50454557", "0.5042761", "0.5040931", "0.5039144", "0.50352454", "0.50328654", "0.50255364", "0.5025492", "0.5016737", "0.50126255", "0.50095445", "0.50039595", "0.49995863", "0.49963385", "0.49963385", "0.49908295", "0.49908295", "0.49908295", "0.49819773", "0.4979739", "0.49761403", "0.49719694", "0.49719694", "0.49719694", "0.49719694", "0.49719694", "0.49719694", "0.49719694", "0.49665004", "0.4960678", "0.49418852", "0.49418852", "0.49410608", "0.49349737", "0.49254468", "0.49159345", "0.4913421", "0.4906556", "0.4906556", "0.49030128", "0.49005657", "0.49003294", "0.48959738" ]
0.0
-1
functions that attach event handlers
function attachCallbackToEvent(selection, eventType, callback) { selection.on(eventType, callback); return selection; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 _bindEventHandlers() {\n\t\t\n helper.bindEventHandlers();\n }", "_events() {\n \tthis._addKeyHandler();\n \tthis._addClickHandler();\n }", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function EventHandlers() {}", "function AttachEventHandlers() {\n\n //If the event handlers have already been attached, get outta here.\n if (mbEventHandlersAttached) return;\n \n //Attach standard event handlers for input fields. \n try {\n AttachEventHandlersToFields();\n }\n catch(e) {\n //ignore error\n }\n \n //Page-specific event handlers go here.\n //AddEvt($(\"XXXXXX\"), \"mouseover\", functionXXXXX);\n \n //AddEvt($(\"New\"), \"mouseover\", functionXXXXX);\n \n \n \n //Set flag to indicate event handlers have been attached.\n mbEventHandlersAttached = true;\n}", "function bindEvents() {\n\t\t\teManager.on('showForm', function() {\n\t\t\t\tshowForm();\n\t\t\t});\n\t\t\teManager.on('csvParseError', function() {\n\t\t\t\tshowError();\n\t\t\t});\n\t\t}", "addEventHandlers() {\n\n\t\tthis.elementConfig.addButton.on(\"click\",this.handleAdd);\n\t\tthis.elementConfig.cancelButton.on(\"click\",this.handleCancel);\n\t\tthis.elementConfig.retrieveButton.on(\"click\",this.retrieveData);\n\n\n\t}", "function bindEvents(){\n\t\t\n\t\t$(document).on(\"click\",\".item_tag\",function(e){\n\t\t\n\t\t\tdisplayItems($(e.target));\n\t\t\t\n\t\t});\n\t\t\n\t\t\n\t\t$(document).on(\"click\",\".item\",function(e){\n\t\t\n\t\t\te.preventDefault();\n\t\t\t\n\t\t\taddItem($(e.target));\n\t\t\n\t\t});\n\t\t\n\t\t\n\t\t$(document).on(\"click\",\".selected_item\",function(e){\n\t\t\n\t\t\te.preventDefault();\n\t\t\t\n\t\t\tremoveItem($(e.target));\n\t\t\n\t\t});\n\t}", "function setEventHandlers() {\n document.getElementById(\"loadprev\").addEventListener('click', load_prev, false);\n document.getElementById(\"loadnext\").addEventListener('click', load_next, false);\n }", "function setupEventHandlers() {\n\t// menus\n\t$(\"#menu_nav\").on(\"click\", onClickHandlerMainMenu);\n\t$(\"#menu_lang\").on(\"click\", onClickHandlerMainMenu);\n\t$(\"#menu_footer\").on(\"click\", onClickHandlerMainMenu);\n\t$('#campanya').hover( hoverOverSub, hoverOutSub );\n\t$('#idioma').hover( hoverOverSub, hoverOutSub );\n\n\t$('.submenu>li').hover(hoverOverSubelement,hoverOutSubelement);\n\n\t$('.photo_link').hover( hoverOverPhoto, hoverOutPhoto );\n\t$(\"#sec_aniversary\").on(\"click\", onClickHandlerAniversary);\n\t$('#sec_aniversary').bind('scroll', switchYears );\n\n\t$(\"#sec_novedades .buttons_container\").on(\"click\", onButtonClickHandler );\n\t$(\"#sec_business .buttons_container\").on(\"click\", onButtonClickHandler );\n\n\t$('#sec_descargas li').hover( hoverOverDownload, hoverOutDownload );\n\t//ACCION CERRAR GALERIA\n\t$('#pane_wrapper').click(function(){\n\t\t$(this).fadeOut(300,function(){\n\t\t\tunPanIt();\n\t\t\t$('#pane_wrapper').css('top','58px');\n\t\t\t$('#pane_wrapper').css('bottom','22px');\n\t\t\t$('#outer_container #pan_container').html('');\n\t\t\t$(this).css('zIndex','1');\n\t\t});\n\t});\n}", "function bindEvents(){\n document.querySelector('#pre').addEventListener('click', () => {\n handleTraversal(preorder)\n })\n document.querySelector('#in').addEventListener('click', () => {\n handleTraversal(inorder)\n })\n document.querySelector('#post').addEventListener('click', () => {\n handleTraversal(postorder)\n })\n }", "addEventListeners() {\n\t\tthis.bindResize = this.onResize.bind(this);\n\t\twindow.addEventListener('resize', this.bindResize);\n\t\tthis.bindClick = this.onClick.bind(this);\n\t\tEmitter.on('CURSOR_ENTER', this.bindClick);\n\t\tthis.bindRender = this.render.bind(this);\n\t\tTweenMax.ticker.addEventListener('tick', this.bindRender);\n\t\tthis.bindEnter = this.enter.bind(this);\n\t\tEmitter.on('LOADING_COMPLETE', this.bindEnter);\n\t}", "function bindEventHandlers() {\r\n dom.mobileMenuIcon.on('click', mobileMenuIconClicked);\r\n dom.mobileMenuClose.on('click', mobileMenuCloseClicked)\r\n\t}", "function assignEventListeners() {\n \tpageElements.output.addEventListener('click', editDelete, false);\n \t pageElements.authorSelect.addEventListener('change', dropDown, false);\n \t pageElements.tagSelect.addEventListener('change', dropDown, false);\n \t pageElements.saveBtn.addEventListener('click', saveAction ,false);\n \t pageElements.addBtn.addEventListener('click', addAction, false);\n \t pageElements.getAllBtn.addEventListener('click', getAll, false);\n \t pageElements.deleteBtn.addEventListener('click', deleteIt, false);\n }", "function handleBindEventHandlers(){\n handleAddBookmark();\n handleFilterRating();\n handleDeleteBookmark();\n handleAddForm();\n handleDescExpand();\n handleCloseButton();\n }", "function _registerEventHandler() {\n\t\t$.$TASMA.find('.button.new').on('click', TaskManager.add);\n\t\t$.$TASMA.find('.tasks-list').on('click', '.button.remove', TaskManager.remove);\n\t\t$.$TASMA.find('.button.remove-all').on('click', TaskManager.removeAll);\n\t\t$.$TASMA.find('.button.save').on('click', TaskManager.save);\n\t\t$.$TASMA.find('.button.cancel').on('click', TaskManager.cancel);\n\t}", "bindEvents() {\n }", "function initEventHandler() {\n // initSortable();\n initFormEvents(fb);\n initListEvents(fb);\n}", "function AllEventsHandling() {\n\n // when view book button click on the top of guest book then below event occur\n loadMovies.addEventListener('click', loadLocalStorageMoviesData);\n // when add button click below function execute\n addbtn.addEventListener(\"click\", addBtnProcess);\n}", "function bindEventHandlers() {\r\n\r\n\t\t\tif(o.buttons) {\r\n\t\t\t\t//add event handlers\r\n\t\t\t\t$nav.on({\r\n\t\t\t\t\t'click': doOnBtnClick,\r\n\t\t\t\t\t'slideChanged': doOnSlideChanged\r\n\t\t\t\t}, 'li');\r\n\r\n\t\t\t}\r\n\r\n\t\t\tif(o.arrows) {\r\n\t\t\t\t$prevArrow.on('click', function() {\r\n\t\t\t\t\tdoOnArrowClick(false);\r\n\t\t\t\t});\r\n\t\t\t\t$nextArrow.on('click', function() {\r\n\t\t\t\t\tdoOnArrowClick(true);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\r\n\r\n\t\t\t//display/hide the navigation on $root hover\r\n\t\t\t$root.on({\r\n\t\t\t\t'mouseenter': doOnSliderMouseEnter,\r\n\t\t\t\t'mouseleave': doOnSliderMouseLeave\r\n\t\t\t});\r\n\r\n\t\t\t$(window).on('resize', function(){\r\n\t\t\t\tserSliderHeight(currentIndex);\r\n\t\t\t});\r\n\t\t}", "function bindEvents(){\r\n\t\t//Move to next page button click\r\n\t\t$('.btn_continue').bind('click', function(){ \r\n\t\t\tvar nameVal = $(this).attr(\"name\");\r\n\t\t\tloadnextpage(nameVal); \r\n\t\t\treturn false;\r\n\t\t});\r\n\r\n\t\t$('.entertowin, #sorryRegister').bind('click', function(){\r\n\t\t\tloadnextpage('register'); \r\n\t\t\treturn false;\r\n\t\t});\r\n\r\n\t\t//Select Partners on Partners page\r\n\t\t$('#selectSix').bind('click', function(){\r\n\t\t\tpartnersSelect();\r\n\t\t\treturn false;\r\n\t\t});\r\n\t\t\r\n\t\t$('#double_down').bind('click', function(){\r\n\t\t\tloadnextpage('doubledown');\r\n\t\t\treturn false;\r\n\t\t});\r\n\r\n\t\t$('#keep_offer').bind('click', function(){\r\n\t\t\tloadnextpage('register');\r\n\t\t\treturn false;\r\n\t\t});\r\n\t\t\r\n\t\t$('.reset').bind('click', function(){\r\n\t\t\tresetGame(); \r\n\t\t\treturn false; \r\n\t\t});\r\n\t}", "function addEventListeners()\n\t{\n\t\t// window event\n\t\t$(window).resize(callbacks.windowResize);\n\t\t$(window).keydown(callbacks.keyDown);\n\t\t\n\t\t// click handler\n\t\t$(document.body).mousedown(callbacks.mouseDown);\n\t\t$(document.body).mouseup(callbacks.mouseUp);\n\t\t$(document.body).click(callbacks.mouseClick);\n\n\t\t$(document.body).bind('touchstart',function(e){\n\t\t\te.preventDefault();\n\t\t\tcallbacks.touchstart(e);\n\t\t});\n\t\t$(document.body).bind('touchend',function(e){\n\t\t\te.preventDefault();\n\t\t\tcallbacks.touchend(e);\n\t\t});\n\t\t$(document.body).bind('touchmove',function(e){\n\t\t\te.preventDefault();\n\t\t\tcallbacks.touchmove(e);\n\t\t});\n\t\t\n\t\tvar container = $container[0];\n\t\tcontainer.addEventListener('dragover', cancel, false);\n\t\tcontainer.addEventListener('dragenter', cancel, false);\n\t\tcontainer.addEventListener('dragexit', cancel, false);\n\t\tcontainer.addEventListener('drop', dropFile, false);\n\t\t\n\t\t// GUI events\n\t\t$(\".gui-set a\").click(callbacks.guiClick);\n\t\t$(\".gui-set a.default\").trigger('click');\n\t}", "registerHandlers() {\n this.formEl.onsubmit = event => this.submitNews(event)\n this.moreBtn.onclick = () => this.loadProducts()\n }", "setEventListeners() {\n $('body').on('touchend click','.menu__option--mode',this.onModeToggleClick.bind(this));\n $('body').on('touchend',this.onTouchEnd.bind(this));\n this.app.on('change:mode',this.onModeChange.bind(this));\n this.app.on('show:menu',this.show.bind(this));\n this.book.on('load:book',this.setTitleBar.bind(this));\n this.book.on('pageSet',this.onPageSet.bind(this));\n this.tutorial.on('done',this.onTutorialDone.bind(this));\n }", "function register_event_handlers()\n {\n \n \n /* button Clear local storage */\n $(document).on(\"click\", \".uib_w_7\", function(evt)\n {\n clearStorage();\n return false;\n \n });\n \n /* button Set local storage */\n $(document).on(\"click\", \".uib_w_6\", function(evt)\n {\n setStorage();\n return false;\n });\n \n /* button Create Database */\n $(document).on(\"click\", \".uib_w_10\", function(evt)\n {\n createDB();\n return false;\n });\n \n /* button Fire Database Query */\n $(document).on(\"click\", \".uib_w_9\", function(evt)\n {\n queryDB()\n return false;\n });\n \n \n \n }", "function _bindEvents() {\n _$sort.on(CFG.EVT.CLICK, _setSort);\n _$navbar.on(CFG.EVT.CLICK, _SEL_BUTTON, _triggerAction);\n _$search.on(CFG.EVT.INPUT, _updateSearch);\n _$clear.on(CFG.EVT.CLICK, _clearSearch);\n }", "function bindEventHandlers () {\n $('#createHaiku').on('click', createHaiku);\n $('#clearOutput').on('click', clearOutput);\n }", "function eventListeners(){\n changeOnButtonClicks();\n changeOnDotClicks();\n changeOnArrowKeys();\n changeOnAnnaLink();\n highlightDotsOnMouseover();\n highlightButtonsOnMouseover();\n highlightAnnaLinkOnMouseover();\n $(document).on(\"mousemove\", foregroundButtons);\n}", "function attachEventHandlers() {\n // TODO diagram: prevent standard context menu inside of diagram\n _this.area.attr(\"onContextMenu\", \"return false;\");\n\n // TODO diagram: attach mouse move event and draw arrow if arrow active mode is on\n\n // TODO diagram: add device drop functionality by jquery ui droppable and prevent dropping outside the diagram\n _this.area.droppable({\n accept: function(ele){\n if(ele.hasClass(\"dropped\")){\n return false;\n }\n if(ele.hasClass(\"device\")){\n return true;\n }\n },\n drop: function (event, ui) {\n addDevice(event, ui);\n }\n });\n\n // TODO diagram: attach mousedown event to body element and remove all active modes like arrow drawing active mode or selected device mode\n $(document.body)[0].addEventListener(\"mousedown\", function (event) {\n var specifiedElement = document.getElementsByClassName('device');\n for (var i = 0; i < specifiedElement.length; i++) {\n (specifiedElement[i]); //second console output\n var isClickInside = specifiedElement[i].contains(event.target);\n if (isClickInside)\n return;\n }\n\n deactivateArrowDrawing();\n $(context).hide();\n if (selectedDevice) {\n selectedDevice.setActive(false);\n selectedDevice = null;\n };\n });\n\n // TODO diagram: attach keyup event to html element for 'ENTF' ('DEL') (delete device or arrow) and 'a'/'A' (toggle arrow active mode)\n arrowButton.click(function () {\n toggleArrowActive();\n });\n // TODO diagram: attach events for context menu items ('Detailseite', 'Löschen')\n\n $(\".contextView\").on(\"mousedown\", function(event){\n alert(selectedDevice.type + selectedDevice.index);\n //alert(event.target.attr('value'));\n });\n\n $(\".contextDelete\").on(\"mousedown\", function(event){\n deleteSelectedDevice();\n });\n\n $('html').keydown(function(e){\n if(e.keyCode == 46) {\n deleteSelectedDevice();\n }\n });\n\n }", "function registerEvents() {\n}", "function bindEventHandlers() {\n startEl.addEventListener(\"click\", startQuiz);\n submitEl.addEventListener(\"click\", saveScore);\n choice1El.addEventListener(\"click\", answerQuestion);\n choice2El.addEventListener(\"click\", answerQuestion);\n choice3El.addEventListener(\"click\", answerQuestion);\n choice4El.addEventListener(\"click\", answerQuestion);\n\n goBackBtnEl.addEventListener(\"click\", backtoStart);\n clearBtnEl.addEventListener(\"click\", clearHighscores);\n}", "function addclickEvents(){\n document.getElementById(\"flask\").addEventListener(\"click\", function() {\n callFlask();\n }, false);\n document.getElementById(\"magnet\").addEventListener(\"click\", function() {\n \tcallMagnet();\n }, false);\n document.getElementById(\"heater_button\").addEventListener(\"click\", function() {\n \tcallHeater();\n }, false);\n document.getElementById(\"stir_button\").addEventListener(\"click\", function() {\n \tcallStir();\n }, false);\n document.getElementById(\"pipette\").addEventListener(\"click\", function() {\n \tcallPipette();\n }, false);\n}", "function addEventListeners() {\n\n}", "setupHandlers () {\n this.rs.on('connected', () => this.eventHandler('connected'));\n this.rs.on('ready', () => this.eventHandler('ready'));\n this.rs.on('disconnected', () => this.eventHandler('disconnected'));\n this.rs.on('network-online', () => this.eventHandler('network-online'));\n this.rs.on('network-offline', () => this.eventHandler('network-offline'));\n this.rs.on('error', (error) => this.eventHandler('error', error));\n\n this.setEventListeners();\n this.setClickHandlers();\n }", "function attachEventHandlers() {\n // TODO device: attach context menu to device (call showContextMenu() in model-diagram.js if context menu is called)\n $(\"#\"+title).contextmenu(function(ev){\n diagram.showContextMenu(_this, ev);\n });\n // TODO device: attach events for functionality like in assignment-document described\n $(\"#\"+title).mousedown(function(event){\n return false;\n });\n $(\"#\"+title).click(function(event){\n diagram.deviceMouseDown(_this);\n });\n\n $(\"#\"+title).dblclick(function(event) {\n alert(name[type] +\" \"+ index);\n });\n\n $(\"#\"+title).keydown(function(event){\n if(event.which == \"13\"){\n diagram.deviceMouseDown(_this);\n }\n });\n\n var x = $(\"#arrow-device-add-reference\").clone();\n x.attr(\"id\", \"arrow-symbol-\"+ title);\n $(\"#\"+title).append(x);\n $(\"#\"+title).hover(function(event){\n if($(window).width() >= 768){\n x.attr(\"style\", \"display: block;\");\n }\n }, function(event){\n x.attr(\"style\", \"display: none;\");\n });\n x.click(function(event){\n diagram.toggleArrowActive();\n });\n\n $(\"#\"+title).removeClass('ui-draggable-dragging');\n\n // TODO device: attach drag & drop functionality\n $(\"#\"+title).draggable({\n start: function(event){\n if($(window).width() <= 767){\n return false;\n }\n },\n containment: diagram.area,\n drag: function(event){\n moveDevice();\n }\n });\n\n\n // TODO device optional: attach events for bonus points for 'Tab' and 'Enter'\n $(\"#\"+_this.title).attr(\"tabindex\",\"0\");\n }", "function attachEvents(){\n Object.keys(he.globalEvents).forEach(function(name){\n document.addEventListener(name, function(e){\n _.each(he.globalEvents[name], function(id){\n var control;\n if(control = CACHE[id]){\n control.trigger(\"global:\" + name, e);\n return;\n }\n // Control was removed\n delete CACHE[id];\n });\n });\n });\n\n delegateEvent('click');\n delegateEvent('keyup');\n delegateEvent('keydown');\n delegateEvent('mousemove');\n delegateEvent('mousedown');\n delegateEvent('mouseup');\n delegateEvent('keypress');\n }", "function main() {\n addEventListeners();\n addAdvancedEventListeners();\n}", "function setupEventListeners() {\n document.querySelector(DOM.addBtn).addEventListener(\"click\", function () {\n UICtrl.toggleDisplay();\n });\n document.querySelector(DOM.formSubmit).addEventListener(\"click\", function (e) {\n ctrlAddItem(e);\n });\n }", "_addEventListeners() {\n this.el.addEventListener('click', this._onClickBound);\n this.el.addEventListener('keydown', this._onKeydownBound);\n }", "function _bindEvents() {\r\n el.form.on('submit', _formHandler);\r\n el.email_input.on('focus', _resetErrors);\r\n }", "function initEventHandlersDev(){\n // Computer user requires keyboard presses\n document.onkeydown = respondToKeyPress;\n document.onkeyup = respondToKeyRelease;\n initTouchEventHandlers();\n // initButtonEventHandlers();\n initMobileEventHandlers();\n}", "addHandlers() {\n this.onDoubleClick = this.onDoubleClick.bind(this);\n document.addEventListener(\"dblclick\", this.onDoubleClick);\n }", "function attachEvents() {\n var\n inputs = document.querySelectorAll('input'),\n\n i;\n\n // Input Elements Events Listeners\n for (i = 0; i < inputs.length; i = i + 1) {\n // if input element isn't the file chooser\n if (inputs[i].id !== 'picture_input') {\n // Validation Part\n inputs[i].addEventListener('input', checkEventElementValidity);\n inputs[i].addEventListener('blur', removeBorder);\n\n // Storage Part\n inputs[i].addEventListener('input', addElemValueToSessionStorage);\n // the input element is the file chooser \n } else {\n inputs[i].addEventListener('change', handleFileSelect);\n }\n }\n\n // Picture dnd Events Listeners\n picture_container.addEventListener('dragenter', dragEnterHandler);\n picture_container.addEventListener('drop', dropHandler);\n picture_container.addEventListener('dragover', dragOverHandler);\n picture_container.addEventListener('dragstart', dragStartHandler);\n }", "$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 addEventListeners() {\n watchSubmit();\n watchResultClick();\n watchLogo();\n watchVideoImageClick();\n watchCloseClick();\n}", "function _addEventListeners () {\n dom.$gridToggle.on('click', _toggleGrid);\n dom.$scrollToLink.on('click', scrollToElement);\n document.onkeypress = keyPress;\n document.onkeydown = keyDown;\n window.addEventListener('scroll', _pageScroll);\n window.addEventListener('resize', _windowResize);\n }", "function setupListeners() {\n // handle mouse down and mouse move\n el.on('mousedown touchstart', handleMouseDown);\n\n // handle mouse up\n pEl.on('mouseup touchend', handleMouseUp);\n\n // handle window resize\n $(win).resize(handleWindowResize);\n\n $('body').on(opts['namespace'] + '-neighbour-resized', function(e) {\n if (e.target !== el[0]) {\n handleNeighbourSplitter();\n }\n });\n\n // destory, cleanup listeners\n scope.$on('$destroy', function() {\n el.off('mousedown touchstart', handleMouseDown);\n pEl.off('mouseup touchend', handleMouseUp);\n $(win).off('resize', handleWindowResize);\n });\n }", "addEventListeners() {\n\t\tthis.container.addEventListener( 'click', this.handleClick, false );\n\t}", "function addListeners() {\n Enabler.addEventListener(studio.events.StudioEvent.EXPAND_START, expandStartHandler);\n Enabler.addEventListener(studio.events.StudioEvent.EXPAND_FINISH, expandFinishHandler);\n Enabler.addEventListener(studio.events.StudioEvent.COLLAPSE_START, collapseStartHandler);\n Enabler.addEventListener(studio.events.StudioEvent.COLLAPSE_FINISH, collapseFinishHandler);\n creative.dom.expandButton.addEventListener('click', onExpandHandler, false);\n creative.dom.collapseButton.addEventListener('click', onCollapseClickHandler, false);\n //creative.dom.expandedExit.addEventListener('click', exitClickHandler);\n creative.dom.expandMain.addEventListener('click', onExpandHandler);\n // creative.dom.closeButton.addEventListener('click', closeClickHandler);\n}", "function addMyEventListener(){\n\t$('#saveBtn').click(save);\n\t$('#toListBtn').click(toList);\n\t$('#maxDateBtn').click(maxDate);\n\t$('.form_datetime').click(initDatePicker);\n}", "function bindEvents() {\n\t\t\tif(options.selection.mode != null){\n\t\t\t\toverlay.observe('mousedown', mouseDownHandler);\t\t\t\t\n\t\t\t}\t\t\t\t\t\n\t\t\toverlay.observe('mousemove', mouseMoveHandler)\n\t\t\toverlay.observe('click', clickHandler)\n\t\t}", "function iniEvents() {\n\n function _gather_table_thead() {\n data.fields.forEach(field => {\n let id = GatherComponent.idByGatherTeamField(gatherMakers, gatherMakers.team, field);\n elementById(id).addEventListener('change', refresh); // TODO optimize scope to table header rows\n });\n }\n\n function _partners_fields() {\n data.partners.forEach(partner => {\n data.fields.forEach(field => {\n let id = GatherComponent.idByPartnerField(partner, field);\n elementById(id).addEventListener('change', refresh); // TODO optmize scope to freeforms or tags\n });\n });\n }\n\n _gather_table_thead();\n _partners_fields();\n}", "function initHandlers(el) {\n $(el).find('.move-records-btn').click(moveRecordsBtnClickHandler);\n\n $(el).find('.proceed-move').click(() => {\n proceedClickHandler(el);\n });\n\n $(el).find('.close-move-dlg').click(() => {\n $.fancybox.close();\n });\n }", "function registerHandlers()\n {\n component.click(showInput);\n component.click(function(){\n list.children('li').removeClass('mt-selected');\n });\n input.on('change',inputOnchange);\n $(document).on('click','.mt-token-erase', function() {\n $(this).parent().remove();\n });\n input.on('keydown',inputKeydown);\n document.getElementById('mailtoken').addEventListener(\"keydown\", documentKeydown); //or however you are calling your method\n\n }", "events() {\n \t\tthis.openButton.on(\"click\", this.openOverlay.bind(this));\n\t\tthis.closeButton.on(\"click\", this.closeOverlay.bind(this));\n\t\t// search window will be open by keybaord. \n\t\t $(document).on(\"keydown\", this.keyPressDispatcher.bind(this));\n\t\t// when use input data in search window, typingLogic method is called. \n\t\t// searchField is defined by constructor of this class.\n\t\t/* we can use $('#search-term), but accessing DOM is much slower than\n\t\t JavaScript(jQuery). So, we use a property of this class object. which is\n\t\t 'searchField'. This is same as #Search-term and defined by constructor. */\n \t\tthis.searchField.on(\"keyup\", this.typingLogic.bind(this));\n \t}", "function bindEvents() {\n if (that._elements[\"previous\"]) {\n that._elements[\"previous\"].addEventListener(\"click\", function() {\n navigate(getPreviousIndex());\n });\n }\n\n if (that._elements[\"next\"]) {\n that._elements[\"next\"].addEventListener(\"click\", function() {\n navigate(getNextIndex());\n });\n }\n\n var indicators = that._elements[\"indicator\"];\n if (indicators) {\n for (var i = 0; i < indicators.length; i++) {\n (function(index) {\n indicators[i].addEventListener(\"click\", function(event) {\n navigateAndFocusIndicator(index);\n });\n })(i);\n }\n }\n\n if (that._elements[\"pause\"]) {\n if (that._properties.autoplay) {\n that._elements[\"pause\"].addEventListener(\"click\", onPauseClick);\n }\n }\n\n if (that._elements[\"play\"]) {\n if (that._properties.autoplay) {\n that._elements[\"play\"].addEventListener(\"click\", onPlayClick);\n }\n }\n\n that._elements.self.addEventListener(\"keydown\", onKeyDown);\n\n if (!that._properties.autopauseDisabled) {\n that._elements.self.addEventListener(\"mouseenter\", onMouseEnter);\n that._elements.self.addEventListener(\"mouseleave\", onMouseLeave);\n }\n }", "_events() {\n this._addKeyHandler();\n this._addClickHandler();\n this._setHeightMqHandler = null;\n\n if (this.options.matchHeight) {\n this._setHeightMqHandler = this._setHeight.bind(this);\n\n $(window).on('changed.zf.mediaquery', this._setHeightMqHandler);\n }\n\n if(this.options.deepLink) {\n $(window).on('popstate', this._checkDeepLink);\n }\n }", "function setEventHandlers() {\n $(\"#login_button\").click(function() {\n console.log(\"login clicked\");\n tools.loadPage(\"login\");\n tools.loadPage(\"login\");\n })\n $(\"#signup_button\").click(function() {\n console.log(\"signup clicked\");\n tools.loadPage(\"signup\")\n })\n $(\"#logout_button\").click(logoutUser)\n $(\"#youtube_link_button\").on('click', function() {\n url = $(\"#youtube_link_input\")[0].value\n getVideoFromURL(url);\n });\n }", "function bindHandlers() {\n\t\t\t\tnext.add(prev).on('click', cont, function() {\n\t\t\t\t\tif ($(this).hasClass('disabled')) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tactive = $(this).hasClass('next') ? active.next() : $(this).hasClass('prev') ? active.prev() : active;\n\t\t\t\t\tchangePic();\n\t\t\t\t});\n\t\t\t}", "function bindEvents() {\n navCategory.on(\"click\", showCategoryNav);\n navCategory.on(\"mouseover\", showCategoryNav);\n $mobileMenuTrigger.on('click', onHamburgerClick);\n //$document.on(\"mouseup\", conditionallyCloseMenus);\n $header.on('mouseleave', hideCategoryNav);\n $search.on('click', expandSearch);\n $searchMobileContainer.on('click', expandSearch);\n $closeSearch.on('click', closeSearch);\n $footerHeadLinks.on('click', footerCategoryClick);\n\n window.addEventListener(\"pagehide\", resetMobileNav, false);\n }", "function register_event_handlers()\n {\n \n \n $(document).on(\"click\", \"#sidemenu_button\", function(evt)\n {\n /* Other possible functions are: \n uib_sb.open_sidebar($sb)\n uib_sb.close_sidebar($sb)\n uib_sb.toggle_sidebar($sb)\n uib_sb.close_all_sidebars()\n See js/sidebar.js for the full sidebar API */\n \n uib_sb.toggle_sidebar($(\"#sidemenu\")); \n });\n $(document).on(\"click\", \".uib_w_6\", function(evt)\n {\n activate_subpage(\"#Reports_page\"); \n });\n $(document).on(\"click\", \".uib_w_7\", function(evt)\n {\n activate_subpage(\"#SCRUM_page\"); \n });\n $(document).on(\"click\", \".uib_w_8\", function(evt)\n {\n activate_subpage(\"#APPLICATION_page\"); \n });\n /* listitem LOGIN */\n $(document).on(\"click\", \".uib_w_5\", function(evt)\n {\n activate_subpage(\"#mainsub\"); \n });\n \n /* button LOGIN */\n $(document).on(\"click\", \"#LOGIN\", function(evt)\n {\n activate_subpage(\"#APPLICATION_page\"); \n });\n \n }", "function addListeners()\n\t{\n\t\t// Show page action so users can change settings\n\t\tchrome.runtime.sendMessage({request: \"showPageAction\"});\n\n\t\t// Add to editable divs, textareas, inputs\n\t\t$(document).on(EVENT_NAME_KEYPRESS,\n\t\t\t'div[contenteditable=true],textarea,input', keyPressHandler);\n\t\t$(document).on(EVENT_NAME_KEYUP,\n\t\t\t'div[contenteditable=true],textarea,input', keyUpHandler);\n\n\t\t// Attach to future iframes\n\t\t$(document).on(EVENT_NAME_LOAD, 'iframe', function(e) {\n\t\t\t$(this).contents().on(EVENT_NAME_KEYPRESS,\n\t\t\t\t'div[contenteditable=true],textarea,input', keyPressHandler);\n\t\t\t$(this).contents().on(EVENT_NAME_KEYUP,\n\t\t\t\t'div[contenteditable=true],textarea,input', keyUpHandler);\n\t\t});\n\n\t\t// Attach to existing iframes as well - this needs to be at the end\n\t\t// because sometimes this breaks depending on cross-domain policy\n\t\t$(document).find('iframe').each(function(index) {\n\t\t\t$(this).contents().on(EVENT_NAME_KEYPRESS,\n\t\t\t\t'div[contenteditable=true],textarea,input', keyPressHandler);\n\t\t\t$(this).contents().on(EVENT_NAME_KEYUP,\n\t\t\t\t'div[contenteditable=true],textarea,input', keyUpHandler);\n\t\t});\n\t}", "@autobind\n initEvents() {\n $(document).on('intro', this.triggerIntro);\n $(document).on('instructions', this.triggerInstructions);\n $(document).on('question', this.triggerQuestion);\n $(document).on('submit_query', this.triggerSubmitQuery);\n $(document).on('query_complete', this.triggerQueryComplete);\n $(document).on('bummer', this.triggerBummer);\n }", "function initListeners() {\n $('#key').on('click', '.key-show-control', function(ev) {\n dispatch.keyShowLine($(this).data('line-id'));\n });\n\n $('#key').on('click', 'a.key-duplicate-control', function(ev) {\n ev.preventDefault();\n dispatch.keyDuplicateLine($(this).data('line-id'));\n });\n\n $('#key').on('click', 'a.key-delete-control', function(ev) {\n ev.preventDefault();\n dispatch.keyDeleteLine($(this).data('line-id'));\n });\n\n $('#key').on('click', 'a.key-edit-control', function(ev) {\n ev.preventDefault();\n dispatch.keyEditLine($(this).data('line-id'));\n });\n }", "function oneTimeEventHandlers(){\n $('#add-new-bookmark').on(\"submit\",formSubmitHandler); \n $('#click-to-toggle-form').click(formToggleHandler); //\n $(\"#filter-bookmark-rating\").on(\"change\", minRatingChangeHandler)\n}", "function addEventListeners(){\n document.querySelectorAll(\"[data-action='filter']\").forEach(button => {\n button.addEventListener(\"click\", selectFilter);\n })\n document.querySelectorAll(\"[data-action='sort']\").forEach(button => {\n button.addEventListener(\"click\", selectSorting);\n })\n document.querySelector(\"#searchfunction\").addEventListener(\"input\", search);\n document.querySelector(\".hogwarts\").addEventListener(\"click\", hackTheSystem);\n}", "function startListeners(options) {\n $(document).on('click', options.button, function() {\n toggleLightbox();\n });\n $(document).on('click', options.curtainId, function() {\n toggleLightbox();\n });\n // If an additional button is defined, add the listener to it.\n if (options.closeButtonId !== undefined) {\n $(document).on('click', options.closeButtonId, function() {\n toggleLightbox();\n });\n }\n }", "setHandlers() {\n this.rowLabels.forEach(\n (rowLabel) =>\n (rowLabel.onclick = () => this.rowLabelClickHandler(rowLabel))\n );\n\n this.difficultyRadios.forEach((radio) => this.radioHandler(radio));\n\n this.playNowBtn.onclick = (e) => this.playNowBtnClickHandler(e);\n\n this.leaderboards.onclick = () => this.openOverlay();\n\n this.closeBtn.onclick = () => this.closeOverlay();\n\n this.playerID.onclick = () => this.changeNameClickHandler();\n\n this.changeName.onclick = () => this.changeNameClickHandler();\n }", "function events() {\r\n\taddition();\r\n\tcounter();\r\n\tcheckForm();\r\n}", "function register_event_handlers()\n { \n /* button Log in */\n $(document).on(\"click\", \".uib_w_2\", function(evt)\n {\n activate_page(\"#Login\"); \n });\n \n /* button Make an account */\n $(document).on(\"click\", \".uib_w_3\", function(evt)\n {\n activate_page(\"#Register\"); \n });\n \n /* button Sign in */\n $(document).on(\"click\", \".uib_w_8\", function(evt)\n {\n activate_page(\"#home\"); \n });\n \n }", "_bindEvents() {\n // Bind document click event to close dropdown\n document.addEventListener('click', this._onDocumentClick);\n\n // Bind event handlers to orginal input\n this.element.addEventListener('change', this._onOriginalInputChange);\n\n // Bind event handlers to internal input\n this.input.addEventListener('input', this._onInputChange);\n this.input.addEventListener('click', this._onInputClick);\n this.input.addEventListener('keydown', this._onInputKeyDown);\n this.input.addEventListener('keypress', this._onInputKeyPress);\n this.input.addEventListener('focusout', this._onInputFocusOut);\n this.input.addEventListener('focusin', this._onInputFocusIn);\n }", "_initEvents () {\n this.el.addEventListener('click', (e) => {\n if (e.target.dataset.action in this.actions) {\n this.actions[e.target.dataset.action](e.target);\n } else this._checkForLi(e.target);\n });\n }", "function bindEvents() {\n if (options.dots) {\n var dotLinks = ML.nodeArr(el.querySelectorAll('.carousel-dots a'));\n\n dotLinks.forEach(function(item) {\n ML.El.evt(item, 'click', dotClick);\n });\n }\n\n ML.El.evt(nextButton, 'click', paginationClick);\n\n ML.El.evt(prevButton, 'click', paginationClick);\n\n if (options.touch) {\n ML.El.evt(ul, 'touchstart', dragStart);\n ML.El.evt(ul, 'touchend', dragEnd);\n ML.El.evt(ul, 'touchmove', dragAction);\n }\n\n if (options.arrowKeys) {\n // To prevent being bound more than once.\n if (!ML.El.isBound(document, 'keydown', 'paginationKeydown')) {\n ML.El.evt(document, 'keydown', paginationKeydown);\n }\n }\n }", "function attachHandlers() {\n addDataGtmIgnore();\n behavior.attach( 'submit-search', 'submit', handleSubmit );\n behavior.attach( 'change-filter', 'change', handleFilter );\n behavior.attach( 'clear-filter', 'click', clearFilter );\n behavior.attach( 'clear-all', 'click', clearFilters );\n behavior.attach( 'clear-search', 'clear', clearSearch );\n cfExpandables.init();\n expandableFacets.init();\n const inputContainsLabel = document.querySelector( '.tdp-activity-search .input-contains-label' );\n if ( inputContainsLabel ) {\n const clearableInput = new ClearableInput( inputContainsLabel );\n clearableInput.init();\n }\n}", "function attachEvents() {\n // Add custom events to the window\n window.addEventListener(\"touch\", handleInteruption, false);\n window.addEventListener(\"mousewheel\", handleInteruption, false);\n window.addEventListener(\"mousedown\", handleInteruption, false);\n}", "registerDomEvents() {/*To be overridden in sub class as needed*/}", "function registerEventHandlers() {\n\n\t\tEventDispatcher.addEventListener( \"LOAD_BUTTON_CLICKED\" , function(){\n\n\t\t\t// Increment number of visible the Articles model unless all are visible\n\t\t\tif( ArticleStore.visibleArticles < ArticleStore.totalArticles ) {\n\n\t\t\t\tArticleStore.visibleArticles++;\n\t\t\t\t\n\t\t\t\trender();\n\n\t\t\t}\n\n\t\t});\n\t}", "function bindEulaModalEvents(){\n\n\t$('#acceptAndDownloadCheckBox').click(function(event){\n\t\thandleEulaModalCheckBoxEvent();\n\t});\n\n\thandleEulaModalCheckBoxEvent();\t\n}", "function addEventListeners() {\n\t$(\"#maple-apple\").click(addMapleApple);\n\t$(\"#cinnamon-o\").click(addCinnamon);\n}", "function loadEventListeners(){\n\n // get dom class names\n const DOM = UICtrl.getDOMStrings();\n //create event listener on add btn 'true icon'\n document.querySelector(DOM.inputBTN).addEventListener('click',ctrlAddItem),\n // event listener for enter btn\n document.addEventListener('keypress',function(e){\n if (e.keyCode === 13 || e.which === 13) {\n ctrlAddItem();\n }\n });\n // event for deleting item\n document.querySelector(DOM.container).addEventListener('click',deleteItem);\n // enent for change type ddl\n document.querySelector(DOM.inputType).addEventListener('change',UICtrl.changeType);\n\n }", "function initializeEvents() {\n 'use strict';\n var thumbnails = getThumbnailsArray();\n thumbnails.forEach(addThumbClickHandler);\n}", "function initializeEvents() {\n 'use strict';\n var thumbnails = getThumbnailsArray();\n thumbnails.forEach(addThumbClickHandler);\n}", "function registerEventHandlers() {\n pausePlay = document.getElementById(\"pauseplay\")\n pausePlay\n .addEventListener(\"click\", togglePausePlay);\n\n document\n .getElementById(\"stepButton\")\n .addEventListener(\"click\", stepButtonClick);\n\n document\n .getElementById(\"restart\")\n .addEventListener(\"click\", restartSimulation);\n\n $('#hintModal').on('shown', hintClick)\n\n}" ]
[ "0.78477645", "0.76434076", "0.75672", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.751856", "0.72482264", "0.72462314", "0.7219688", "0.7155715", "0.715529", "0.70796424", "0.70721555", "0.7070718", "0.70695543", "0.7066062", "0.7063232", "0.70502436", "0.704032", "0.70320493", "0.700039", "0.69790226", "0.69717646", "0.69674695", "0.6964844", "0.6952356", "0.69452006", "0.6943743", "0.6924906", "0.69111335", "0.6901461", "0.6888607", "0.68697804", "0.68683004", "0.6866954", "0.68649715", "0.68622875", "0.68548864", "0.68413734", "0.68379796", "0.6830644", "0.6826188", "0.681326", "0.6812181", "0.68071306", "0.68040377", "0.6797002", "0.6771385", "0.67632145", "0.67407703", "0.67302966", "0.67297095", "0.67181927", "0.67146873", "0.6712332", "0.6704577", "0.66983163", "0.66980153", "0.66968733", "0.6692576", "0.66882277", "0.66868097", "0.66857743", "0.66857266", "0.66736615", "0.66701174", "0.6667552", "0.66640437", "0.6652267", "0.66480637", "0.66432625", "0.6640939", "0.66374266", "0.6631536", "0.6627795", "0.66262186", "0.66166687", "0.6616078", "0.66041714", "0.659965", "0.6597525", "0.6595072", "0.65930057", "0.65930057", "0.65864277" ]
0.0
-1
another variation useful if you need to pass something arbitrary thru to the callback fn achieved by caching the thing you want sent in a Property in the D3 selection
function attachCallbackToEventWithProperty(selection, eventType, callback, propname, prop) { selection.on(eventType, callback); selection.property(propname, prop); return selection; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function optionChanged() { \n\n var testSubject = d3.select('#selDataset').node().value;\n buildPlot(testSubject)\n \n}", "function optionChanged(){\r\n var dropdownMenu = d3.select('#selDataset');\r\n var subjectID = dropdownMenu.property('value');\r\n// run the plot data function (which includes the dropdownValue function)\r\n plotData(subjectID);\r\n}", "function optionChanged(){\r\n var data=d3.select('option').node().value;\r\n getData(data)\r\n }", "function _attr(name, value, control, a,r,g,s) {\n if (arguments.length > 2) { \n var filter = function (d) { return d };\n\n if (arguments.length > 5) {;\n filter = arguments[arguments.length - 1];\n }\n\n var wires = makeWires();\n\n d3.playground.create.apply(this, [].concat.apply([wires.trigger], arguments))\n\n return __transition_tween(this, name, value, wires.register, \n function (value, d, i) {\n if (typeof value === 'function') {\n value = value(d, i);\n }\n\n return filter(value, d, i);\n });\n }\n\n// Defer to original attr function if no extra arguments\n// So we've added \n// * 1 simple logic\n// * 1 fn.apply to every attr call\n// * 1 closure\n return original_d3_selection_transition_attr.apply(this, arguments)\n }", "function optionChanged () {\n id = d3.select('#selDataset').property('value');\n reload(id)\n return id\n}", "function optionChanged() {\n\tdropDownMenu=d3.select('#selDataset');\n\tid=dropDownMenu.property('value');\n\tconsole.log(id);\n\tbuildPlot(id);\n\n}", "function optionChanged() {\n // Select the input value from the selection\n var filter_year = d3.select('#selDataset').property('value');\n // console.log('filter_id:', filter_id);\n myPlot(filter_year);\n}", "function _attr(name, value, control, a,r,g,s) {\n // Our priorities are always important!\n var priority = 'important';\n\n if (arguments.length > 2) {\n\n var filter = function (d) { return d };\n\n if (arguments.length > 5) {;\n filter = arguments[arguments.length - 1];\n }\n\n var wires = makeWires();\n\n d3.playground.create.apply(this, [].concat.apply([wires.trigger], arguments))\n\n return __transition_tween(this, name, value, priority, wires.register, \n function (value, d, i) {\n if (typeof value === 'function') {\n value = value(d, i);\n }\n\n return filter(value, d, i);\n });\n }\n\n// Defer to original attr function if no extra arguments\n// So we've added \n// * 1 simple logic\n// * 1 fn.apply to every attr call\n// * 1 closure\n return original_d3_selection_transition_attr.apply(this, arguments)\n }", "function getCallBackParams(d, elem, prop) {\n var cbParams = { datum: d\n , elem: elem\n , prop: prop // NB - untyped assignment - only use in mkCallback fns\n , timestamp: d3.event.timeStamp\n , meta: d3.event.metaKey\n , shift: d3.event.shiftKey\n , ctrl: d3.event.ctrlKey\n , alt: d3.event.altKey };\n return cbParams;\n}", "function getData() {\r\n var dropdownMenu = d3.select(\"#selDataset\");\r\n // Assign the value of the dropdown menu option to a variable\r\n var newTestID = dropdownMenu.property(\"value\").toString();\r\n plotFunc(newTestID);\r\n}", "function clicked(cb_keyword) {\n return function(d) {\n d3.selectAll(\"g\").style(\"stroke\", \"\");\n if(!oneclick) {\n oneclick = true;\n let click_to = setTimeout(function() {\n if(oneclick) {\n cb_keyword(d);\n }\n oneclick = false;\n }, 250);\n // d3.select(this).style(\"stroke\", \"rgb(220,100,100)\");\n let self = this;\n d3.selectAll(\".select-path\").remove();\n d3.select(self).append(\"path\")\n .attr(\"class\", \"link\")\n .attr(\"class\", \"select-path\")\n .attr('d', function(d){\n let p = d3.select(this.parentNode);\n let t = p.attr(\"transform\").split(\",\");\n t[0] = d3.select(\"svg\")._groups[0][0].clientWidth - parseFloat(t[0].replace(\"translate(\", \"\"));\n t[1] = -parseFloat(t[1].replace(\")\", \"\"))+20;\n let r = parseInt(p.select(\"circle\").attr(\"r\"));\n r += $(p.select(\"foreignObject body div span.node-label\")._groups[0][0]).width()+30;\n let o = {x:-5,y:r};\n let o2 = {x:t[1],y:t[0]};\n return diagonal(o2, o);\n });\n\n d3.selectAll(\"foreignObject body\")\n .attr(\"class\", \"\");\n\n d3.selectAll(\"circle.node\")\n .attr(\"class\", \"node\");\n\n d3.select(self)\n .select(\"foreignObject body\")\n .attr(\"class\", \"hl-label\")\n .attr(\"style\", function(d) {\n let p = d3.select(this.parentNode);\n let r = $(p.select(\"foreignObject body div span.node-label\")._groups[0][0]).width()+25;\n return \"width:\" + r + \"px;\";\n });\n\n d3.select(self)\n .select(\"circle.node\")\n .attr(\"class\", \"node selected\")\n } else {\n oneclick = false;\n clearTimeout(click_to);\n if((d.data.length == \"0\" && d.data.heading_id != \"root\")\n || d.data.heading_id == selected_heading) {\n // don't update if there's nothing to load\n // or if we already have this heading loaded\n return;\n }\n // otherwise we double clicked another tier\n let $container = $(this).closest(\"svg\");\n let svg_id = $container.attr(\"id\");\n let width = $container.attr(\"width\");\n let height = $container.attr(\"height\");\n let pack = d3.tree().size([height, width]);\n last_heading = \"\";\n selected_heading = \"\";\n $(\".hl-label\").removeClass(\"hl-label\");\n $(\".selected\").removeClass(\"selected\");\n // update the circle pack to show new tier\n update(d3.select(\"svg#\" + svg_id), pack, \"/oht/\", d.id, cb_keyword);\n }\n }\n}", "function $d3(selection) {\n return $(selection[0][0]);\n}", "function createSelectionOptions(element,objName,configObj,propertyName,optionsArray,eventHidderId){\n var thisDiv=document.createElement('div');\n rsb.appendHTML_Child(thisDiv);\n var thisDivNode=d3.select(thisDiv);\n thisDivNode.style(\"dispay\",\"grid\");\n thisDivNode.style(\"margin-top\",\"5px\");\n thisDivNode.style(\"width\",\"100%\");\n thisDivNode.style(\"padding\",\"2px 5px\");\n\n if (eventHidderId){\n // console.log(\"Event HIder ID \"+ eventHidderId);\n thisDivNode.classed(eventHidderId,true);\n }\n\n\n\n var lb=thisDivNode.append('label');\n lb.node().innerHTML=propertyName;\n var sel=thisDivNode.append('select');\n sel.node().id=\"_\"+propertyName+\"_Selection\";\n sel.style(\"position\",\"absolute\");\n sel.style(\"right\",\"10px\");\n\n\n for (var i=0;i<optionsArray.length;i++){\n var optA=sel.append('option');\n optA.node().innerHTML=optionsArray[i];\n }\n\n // set the selected value;\n var givenRenderingType=configObj[propertyName];\n // console.log(givenRenderingType);\n var selectionIndex=optionsArray.indexOf(givenRenderingType);\n var selection=d3.select(\"#_\"+propertyName+\"_Selection\");\n selection.node().options.selectedIndex=selectionIndex;\n selection.on(\"change\",function(){\n var parent=d3.select(\"#_\"+propertyName+\"_Selection\");\n var optsArray=parent.node().options;\n var selectedIndex=optsArray.selectedIndex;\n var nameOfElement=optsArray[selectedIndex].innerHTML;\n // console.log(\"That thing has Changed Selection to value: \"+nameOfElement);\n configObj[propertyName]=nameOfElement;\n\n var nodeElement=true;\n if (!element.getLabelText){\n nodeElement=false;\n element.getPropertyNode().getConfigObj()[propertyName]=nameOfElement;\n }\n // graphRenderer.graph.zoomToExtentOfGraph();\n if (nodeElement)\n element.handleLocal_GizmoRepresentationChanges();\n else\n element.getPropertyNode().handleLocal_GizmoRepresentationChanges();\n // if (propertyName===\"renderingType\") {\n // updateShapeParamVisibility(configObj[propertyName]);\n // }\n\n });\n return selection;\n }", "function mouseover(d){\n var select = d.data.type;\n select = select.split(' ').join('');\n select = select.split(',').join('');\n\n //if nother on the chart has been clicked yet, set lower opacity on hover,\n //then update\n if(!somethingIsClicked){\n\n piesvg.selectAll(\".\" + select)\n .style(\"opacity\", \"0.6\");\n\n hG.update(fData.map(function(v){ \n return [v.ID,parseFloat(v.freq[d.data.type]),v.county,d.data.type];}),segColor(d.data.type)); //update segColor to something else\n \n //if it has been clicked already\n }else{\n\n var tc = d3.select(this).attr(\"clicked\");\n \n //and this has been clicked keep everything the same\n if(tc == \"true\"){\n\n piesvg.selectAll(\"path\")\n .style(\"opacity\", \"0.2\");\n\n piesvg.selectAll(\".\" + select)\n .style(\"opacity\", \"1\");;\n \n //if this is not the clicked slice change the opacity\n }else{\n \n piesvg.selectAll(\".\" + select)\n .style(\"opacity\", \"0.6\");\n }\n \n }\n \n \n }", "function optionChanged(newSample) {\n var dropDownMenu = d3.select('#selDataset');\n var subject = dropDownMenu.property('value');\n createBarChart(subject);\n createBubbleChart(subject);\n createDemographics(subject);\n createGaugeChart(subject);\n}", "function dropDown(names){\r\n //finding the element by ID in the HTML\r\n var selector = d3.select(\"#selDataset\")\r\n names.forEach(name => {\r\n selector.append(\"option\")\r\n .text(name)\r\n .property(\"value\", name);\r\n });\r\n optionChanged(names[0])\r\n}", "_objectPropertiesEventListener() {\r\n\r\n // CLASS REFERENCE\r\n let that = this;\r\n\r\n // STRUCTURE PROPERTY \r\n d3.selectAll('[data-structure-property]').on('change', function () {\r\n let property = d3.select(this).attr('data-structure-property');\r\n let value = d3.select(this).property('value');\r\n switch (property) {\r\n case \"x\": {\r\n }\r\n break;\r\n case \"y\": {\r\n\r\n }\r\n break;\r\n case \"width\": {\r\n\r\n }\r\n break;\r\n case \"height\": {\r\n\r\n }\r\n break;\r\n case \"angle\": {\r\n\r\n }\r\n default:\r\n break;\r\n }\r\n });\r\n\r\n }", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.iso_a3) //or iso_a3?\n .style(\"stroke\", \"blue\")\n .style(\"stroke-width\", \"2\");\n //console.log(\"hello\", \".\" + props.iso_a3);\n // add dynamic label on mouseover\n setLabel(props);\n}", "function displayGraph(column, high, low = 0){\n const selected = document.getElementsByClassName('selected')\n console.log(selected)\n if (selected[0]) {\n selected[0].className = ''\n }\n document.getElementById(column).className = 'selected'\n svg.selectAll(\".county\")\n .style(\"fill\", function(d) {\n try {\n return getFill(rateById[d.id - 0][column], high, low);\n } catch(e) {\n return undefined\n }\n \n })\n .on(\"mouseout\", function(){\n d3.select(this).style(\"fill\", function(d) {\n try {\n return getFill(rateById[d.id - 0][column], high, low);\n } catch(e) {\n return undefined\n }\n }\n );\n getText(undefined);})\n \n}", "function SearchEvent() {\n //name = d3.select(\"#searchbox\").value;\n var name = document.getElementById(\"searchbox\").value;\n if (document.getElementById(\"searchbox\").value==\"\"){\n name = d3.select(this).value;\n }\n console.log(d3.select(this).value);\n if (name!=\"\"){\n d3.selectAll(\"circle\")\n .attr(\"opacity\",0.3);\n d3.select(\"body\")\n .selectAll(\".\"+name)\n .attr(\"fill\",\"red\")\n .attr(\"opacity\",1);\n //d3.select(\"body\").selectAll(\".\"+name).attr(\"fill\",\"red\");\n }\n }", "function optionChanged(){\n\n // Use D3 to get selected subject ID from dropdown \n subjectID = d3.select(\"#selDataset\").property(\"value\");\n console.log(subjectID)\n \n\n // Update Charts based on selected Student_ID\n topOTUBar(subjectID)\n topOTUBubble(subjectID)\n demographTable(subjectID)\n washingGauge(subjectID)\n\n \n\n}", "addSelector(container, plotAxis, selectedOption) {\n\t\tlet selector = container.append('select')\n \t.attr('id', 'scatterplot-control-' + plotAxis);\n\n let options = selector.selectAll('option')\n \t.data(this.availableSelections)\n \t.enter()\n \t.append('option')\n \t.text((d) => { return d.replace('_', ' ') })\n \t.attr('value', (d) => { return d });\n\n options.filter((d) => { if (d === selectedOption) return d; })\n \t.attr('selected', 'selected');\n\n let that = this;\n\n selector.on('change', function(d, i) {\n \tthat.selections[plotAxis] = this.options[this.selectedIndex].value;\n \tthat.update();\n });\n\n return selector;\n\t}", "function ShowYear(selected_year)\n{\n d3.csv(\"data/country_data.csv\", function(data)\n {\n\n country_emissions_data = data;\n d3.selectAll(\"#map_radio_option\").on(\"click\",//When the mouse clicked over a country, lock that country\n function()\n {\n radio_metric_selection = document.getElementsByName('map_colour_radio').value;\n draw_map_by_metric_and_scale(country_emissions_data, radio_metric_selection, radio_colour_selection)\n });\n draw_map_by_year(country_emissions_data, selected_year);\n });\n}", "function onMouseoverOnto(){\n currentObjOnto = d3.select(this);\n}", "function optionChanged(value) {\n d3.json(url, function(data) {\n var flowData = data['flow'];\n var outcomesData = data['outcomes']\n var demoData = data['demo']\n var filteredFlow = filterFlow(value,flowData);\n var filteredOutcomes = filterOutcomes(value, outcomesData);\n var filteredDemo = filterDemo(value, demoData);\n console.log(value + ' Filtered Data for PH row: ', filteredOutcomes);\n console.log(value + ' Filtered Data for in/out/exit row: ', filteredFlow);\n console.log(value + ' Filtered Data for Demo row: ', filteredDemo);\n\n\n\n updateFlow(filteredFlow, value);\n updateOutcomes(filteredOutcomes, value);\n updateDemo(filteredDemo, value);\n });\n}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function SelectionChange() {}", "function init() {\n var myDropDown = d3.select('#selDataset');\n //loop through the name\n jsonData.names.forEach((name) => {\n myDropDown.append('option').text(name).property('value', name);\n });\n optionChanged(jsonData.names[0])\n}", "function selectNHSDataCallback(key, value) {\n\t\t\tvm.rota[key] = value;\n\t\t\tvm.updateViewWithRelatedModel(key);\n\t\t}", "function optionChanged(newSelection) {\n buildChart(newSelection);\n}", "attributeChangedCallback(attr, oldVal, newVal) {}", "attributeChangedCallback(attr, oldVal, newVal) {}", "attributeChangedCallback(attr, oldVal, newVal) {}", "attributeChangedCallback(attr, oldVal, newVal) {}", "function change(){ \n //get selected value\n const vals = d3.select('#sel').property('value')\n //append main dataset\n d3.csv('datasets/uni_latlng_count_nat_extended2.csv', function (error, data) {\n\n //define scale for the red circles\n const r = d3.scaleLinear()\n .domain([d3.min(data, d=>Number(d.count)),d3.max(data, d=>Number(d.count))])\n .range([10,45])\n //refresh when toggle select\n g3.selectAll('circle').remove().exit()\n //append circles\n g3.selectAll('circle').data(data)\n .enter()\n .append('circle')\n //(get selected value) filter by institution type\n .filter(function(d){return d.type == vals})\n .attr('cx', (d) => projection([d.lng, d.lat])[0])\n .attr('cy', (d) => projection([d.lng, d.lat])[1]) \n .attr(\"r\", (d) => r(d.count))\n .style(\"fill\", \"red\")\n .style(\"opacity\", 0.25)\n //mouse behaviour : on mouse over circles append specific data about the institutions selected\n .on(\"mouseover\", function(d) {\n uniName.attr(\"x\", projection([d.lng, d.lat])[0])\n .attr(\"y\", projection([d.lng, d.lat])[1]-30)\n .text(d.university)\n .attr(\"font-family\", \"sans-serif\")\n .attr('font-weight', 'bold')\n .attr(\"font-size\", \"14px\")\n .attr(\"fill\", \"black\")\n uniCount.attr(\"x\", projection([d.lng, d.lat])[0])\n .attr(\"y\", projection([d.lng, d.lat])[1])\n .text(`Projets (freq.) : ${d.count}`)\n .attr(\"font-family\", \"sans-serif\")\n .attr('font-weight', 'bold')\n .attr(\"font-size\", \"10px\")\n .attr(\"fill\", \"black\")\n uniSumAmount.attr(\"x\", projection([d.lng, d.lat])[0])\n .attr(\"y\", projection([d.lng, d.lat])[1]+20)\n .text(`Financements (total) : ${d.amount_sum}.-`)\n .attr(\"font-family\", \"sans-serif\")\n .attr('font-weight', 'bold')\n .attr(\"font-size\", \"10px\")\n .attr(\"fill\", \"black\")\n uniMeanAmount.attr(\"x\", projection([d.lng, d.lat])[0])\n .attr(\"y\", projection([d.lng, d.lat])[1]+40)\n .text(`Financements (moy.) : ${d.amount_mean}.-`)\n .attr(\"font-family\", \"sans-serif\")\n .attr('font-weight', 'bold')\n .attr(\"font-size\", \"10px\")\n .attr(\"fill\", \"black\")\n uniMedAmount.attr(\"x\", projection([d.lng, d.lat])[0])\n .attr(\"y\", projection([d.lng, d.lat])[1]+60)\n .text(`Financements (med.) : ${d.amount_median}.-`)\n .attr(\"font-family\", \"sans-serif\")\n .attr('font-weight', 'bold')\n .attr(\"font-size\", \"10px\")\n .attr(\"fill\", \"black\")\n g2.transition().duration(500).style('opacity', .3)\n d3.select(this).transition()\t\t\n .duration(350)\n .attr('r', 150)\t\t\n uniName.transition()\t\t\n .duration(1000)\t\t\n .style(\"opacity\", .9);\n uniCount.transition()\n .duration(1000)\n .style('opacity', .9)\n uniSumAmount.transition()\n .duration(1000)\n .style('opacity', .9)\t\n uniMeanAmount.transition()\n .duration(1000)\n .style('opacity', .9)\t \t\t\t\n uniMedAmount.transition()\n .duration(1000)\n .style('opacity', .9)\t \t\t\t\n })\n .on(\"mouseout\", function(d) {\t\t\n uniName.transition()\t\t\n .duration(500)\t\t\n .style(\"opacity\", 0);\t\n uniCount.transition()\t\t\n .duration(500)\t\t\n .style(\"opacity\", 0);\n uniSumAmount.transition()\t\t\n .duration(500)\t\t\n .style(\"opacity\", 0);\n uniMeanAmount.transition()\t\t\n .duration(500)\t\t\n .style(\"opacity\", 0);\n uniMedAmount.transition()\t\t\n .duration(500)\t\t\n .style(\"opacity\", 0);\t\n d3.select(this).transition().duration(500).attr('r', (d) => r(d.count))\t\t\n g2.transition().duration(500).style('opacity', 1)\n\n });\n\t\t\n });\n }", "attributeChangedCallback() { }", "function generalCallback(data) {\n lastValue = data;\n }", "onSelect() {}", "registerOnChange(fn) {\n this._fn = fn;\n\n this.onChange = () => {\n fn(this.value);\n\n this._registry.select(this);\n };\n }", "function myFunction() {\n var input = d3.select(\"input\");\n var username = input.property(\"value\");\n load_tweet(username);\n}", "function selectHandler() \n {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) \n {\n var selectedLevel = data.getValue(selectedItem.row, 0);\n var hidData = $(\"#hid\"+title+\"PieChartContainer\").val();\n \n if(hidData != undefined){\n var hid_ids = JSON.parse(hidData); \n var selected_ele_ids = hid_ids[selectedLevel];\n ViewerHighLight(selected_ele_ids);\n }\n }\n }", "function optionCompareChangedOne(select) {\n //Giving select a variable name\n var sel = select\n\n // Importing data from portionsandweights\n d3.json(\"/portionsandweights\").then((importData) => {\n\n // Searching food names through json\n var portions = importData.data;\n\n //Empty Variable\n var filterSelect = []\n\n // Filter the search\n filterSelect = portions.filter(d => d.food_code == sel);\n\n // Food name of filtered data\n var nameOne = filterSelect[0].main_food_description;\n\n // selecting tag for displaying the name\n var selectFoodName = document.getElementById(\"nameOne\");\n\n // Clear html display name\n selectFoodName.innerHTML = \"\";\n\n // Create html tag showing food name\n selectFoodName.innerHTML = selectFoodName.innerHTML +\n '<h3>' + nameOne + '</h3>';\n\n // selecting tag for dropdown\n var select = document.getElementById(\"selCompareTwo\");\n\n //Clear dropdown\n select.innerHTML = \"\";\n\n // For loop for drop down. referencing id and seq_num of portion size\n for (var i = 0; i < filterSelect.length; i++) {\n select.innerHTML = select.innerHTML +\n '<option value=\"' + filterSelect[i].food_code + ',' + filterSelect[i].seq_num + '\">' + filterSelect[i].portion_description + '</option>';\n\n }\n\n // default selection\n var defaultPortionID = filterSelect[0].food_code\n var defaultPortionSeq_num = filterSelect[0].seq_num\n\n // Adding default selection into selection categfory\n optionCompareWeightChangedOne(defaultPortionID, defaultPortionSeq_num);\n // GAUGE ONE\n gaugeOne(defaultPortionID, defaultPortionSeq_num);\n\n });\n}", "attributeChangedCallback(name, oldValue, newValue) {\n // do stuff\n }", "function optionChanged (d) {\n console.log(\"option changed function\");\n const isNumber = (element) => element === d;\n var idx = (names.findIndex(isNumber));\n d3.selectAll(\"td\").remove();\n d3.selectAll(\"option\").remove();\n var dropMenu = d3.select(\"#selDataset\")\n dropMenu.append(\"option\").text(d); \n init(idx);\n}", "function OnGenChanged(gen) {\n selectionsGenerations = gen;\n OnFilterCriteriaChanged();\n}", "function invokeCallback(binding, expression, event, index, item) {\n return binding.value[expression]({\n event: event,\n index: index,\n item: item || undefined,\n external: !dndDragTypeWorkaround.isDragging,\n type: dndDragTypeWorkaround.isDragging ? dndDragTypeWorkaround.dragType : undefined\n });\n }", "update_info(d,context) {\n if (d.munip_votes) {\n var value = d.munip_votes;\n }\n else {\n var value = 0;\n }\n\n\n d3.select(context).classed(\"highlighted\", true);\n\n var name;\n if(d.properties.KTNAME) {\n name = d.properties.KTNAME;\n }\n else if(d.properties.GMDNAME) {\n name = d.properties.GMDNAME;\n }\n d3.selectAll(this.map_id).select(\".value_map\").text( name );\n\n\n }", "function selFeature(value){\n //...\n }", "function selFeature(value){\n //...\n }", "function callback(){}", "function mySelectEvent() {\n\n var selected = this.selected();\n if (selected === '1') {\n hStep=1;\n ItterNum=1;\n }\n\n if (selected === '2') {\n hStep=0.1;\n ItterNum=10;\n }\n\n if (selected === '3') {\n hStep=0.01;\n ItterNum=100;\n }\n\n}", "function setupCallback(func, callbacks){\n\t\tvar hash = \"\" + Object.keys(callbacks).length;\n\t\tcallbacks[hash] = func;\n\t\tvar dataAttr = document.createAttribute(dataIdName);\n\t\tdataAttr.value = hash;\n\t\treturn dataAttr;\n\t}", "function my(selection) {\n\n\t\t// pass the data to each selection (multiples-friendly)\n\t\tselection.each(function(data, i) {\n\n\t\t\tvar minX = 0;\n\t\t\tvar maxX = d3.max(data, function(d) { return d[xVar]; });\n\n\t\t\tvar scaleX = d3.scale.linear().domain([minX, maxX]).range([0, width]);\n\t\t\tvar scaleY = d3.scale.ordinal().domain(d3.range(data.length)).rangePoints([height, 0], 1);\n\t\t\t\n\n // In the following we'll attach an svg element to the container element (the 'selection') when and only when we run this the first time.\n // We do this by using the mechanics of the data join and the enter selection. \n // As a short reminder: the data join (on its own, not chained with .enter()) checks how many data items there are \n // and stages a respective number of DOM elements.\n // An join on its own - detached from the .enter() method - checks first how many data elements come in new \n // (n = new data elements) to the data join selection and then it appends the specified DOM element exactly n times. \n\n // Here we do exactly that with joining the data as one array element with the non-existing svg first:\n\n\t\t\tvar svg = d3.select(this) \t// conatiner (here 'body')\n\t\t\t\t\t.selectAll('svg')\t\t\t\t// first time: empty selection of staged svg elements (it's .selectAll not .select)\n\t\t\t\t\t.data([data]);\t\t\t\t\t// first time: one array item, hence one svg will be staged (but not yet entered); \n\n svg \t\t\t\t\t\t\t\t\t\t\t\t// one data item [data] staged with one svg element\n\t \t.enter() // first time: initialise the DOM element entry; second time+: empty\n\t \t.append(\"svg\"); // first time: append the svg; second time+: nothing happens\n\n // If we have more elements apart from the svg element that should only be appended once to the chart \n // like axes, or svg > g-elements for the margins, \n // we would store the enter-selection in a unique variable (like 'svgEnter', or if we inlcude another g 'gEnter'. \n // This allows us to reference just the enter()-selection which would be empty with every update, \n // not invoking anything that comes after .enter() - apart from the very first time.\n\n\t\t\tsvg\n\t\t\t\t.attr('width', width)\n\t\t\t\t.attr('height', height);\t\t\t\t\n\n\n\t\t\t// Here comes the general update pattern:\n\n\t\t\t// Data join\n\t\t\tvar bar = svg\n\t\t\t\t\t.selectAll('.bar')\n\t\t\t\t\t.data(data, function(d) { return d[yVar]; }); // key function to achieve object constancy\n\n\t\t\t// Enter\n\t\t\tbar\n\t\t\t\t\t.enter()\n\t\t\t\t.append('rect')\n\t\t\t\t\t.classed('bar', true)\n\t\t\t\t\t.attr('x', scaleX(minX))\n\t\t\t\t\t.attr('height', 5)\n\t\t\t\t\t.attr('width', function(d) { return scaleX(minX); });\n\n\t\t\t// Update\n\t\t\tbar\n\t\t\t\t.transition().duration(1000).delay(function(d,i) { return i / (data.length-1) * 1000; }) // implement gratuitous object constancy\n\t\t\t\t\t.attr('width', function(d) { return scaleX(d[xVar]); })\n\t\t\t\t\t.attr('y', function(d, i) { return scaleY(i); });\n\n\t\t\t// Exit\n\t\t\tbar\n\t\t\t\t\t.exit()\n\t\t\t\t.transition().duration(1000)\n\t\t\t\t\t.attr('width', function(d) { return scaleX(minX); })\n\t\t\t\t\t.remove();\n\n\t\t}); // selection.each()\n\n\t\ttriggerTooltip(yVar); // invoke tooltip - not necessary, forget about it, remove it to keep it simple\n\n\t} // Closure", "function dropdownChange() {\n var newYear = d3.select(this).property('value');\n axes(slide,newYear);\n cars(slide,newYear);\n}", "registerOnChange(fn) {\n this.onChange = valueString => {\n this.value = this._getOptionValue(valueString);\n fn(this.value);\n };\n }", "_colorEventListener() {\r\n d3.selectAll('.stroke-width').on('click', function () {\r\n\r\n this.stroke = d3.select(this).property('value');\r\n\r\n })\r\n }", "onSelect(event) {}", "function OnEggChanged(egg) {\n selectionsEgg = egg;\n OnFilterCriteriaChanged();\n}", "function createChainedMethodForRender(method) {\n\treturn function () {\n\n\t\tthis.init();\n\n\t\tvar value = method.call(this);\n\t\t// call update after render if there is a data\n\t\tif (this.context().data) {\n\t\t\tthis.update();\n\t\t}\n\n\t\t// the value is the return of render.\n\t\tif (value) {\n\t\t\tthis.set('selection', value);\n\t\t} else if (value !== null) {\n\t\t\tthrow new Error(\"[\" + this.name + \"] render method must return a d3 node or null value.\");\n\t\t}\n\n\t\trenderLayerChildren(this);\n\t\treturn value;\n\t}\n}", "function selFeature(value){\r\n //...\r\n }", "function optionChanged() {\n // Obtain selected sample from dropdown\n var selectedSample = Plotly.d3.select('select').property('value'); \n console.log('selectsamle_value : ' , selectedSample)\n // Call plot function with the new sample value\n fillOutTable(selectedSample);\n buildCharts(selectedSample);\n buildGauges(selectedSample);\n}", "_setSingleAttribute(attributeName, value) {\n this.getSelectedObjects().forEach(selectedObject => {\n selectedObject[attributeName] = value;\n });\n }", "function onSelect(callback){\n\t\t\t_onSelectCallback = callback;\n\t\t}", "function onSelected($e, datum) {\n onAutocompleted($e,datum);\n }", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "function functor(val){\n return function(){\n return val;\n }\n}", "registerOnChange(fn) {\n this._fn = fn;\n this.onChange = () => {\n fn(this.value);\n this._registry.select(this);\n };\n }", "registerOnChange(fn) {\n this._fn = fn;\n this.onChange = () => {\n fn(this.value);\n this._registry.select(this);\n };\n }", "registerOnChange(fn) {\n this._fn = fn;\n this.onChange = () => {\n fn(this.value);\n this._registry.select(this);\n };\n }", "registerOnChange(fn) {\n this._fn = fn;\n this.onChange = () => {\n fn(this.value);\n this._registry.select(this);\n };\n }", "registerOnChange(fn) {\n this._fn = fn;\n this.onChange = () => {\n fn(this.value);\n this._registry.select(this);\n };\n }", "registerOnChange(fn) {\n this._fn = fn;\n this.onChange = () => {\n fn(this.value);\n this._registry.select(this);\n };\n }", "registerOnChange(fn) {\n this._fn = fn;\n this.onChange = () => {\n fn(this.value);\n this._registry.select(this);\n };\n }", "data(val) {\n\t\t\t\tif (!arguments.length) return data;\n\t\t\t\tdata = val;\n\t\t\t\t$sel.datum(data);\n\t\t\t\tChart.render();\n\t\t\t\treturn Chart;\n\t\t\t}", "data(val) {\n\t\t\t\tif (!arguments.length) return data;\n\t\t\t\tdata = val;\n\t\t\t\t$sel.datum(data);\n\t\t\t\tChart.render();\n\t\t\t\treturn Chart;\n\t\t\t}", "data(val) {\n\t\t\t\tif (!arguments.length) return data;\n\t\t\t\tdata = val;\n\t\t\t\t$sel.datum(data);\n\t\t\t\tChart.render();\n\t\t\t\treturn Chart;\n\t\t\t}", "data(val) {\n\t\t\t\tif (!arguments.length) return data;\n\t\t\t\tdata = val;\n\t\t\t\t$sel.datum(data);\n\t\t\t\tChart.render();\n\t\t\t\treturn Chart;\n\t\t\t}", "data(val) {\n\t\t\t\tif (!arguments.length) return data;\n\t\t\t\tdata = val;\n\t\t\t\t$sel.datum(data);\n\t\t\t\tChart.render();\n\t\t\t\treturn Chart;\n\t\t\t}", "data(val) {\n\t\t\t\tif (!arguments.length) return data;\n\t\t\t\tdata = val;\n\t\t\t\t$sel.datum(data);\n\t\t\t\tChart.render();\n\t\t\t\treturn Chart;\n\t\t\t}", "function selectHandler() {\n var selectedItem = chart.getSelection()[0];\n if (selectedItem) {\n var value = data.getValue(selectedItem.row, selectedItem.column);\n alert('The user selected ' + value);\n }\n }", "function optionCompareChangedTwo(select) {\n //Giving select a variable name\n var sel = select\n // Importing data from portionsandweights\n d3.json(\"/portionsandweights\").then((importData) => {\n\n // Searching food names through json\n var portions = importData.data;\n\n //Empty Variable\n var filterSelect = []\n\n // Filter the search\n filterSelect = portions.filter(d => d.food_code == sel);\n\n // Food name of filtered data\n var nameTwo = filterSelect[0].main_food_description;\n\n // selecting tag for displaying the name\n var selectFoodName = document.getElementById(\"nameTwo\");\n\n // Clear html display name\n selectFoodName.innerHTML = \"\";\n\n // Create html tag showing food name\n selectFoodName.innerHTML = selectFoodName.innerHTML +\n '<h3>' + nameTwo + '</h3>';\n\n // selecting tag\n var select = document.getElementById(\"selCompareFour\");\n\n //Clear dropdown\n select.innerHTML = \"\";\n\n // For loop for drop down. referencing id and seq_num of portion size\n for (var i = 0; i < filterSelect.length; i++) {\n select.innerHTML = select.innerHTML +\n '<option value=\"' + filterSelect[i].food_code + ',' + filterSelect[i].seq_num + '\">' + filterSelect[i].portion_description + '</option>';\n }\n // default selection\n var defaultPortionID = filterSelect[0].food_code\n var defaultPortionSeq_num = filterSelect[0].seq_num\n\n // Adding default selection into selection categfory\n optionCompareWeightChangedTwo(defaultPortionID, defaultPortionSeq_num);\n // GAUGE TWO\n gaugeTwo(defaultPortionID, defaultPortionSeq_num);\n\n });\n}", "function highlight(props){\n //change stroke\n var selected = d3.selectAll(\".\" + props.name.replace(/ /g, \"_\"))\n .style(\"stroke\", \"black\")\n .style(\"stroke-width\", \"2\");\n\n setLabel(props);\n}", "function getData() {\n\n var dropdownMenu = d3.select(\"#selFilterQuery\");\n // Assign the value of the dropdown menu option to a variable\n var term = dropdownMenu.property(\"value\");\n\n clickButton(term);\n\n}", "onDidChangeSelection(callback) {\n return this.emitter.on('did-change-path-selection', callback);\n }", "function highlight(props){\r\n //change stroke\r\n var selected = d3.selectAll(\".\" + props.CODE)\r\n .style(\"stroke\", \"blue\")\r\n .style(\"stroke-width\", \"2\");\r\n setLabel(props);\r\n}", "function imgSelectedEventListener(_fnCallback) {\n saveCallback = _fnCallback;\n}", "registerOnChange(fn) {\n this.onChange = element => {\n const selected = [];\n const selectedOptions = element.selectedOptions;\n\n if (selectedOptions !== undefined) {\n const options = selectedOptions;\n\n for (let i = 0; i < options.length; i++) {\n const opt = options[i];\n\n const val = this._getOptionValue(opt.value);\n\n selected.push(val);\n }\n } // Degrade to use `options` when `selectedOptions` property is not available.\n // Note: the `selectedOptions` is available in all supported browsers, but the Domino lib\n // doesn't have it currently, see https://github.com/fgnass/domino/issues/177.\n else {\n const options = element.options;\n\n for (let i = 0; i < options.length; i++) {\n const opt = options[i];\n\n if (opt.selected) {\n const val = this._getOptionValue(opt.value);\n\n selected.push(val);\n }\n }\n }\n\n this.value = selected;\n fn(selected);\n };\n }" ]
[ "0.58874065", "0.57989436", "0.5757216", "0.56241125", "0.55572116", "0.54892504", "0.5479817", "0.54547167", "0.541034", "0.5369719", "0.53387153", "0.533705", "0.52792317", "0.526219", "0.52497226", "0.52429646", "0.52146345", "0.51889366", "0.5138782", "0.5133924", "0.5130915", "0.5124836", "0.51240224", "0.51200366", "0.5117629", "0.5107863", "0.5107863", "0.5107863", "0.5107863", "0.5104121", "0.5090677", "0.5083746", "0.5077763", "0.5077763", "0.5077763", "0.5077763", "0.5058966", "0.50483775", "0.50475526", "0.5045096", "0.504369", "0.50401205", "0.50311714", "0.50308377", "0.5011736", "0.5003085", "0.49962714", "0.4995902", "0.49903628", "0.4989126", "0.4989126", "0.4984249", "0.498173", "0.49767604", "0.4973536", "0.4972269", "0.49668518", "0.4962783", "0.4956122", "0.49461642", "0.4943876", "0.49405023", "0.4940314", "0.49402502", "0.49357688", "0.4927702", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49224123", "0.49128085", "0.49128085", "0.49128085", "0.49128085", "0.49128085", "0.49128085", "0.49128085", "0.49048603", "0.49048603", "0.49048603", "0.49048603", "0.49048603", "0.49048603", "0.4903286", "0.49027613", "0.49002826", "0.48984867", "0.48932624", "0.48930734", "0.4892344", "0.48919803" ]
0.56258893
3
Renders the layout of the `ProductImage` component.
render() { return ( <div className="row justify-content-lg-start"> <div className="col-lg-2 thumbs"> {this.props.product.map( (product) => { let arr = []; // The comingled images between product and these standalone images // threw me off a bit arr.push(product.product_images.map( (image, index) => { return ( <a onClick={() => this.props.updateSelectedImage(image)}> <img key={`thumb-image-${index}`} className="img-fluid" src={image} alt={`Product thumbnail ${index}`}/> </a> ) })); arr.push(product.options.map( (option, index) => { return ( <a onClick={() => this.props.updateSelectedProduct(option)}> <img key={`thumb-option-${index}`} className="img-fluid" src={option.option_image} alt={`Product thumbnail ${index}`}/> </a> ) })); arr = arr.reduce( (a, b) => { return a.concat(b); }); return arr; })} </div> <div className="col-lg-10" data-test="selected-image"> <img className="img-fluid" src={this.props.selectedImage} alt="Selected"/> </div> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function renderProduct() {\n logger.info('renderProduct start');\n var imageGroups = currentProduct.getHeroImageGroups();\n var altImagesInfo = [],\n imageViews = [];\n\n currentProduct.ensureImagesLoaded('altImages').done(function() {\n var imageGroup,\n imageGroupImages,\n image,\n imageContainer,\n variationValue,\n valuePrefix,\n altContainer,\n altImages,\n commonNumber,\n smallImage,\n counter = -1,\n imageGroupsLength = imageGroups ? imageGroups.length : 0;\n\n if (imageGroupsLength == 0) {\n logger.error('product/components/images: heroImage group empty for product id ' + currentProduct.getId());\n }\n\n for (var i = 0, ii = imageGroupsLength; i < ii; i++) {\n // make the first large image visible\n imageGroup = imageGroups[i];\n\n variationValue = determineImageVariationValue(imageGroup);\n valuePrefix = variationValue || 'default';\n\n // If there a bunch of colors ... then skip the first one\n if (ii > 1 && !variationValue) {\n continue;\n }\n counter++;\n imageGroupImages = imageGroup.getImages();\n image = imageGroupImages[0].getLink();\n\n imageContainer = Alloy.createController('product/images/imageContainer');\n\n imageContainer.init(valuePrefix, image);\n imageContainer.number = counter;\n\n altContainer = imageContainer.getAltContainer();\n\n altImages = currentProduct.getAltImages(valuePrefix);\n commonNumber = imageGroupImages.length > altImages.length ? altImages.length : imageGroupImages.length;\n // create the small images to put in the alternate view\n for (var j = 0; j < commonNumber; j++) {\n smallImage = Alloy.createController('product/images/alternateImage');\n smallImagesControllers.push(smallImage);\n\n smallImage.init({\n largeImageView : imageContainer.getLargeImageView(),\n largeImage : imageGroupImages[j].getLink(),\n image : altImages[j].getLink(),\n altImageNumber : j,\n imageContainerNumber : imageContainer.number\n });\n altContainer.add(smallImage.getView());\n\n smallImagesViews.push(smallImage.getView());\n\n }\n\n addVideos({\n videoURL : 'http://assets.appcelerator.com.s3.amazonaws.com/video/media.m4v',\n imageContainerNumber : imageContainer.number,\n altImageNumber : commonNumber,\n videoPlayer : imageContainer.getVideoPlayer(),\n altContainer : altContainer\n\n });\n\n _.each(smallImagesViews, function(view) {\n view.addEventListener('alt_image_selected', altImageSelectedEventHandler);\n });\n\n imageViews.push(imageContainer.getView());\n $.pdp_image_scroller[COLOR_CONTAINER_ID_PREFIX + valuePrefix] = imageContainer.getColorContainer();\n imageContainers[counter] = imageContainer;\n imageContainer.selectedImage = 0;\n }\n $.pdp_image_scroller.setViews(imageViews);\n });\n\n logger.info('renderProduct end');\n}", "function renderTheProducts() {\n leftProduct.renderProduct(leftProductImgElem, leftProductH2Elem);\n centerProduct.renderProduct(centerProductImgElem, centerProductH2Elem); \n rightProduct.renderProduct(rightProductImgElem, rightProductH2Elem); \n}", "function display() {\n var content = this.getContent();\n var root = Freemix.getTemplate(\"thumbnail-view-template\");\n\n content.empty();\n content.append(root);\n this._setupViewForm();\n this._setupLabelEditor();\n\n var images = Freemix.property.getPropertiesWithType(\"image\");\n\n var image = content.find(\"#image_property\");\n\n // Set up image property selector\n this._setupPropertySelect(image, \"image\", images);\n this._setupTitlePropertyEditor();\n this._setupMultiPropertySortEditor();\n\n image.change();\n }", "render() {\n\n if(this.state.isLoaded == true){\n console.log(\"----------- Rendering product in ProductDetails.Render()---------\"+ this.state.product.product_Id);\n console.log(\"************ 4.0 started ProductDetails.Render() method gets called ****************\");\n var imgBasUrl = \"https://s3.amazonaws.com/instadelibucket/\";\n let productV = this.state.product;\n var that = this; \n //let productImages = this.state.product.productImagesSet;\n var count = 0;\n return (\n <div className=\"_divWH1\" >\n <div className=\"_divWH2\" styles=\"padding-top:96px;\" >\n <div className=\"_divWH3\" >\n <div className=\"_divWH3\" >\n <div className=\"_divWH3 _1Zddhx\" >\n <div className=\"_divWH4 _1GRhLX _3N5d1n\" >\n <div className=\"_divWH4 _33MqSN\" >\n <div className=\"_divWH5 _3S6yHr\" >\n <div className=\"_26KFgP\" >\n <div className=\"_2wEmBu\" >\n {/* This div is responsible for products extra images */} \n <div className=\"_divWH6 _3Z9-Oj\" >\n <div className=\"_3aYEat\" >\n <div className=\"_21PE8N _divWH7\" >\n <ul className=\"LzhdeS _divWH7 _ulWH1\" >\n <li className=\"_4f8Q22 _1WPMdP\" style={{height:'64px'}}>\n <div className=\"_20J1N6 \" > \n <div className=\"_1kJJoT\" style={{backgroundImage:`url(${imgBasUrl + this.state.product.imageUrl})`}} \n onClick={() => this.displayImage(imgBasUrl + this.state.product.imageUrl)} \n onMouseOver={() => this.displayImage(imgBasUrl + this.state.product.imageUrl)}>\n </div>\n </div>\n </li>\n {this.state.product.productImagesSet.map((productOthImages,index) =>\n <li className=\"_4f8Q22 _1WPMdP\" style={{height:'64px'}} key={index} >\n <div className=\"_20J1N6\" id={that.state.product.product_Id + productOthImages.productImgId} > \n <div className=\"_1kJJoT\" style={{backgroundImage:`url(${imgBasUrl + productOthImages.productImageUrl})`}} \n onClick={() => that.displayImage(imgBasUrl + productOthImages.productImageUrl)} \n onMouseOver={() => that.displayImage(imgBasUrl + productOthImages.productImageUrl)} ></div>\n </div>\n </li> )}\n </ul>\n </div>\n <div className=\"_1sPU_V _2-5Z5m LwZTRD\" >\n <svg width=\"8\" height=\"15\" viewBox=\"0 0 16 27\" xmlns=\"http://www.w3.org/2000/svg\" className=\"_1gnlcU\" >\n <path d=\"M16 23.207L6.11 13.161 16 3.093 12.955 0 0 13.161l12.955 13.161z\" fill=\"#000\" className=\"\" >\n </path>\n </svg>\n </div>\n <div className=\"_1sPU_V _3-urXm LwZTRD\" >\n <svg width=\"8\" height=\"15\" viewBox=\"0 0 16 27\" xmlns=\"http://www.w3.org/2000/svg\" className=\"_1gnlcU\" >\n <path d=\"M16 23.207L6.11 13.161 16 3.093 12.955 0 0 13.161l12.955 13.161z\" fill=\"#000\" className=\"\" >\n </path>\n </svg>\n </div>\n </div>\n </div>\n {/* This div is responsible to show selected product image */}\n <div className=\"_1hMRnR\" style={{ height:'420px',width:'auto'}}>\n <div className=\"_2SIJjY fluid__image-container\" style={{ height:'420px',width:'auto'}} >\n <ReactImageMagnify {...{\n largeImage: {\n alt: '',\n // src: imgBasUrl + this.state.product.imageUrl,\n src:this.state.displayImgUrl,\n width: 1200,\n height: 1800\n },\n smallImage: {\n isFluidWidth: true,\n alt: 'Wristwatch by Ted Baker London',\n //src: imgBasUrl + this.state.product.imageUrl,\n src:this.state.displayImgUrl,\n sizes: '(max-width: 480px) 100vw, (max-width: 1200px) 30vw, 460px'\n },\n isHintEnabled: true,\n enlargedImagePosition: 'over'\n }} /> \n \n </div>\n </div>\n </div>\n <div className=\"_3gDSOa _2rDH5A\" >\n <div className=\"DsQ2eg\" >\n <svg xmlns=\"http://www.w3.org/2000/svg\" className=\"_2oLiqr\" width=\"16\" height=\"16\" viewBox=\"0 0 20 16\" >\n <path d=\"M7.695 15.35C3.06 11.14 0 8.356 0 4.958 0 2.172 2.178 0 4.95 0 6.516 0 9.164 1.764 9 2.91 9.164 1.763 11.484 0 13.05 0 15.822 0 18 2.172 18 4.958c0 3.398-3.06 6.183-7.695 10.392L9 16.54l-1.305-1.19z\" fill=\"#2874F0\" className=\"_35Y7Yo\" ></path>\n </svg>\n </div>\n </div>\n </div>\n </div>\n {/*This div is responsible for product details */}\n <div className=\"_2Cl4hZ\" >\n <div className=\"_1MVZfW\" >\n <div className=\"_2UDlNd\" >\n <div data-reactid=\"157\">\n <h1 className=\"_3eAQiD\" >\n {this.state.product.name}\n </h1>\n <div className=\"_1vC4OE _37U4_g\" >\n <span><h1 className=\"_3eAQiD\" > ₹ </h1>\n </span>\n <span>{this.state.product.cost}</span>\n </div>\n \n \n </div>\n </div>\n {/*This div is responsible for product Variants */} \n \n {that.state.variantKeys.length > 0 && \n <div className=\"rPoo01\" data-reactid=\"variant\" >\n {that.state.product.variantKeys.map((variantKey,index) => \n \n (function() {\n count = count + 1;\n switch(variantKey) {\n case 'Color': return <ColorV product={productV} variantKey={variantKey} key={index} \n onClick={that.props.onClick} \n id={\"ColorV\"+ that.state.variantKey +\"-\" + count + index } />;break;\n // case 'Size': return <Size product={productV} variantKey={variantKey} key={index} onClick={onClickFunc} />;break;\n //case 'Material': return <Material product={productV} variantKey={variantKey} key={index} onClick={onClickFunc}/>;break;\n default: return <p data-reactid={variantKey} key={index}>{variantKey}</p>;break;\n }\n })())\n \n }\n </div>\n \n \n }\n \n \n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n }else{\n return null;\n }\n \n \n }", "render() {\n return (\n <div className=\"bg-dark\">\n <div>\n {/* <h1 className=\"display-4 text-center\"> {title} </h1> */}\n <p className=\"text-white\">Chosen Product:</p>\n {/* <img src={} /> */}\n <Header></Header>\n <Carousel></Carousel>\n <SmartPhone _getProductName={this._getProductName}></SmartPhone>\n <Laptop></Laptop>\n <Promotion></Promotion>\n </div>\n </div>\n );\n }", "render() {\n image(this.image, this.x, this.y, this.width, this.height);\n }", "render () {\r\n\t\tconst { description, urls } = this.props.image;\r\n\r\n\t\treturn (\r\n\t\t\t<div style={{ gridRowEnd: `span ${this.state.spans}` }}>\r\n\t\t\t\t<img \r\n\t\t\t\t\tref={this.imageRef}\r\n\t\t\t\t\talt={description}\r\n\t\t\t\t\tsrc={urls.regular}\r\n\t\t\t\t/>\r\n\t\t\t</div>\r\n\t\t);\r\n\t}", "function renderProductPage (productId) {\n if (!productId) {\n return false;\n }\n\n return client.entries({\n content_type: ContentTypes.Product,\n 'sys.id': productId\n }).then(function (products) {\n var product = products[0];\n if (!product) {\n return false;\n }\n product.allImages = [product.fields.mainImage, product.fields.hoverImage].concat(product.fields.images).filter(Boolean);\n return Templates.ProductPage(product);\n });\n }", "function render(){\n leftEl.src = Product.allProducts[randomLeft].filepath; //current\n leftEl.alt = Product.allProducts[randomLeft].name;\n\n centerEl.src = Product.allProducts[randomCenter].filepath;\n centerEl.alt = Product.allProducts[randomCenter].name;\n\n rightEl.src = Product.allProducts[randomRight].filepath;\n rightEl.alt = Product.allProducts[randomRight].name;\n\n //increment the number of times each image was shown\n Product.allProducts[randomLeft].timesDisplayed += 1;\n Product.allProducts[randomCenter].timesDisplayed += 1;\n Product.allProducts[randomRight].timesDisplayed += 1;\n\n //keep track of these as the previously displayed products\n Product.lastDisplayed[0] = randomLeft;\n Product.lastDisplayed[1] = randomCenter;\n Product.lastDisplayed[2] = randomRight;\n}", "function renderProducts(productsArray) {\n\tproductsArray.forEach((product) => {\n\n\t\tconst newProduct = document.createElement(\"div\");\n\t\tnewProduct.classList.add(\"productsContainer\");\n\t\t\n\t\tconst link = getProductLink(product);\n\n\t\tconst img = getProductImg(product);\n\n\t\tconst description = getProductDescription(product);\n\n\t\tlink.appendChild(img);\n\t\tlink.appendChild(description);\n newProduct.appendChild(link);\n\t\t\n\t\t\n\t document.getElementById('productsMainContainer').appendChild(newProduct);\n\t});\n}", "function renderProduct(product) {\n var images = document.getElementById('images');\n var imgEl = document.createElement('img');\n\n var att = document.createAttribute('id');\n att.value = product.name;\n imgEl.setAttributeNode(att); // W3Schools\n\n imgEl.src = product.filepath;\n images.appendChild(imgEl);\n\n imgEl.addEventListener('click', clickEvent);\n}", "render() {\n if (!this.props.product) {\n return <div>Select a product to view profile.</div>;\n }\n\n return (\n <div>\n\n <Header as=\"h4\">Product details</Header>\n {/* Field name */}\n <Grid columns='equal'>\n <Grid.Column>\n <label>Name :</label> \n </Grid.Column>\n <Grid.Column width={12}>\n <b>{this.props.product.name}</b>\n </Grid.Column>\n </Grid>\n\n {/* Field color */}\n <Grid columns='equal'>\n <Grid.Column>\n <label>Color</label> :\n </Grid.Column>\n <Grid.Column width={12}>\n <b>{this.props.product.color}</b>\n </Grid.Column>\n </Grid> \n \n {/* Field price */}\n <Grid columns='equal'>\n <Grid.Column>\n <label>Price</label> :\n </Grid.Column>\n <Grid.Column width={12}>\n <b>{this.props.product.price}</b>\n </Grid.Column>\n </Grid>\n\n {/* Field category */}\n <Grid columns='equal'>\n <Grid.Column>\n <label>Category</label> :\n </Grid.Column>\n <Grid.Column width={12}>\n <b>{this.props.product.category}</b>\n </Grid.Column>\n </Grid> \n\n {/* Field Image field */}\n <Grid columns='equal'>\n <Grid.Column>\n <label>Product image</label> :\n </Grid.Column>\n <Grid.Column width={12}>\n <div className=\"selected-image selected-image__custom\">\n <Image src={this.props.product.image_base64} size=\"small\" />\n </div>\n </Grid.Column>\n </Grid>\n {/* Field description */}\n <Grid columns='equal'>\n <Grid.Column>\n <label>Description</label> :\n </Grid.Column>\n <Grid.Column width={12}>\n <p>{this.props.product.description}</p>\n </Grid.Column>\n </Grid>\n\n </div>\n );\n }", "function Products(props) {\n return (\n <div class=\"container\">\n <div className=\"card mb-3\">\n <div className=\"row no-gutters\">\n <div className=\"col-md-8\">\n <div className=\"card-header\">{ props.brand }</div>\n <div className=\"card-body\">\n <h6 className=\"card-title\">{props.category}: { props.productName }</h6>\n <h6 className=\"card-text\">Ingredients: \n {props.ingredients}\n </h6>\n <h6 className=\"card-text\">{props.description}</h6>\n </div>\n </div>\n <div className=\"col-md-4\">\n <img src={require(`../../images/HairImages/${props.image}`)} className=\"imageProduct\" alt='placeholder'></img>\n </div>\n </div>\n </div>\n </div>\n );\n}", "function ProductManagementImage(_ref) {\n var size = _ref.size;\n\n var widths = {\n 1: 300,\n 2: 200,\n 3: 150\n };\n return _react2.default.createElement(_Image2.default, { src: _catalogue_image2.default, width: '100%' });\n}", "function Product(props) {\n return (\n <div className='product-container'>\n <ul>\n <li>\n <img\n src={props.product.imgUrl}\n alt={props.product.imgAlt}\n className='product-img'\n />\n <h3>{props.product.name}</h3>\n <p>Price: {props.product.price}</p>\n <p>Product description: {props.product.productDescription}</p>\n </li>\n </ul>\n </div>\n )\n}", "render() {\n\t\treturn (\n\t\t\t<img \n\t\t\t\tsrc={ this.props.src } \n\t\t\t\talt={ this.props.title }\n\t\t\t\tclassName={ styles.image }\n\t\t\t/>\n\t\t);\n\t}", "function renderProducts(productName, productId, productImg, productPrice) {\r\n const products = document.getElementById('cameras');\r\n const article = document.createElement('article'); // Récupère la div qui contiendra les différents articles\r\n article.classList.add('product-general');\r\n article.innerHTML = `\r\n <img alt=\"${productName}\" src=\"${productImg}\">\r\n <div class=\"product-list\"><p class=\"product-name\">${productName}</p> \r\n <p class=\"product-price\">${productPrice / 100}€</p>\r\n <a href=\"/HTML/product.html?id=${productId}\" class=\"find-out-more\">Développez-moi</a></div>\r\n `;\r\n\r\n products.append(article);\r\n}", "render() {\n\t\tconst product = this.props.product;\n\n\t\treturn (\n\t\t\t<div className=\"wc-products-list-card__content\">\n\t\t\t\t<img src={ product.images[0].src } />\n\t\t\t\t<span className=\"wc-products-list-card__content-item-name\">{ this.state.clicked ? __( 'Added' ) : product.name }</span>\n\t\t\t\t<button type=\"button\"\n\t\t\t\t\tclassName=\"button-link\"\n\t\t\t\t\tid={ 'product-' + product.id }\n\t\t\t\t\tonClick={ this.handleClick } >\n\t\t\t\t\t\t{ __( 'Add' ) }\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t);\n\t}", "render(listProducts) {\n for (const product of listProducts) {\n const divProduct = document.createElement('div');\n divProduct.classList.add('product');\n divProduct.setAttribute('id', product.id);\n\n const image = document.createElement('img');\n image.classList.add('product-image');\n image.src = product.image;\n image.setAttribute('alt', product.name);\n divProduct.append(image);\n\n const title = document.createElement('span');\n title.classList.add('product-title');\n title.innerText = product.name;\n divProduct.append(title);\n\n const price = document.createElement('span');\n price.classList.add('product-price');\n price.innerText = `$ ${product.price}`;\n divProduct.append(price);\n\n this.containerProducts.append(divProduct);\n }\n }", "function ibpsRenderProduct(index) {\n\t// Check to make our index is within actual data range\n\tif ((index < 0) || (index > (_ibpsProductCount - 1))) {\n\t\talert (\"Invalid product index: ibpsRenderProduct(\" + index + \")\");\n\t}\n\t\n\t// Get the values needed to display\n\tvar productImage = _ibpsData[index].image1;\n\tvar productName = _ibpsData[index].name;\n\tvar productURL = _ibpsData[index].product_url;\n\tvar companyName = _ibpsData[index].company_name;\n\t\n\t// Erase current product\n\t$('div.ibps-product').empty();\n\t\n\t// Convert data to HTML and display it in the product div\n\t$('div.ibps-product').append(\n\t\t' <a class=\"ibps-product-link\" href=\"' + productURL + '\" target=\"_blank\">' +\n\t\t' <img style=\"display:block;margin:auto;\" class=\"ibps-product-image\" src=\"' + productImage + '\" width=\"288\" height=\"216\" />' +\n\t\t' </a>' +\n\t\t' <a href=' + productURL + ' class=\"ibps-product-name\" target=\"_blank\" >' + productName + '</a><br>' + \n\t\t' <a href=' + productURL + ' class=\"ibps-company-name\" target=\"_blank\" >' + companyName + '</a>'\n\t);\n}", "render() {\n\t\tconst product = this.props.product;\n\t\t//let icon = this.props.selected ? <Dashicon icon=\"yes\" /> : null;\n//\t{ icon }\n\t\treturn (\n\t\t\t<div className={ 'wc-products-list-card__content' + ( this.props.selected ? ' wc-products-list-card__content--added' : '' ) } onClick={ this.handleClick }>\n\t\t\t\t<img src={ product.images[0].src } />\n\t\t\t\t<span className=\"wc-products-list-card__content-item-name\">{ product.name }</span>\n\t\t\t</div>\n\t\t);\n\t}", "function Home() {\n return (\n <div className=\"home\">\n {/**Image */}\n <img className=\"home__image\" src={cover} alt=\"Cover banner\" />\n {/**Products */}\n <div className=\"home__row\">\n <Product\n id=\"1235434\"\n title=\"Nike Piscart Shoes\"\n price={122}\n img={nike}\n rating={3} />\n <Product\n id=\"456333322\"\n title=\"Nike Buffer Shoes\"\n price={321}\n img={nikeshoe}\n rating={2} />\n </div>\n </div>\n\n )\n}", "render() {\n return (\n <div className=\"box box-white box-product m-b-20\">\n <Link to={\"single/\" + this.props.id + \"/\" + this.props.last} >\n <Image src={this.props.image} responsive className=\"image-product\" title={this.props.title}/>\n <div className=\"price-product p-10\">{this.props.price}</div>\n </Link>\n </div>\n )\n }", "render () {\n ctx.drawImage(Resources.get(this.image), this.x, this.y);\n }", "function Product(props){\r\n\r\n return (\r\n <div>\r\n <div className=\"col-xs-4 col-sm-4 col-md-4 col-lg-4\">\r\n \t<div className=\"thumbnail\">\r\n \t\t<img alt=\"\" src={props.image}/>\r\n \t\t<div className=\"caption\">\r\n \t\t\t<h3>\r\n\t\t\t\t{props.children}\r\n\r\n \t\t\t</h3>\r\n \t\t\t<p>\r\n \t\t\t\t{props.price} VNĐ\r\n \t\t\t</p>\r\n \t\t\t<p>\r\n \t\t\t\t<a className=\"btn btn-primary\">Action</a>\r\n \t\t\t\t<a className=\"btn btn-default\">Action</a>\r\n \t\t\t</p>\r\n \t\t</div>\r\n \t</div>\r\n </div>\r\n </div>\r\n );\r\n}", "render() {\n return (\n <div class=\"card\">\n <div class=\"card-image\">\n <figure class=\"image is-4by3\">\n <img src={this.props.product.image} alt=\"Placeholder image\"></img>\n </figure>\n </div>\n <div class=\"card-content\">\n <p class=\"title product-title\">{this.props.product.name}</p>\n\n <div class=\"content\">\n {this.props.product.short_description}\n <br></br>\n </div>\n <a class=\"button is-primary\" href={\"product.html?id=\" + this.props.product.id.toString()} target=\"_blank\">\n <strong>More Details</strong>\n </a>\n </div>\n </div>\n )\n }", "render() {\n let { url, selectColor, selected, mouseEnter, mouseOut } = this.props;\n return (\n <React.Fragment>\n <div className={selected ? styles.selectedcolorDiv : styles.colorDiv} onClick={selectColor}>\n {/* <p style={{ borderRadius: shapeColor === 'circle' ? '20px' : '3px', backgroundColor: colorHex, width: width,\n height: height, cursor: 'pointer' }} onClick={selectColor}>{addCross ? <img className={styles.crossMark} src={require('../../images/PD/fill-1.svg')} alt=\"Cross\" /> : null }</p> */}\n {/* <img src={url} alt=\"glases\" width=\"40\" height=\"20\"/> */}\n <img key={product._id} alt=\"glasses\"\n src={url}\n width=\"40\" height=\"20\"\n onMouseEnter={mouseEnter}\n onMouseOut={mouseOut}\n />\n </div>\n </React.Fragment>\n\n\n );\n }", "display() {\n push();\n // Centering image for easier image placement\n imageMode(CENTER);\n image(this.image, this.x, this.y, 1500, 300);\n pop();\n }", "function displayImage() {\n let image = document.createElement('img');\n image.setAttribute(\"src\", product.imageUrl);\n image.setAttribute(\"alt\", product.name);\n image.classList.add(\"img-thumbnail\",\"border-dark\");\n imageContainer.appendChild(image);\n}", "render() {\n return(\n <div className=\"container\">\n <div className=\"row\">\n <div className=\"col-lg\">\n <h3>All Products</h3>\n </div> \n </div>\n <div className=\"row\">\n <div className=\"col-lg card mb-3 border-secondary\">\n <ul className=\"card-body\">\n { this.renderProducts() }\n </ul>\n </div>\n <div className=\"col-lg\">\n <Product product={ this.state.currentProduct } editform={this.state.currentProductUpdateForm} onDelete={this.handleDeleteProduct} onUpdate={this.handleUpdateProduct} onEdit={this.handleEditProduct} onInputChange={this.handleChangeInputs} />\n <br />\n <AddProduct onAdd={this.handleAddProduct} />\n </div> \n </div>\n </div>\n );\n }", "render() {\n ctx.drawImage(Resources.get(this.image), this.x, this.y);\n }", "function renderImages() {\n //if ( viewSkins ) { renderSkins(); } // disabled here so plants can be rendered sequentially in plants.js\n if ( viewSpans ) { renderSpans(); }\n if ( viewPoints ) { renderPoints(); }\n if ( viewScaffolding ) { renderScaffolding(); }\n}", "function buildMyProduct(myProduct) {\n var html = \"\";\n html += \"<div class='row'>\";\n html += \"<div><h3 style='padding-left:20px;'>\" + myProduct.title + \"</h3></div>\";\n html += \"<div class='col-md-3 thumbnail'style='width:250px; height:180px;'><img style='width:250px; height:170px;' src='\" + myProduct.MainImage + \"' /></div>\";\n html += \"<div class='col-md-3 container'><div>\" + myProduct.price +\"<div>\"+ myProduct.model +\"</div>\"+ \"</div>\"+\"<div>\"+myProduct.description + \"</div></div>\";\n html += \"</div>\";\n html += \"<div class='row' id='Similares' style='padding-left:6px;'>\";\n $.each(myProduct.ProductImage, function (element, obj) {\n html += \"<img class='col-md-3 thumbnail' style='width:80px; height:80px;' src='\" + obj.imgUrl + \"'/>\";\n });\n html += \"</div>\";\n\n\n\n $(\"#MyDynamicProductDetail\").append(html);\n}", "function logoLayout() {\n layout('logo');\n next();\n}", "render() {\n const productData = this.props.productData;\n // const productInfo = productData['prod_serial'];\n const imageData = productData['image_data'];\n const prod_hash = imageData.prod_id;\n const key = prod_hash + Math.floor(Math.random() * 1000);\n const shop = imageData.shop;\n const brand = imageData.brand;\n const img_url = imageData.img_url;\n const name = imageData.name;\n const prod_url = imageData.prod_url;\n const currency = '£';\n const price = imageData.price.toFixed(2);\n const sale = imageData.sale;\n const saleprice = imageData.saleprice;\n const fst_img_hash = imageData.img_hash;\n const fst_img_color = imageData.color_1;\n\n const ImageCarousel = () => {\n return (\n <div\n style={{\n width: '100%'\n }}\n >\n <Route render={({history}) => (\n <div\n style={{\n width: '100%',\n paddingBottom: '130%',\n position: 'relative',\n overflowY: 'hidden'\n }}\n >\n <img\n className=\"product-image\"\n src={this.updateImgProtocol(img_url)}\n style={{\n cursor: 'pointer',\n backgroundColor: '#e9dcc9',\n position: 'absolute',\n top: '0',\n left: '0',\n width: '100%',\n height: 'auto'\n }}\n onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'open outfit',\n label: prod_hash\n });\n history.push(`/outfit-page?id=${prod_hash}&sex=${imageData.sex}`)\n }}\n />\n </div>\n )}/>\n </div>\n )\n };\n\n const ColorPicker = () => {\n let image = imageData;\n let color_1 = image['color_1'];\n let color_2 = image['color_2'];\n let color_3 = image['color_3'];\n let color_1_hex = image['color_1_hex'];\n let color_2_hex = image['color_2_hex'];\n let color_3_hex = image['color_3_hex'];\n let img_hash = image['img_hash'];\n\n // Dynamic CSS for image color choice modal\n if(color_1_hex.length > 0){\n var colorStyle1 = {\n width: '42px',\n height: '42px',\n borderRadius: '21px',\n backgroundColor: color_1_hex,\n margin: '2px',\n marginRight: '0px',\n display: 'inline-block',\n cursor: 'pointer'\n };\n var colorStyle2 = {\n width: '42px',\n height: '42px',\n borderRadius: '21px',\n backgroundColor: color_2_hex,\n margin: '2px',\n marginRight: '0px',\n display: 'inline-block',\n cursor: 'pointer'\n };\n var colorStyle3 = {\n width: '42px',\n height: '42px',\n borderRadius: '21px',\n backgroundColor: color_3_hex,\n margin: '2px',\n marginRight: '0px',\n display: 'inline-block',\n cursor: 'pointer'\n };\n }\n let rgbSum = eval(image['color_1'].join('+'));\n var pickerBgUrl;\n\n if (rgbSum > 400) {\n pickerBgUrl = 'url(\"data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzIwMCcgIGZpbGw9IiMw'\n + 'MDAwMDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3Jn'\n + 'LzE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCAxMDAgMTAwIiBzdHlsZT0i'\n + 'ZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxMDAgMTAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTk0Ljks'\n + 'MTcuNmMtMC44LTUuNy00LTguNi02LjYtMTAuNWMtMi45LTIuMS02LjYtMi42LTkuOS0xLjNjLTMuNSwxLjMtNiwzLjktOC42L'\n + 'DYuNWMtMywzLjItNi4yLDYuMi05LjMsOS4zICBjLTMuMS0yLTQuOC0xLjgtNy4zLDAuNmMtMS41LDEuNS0zLDIuOS00LjQsN'\n + 'C40Yy0xLjUsMS42LTEuNyw0LjItMC4yLDUuOGMwLjcsMC44LDEuNywxLjMsMi43LDJjLTEuMSwwLjktMS42LDEuMy0yLDEuN'\n + 'yAgQzM4LDQ3LjQsMjYuNiw1OC44LDE1LjIsNzAuMWMtMi42LDIuNi00LjcsNS40LTUuNyw5LjFjLTAuNSwyLTEuNywzLjktM'\n + 'i44LDUuNmMtMC4yLDAuMy0wLjQsMC41LTAuNiwwLjhjLTEuNywyLjMtMS42LDUuNCwwLjQsNy40ICBjMC4xLDAuMSwwLjIsM'\n + 'C4yLDAuMiwwLjJjMiwyLDUsMi4xLDcuMywwLjVjMCwwLDAsMCwwLjEsMGMxLjctMS4yLDMuMy0yLjgsNS4yLTMuMWM0LjItM'\n + 'C45LDcuNS0zLDEwLjQtNkM0MS4zLDczLjQsNTIuNiw2Miw2NCw1MC43ICBjMC41LTAuNSwxLTAuOSwxLjgtMS43YzAuNSwwL'\n + 'jcsMC44LDEuMywxLjMsMS44YzIuMiwyLjMsNC42LDIuMiw2LjksMGMxLjItMS4yLDIuNC0yLjQsMy42LTMuNmMyLjktMi45L'\n + 'DMuNy00LjMsMS4xLTcuOCAgYzIuNC0yLjQsNC44LTQuNyw3LjItNy4xYzMuMy0zLjQsNy4yLTYuMyw4LjctMTEuMUM5NSwyM'\n + 'Cw5NS4xLDE4LjgsOTQuOSwxNy42eiBNNjEuNiw0Ny4yQzQ5LjksNTguOSwzOC4yLDcwLjYsMjYuNSw4Mi4yICBjLTIuMiwyL'\n + 'jItNC43LDMuNi03LjcsNC40Yy0yLjMsMC42LTQuMywyLjItNi40LDMuM2MtMC4yLDAuMS0wLjQsMC4zLTAuNiwwLjRjLTAuN'\n + 'iwwLjUtMS41LDAuNC0yLTAuMWMwLDAsMCwwLDAsMCAgYy0wLjUtMC42LTAuNi0xLjQtMC4xLTJjMC43LTAuOSwxLjQtMS44L'\n + 'DItMi43YzAuOC0xLjMsMS41LTIuOCwxLjgtNC4zYzAuNi0yLjksMS45LTUuMywzLjktNy4zYzEyLjEtMTIuMSwyNC4yLTI0L'\n + 'jIsMzYuMS0zNi4xICBjMi45LDIuOCw1LjcsNS43LDguNyw4LjdDNjIuMiw0Ni41LDYxLjksNDYuOSw2MS42LDQ3LjJ6Ij48L'\n + '3BhdGg+PC9zdmc+\")';\n } else {\n pickerBgUrl = 'url(\"data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzIwMCcgIGZpbGw9IiNmZ'\n + 'mZmZmYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnL'\n + 'zE5OTkveGxpbmsiIHZlcnNpb249IjEuMSIgeD0iMHB4IiB5PSIwcHgiIHZpZXdCb3g9IjAgMCAxMDAgMTAwIiBzdHlsZT0iZ'\n + 'W5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxMDAgMTAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHBhdGggZD0iTTk0LjksM'\n + 'TcuNmMtMC44LTUuNy00LTguNi02LjYtMTAuNWMtMi45LTIuMS02LjYtMi42LTkuOS0xLjNjLTMuNSwxLjMtNiwzLjktOC42L'\n + 'DYuNWMtMywzLjItNi4yLDYuMi05LjMsOS4zICBjLTMuMS0yLTQuOC0xLjgtNy4zLDAuNmMtMS41LDEuNS0zLDIuOS00LjQsN'\n + 'C40Yy0xLjUsMS42LTEuNyw0LjItMC4yLDUuOGMwLjcsMC44LDEuNywxLjMsMi43LDJjLTEuMSwwLjktMS42LDEuMy0yLDEuN'\n + 'yAgQzM4LDQ3LjQsMjYuNiw1OC44LDE1LjIsNzAuMWMtMi42LDIuNi00LjcsNS40LTUuNyw5LjFjLTAuNSwyLTEuNywzLjktM'\n + 'i44LDUuNmMtMC4yLDAuMy0wLjQsMC41LTAuNiwwLjhjLTEuNywyLjMtMS42LDUuNCwwLjQsNy40ICBjMC4xLDAuMSwwLjIsM'\n + 'C4yLDAuMiwwLjJjMiwyLDUsMi4xLDcuMywwLjVjMCwwLDAsMCwwLjEsMGMxLjctMS4yLDMuMy0yLjgsNS4yLTMuMWM0LjItM'\n + 'C45LDcuNS0zLDEwLjQtNkM0MS4zLDczLjQsNTIuNiw2Miw2NCw1MC43ICBjMC41LTAuNSwxLTAuOSwxLjgtMS43YzAuNSwwL'\n + 'jcsMC44LDEuMywxLjMsMS44YzIuMiwyLjMsNC42LDIuMiw2LjksMGMxLjItMS4yLDIuNC0yLjQsMy42LTMuNmMyLjktMi45L'\n + 'DMuNy00LjMsMS4xLTcuOCAgYzIuNC0yLjQsNC44LTQuNyw3LjItNy4xYzMuMy0zLjQsNy4yLTYuMyw4LjctMTEuMUM5NSwyM'\n + 'Cw5NS4xLDE4LjgsOTQuOSwxNy42eiBNNjEuNiw0Ny4yQzQ5LjksNTguOSwzOC4yLDcwLjYsMjYuNSw4Mi4yICBjLTIuMiwyL'\n + 'jItNC43LDMuNi03LjcsNC40Yy0yLjMsMC42LTQuMywyLjItNi40LDMuM2MtMC4yLDAuMS0wLjQsMC4zLTAuNiwwLjRjLTAuN'\n + 'iwwLjUtMS41LDAuNC0yLTAuMWMwLDAsMCwwLDAsMCAgYy0wLjUtMC42LTAuNi0xLjQtMC4xLTJjMC43LTAuOSwxLjQtMS44L'\n + 'DItMi43YzAuOC0xLjMsMS41LTIuOCwxLjgtNC4zYzAuNi0yLjksMS45LTUuMywzLjktNy4zYzEyLjEtMTIuMSwyNC4yLTI0L'\n + 'jIsMzYuMS0zNi4xICBjMi45LDIuOCw1LjcsNS43LDguNyw4LjdDNjIuMiw0Ni41LDYxLjksNDYuOSw2MS42LDQ3LjJ6Ij48L'\n + '3BhdGg+PC9zdmc+\")';\n }\n\n let pickerStyle = {\n width: '46px',\n height: '46px',\n backgroundColor: color_1_hex,\n backgroundImage: pickerBgUrl,\n backgroundRepeat: 'no-repeat',\n backgroundPosition: 'center',\n backgroundSize: '28px 28px',\n borderRadius: '23px',\n position: 'absolute',\n right: '113px',\n cursor: 'pointer'\n };\n\n var pickerDrawerHeight;\n\n if (this.state.pickerExpanded === img_hash){\n pickerDrawerHeight = '190px';\n } else {\n pickerDrawerHeight = '44px';\n }\n\n let pickerDrawerStyle = {\n width: '46px',\n transition: 'width 300ms ease-in-out',\n height: pickerDrawerHeight,\n borderRadius: '23px',\n backgroundColor: '#FFFFFF',\n bottom: '5px',\n right: '113px',\n position: 'absolute',\n textAlign: 'left',\n overflow: 'hidden'\n };\n\n return (\n <div>\n <div style={pickerDrawerStyle}>\n <div\n style={colorStyle1}\n onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'search similar color',\n label: `img_hash: ${img_hash}, color: ${color_1}`\n });\n this.setColorPosTags({'color_rgb': color_1, 'cat':''});\n this.searchSimilarImages(img_hash, color_1);\n }} />\n <div\n style={colorStyle2}\n onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'search similar color',\n label: `img_hash: ${img_hash}, color: ${color_2}`\n });\n this.setColorPosTags({'color_rgb': color_2, 'cat':''});\n this.searchSimilarImages(img_hash, color_2);\n }} />\n <div\n style={colorStyle3}\n onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'search similar color',\n label: `img_hash: ${img_hash}, color: ${color_3}`\n });\n this.setColorPosTags({'color_rgb': color_3, 'cat':''});\n this.searchSimilarImages(img_hash, color_3);\n }} />\n </div>\n <Tooltip title=\"Search By Color\">\n <div\n style={pickerStyle}\n onClick={() => {this.expandDrawer(img_hash, this.state.pickerExpanded);}}\n />\n </Tooltip>\n </div>\n )\n };\n\n const ExploreOptions = () => {\n let exploreOptsStyle = {\n position: this.state.device === 'desktop' ? 'absolute' : 'fixed',\n height: '55px',\n width: '215px',\n zIndex: '10',\n backgroundColor: this.state.device === 'mobile' ? '#FFFFFF' : 'rgba(255,255,255,0.7)',\n paddingTop: '5px'\n };\n if (this.state.device === 'desktop') {\n exploreOptsStyle['bottom'] = '0';\n exploreOptsStyle['right'] = '0';\n exploreOptsStyle['borderRadius'] = '27px 0px 0px 0px';\n } else {\n const bottom = document.getElementById(prod_hash).getBoundingClientRect().bottom;\n exploreOptsStyle['top'] = `${bottom - 35}px`;\n exploreOptsStyle['left'] = 'calc((100vw - 215px) / 2)';\n exploreOptsStyle['boxShadow'] = '0px 0px 5px 0 rgba(0, 0, 0, 0.6)';\n exploreOptsStyle['borderRadius'] = '27px';\n }\n\n return (\n <div\n style={exploreOptsStyle}\n >\n\n <Tooltip title=\"Search Similar Items\" >\n <div\n className=\"search-similar-mobile\"\n onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'search similar',\n label: fst_img_hash\n });\n this.setColorPosTags({'color_rgb': fst_img_color, 'cat':''});\n this.searchSimilarImages(fst_img_hash, fst_img_color);\n }}\n />\n </Tooltip>\n <Tooltip title=\"Search By Color\" >\n <ColorPicker />\n </Tooltip>\n {/*<TagPicker/>*/}\n {(this.state.isAuth === \"true\") ? (\n <Tooltip title=\"Add To Favorites\" >\n <div className=\"add-to-favorites-mobile\" onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'add outfit',\n label: fst_img_hash\n });\n this.props.showLookList(fst_img_hash);\n }} />\n </Tooltip>\n ) : (\n <Route render={({history}) => (\n <Tooltip title=\"Add To Favorites\" >\n <div\n className=\"add-to-favorites-mobile\"\n onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'add outfit',\n label: fst_img_hash\n });\n history.push(`/register-from-result?id=${fst_img_hash}`);\n }}\n />\n </Tooltip>\n )}/>\n )}\n <Tooltip title=\"Buy Now\" >\n <div className=\"buy-now-mobile\" onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'buy now',\n label: prod_url\n });\n this.buyNow(prod_url);\n }}/>\n </Tooltip>\n </div>\n )\n };\n\n const CardTagList = () => {\n const prodTagList = imageData['all_cats'].filter(this.getUniqueArr).map(cat => {\n return (\n <div\n className=\"results-card-cat-tag\"\n key={cat}\n onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'set tag',\n label: cat\n });\n this.props.setPosNegButtonTag(cat);\n }}\n >\n {cat}\n </div>\n )\n });\n return (\n <div\n style={{\n position: 'relative',\n top: '0',\n marginBottom: '5px',\n textAlign: 'left',\n overflow: 'hidden',\n height: '19px'\n }}\n >\n <div\n className=\"results-card-brand-tag\"\n onClick={() => {\n ReactGA.event({\n category: \"Result Card Action\",\n action: 'set brand',\n label: brand\n });\n this.props.addBrandFilter(brand, false);\n }}\n >\n {brand}\n </div>\n {prodTagList}\n </div>\n\n )\n };\n\n const priceStyle = sale ? {\n textDecoration: 'line-through',\n fontWeight: 'bold',\n display: 'inline-block'\n } : {\n textDecoration: 'none',\n fontWeight: 'bold',\n };\n\n return (\n <div\n key={key}\n style={{\n textAlign: 'center',\n margin: this.state.device === 'mobile' ? '3px' : '6px',\n width: '46vw',\n maxWidth: '350px',\n paddingBottom: '2px',\n display: 'inline-block',\n position: 'relative',\n verticalAlign: 'top',\n fontSize: '0.9rem'\n }}\n className=\"result-product-tile\"\n >\n <div\n style={{\n display: 'inline-block',\n position: 'relative',\n width: '100%'\n }}\n >\n <ImageCarousel />\n {(this.state.showExplore || this.state.device === 'desktop') && (\n <ExploreOptions />\n )}\n {this.state.device === 'mobile' && (\n <Tooltip title=\"Explore Options\" >\n <div\n className=\"explore-options\"\n id={prod_hash}\n onClick={() => {\n this.setState({\n showExplore: true\n })\n }}\n />\n </Tooltip>\n )}\n </div>\n {this.state.showTagList && (\n <CardTagList />\n )}\n\n <div\n style={{\n height: '90px',\n position: 'relative'\n }}\n >\n <div\n style={{\n margin: '0',\n position: 'absolute',\n top: '50%',\n transform: 'translateY(-50%)',\n width: '100%',\n textAlign: 'center'\n }}\n >\n <div\n className=\"product-name\"\n style={{\n marginRight: '1px',\n marginLeft: '1px',\n fontSize: '0.8rem',\n lineHeight: '1'\n }}\n >\n <b\n style={{\n fontWeight: 'normal',\n fontSize: '1.1rem'\n }}\n >\n {brand}\n </b>\n <p\n style={{\n marginBottom: '1px',\n marginTop: '5px'\n }}\n >{name}</p>\n </div>\n <div style={priceStyle}>\n £{price}\n </div>\n {(sale) && (\n <div style={{\n color: '#d6181e',\n display: 'inline-block',\n marginLeft: '5px',\n fontWeight: 'bold'\n }}>\n £{saleprice}\n </div>\n )}\n </div>\n </div>\n </div>\n )\n }", "render() {\n image(this.g, 0, 0, this.w, this.h);\n }", "render() {\n const imgURL = this.props.item.img;\n return (\n <div className=\"container d-flex justify-content-center\">\n <div className=\"imagePreview\" id=\"imagePreview\">\n <label>{this.props.item.id.slice(0, -1)}</label>\n <div\n style={{\n backgroundImage:\n \"url(\" + `${process.env.PUBLIC_URL}` + imgURL + \")\"\n }}\n className=\"imageContainer\"\n id=\"imageContainer\"\n >\n {this.state.hasDescription ? (\n <button\n className=\"imageButton\"\n onMouseOver={() => this.buildDescriptionSpan()}\n onMouseOut={() => this.removeDescriptionSpan()}\n >\n !\n </button>\n ) : null}\n <div className=\"imageDescription\" id=\"imageDescription\"></div>\n </div>\n </div>\n <table className=\"table table-borderless\">\n {this.buildTableHeaders()}\n <tbody>\n <React.Fragment>\n <Item\n key={this.props.item.id}\n id={this.props.item.id}\n item={this.props.item}\n handleRowChange={this.props.handleRowChange}\n />\n <TotalsRow\n totals={this.props.grandTotals}\n id={this.props.item.id}\n price={this.props.item.price}\n note={this.props.item.note}\n handleMoreChange={this.props.handleMoreChange}\n />\n </React.Fragment>\n </tbody>\n </table>\n </div>\n );\n }", "function render(id, title, imgUrl, height, width, prev, next) {\n var imgContainer = \"<div id='\" + id + \"' class='thumb col-md-3' data-title='\" + title + \"' data-previous='\" + prev + \"' data-next='\"+ next + \"' style='background-repeat: no-repeat; position: relative; max-width:\" + width + \"px; width: 100%; height:\" + height + \"px;'><img src='\" + imgUrl + \"'/></div>\";\n document.getElementById(\"container\").innerHTML += imgContainer;\n }", "renderImage() {\n\n const imageContainer = document.getElementById(\"image-container\")\n const div = document.createElement('div')\n div.className = 'container-fluid'\n imageContainer.append(div)\n const img = document.createElement('img')\n img.setAttribute('id', 'img')\n img.className = 'img-fluid'\n img.src = `${this.url}`\n\n const p1 = document.createElement('p1')\n p1.setAttribute('id', 'p1')\n\n p1.innerText = `${this.caption}`\n div.append(img, p1)\n\n }", "render(){\n return(\n <div>\n <img src={this.props.imagen} className={this.props.clases} alt=\"\" height={this.props.height} width={this.props.width}/>\n </div>\n )\n }", "renderList() { \n \n return this.props.products.map(product => { \n \n return (\n <div className=\"item\" key = {product.id}> \n<div className=\"image\"><img src={product.product_image} /> </div> \n<div className=\"header\" >{product.product_name}</div>\n<div className=\"description\">{product.description}</div>\n <div className=\"price\">{product.price}</div>\n\n<div className=\"content\" >\n\n </div> \n \n </div>\n )\n\n }); \n \n }", "render() {\n ctx.drawImage(Resources.get(this.image), this.x, this.y)\n }", "function Render(image) {\n selectedImage = image;\n //setup canvas for paper API\n setupPaperCanvas();\n //setup and fill image\n setupPaperImage();\n //setup and fill texts\n setupPaperTexts();\n}", "function Product(props){\n return(\n <div className=\"card-drink\">\n <img src={props.image}/>\n\t <div>{props.name}<br></br>{props.amount}</div>\n </div>\n );\n}", "render() {\n return (\n <section className='col-4 border-right d-flex align-items-center'>\n \n <AddProductUI\n title={this.state.product.title}\n desc={this.state.product.desc}\n img={this.state.product.img}\n errorTitle={this.state.error.title}\n errorImg={this.state.error.img}\n errorDesc={this.state.error.desc}\n onChangeInput={this.onChangeInput}\n onAddProduct={this.onAddProduct}\n />\n \n </section>\n );\n }", "display() {\n if (this.isDrank === false) {\n //Display\n image(this.image, this.x, this.y, this.size, this.size);\n }\n }", "render() {\n\t\treturn (\n\t\t\t<div key={this.props.id} className=\"col-md-4 col-xs-4\">\n\t\t\t\t<Thumbnail src={this.props.image}/>\n\t\t\t\t<OverlayTrigger trigger=\"click\" rootClose placement=\"bottom\" overlay={\n\t\t\t\t\t<Popover>\n\t\t\t\t\t<dt>Name</dt>\n\t\t\t\t\t<dd>{this.props.name}</dd>\n\t\t\t\t\t<dt>Brand</dt>\n\t\t\t\t\t<dd>{this.props.brand}</dd>\n\t\t\t\t\t<dt>Category</dt>\n\t\t\t\t\t<dd>{this.props.category}</dd>\n\t\t\t\t\t<dt>Price</dt>\n\t\t\t\t\t<dd>{this.props.price}</dd>\n\t\t\t\t\t</Popover>}>\n\t\t\t\t\t<Button bsStyle=\"primary\">Product Info</Button>\n\t\t\t\t</OverlayTrigger>\n\t\t\t\t<a href={this.props.url} target=\"_blank\" rel=\"nofollow\" className=\"pull-right btn btn-info\">Product Link</a>\n\t\t\t</div>\n\t\t);\n\t}", "render() {\n const { name, price, image_url, id } = this.props.data;\n return (\n <Card className=\"Product\">\n <CardImg top width=\"100%\" src={image_url} />\n <CardBody>\n <CardTitle>{name}</CardTitle>\n <CardText>\n {`Price: ${price}`}\n {this.props.renderQuantity ?\n <p>Quantity: {this.props.data.quantity}</p> :\n null\n }\n </CardText>\n <Button onClick={this.addProduct}>Add Product</Button>\n <Button onClick={this.removeProduct}>Remove Product</Button>\n </CardBody>\n </Card>\n );\n }", "function displayProduct(item){\r\n if(item.id == 1\r\n || item.id == 2 \r\n || item.id == 3\r\n || item.id == 4\r\n || item.id == 5\r\n || item.id == 6){\r\n return `\r\n <div class = \"product\">\r\n <img src = ${item.img_url}></img>\r\n \r\n <div class = product-top>\r\n <h4>${item.title}</h4>\r\n <h6>$${item.price}</h6>\r\n </div>\r\n\r\n <p>${item.text}</p>\r\n\r\n <div class = product-bottom>\r\n <h6>Rating: ${item.rating} out of 5</h6>\r\n <a href = \"#\"><span>Reviews (${item.reviews})</span></a>\r\n </div>\r\n </div>\r\n `\r\n }\r\n}", "render(){\nconst {container,titleConatiner,title,body,productContainer,productImage,productName,productPrice} = styles;\n\n\n//Product Images\n return(\n<View style= {container}>\n<View style={titleConatiner}>\n<Text style={title}>Top Products </Text>\n</View>\n\n <View style={body}>\n\n {this.props.topProducts.map(e => (\n <TouchableOpacity style={productContainer} onPress={() => this.gotoDetails(e)} key={e.id} >\n\n <Image source={{ uri: `${url} ${e.images[0]}` }} style={productImage} />\n\n <Text style={productName}>{e.name.toUpperCase()}</Text>\n\n <Text style={productPrice}>{e.price}$</Text>\n </TouchableOpacity>\n ))}\n\n\n</View>\n</View>\n\n );\n}", "render() {\n push();\n translate(this.pos.x + this.xOff, this.pos.y);\n rotate(this.angle);\n imageMode(CENTER);\n image(this.design, 0, 0, this.r, this.r);\n pop();\n }", "show() {\n // applyTextTheme\n image(this.image, this.x, this.y, this.width, this.height)\n }", "render() {\n return (\n <div>\n <ProductListComponent/>\n </div>\n )\n }", "function imageDisplay() {\n var color = imageColor();\n var captionColor = color;\n captionColor = color.replace(/_/g, \" \").replace('solid', '');\n var captionProduct = name.replace('<br>', '&nbsp;');\n var caption = (captionColor+\" \"+captionProduct).replace(/(^|\\s)\\S/g, function(match) {\n return match.toUpperCase();\n });\n var img_source = \"../../images/products/\"+img+color+\".gif\";\n var lightbox_img = \"../../images/products/large/\"+img+color+\".gif\";\n var lightbox_img_back = \"../../images/products/back/large/\"+img+color+\".gif\";\n $('#product_img_front').attr('src', img_source);\n $('#product_img_front_large').attr('src', lightbox_img);\n $('#product_img_back_large').attr('src', lightbox_img_back);\n $('#product_img_front').parent().attr('href', lightbox_img).attr('data-lightbox', img+color).attr('title', caption);\n $('#product_img_back').attr('href', lightbox_img_back).attr('data-lightbox', img+color).attr('title', caption+' (Back)');\n}", "renderGallery() {\n\t\tconst {data, container, currentPhoto} = this.props,\n\t\t\timageWrapper = this.createElement('div', 'gallery__general-image'),\n\t\t\timage = this.createElement('img', 'gallery__photo');\n\t\tcontainer.innerText = '';\n\n\t\timageWrapper.append(image);\n\t\tcontainer.append(imageWrapper, this.renderPhotoList());\n\t\tthis.changeGeneralPhoto(currentPhoto);\n\t}", "renderImage( img, i ) {\n\t\tconst {\n\t\t\timageFilter,\n\t\t\timages,\n\t\t\tisSave,\n\t\t\tlinkTo,\n\t\t\tlayoutStyle,\n\t\t\tonRemoveImage,\n\t\t\tonSelectImage,\n\t\t\tselectedImage,\n\t\t\tsetImageAttributes,\n\t\t} = this.props;\n\n\t\t/* translators: %1$d is the order number of the image, %2$d is the total number of images. */\n\t\tconst ariaLabel = sprintf(\n\t\t\t__( 'image %1$d of %2$d in gallery', 'jetpack' ),\n\t\t\ti + 1,\n\t\t\timages.length\n\t\t);\n\t\tconst Image = isSave ? GalleryImageSave : GalleryImageEdit;\n\n\t\tconst { src, srcSet } = photonizedImgProps( img, { layoutStyle } );\n\n\t\treturn (\n\t\t\t<Image\n\t\t\t\talt={ img.alt }\n\t\t\t\taria-label={ ariaLabel }\n\t\t\t\theight={ img.height }\n\t\t\t\tid={ img.id }\n\t\t\t\timageFilter={ imageFilter }\n\t\t\t\tisSelected={ selectedImage === i }\n\t\t\t\tkey={ i }\n\t\t\t\tlink={ img.link }\n\t\t\t\tlinkTo={ linkTo }\n\t\t\t\tonRemove={ isSave ? undefined : onRemoveImage( i ) }\n\t\t\t\tonSelect={ isSave ? undefined : onSelectImage( i ) }\n\t\t\t\torigUrl={ img.url }\n\t\t\t\tsetAttributes={ isSave ? undefined : setImageAttributes( i ) }\n\t\t\t\tsrcSet={ srcSet }\n\t\t\t\turl={ src }\n\t\t\t\twidth={ img.width }\n\t\t\t/>\n\t\t);\n\t}", "function updateProductImageHeight() {\n let productImageWidth = $('.product-image').width();\n $('.product-image').css({'height': productImageWidth + 'px'});\n }", "render(){\n return (\n <div>\n . <img src=\"./login_images/login_background.jpeg\" id=\"login_background\" />\n <div id=\"login_component\">\n <img src=\"./login_images/cc_logo.png\" id=\"login_image\" />\n <LoginButton />\n </div>\n </div>\n );\n }", "render() {\n return (\n <div id=\"main\">\n <div className=\"content\">\n <h1>Products</h1>\n\n <ProductList />\n </div>\n </div>\n );\n }", "render() {\n return (\n\t\t<View style={styles.container}>\n\t\t{this.state.products.map((item, i) => \n\t\t\t<View style={styles.container} key={i}>\n\t\t\t\t<Text>{ item.title }</Text>\n\t\t\t\t<Image\n\t\t\t\t style={{width: 140, height: 80}}\n\t\t\t\t source={{uri: item.images[0].src }}\n\t\t\t\t/>\n\t\t\t\t<Text> $ { item.variants[0].price * 0.75 }</Text>\n\t\t\t\t<Button \n\t\t\t\t onPress={ ()=> \n\t\t\t\t\tonButtonPress(item.title, item.variants[0].price * 0.75)\n\t\t\t\t }\n\t\t\t\t title=\"Purchase\"\n\t\t\t\t color=\"#841584\"\n\t\t\t\t accessibilityLabel=\"Learn more about this product\" />\n\t\t\t</View>\n\t\t)}\n\t\t</View>\n );\n }", "function generateProductsHTML(index, item) {\n return `<div class=\"product-container\" position=${index}>\n <img class=\"product-image\" id=\"image${item.id}\" src=\"${item.image}\">\n <div class=\"productInfo-container\">\n <div class=\"product-name\">${item.name}</div>\n <div class=\"product-price\">${item.price}</div>\n </div>\n <div class=\"product-buy\" id=\"${item.id}\">${item.button_text}</div> \n </div>`\n}", "render() {\r\n return html`\r\n <style>\r\n :host {\r\n display: flex;\r\n flex-direction: column;\r\n align-items: flex-start;\r\n width: 250px;\r\n border-radius: 5px;\r\n overflow: hidden;\r\n cursor: pointer;\r\n transition: box-shadow 0.2s;\r\n }\r\n\r\n :host(:hover) {\r\n box-shadow: var(--app-card-shadow);\r\n }\r\n\r\n img {\r\n width: 250px;\r\n height: 165px;\r\n object-fit: cover;\r\n }\r\n\r\n .info-container {\r\n margin: 8px;\r\n }\r\n\r\n .name {\r\n font-size: 20px;\r\n }\r\n\r\n .subtitle {\r\n font-size: 12px;\r\n font-weight: 300;\r\n }\r\n\r\n @media (max-width: 768px) {\r\n :host {\r\n width: 200px;\r\n }\r\n\r\n img {\r\n width: 200px;\r\n height: 135px;\r\n }\r\n\r\n .name {\r\n font-size: 16px;\r\n }\r\n\r\n .subtitle {\r\n font-size: 10px;\r\n }\r\n }\r\n\r\n @media (max-width: 460px) {\r\n :host {\r\n width: 100%;\r\n }\r\n\r\n img {\r\n width: 100%;\r\n }\r\n }\r\n </style>\r\n\r\n <img src=\"${(this.images && this.images.length) ? this.images[0] : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII='}\">\r\n <div class=\"info-container\">\r\n <div class=\"name\">${this.name}</div>\r\n <div class=\"subtitle\">${this.price}</div>\r\n </div>\r\n `;\r\n }", "function renderImage(graphValues) {\n //Create a cytosnap object\n var snap = cytosnap();\n var layouts = graphValues.layouts;\n var graph = graphValues.graph;\n\n if(!layouts || layouts.length <= 1) {return new Promise(r => r([]));}\n\n //Get all parent nodes\n let parents = graph.map(element => element.data.parent);\n parents = _.compact(parents); // Remove false values\n parents = _.uniq(parents); //Delete duplicates\n\n //Start Cytosnap Instance\n return snap.start().then(function () {\n //Create an array of images\n let images = layouts.map(layout => {\n\n //Filter out parent nodes\n let layoutPositions = _.pickBy(layout.positions, (value, key) => !parents.includes(key)); \n\n //Build a render options object\n let renderJson = getRenderOptions(graph, layoutPositions);\n\n //Generate an image of a layout.\n return snap.shot(renderJson).then(res => ({\n id: layout.id,\n date: layout.date_added,\n img: res\n }));\n });\n\n return Promise.all(images);\n });\n}", "function renderProducts() {\n var newProductIndexes = generateNewProductIndexes();\n productAIndex = newProductIndexes[0];\n productBIndex = newProductIndexes[1];\n productCIndex = newProductIndexes[2];\n\n productsHistory.push([Product.allProducts[productAIndex].name, Product.allProducts[productBIndex].name, Product.allProducts[productCIndex].name]);\n\n productAElement.src = Product.allProducts[productAIndex].image;\n productBElement.src = Product.allProducts[productBIndex].image;\n productCElement.src = Product.allProducts[productCIndex].image;\n \n Product.allProducts[productAIndex].views ++;\n Product.allProducts[productBIndex].views ++;\n Product.allProducts[productCIndex].views ++;\n\n}", "function init() {\n imageContainers = [];\n if (product_id && !$model) {\n // Should look up the product by id and call render() when done()\n currentProduct = Alloy.createModel('product');\n currentProduct.id = product_id;\n currentProduct.ensureImagesLoaded('heroImage').done(function() {\n render();\n });\n } else {\n // Just render with what we have\n currentProduct.ensureImagesLoaded('heroImage').done(function() {\n render();\n }).fail(function() {\n logger.error('cannot get images!');\n });\n }\n}", "function renderProduct(container, storeInstance, itemName) {\n var product_container = document.createElement(\"div\");\n product_container.setAttribute(\"class\", \"container\");\n var product_img = document.createElement(\"img\");\n product_img.setAttribute(\"class\", \"product_img\");\n // console.log(itemName)\n // console.log(storeInstance.stock[itemName])\n product_img.setAttribute(\"src\", storeInstance.stock[itemName].imageUrl);\n product_container.appendChild(product_img);\n\n var price = document.createElement(\"p\");\n price.setAttribute(\"class\", \"price\");\n price.appendChild(document.createTextNode(\"$\" + storeInstance.stock[itemName].price));\n product_container.appendChild(price);\n\n var span = document.createElement(\"span\");\n span.appendChild(document.createTextNode(storeInstance.stock[itemName].label));\n product_container.appendChild(span);\n var item_control = document.createElement(\"div\");\n item_control.setAttribute(\"class\", \"item_control\");\n product_container.appendChild(item_control);\n\n var add_button = document.createElement(\"button\");\n add_button.setAttribute(\"class\", \"btn-add\");\n add_button.appendChild(document.createTextNode(\"Add to Cart\"));\n var remove_button = document.createElement(\"button\");\n remove_button.setAttribute(\"class\", \"btn-remove\");\n remove_button.appendChild(document.createTextNode(\"Remove from Cart\"));\n\n if (storeInstance.stock[itemName]['quantity'] > 0) {\n item_control.appendChild(add_button);\n } else {\n if (item_control.contains(add_button)) {\n item_control.removeChild(add_button);\n }\n }\n if (!storeInstance.cart[itemName] || storeInstance.cart[itemName] === 0) {\n if (item_control.contains(remove_button)) {\n item_control.removeChild(remove_button);\n }\n } else {\n item_control.appendChild(remove_button);\n }\n while (container.firstChild) container.firstChild.remove();\n container.appendChild(product_container);\n}", "function Products() {\n const Item = [\n {\n itemName: \"Nike Air Force 1 Crater\",\n itemGender: \"Women's Shoe\",\n itemPrice: \"$110\",\n photo: [ {id: 1, image: BackShoe} , {id: 2, image: Bottom}, {id: 3, image: CloseView}, {id: 4, image: LeftSide}, {id: 5, image: RightSide}, {id: 6, image: TopView}, {id: 7, image: TwoShoes} ],\n },\n ];\n\n// console.log(Item[0].photo[0].BackShoe);\n\n return (\n <div className=\"container\">\n <img src={Item[0].photo[0].BackShoe} alt=''/>\n {Item[0].photo.map(picture => (\n <div className='productPictures' key={picture.id}>\n <img src={picture.image} alt='' style={{width: '400px', height: '450px'}}/> \n </div>\n ))}\n <ProductDetail gender=\"Women's Shoe\" title='Nike Air Force 1 Crater' price='$110'/>\n <ShoeSize />\n <ShoeInfo />\n </div>\n );\n}", "render() {\n super.render();\n this._outputView = new OutputArea({\n rendermime: renderMime,\n contentFactory: OutputArea.defaultContentFactory,\n model: this.model.outputs\n });\n this.pWidget.insertWidget(0, this._outputView);\n\n this.pWidget.addClass('jupyter-widgets');\n this.pWidget.addClass('widget-output');\n this.update(); // Set defaults.\n }", "function ViewImage({ image, selectedImage64 }) {\n if (!selectedImage64) {\n return (\n <div>\n view image\n <br />\n view image\n <br />\n view image\n <br />\n view image\n <br />\n <BusyLoading />\n <br />\n </div>\n );\n }\n return (\n <div>\n view image\n <br />\n view image\n <br />\n view image\n <br />\n view image\n <br />\n view image\n <br />\n <Image src={\"data:image/jpeg;base64,\" + selectedImage64} responsive />\n </div>\n );\n}", "function renderProductItem(titleProduct, imgProduct, rankProduct, rankCountProduct, priceProduct) {\n let imgElement = createElement('img', {\n src: imgProduct\n });\n\n let titleElement = createElement('p', { class: 'title' }, titleProduct);\n\n let rankStar = createElement('i', { class: 'fa fa-star' });\n let rankElement = createElement('span', { class: 'rank' }, `(${rankCountProduct})${rankProduct}`);\n rankElement.appendChild(rankStar);\n\n let priceElement = createElement('span', { class: 'price' }, priceProduct);\n priceElement.appendChild(createElement('span', { class: \"toman\" }, ' تومان'));\n\n let container = createElement('li', { class: 'product-item' }, [imgElement, titleElement, rankElement, priceElement]);\n\n return container;\n }", "function renderImg() {\n // console.log('before '+arrIndex);\n leftIndex = generateIndex();\n middleIndex = generateIndex();\n rightIndex = generateIndex();\n while (leftIndex === middleIndex || leftIndex === rightIndex || rightIndex === middleIndex || arrIndex.includes(leftIndex) || arrIndex.includes(middleIndex) || arrIndex.includes(rightIndex)) {\n leftIndex=generateIndex();\n middleIndex=generateIndex();\n rightIndex = generateIndex();\n }\n arrIndex=[leftIndex,middleIndex,rightIndex];\n\n\n\n // leftImage.src=Products.allImages[leftIndex].source;\n leftImage.setAttribute('src', allImages[leftIndex].source);\n allImages[leftIndex].views ++;\n middleImage.setAttribute('src', allImages[middleIndex].source);\n allImages[middleIndex].views ++;\n rightImage.setAttribute('src', allImages[rightIndex].source);\n allImages[rightIndex].views ++;\n}", "renderImage() {\n const { images, currentImage } = this.props;\n\n if (!images || !images.length) return null;\n const image = images[currentImage];\n\n return(\n <div className=\"lightbox--container\">\n <header className=\"lightbox--header\">\n <a href={utils.urlBuilder.getPhotoPostUrl(image)} target=\"_blank\"> <i className=\"fa fa-link\"></i> Flickr Post</a>\n <button onClick={this.props.onClose}> <i className=\"fa fa-close\"></i> </button>\n </header>\n <img\n src={utils.urlBuilder.getFlickrPhotoUrl(image, 'x-large')}\n style={ { maxHeight: this.state.windowHeight} } />\n <footer className=\"lightbox--footer\">\n <div className=\"counter\">\n { currentImage + 1 } of { images.length }\n </div>\n <div className=\"description\">{image.title}</div>\n </footer>\n </div>\n )\n }", "function showProduct() {\n const title = el('products').value;\n const product = products[title];\n if (product) {\n el('title').innerHTML = title;\n el('price').innerHTML = 'Price: ' + currencyFormatter.format(product.price);\n el('image').src = product.image;\n }\n el('quantity-container').style.display = product ? 'block' : 'none';\n}", "renderLayout() {\n\t let self = this;\t \n\t let photoListWrapper = document.querySelector('#photos');\t \n imagesLoaded(photoListWrapper, function() { \t \n\t\t\tself.msnry = new Masonry( photoListWrapper, {\n\t\t\t\titemSelector: '.photo'\n\t\t\t}); \n\t\t\t[...document.querySelectorAll('#photos .photo')].forEach(el => el.classList.add('in-view'));\n });\n }", "render () {\n let {src, alt, ...props} = this.props;\n src = src?.src || src; // image passed through import will return an object\n return <img {...props} src={addBasePath(src)} alt={alt}/>\n }", "render() {\n return (\n <img\n alt={\"img-\" + this.num}\n src={this.src}\n style={this.styles}\n onError={this.failedToLoad}\n />\n );\n }", "function Home() {\n return (\n <div className=\"home\">\n <div className=\"home__container\">\n <img\n className=\"home__image landing-img\"\n // src=\"https://image.freepik.com/free-photo/shopping-cart-moves-speed-light-backdrop-with-balloons-gift-boxes-all-live-futuristic-atmosphere-3d-render_172660-11.jpg\" \n src={image} \n alt=\"our landing page\"\n />\n\n <div className=\"home__row\">\n <Product\n id=\"12321341\"\n title=\"Apple iPhone 12 Pro, 128GB 6GB RAM, Silver, IP68 dust/water resistant,15.49 cm (6.1 inch) Super Retina XDR Display,12MP + 12MP + 12MP | 12MP Front Camera\"\n price={116250}\n rating={5}\n image=\"https://fdn2.gsmarena.com/vv/pics/apple/apple-iphone-12-pro-r1.jpg\"\n />\n <Product\n id=\"49538094\"\n title=\"Samsung Galaxy S21 Ultra 5G, 128GB 12GB RAM, skyblue, IP68 dust/water resistant\"\n price={110000.0}\n rating={5}\n image=\"https://fdn2.gsmarena.com/vv/pics/samsung/samsung-galaxy-s21-ultra-5g-1.jpg\"\n />\n </div>\n <div className=\"home__row\">\n <Product\n id=\"12321341\"\n title=\"Oppo Reno6 Pro+ 5G ilver, IP68 dust/water resistant .Android 11, ColorOS 11.3 ,128GB 8GB RAM, 256GB 12GB RAM ,UFS 3.1\"\n price={85250}\n rating={4}\n image=\"https://fdn2.gsmarena.com/vv/pics/oppo/oppo-reno6-5g-1.jpg\"\n />\n <Product\n id=\"49538094\"\n title=\"ZTE nubia Red Magic 6R, Android 11, Redmagic 4.0 ,Dark Blue, Silver, Light Blue ,Glass front, aluminum frame, plastic back \"\n price={55286.0}\n rating={4}\n image=\"https://fdn2.gsmarena.com/vv/pics/zte/zte-nubia-red-magic-6r-1.jpg\"\n />\n </div>\n \n\n <div className=\"home__row\">\n <Product\n id=\"4903850\"\n title=\"Xiaomi Redmi Note 10 Pro , Android 11, MIUI 12,AMOLED, 120Hz, HDR10, 450 nits (typ), 1200 nits (peak),64GB 6GB RAM, 128GB 6GB RAM, 128GB 8GB RAM\"\n price={48367.99}\n rating={4}\n image=\"https://rukminim1.flixcart.com/image/416/416/kf4ajrk0/mobile/t/4/4/mi-redmi-note-9-pro-mzb9586in-original-imafvnfgtacmgwu7.jpeg?q=70\"\n />\n <Product\n id=\"23445930\"\n title=\"APPLE Airpods Pro With Wireless Charging Case Active noise cancellation enabled Bluetooth Headset (White, True Wireless)\"\n price={21999.99}\n rating={5}\n image=\"https://rukminim1.flixcart.com/image/416/416/k5cs87k0/headphone/h/8/8/apple-earphone-1a-original-imafmyz2ufupkvxr.jpeg?q=70\"\n />\n <Product\n id=\"3254354345\"\n title=\"Mi Notebook 14 Core i5 10th Gen - (8 GB/512 GB SSD/Windows 10 Home) JYU4243IN Thin and Light Laptop (14 inch, Silver, 1.5 kg)\"\n price={42999.99}\n rating={4}\n image=\"https://rukminim1.flixcart.com/image/416/416/koixwnk0/computer/9/p/x/na-thin-and-light-laptop-mi-original-imag2ygskfu3zew5.jpeg?q=70\"\n />\n </div>\n \n\n <div className=\"home__row\">\n <Product\n id=\"90829332\"\n title=\"SAMSUNG 198 L Direct Cool Single Door 5 Star Refrigerator with Base Drawer (Camellia Blue, RR21T2H2WCU/HL) ,198 L : Good for couples and small families,Digital Inverter Compressor ,5 Star : For Energy savings up to 55%\"\n price={16888.98}\n rating={4}\n image=\"https://rukminim1.flixcart.com/image/416/416/k4ss2a80/refrigerator-new/j/w/v/rr21t2h2wcu-hl-5-samsung-original-imafnmkbyzev8szv.jpeg?q=70\"\n />\n <Product\n id=\"3254354345\"\n title=\"Godrej 19 L Convection Microwave Oven (GMX 519 CP1 PZ, White Rose),Bring home this 19 L microwave and enjoy safe usage with its Child Lock function that prevents its use by a child. The digital display adds to the ease of use of this appliance. Choose from the 125 recipes that the Instacook function offers and easily cook your favourite food with its preset settings.\"\n price={7888.99}\n rating={4}\n image=\"https://rukminim1.flixcart.com/image/416/416/klzhq4w0/microwave-new/v/r/w/gmx-519-cp1-pz-godrej-original-imagyzexsnbkug24.jpeg?q=70\"\n />\n </div>\n <div className=\"home__row\">\n <Product\n id=\"90829332\"\n title=\"SAMSUNG 6 kg 5 star Inverter Fully Automatic Front Load with In-built Heater White (WW60R20GLMA/TL) ,Fully Automatic Front Load Washing Machines have Great Wash Quality with very less running cost ,1000 rpm : Higher the spin speed, lower the drying time\"\n price={20999.98}\n rating={4}\n image=\"https://rukminim1.flixcart.com/image/416/416/k7f34i80/washing-machine-new/h/y/j/ww60r20glma-tl-samsung-original-imafpns894qh5zta.jpeg?q=70\"\n />\n <Product\n id=\"3254354345\"\n title=\"Bharat Lifestyle Nano Fabric 6 Seater Sofa (Finish Color - Black Grey),Upholestry: Polycotton,Filling Material: Foam,W x H x D: 261 cm x 76 cm x 185 cm (8 ft 6 in x 2 ft 5 in x 6 ft)\"\n price={18999.99}\n rating={4}\n image=\"https://rukminim1.flixcart.com/image/416/416/jmp79u80/sofa-sectional/t/a/r/black-polycotton-nano-bharat-lifestyle-black-grey-original-imaf9jnxsemqtmgk.jpeg?q=70\"\n />\n </div>\n </div>\n </div>\n );\n}", "render() {\n\n return (\n <Content style={{ margin: '24px 16px 0' }}>\n <div style={{ padding: 24, background: '#fff', minHeight: 360 }}>\n <img src={this.props.imgdata} />\n </div>\n </Content>\n );\n }", "render() {\n const { products, page, productInfo} = this.state; //desistruturando\n //aonde era this.state.products.map, fica agr apenas products.map, vale o mesmo para os demais\n\n //a key no h2 e passada, pq o react pede que tenha uma key unica pra cada item da iteracao\n return (\n <div className=\"product-list\"> \n <div className='header'>\n <h1>Sua Lista de Produtos:</h1>{/*alt='' e por questao de acessibilidade, ele fornece o que e aquela imagem, para deficientes visuais ou navegacao apenas de texto*/}\n <Link to={`/createProducts`} title='Novo Produto' className='btIcon'><img alt='Imagem Novo Produto' src={iconNew}/></Link> \n </div>\n {//aqui codigo javascript, apos \"=> (\" volta a ser html\n products.map(product => (\n <article key={product._id}>\n <strong>{product.title}</strong>\n <p>{product.description}</p>\n <Link to={`/products/${product._id}`}>Acessar</Link>\n <div className='buttons'> {/*alt='' e por questao de acessibilidade, ele fornece o que e aquela imagem, para deficientes visuais ou navegacao apenas de texto*/}\n <Link to={`/updateProducts/${product._id}`} title='Editar' className='btIcon'><img alt='Imagem Editar Produto' src={iconEdt}/></Link>\n <button title='Deletar' className='btIcon' onClick= {() => {this.DeleteProduct(product._id, page);}}><img alt='Imagem Deletar Produto' src={iconDel}/></button>\n </div>\n </article>\n ))}\n <div className=\"actions\">\n <button disabled={page === 1} onClick={this.prevPage}>Anterior</button>\n <button disabled={page === productInfo.pages} onClick={this.nextPage}>Próxima</button>\n </div> \n </div>\n\n \n )\n }", "render() {\n return (\n <div classname=\"row align-items-start\">\n <div classname=\"col-sm-10\">\n <h1 id=\"Websitename\">Remember All</h1>\n </div>\n {/* <div classname=\"col-sm-2\"> */}\n {/* <img id=\"goldfish\" src={\"goldfish.jpg\"} alt=\"Goldfish\">; */}\n \n {/* </img> */}\n </div>\n // </div>\n\n ) }", "render() {\r\n return html`\r\n ${SharedStyles}\r\n <style>\r\n .container {\r\n display: flex;\r\n }\r\n\r\n img {\r\n width: 400px;\r\n height: 400px;\r\n object-fit: contain;\r\n border-radius: 5px;\r\n background-color: var(--app-dark-primary-color);\r\n }\r\n\r\n .name {\r\n font-size: 40px;\r\n font-family: 'Roboto Mono', monospace;\r\n line-height: 1;\r\n }\r\n\r\n .info-container {\r\n margin-left: 16px;\r\n display: flex;\r\n flex-direction: column;\r\n margin-bottom: 6px;\r\n }\r\n\r\n .subtitle {\r\n font-weight: 300;\r\n }\r\n\r\n .description {\r\n margin-top: 24px;\r\n margin-bottom: 24px;\r\n font-size: 18px;\r\n }\r\n\r\n .button-container {\r\n margin-top: auto;\r\n align-self: flex-start;\r\n }\r\n\r\n .price {\r\n font-family: 'Roboto Mono', monospace;\r\n font-size: 28px;\r\n }\r\n\r\n mwc-button {\r\n --mdc-theme-primary: var(--app-button-background-color);\r\n --mdc-theme-on-primary: black;\r\n }\r\n\r\n @media (max-width: 768px) {\r\n .container {\r\n flex-direction: column;\r\n }\r\n\r\n .info-container {\r\n margin: 0;\r\n }\r\n\r\n .image-container {\r\n width: 100%;\r\n }\r\n\r\n img {\r\n width: 100%;\r\n height: 300px;\r\n }\r\n }\r\n\r\n @media (max-width: 460px) {\r\n img {\r\n height: 200px;\r\n }\r\n\r\n .name {\r\n font-size: 32px;\r\n }\r\n\r\n .subtitle {\r\n font-size: 12px;\r\n }\r\n\r\n .description {\r\n font-size: 14px;\r\n }\r\n\r\n .price {\r\n font-family: 'Roboto Mono', monospace;\r\n font-size: 22px;\r\n }\r\n }\r\n </style>\r\n\r\n <div class=\"container\">\r\n <div class=\"image-container\">\r\n <img src=\"${this._computeImageSrc(this.item)}\">\r\n </div>\r\n \r\n <div class=\"info-container\">\r\n <div class=\"name\">${this.item ? this.item.name : \"\"}</div>\r\n <div class=\"subtitle\">${this._computeIngredients(this.item)}</div>\r\n <div class=\"description\">${this.item ? this.item.description : \"\"}</div>\r\n\r\n <div class=\"button-container\">\r\n <div class=\"price\">${this.item ? this.item.price : \"\"}</div>\r\n <mwc-button @click=\"${_ => this._onAddToCartClick(this.item, this.quantity)}\" raised>add to cart</mwc-button>\r\n </div>\r\n </div>\r\n </div>\r\n \r\n `;\r\n }", "function displayProduct(product) {\n document.getElementById('product').innerHTML = renderHTMLProduct(product, 'single');\n}", "render() {\n return(\n <span>\n <h1 className=\"title\">\n {this.props.title}\n </h1>\n <div>\n <img className=\"image\" alt=\"\" src={this.state.img}></img>\n </div>\n <br></br>\n <Button variant=\"outline-dark\" onClick={this.handleClick}>Recipe</Button>\n </span>\n );\n }", "render() {\n console.log('rerendering product page');\n return (\n <div>\n <div id=\"product-view__container\">\n <div id=\"product\">\n <div className=\"spinner\">&#128296;</div>\n </div>\n <div id=\"carousel\"></div>\n <div id=\"reviews\"></div>\n </div>\n </div>\n );\n }", "render(){\n\n /*\n * FIXME: get jpegs for product images\n */\n\n return (\n <View style ={styles.categories}>\n <Featured/>\n {this.state.categories.map(function(c, i){\n return (\n <TouchableOpacity key={i} style={styles.panel}>\n <Image source={require('./test.jpg')} style={styles.panelImage}/>\n <View style={styles.textContainer}>\n <Text style={styles.panelText}>{c.name}</Text>\n </View>\n </TouchableOpacity>\n )\n })}\n </View>\n )\n }", "function Product({\n product\n}) {\n var _product$photo, _product$photo$image;\n\n return /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(\"div\", {\n className: (_styles_ItemStyles_module_scss__WEBPACK_IMPORTED_MODULE_5___default().root),\n children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(\"img\", {\n // className={classesItemStyles.itemImg}\n src: product === null || product === void 0 ? void 0 : (_product$photo = product.photo) === null || _product$photo === void 0 ? void 0 : (_product$photo$image = _product$photo.image) === null || _product$photo$image === void 0 ? void 0 : _product$photo$image.publicUrlTransformed,\n alt: product.name\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 14,\n columnNumber: 7\n }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(\"div\", {\n className: (_styles_Title_module_css__WEBPACK_IMPORTED_MODULE_6___default().title),\n children: /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)((next_link__WEBPACK_IMPORTED_MODULE_1___default()), {\n href: `/product/${product.id}`,\n children: product.name\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 20,\n columnNumber: 9\n }, this)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 19,\n columnNumber: 7\n }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(\"div\", {\n className: (_styles_PriceTag_module_css__WEBPACK_IMPORTED_MODULE_7___default().priceTag),\n children: (0,_lib_util_formatMoney__WEBPACK_IMPORTED_MODULE_2__.default)(product.price)\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 22,\n columnNumber: 7\n }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(\"p\", {\n children: product.description\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 25,\n columnNumber: 7\n }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(\"div\", {\n className: (_styles_ItemStyles_module_scss__WEBPACK_IMPORTED_MODULE_5___default().buttonList),\n children: [/*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)((next_link__WEBPACK_IMPORTED_MODULE_1___default()), {\n href: {\n pathname: \"update\",\n query: {\n id: product.id\n }\n },\n children: \"Edit\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 27,\n columnNumber: 9\n }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(_DeleteProduct__WEBPACK_IMPORTED_MODULE_3__.default, {\n id: product.id,\n children: \"Delete\"\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 30,\n columnNumber: 9\n }, this), /*#__PURE__*/(0,react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxDEV)(_AddToCart__WEBPACK_IMPORTED_MODULE_4__.default, {\n id: product.id\n }, void 0, false, {\n fileName: _jsxFileName,\n lineNumber: 31,\n columnNumber: 9\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 26,\n columnNumber: 7\n }, this)]\n }, void 0, true, {\n fileName: _jsxFileName,\n lineNumber: 13,\n columnNumber: 5\n }, this);\n}", "_renderThumbnail($$) {\n let node = this.props.node\n // TODO: Make this work with tables as well\n let contentNode = node.find('graphic')\n let el = $$('div').addClass('se-thumbnail')\n if (contentNode) {\n el.append(\n $$(this.getComponent(contentNode.type), {\n node: contentNode,\n disabled: this.props.disabled\n })\n )\n } else {\n el.append('No thumb')\n }\n return el\n }", "display() {\n this.move();\n imageMode(CENTER);\n image(this.axeImg, this.x + bgLeft, this.y, this.w, this.h);\n }", "function renderProducts() {\n const promotionalProductsPart = document.querySelector(\".promotion-list\");\n let html = \"\";\n for (const product of productsList) {\n if (product.category === \"promotionalProducts\") {\n html += `<article>\n <div>\n <img src=\"img/${product.image}\" alt=\"${product.alt}\">\n <h3>${product.title}</h3>\n <a href=#>LEARN MORE - - - <span>&#10145;</span></a>\n </div>\n </article>`;\n }\n }\n promotionalProductsPart.innerHTML = html;\n}", "function render() {\n var state = store.getState()\n document.getElementById('value').innerHTML = state.count.result;\n document.getElementById('value2').innerHTML = state.sum;\n\n if(state.count.loading){\n document.getElementById('status').innerHTML = \"is loading...\";\n }else{\n document.getElementById('status').innerHTML = \"loaded\";\n }\n // image\n document.getElementById('imagesStatus').innerHTML = state.images.loading;\n if(state.images.loading ==\"loading…\"){\n $('#imagesList').text(\"\");\n }\n else if(state.images.loading ==\"loaded\"){\n for(var i=0; i< state.images.data.length; i++){\n $('#imagesList').append(\n \"<img src='\" + state.images.data[i].link + \"' style='height:200px'>\");\n }\n }\n\n}", "render() {\n // eslint-disable-next-line no-unused-vars\n let baseStyle = {};\n // eslint-disable-next-line no-unused-vars\n let layoutFlowStyle = {};\n \n const style_background = {\n width: '100%',\n height: '100%',\n };\n const style_background_outer = {\n backgroundColor: '#f6f6f6',\n pointerEvents: 'none',\n };\n const style_image = {\n backgroundImage: 'url('+img_elImage+')',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: '50% 50%',\n backgroundSize: 'cover',\n pointerEvents: 'none',\n };\n const style_image2 = {\n backgroundImage: 'url('+img_elImage2+')',\n backgroundRepeat: 'no-repeat',\n backgroundPosition: '50% 50%',\n backgroundSize: 'cover',\n };\n const style_image2_outer = {\n pointerEvents: 'none',\n };\n \n return (\n <div className=\"Component1\" style={baseStyle}>\n <div className=\"background\">\n <div className='appBg containerMinHeight elBackground' style={style_background_outer}>\n <div style={style_background} />\n \n </div>\n \n <div className='elImage' style={style_image} />\n </div>\n <div className=\"layoutFlow\">\n <div className='elImage2' style={style_image2_outer}>\n <div style={style_image2} />\n \n </div>\n \n </div>\n </div>\n )\n }", "function printProducts(){\n for (var i = 0; i <= products.length; i++){ \n if (i < products.length-1){\n var clone = productDiv.cloneNode(true);\n productDiv.parentNode.insertBefore(clone, productDiv);\n };\n productDiv.style.display = \"block\";\n productName.innerHTML = products[i].name;\n productDescription.innerHTML = products[i].description;\n price.innerHTML = products[i].price;\n image.setAttribute(\"src\", products[i].url); \n \n }\n \n }", "render() {\n\n return (\n <div className=\"mx-3\">\n <CategorySelect productsAndImagesData={this.state.productsAndImagesData} />\n </div>\n );\n }", "render() {\n console.log(\"Rendering ArtBlock...\");\n let paintings = this.state.paintings;\n const ArtBlocks = [];\n for (var i = 0; i < paintings.length; i++) {\n ArtBlocks.push(\n <img key={paintings[i].name}\n className=\"artBlock\"\n src={process.env.PUBLIC_URL + paintings[i].artURL}\n fluid=\"true\"\n data-painting={paintings[i].name}\n alt={Paintings[i].name}\n onClick={this.handleClick}></img>\n )\n }\n return (\n <div>\n <div id=\"scoreboard\" className=\"score\">Score: {this.state.currentScore} | High Score: {this.state.highScore}</div>\n <div id=\"modal\" className=\"surpriseDiv\">\n {Modal}\n </div>\n <div className=\"background\">\n {ArtBlocks}\n </div>\n </div>\n )\n }", "function renderGallery(image) {\n let gallery = document.getElementById('gallery');\n if (gallery != null)\n updateGallery(gallery, image);\n else\n createGallery(image);\n }", "renderProduct(product) {\n return (<div className=\"product-card card\">\n {product.name}\n </div>);\n }", "function render() {\n\n\t\t\t}", "function renderImg() \n{\n leftIndex = randomImage();\n midIndex = randomImage();\n rightIndex = randomImage();\n\n randControl();\n while (leftIndex === rightIndex || leftIndex === midIndex) \n {\n leftIndex = randomImage();\n }\n while(rightIndex === midIndex)\n {\n rightIndex = randomImage();\n }\n randControl();\n usedImg.splice(0, usedImg.length);\n\n leftImg.setAttribute('src', products[leftIndex].productImg);\n midImg.setAttribute('src', products[midIndex].productImg);\n rightImg.setAttribute('src', products[rightIndex].productImg);\n products[leftIndex].views++;\n products[midIndex].views++;\n products[rightIndex].views++;\n\n usedImg.push(leftIndex);\n usedImg.push(midIndex);\n usedImg.push(rightIndex);\n}", "render () {\n return (\n <div>\n <div className=\"ui center aligned container\">\n <Logo />\n </div>\n <div className=\"ui container\" style={{marginTop: '20px'}}>\n <SearchBar onSubmission={(term)=>this.onSearchSubmit(term)}/>\n <ImageList images={this.state.images} />\n </div>\n </div>\n );\n }", "function ItemImage(props) {\n return <Image {...props} ui={false} wrapped />\n}" ]
[ "0.68119514", "0.6711578", "0.6438905", "0.6103812", "0.60803235", "0.6068057", "0.6055299", "0.6051518", "0.60464317", "0.6000089", "0.5971422", "0.5937545", "0.5921839", "0.5915895", "0.5908995", "0.5892216", "0.5871162", "0.5831915", "0.5831691", "0.5806436", "0.5787973", "0.57657754", "0.5723944", "0.57129925", "0.5702852", "0.5682741", "0.5650505", "0.56426615", "0.5623197", "0.56102717", "0.5601003", "0.5577978", "0.5572669", "0.5572513", "0.5555633", "0.5544983", "0.55292237", "0.5525613", "0.5514523", "0.54971385", "0.54679453", "0.5461438", "0.5459829", "0.5453033", "0.5450901", "0.54484975", "0.54419714", "0.54289126", "0.5426699", "0.5410413", "0.5410205", "0.5402377", "0.53943425", "0.53930783", "0.53771937", "0.537474", "0.5373132", "0.5360696", "0.53596926", "0.5355597", "0.53539884", "0.5352578", "0.534132", "0.53304535", "0.5323526", "0.5321553", "0.5316722", "0.53084445", "0.53056943", "0.5296578", "0.529359", "0.5290114", "0.5285622", "0.5281973", "0.52797747", "0.5279625", "0.52736443", "0.5272152", "0.52692217", "0.52649915", "0.52584916", "0.5240445", "0.5238457", "0.5234438", "0.5228368", "0.52258617", "0.52176255", "0.5216038", "0.5215461", "0.52150077", "0.5201484", "0.5188266", "0.51865", "0.5186379", "0.5185892", "0.51790893", "0.5173505", "0.5166844", "0.51662284", "0.5164953" ]
0.5530093
36
Displays users name and a button, starts game when clicked.
function introWelcome() { title.innerText = "Welcome, " + username; subTitle.innerText = ""; firstButton.classList.remove("hidden"); firstButton.innerText = "Click to start!" firstButton.onclick = function() { startFunction(); } userInput.classList.add("hidden"); submitButton.classList.add("hidden"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showGamificationButton(names, urls) {\n\n //////////////////////////\n // REMOVE OLD BUTTONS\n /////////////////////////\n const old_gameStartButton = document.getElementById('start_game_button'),\n old_gameButton = document.getElementById('guess_game_button');\n if (old_gameStartButton !== null && old_gameButton !== null) {\n removeElements([old_gameStartButton]);\n removeElements([old_gameButton]);\n }\n \n // create a button\n const gameButton = document.createElement('div'),\n gameStartButton = document.createElement('div');\n \n gameStartButton.innerHTML = 'START';\n gameStartButton.id = 'start_game_button';\n entry_info.parentNode.insertBefore(gameStartButton, entry_info.nextSibling);\n\n // assign an id to it\n gameButton.id = 'guess_game_button';\n\n // insert text\n gameButton.innerHTML = 'Guess The Plants';\n\n // append it next to the pages div tag as a next sibling element\n pages.parentNode.insertBefore(gameButton, pages.nextSibling);\n\n // add a mouseup event listener to the buttons\n gameButton.addEventListener('mouseup', () => {\n \n showGameEntry(urls);\n });\n gameStartButton.addEventListener('mouseup', () => {\n\n // if the text field for username input is not empty\n if (username.value !== '') {\n\n // hide the game start button\n gameStartButton.style.visibility = 'hidden';\n \n // set the container to be fullscreen\n game_entry.style.setProperty('transform', 'translate(0, 0)', 'important');\n game_entry.style.setProperty('width', '100%', 'important');\n game_entry.style.setProperty('height', '100%', 'important');\n\n turns++;\n init(names, urls);\n }\n });\n}", "function renderGame (){\n\n //setup new instructions\n var newInst = $(\"<h3>\");\n newInst.text(\"Welcome back, \"+username);\n newInst.addClass(\"col s12 center-align\");\n $(\"#instructions\").html(newInst);\n \n $(\"#game\").show();\n\n $(\"#yourName\").text(username);\n\n\n if(oppChoice){\n $(\"#opponentChoice\").css(\"opacity\", \"1\");\n } \n // if you haven't chosen, set instructions to say choose\n if (yourChoice){\n $(\"#yourChoice\").css(\"background-image\", \"url('assets/images/\"+yourChoice+\".png')\");\n $(\"#yourChoice\").css(\"opacity\", \"1\");\n \n // if you haven't chosen, show buttons \n } else {\n renderButtons();\n }\n\n updateStatus();\n}", "function useNewButton() {\r\n createUser();\r\n startPage()\r\n}", "function startGame(playerCount) {\r\n\t\r\n\tGC.initalizeGame(playerCount);\r\n\t\r\n\tUI.setConsoleHTML(\"The game is ready to begin! There will be a total of \" + GC.playerCount + \" players.<br />Click to begin!\");\r\n\tUI.clearControls();\r\n\tUI.addControl(\"begin\",\"button\",\"Begin\",\"takeTurn()\");\r\n\t\r\n\tGC.drawPlayersOnBoard();\r\n}", "function startGame() {\n\tvar userName = $(\"#enterName\").val();\n\t$(\"#name\").text(userName);\n\t$(\"#startScreen\").addClass('hide');\n\tif($(\"#enterName\").val() != \"\") {\n\t\tsetQuestion();\n\t} else {\n\t\t$(\"#hint\").removeClass('initialHide');\n\t\t$(\"#hint\").text(\"Please enter your username!\")\n\t}\n\n}", "function startGame(){\r\n var UserData;\r\n var userName = document.getElementById('nameEntry').value\r\n UserData = checkCookie(userName);\r\n updateTables(UserData);\r\n $('#Load').html(\"<button type=\\\"button\\\" id=\\\"loadGame\\\" onclick=\\\"loadGame()\\\">Load Game</button>\");\r\n $('#saveGame').prop('disabled',false);\r\n enableTravel();\r\n}", "function startGame() {\n $(\".landing-menu\").hide();\n $(\".game-section\").show();\n $(\".userButtons\").show();\n }", "display(){\r\n var title = createElement('h1')\r\n title.html(\"car racing game!\")\r\n title.position(380,100)\r\n\r\n var input = createInput(\"Name\")\r\n var button = createButton(\"Play\")\r\n var greeting = createElement('h2')\r\n input.position(380,240)\r\n button.position(440,300)\r\n//when player pressed over the button player count is increased and updated\r\n//button and input is hidden\r\n//greeting message to the player is displayed\r\n\r\n button.mousePressed(function(){\r\n input.hide()\r\n button.hide()\r\n //.value()- gives the value that was passed inside the input\r\n var name = input.value()\r\n\r\n playerCount+=1\r\n player.update(name)\r\n player.updateCount(playerCount)\r\n\r\n greeting.html(\"hellow \"+name)\r\n greeting.position(380,250)\r\n\r\n })\r\n\r\n }", "function showTheGame () {\n\t$(\".game\").show();\n\t$(\".startNowButton\").hide();\n\trun();\n}", "startGame() {\n document.getElementById('homemenu-interface').style.display = 'none';\n document.getElementById('character-selection-interface').style.display = 'block';\n this.interface.displayCharacterChoice();\n this.characterChoice();\n }", "function onClickGameName() {\n stopGame();\n\n socket.send({action: \"exit_game\"});\n $(\"#game\").hide(); \n $(\"#game_choose\").show(); \n\n initHome();\n }", "function startGame() {\n\n $(\"#questionPage\").hide();\n \n $(\"#start\").show();\n\n var startButton = $(\"<button>\");\n\n startButton.text(\"Start\");\n\n $(\"#start\").append(startButton);\n\n}", "function actionOnClick () {\r\n game.state.start(\"nameSelectionMenu\");\r\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 startGameButton() {\n return $(\"<button class='btn btn-success form-control padded' id='showQrBtn'>\"+tr(\"Let's go!\")+\"</button>\").click(hostNewGame);\n}", "function startGame(){\n document.querySelector('.menu').style.display = \"none\";\n addClicks();\n score.querySelector('h2').innerText = ('Game Ready. Player 1 turn.');\n}", "function startGame() {\n gameState.active = true;\n resetBoard();\n gameState.resetBoard();\n\n var activePlayer = rollForTurn();\n \n // Game has started: enable/disable control buttons accordingly.\n btnDisable(document.getElementById('btnStart'));\n btnEnable(document.getElementById('btnStop'));\n\n var showPlayer = document.getElementById('showPlayer');\n showPlayer.innerHTML = activePlayer;\n showPlayer.style.color = (activePlayer === \"Player 1\") ? \"blue\" : \"red\";\n // The above line, doing anything more would require a pretty sizeable refactor.\n // I guess I could name \"Player 1\" with a constant.\n}", "function showLobby() {\n battlefield.innerHTML = '';\n gamesList.classList.remove('hidden');\n updateBtn(actionBtn, ACTION_BTN.CREATE_GAME);\n resetHeader();\n }", "function getName() {\n applicationState.user = userName.value;\n document.getElementById(\n \"userinfo\"\n ).innerHTML = `welcome ${applicationState.user}`;\n applicationState.gameStart = true;\n startTime = Date.now();\n}", "function start(){\n c.style.display = \"none\"\n d.style.display = \"block\"\n document.querySelector(\"#user\").innerHTML= name + \" :\"\n}", "function initiateGame(){\n\n\t$( document ).ready( function() {\n\t\t\n\t\t$( '#display' ).html('<button>' + 'start' + '</button>');\n\t\t$( '#display' ).attr('start', 'start');\n\t\t$( '#display' ).on( 'click', function() {\n\t\t\trenderGame();\n\t\t})\n\t\t\n\t});\n}", "static startGameOnClick(){\n $('#imageIndex').on('click', function(event){\n var imageId = parseInt(event.target.id.replace(\"image\", \"\"))\n let userName = $('#username').val()\n userName === \"\" ? userName = \"Guest\" : userName\n startGame(imageId, userName)\n })\n }", "function newGameUser() {\n var btn = document.getElementById(\"testName\");\n btn.addEventListener(\"click\", function() {\n userName = this.form.username.value;\n changeUserText(userName);\n this.form.username.value = \"\";\n testLocal();\n });\n}", "function startGame()\r\n{\r\n // alert(\"The last straw \");\r\n\r\n isGameEnded = false ;\r\n playerName = prompt (\"What's your name ? \",\"Paul Tibbets\");\r\n statusMessage = \"Welcome, \"+playerName+\"!\" ;\r\n updateStatusMessage(statusMessage, 1) ;\r\n document.getElementById(\"name1\").innerHTML = playerName+\"'s Caption\" ;\r\n /* Empty the board contents */\r\n emptyBoard();\r\n\r\n /* Place the board at random for both computer and player */\r\n placeBoard();\r\n\r\n statusMessage = \"Hit me with your best shot, \"+playerName;\r\n updateStatusMessage(statusMessage, 2) ;\r\n\r\n}", "function GameUI() {}", "function screenPlayers()\n{\n\tshowScreen(\"players_choice\", \"Choix des joueurs\", function()\n\t{\n\t\tnbPlayers = 0;\n\n\t\tplayersList = [];\n\n\t\tdelete teamId;\n\n\t\tshowNext(\"Comptage\", function()\n\t\t{\n\t\t\tconsole.log(\"Go vers le comptage !!!\");\n\t\t});\n\n\t\t$.ajax(\n\t\t{\n\t\t\turl: serverUrl + \"queries.php\",\n\t\t\ttype: \"POST\",\n\t\t\tcache: false,\n\t\t\tdata:\n\t\t\t{\n\t\t\t\tfunc: \"get_user\"\n\t\t\t}\n\t\t}).done(function(data)\n\t\t{\n\t\t\tvar users = eval(data);\n\n\t\t\tvar slide = $(\"<div></div>\").attr(\"id\", \"users_slide\");\n\n\t\t\tvar currentDiv = $(\"<div></div>\");\n\n\t\t\tfor(var user in users)\n\t\t\t{\n\t\t\t\tif(user % 6 == 0 && user != 0)\n\t\t\t\t{\n\t\t\t\t\tslide.append(currentDiv);\n\n\t\t\t\t\tcurrentDiv = $(\"<div></div>\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tcurrentDiv.append(userSwitch(users[user]));\n\t\t\t}\n\n\t\t\tslide.append(currentDiv);\n\n\t\t\t$(\".wrapper\").append(slide);\n\n\t\t\t$(\"#users_slide\").slick(\n\t\t\t{\n\t\t\t\tdots: true,\n\t\t\t\tinfinite: false\n\t\t\t});\n\n\t\t\taddUserClickAction();\n\n\t\t\tvar usersChoiceButtons = $(\"<div></div>\").attr(\"id\", \"users_choice_buttons\");\n\n\t\t\tvar ajouterButton = button(\"\").addClass(\"invisible\");\n\n\t\t\tvar commencerButton = button(\"Commencer\").attr(\"id\", \"commencer\").addClass(\"disable\");\n\n\t\t\tusersChoiceButtons.append($(\"<div></div>\").append(ajouterButton));\n\n\t\t\tusersChoiceButtons.append($(\"<div></div>\").append(commencerButton));\n\n\t\t\t$(\".wrapper\").append(usersChoiceButtons);\n\n\t\t\thideLoader();\n\t\t});\n\t});\n}", "function gamestart() {\n\t\tshowquestions();\n\t}", "function initGame(){\n gamemode = document.getElementById(\"mode\").checked;\n \n fadeForm(\"user\");\n showForm(\"boats\");\n \n unlockMap(turn);\n \n player1 = new user(document.user.name.value);\n player1.setGrid();\n \n turnInfo(player1.name);\n bindGrid(turn);\n}", "startGame() {\r\n\t\tthis.board.drawHTMLBoard();\r\n\t\tthis.activePlayer.activeToken.drawHTMLToken();\r\n\t\tthis.ready = true;\r\n\t}", "function playersOnClick () {\n module.exports.internal.stateManager.showState('main-branch', 'pick-a-player')\n}", "function startGame() {\n showGuessesRemaining();\n showWins();\n}", "function startGame() {\n console.log('start button clicked')\n $('.instructions').hide();\n $('.title').show();\n $('.grid_container').show();\n $('.score_container').show();\n $('#timer').show();\n // soundIntro('sound/Loading_Loop.wav');\n }", "function startGame() {\n //hide the deal button\n hideDealButton();\n //show the player and dealer's card interface\n showCards();\n //deal the player's cards\n getPlayerCards();\n //after brief pause, show hit and stay buttons\n setTimeout(displayHitAndStayButtons, 2000);\n }", "function start_game(){\r\n if(name_input.value==\"\"){\r\n enter_name_alert.style=\"visibility: visible;\"\r\n }\r\n else{\r\n enter_name_alert.style=\"visibility: hidden;\"\r\n first_layer.style.display=\"none\"\r\n user_name.innerHTML=name_input.value+' <i class=\"fa fa-gamepad\" aria-hidden=\"true\"></i>'\r\n }\r\n}", "function startGame() {\n setMessage(player1 + ' gets to start.');\n}", "function startGame() {\n\t\tstatus.show();\n\t\tinsertStatusLife();\n\t\tsetLife(100);\n\t\tsetDayPast(1);\n\t}", "function changeUser() {\n var choice = Math.floor(Math.random() * name.length);\n document.getElementById(\"user\").innerHTML = name[choice];\n document.getElementById(\"userBtn\").innerHTML = name[choice];\n document.getElementById(\"userDrop\").innerHTML = name[choice];\n drawTextAndResize(name[choice]);\n}", "function showButtons() {\n // when users are not connected, we want start game button disabled\n // document.getElementById('start-game').style.display = 'inline';\n\n document.getElementById('button-invite').style.display = 'inline';\n // document.getElementById('button-preview').style.display = 'inline';\n document.getElementById('grab-username').style.display = 'inline';\n document.getElementById('username').style.display = 'inline';\n document.getElementById('invite-to').style.display = 'inline';\n\n // document.getElementById('end-call').style.display = 'none';\n\n // ensure that local media removes on firefox\n $('#local-media > video').remove();\n }", "function startGame() {\n createButtons();\n const cards = createCardsArray();\n appendCardsToDom(cards);\n}", "function startGame() {\n setMessage(\"Select an opponent above\");\n}", "function menu() {\n\t\n // Title of Game\n title = new createjs.Text(\"Poker Room\", \"50px Bembo\", \"#FF0000\");\n title.x = width/3.1;\n title.y = height/4;\n\n // Subtitle of Game\n subtitle = new createjs.Text(\"Let's Play Poker\", \"30px Bembo\", \"#FF0000\");\n subtitle.x = width/2.8;\n subtitle.y = height/2.8;\n\n // Creating Buttons for Game\n addToMenu(title);\n addToMenu(subtitle);\n startButton();\n howToPlayButton();\n\n // update to show title and subtitle\n stage.update();\n}", "function win () { \n style = { font: \"65px Arial\", fill: \"#fff\", align: \"center\" };\n game.add.text(game.camera.x+325, game.camera.y+150, \"You Win!\", style);\n button = game.add.button(game.camera.x+275, game.camera.y+250, 'reset-button', actionOnResetClick, this);\n button = game.add.button(game.camera.x+475, game.camera.y+250, 'contact-button', actionOnContactClick, this); \n // The following lines kill the players movement before disabling keyboard inputs\n player.body.velocity.x = 0;\n setTimeout(game.input.keyboard.disabled = true, 1000); \n // Plays the victory song \n victory.play('');\n // When the Reset button is clicked, it calls this function, which in turn calls the game to be reloaded.\n // Here we display the contact and replay button options, calling either respective function\n function actionOnResetClick () {\n gameRestart();\n }\n\n // When the contact button is clicked it redirects through to contact form\n function actionOnContactClick () {\n\n window.location = (\"/contacts/\" + lastName)\n \n } \n }", "function startGame(){\n\t$( \"#button_game0\" ).click(function() {selectGame(0)});\n\t$( \"#button_game1\" ).click(function() {selectGame(1)});\n\t$( \"#button_game2\" ).click(function() {selectGame(2)});\n\tloadRound();\n}", "function displayStart(){\n\t// Display game start button again\n\t$('#game').append(\"<div id='start'></div>\");\n\t$(\"#start\").unbind();\n\t$(\"#start\").click(startGame);\n\t// Play main theme song again\n\tmarioGame.audMainTheme.play();\n}", "function switchToGameBoard(){\n\t\tif(userlist.length === 0){\n\t\t\tturnService.showWaitingAlert();\n\t\t}\n\t\t$userLoginArea.hide();\n\t\t$pageWrapper.show();\n\t\t$currentPhrase.hide();\n\t}", "function startGame() {\n \n $(\"#start-button\").html(\"<button id='btn-style'>Start Game</button>\");\n $(\"#start-button\").on('click', function () {\n $(\"#start-button\").remove();\n startTimer();\n getQuestion();\n });\n }", "function startScreen() {\n\tdraw();\n\tif(usuario_id !== -1)\n\t\tstartBtn.draw();\n}", "function startGame() {\n\t\ttheBoxes.innerText = turn;\n\t\twinner = null;\n\t}", "function startGame() {\n\tvar serverMsg = document.getElementById('serverMsg');\n\tdocument.getElementById('print').disabled = false;\n\tserverMsg.value += \"\\n> all players have joined, starting game, wait for your turn...\"\n\tdocument.getElementById('rigger').style.display = \"none\";\n}", "function joined(e) {\n userId = e.id;\n $('#controls').show();\n startPrompts();\n}", "function startGame() {\n\n game.updateDisplay();\n game.randomizeShips();\n $(\"#resetButton\").toggleClass(\"hidden\");\n $(\"#startButton\").toggleClass(\"hidden\");\n game.startGame();\n game.updateDisplay();\n saveGame();\n}", "function updateStartGameButtonVisibility() {\n //find out if current user is the creator\n var isCreator = (gameInfo.username === gameInfo.gameID);\n //get number of players\n var numPlayers = gameInfo.currentPlayers.length;\n\n if (isCreator && (numPlayers >= minNumberOfPlayers)) {\n //this is the game creator and there are enough players. Show start game option\n $(\"#startGameButton\").show();\n } else {\n //hide or keep hidden the startGameButton in all other cases\n $(\"#startGameButton\").hide();\n }\n}", "function startNewGame(text){\n\n\t//console.log('start new game!');\n\n\ttext.destroy();\n\n\t//not very elegant but it does the job\n\tvar playerName = prompt(\"What's your name?\", \"Cloud\");\n\n\t//store player name in cache to be shown on in-game HUD\n\tlocalStorage.setItem(\"playerName\", playerName);\n\n\tthis.game.state.start('Game');\n}", "function startGameButton() {\r\n\tif(table != undefined) {\r\n\t\ttable.startGame();\r\n\t}\r\n}", "function login() {\n Player.name = $(\"#login_name\").val();\n $(\"#console\").hide();\n start_game();\n}", "function beginApp() {\n console.log('Please build your team');\n newMemberChoice();\n}", "function getFirstPlayer(){\n var firstRound = (Math.floor(Math.random() * 10) + 1)%2;\n turnsPlayer = turnsPlayer + firstRound;\n //display the current turn:\n if (turnsPlayer%2 == 0){\n currentPlayer = user.userx.name;\n } else {\n currentPlayer = user.usero.name;}\n $(\"#button2\").on(\"click\", function(){\n $(\"p\").text(\"Player \" + currentPlayer + \"'s turn\");\n });\n }", "function populatepage(){\n \n document.getElementById('signedNamePlace').innerHTML = \"User: \";\n document.getElementById('signedName').innerHTML = username;\n document.getElementById('firstbtn').style.visibility = \"visible\";\n document.getElementById('simplebtn').style.visibility = \"visible\";\n}", "function handleStartClick() {\n toggleButtons(true); // disable buttons\n resetPanelFooter(); // reset panel/footer\n\n for (let id of ['player-panel', 'ai-panel', 'enemyboard', 'ai-footer', 'player-footer']) {\n document.getElementById(id).classList.remove(\"hidden\");\n }\n\n game = new Game(settings.difficulty, settings.playerBoard);\n game.start();\n}", "update() {\n this.nameText.text = 'Submit Name to Leaderboard:\\n ' + this.userName + '\\n(Submits on New Game)';\n\n }", "function initializeGame(){\n if (typeof playerOne === \"undefined\"){\n $(\"section#game-section .game .game-wrapper\").text(\"Player One to Sign Up\");\n\n }else if(typeof playerTwo === \"undefined\") {\n $(\"section#game-section .game .game-wrapper\").text(\"Player Two to Sign Up\");\n }else{\n $(\"section#game-section .game .game-wrapper\").text(\"Game will start shortly \");\n $(\"section#game-section .game .game-wrapper\").append(playerTwo.name+' vs '+playerOne.name);\n startGame();\n assignStartTurn();\n }\n}", "function aboutGame(){\n\tvar temp=\"\";\n\tvar img=\"\";\n\tvar Title=\"\";\n\t/// if we clicked on about the game formate about game text \n\tif(this.id === 'abutBtn'){\n\t\ttemp =window.gameInformation['abutBtn'];\n\t\timg='\\rrecources\\\\AF005415_00.gif';\n\t\tTitle=\" Game General Information \";\n\n\t}////// if we clicked on about the game formate about auther text \n\telse if(this.id === 'abouMe'){\n\t\ttemp =window.gameInformation['abouMe'];\n\t\timg='\\rrecources\\\\viber_image_2019-09-26_23-29-08.jpg';\n\t\tTitle=\" About The Auther\";\n\t}// formatting Text For Instructions\n\telse if(this.id === 'Instructions')\n\t{\n\t\ttemp =window.gameInformation['Instructions'];\n\t\timg='\\rrecources\\\\keyboard-arrows-512.png';\n\t\tTitle=\" Instructions\";\n\t}\n\n\t// create the dialog for each button alone\n\tcreatDialog(Title , temp ,img,300 );\n\t\n}", "function startGame() {\n const usernameField = document.querySelector(\".username-field\");\n playerName = usernameField.value;\n hideGameIntroModal();\n fetch(\"headlines.json\")\n .then(response => response.json())\n .then(data => selectStories(data));\n}", "function main() {\r\n rock_div.addEventListener(\"click\", () => {\r\n game(\"r\");\r\n resetUserRPS();\r\n showUserRock_div.style.display = \"block\";\r\n checkWhoWon();\r\n });\r\n paper_div.addEventListener(\"click\", () => {\r\n game(\"p\");\r\n resetUserRPS();\r\n showUserPaper_div.style.display = \"block\";\r\n checkWhoWon();\r\n });\r\n scissors_div.addEventListener(\"click\", () => {\r\n game(\"s\");\r\n resetUserRPS();\r\n showUserScissors_div.style.display = \"block\";\r\n checkWhoWon();\r\n });\r\n\r\n}", "function display() {\n\n doSanityCheck();\n initButtons();\n}", "function initialize() {\n $(\"#begin-btn\").html(\"<button id='start-btn'> START GAME </button>\");\n\n }", "function startGame() {\n startButton.classList.add(\"hide-content\");\n resetButton.classList.remove(\"hide-content\");\n $(\"#turnsTaken\").text(\"0\");\n originalColor();\n beginGame();\n}", "function selectTypeGame(){\r\n\r\n inputs.forEach(input => input.value = \"\");//clean all imputs\r\n //if the user want to play with other user\r\n if(this.id === '2user'){\r\n //run the btnGame's logic\r\n containerModeGame.style.display = 'none';\r\n containerForm.style.display = 'block';\r\n\r\n //if the user want to play with the computer\r\n }else if(this.id === 'computerUser'){\r\n const userSelects = document.querySelectorAll('.userSelect');//btns X or O\r\n const userPrime = document.getElementById('userPrime');// input user name\r\n \r\n containerModeGame.style.display = 'none';\r\n containerPlayWithComputer.style.display = 'block'\r\n\r\n \r\n userSelects.forEach(userSelect => userSelect.addEventListener('click',(e)=>{\r\n \r\n if(userPrime.value.length === 0){//checks if the input is empty\r\n \r\n userPrime.parentNode.lastElementChild.textContent = 'User name cannot be empty';// write the message in the div\r\n //input.parentNode.lastElementChild.classList.add('alert');//add the alert class to the div\r\n\r\n userPrime.classList.add('input-alert');//add the input-alert class to the input\r\n\r\n } else {\r\n \r\n value1 = e.target.id === 'userX'? 'X':'O';\r\n value2 = value1 === 'X'? 'O':'X';\r\n\r\n //creating the user objects\r\n user1V = Object.assign(user1V,newUser(userPrime.value,true,value1));\r\n user2V = Object.assign(user2V,newUser('Computer',false,value2));\r\n\r\n \r\n containerPlayWithComputer.style.display = 'none';\r\n containerGame.style.display = 'block';\r\n\r\n //call the game; gameTicTacToe it's a module now \r\n const gameTicTacToe = game();\r\n\r\n\r\n gameTicTacToe.newGrid();\r\n gameTicTacToe.renderGrid();\r\n \r\n }\r\n\r\n \r\n }))\r\n\r\n }\r\n}", "function initGame() {\n correctGuesses = 0;\n incorrectGuesses = 0;\n gameInProgress = false;\n $(\"#gameStart\").html(\"<button>\" + \"START\" + \"</button>\")\n .click(playGame);\n}", "function game() {\n document.querySelector(\"#gameStartModal\").style.display = \"none\";\n document.querySelector(\"#header section#level\").style.display = \"block\";\n document.querySelector(\"#header section#start\").style.display = \"block\";\n init();\n // The game loop.\n update();\n}", "function startGame() {\r\n\r\n\tvar playerName = document.getElementById(\"playername\").value;\r\n\t\r\n\tif (playerName == \"\") {\r\n\t\treturn false;\r\n\t}else{\r\n\t\r\n\t\t// Store player name in pName variable\r\n\t\tpName = playerName;\r\n\t\t// Remove display of the intro screen\r\n\t\tdocument.getElementById(\"intro\").style.display = \"none\";\r\n\t\t// Add event listeners controls\r\n\t\taddControls();\r\n\t\t//Sounds.moon.play();\r\n\t}\r\n\r\n\r\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 startNewGame(evt) {\n 'use strict';\n document.getElementById(\"gameDiv\").innerHTML = \"\";\n var menuDiv = document.getElementById(\"menuControls\");\n \n /* Variables for current player & last play to reset */\n var lastPlayDisplay = document.getElementById(\"lastPlayMade\");\n var currentPlayerDisp = document.getElementById('currentPlayer');\n lastPlayDisplay.innerHTML = \"\";\n currentPlayerDisp.innerHTML = \"\";\n \n menuDiv.innerHTML = \"<button id=\\\"startGameBtn\\\" type=\\\"button\\\">Start Game</button>\";\n document.getElementById(\"gameStatus\").style.display = \"none\";\n \n var newGameEntry = document.getElementById(\"userEntry\");\n newGameEntry.innerHTML = \"Player One Designation: <input id=\\\"plyrOneName\\\" type=\\\"text\\\" name=\\\"playerOneName\\\" value=\\\"Player One\\\"/><br/>\";\n newGameEntry.innerHTML += \"Player Two Designation: <input id=\\\"plyrTwoName\\\" type=\\\"text\\\" name=\\\"playerTwoName\\\" value=\\\"Player Two\\\"/><br/>\";\n \n var plyrOneName = document.getElementById(\"plyrOneName\");\n var plyrTwoName = document.getElementById(\"plyrTwoName\");\n addHandler(plyrOneName, 'input', playerNameChange);\n addHandler(plyrTwoName, 'input', playerNameChange);\n \n var startGameBtn = document.getElementById(\"startGameBtn\");\n addHandler(startGameBtn, 'click', generateGameGrid);\n}", "function startGame() {\n\t$(\"#start-button\", \"#menu\").click(function(){\n\t\tif (sess_token == null) {\n\t\t\treturn;\n\t\t}\n\t\tbutton_lock = true;\n\t\tdocument.getElementById(\"question-answer-container\").style.visibility = \"visible\";\n\t\tdocument.getElementById(\"stats\").style.visibility = \"visible\";\n\t\tdocument.getElementById(\"menu\").style.visibility = \"hidden\";\n\t\tdocument.getElementById(\"reset-button\").style.visibility = \"visible\";\n\t\tgetQuestion(\"easy\");\n\t}); \n}", "function startGame() {\n let gameBoard = document.getElementById('gameBoard');\n let tutorial = document.getElementById('tutorial');\n gameBoard.style.display = \"block\";\n tutorial.style.display = \"none\";\n addGround();\n addTree(treeCenter, trunkHeight);\n addBush(bushStart);\n addStones(stoneStart);\n addCloud(cloudStartX, cloudStartY);\n addingEventListenersToGame();\n addingEventListenersToTools();\n addInventoryEventListeners()\n}", "function NewGame() {\n\t// Your code goes here for starting a game\n\tprint(\"Complete this method in Singleplayer.js\");\n}", "function onBoardClick() {\n if (!hasStarted) {\n startGame();\n } else {\n startPause();\n }\n }", "function createUser (){\n\t//create user and get names from the user\n\tuser.townName = document.getElementById('townName').value;\n\tuser.character = document.getElementById('charName').value;\n\n\t//hide the user creation div and show the output div\n\t\n\tdocument.getElementById('outputDiv').style.display='block';\n\tdocument.getElementById('descriptionDiv').style.display='block';\n\tdocument.getElementById('textEntryDiv').style.display='block';\n\tdocument.getElementById('inputDiv').style.display='none';\n \n\t//Inititalize stuff\n\tclear();\n\tcreateItems();\n\tcreatePeople();\n\tcreateLocations();\n\tconnectLocations();\n\tgoTo(downtown); //Start the user in this location\n\t\n\t//Welcome the user\n\tdocument.getElementById('outputDiv').innerHTML=\n\t'Welcome to ' + user.townName + ', have fun playing our game ' + user.character + '! ' + user.townName + ' is divided into three sections Uptown, the Shopping District, and Downtown.';\n }", "function startGame(){\n\t\tfor (var i=1; i<=9; i=i+1){\n\t\t\tclearBox(i);\n\t\t}\n\t\tdocument.turn = \"X\";\n\t\tif (Math.random()<0.5) {\n\t\t\tdocument.turn = \"O\";\n\t\t}\n\t\tdocument.winner = null;\n\t// This uses the \"setMessage\" function below in order to update the message with the contents from this function\n\t\tsetMessage(document.turn + \" gets to start.\");\n\t}", "function displayUI() {\n /*\n * Be sure to remove any old instance of the UI, in case the user\n * reloads the script without refreshing the page (updating.)\n */\n $('#plugbot-ui').remove();\n\n /*\n * Generate the HTML code for the UI.\n */\n $('#chat').prepend('<div id=\"plugbot-ui\"></div>');\n var cWoot = autowoot ? \"#3FFF00\" : \"#ED1C24\";\n var cQueue = autoqueue ? \"#3FFF00\" : \"#ED1C24\";\n var cHideVideo = hideVideo ? \"#3FFF00\" : \"#ED1C24\";\n var cUserList = userList ? \"#3FFF00\" : \"#ED1C24\";\n $('#plugbot-ui').append(\n '<p id=\"plugbot-btn-woot\" style=\"color:' + cWoot + '\">auto-woot</p><p id=\"plugbot-btn-queue\" style=\"color:' + cQueue + '\">auto-queue</p><p id=\"plugbot-btn-hidevideo\" style=\"color:' + cHideVideo + '\">hide video</p><p id=\"plugbot-btn-userlist\" style=\"color:' + cUserList + '\">userlist</p><h2 title=\"This makes it so you can give a user in the room a special colour when they chat!\">Custom Username FX: <br /><br id=\"space\" /><span onclick=\"promptCustomUsername()\" style=\"cursor:pointer\">+ add new</span></h2>');\n}", "function renderPlayer(){\n console.log('in renderPlayer')\n let text;\n if (!state.players[0] || !state.players[1]){\n text = `\n <input name=\"player1\" placeholder=\"Enter Player 1\">\n <input name=\"player2\" placeholder=\"Enter Player 2\">\n <button class=\"start\">Start Game</button>\n `\n } else {\n text = `${state.getCurrentPlayer()} place a token!`\n }\n playerTurn.innerHTML= text;\n }", "static showGame() {\n document.getElementById('js-player-selection').style.display = 'none';\n document.getElementById('js-game-info').style.display = 'block';\n }", "showStartButton() {\n let startButton = document.createElement(\"button\");\n startButton.innerHTML = \"Start\";\n startButton.addEventListener(\"click\", function () {\n game.deleteStartButton();\n game.showTitle();\n game.showReply();\n game.showForm();\n });\n startButton.classList.add(\"start\");\n this.main.appendChild(startButton);\n }", "function startGame(player1Name, player2Name, difficultySetting) {\n window.scoreboard = new Scoreboard(player1Name, player2Name, difficultySetting); \n window.gameboard = new Gameboard(difficultySetting); \n window.clickToPlay = new ClickToPlay(player1Name, player2Name, difficultySetting);\n $('#grid-container-body').removeClass('hide');\n setTimeout(hideWelcomeModal, 500);\n }", "function beginGame() {\n gameConsole.innerHTML = \"\";\n\n// Prompt player name\nplayer1Name = prompt('Please input your name');\n\n// and change it in the HTML\n document.getElementById('player-1-name').innerHTML = player1Name;\n\n// explain the rules for the opening puzzle\n gameConsole.innerHTML = 'Thanks ' + player1Name + '. The opening puzzle will begin. There will be one word up above that will fill in slowly. Click the buzzer of the opportunity to guess correctly. A correct guess will net you 50 points, and control of the first board. Guessing incorrectly will give the opponent the points and control. Good luck, and click the start button to begin.';\n\n// modify the start button to initialize the pizzle as oppose to beginning the game\n\tappendOutputConsole('div', '<button class=\"continue-button\" onclick=\"firstPuzzleStart()\">Begin first Puzzle</button>', 'flex-container justify-center');\n}", "function startGame() {\n printStats();\n console.log(\"Game Started\");\n getGamePick();\n console.log(gPick);\n document.getElementById('Title').innerHTML=\"Great, now it is you turn pick a letter a-z\"; \n }", "function clickToStart(){\n if (gameStarted === false) {\n $(\"#win-count\").text(wins);\n $(\"#loss-count\").text(wins);\n $(\"#win-header\").text(\"wins\");\n $(\"#loss-header\").text(\"losses\");\n $(\"#number-to-guess\").text(targetNumber);\n $(\"#userCounter\").text(counter);\n $(\"#clickToStart\").addClass(\"isHidden\");\n generateRupees();\n gameStarted = true;\n } \n \n }", "function gameStart(){\n\t\tplayGame = true;\n\t\tmainContentRow.style.visibility = \"visible\";\n\t\tscoreRow.style.visibility = \"visible\";\n\t\tplayQuitButton.style.visibility = \"hidden\";\n\t\tquestionPool = getQuestionPool(answerPool,hintPool);\n\t\tcurrentQuestion = nextQuestion();\n}", "function displayPlayer(turn, player) {\n turn.html('It is player '+player+'\\'s turn');\n }", "function displayPlayers() {\n $('#userNameBox').text(human.name)\n $('#userSymbolBox').text(human.symbol)\n $('#compNameBox').text(ai.name)\n $('#compSymbolBox').text(ai.symbol)\n}", "displayBoard(message) {\n $('.menu').css('display', 'none');\n $('.gameBoard').css('display', 'block');\n $('#userHello').html(message);\n this.createGameBoard();\n }", "function start(){\n //hide game and error message\n document.getElementById(\"error-message\").classList.add(\"hidden\");\n document.getElementById(\"game\").classList.add(\"hidden\");\n\n //add event listener to start button to trigger game\n\tvar start = document.getElementById(\"intro\").firstChild.nextSibling;\n start.addEventListener('click', game);\n}", "function showLoggedInUser(user) {\n login_status.text(\"Logged in as: \" + user.profile.name);\n login_button.text(\"Logout\");\n }", "function startGame() {\n $controls.addClass(\"hide\");\n $questionWrapper.removeClass(\"hide\");\n showQuestion(0, \"n\");\n points();\n}", "create () {\n var background = this.game.add.sprite(0, 0, 'space');\n background.height = this.game.height;\n var button = this.game.add.button(this.game.world.centerX - 100, 100, 'start', start,this);\n button.angle = -30;\n\n this.userName = ''; //Initializes name\n \n \n var scoreText = this.game.add.text(0, 500, 'You Lost!', {fontsize: '32px', fill: '#ffffff', boundsAlignH: \"center\"});\n scoreText.text = \"You Lost! Score: \" + this.scoreValue + \"\\n(Click Alex's face or \\npress enter to play again)\";\n scoreText.setTextBounds(0, 100, 800);\n\n this.nameText = this.game.add.text(200, 800, 'Submit Name to Leaderboard: \\n(Enter to Submit)', {fontsize: '32px', fill: '#ffffff'});\n //Retrieve keyboard presses from the player\n this.game.input.keyboard.addCallbacks(this, null, null, keyPress);\n this.textInput = this.game.add.text(this.game.world.centerX + 5, 575, \"\", {\n font: \"28px Arial\",\n fill: \"#000\",\n align: \"center\"\n });\n this.textInput.setText(this.textInput.text);\n this.textInput.anchor.setTo(0.5, 0.5);\n\n function keyPress(char) {\n this.userName += char;\n }\n\n //Keys for backspace and enter\n this.deleteKey = this.game.input.keyboard.addKey(Phaser.Keyboard.BACKSPACE);\n this.enterKey = this.game.input.keyboard.addKey(Phaser.Keyboard.ENTER);\n this.game.input.keyboard.addKeyCapture([ Phaser.Keyboard.BACKSPACE, Phaser.Keyboard.ENTER ]);\n\n //Detect backspaces when typing the name\n this.deleteKey.onDown.add(deleteText, this);\n\n //allows user to delete characters\n function deleteText() {\n if (this.userName !== '') {\n this.userName = this.userName.slice(0, this.userName.length - 1);\n }\n }\n\n //Detect Enter when typing the name\n this.enterKey.onDown.add(start, this);\n\n\n //Send to Firebase Here\n function start() {\n if (this.userName === '') {\n this.userName = 'Alex';\n }\n var newScore = {ScoreValue: this.scoreValue, UserName: this.userName};\n scoresData.push(newScore);\n\n this.userName = '';\n this.state.start('Game');\n }\n }", "function startGame()\n{\n\tcreateDeck();\n\tshuffleDeck();\n\tcreatePlayers(2);\n\n\tdrawCard(0, 0);\n\tdrawCard(1, 0);\n\tdrawCard(0, 0);\n\tdrawCard(1, 0);\n\n\n\n\tdisplayCards();\n\tdisplayOptions();\n}", "display(title) {\r\n this.title.html(title);\r\n this.title.position(130, 0);\r\n if (this.playButton, this.inputbox) {\r\n this.inputbox.position(130, 160);\r\n\r\n this.playButton.position(250, 200);\r\n\r\n this.playButton.mousePressed(() => {\r\n this.inputbox.hide();\r\n this.playButton.hide();\r\n playerObj.name = this.inputbox.value();\r\n gameState = 1;\r\n this.greeting.html(\"Welcome \" + playerObj.name);\r\n this.greeting.position(200, 250);\r\n });\r\n }\r\n }", "function startGame() {\n\tdisplayCharacterStats(null);\n\n\treturn;\n}", "function startGame() {\n createButtons();\n createCards();\n}", "function startGame() {\n createButtons();\n createCards();\n}" ]
[ "0.7060195", "0.69904566", "0.6753309", "0.67526233", "0.6736144", "0.6704425", "0.6685465", "0.6605404", "0.6598817", "0.65951693", "0.6560461", "0.6552254", "0.6488314", "0.643916", "0.6436459", "0.64232516", "0.6409647", "0.64065343", "0.63825643", "0.6379045", "0.63708436", "0.6370226", "0.636862", "0.63607436", "0.6357959", "0.63534826", "0.6349537", "0.6348982", "0.6348081", "0.63307804", "0.63221186", "0.6312787", "0.63052195", "0.6274072", "0.6273557", "0.627056", "0.626817", "0.6258369", "0.62577057", "0.62523013", "0.6245355", "0.624461", "0.6244116", "0.62432176", "0.6242727", "0.6241053", "0.62401044", "0.6236445", "0.62350374", "0.62110585", "0.62094885", "0.62046367", "0.6195412", "0.6190015", "0.6189687", "0.61886764", "0.618367", "0.61740756", "0.6170647", "0.6169018", "0.61642224", "0.615962", "0.6155498", "0.6153345", "0.61286783", "0.61183363", "0.6112383", "0.6112109", "0.60887426", "0.6084684", "0.60811573", "0.6080434", "0.6079071", "0.60770404", "0.60769236", "0.60590094", "0.6057191", "0.6051124", "0.6051035", "0.604712", "0.60445327", "0.60384655", "0.60379666", "0.60320526", "0.6031776", "0.6028703", "0.6027233", "0.60203093", "0.60193646", "0.60178494", "0.6015291", "0.6013153", "0.60045534", "0.5992698", "0.5986002", "0.5985172", "0.5981141", "0.5979924", "0.59776825", "0.59776825" ]
0.59898114
94
Choose to eat at a fancy restaurant or a fastfood restaurant.
function startFunction() { title.innerText = ""; subTitle.innerText = subTitleIntro; firstButton.innerText = "fancy restaurant"; secondButton.classList.remove("hidden"); secondButton.innerHTML = "fastfood restaurant"; firstButton.onclick = function() { regretFancyRestaurantOption(); } secondButton.onclick = function() { regretFastFoodRestaurantOption(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFastRestaurantChoice() {\n /** @type {HTMLInputElement} Input field. */\n const fastDishInput = document.getElementById(\"fast-input\").value;\n const fastfoodMenu = [\"cheeseburger\", \"doubleburger\", \"veganburger\"]\n\n if(fastDishInput == fastfoodMenu[0]) {\n restaurantClosing();\n } else if (fastDishInput == fastfoodMenu[1]) {\n restaurantClosing();\n } else if (fastDishInput == fastfoodMenu[2]) {\n restaurantClosing();\n } else {\n fastFoodRestaurantScene();\n }\n}", "function handleFancyRestaurantChoice() {\n /** @type {HTMLInputElement} Input field. */\n const dishInput = document.getElementById(\"dish-input\").value;\n const fancyMenu = [\"pizza\", \"paella\", \"pasta\"]\n\n if(dishInput == fancyMenu[0]) {\n restaurantClosing();\n } else if (dishInput == fancyMenu[1]) {\n restaurantClosing();\n } else if (dishInput == fancyMenu[2]) {\n restaurantClosing();\n } else {\n fancyRestauratMenu();\n }\n}", "function randomFood() {\n\n\t\tif (Math.random() > 0.5) {\n\t\t\treturn 'pizza';\n\t\t} \n\t\treturn 'ice cream';\n\t}", "function whatDidYouEat(food) {\n var outcome;\n switch (food) {\n case \"beans\":\n outcome = \"gas attack\";\n break;\n case \"salad\":\n outcome = \"safe and sound\";\n break;\n case \"mexican\":\n outcome = \"diarrhea in 30 minutes\"\n break;\n default:\n outcome = \"please enter valid food\";\n }\n return outcome;\n}", "function checkFood(food){\n\tvar food = [\"chicken\", \"beef\", \"fish\", \"lamb\", \"veal\"];\n\n\t//The first term starts with 0\n\n\tif(food == food[0] || food == food[1] || food == food[2] || food == food[3] || food == food [4]){\n\t\talert(\"You are considered as meat\");\n\t}else{\n\t\talert(\"You may or may not be considered as meat\");\n\t//if chicken, beef, fish, lamb or veal is entered, then a popup will appaer with \"You are considered as meat\"\n\t//if something else is entered, then a popup will appear saying \"you may or may not be considered as meat\"\t\n\t}\n}", "function findTheCheese (foods) {\n\n for (var i = 0; i < foods.length; i++) {\n\n switch (foods[i]) {\n case \"cheddar\":\n return \"cheddar\"\n break;\n case \"gouda\":\n return \"gouda\"\n break;\n case \"camembert\":\n return \"camembert\"\n break;\n }\n }\n return \"no cheese!\"\n}", "function eat(food)\n\t\t{\n\t\t\t// Add the food's HTML element to a queue of uneaten food elements.\n\t\t\tuneatenFood.push(food.element);\n\n\t\t\t// Tell the fish to swim to the position of the specified food object, appending this swim instruction\n\t\t\t// to all other swim paths currently queued, and then when the swimming is done call back a function that\n\t\t\t// removes the food element.\n\t\t\tFish.swimTo(\n\t\t\t\tfood.position,\n\t\t\t\tFish.PathType.AppendPath,\n\t\t\t\tfunction()\n\t\t\t\t{\n\t\t\t\t\tlet eatenFood = uneatenFood.shift();\n\t\t\t\t\teatenFood.parentNode.removeChild(eatenFood);\n\t\t\t\t\tgrow();\n\t\t\t\t});\n\t\t} // end eat()", "function makeFood(beans, rice) {\n if (beans === 'y' && rice === 'y') {\n console.log('Burrito');\n }\n}", "function setFoodType(type) {\n // This allows us to display items related to the choice on the map but also to style the buttons so the user knows that they have selected something\n if(type === 'kebab') {\n $scope.hammered = 'chosen-emotion';\n $scope.hungover = '';\n $scope.hangry = '';\n $scope.hardworking = '';\n } else if(type === 'cafe') {\n $scope.hammered = '';\n $scope.hungover = 'chosen-emotion';\n $scope.hangry = '';\n $scope.hardworking = '';\n } else if(type === 'fastfood') {\n $scope.hammered = '';\n $scope.hungover = '';\n $scope.hangry = 'chosen-emotion';\n $scope.hardworking = '';\n } else {\n $scope.hammered = '';\n $scope.hungover = '';\n $scope.hangry = '';\n $scope.hardworking = 'chosen-emotion';\n }\n vm.foodType = type;\n }", "selectSoupTomato() {\n I.waitForElement(foodObjects.chooseCup);\n I.tap(foodObjects.chooseCup);\n I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar);\n I.waitForElement(foodObjects.tomatoSoup);\n I.tap(foodObjects.tomatoSoup);\n I.waitForElementLeaveDom(settings.config.helpers.Appium.platform, commonObjects.progressBar);\n }", "function randomFood() {\n\tfor(var i=0; i<3; i++) {\n\t\tvar rfood = Math.floor(Math.random()*food.length);\n\t\tfoods[i].className = 'food';\n\t\tfoods[i].classList.add(food[rfood]);\n\t\tfoods[i].style.top = randomPosition()+\"px\";\n\t\tfoods[i].style.left = randomPosition()+\"px\";\n\t\tcheckEat(pig, foods[i]);\n\t}\n}", "function fruitOrVegetable(product) {\n switch (product) {\n case \"cucumber\":\n case \"pepper\":\n case \"carrot\":\n console.log(\"vegetable\");\n break;\n // TODO: Implement the other cases\n }\n}", "eat() {\r\n let consume = this.food - 2\r\n if (consume > 1) {\r\n this.isHealthy = true\r\n return this.food = consume\r\n } if (consume <= 0) {\r\n this.isHealthy = false\r\n return this.food = 0\r\n }\r\n else if (consume <= 1) {\r\n return this.food = consume\r\n //alert(this.name + \" food supply reached to 0. It's time for a hunt\")\r\n //this.isHealthy = true\r\n }\r\n\r\n }", "generateRestaurant(){\n// we want the user to input the zipcode they want to search, the food type they want to eat\n// and the rating (1-5) \n// getRestaurants()\n\n\n}", "function eatingFood(eatingTime) {\n switch(eatingTime) {\n case 'Breakfast':\n return '07:00';\n case 'Lunch':\n return '13:00';\n default:\n return 'I do not eat';\n }\n}", "pickUpFood() {\n var surTile = this.Survivor.getCurrentTile();\n for (const f of this.foodStock) {\n if (surTile === f.getTile() && f.getActive()) {\n f.setActive(false);\n this.playerFood += this.foodValue;\n this.playerScore += 10;\n }\n }\n }", "function changeRestaurant() {\n if (selectedRestaurant < rRestaurants.length - 1) {\n const next = selectedRestaurant + 1;\n dispatch(setSelectedRestaurant(next));\n } else {\n dispatch(setSelectedRestaurant(0));\n }\n }", "function getRandomMeal() {\n const getMeal = async () => {\n const singleMeal = await getRandom();\n if (singleMeal) setMeal(singleMeal);\n setStatus(true);\n };\n getMeal();\n }", "function eatFood() {\n if (gameState.snakeStart === gameState.food) {\n gameState.snakeLength++;\n\n updateFoodCell(\"remove\", gameState.food);\n\n createFood();\n updateFoodCell(\"add\", gameState.food);\n gameState.score++;\n increaseSpeed();\n showScore();\n return true;\n }\n}", "function eat(snake, food) {\n\tsnake.belly = food.value;\n\tresetFood();\n}", "eat(){\n let head = this.state.snakeDots[this.state.snakeDots.length - 1];\n let food = this.state.food;\n if (head[0] === food[0] && head[1] === food[1]){\n this.setState({\n food : getRandomCo()\n })\n this.increaseB();\n this.SpeedIN();\n }\n }", "function fastFoodMeal(sandwich, side, drink, dessert) {\n \n return {\n sandwich: sandwich,\n side: side,\n drink: drink,\n dessert: dessert,\n }\n}", "function foodClickHandler(foodsitem) {\n setFood(foodsitem);\n }", "function computeFood(inputFood) {\n if (inputFood) {\n inputFood = inputFood.toLowerCase();\n switch (inputFood) {\n case \"italian\": \n parseFood = \"cuisine=italian&\";\n break;\n case \"american\":\n parseFood = \"cuisine=american&\";\n break;\n case \"chicken\": \n parseFood = \"cuisine=chicken&\";\n break;\n case \"burgers\": \n parseFood = \"cuisine=burgers&\";\n break;\n case \"salads\": \n parseFood = \"cuisine=salads&\";\n break;\n case \"sandwiches\": \n parseFood = \"cuisine=sandwiches&\";\n break;\n case \"soups\": \n parseFood = \"cuisine=soups&\";\n break;\n case \"subs\": \n parseFood = \"cuisine=subs&\";\n break;\n case \"chinese\": \n parseFood = \"cuisine=chinese&\";\n break;\n case \"vietnamese\": \n parseFood = \"cuisine=vietnamese&\";\n break;\n case \"pizza\": \n parseFood = \"cuisine=pizza&\";\n break;\n case \"seafood\": \n parseFood = \"cuisine=seafood&\";\n break;\n case \"indian\": \n parseFood = \"cuisine=indian&\";\n break;\n case \"asian\": \n parseFood = \"cuisine=asian&\";\n break;\n case \"diner\": \n parseFood = \"cuisine=diner&\";\n break;\n case \"healthy\": \n parseFood = \"cuisine=healthy&\";\n break;\n case \"irish\": \n parseFood = \"cuisine=irish&\";\n break;\n case \"mediterranean\": \n parseFood = \"cuisine=mediterranean&\";\n break;\n case \"noodles\": \n parseFood = \"cuisine=noodles&\";\n break;\n case \"steak\": \n parseFood = \"cuisine=steak&\";\n break;\n case \"vegetarian\": \n parseFood = \"cuisine=vegetarian&\";\n break;\n }\n }\n}", "function chooseAction() {\n\tinquirer\n\t\t.prompt({\n\t\t\tname: \"action\", \n\t\t\ttype: \"rawlist\", \n\t\t\tmessage: \"What do you want to do?\", \n\t\t\tchoices: [\"VIEW PRODUCTS\", \"VIEW LOW INVENTORY\", \"ADD TO INVENTORY\", \"ADD NEW PRODUCT\", \"QUIT\"]\n\t\t})\n\t\t.then(function(ans) {\n\t\t\tif(ans.action.toUpperCase() ===\"VIEW PRODUCTS\") {\n\t\t\t\tviewProducts(); \n\t\t\t} \n\t\t\telse if (ans.action.toUpperCase() === \"VIEW LOW INVENTORY\") {\n\t\t\t\tviewLowInventory(); \n\t\t\t}\n\t\t\telse if (ans.action.toUpperCase() === \"ADD TO INVENTORY\") {\n\t\t\t\taddInventory(); \n\t\t\t}\n\t\t\telse if (ans.action.toUpperCase() === \"ADD NEW PRODUCT\") {\n\t\t\t\taddNewProduct(); \n\t\t\t}\n\t\t\telse {\n\t\t\t\tendConnection(); \n\t\t\t}\n\t\t})\n}", "async displayFoodChoice(step) {\n const user = await this.userProfile.get(step.context, {});\n if (user.food) {\n await step.context.sendActivity(`Your name is ${ user.name } and you would like this kind of food : ${ user.food }.`);\n } else {\n const user = await this.userProfile.get(step.context, {});\n\n //await step.context.sendActivity(`[${ step.context.activity.text }]-type activity detected.`);\n\n if (step.context.activity.text == 1) {\n user.food = \"European\";\n await this.userProfile.set(step.context, user);\n } else if (step.context.activity.text == 2) {\n user.food = \"Chinese\";\n await this.userProfile.set(step.context, user);\n } else if (step.context.activity.text == 3) {\n user.food = \"American\";\n await this.userProfile.set(step.context, user);\n }else {\n await this.userProfile.set(step.context, user);\n await step.context.sendActivity(`Sorry, I do not understand, please try again.`);\n return await step.beginDialog(WHICH_FOOD);\n }\n\n await step.context.sendActivity(`Your name is ${ user.name } and you would like this kind of food : ${ user.food }.`);\n }\n return await step.beginDialog(WHICH_PRICE);\n //return await step.endDialog();\n}", "function fightOrRun() {\n var choices = [\"Run\", \"Fight\"];\n var askPlayer = parseInt(readline.keyInSelect(choices, \"Do you want to fight like a shark or run like a shrimp???\\nThe next monster might be scarier.\\n \\n What are you going to do? Press 1 to run...Press 2 to fight.\"));\n if (choices === 1) {\n //call the function for deciding to run \n run();\n } else {\n //call the function for deciding to fight\n console.log('You decided to fight, bring it on!!.');\n fight();\n }\n }", "onFood () {\r\n let tilePlants = this.tile.objs.filter(o => o.name === 'plant')\r\n if (tilePlants.length < 1) return false\r\n return tilePlants[0]\r\n }", "function foodFunc() {\n\n var favFood = prompt('Guess one of the top four styles of foods that I enjoy eating.').toLowerCase();\n var foodStyles = ['mexican', 'italian', 'southern', 'japanese'];\n\n for (var i = 0; i < 5; i++) {\n if (favFood === foodStyles[0] || favFood === foodStyles[1] || favFood === foodStyles[2] || favFood === foodStyles[3]) {\n favFood = alert('Correct, ' + favFood + ' food is delicious!');\n score++;\n break;\n } else if (i !== 6) {\n favFood = prompt('That doesn\\'t make the top four. Please try again.');\n }\n }\n if (i === 5) {\n favFood = alert('My top four favorite styles of food are mexican, italian, southern, and japanese food!');\n }\n}", "function makeEnemyChoice() {\n const choices = [\"horse\", \"hay\", \"sword\"];\n const choiceIndex = Math.floor(Math.random() * choices.length);\n selectItem(\"enemy\", choices[choiceIndex]);\n}", "eat () {\n if (this.food === 0) {\n this.isHealthy = false;\n\n } else {\n this.food -= 1;\n }\n }", "function makeChoise() {\n\tconsole.log('Func makeChoise');\n\tvar choise = 0;\n\tif(machina.countCoins == MINERAL_WATER) {\n\t\tchoise = prompt('Press 1 to choose Mineral water or add more coins to make another choise.', 0);\n\t\tif(choise == 1) {\n\t\t\tmachina.giveMineralWater();\n\t\t}\n\t\telse getCoins();\n\t}\n\telse if(machina.countCoins == SWEET_WATER ) {\n\t\tchoise = prompt('Press 1 to choose Mineral water or Press 2 to choose Sweet water.', 0);\n\t\tif(choise == 1) {\n\t\t\tmachina.giveMineralWater();\n\t\t}\n\t\telse machina.giveSweetWater();\n\t}\n}", "function fightOrFlight() {\n var fightOrFlight = ask.question(\"Do you choose to fight or run? Type 'f' to fight or 'r' to run\\n\")\n if (fightOrFlight === \"f\") {\n fight();\n } else {\n run();\n }\n}", "async eatEnergy() {\n await this.updateAvailableEat();\n let response = await this.sendRequest(\"foodSystem.php\", { \"whatneed\": \"eatFrmHldnk\" });\n debug(\"Eating...\", response);\n return response;\n }", "setSelectedRestaurant(state, resto) {\n state.selectedRestaurant = resto;\n }", "function pickFood() {\r\n\r\n\t\tdocument.getElementById(\"searchFood\").value = \"\";\r\n\t\tlet food = document.getElementById(this.id).innerHTML;\r\n\t\tlet foodName = \"\";\r\n\t\tlet foodSplit = food.split(/[ \\t\\n]+/);\r\n\r\n\t\tfor(let i = 0; i < foodSplit.length; i++) {\r\n\t\t\tfoodName += foodSplit[i];\r\n\t\t\tif(i + 1 < foodSplit.length) {\r\n\t\t\t\tfoodName += \"+\";\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tlet url = \"https://www.themealdb.com/api/json/v1/1/search.php?s=\"+foodName;\r\n\t\tfetch(url)\r\n\t\t\t.then(checkStatus)\r\n\t\t\t.then(function(responseText) {\r\n\t\t\t\tlet json = JSON.parse(responseText);\r\n\t\t\t\tclear();\r\n\t\t\t\taddTop(json);\r\n\t\t\t\taddIngredients(json);\r\n\t\t\t\taddDirections(json);\r\n\t\t\t\textras(json);\r\n\t\t\t\tdocument.getElementById(\"image\").style.visibility = \"visible\";\r\n\t\t\t})\r\n\t\t\t.catch(function(error) {\r\n\t\t\t\tconsole.log(error);\r\n\t\t\t\tlet error1 = document.getElementById(\"error\");\r\n\t\t\t\terror1.innerHTML = \"Sorry a problem occurred with API, try another name\";\r\n\t\t\t});\r\n\t}", "function findTheCheese (foods) {\n for (var i=0; i<foods.length; i++){\n foods.shift();\n if (foods[i] === \"gouda\"){\n return `gouda`;\n }\n else if (foods[i] === `cheddar`){\n return 'cheddar';\n }\n else {\n return `no cheese!`;\n }\n }\n}", "function getFood(food, callback) {\n\t\t// Construct food search API URL\n\t\tvar foodSearchURL = NUTRI_API_BASE+ food + NUTRI_API_TRAIL;\n\t\t// Make asynchronous request\n\t\trequest(foodSearchURL, function(response) {\n\t\t\tcallback(response);\n\t\t});\n\t}", "static altUrlforRestaurant(restaurant){\n\t return(restaurant.alt);\n }", "function checkFruits(fruit) {\n switch (fruit) {\n case \"banana\":\n return \"banana is creamy\";\n case \"orange\":\n return \"orange is juicy\";\n case \"strawberry\":\n return \"strawberry is yummy\";\n case \"apple\":\n return \"apple is crunchy\";\n default:\n \"Please enter a fruit\";\n }\n}", "function whereToGO() {\n\n\t\t\t\tif (activity == 0 && budget == 0) {\n\t\t\t\t\tadventure = \"bowling_alley\";\n\t\t\t\t} else if (activity == 0 && budget >= 1) {\n\t\t\t\t\tadventure = \"restaurant\";\n\t\t\t\t}\n\t\t\t\telse if (activity == 1 && budget == 0) {\n\t\t\t\t\tadventure = \"shopping_mall\";\n\t\t\t\t} else if (activity == 1 && budget >= 1) {\n\t\t\t\t\tadventure = \"amusement_park\";\n\t\t\t\t} else if (activity == 2 && budget == 0) {\n\t\t\t\t\tadventure = \"bar\";\n\t\t\t\t} else if (activity == 2 && budget >= 1) {\n\t\t\t\t\tadventure = \"spa\";\n\t\t\t\t}\n\t\t\t}", "function Traveler(food, name, isHealthy) {\n this.isHealthy = true; //setting as true to begin with\n this.food = food; // CB Note: can put this getRandomIntInclusive(1,0); --not best solution\n this.name = name;\n this.isHealthy = isHealthy;\n }", "function chooseAction(me, opponent, t) {\n // This strategy uses the state variable 'evil'.\n // In every round, turn 'not angel' with 10% probability.\n // (And remain this way until the 200 rounds are over.)\n if (Math.random() < 0.1) {\n angel = false;\n }\n\n // If angel, recycle\n if (angel) return 1;\n\n return 0; // Waste otherwise\n }", "async promptForFood(step) {\n if (step.result && step.result.value === 'yes') {\n\n return await step.prompt(FOOD_PROMPT, `Tell me what kind of food would you prefer ?`,\n {\n retryPrompt: 'Sorry, I do not understand or say cancel.'\n }\n );\n } else {\n return await step.next(-1);\n }\n}", "function flavorBanana() {\n\t// flavor texts\n\tflavors = [\"Bananas are radioactive.\",\"Bananas are clones.\",\"Most types of banana are unpalatable.\",\"Bananas are technically a berry.\",\"A cluster of bananas is called a \\\"hand.\\\"\"];\n\t// pick a flavor text and return it\n\tflavor = Math.floor(Math.random() * flavors.length);\n\treturn flavors[flavor];\n}", "function selectMeat(meat) {\n if($scope.model.selectedBurger.meat) {\n $scope.model.selectedBurger.meat.selected = false;\n }\n $scope.model.selectedBurger.meat = meat;\n $scope.model.selectedBurger.meat.selected = true;\n selectStep('cheese');\n }", "function doChoice(e) {\n if (this.selectedIndex>0) {\n var c = favlist[this.options[this.selectedIndex].value];\n\t\tvar fail = false;\n if (c) {\n var i;\n setNotice('Loading fav ...');\n for (i=1;i<=c.length;i++) {\n fail |= setState(i,c[i-1]);\n }\n for (;i<=11;i++) {\n clearState(i);\n }\n }\n this.selectedIndex = 0;\n\t\tif (fail)\n\t\t\taddNotice('Item(s) not found!');\n\t\telse\n\t\t\taddNotice('Fav loaded!');\n }\n}", "function findFood(post) {\n\t\tconsole.log(post);\n\t\trestaurantCheck(post);\n\t\tpost = filterPost(post); // filters posts\n\n\t\t// checks spoonacular API to find foods\n\t\tpost.forEach(function (element, index) {\n\t\t\tclassifyCuisine(element);\n\t\t\tingredientSearch(element);\n\t\t});\n\t}", "function foodFactory() {\n\n\t\t//generate food randomly with 1/10 chance\n\t\tif (Math.floor((Math.random() * 25) + 1) === 3) {\n\n\t\t\t//randomly position it on the field\n\t\t\tvar randomX = Math.floor((Math.random() * size) );\n\t\t\tvar randomY = Math.floor((Math.random() * size) );\n\n\t\t\t//if selected field is empty create food here\n\t\t\tif (game[randomY][randomX] === 0) {\n\t\t\t\tgame[randomY][randomX] = 2;\n\t\t\t}\n\t\t}\n\t}", "function ingredientSearch (food) {\n\n\t\t// J\n\t\t// Q\n\t\t// U\n\t\t// E\n\t\t// R\n\t\t// Y\n\t\t$.ajax ({\n\t\t\tmethod: \"GET\",\n\t\t\turl: ingredientSearchURL+\"?metaInformation=false&number=10&query=\"+food,\n\t\t headers: {\n\t\t 'X-Mashape-Key': XMashapeKey,\n\t\t 'Content-Type': \"application/x-www-form-urlencoded\",\n\t\t \"Accept\": \"application/json\"\n\t\t }\n\t\t}).done(function (data) {\n\t\t\t// check each returned ingredient for complete instance of passed in food\n\t\t\tfor (var i = 0; i < data.length; i++) {\n\t\t\t\tvar word_list = getWords(data[i].name);\n\t\t\t\t// ensures food is an ingredient and not already in the food list\n\t\t\t\tif (word_list.indexOf(food) !== -1 && food_list.indexOf(food) === -1) {\n\t\t\t\t\tfood_list.push(food);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}", "function generateRandomFood() {\n\n\t\tvar x = Math.floor((Math.random() * BOARD_SIZE));\n\t\tvar y = Math.floor((Math.random() * BOARD_SIZE));\n\n\t\tvar pos = new Position(x,y);\n\n\t\twhile(snakeAtPosition(pos)) {\n\n\t\t\tx = Math.floor((Math.random() * BOARD_SIZE));\n\t\t\ty = Math.floor((Math.random() * BOARD_SIZE));\n\t\t\tpos = new Position(x,y);\n\t\t}\n\n\t\treturn new Food(pos.x, pos.y);\n\t}", "function systemSelection(option){\n\tvar check = option; \n\tif(vehicleFuel<=0){\n\t\tgameOverLose();\n\t}\n\n\telse{\n\n\n\tif(currentLocation===check){\n\t\t\tgamePrompt(\"Sorry Captain, You're already there or have been there. I will return you to the main menu to make another choice\",beginTravel);\n\t\t\t}\n\n\telse{\n\t\n\t\t\tif(check.toLowerCase() === \"e\"){\n\t\t\t\tvehicleFuel=(vehicleFuel-10);\n\t\t\t\tcurrentLocation=\"e\" ;\n\t\t\t\tgamePrompt(\"Flying to Earth...You used 10 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToEarth);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"m\"){\n\t\t\t//need to add a 'visited' conditional\n\t\t\tvehicleFuel=(vehicleFuel-20);\n\t\t\tcurrentLocation=\"m\" ;\n\t\t\t\tgamePrompt(\"Flying to Mesnides...You used 20 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\", goToMesnides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"l\"){\n\t\t\tvehicleFuel=(vehicleFuel-50);\n\t\t\tcurrentLocation=\"l\" ;\n\t\t\tgamePrompt(\"Flying to Laplides...You used 50 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToLaplides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"k\"){\n\t\t\tvehicleFuel=(vehicleFuel-120);\n\t\t\tcurrentLocation=\"k\" ;\n\t\t\tgamePrompt(\"Flying to Kiyturn...You used 120 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToKiyturn);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"a\"){\n\t\t\tvehicleFuel=(vehicleFuel-25);\n\t\t\tcurrentLocation=\"a\";\n\t\t\tgamePrompt(\"Flying to Aenides...You used 25 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToAenides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"c\"){\n\t\t\tvehicleFuel=(vehicleFuel-200);\n\t\t\tcurrentLocation=\"c\" ;\n\t\t\tgamePrompt(\"Flying to Cramuthea...You used 200 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToCramuthea);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"s\"){\n\t\t\tvehicleFuel=(vehicleFuel-400);\n\t\t\tcurrentLocation=\"s\" ;\n\t\t\tgamePrompt(\"Flying to Smeon T9Q...You used 400 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToSmeon);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"g\"){\n\t\t\tvehicleFuel=(vehicleFuel-85);\n\t\t\tcurrentLocation=\"g\" ;\n\t\t\tgamePrompt(\"Flying to Gleshan 7Z9...You used 85 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToGleshan);\n\t\t\t}\n\t\telse{\n\t\t\tgamePrompt(\"Sorry Captain, I did not understand you. I will return you to the main menu\",beginTravel);\n\t\t}\n\t}\n\t}\n}", "function chap19(){\n var wantChicken = false;\n var foodArray = [\"Salmon\", \"Tilapia\", \"Tuna\", \"Lobster\"];\n var customerOrder = prompt(\"What would you like?\", \"Look the menu\");\n for (var i = 0; i <= 3; i++) {\n if (customerOrder === foodArray[i]) {\n wantChicken = true;\n alert(\"We have it on the menu!\");\n break;\n }\n }\n if(wantChicken===false) {\n\t\talert(\"We don't serve chicken here, sorry.\");\n\t}\n}", "function createFood() {\n food.FOOD_COLOUR = food.colours[Math.floor(Math.random()*7)]\n // Generate a random number the food x-coordinate\n food.x = randomTen(0, gameCanvas.width - 10);\n // Generate a random number for the food y-coordinate\n food.y = randomTen(0, gameCanvas.height - 10);\n \n\n // if the new food location is where the snake currently is, generate a new food location\n snakeOne.snake.forEach(function isFoodOnSnake(part) {\n const foodIsoNsnake = part.x == food.x && part.y == food.y;\n if (foodIsoNsnake) createFood();\n });\n }", "function doSomething(chosen, title) {\n switch (chosen) {\n case 'my-tweets':\n tweetIt();\n break;\n case 'spotify-this-song':\n songIt(title);\n break;\n case 'movie-this':\n movieIt(title);\n break;\n case 'do-what-it-says':\n doIt();\n break;\n }\n}", "function supervisorMenu() {\n inquirer\n .prompt({\n name: 'apple',\n type: 'list',\n message: 'What would you like to do?'.yellow,\n choices: ['View Product Sales by Department',\n 'View/Update Department',\n 'Create New Department',\n 'Exit']\n })\n .then(function (pick) {\n switch (pick.apple) {\n case 'View Product Sales by Department':\n departmentSales();\n break;\n case 'View/Update Department':\n updateDepartment();\n break;\n case 'Create New Department':\n createDepartment();\n break;\n case 'Exit':\n connection.end();\n break;\n }\n });\n}", "function travelTypeChange (userInput) { //takes the result from changeDestinationResult and uses the yesOrNo function to give random part of trip the user wishes to switch.\n if(userInput === \"1\"){\n \n randomDestination = yesOrNo(destination,destination);\n \n }\n else if (userInput === \"2\") {\n \n randomRestaurant = yesOrNo(restaurant,restaurant);\n }\n else if (userInput === \"3\") {\n \n randomTravelType = yesOrNo(transportation, transportation);\n }\n else if (userInput === \"4\") {\n \n randomEntertainment = yesOrNo(entertainment,entertainment);\n }\n}", "function setFood() {\n\tvar empty = [];\n\t\n\t//finds all empty cells so not to collide with snake\n\tfor (var x=0; x < grid.w; x++) {\n\t\tfor (var y=0; y < grid.h; y++) {\n\t\t\tif (grid.get(x, y) == emptyFill) {\n\t\t\t\tempty.push({x:x, y:y});\n\t\t\t}\n\t\t}\n\t}\n\t\n\t//puts food in random cell\n\tvar randpos = empty[Math.round(Math.random()*(empty.length - 1))];\n\tgrid.set(foodFill, randpos.x, randpos.y);\n}", "function randomFood() {\n var fRow = Math.floor(Math.random() * 19);\n var fCol = Math.floor(Math.random() * 19);\n var foodCell = $('#cell_'+fRow+'_'+fCol);\n if (!foodCell.hasClass('snake-cell')) {\n foodCell.addClass(\"food-cell\");\n food='_'+fRow+'_'+fCol;\n }\n else randomFood();\n }", "function fightOrCave() {\n\n let whereNext = prompt(\"Vart vill du gå nu? Ange fight för att gå och bekämpa monstret eller grottan för att gå till grottan\").toLowerCase();\n\n if (whereNext === \"grottan\"){\n goToCaveSecondTime();\n }\n else if (whereNext === \"fight\") {\n alert(\"Oops, du har ju inte skölden än... Du måste hämta den först. Klicka ok för att gå till grottan.\")\n goToCaveSecondTime();\n }\n else {\n alert(\"Vänligen ange fight eller grottan\")\n fightOrCave()\n }\n\n \n}", "function generateMealPlan() {\n // here we will let them decide, based on their diet type, we can take a quick survey of the current diet type\n // when they click generate a meal plan because this can change very regularly\n\n if (dietType == 'maintain' /* check if the diet type == maintainWeight*/) {\n // this means that they do not need to change amount of calories burn, so essentially calorieLoss = regular loss\n calorieIntake = calculateBMR();\n } else if (dietType == 'gain' /*check if the diet type == weightGain*/) {\n // to gain weight we must add around 500 calories (this is a changing factor) to the intake amount\n // for this we will need to ask them again in the quick survey if this diet is selected how main pounds\n // are they trying to gain, normal (healthy) amount are 0.5lb (+250 calories) and 1lb (+500 calories) a week\n neededCalories = 250 /* 250 ?*/; //again we will check and change this value depending on amount loss\n calorieIntake = calculateBMR() + neededCalories;\n } else if (dietType == 'loss') {\n // to lose weight we must subtract around 500 calories(this is a changing factor) to the intake amount\n // for this we will need to ask them again in the quick survey if this diet is selected how main pounds\n // are they trying to lose, normal (healthy) amount are 0.5lb (-250 calories) and 1lb (-500 calories) a week\n neededCalories = 250 /* 500 ?*/;\n calorieIntake = calculateBMR() - neededCalories;\n }\n\n // now we can call the calorieIntake value and essentially grab a meal/meals that are within this range for the\n // user\n\n // we can make calls to the database and check for the essential meal here this might be a little difficult\n // since we need to make a meal for the day in a sense, so we need to check with the nutritionist \n // about what should be allocated for calories for breakfast, lunch, and dinner\n\n // also we need to check for allergies and account for this in some way, but that can be handled later\n // once we nail down the functionality of this.\n return calorieIntake;\n}", "function fighterSelect() {\n if (userSelected === false) {\n userChoice.append($(this));\n userSelected = true;\n for (let i = 0; i < fighterArray.length; i++) {\n if ($(this).attr('alt') === fighterArray[i].name) {\n userFighter = fighterArray[i];\n userFighter.hide();\n }\n }\n return userFighter\n }\n \n else if (userSelected === true && enemySelected === false) {\n enemyChoice.append($(this));\n enemySelected = true;\n for (let i = 0; i < fighterArray.length; i++) {\n if ($(this).attr('alt') === fighterArray[i].name) {\n enemyFighter = fighterArray[i];\n enemyFighter.hide();\n }\n }\n return enemyFighter;\n }\n }", "async function e_greedy() {\r\n\t\tlet action;\r\n\t\t//Based off explore/exploit\r\n\t\tif (Math.random() < epsilon) { //chooses best action\r\n\t\t\t//read max value from firestore database and get the id\r\n\t\t\tlet response = await getMax(s);\r\n\t\t\taction = response;\r\n\t\t} else { //choose random action\r\n\t\t\taction = Math.floor(Math.random() * Math.floor(states));; //if a = 8, this indicates to choose random state\r\n\t\t}\r\n\t\treturn action;\r\n\t}", "function pickSearchTerm() {\n let options = [\"stop\", \"mad\", \"angry\", \"annoyed\", \"cut it\" ];\n return options[Math.floor(Math.random() * 4)];\n}", "function printFruitOrVeggie(word) {\n switch (word) {\n case 'banana':\n case 'apple':\n case 'kiwi':\n case 'cherry':\n case 'lemon':\n case 'grapes':\n case 'peach':\n console.log('fruit'); break;\n case 'tomato':\n case 'cucumber':\n case 'pepper':\n case 'onion':\n case 'parsley':\n case 'garlic':\n console.log('vegetable'); break;\n default:\n console.log('unknown');\n }\n }", "checkForFood(foods) {\n for (var i=0; i < foods.length; i++) {\n let distance = Math.abs(super.subtractVectors(this.position, foods[i].position));\n if (distance <= this.senseRadius && distance >= 0) {\n if (distance <= this.stepSize / 2 && distance >= 0) {\n this.eat(foods[i]);\n this.foodIsNearby = false;\n } else {\n this.foodIsNearby = true;\n }\n } else {\n this.foodIsNearby = false;\n }\n }\n }", "function checkMeat(food) {\n var aisle = food;\n console.log(aisle);\n console.log(aisleIngredients);\n if (aisleIngredients.indexOf(\"Seafood\") >= 0) {\n var searchTerm =\n wineIngredients[aisleIngredients.indexOf(\"Seafood\")].nameClean;\n console.log(searchTerm);\n fetch(\n `https://api.spoonacular.com/food/wine/pairing?food=${searchTerm}&apiKey=${apiKey}`\n )\n .then((blob) => {\n return blob.json();\n })\n .then((response) => {\n if (\n typeof response.pairingText != \"undefined\" &&\n response.pairingText != \"\"\n ) {\n winePair.innerHTML = response.pairingText;\n } else {\n lastWine();\n }\n });\n } else if (aisleIngredients.indexOf(\"Frozen;Meat\") >= 0) {\n var searchTerm =\n wineIngredients[aisleIngredients.indexOf(\"Frozen;Meat\")].nameClean;\n console.log(searchTerm);\n fetch(\n `https://api.spoonacular.com/food/wine/pairing?food=${searchTerm}&apiKey=${apiKey}`\n )\n .then((blob) => {\n return blob.json();\n })\n .then((response) => {\n if (\n typeof response.pairingText != \"undefined\" &&\n response.pairingText != \"\"\n ) {\n winePair.innerHTML = response.pairingText;\n } else {\n lastWine();\n }\n });\n } else if (aisleIngredients.indexOf(\"Meat\") >= 0) {\n var searchTerm =\n wineIngredients[aisleIngredients.indexOf(\"Meat\")].nameClean;\n console.log(searchTerm);\n fetch(\n `https://api.spoonacular.com/food/wine/pairing?food=${searchTerm}&apiKey=${apiKey}`\n )\n .then((blob) => {\n return blob.json();\n })\n .then((response) => {\n if (\n typeof response.pairingText != \"undefined\" &&\n response.pairingText != \"\"\n ) {\n winePair.innerHTML = response.pairingText;\n } else {\n lastWine();\n }\n });\n } else if (aisleIngredients.indexOf(\"Pasta and Rice\") >= 0) {\n var searchTerm =\n wineIngredients[aisleIngredients.indexOf(\"Pasta and Rice\")].nameClean;\n console.log(searchTerm);\n fetch(\n `https://api.spoonacular.com/food/wine/pairing?food=${searchTerm}&apiKey=${apiKey}`\n )\n .then((blob) => {\n return blob.json();\n })\n .then((response) => {\n if (\n typeof response.pairingText != \"undefined\" &&\n response.pairingText != \"\"\n ) {\n winePair.innerHTML = response.pairingText;\n } else {\n lastWine();\n }\n });\n } else if (aisleIngredients.indexOf(\"Cheese\") >= 0) {\n var searchTerm =\n wineIngredients[aisleIngredients.indexOf(\"Cheese\")].nameClean;\n console.log(searchTerm);\n fetch(\n `https://api.spoonacular.com/food/wine/pairing?food=${searchTerm}&apiKey=${apiKey}`\n )\n .then((blob) => {\n return blob.json();\n })\n .then((response) => {\n if (\n typeof response.pairingText != \"undefined\" &&\n response.pairingText != \"\"\n ) {\n winePair.innerHTML = response.pairingText;\n } else {\n lastWine();\n }\n });\n } else if (aisleIngredients.indexOf(\"Produce\") >= 0) {\n var searchTerm =\n wineIngredients[aisleIngredients.indexOf(\"Produce\")].nameClean;\n console.log(searchTerm);\n fetch(\n `https://api.spoonacular.com/food/wine/pairing?food=${searchTerm}&apiKey=${apiKey}`\n )\n .then((blob) => {\n return blob.json();\n })\n .then((response) => {\n if (\n typeof response.pairingText != \"undefined\" &&\n response.pairingText != \"\"\n ) {\n winePair.innerHTML = response.pairingText;\n } else {\n lastWine();\n }\n });\n } else if (aisleIngredients.indexOf(\"Nuts\") >= 0) {\n var searchTerm =\n wineIngredients[aisleIngredients.indexOf(\"Nuts\")].nameClean;\n console.log(searchTerm);\n fetch(\n `https://api.spoonacular.com/food/wine/pairing?food=${searchTerm}&apiKey=${apiKey}`\n )\n .then((blob) => {\n return blob.json();\n })\n .then((response) => {\n if (\n typeof response.pairingText != \"undefined\" &&\n response.pairingText != \"\"\n ) {\n winePair.innerHTML = response.pairingText;\n } else {\n lastWine();\n }\n });\n } else {\n lastWine();\n }\n}", "function selectRestaurant() {\n let restaurant = document.getElementById(\"dropdown\").firstChild.value;\n let clear;\n if (restaurant === null) {\n return;\n } else if (Object.keys(order.items).length > 0) {\n //Confirm the if the user wants to proceed to clear the order\n clear = confirm(\"Would you like to clear the current order?\");\n if(!clear) {\n document.getElementById(\"dropdown\").firstChild.value = \"\";\n return;\n }\n }\n\n clearOrder(true);\n\n changeRestaurant(restaurant);\n\n}", "function randomEmote () {\n let emoteState = pet_info.state\n \n switch(emoteState) {\n case 'good':\n const goodPetStates = [\n './assets/Emote_Heart.png',\n './assets/Emote_Hi!.gif',\n './assets/Emote_Game.png',\n './assets/Emote_Laugh.gif',\n './assets/Emote_Happy.png',\n './assets/Emote_Note.png',\n './assets/Emote_Yes.gif'\n ]\n \n const goodArrayLength = goodPetStates.length\n let goodSelectedState = Math.floor((Math.random() * goodArrayLength) + 0)\n\n $('.pet-state').attr('src', goodPetStates[goodSelectedState])\n \n break\n case 'bad':\n const badPetStates = [\n './assets/Emote_No.gif',\n './assets/Emote_Sad.png',\n './assets/Emote_Sick.gif',\n './assets/Emote_Surprised.gif',\n './assets/Emote_Uh.gif',\n './assets/Emote_Angry.png'\n ]\n \n const badArrayLength = badPetStates.length\n let badSelectedState = Math.floor((Math.random() * badArrayLength) + 0)\n \n $('.pet-state').attr('src', badPetStates[badSelectedState])\n \n break\n case 'dead':\n const deadPetStates = [\n './assets/Emote_Sleep.png',\n './assets/Emote_X.png',\n './assets/Emote_Exclamation.png'\n ]\n \n const deadArrayLength = deadPetStates.length\n let deadSelectedState = Math.floor((Math.random() * deadArrayLength) + 0)\n \n $('.pet-state').attr('src', deadPetStates[deadSelectedState])\n \n break\n default:\n const defaultPetState = 'Emote_Question.png'\n $('.pet-state').attr('src', defaultPetState)\n }\n}", "function alertAll() {\n let ask = prompt(`What type of coffee maker you are interested in? : \\n Drip,Carob,Coffee-Machine`)\n let lowerAsk = ask.toLowerCase();\n\n if (lowerAsk == 'drip') {\n newCoffeeMachine.firstMethod()\n newCoffeeMachine.history()\n }\n if(lowerAsk == 'carob'){\n newCoffeeMachine3.firstMethod()\n newCoffeeMachine3.mainType()\n }\n if(lowerAsk == 'coffee-machine'){\n newCoffeeMachine2.firstMethod()\n newCoffeeMachine2.history()\n }\n}", "function pickUp(index) {\n var pt = self[self.turn];\n var result = self.food[pt];\n if (!result) return; // Nothing to do\n if (result.length == 1) index = 0; // Unique\n if (index == null) { // Can't decide now...\n newState.pending = action;\n return;\n }\n reward += self.food[pt][index]; // Take the food\n newState.food[pt] = null; // Food is now gone\n }", "function eatFood() {\n var lastball = snake[snake.length - 1];\n if (lastball.x == food.x * 20 && lastball.y == food.y*20 ) {\n eat.play()\n score++;\n add();\n createFood();\n }\n}", "function placeFood() {\n if (!isThereEmptyCell()) return;\n var cell = getCell([~~(Math.random() * settings.size[0]), ~~(Math.random() * settings.size[1])]);\n if (cell.className) placeFood();\n else cell.className = 'food';\n }", "onSelectRestaurant(restaurant){\n this.closeAllRestaurant()\n restaurant.viewDetailsComments()\n restaurant.viewImg()\n\n }", "function selectCheese(cheese) {\n if($scope.model.selectedBurger.cheese) {\n $scope.model.selectedBurger.cheese.selected = false;\n }\n if(cheese !== undefined) {\n $scope.model.selectedBurger.cheese = cheese;\n $scope.model.selectedBurger.cheese.selected = true;\n }\n\n selectStep('salads');\n }", "function selectAction() {\n inquirer.prompt([\n {\n name: \"action\",\n message: \"Please select what you want to do:\",\n type: \"list\",\n choices: [\n \"View Product Sales by Department\",\n \"Create New Department\",\n ]\n }\n // use if to lead manager to the different functions\n ]).then(function (answers) {\n if (answers.action === \"View Product Sales by Department\") {\n // run the list function to display all available product\n console.log(\"=============================================\")\n salesByDepartment()\n } else if (answers.action === \"Create New Department\") {\n // run the lowInventory function to display all product with lower than 5 stock quant\n console.log(\"=============================================\")\n createDepartment() \n } else {\n console.log(\"I don't know what you want to do.\")\n }\n })\n}", "function findTheCheese (foods) {\n const cheese = [\"cheddar\", \"gouda\", \"camembert\"];\n \n for (let i=0; i < foods.length; i++) { \n \n let flag = cheese.indexOf(foods[i]);\n \n if(flag !== -1) {\n return foods[i];\n }\n } \n return \"no cheese!\";\n}", "function app(people){\n let searchType = promptFor(\"Do you know the name of the person you are looking for? Enter 'yes' or 'no'\", yesNo).toLowerCase();\n let searchResults;\n let pickAdventure;\n switch(searchType){\n case 'yes':\n searchResults = searchByName(people);\n break;\n case 'no':\n let pickAdventure = decideSearch();\n if (pickAdventure === \"one\"){\n searchResults = searchByTraits(people);\n } \n else if (pickAdventure === \"multiple\"){\n //multiple search\n }\n else{\n alert(\"Invalid Response\");\n decideSearch();\n }\n // TODO: search by traits\n break;\n default:\n app(people); // restart app\n break;\n }\n \n // Call the mainMenu function ONLY after you find the SINGLE person you are looking for\n mainMenu(searchResults, people);\n \n}", "function explore(name) {\n // create a random number, if that number is either 3, 6 or 9, the player will fight a monster\n const randomNumber = Math.floor(Math.random() * 10) + 1;\n\n if (randomNumber === 3 || randomNumber === 6 || randomNumber === 9) {\n // disable button to explore tower and insert dialogue that let players know which monster they are facing\n disableExploreTowerButton();\n monsterEncounterDialogue();\n \n } else {\n exploreDialogue(name);\n }\n}", "function pickFruits() {\n return getApple()\n .then(apple => {\n return getBanana()\n .then(banana => `${apple} + ${banana}`);\n });\n}", "function aDifficultChoice(choice){\n if(choice==1){\n return 'Take her daughter to a doctor';\n }\n else{\n if(choice==-1)\n {\n return 'Break down and give up all hope';\n } \n }\n if(typeof(choice)=='undefined')\n {\n return \"Wasn't able to decide\";\n }\n else{\n if(choice==\"I give up\")\n {\n return \"Refused to do anything for Karen\";\n }\n}\n}", "function ChooseBattleOption(){\r\n\r\n PotentialDamageBlocked[0] = 0; // If Both Players Defend\r\n PotentialDamageDealt[0] = Attack; // If Both Players Attack\r\n\r\n if (NatureControllerScript.Attack >= Defence) PotentialDamageBlocked[1] = Defence; //If Nature Attacks and Human defends\r\n if (NatureControllerScript.Attack < Defence) PotentialDamageBlocked[1] = NatureControllerScript.Attack; //If Nature Attacks and Human defends\r\n\r\n var NetDamageDealt: int; \r\n NetDamageDealt = Attack - NatureControllerScript.Defence;\r\n if (NetDamageDealt > 0) PotentialDamageDealt[1] = NetDamageDealt; //If Human Attacks and Nature defends\r\n if (NetDamageDealt <= 0) PotentialDamageDealt[1] = 0; //If Human Attacks and Nature defends (Successful Defence)\r\n\r\n AttackingPotential = (PotentialDamageDealt[0]+PotentialDamageDealt[1])/2;\r\n DefendingPotential = (PotentialDamageBlocked[0]+PotentialDamageBlocked[1])/2;\r\n \r\n if (DefendingPotential > AttackingPotential){\r\n Choice = 1; //Defend\r\n }\r\n\r\n if (AttackingPotential > DefendingPotential){\r\n Choice = 0; //Attack\r\n }\r\n\r\n if (AttackingPotential == DefendingPotential){\r\n if (Health >= NatureControllerScript.Health) Choice = 0; //Choice = Attack\r\n if (Health < NatureControllerScript.Health) Choice = 1; //Choice = Defend\r\n }\r\n}", "function picker(action, target) {\n switch (action) {\n case \"concert-this\":\n concertthis(target);\n break;\n\n case \"spotify-this-song\":\n spotifythissong(target);\n break;\n\n case \"movie-this\":\n moviethis(target);\n break;\n\n case \"do-what-it-says\":\n dowhatitsays();\n break;\n\n default:\n console.log(\"Hmmm ... I don't understand.\");\n break;\n }\n}", "function spawnFood() {\n\tvar x = Math.floor(Math.random()*(WIDTH-3))+1;\n\tvar y =\tMath.floor(Math.random()*(HEIGHT-5))+3;\n\tvar f = {x: x, y: y};\n\tvar clear = snake.body.every(\n\t\t\tfunction(cell) {\n\t\t\t\treturn !isTouchingFood(cell, f);\n\t\t\t}) && !isTouchingFood(snake.head, f);\n\tif (clear) {\n\t\tfood = new Food(x, y);\n\t} else {\n\t\tspawnFood();\n\t}\n}", "function Food() {\n var food_x = Math.floor(Math.random() * backWidth);\n var food_y = Math.floor(Math.random() * backHeight);\n\n board[food_y][food_x].food = 1;\n }", "function pickLocForFood() {\n\tvar cols = floor(windowWidth/s.sWidth);\n\tvar rows = floor(windowHeight/s.sHeight);\n\tfoodPosition =createVector(floor (random(cols)), floor(random(rows)));\n\tfoodPosition.x = constrain (foodPosition.x * s.sWidth, 20, windowWidth-s.sWidth-60);\n\tfoodPosition.y = constrain (foodPosition.y * s.sHeight, 20, windowWidth-s.sHeight-20);\n}", "function hasPizza (foodTray) {\n return foodTray.indexOf('pizza') !== -1;\n}", "async function makeFood(step) {\n try {\n if (step < brusselSprouts.length) {\n await addFood(brusselSprouts[step], \"#brusselSprouts\"); // Coloco o passo atual na fila\n makeFood(step + 1); // Dou o próximo passo na receita\n } else {\n throw \"End of recipe.\";\n }\n } catch (err) {\n console.log(err);\n }\n}", "function whichMeal(datapoint){\n let f = datapoint.whichMeal;\n if (f = \"breakfast\"){\n return \"0.1\";\n }else if (f = \"lunch\"){\n return \"0.5\";\n }else if (f = \"lunch\"){\n return \"1\";\n }\n}", "function EatFood(agent) {\n\tthis.description = 'eating food';\n\n\tthis.evaluate = function(context) {\n\t\tvar self = this;\n\t\tvar result = agent.grid.eachThing(function(food) {\n\t\t\tif(!food.claimedBy &&\n\t\t\t\tagent.pos.x == food.pos.x &&\n\t\t\t\tagent.pos.y == food.pos.y) {\n\t\t\t\tagent.grid.claimFood(food, agent);\n\t\t\t}\n\t\t\tif(food.claimedBy == agent) {\n\t\t\t\tcontext.updateRunningTime(self, context.elapsedTime);\n\t\t\t\tfood.consume(context.runningTime);\n\t\t\t\treturn BT.NodeStatus.Running;\n\t\t\t}\n\t\t}, Food);\n\n\t\treturn typeof result !== 'undefined' ? result : BT.NodeStatus.Failure;\n\t};\n}", "randomAction() {\n var action;\n const role = this.role.toLowerCase();\n switch (this.location.location.toLowerCase()) {\n case 'throne': \n if (role == 'advisor' && randomChoice([0,1,1]) == 1) {\n action = new Action.Propose(randomChoice([100,150,200,300]),randomChoice([this.game.courtyard,this.game.chapel,this.game.barracks]));\n } break;\n case 'courtyard': break;\n case 'ballroom': \n if (role != 'captain' && role != 'grim' && randomChoice([0,1,1]) == 1) {\n action = new Action.Laud(randomChoice(this.game.characters));\n } break;\n case 'chapel':\n if (role != 'captain' && randomChoice([0,1,1]) == 1) {\n action = new Action.Pray();\n } break;\n case 'barracks': break;\n }\n if (action == null) {\n action = randomChoice([0,0,1]) == 1 ? this.randomVisit() : new Action.Investigate(randomChoice(this.game.characters));\n }\n if (action.time <= this.time) {\n return action;\n } else {\n return new Action.End(this.time);\n }\n }", "function handleNewMealRequest(response) {\n // Get a random meal from the random meals list\n var mealIndex = Math.floor(Math.random() * RANDOM_MEALS.length);\n var meal = RANDOM_MEALS[mealIndex];\n\n // Create speech output\n var speechOutput = \"Here's a suggestion: \" + meal;\n\n response.tellWithCard(speechOutput, \"MealRecommendations\", speechOutput);\n}", "function select_by_weather(recipes) {\n recipes.forEach(recipe => {\n recipe['weather'] = false;\n });\n let selectedChoices = findIfFilters(\"weather\");\n if (selectedChoices.length === 0) {\n document.querySelector('#no-filter-chosen').style.display = 'block';\n } else {\n filter(\"weather\", selectedChoices);\n display_selected_recipes();\n history.pushState({ recipes: 'loaded', weather_types: selectedChoices }, ``, '/recipes');\n }\n}", "function displayPizzaType(){\n if (pizzaArray.indexOf(randPizza) === 0){\n pizzaType.innerText = 'Cheese';\n ingredientList.innerHTML = 'Ingredients<br>Sauce, Cheese';\n } else if (pizzaArray.indexOf(randPizza) === 1){\n pizzaType.innerText = 'Pepperoni';\n ingredientList.innerHTML = 'Ingredients<br>Sauce, Cheese, Pepperoni';\n } else if (pizzaArray.indexOf(randPizza) === 2){\n pizzaType.innerText = 'Sausage & Peppers';\n ingredientList.innerHTML = 'Sauce, Cheese, Sausage, Peppers';\n } else if (pizzaArray.indexOf(randPizza) === 3){\n pizzaType.innerText = 'Breath-mint';\n ingredientList.innerHTML = 'Ingredients<br>Sauce, Cheese, Anchovies, Garlic, Onion';\n } else if (pizzaArray.indexOf(randPizza) === 4){\n pizzaType.innerText = 'Marg';\n ingredientList.innerHTML = 'Ingredients<br>Sauce, Cheese, Basil, Garlic, Tomato';\n } else if (pizzaArray.indexOf(randPizza) === 5){\n pizzaType.innerText = 'Meat Lovers';\n ingredientList.innerHTML = 'Ingredients<br>Sauce, Cheese, Sausage, Pepperoni, Bacon, Ham';\n } else if (pizzaArray.indexOf(randPizza) === 6){\n pizzaType.innerText = 'Veggie';\n ingredientList.innerHTML = 'Ingredients<br>Sauce, Cheese, Mushroom, Onion, Peppers, Tomato';\n } else if (pizzaArray.indexOf(randPizza) === 7){\n pizzaType.innerText = 'White';\n ingredientList.innerHTML = 'Ingredients<br>Cheese, Basil, Tomato, Garlic';\n } else if (pizzaArray.indexOf(randPizza) === 8){\n pizzaType.innerText = 'Vegan';\n ingredientList.innerHTML = 'Ingredients<br>Sauce, Basil, Tomato, Mushroom, Onion, Pepper';\n } else if (pizzaArray.indexOf(randPizza) === 9){\n pizzaType.innerText = 'Hawaiian';\n ingredientList.innerHTML = 'Ingredients<br>Sauce, Cheese, Ham, Pineapple';\n } \n\n}", "function getChoice() {\n inquirer.prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\"]\n }).then(function(answer) {\nswitch(answer.action) {\n\tcase 'View Products for Sale':\n\t\tviewProducts();\n\tbreak;\n\n\tcase 'View Low Inventory':\n\t\tviewLowInventory();\n\tbreak;\n\t\n\tcase 'Add to Inventory':\n\t\trestockInventory();\n\tbreak; \n\t\n\tcase 'Add New Product':\n\t\taddNewProduct();\n\tbreak;\n }\n })\n}", "function Food_Function() {\n var Food_Output;\n var Foods = document.getElementById(\"Food_Input\").value\n var Food_String = \" is a Delicious Food!\"\n switch(Foods) {\n case \"Chips\": //a case, are the various conditions that are evaluated \n Food_Output = \"Chips\" + Food_String;\n break;\n case \"Steak\":\n Food_Output = \"Steak\" + Food_String;\n break;\n case \"Chicken\":\n Food_Output = \"Chicken\" + Food_String;\n break;\n case \"Curry\":\n Food_Output = \"Curry\" + Food_String;\n break;\n case \"Chilli\":\n Food_Output = \"Chilli\" + Food_String;\n break;\n case \"Purple\":\n Food_Output = \"Purple\" + Food_String;\n break;\n default:\n Food_Output = \"Please enter a Food exactly as written on the above list\"; //if no case match prents this\n}\ndocument.getElementById(\"Output\").innerHTML=Food_Output;\n}", "choose_treatment(){\n // Gerando um número aleatório entre 0 e 26.\n let index = (Math.floor(Math.random()* 25 + 1));\n // Possíveis formas de tratamento.\n let treatment = [\n \"consagrado\",\n \"condensado\",\n \"condenado\",\n \"chamuscado\",\n \"concursado\",\n \"condecorado\",\n \"comissionado\",\n \"calejado\", \n \"cutucado\", \n \"cuckado\", \n \"abenssoado\", \n \"desgraçado\", \n \"lisonjeado\", \n \"alejado\", \n \"afetado\", \n \"afeminado\", \n \"sensualizado\", \n \"fuzilado\", \n \"adequado\", \n \"algemado\", \n \"amargurado\", \n \"retardado\", \n \"reciclado\", \n \"coroado\", \n \"abestado\", \n \"ensaboado\"\n ];\n return treatment[index];\n }", "function addFoodIcon(food) {\n switch(pluralize.singular(food.name.toLowerCase())) {\n case 'apple':\n return 'apple-1.png';\n break;\n case 'asparagus':\n return 'asparagus.png';\n break;\n case 'avocado':\n return 'avocado.png';\n break;\n case 'bacon':\n return 'bacon.png';\n break;\n case 'banana':\n return 'banana.png';\n break;\n case 'bean':\n return 'beans.png';\n break;\n case 'biscuit':\n return 'biscuit.png';\n break;\n case 'blueberry':\n return 'blueberries.png';\n break;\n case 'bread':\n return 'bread-1.png';\n break;\n case 'broccoli':\n return 'broccoli.png';\n break;\n case 'cabbage':\n return 'cabbage.png';\n break;\n case 'cake':\n return 'cake.png';\n break;\n case 'candy':\n return 'candy.png';\n break;\n case 'carrot':\n return 'carrot.png';\n break;\n case 'cauliflower':\n return 'cauliflower.png';\n break;\n case 'cereal':\n return 'cereals.png';\n break;\n case 'cheese':\n return 'cheese.png';\n break;\n case 'cherry':\n return 'cherries.png';\n break;\n case 'chili':\n return 'chili.png';\n break;\n case 'chips':\n return 'chips.png';\n break;\n case 'chives':\n return 'chives.png';\n break;\n case 'green onion':\n return 'chives.png';\n break;\n case 'chocolate':\n return 'chocolate.png';\n break;\n case 'coconut':\n return 'coconut.png';\n break;\n case 'coffee':\n return 'coffee-2.png';\n break;\n case 'cookie':\n return 'cookies.png';\n break;\n case 'corn':\n return 'corn.png';\n break;\n case 'cucumber':\n return 'cucumber.png';\n break;\n case 'egg':\n return 'egg.png';\n break;\n case 'fish':\n return 'fish.png';\n break;\n case 'flour':\n return 'flour.png';\n break;\n case 'fry':\n return 'fries.png';\n break;\n case 'garlic':\n return 'garlic.png';\n break;\n case 'egg':\n return 'egg.png';\n break;\n case 'grape':\n return 'grapes.png';\n break;\n case 'ham':\n return 'ham.png';\n break;\n case 'honey':\n return 'honey.png';\n break;\n case 'ice cream':\n return 'ice-cream-12.png';\n break;\n case 'jam':\n return 'jam-1.png';\n break;\n case 'jelly':\n return 'jam-1.png';\n break;\n case 'lemon':\n return 'lemon-1.png';\n break;\n case 'lime':\n return 'lime.png';\n break;\n case 'milk':\n return 'milk-1.png';\n break;\n case 'mushroom':\n return 'mushroom.png';\n break;\n case 'mustard':\n return 'mustard.png';\n break;\n case 'noodles':\n return 'noodles.png';\n break;\n case 'oat':\n return 'oat.png';\n break;\n case 'olive oil':\n return 'oil.png';\n break;\n case 'vegetable oil':\n return 'oil.png';\n break;\n case 'oil':\n return 'oil.png';\n break;\n case 'olive':\n return 'olive.png';\n break;\n case 'onion':\n return 'onion.png';\n break;\n case 'orange':\n return 'orange.png';\n break;\n case 'pancake':\n return 'pancakes-1.png';\n break;\n case 'pasta':\n return 'spaguetti.png';\n break;\n case 'peach':\n return 'peach.png';\n break;\n case 'pear':\n return 'pear.png';\n break;\n case 'pea':\n return 'peas.png';\n break;\n case 'pepper':\n return 'pepper.png';\n break;\n case 'pickle':\n return 'pickles.png';\n break;\n case 'pie':\n return 'pie.png';\n break;\n case 'pineapple':\n return 'pineapple.png';\n break;\n case 'beer':\n return 'pint.png';\n break;\n case 'pistachio':\n return 'pistachio.png';\n break;\n case 'pizza':\n return 'pizza.png';\n break;\n case 'pomegranate':\n return 'pomegranate.png';\n break;\n case 'potato':\n return 'potatoes-2.png';\n break;\n case 'pretzel':\n return 'pretzel.png';\n break;\n case 'pumpkin':\n return 'pumpkin.png';\n break;\n case 'radish':\n return 'radish.png';\n break;\n case 'raspberry':\n return 'raspberry.png';\n break;\n case 'rice':\n return 'rice.png';\n break;\n case 'brown rice':\n return 'rice.png';\n break;\n case 'white rice':\n return 'rice.png';\n break;\n case 'salad':\n return 'salad.png';\n break;\n case 'lettuce':\n return 'salad-1.png';\n break;\n case 'spinach':\n return 'salad-1.png';\n break;\n case 'kale':\n return 'salad-1.png';\n break;\n case 'salami':\n return 'salami.png';\n break;\n case 'salmon':\n return 'salmon.png';\n break;\n case 'sandwich':\n return 'sandwich.png';\n break;\n case 'sausage':\n return 'sausage.png';\n break;\n case 'italian sausage':\n return 'sausage.png';\n break;\n case 'breakfast sausage':\n return 'sausage.png';\n break;\n case 'steak':\n return 'steak.png';\n break;\n case 'strawberry':\n return 'strawberry.png';\n break;\n case 'sushi':\n return 'sushi-1.png';\n break;\n case 'taco':\n return 'taco.png';\n break;\n case 'toast':\n return 'toast.png';\n break;\n case 'tomato':\n return 'tomato.png';\n break;\n case 'turkey':\n return 'turkey.png';\n break;\n case 'watermelon':\n return 'watermelon.png';\n break;\n case 'wrap':\n return 'wrap.png';\n break;\n case 'chicken':\n return 'meat.png';\n break;\n case 'chicken breast':\n return 'meat.png';\n break;\n case 'ketchup':\n return 'mustard-2.png';\n break;\n case 'ground beef':\n return 'ham.png';\n break;\n case 'ground turkey':\n return 'ham.png';\n break;\n case 'ground chicken':\n return 'ham.png';\n break;\n case 'ground chicken':\n return 'ham.png';\n break;\n // If a food name is not one of these things, populate it's icon based on category\n default: \n if (food.category === 'Vegetables') {\n return 'salad-1.png';\n } else if (food.category === 'Fruits') {\n return 'apple-1.png'\n } else if (food.category === 'Meat/Seafood') {\n return 'meat-1.png'\n } else if (food.category === 'Grains') {\n return 'grain.png'\n } else if (food.category === 'Dairy') {\n return 'milk.png'\n } else if (food.category === 'Sugars') {\n return 'cupcake.png'\n }\n return 'food.png'\n }\n}", "function fDogs(selected_species) {\n return selected_species.species == \"dog\"\n}", "function runIntoTheForest(){\n\tstory(\"You get sketched out from the guy acting strange all of a sudden so you just start running as fast as you can towards the only cover you'll have to get away from him\");\n\tchoices = [\"Trip over a tree root\",\"Go back\",\"Call the police\"];\n\tanswer = setOptions(choices);\n}", "function genRandomResult(placesArray){\n var numResult = Math.floor(Math.random() * (placesArray.length));\n var restaurantChoice = placesArray[numResult];\n console.log(\"restaurant choice \" + restaurantChoice)\n //alert(restaurantChoice);\n return restaurantChoice;\n}//genRandomResult" ]
[ "0.7036451", "0.68487436", "0.6445757", "0.6161395", "0.6132312", "0.608472", "0.59508175", "0.5935433", "0.59339875", "0.5858789", "0.5857141", "0.5808869", "0.5801549", "0.5787674", "0.57862955", "0.5737572", "0.571127", "0.5710847", "0.5680382", "0.56678766", "0.5634949", "0.562701", "0.5609133", "0.5589664", "0.5576922", "0.5574979", "0.55523497", "0.5551033", "0.5524142", "0.5521212", "0.5510057", "0.5503258", "0.54934406", "0.5484304", "0.5476818", "0.54746795", "0.5457178", "0.5444551", "0.5444358", "0.5435162", "0.5415711", "0.541545", "0.54153484", "0.5407661", "0.5406086", "0.53969073", "0.53912973", "0.5377946", "0.53762895", "0.5374873", "0.53652143", "0.53619915", "0.5360041", "0.5356098", "0.5356077", "0.53518325", "0.53432316", "0.53398263", "0.5330626", "0.5324696", "0.5313833", "0.53116083", "0.53097504", "0.5305349", "0.5282668", "0.52759814", "0.527447", "0.5269119", "0.52600825", "0.5248817", "0.5248778", "0.52435327", "0.5242059", "0.5239417", "0.52310675", "0.5230467", "0.52294344", "0.5229163", "0.5216421", "0.5212049", "0.5211808", "0.52105564", "0.52057755", "0.5202131", "0.5201235", "0.5197262", "0.5196263", "0.51801795", "0.5178012", "0.51726294", "0.51709485", "0.51689434", "0.5158452", "0.5155164", "0.51525736", "0.5146485", "0.5146405", "0.51454234", "0.51317394", "0.51206666", "0.511492" ]
0.0
-1
Continue or regret option for fancy restaurant.
function regretFancyRestaurantOption() { subTitle.innerText = "Are you sure?"; firstButton.innerText = "Yes, continue"; firstButton.onclick = function() { fancyRestauratMenu(); } secondButton.innerText = "No, go back"; secondButton.onclick = function() { startFunction(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFancyRestaurantChoice() {\n /** @type {HTMLInputElement} Input field. */\n const dishInput = document.getElementById(\"dish-input\").value;\n const fancyMenu = [\"pizza\", \"paella\", \"pasta\"]\n\n if(dishInput == fancyMenu[0]) {\n restaurantClosing();\n } else if (dishInput == fancyMenu[1]) {\n restaurantClosing();\n } else if (dishInput == fancyMenu[2]) {\n restaurantClosing();\n } else {\n fancyRestauratMenu();\n }\n}", "function handleFastRestaurantChoice() {\n /** @type {HTMLInputElement} Input field. */\n const fastDishInput = document.getElementById(\"fast-input\").value;\n const fastfoodMenu = [\"cheeseburger\", \"doubleburger\", \"veganburger\"]\n\n if(fastDishInput == fastfoodMenu[0]) {\n restaurantClosing();\n } else if (fastDishInput == fastfoodMenu[1]) {\n restaurantClosing();\n } else if (fastDishInput == fastfoodMenu[2]) {\n restaurantClosing();\n } else {\n fastFoodRestaurantScene();\n }\n}", "function option() {\n\tinquirer\n\t\t.prompt(\n\t\t\t{\n\t\t\t\tname: \"option\",\n\t\t\t\ttype: \"rawlist\",\n\t\t\t\tmessage: \"Would you like to continue to shop?\",\n\t\t\t\tchoices: [\"yes\", \"no\"]\n\t\t\t}\n\t\t)\n\t\t.then(function (answer) {\n\t\t\tif (answer.option === \"yes\") {\n\t\t\t\tdisplayProducts();\n\t\t\t}\n\n\t\t\telse {\n\t\t\t\tconsole.log(\"Thank you for shopping with us at Bamazon, now get the hell out of here!\")\n\t\t\t\tconnection.end()\n\t\t\t}\n\t\t})\n}", "function changeRestaurant() {\n if (selectedRestaurant < rRestaurants.length - 1) {\n const next = selectedRestaurant + 1;\n dispatch(setSelectedRestaurant(next));\n } else {\n dispatch(setSelectedRestaurant(0));\n }\n }", "function selectRestaurant() {\n let restaurant = document.getElementById(\"dropdown\").firstChild.value;\n let clear;\n if (restaurant === null) {\n return;\n } else if (Object.keys(order.items).length > 0) {\n //Confirm the if the user wants to proceed to clear the order\n clear = confirm(\"Would you like to clear the current order?\");\n if(!clear) {\n document.getElementById(\"dropdown\").firstChild.value = \"\";\n return;\n }\n }\n\n clearOrder(true);\n\n changeRestaurant(restaurant);\n\n}", "function restartMenu(){\n\tinquirer.prompt([{\n\t\ttype: \"confirm\",\n\t\tname: \"restartSelection\",\n\t\tmessage: \"Would you like to continue shopping?\"\n\t}]).then(function(restartAnswer){\n\t\tif (restartAnswer.restartSelection === true) {\n\t\t\tcustomerMenu();\n\t\t}\n\t\telse {\n\t\t\tconsole.log(\"Thank you for shopping!\\nYour total is $\" + totalCost); \n\t\t}\n\t});\n}", "async promptForFood(step) {\n if (step.result && step.result.value === 'yes') {\n\n return await step.prompt(FOOD_PROMPT, `Tell me what kind of food would you prefer ?`,\n {\n retryPrompt: 'Sorry, I do not understand or say cancel.'\n }\n );\n } else {\n return await step.next(-1);\n }\n}", "generateRestaurant(){\n// we want the user to input the zipcode they want to search, the food type they want to eat\n// and the rating (1-5) \n// getRestaurants()\n\n\n}", "function selectRestaurant(){\r\n\tlet select = document.getElementById(\"restaurant-select\");\r\n\tlet name = select.options[select.selectedIndex]\r\n\t//checks for undefined\r\n\tif (name !== undefined){\r\n\t\t//creates custom url that tells server what the currently selected restaurant is\r\n\t\tname= select.options[select.selectedIndex].text;\r\n\t\tname = name.replace(/\\s+/g, '-');\r\n\t\tlet request = new XMLHttpRequest();\r\n\t\r\n\t\trequest.onreadystatechange = function(){\t\r\n\t\t\tif(this.readyState == 4 && this.status == 200){ //if its reggie\r\n\t\t\t\tlet data = JSON.parse(request.responseText);\r\n\t\t\t\t//set menu[0] equal to the data from the server\r\n\t\t\t\tmenu[0] = data;\r\n\t\t\t\tconsole.log(menu);\r\n\t\t\t\tlet result = true;\r\n\t\r\n\t\t\t\t//If order is not empty, confirm the user wants to switch restaurants.\r\n\t\t\t\tif(!isEmpty(order)){\r\n\t\t\t\t\tresult = confirm(\"Are you sure you want to clear your order and switch menus?\");\r\n\t\t\t\t}\r\n\t\r\n\t\t\t\t//If switch is confirmed, load the new restaurant data\r\n\t\t\t\tif(result){\r\n\t\t\t\t\t//Get the selected index and set the current restaurant\r\n\t\t\t\t\tlet selected = select.options[select.selectedIndex].value;\r\n\t\t\t\t\tcurrentSelectIndex = select.selectedIndex;\r\n\t\t\t\t\t//In A2, current restaurant will be data you received from the server\r\n\t\t\t\t\tcurrentRestaurant = menu[0];\r\n\t\t\r\n\t\t\t\t\t//Update the page contents to contain the new menu\r\n\t\t\t\t\tif (currentRestaurant !== undefined){\r\n\t\t\t\t\t\tdocument.getElementById(\"left\").innerHTML = getCategoryHTML(currentRestaurant);\r\n\t\t\t\t\t\tdocument.getElementById(\"middle\").innerHTML = getMenuHTML(currentRestaurant);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//Clear the current oder and update the order summary\r\n\t\t\t\t\torder = {};\r\n\t\t\t\t\tupdateOrder(currentRestaurant);\r\n\t\t\r\n\t\t\t\t\t//Update the restaurant info on the page\r\n\t\t\t\t\tlet info = document.getElementById(\"info\");\r\n\t\t\t\t\tinfo.innerHTML = currentRestaurant.name + \"<br>Minimum Order: $\" + currentRestaurant.min_order + \"<br>Delivery Fee: $\" + currentRestaurant.delivery_fee + \"<br><br>\";\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//If they refused the change of restaurant, reset the selected index to what it was before they changed it\r\n\t\t\t\t\tlet select = document.getElementById(\"restaurant-select\");\r\n\t\t\t\t\tselect.selectedIndex = currentSelectIndex;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//make request to server with custom url based on the currently selected restaurant\r\n\t\trequest.open(\"GET\",\"http://localhost:3000/menu-data/\"+name,true);\r\n\t\trequest.send();\r\n\t}\r\n}", "function supervisorMenu() {\n inquirer\n .prompt({\n name: 'apple',\n type: 'list',\n message: 'What would you like to do?'.yellow,\n choices: ['View Product Sales by Department',\n 'View/Update Department',\n 'Create New Department',\n 'Exit']\n })\n .then(function (pick) {\n switch (pick.apple) {\n case 'View Product Sales by Department':\n departmentSales();\n break;\n case 'View/Update Department':\n updateDepartment();\n break;\n case 'Create New Department':\n createDepartment();\n break;\n case 'Exit':\n connection.end();\n break;\n }\n });\n}", "function continuePrompt(){\n inquirer\n .prompt({\n name: \"repeat\",\n type: \"list\",\n message: \"Is there anything else you'd like to do?\",\n choices: [\n \"Yes\",\n \"No, I'm done.\"\n ]\n })\n .then(function(answer) {\n switch(answer.repeat){\n case \"Yes\":\n optionMenu();\n break;\n\n case \"No, I'm done.\":\n console.log(\"\\nHave a nice day!\\n\");\n connection.end();\n break;\n }\n });\n}", "async displayFoodChoice(step) {\n const user = await this.userProfile.get(step.context, {});\n if (user.food) {\n await step.context.sendActivity(`Your name is ${ user.name } and you would like this kind of food : ${ user.food }.`);\n } else {\n const user = await this.userProfile.get(step.context, {});\n\n //await step.context.sendActivity(`[${ step.context.activity.text }]-type activity detected.`);\n\n if (step.context.activity.text == 1) {\n user.food = \"European\";\n await this.userProfile.set(step.context, user);\n } else if (step.context.activity.text == 2) {\n user.food = \"Chinese\";\n await this.userProfile.set(step.context, user);\n } else if (step.context.activity.text == 3) {\n user.food = \"American\";\n await this.userProfile.set(step.context, user);\n }else {\n await this.userProfile.set(step.context, user);\n await step.context.sendActivity(`Sorry, I do not understand, please try again.`);\n return await step.beginDialog(WHICH_FOOD);\n }\n\n await step.context.sendActivity(`Your name is ${ user.name } and you would like this kind of food : ${ user.food }.`);\n }\n return await step.beginDialog(WHICH_PRICE);\n //return await step.endDialog();\n}", "setSelectedRestaurant(state, resto) {\n state.selectedRestaurant = resto;\n }", "onSelectRestaurant(restaurant){\n this.closeAllRestaurant()\n restaurant.viewDetailsComments()\n restaurant.viewImg()\n\n }", "function startOver() {\n\tinquirer.prompt([\n\t\t{\n\t\t\tname: \"confirm\",\n\t\t\ttype: \"confirm\",\n\t\t\tmessage: \"Would you like to make another selection?\"\n\t\t}\n\t]).then(function(answer) {\n\t\tif (answer.confirm === true) {\n\t\t\tdisplayOptions();\n\t\t}\n\t\telse {\n\t\t\tconsole.log(\"Goodbye!\");\n\t\t}\n\t});\n}", "function mainMenu() {\n inquirer\n .prompt([\n {\n type: \"confirm\",\n name: \"choice\",\n message: \"Would you like to place another order?\"\n }\n ]).then(function (answer) {//response is boolean only\n if (answer.choice) { //if true, run func\n startBamazon();\n } else {\n console.log(\"Thanks for shopping at Bamazon. See you soon!\")\n connection.end();\n }\n })\n}", "function resetProductView(){\n \n inquirer.prompt([\n {\n type: \"rawlist\",\n name: \"action\",\n message: \"What would you like to do next?\",\n choices:[\"I want to checkout\", \"I want to continue shopping\"]\n }\n\n ]).then(function(answers){\n if(answers.action === \"I want to checkout\"){\n console.log(\"Good Bye, hope to see you again!\");\n }else if (answers.action === \"I want to continue shopping\"){\n customerview();\n }\n });\n\n}", "function doChoice(e) {\n if (this.selectedIndex>0) {\n var c = favlist[this.options[this.selectedIndex].value];\n\t\tvar fail = false;\n if (c) {\n var i;\n setNotice('Loading fav ...');\n for (i=1;i<=c.length;i++) {\n fail |= setState(i,c[i-1]);\n }\n for (;i<=11;i++) {\n clearState(i);\n }\n }\n this.selectedIndex = 0;\n\t\tif (fail)\n\t\t\taddNotice('Item(s) not found!');\n\t\telse\n\t\t\taddNotice('Fav loaded!');\n }\n}", "function continueShopping(){\n inquirer.prompt(\n {\n type: \"confirm\",\n name: \"confirm\",\n message: \"Do you want to continue shopping?\",\n default: true\n }\n ).then(answers=>{\n if(answers.confirm){\n displayProducts();\n }else{\n connection.end();\n }\n });\n}", "function regretFastFoodRestaurantOption() {\n subTitle.innerText = \"Are you sure?\";\n firstButton.innerText = \"Yes, continue\";\n firstButton.onclick = function() {\n fastFoodRestaurantScene();\n }\n secondButton.innerText = \"No, go back\";\n secondButton.onclick = function() {\n startFunction();\n }\n}", "function regretsPrompt (res) {\n\tinquirer\n \t\t.prompt([\n \t\t\t{\n\t\t\t\ttype: \"list\",\n\t\t\t\tmessage: \"What would you like to do?\",\n\t\t\t\tchoices: [\"Change Quantity\", \"Start Over\"],\n\t\t\t\tname: \"selection\"\n\t\t }\n\t\t])\n\t\t.then(function(inqRes) {\n\t\t\tif (inqRes.selection == \"Change Quantity\"){\n\t\t\t\tquantityPrompt(res);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdisplayAllProducts();\t\n\t\t\t}\n\n\n\t\t});//ends then\n}", "function continuePrompt(){\n inquirer.prompt({\n type: \"confirm\",\n name: \"continue\",\n message: \"Continue....?\",\n }).then((answer) => {\n if (answer.continue){\n showMainMenu();\n } else{\n exit();\n }\n })\n}", "function repeat() {\n inquirer\n .prompt({\n name: \"gotoMainMenu\",\n type: \"list\",\n message: \"Do you want to go back to main menu ?\",\n choices: [\"Yes\", \"No\"]\n })\n .then(function (choice) {\n if (choice.gotoMainMenu === \"Yes\") {\n start();\n }\n else {\n connection.end();\n }\n });\n}", "function managerChoice() {\n \n inquirer\n .prompt({\n name: \"action\",\n type: \"rawlist\",\n message: \"What would you like to do?\",\n choices: [\n \"View Products For Sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\",\n \"Quit\"\n ]\n })\n .then(function(answer) {\n switch (answer.action) {\n case \"View Products For Sale\":\n MgrDisplayInv();\n break;\n\n case \"View Low Inventory\":\n lowInv();\n break;\n\n case \"Add to Inventory\":\n addInv();\n break;\n\n case \"Add New Product\":\n addItem();\n break;\n\n case \"Quit\":\n disconnect();\n break;\n }\n });\n}", "function mainOptions() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View\",\n \"Add\",\n \"Delete\",\n \"Update\"\n ]\n })\n .then(function (answer) {\n switch (answer.action) {\n\n case \"View\":\n viewChoice();\n break;\n\n case \"Add\":\n addChoice();\n break;\n\n case \"Delete\":\n deleteChoice()\n break;\n\n case \"Update\":\n updateChoice()\n break;\n\n\n }\n });\n\n}", "function startPrompt() {\n \n inquirer.prompt([{\n\n type: \"confirm\",\n name: \"confirm\",\n message: \"Welcome to Zohar's Bamazon! Wanna check it out?\",\n default: true\n\n }]).then(function(user){\n if (user.confirm === true){\n inventory();\n } else {\n console.log(\"FINE.. come back soon\")\n }\n });\n }", "function goPrompt() {\n inquirer.prompt([\n {\n type: \"list\",\n message: \"What action would you like to do?\",\n name: \"choice\",\n choices: [\n \"Check Departments\",\n \"Check Roles\",\n \"Check Employees\",\n \"Plus Employee\",\n \"Plus Role\",\n \"Plus Department\"\n ]\n }\n // switch replaces else if...selects parameter and javascript will look for the correct function\n ]).then(function (data) {\n switch (data.choice) {\n case \"Check Departments\":\n viewDepartments()\n break;\n case \"Check Roles\":\n viewRoles()\n break;\n case \"Check Employees\":\n viewEmployees()\n break;\n case \"Plus Employee\":\n plusEmployees()\n break;\n case \"Plus Department\":\n plusDepartment()\n break;\n case \"Plus Role\":\n plusRole()\n break;\n }\n })\n}", "function runAgain(){\n inquire.prompt([\n {\n name: 'again',\n message: 'Would you like to make another purchase?',\n type: 'confirm'\n }\n ]).then(function(res){\n if (res.again){\n customer();\n } else {\n console.log('We hope to see you at the Agora again!');\n checkout();\n }\n })\n}", "function startOver() {\n inquirer\n .prompt({\n name: \"continue\",\n type: \"confirm\",\n message: \"Would you like to buy another product?\",\n default: true\n })\n .then(function(answer) {\n if (answer.continue) {\n purchaseChoice();\n }\n else {\n connection.end();\n }\n })\n}", "async handleMenuResult(step) {\n switch (step.result.value) {\n case \"Donate Food\":\n return step.beginDialog(DONATE_FOOD_DIALOG);\n case \"Find a Food Bank\":\n return step.beginDialog(FIND_FOOD_DIALOG);\n case \"Contact Food Bank\":\n return step.beginDialog(CONTACT_DIALOG);\n }\n return step.next();\n }", "function continueShopping() {\n inquire.prompt([{\n message: \"Checkout or Continue Shopping?\",\n type: \"list\",\n name: \"continue\",\n choices: [\"Continue\", \"Go to checkout\"]\n }]).then(function (ans) {\n if (ans.continue === \"Continue\") {\n console.log(\" Items Added to Cart!\");\n shoppingCart();\n } else if (ans.continue === \"Go to checkout\") {\n checkOut(itemCart, cartQuant);\n }\n });\n}", "function runAgain2(){\n console.log('That item ID was not found in our records.');\n inquire.prompt([\n {\n name: 'again',\n message: 'Would you like to make another purchase?',\n type: 'confirm'\n }\n ]).then(function(res){\n if (res.again){\n customer();\n } else {\n console.log('We hope to see you at the Agora again!');\n checkout();\n }\n })\n}", "function restartFunction() {\n inquirer.prompt([\n {\n name:\"action\",\n type:\"list\",\n message: \"Do you want to do another operation?\",\n choices: [\n \"Yes, please.\",\n \"No, I am fine thank you.\"\n ]\n }\n ]).then(function(answer) {\n if(answer.action === \"Yes, please.\") {\n menuOptions();\n } else {\n connection.end();\n }\n })\n}", "next() {\n inquirer\n .prompt({\n type: 'list',\n name: 'select',\n message: 'Select a team member or hit \"Done\" to finish:',\n choices: ['Add Manager', 'Add Engineer', 'Add Intern', 'Done'],\n }).then(({select}) => {\n this.parseChoice(select);\n });\n }", "chooseLocation() {\n \n }", "function restartPrompt(){\n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"confirm\",\n message: \"Would you like to continue shopping?\".question,\n default: true\n }\n ]).then(function(input){\n // If customer wants to continue show products again\n if(input.confirm){\n showProducts();\n }\n else{\n console.log(\"Thank you for shopping with Bamazon!\".magenta);\n connection.end();\n }\n })\n}", "function reRun(){\n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"reply\",\n message: \"Would you like to purchase another item?\"\n }\n ]).then(function(answer) {\n if(answer.reply) {\n buy();\n } \n else \n {\n console.log(\"Thanks for shopping Bamazon!\");\n connection.end();\n }\n });\n}", "function callNextActionOrExit(answer) {\n if (answer.userSelection === \"View Products for Sale\") {\n console.log(\"You want to view products\");\n viewProducts();\n } else if (answer.userSelection === \"View Low Inventory\") {\n console.log(\"You want to view inventory\")\n viewLowInventory();\n } else if (answer.userSelection === \"Add to Inventory\") {\n console.log(\"You want to add to inventory\")\n addToInventory();\n } else if (answer.userSelection === \"Add New Product\") {\n console.log(\"You want to add a new product\")\n getNewItem();\n } else {\n database.endConnection();\n }\n}", "function managerOptions() {\n inquirer.prompt([\n {\n name: \"option\",\n message: \"Hello, random manager. What would you like to do today?\",\n type: \"list\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\"]\n }\n ]).then(function (answer) {\n\n //Use a switch case since we have multiple scenarios\n switch (answer.option) {\n\n case \"View Products for Sale\":\n viewProducts();\n break;\n\n case \"View Low Inventory\":\n lowInventory();\n break;\n\n case \"Add to Inventory\":\n addInventory();\n break;\n\n case \"Add New Product\":\n addNew();\n break;\n };\n });\n}", "function ADMIN() {\n //SORT FLIGHTS BY ID, SET ALL DISPLAYS TO TRUE\n flights.sort((a, b) => a.id - b.id);\n for (let i = 0; i < flights.length; i++) {\n flights[i].display = true;\n }\n let ediDel;\n do {\n ediDel = prompt(\n \"Te encuentras en la funci\\u00F3n de ADMINISTRADOR. Indica la funci\\u00F3n a la que quieres acceder: EDIT, DELETE.\",\n \"EDIT,DELETE\"\n );\n salida(ediDel, ADMIN);\n ediDel = ediDel.toUpperCase();\n } while (ediDel !== \"EDIT\" && ediDel !== \"DELETE\");\n\n //JUMP TO NEXT FUNCITON\n if (ediDel === \"EDIT\") {\n EDIT();\n } else if (ediDel === \"DELETE\") {\n DELETE();\n } else {\n alert(\"No te he entendido\");\n ADMIN();\n }\n}", "function again() {\n inquirer.prompt({\n name: \"shop\",\n type: \"list\",\n message: \"Would you like to keep shopping?\",\n choices: [\"Yes\", \"No\"]\n }).then(function(answer){\n if(answer.shop == \"Yes\"){\n list();\n } else {\n console.log(\"Please come back soon!\");\n connection.end();\n }\n })\n}", "function endRepeat() {\n inquirer\n .prompt([{\n type: \"list\",\n name: \"wish\",\n message: \"\\nDo you want to perform another operation?\",\n choices: [\"Yes\", \"No\"]\n }]).then( answer => {\n if (answer.wish === \"Yes\") {\n showMenu();\n } else {\n connection.end();\n }\n })\n}", "function determineNextAction(option) {\n switch(option.toString()) {\n case \"Add Engineer\": \n currentEmployeeType = Engineer.getRole();\n askQuestions(ENGINEER_QUESTIONS);\n break;\n case 'Add Intern':\n currentEmployeeType = Intern.getRole();\n askQuestions(INTERN_QUESTIONS)\n break;\n case 'Exit':\n console.log(\"generate html\");\n GenerateHTML.generateSkeletonHTML(teamArray);\n console.log(\"exiting....\");\n break;\n }\n}", "function shopAgain(){\n inquirer\n .prompt([\n {\n type: \"list\",\n name: \"shop\",\n message: \"Would you like to buy another item?\",\n choices: [\"YES\", \"NO\"]\n }\n ]).then(function(answer) {\n if (answer.shop === \"YES\") {\n runBamazon();\n } else {\n console.log(\"Thank you for shopping with us, have a nice day!\");\n connection.end();\n }\n })\n}", "function initSelectRestaurant(restaurants, searchTerm){\n $(function(){\n\n var getRestaurant = window.LE.restaurants.getRestaurant\n\n userdata.restaurant = null;\n\n //dummy var\n var isSearch = null;\n\n // prepare template\n var source = $(\"#restaurant-dropdown-template\").html();\n var template = Handlebars.compile(source);\n\n html = template(restaurants); \n\n // populate dropdown for restaurants\n var renderingRestaurants = $('#render-restaurants').after(html);\n\n // render confirmation of the search term so the user remembers what they were looking for\n var renderingSearchTerm = $('#select-restaurant-search-term').html(searchTerm);\n\n // when the restaurant changes, we need to display rate and other data\n $.when(renderingRestaurants, renderingSearchTerm).done(function(){\n renderRestaurantDetails(templates.templateRestInfo, getRestaurant, isSearch);\n });\n \n $(\"#select-restaurant-continue-button\").on(\"click\", function(){\n // this is the restaurant id to render later\n var selectedVal = $(\"#restaurant\").val();\n\n if(_debug){ console.log(selectedVal); }\n\n if(selectedVal == \"\"){\n document.getElementById(\"restaurant-alert\").innerHTML = \"Required.\";\n }else{\n\n // cleanup old event handlers before leaving home context\n destroyHome();\n\n userdata.currentRestaurant = selectedVal;\n initSelectItem(selectedVal);\n // ease scroll to top of next view\n $(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\n }\n });\n });\n}", "function displayRestaurant() {\n restaurantDrop.on(\"click\", function (event) {\n if ($(event.target).attr(\"class\") === \"yes\") {\n console.log(\"hi\");\n $(\".body-container\").prepend($(\".location\").show());\n restaurantOption.hide();\n }\n if ($(event.target).attr(\"class\") === \"no\") {\n $(\".final-date\").removeClass(\"hide\");\n restaurantOption.hide();\n viewDate.append($(\".movie-display\"));\n $(\".movie-display\").show();\n restaurantStorage.push(\"\")\n localStorage.setItem(\"Restaurants\", JSON.stringify(restaurantStorage))\n }\n });\n}", "function superAsk(){\n\n inquirer\n .prompt([\n // Here we create a basic text prompt.\n {\n type: \"rawlist\",\n message: \"Greetings, what action would you like to perform today? (select by picking a #)\",\n choices: ['View Product Sales by Department', 'Create New Department', 'Exit'],\n name: \"action\", \n },\n\n ])\n .then(function(response) {\n\n switch (response.action) {\n case 'View Product Sales by Department':\n viewProdSales();\n break;\n case 'Create New Department':\n createDept();\n break;\n case 'Exit':\n process.exit();\n break;\n default:\n console.log('Whoops! Looks like something went wrong. Are you sure you picked a number 1-2?');\n }\n });\n}", "function restartMenu(){\n\tinquirer.prompt([{\n\t\ttype: \"confirm\",\n\t\tname: \"restartSelection\",\n\t\tmessage: \"Would you like to return to the main menu?\"\n\t}]).then(function(restartAnswer){\n\t\tif (restartAnswer.restartSelection === true) {\n\t\t\tmanagerMenu();\n\t\t}\n\t\telse {\n\t\t\tconsole.log(\"Good bye!\"); \n\t\t}\n\t});\n}", "function menu_paquet(){\n\t\taction=prompt(\"F fin de tour | P piocher une carte\");\n\t\taction=action.toUpperCase();\n\t\tif (action != null){\n\t\t\tswitch(action){\n\t\t\t\tcase \"F\":\n\t\t\t\t\tif (att_me.length>0){\n\t\t\t\t\t\t//MAJ des cartes en INV_ATT1,2\n\t\t\t\t\t\tmajCartesEnAttaque();\n\t\t\t\t\t}\n\t\t\t\t\tif (pv_adv==0 || pv_me==0){\n\t\t\t\t\t\tif (pv_adv==0){\n\t\t\t\t\t\t\talert(\"Vous avez gagné !!!\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\talert(\"Vous avez perdu !!!\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/////////////////////////////////Gérer la fin de partie ICI\n\t\t\t\t\t} else {\n\t\t\t\t\t\tIA_jouer(IA_stategie_basic);\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\tcase \"P\":\n\t\t\t\t\tjeu_piocherDsPaquet(true);\t\t\t\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "function start() {\n inquirer.prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View All departments\",\n \"View All employees\",\n \"View All roles\",\n \"Add roles\",\n \"Add departments\",\n \"Add employees\",\n \"Delete roles\",\n \"Delete departments\",\n \"Exit\"\n ]\n })\n .then(function(res) { \n switch (res.action) {\n case \"View departments\":\n viewDep();\n break;\n \n case \"View All employees\":\n viewEmp();\n break;\n \n case \"View All roles\":\n viewRole();\n break;\n \n case \"Add roles\":\n addRole();\n break;\n \n case \"Add departments\":\n addDep();\n break;\n\n case \"Add employees\":\n addEmp();\n break;\n\n case \"Update employee roles\":\n updateEmpRole();\n break;\n \n case \"Delete roles\":\n deleteRole();\n break;\n \n case \"Delete departments\":\n deleteDep();\n break;\n \n case \"Exit\":\n end();\n break\n }\n });\n }", "function handleNewMealRequest(response) {\n // Get a random meal from the random meals list\n var mealIndex = Math.floor(Math.random() * RANDOM_MEALS.length);\n var meal = RANDOM_MEALS[mealIndex];\n\n // Create speech output\n var speechOutput = \"Here's a suggestion: \" + meal;\n\n response.tellWithCard(speechOutput, \"MealRecommendations\", speechOutput);\n}", "function travelTypeChange (userInput) { //takes the result from changeDestinationResult and uses the yesOrNo function to give random part of trip the user wishes to switch.\n if(userInput === \"1\"){\n \n randomDestination = yesOrNo(destination,destination);\n \n }\n else if (userInput === \"2\") {\n \n randomRestaurant = yesOrNo(restaurant,restaurant);\n }\n else if (userInput === \"3\") {\n \n randomTravelType = yesOrNo(transportation, transportation);\n }\n else if (userInput === \"4\") {\n \n randomEntertainment = yesOrNo(entertainment,entertainment);\n }\n}", "function start() {\n inquirer.prompt({\n name: \"select\",\n type: \"rawlist\",\n message: \"What would you like to do?\",\n choices: [\"VIEW SALES\", \"CREATE NEW DEPARTMENT\", \"DELETE DEPARTMENT\", \"EXIT\"]\n }).then(function (answers) {\n if (answers.select.toUpperCase() === \"VIEW SALES\") {\n viewSales();\n } else if (answers.select.toUpperCase() === \"CREATE NEW DEPARTMENT\") {\n newDepartment();\n } else if (answers.select.toUpperCase() === \"DELETE DEPARTMENT\") {\n deleteDepartment();\n } else {\n // Selecting \"EXIT\" just takes the user here\n connection.end();\n }\n });\n}", "function nextAction() {\n\tinquirer.prompt({\n\t\tmessage: \"What would you like to do next?\",\n\t\ttype: \"list\",\n\t\tname: \"nextAction\",\n\t\tchoices: [\"Add More Items\", \"Remove Items\", \"Alter Item Order Amount\", \"Survey Cart\", \"Checkout\"]\n\t})\n\t\t.then(function (actionAnswer) {\n\t\t\tswitch (actionAnswer.nextAction) {\n\t\t\t\tcase \"Add More Items\":\n\t\t\t\t\t// go to the start function\n\t\t\t\t\tstart();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Remove Items\":\n\t\t\t\t\t// go to the removal function\n\t\t\t\t\tremoveItem();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Checkout\":\n\t\t\t\t\t// go to the checkout tree;\n\t\t\t\t\tverifyCheckout();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Alter Item Order Amount\":\n\t\t\t\t\t// go to the function that alters the shopping cart qty\n\t\t\t\t\talterItem();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Survey Cart\":\n\t\t\t\t\t// look at the cart\n\t\t\t\t\tcheckoutFunction();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: console.log(\"how did you get here?\")\n\t\t\t}\n\t\t})\n}", "function anotherAction() {\n\n inquirer\n .prompt([\n {\n name: \"confirm\",\n type: \"confirm\",\n message: \"Would you like to complete another action?\"\n }\n ])\n .then(function (answer) {\n if (answer.confirm == true) {\n showMenu();\n }\n else {\n console.log(\"Goodbye.\");\n connection.end();\n }\n\n });\n\n}", "onSelectRestaurant(restaurant){\n \n this.infoWindow.setContent(`<span> ${restaurant.name} </span><span> ${restaurant.address} </span>`)\n this.infoWindow.open(this.map,this.markers.find(m=>m.restaurant.address === restaurant.address));\n }", "function askForMenuOption() {\n\tlet selection = PROMPT.question(\" >> \");\n\tswitch (selection) {\n\t\tcase \"new\":\n\t\t\taddNewMovie();\n\t\t\taddMovieRating(movies.length - 1);\n\t\t\tbreak;\n\t\tcase \"sort\":\n\t\t\tsetSortOrder();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (selection == \"\" || (!MOVIE_ID_REGEX.test(selection) || selection > movies.length)) {\n\t\t\t\tconsole.log(\"--- Movie ID invalid - Try again ---\");\n\t\t\t\taskForMenuOption();\n\t\t\t}\n\t\t\taddMovieRating(Number(selection) - 1);\n\t\t\tbreak;\n\n\t}\n}", "function _wantToGoFunction() {\n if (vm.dataCheck) {\n\n for (var i = 0; i < vm.dataCheck.length; i++) {\n\n if (vm.dataCheck[i].favoriteType == 2) {\n\n vm.$alertService.warning('Already in your \"Want To Go\" list!');\n }\n }\n\n } else {\n\n vm.favoriteTypeData = {\n favoriteType: 2,\n placeId: vm.place.id\n }\n\n vm.$userFavoritePlacesService.apiPostUserFavoritePlaces(vm.favoriteTypeData, vm.onFavoriteSuccess, vm.onFavoriteError);\n }\n }", "function continueorquit(data) {\n inquirer\n .prompt([\n {\n type: \"list\",\n name: \"CorQ\",\n message: \"Would you like to Add Another employee\",\n choices: ['Yes', 'No']\n },\n ])\n .then(quitData => {\n switch (quitData.CorQ) {\n case 'Yes': getEmployee()\n break\n case 'No': createWebsite()\n break\n }\n })\n\n\n}", "function another() {\n inquirer\n .prompt(\n {\n name: 'another',\n type: 'confirm',\n message: 'Would you like to continue shopping?'\n },\n\n )\n .then(function (answer) {\n if (answer.another === true) {\n start();\n } else {\n console.log('Thanks for shopping with us! Your orders will be shipped promptly.')\n connection.end();\n }\n });\n\n}", "function promptAction() {\n inquirer.prompt([{\n type: 'list',\n message: 'Select from list below what action you would like to complete.',\n choices: ['View Products for Sale', 'View Low Inventory', 'Add to Inventory', 'Add New Product'],\n name: \"action\"\n }, ]).then(function(selection) {\n switch (selection.action) {\n case 'View Products for Sale':\n viewAllProducts();\n break;\n\n case 'View Low Inventory':\n lowInventoryList();\n break;\n\n case 'Add to Inventory':\n addInventory();\n break;\n\n case 'Add New Product':\n addNewProduct();\n break;\n }\n }).catch(function(error) {\n throw error;\n });\n}", "function systemSelection(option){\n\tvar check = option; \n\tif(vehicleFuel<=0){\n\t\tgameOverLose();\n\t}\n\n\telse{\n\n\n\tif(currentLocation===check){\n\t\t\tgamePrompt(\"Sorry Captain, You're already there or have been there. I will return you to the main menu to make another choice\",beginTravel);\n\t\t\t}\n\n\telse{\n\t\n\t\t\tif(check.toLowerCase() === \"e\"){\n\t\t\t\tvehicleFuel=(vehicleFuel-10);\n\t\t\t\tcurrentLocation=\"e\" ;\n\t\t\t\tgamePrompt(\"Flying to Earth...You used 10 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToEarth);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"m\"){\n\t\t\t//need to add a 'visited' conditional\n\t\t\tvehicleFuel=(vehicleFuel-20);\n\t\t\tcurrentLocation=\"m\" ;\n\t\t\t\tgamePrompt(\"Flying to Mesnides...You used 20 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\", goToMesnides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"l\"){\n\t\t\tvehicleFuel=(vehicleFuel-50);\n\t\t\tcurrentLocation=\"l\" ;\n\t\t\tgamePrompt(\"Flying to Laplides...You used 50 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToLaplides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"k\"){\n\t\t\tvehicleFuel=(vehicleFuel-120);\n\t\t\tcurrentLocation=\"k\" ;\n\t\t\tgamePrompt(\"Flying to Kiyturn...You used 120 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToKiyturn);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"a\"){\n\t\t\tvehicleFuel=(vehicleFuel-25);\n\t\t\tcurrentLocation=\"a\";\n\t\t\tgamePrompt(\"Flying to Aenides...You used 25 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToAenides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"c\"){\n\t\t\tvehicleFuel=(vehicleFuel-200);\n\t\t\tcurrentLocation=\"c\" ;\n\t\t\tgamePrompt(\"Flying to Cramuthea...You used 200 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToCramuthea);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"s\"){\n\t\t\tvehicleFuel=(vehicleFuel-400);\n\t\t\tcurrentLocation=\"s\" ;\n\t\t\tgamePrompt(\"Flying to Smeon T9Q...You used 400 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToSmeon);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"g\"){\n\t\t\tvehicleFuel=(vehicleFuel-85);\n\t\t\tcurrentLocation=\"g\" ;\n\t\t\tgamePrompt(\"Flying to Gleshan 7Z9...You used 85 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToGleshan);\n\t\t\t}\n\t\telse{\n\t\t\tgamePrompt(\"Sorry Captain, I did not understand you. I will return you to the main menu\",beginTravel);\n\t\t}\n\t}\n\t}\n}", "function askAgain(){\n\tconsole.log(\"=============================================================\");\n\tinquirer.prompt([\n\t\t{\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"confirm\",\n\t\t\tmessage: \"Would you like to do another task?\",\n\t\t\tdefault: false\n\t\t}\n\t]).then(function(again){\n\t\tif (again.confirm){\n\t\t\tsupervisorOptions();\n\t\t}\n\t\telse{\n\t\t\tconsole.log(\"All tasks are done.\");\n\t\t\t// Exits node program execution\n\t\t\tprocess.exit();\n\t\t}\n\t});\n}", "prompt() {\n // Fetch appointment types from Acuity\n acuity.request('/appointment-types', function (err, res, appointmentTypes) {\n\n // Build some buttons for folks to choose a class\n const replies = appointmentTypes\n // Filter types for public classes\n .filter(appointmentType => appointmentType.type === 'class' && !appointmentType.private)\n // Create a button for each type\n .map(appointmentType => client.makeReplyButton(\n appointmentType.name,\n null,\n 'bookClass',\n {appointmentTypeID: appointmentType.id}\n ));\n\n // Set the response intent to prompt to choose a type\n client.addResponseWithReplies('prompt/type', null, replies);\n\n // End the asynchronous prompt\n client.done();\n });\n }", "function fancyRestauratMenu() {\n subTitle.innerText = fancyRestaurantWelcome;\n firstButton.classList.add(\"hidden\");\n secondButton.classList.add(\"hidden\");\n fancyDiv.classList.remove(\"hidden\");\n\n handleFancyRestaurantChoice();\n}", "function start() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"What would you like to do?\",\n choices: [\"Purchase Items\", \n \"Exit\"],\n }\n ]).then(function(answer) {\n\n // Based on the selection, the user experience will be routed in one of these directions\n switch (answer.choice) {\n case \"Purchase Items\":\n displayItems();\n break;\n case \"Exit\":\n exit();\n break;\n }\n });\n} // End start function", "function anythingElse() {\n inquirer\n .prompt([\n {\n type: \"confirm\",\n message: \"Anything Else?\",\n name: \"choice\"\n }\n ])\n .then(res => {\n if (res.choice) {\n displayProducts();\n } else {\n console.log(\"Thank You!\");\n console.log(`Total: $${total}`);\n connection.end();\n }\n });\n}", "function fightOrCave() {\n\n let whereNext = prompt(\"Vart vill du gå nu? Ange fight för att gå och bekämpa monstret eller grottan för att gå till grottan\").toLowerCase();\n\n if (whereNext === \"grottan\"){\n goToCaveSecondTime();\n }\n else if (whereNext === \"fight\") {\n alert(\"Oops, du har ju inte skölden än... Du måste hämta den först. Klicka ok för att gå till grottan.\")\n goToCaveSecondTime();\n }\n else {\n alert(\"Vänligen ange fight eller grottan\")\n fightOrCave()\n }\n\n \n}", "function promptOptions() {\n inquirer.prompt([\n {\n type: \"list\",\n message: \"Would you like to ... ?\",\n choices: [\"Continue Shopping\", \"Update Cart\", \"Checkout\"],\n name: \"choice\"\n }\n ]).then(function (option) {\n switch (option.choice) {\n case \"Continue Shopping\":\n promptBuy();\n break;\n case \"Update Cart\":\n updateCart();\n break;\n case \"Checkout\":\n checkout();\n break;\n }\n });\n}", "function endStart(){\n inquirer.prompt({\n name: \"confirm\",\n type: \"confirm\",\n message: \"continue shopping?\",\n // default: true\n }).then(function (data) {\n if (data.confirm === false)\n \n process.exit();\n else \n start();\n });\n}", "function managerOptions() {\n inquirer.prompt([\n {\n type: \"checkbox\",\n name: \"managerTask\",\n message: \"Hi manager. What would you like to do?\",\n choices: [\"View products for sale\", \"View low inventory\", \"Add to inventory\", \"Add New Product\"]\n }\n ]).then(function (manager) {\n var task = manager.managerTask;\n if (task == \"View products for sale\") {\n viewProducts();\n }\n else if (task == \"View low inventory\") {\n lowinventory();\n }\n else if (task == \"Add to inventory\") {\n addToInvetory();\n }\n else if (task == \"Add New Product\") {\n addProduct();\n }\n });\n}", "function returnToMenu() {\n\tinquirer.prompt({\n\t\tname: \"choice\",\n\t\ttype: \"confirm\",\n\t\tmessage: \"Would you like to return to the menu?\"\n\n\t}).then(function(input) {\n\t\tif (input.choice === true) {\n\t\t\tmenu();\n\t\t} else {\n\t\t\tconnection.end();\n\t\t}\n\t})\n}", "function menuoption(){\n inquirer.prompt({\n type: \"list\",\n name : \"menu\",\n message : \"What do you want to see ?\",\n choices : [\"\\n\",\"View Products for Sale\",\"View Low Inventory\",\"Add to Inventory\",\"Add New Product\"]\n\n }).then(function(answer){\n // var update;\n // var addnew;\n console.log(answer.menu);\n //if else option to compare user input and call the required function\n if(answer.menu == \"View Products for Sale\" ){\n showitem();\n }else if(answer.menu == \"View Low Inventory\"){\n \n lowinventory();\n }else if(answer.menu == \"Add to Inventory\"){\n updateinventory();\n // updateonecolumn(itemidinput);\n }else if(answer.menu == \"Add New Product\"){\n addnewproduct();\n }\n \n });\n }", "function shop() {\n\n inquirer.prompt([{\n name: \"menu\",\n type: \"list\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Update Inventory\", \"Add New Product\"]\n }]).then(function (answer) {\n\n switch (answer.menu) {\n case \"View Products for Sale\":\n forSale();\n break;\n\n case \"View Low Inventory\":\n lowStock();\n break;\n\n case \"Add New Product\":\n addThing();\n break;\n\n case \"Update Inventory\":\n moreStuff();\n break;\n }\n });\n}", "buildGoOption(term) {\n let isValidPatp = urbitOb.isValidPatp(term.substr(1));\n let isStation = isValidStation(term);\n let details = isStation && getStationDetails(term);\n // use collection description if it's a collection\n let displayTextTerm = isStation ? details.type == 'text' ? `${details.station.split(\"/\")[0]} / ${details.stationTitle}` : details.station.split(\"/\").join(\" / \") : term;\n\n let displayText = `go ${displayTextTerm}`;\n let helpText = isStation ?\n `Go to ${details.cir} on ~${details.host}` :\n `Go to the profile of ${term}`\n\n return {\n name: `go ${term}`,\n action: () => {\n let targetUrl;\n if (isValidPatp) {\n targetUrl = profileUrl(term.substr(1))\n this.props.transitionTo(targetUrl);\n } else if (isStation) {\n targetUrl = (details.type === \"text-topic\") ? details.postUrl : details.stationUrl\n this.props.transitionTo(targetUrl);\n }\n },\n displayText,\n helpText\n };\n }", "function handle_again() {\n var current = current_selection();\n // call the initiator function on the current selection\n window.initiate_fcn(current, $(featherlight_selector()).get(0));\n}", "function menu() {\n var option = parseInt(prompt('Choississez une option :'));\n\n do {\n if (option == 1) {\n list(), navigation();\n var option = parseInt(prompt('Choississez une option :'));\n } else if (option == 2) {\n addContact();\n var option = parseInt(prompt('Choississez une option :'));\n }\n } while (option != 3)\n alert(\"Aurevoir et à bientot !\");\n}", "function askToContinue() {\n\t\tinquirer\n\t\t\t.prompt([\n\t\t\t\t{\n\t\t\t\t\ttype: 'confirm',\n\t\t\t\t\tmessage: 'Do you want to play again?',\n\t\t\t\t\tname: 'confirm',\n\t\t\t\t\tdefault: true\n\t\t\t\t}\n\t\t\t])\n\t\t\t.then(function(response) {\n\t\t\t\tif (response.confirm === true) {\n\t\t\t\t\tstartGame();\n\t\t\t\t} \n\t\t\t});\n\t}", "function cardMakeContinue() { // function that asks to continue making cards//\n\tinquirer.prompt({\n\t\t\ttype: \"list\",\n\t\t\tmessage:\"\\nContinue? Yes or No \",\n\t\t\tchoices: [\"Yes\", \"No\"],\n\t\t\tname: \"ynChoices\"\n\t\t\t}).then(function(continuebasicYN){\n\t\t\tvar ynChoices = continuebasicYN.ynChoices;\n \t\n\t\t\tif (ynChoices === \"Yes\") \n\t\t\t\t{\n\t\t\t\tgetInfo(loop); // calls function to enter another card\n\t\t\t\t}\n\t\t\t\telse \n\t\t\t\t{ console.log(\"Good Job, you are finished!\");\n\t\t\t\t}\n\t\t\t}) // close cardMakecontinue prompts\n\n\t\t}", "function frostingChoice(item) {\n frostingChosen = true;\n if (typeof preFrostingChoice !== 'undefined'){\n preFrostingChoice.style.backgroundColor = \"white\";\n }\n\n item.style.backgroundColor = \"lightgray\";\n preFrostingChoice = item;\n\n checkPrice();\n}", "function keepShopping(){\n inquirer.prompt([\n {\n type: \"confirm\",\n message: \"do you want to keep shopping for beers?\",\n name: \"confirm\"\n }\n ]).then(function(res){\n if (res.confirm){\n console.log(\"----------------\");\n showProducts();\n } else {\n console.log('Thank you for shopping in our online bar, happy drinking!');\n connection.end();\n }\n })\n}", "function promptContinue(){\n return inquirer.prompt([\n {\n type: \"list\",\n name: \"Job\", \n choices: [\"Engineer\", \"Intern\", \"Finish building my team\"]\n },\n])\n.then((answers) => {\n if(answers.Job === \"Engineer\"){\n promptEngineer();\n } else if (answers.Job === \"Intern\"){\n promptIntern();\n } else {\n generate.generateHTML(employeeArray);\n console.log(\"Your team is being built!\")\n }\n})\n}", "async promptForMenu(step) {\n return step.prompt(MENU_PROMPT, {\n choices: [\"Donate Food\", \"Find a Food Bank\", \"Contact Food Bank\"],\n prompt: \"Do you have food to donate, do you need food, or are you contacting a food bank?\",\n retryPrompt: \"I'm sorry, that wasn't a valid response. Please select one of the options\"\n });\n }", "function askUser() {\n inquirer.prompt(\n {\n name: \"action\",\n message: \"WHAT WOULD YOU LIKE TO DO?\",\n type: \"list\",\n choices: [\"BROWSE ITEMS\", \"EXIT\"]\n }\n ).then(function (answer) {\n switch (answer.action) {\n case \"BROWSE ITEMS\":\n showItems();\n break;\n\n case \"EXIT\":\n connection.end();\n break;\n }\n });\n}", "function checkIfVacationNeedsReplacement(bool){\n let ask;\n let empty = \"\";\n if (bool === true){\n alert(\"Enjoy your Vacation!\");\n loopBreak = true;\n return empty;\n }\n else{\n ask = prompt(\"What part of your vacation would you like to replace? Type destination, food, transportation, entertainment, all, or done.\");\n return ask;\n }\n}", "function goToAenides(){\n\t\tif(visitedAen===0){\n\t\t\tvisitedAen=1;\n\t\t\t// artifacts=1;\n\t\t\tgamePrompt(\"You discover upon arrival to Aenides that they are a hostile people. You attempt to land, but they begin to fire upon your S.R.S.V. and you are forced to retreat.\",beginTravel);\n\t\t}else{\n\t\t\tgamePrompt([\"You've already been here!\",\"Where to next?\"],beginTravel);\n\t\t}\n}", "function foodRunnerSelector() {\n \n if (document.getElementById(\"foodRunnerYes\").checked == true) {\n\tdoTipFoodRunner = true;\n\tdocument.getElementById(\"foodRunnerConfirm\").innerHTML = \"Food Runner will be tipped out\";}\n else { \n\tdoTipFoodRunner = false;\n\tdocument.getElementById(\"foodRunnerConfirm\").innerHTML = \"No tip out for Food Runner\"; \n }\n return doTipFoodRunner\n}", "function optionMenu(){\n inquirer\n .prompt({\n name: \"menu\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View Products for Sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\",\n \"Nothing, I've changed my mind.\"\n ]\n })\n .then(function(answer) {\n switch(answer.menu){\n case \"View Products for Sale\":\n showProducts();\n\n // continuePrompt is delayed to allow showProducts to be completed\n setTimeout(continuePrompt,300);\n break;\n\n case \"View Low Inventory\":\n lowInventory();\n\n // continuePrompt is delayed to allow lowInventory to be completed\n setTimeout(continuePrompt,300);\n break;\n\n case \"Add to Inventory\":\n showProducts()\n\n // addInventory is delayed to allow lowInventory to be completed\n setTimeout(addInventory,300);\n break;\n\n case \"Add New Product\":\n newProduct();\n break;\n\n case \"Nothing, I've changed my mind.\":\n console.log(\"\\nHave a nice day!\\n\");\n connection.end();\n break;\n }\n });\n}", "function confirmGoalsAndContinue() {\n if ($('.js-goal-rank').length > 1) {\n reorderItems('#goal-rank-num li', '#sortable-goals');\n }\n //Make sure the number labels are in the proper order, the user might navigate back to goal ranking using the back button\n utility.getInitialOrder('#goal-rank-num li');\n SALT.trigger('goalrank:updated');\n $('#js-rank-container').removeClass('active-panel');\n $('.js-onboarding-exit, .outer-progress-meter-wrapper').show();\n //Show the first Q+A panel now that goal rank is hidden\n $('.js-profileQA-container').children().first().addClass('active-panel');\n focusFirstInput();\n //Scroll to the top of the screen in case so that the user is always seeing the top of the new panel\n $('html, body').animate({scrollTop: 0}, 300);\n initializeProgressMeter();\n }", "function noInventoryOptions() {\n inquirer.prompt([\n {\n type: \"list\",\n message: \"Do you want to choose a new item or quit?\",\n choices: [\"NEW-ITEM\", \"QUIT\"],\n name: \"startAgain\"\n }\n ])\n .then(function(answer6) {\n if (answer6.startAgain == \"NEW-ITEM\") {\n displayProducts(); \n }\n if (answer6.startAgain == \"QUIT\") {\n console.log(\"Thank you. Good-bye!\");\n connection.end();\n }\n });\n}", "function onAfterLocationUpdate() {\n $.fancybox.showLoading(getLabel('ajax.finding-restaurants'));\n location.href = ctx + '/app/' + getLabel('url.find-takeaway') + '/session/loc';\n}", "function returntoMenu() {\n inquirer.prompt({\n name: 'return',\n type: 'rawlist',\n choices: [\"Return to Main Menu\", \"Exit\"],\n message: \"Would you like to return to main menu or exit?\"\n }).then(function(answer){\n if (answer.return === \"Return to Main Menu\") {\n start();\n }\n else {\n connection.end();\n }\n })\n}", "function askAgain() {\n\n inquirer\n .prompt({\n name: \"nextSteps\",\n type: \"list\",\n message: \"Would you like to continue shopping?\",\n choices: [\"YES\", \"NO\"]\n })\n .then(function(answer) {\n \n if (answer.nextSteps.toUpperCase() === \"NO\") {\n\n console.log(chalk.yellow(\"\\nHope you had a pleasant experience. Come again soon!\\n\"));\n\n //turns off the connection from db\n connection.end();\n }\n\n else {\n\n \t//the first function is called again\n \treadProducts();\n\n\n } \n\n });\n}", "function options() {\n inquirer\n .prompt({\n name: \"departmentOfManagers\",\n type: \"list\",\n message: \"Which saleDepartment you are looking for ?\",\n choices: [\"Products of sale\", \"Low Inventory\", \"Add to Inventory\", \" Add New Product\"]\n })\n .then(function(answer) {\n // based on their answer of functions\n if (answer.options === \"Products of sale\") {\n viewSaleProduct();\n }\n else if(answer.options === \"Low Inventory\") {\n lowInventory();\n }\n else if(answer.options === \"Add to Inventory\") {\n addInventory();\n } \n else if(answer.options === \"Add New Product\") \n {\n addNewProduct();\n } else{\n connection.end();\n }\n });\n}", "function chooseFoodQuiz() {\n $(foodQuiz).click();\n questions = foodQuestions;\n finalQuestion = foodQuestions.length - 1;\n startQuiz();\n}", "function nextPrompt(){\n inquirer.prompt([\n {\n name: \"status\",\n type: \"list\",\n message: \"Buy more?\",\n choices: [\"Buy more\", \"Exit\"]\n }\n ]).then(answer => {\n if(answer.status === \"Buy more\"){\n displayInventory();\n promptBuy();\n } else{\n console.log(\"Thank you. Goodbye.\");\n connection.end();\n }\n })\n}", "function chooseAction() {\n\tinquirer\n\t\t.prompt({\n\t\t\tname: \"action\", \n\t\t\ttype: \"rawlist\", \n\t\t\tmessage: \"What do you want to do?\", \n\t\t\tchoices: [\"VIEW PRODUCTS\", \"VIEW LOW INVENTORY\", \"ADD TO INVENTORY\", \"ADD NEW PRODUCT\", \"QUIT\"]\n\t\t})\n\t\t.then(function(ans) {\n\t\t\tif(ans.action.toUpperCase() ===\"VIEW PRODUCTS\") {\n\t\t\t\tviewProducts(); \n\t\t\t} \n\t\t\telse if (ans.action.toUpperCase() === \"VIEW LOW INVENTORY\") {\n\t\t\t\tviewLowInventory(); \n\t\t\t}\n\t\t\telse if (ans.action.toUpperCase() === \"ADD TO INVENTORY\") {\n\t\t\t\taddInventory(); \n\t\t\t}\n\t\t\telse if (ans.action.toUpperCase() === \"ADD NEW PRODUCT\") {\n\t\t\t\taddNewProduct(); \n\t\t\t}\n\t\t\telse {\n\t\t\t\tendConnection(); \n\t\t\t}\n\t\t})\n}", "function mainMenu(){\n inquirer.prompt([\n {\n name: \"mainOptions\",\n type: \"list\",\n message:\"What would you like to do?\",\n choices: [\"View Products\", \"View Low Inventory Products\", \"Add Product Inventory\", \"Add New Product\", \"Exit\"]\n }\n ]).then(function(answer){\n switch (answer.mainOptions) {\n case \"View Products\":\n displayInventory();\n break;\n case \"View Low Inventory Products\":\n displayLowInv();\n break;\n case \"Add Product Inventory\":\n addInventory();\n break;\n case \"Add New Product\":\n addProduct();\n break;\n case \"Exit\":\n console.log(\"***********************************************************\");\n console.log(\"* Have a productive day :-) *\");\n console.log(\"***********************************************************\");\n connection.end();\n };\n });\n}", "function managerPrompt() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"list\",\n message: \"Hello Bamazon manager, what would you like to do today?\",\n choices: [\n \"View Products for sale?\",\n \"View Low Inventory?\",\n \"Add to Inventory?\",\n \"Add a New Product?\"\n ]\n })\n .then(function(answer) {\n switch (answer.action) {\n case \"View Products for sale?\":\n viewAllProducts();\n break;\n\n case \"View Low Inventory?\":\n viewLowInventory();\n break;\n\n case \"Add to Inventory?\":\n addInventory();\n break;\n\n case \"Add a New Product?\":\n addNewProduct();\n break;\n }\n\n });\n\n}", "function userSearch() {\n\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"What would you like to do:\",\n choices: [\"View product sales by Department\", \"Create new department\", \"Exit Supervisor Mode\"]\n }\n\n ]).then(function (manager) {\n\n switch (manager.choice) {\n case \"View product sales by Department\":\n viewDepartments();\n break;\n \n case \"Create new department\":\n addNewDepartment();\n break;\n\n case \"Exit Supervisor Mode\":\n console.log(\"\\nSee ya later!\\n\");\n connection.end ();\n break;\n }\n\n });\n\n}" ]
[ "0.68103266", "0.64964914", "0.6342976", "0.62424755", "0.61173964", "0.6034379", "0.5987297", "0.58292925", "0.5781033", "0.5737571", "0.57127887", "0.5708035", "0.5688682", "0.56830406", "0.56636477", "0.56604296", "0.56401587", "0.5638404", "0.56222045", "0.5614877", "0.5614036", "0.5600347", "0.5595774", "0.5577155", "0.55717146", "0.55594057", "0.55581653", "0.55518633", "0.5548958", "0.5548455", "0.55350167", "0.5534366", "0.5529235", "0.551177", "0.5496822", "0.5494539", "0.5492613", "0.5483039", "0.5469218", "0.5468171", "0.54679537", "0.54669416", "0.54539996", "0.545248", "0.5450221", "0.54411936", "0.5439916", "0.5433537", "0.54230577", "0.54205126", "0.54155624", "0.5410685", "0.5398335", "0.5394103", "0.53911227", "0.5388845", "0.5386328", "0.53853667", "0.5376627", "0.53737193", "0.5367417", "0.5363824", "0.53552276", "0.53495127", "0.5343098", "0.533838", "0.5334769", "0.53335583", "0.5333456", "0.5319867", "0.5306104", "0.5301944", "0.5300739", "0.5299799", "0.52993965", "0.52922577", "0.5288702", "0.5283504", "0.5283024", "0.5280796", "0.5275275", "0.527482", "0.5273145", "0.52649635", "0.52635384", "0.5260161", "0.5260071", "0.52577615", "0.5254783", "0.52532935", "0.52527183", "0.5251287", "0.52444947", "0.524228", "0.5241531", "0.5236718", "0.5236086", "0.52356243", "0.5228005", "0.5226266" ]
0.559048
23
Continue or regret option for fastfood restaurant.
function regretFastFoodRestaurantOption() { subTitle.innerText = "Are you sure?"; firstButton.innerText = "Yes, continue"; firstButton.onclick = function() { fastFoodRestaurantScene(); } secondButton.innerText = "No, go back"; secondButton.onclick = function() { startFunction(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function handleFastRestaurantChoice() {\n /** @type {HTMLInputElement} Input field. */\n const fastDishInput = document.getElementById(\"fast-input\").value;\n const fastfoodMenu = [\"cheeseburger\", \"doubleburger\", \"veganburger\"]\n\n if(fastDishInput == fastfoodMenu[0]) {\n restaurantClosing();\n } else if (fastDishInput == fastfoodMenu[1]) {\n restaurantClosing();\n } else if (fastDishInput == fastfoodMenu[2]) {\n restaurantClosing();\n } else {\n fastFoodRestaurantScene();\n }\n}", "function handleFancyRestaurantChoice() {\n /** @type {HTMLInputElement} Input field. */\n const dishInput = document.getElementById(\"dish-input\").value;\n const fancyMenu = [\"pizza\", \"paella\", \"pasta\"]\n\n if(dishInput == fancyMenu[0]) {\n restaurantClosing();\n } else if (dishInput == fancyMenu[1]) {\n restaurantClosing();\n } else if (dishInput == fancyMenu[2]) {\n restaurantClosing();\n } else {\n fancyRestauratMenu();\n }\n}", "function changeRestaurant() {\n if (selectedRestaurant < rRestaurants.length - 1) {\n const next = selectedRestaurant + 1;\n dispatch(setSelectedRestaurant(next));\n } else {\n dispatch(setSelectedRestaurant(0));\n }\n }", "function option() {\n\tinquirer\n\t\t.prompt(\n\t\t\t{\n\t\t\t\tname: \"option\",\n\t\t\t\ttype: \"rawlist\",\n\t\t\t\tmessage: \"Would you like to continue to shop?\",\n\t\t\t\tchoices: [\"yes\", \"no\"]\n\t\t\t}\n\t\t)\n\t\t.then(function (answer) {\n\t\t\tif (answer.option === \"yes\") {\n\t\t\t\tdisplayProducts();\n\t\t\t}\n\n\t\t\telse {\n\t\t\t\tconsole.log(\"Thank you for shopping with us at Bamazon, now get the hell out of here!\")\n\t\t\t\tconnection.end()\n\t\t\t}\n\t\t})\n}", "async promptForFood(step) {\n if (step.result && step.result.value === 'yes') {\n\n return await step.prompt(FOOD_PROMPT, `Tell me what kind of food would you prefer ?`,\n {\n retryPrompt: 'Sorry, I do not understand or say cancel.'\n }\n );\n } else {\n return await step.next(-1);\n }\n}", "function restartMenu(){\n\tinquirer.prompt([{\n\t\ttype: \"confirm\",\n\t\tname: \"restartSelection\",\n\t\tmessage: \"Would you like to continue shopping?\"\n\t}]).then(function(restartAnswer){\n\t\tif (restartAnswer.restartSelection === true) {\n\t\t\tcustomerMenu();\n\t\t}\n\t\telse {\n\t\t\tconsole.log(\"Thank you for shopping!\\nYour total is $\" + totalCost); \n\t\t}\n\t});\n}", "function selectRestaurant() {\n let restaurant = document.getElementById(\"dropdown\").firstChild.value;\n let clear;\n if (restaurant === null) {\n return;\n } else if (Object.keys(order.items).length > 0) {\n //Confirm the if the user wants to proceed to clear the order\n clear = confirm(\"Would you like to clear the current order?\");\n if(!clear) {\n document.getElementById(\"dropdown\").firstChild.value = \"\";\n return;\n }\n }\n\n clearOrder(true);\n\n changeRestaurant(restaurant);\n\n}", "generateRestaurant(){\n// we want the user to input the zipcode they want to search, the food type they want to eat\n// and the rating (1-5) \n// getRestaurants()\n\n\n}", "function selectRestaurant(){\r\n\tlet select = document.getElementById(\"restaurant-select\");\r\n\tlet name = select.options[select.selectedIndex]\r\n\t//checks for undefined\r\n\tif (name !== undefined){\r\n\t\t//creates custom url that tells server what the currently selected restaurant is\r\n\t\tname= select.options[select.selectedIndex].text;\r\n\t\tname = name.replace(/\\s+/g, '-');\r\n\t\tlet request = new XMLHttpRequest();\r\n\t\r\n\t\trequest.onreadystatechange = function(){\t\r\n\t\t\tif(this.readyState == 4 && this.status == 200){ //if its reggie\r\n\t\t\t\tlet data = JSON.parse(request.responseText);\r\n\t\t\t\t//set menu[0] equal to the data from the server\r\n\t\t\t\tmenu[0] = data;\r\n\t\t\t\tconsole.log(menu);\r\n\t\t\t\tlet result = true;\r\n\t\r\n\t\t\t\t//If order is not empty, confirm the user wants to switch restaurants.\r\n\t\t\t\tif(!isEmpty(order)){\r\n\t\t\t\t\tresult = confirm(\"Are you sure you want to clear your order and switch menus?\");\r\n\t\t\t\t}\r\n\t\r\n\t\t\t\t//If switch is confirmed, load the new restaurant data\r\n\t\t\t\tif(result){\r\n\t\t\t\t\t//Get the selected index and set the current restaurant\r\n\t\t\t\t\tlet selected = select.options[select.selectedIndex].value;\r\n\t\t\t\t\tcurrentSelectIndex = select.selectedIndex;\r\n\t\t\t\t\t//In A2, current restaurant will be data you received from the server\r\n\t\t\t\t\tcurrentRestaurant = menu[0];\r\n\t\t\r\n\t\t\t\t\t//Update the page contents to contain the new menu\r\n\t\t\t\t\tif (currentRestaurant !== undefined){\r\n\t\t\t\t\t\tdocument.getElementById(\"left\").innerHTML = getCategoryHTML(currentRestaurant);\r\n\t\t\t\t\t\tdocument.getElementById(\"middle\").innerHTML = getMenuHTML(currentRestaurant);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//Clear the current oder and update the order summary\r\n\t\t\t\t\torder = {};\r\n\t\t\t\t\tupdateOrder(currentRestaurant);\r\n\t\t\r\n\t\t\t\t\t//Update the restaurant info on the page\r\n\t\t\t\t\tlet info = document.getElementById(\"info\");\r\n\t\t\t\t\tinfo.innerHTML = currentRestaurant.name + \"<br>Minimum Order: $\" + currentRestaurant.min_order + \"<br>Delivery Fee: $\" + currentRestaurant.delivery_fee + \"<br><br>\";\r\n\t\t\t\t}else{\r\n\t\t\t\t\t//If they refused the change of restaurant, reset the selected index to what it was before they changed it\r\n\t\t\t\t\tlet select = document.getElementById(\"restaurant-select\");\r\n\t\t\t\t\tselect.selectedIndex = currentSelectIndex;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//make request to server with custom url based on the currently selected restaurant\r\n\t\trequest.open(\"GET\",\"http://localhost:3000/menu-data/\"+name,true);\r\n\t\trequest.send();\r\n\t}\r\n}", "function mainMenu() {\n inquirer\n .prompt([\n {\n type: \"confirm\",\n name: \"choice\",\n message: \"Would you like to place another order?\"\n }\n ]).then(function (answer) {//response is boolean only\n if (answer.choice) { //if true, run func\n startBamazon();\n } else {\n console.log(\"Thanks for shopping at Bamazon. See you soon!\")\n connection.end();\n }\n })\n}", "function eatFood() {\n if (gameState.snakeStart === gameState.food) {\n gameState.snakeLength++;\n\n updateFoodCell(\"remove\", gameState.food);\n\n createFood();\n updateFoodCell(\"add\", gameState.food);\n gameState.score++;\n increaseSpeed();\n showScore();\n return true;\n }\n}", "function startOver() {\n inquirer\n .prompt({\n name: \"continue\",\n type: \"confirm\",\n message: \"Would you like to buy another product?\",\n default: true\n })\n .then(function(answer) {\n if (answer.continue) {\n purchaseChoice();\n }\n else {\n connection.end();\n }\n })\n}", "async function makeFood(step) {\n try {\n if (step < brusselSprouts.length) {\n await addFood(brusselSprouts[step], \"#brusselSprouts\"); // Coloco o passo atual na fila\n makeFood(step + 1); // Dou o próximo passo na receita\n } else {\n throw \"End of recipe.\";\n }\n } catch (err) {\n console.log(err);\n }\n}", "function reRun(){\n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"reply\",\n message: \"Would you like to purchase another item?\"\n }\n ]).then(function(answer) {\n if(answer.reply) {\n buy();\n } \n else \n {\n console.log(\"Thanks for shopping Bamazon!\");\n connection.end();\n }\n });\n}", "async displayFoodChoice(step) {\n const user = await this.userProfile.get(step.context, {});\n if (user.food) {\n await step.context.sendActivity(`Your name is ${ user.name } and you would like this kind of food : ${ user.food }.`);\n } else {\n const user = await this.userProfile.get(step.context, {});\n\n //await step.context.sendActivity(`[${ step.context.activity.text }]-type activity detected.`);\n\n if (step.context.activity.text == 1) {\n user.food = \"European\";\n await this.userProfile.set(step.context, user);\n } else if (step.context.activity.text == 2) {\n user.food = \"Chinese\";\n await this.userProfile.set(step.context, user);\n } else if (step.context.activity.text == 3) {\n user.food = \"American\";\n await this.userProfile.set(step.context, user);\n }else {\n await this.userProfile.set(step.context, user);\n await step.context.sendActivity(`Sorry, I do not understand, please try again.`);\n return await step.beginDialog(WHICH_FOOD);\n }\n\n await step.context.sendActivity(`Your name is ${ user.name } and you would like this kind of food : ${ user.food }.`);\n }\n return await step.beginDialog(WHICH_PRICE);\n //return await step.endDialog();\n}", "function continueShopping(){\n inquirer.prompt(\n {\n type: \"confirm\",\n name: \"confirm\",\n message: \"Do you want to continue shopping?\",\n default: true\n }\n ).then(answers=>{\n if(answers.confirm){\n displayProducts();\n }else{\n connection.end();\n }\n });\n}", "setSelectedRestaurant(state, resto) {\n state.selectedRestaurant = resto;\n }", "function askAgain(){\n\tconsole.log(\"=============================================================\");\n\tinquirer.prompt([\n\t\t{\n\t\t\ttype: \"confirm\",\n\t\t\tname: \"confirm\",\n\t\t\tmessage: \"Would you like to do another task?\",\n\t\t\tdefault: false\n\t\t}\n\t]).then(function(again){\n\t\tif (again.confirm){\n\t\t\tsupervisorOptions();\n\t\t}\n\t\telse{\n\t\t\tconsole.log(\"All tasks are done.\");\n\t\t\t// Exits node program execution\n\t\t\tprocess.exit();\n\t\t}\n\t});\n}", "function repeat() {\n inquirer\n .prompt({\n name: \"gotoMainMenu\",\n type: \"list\",\n message: \"Do you want to go back to main menu ?\",\n choices: [\"Yes\", \"No\"]\n })\n .then(function (choice) {\n if (choice.gotoMainMenu === \"Yes\") {\n start();\n }\n else {\n connection.end();\n }\n });\n}", "function askAgain() {\n\n inquirer\n .prompt({\n name: \"nextSteps\",\n type: \"list\",\n message: \"Would you like to continue shopping?\",\n choices: [\"YES\", \"NO\"]\n })\n .then(function(answer) {\n \n if (answer.nextSteps.toUpperCase() === \"NO\") {\n\n console.log(chalk.yellow(\"\\nHope you had a pleasant experience. Come again soon!\\n\"));\n\n //turns off the connection from db\n connection.end();\n }\n\n else {\n\n \t//the first function is called again\n \treadProducts();\n\n\n } \n\n });\n}", "function continuePrompt(){\n inquirer\n .prompt({\n name: \"repeat\",\n type: \"list\",\n message: \"Is there anything else you'd like to do?\",\n choices: [\n \"Yes\",\n \"No, I'm done.\"\n ]\n })\n .then(function(answer) {\n switch(answer.repeat){\n case \"Yes\":\n optionMenu();\n break;\n\n case \"No, I'm done.\":\n console.log(\"\\nHave a nice day!\\n\");\n connection.end();\n break;\n }\n });\n}", "function runAgain(){\n inquire.prompt([\n {\n name: 'again',\n message: 'Would you like to make another purchase?',\n type: 'confirm'\n }\n ]).then(function(res){\n if (res.again){\n customer();\n } else {\n console.log('We hope to see you at the Agora again!');\n checkout();\n }\n })\n}", "function supervisorMenu() {\n inquirer\n .prompt({\n name: 'apple',\n type: 'list',\n message: 'What would you like to do?'.yellow,\n choices: ['View Product Sales by Department',\n 'View/Update Department',\n 'Create New Department',\n 'Exit']\n })\n .then(function (pick) {\n switch (pick.apple) {\n case 'View Product Sales by Department':\n departmentSales();\n break;\n case 'View/Update Department':\n updateDepartment();\n break;\n case 'Create New Department':\n createDepartment();\n break;\n case 'Exit':\n connection.end();\n break;\n }\n });\n}", "function restartFunction() {\n inquirer.prompt([\n {\n name:\"action\",\n type:\"list\",\n message: \"Do you want to do another operation?\",\n choices: [\n \"Yes, please.\",\n \"No, I am fine thank you.\"\n ]\n }\n ]).then(function(answer) {\n if(answer.action === \"Yes, please.\") {\n menuOptions();\n } else {\n connection.end();\n }\n })\n}", "function fightOrFlight() {\n var fightOrFlight = ask.question(\"Do you choose to fight or run? Type 'f' to fight or 'r' to run\\n\")\n if (fightOrFlight === \"f\") {\n fight();\n } else {\n run();\n }\n}", "function startPrompt() {\n \n inquirer.prompt([{\n\n type: \"confirm\",\n name: \"confirm\",\n message: \"Welcome to Zohar's Bamazon! Wanna check it out?\",\n default: true\n\n }]).then(function(user){\n if (user.confirm === true){\n inventory();\n } else {\n console.log(\"FINE.. come back soon\")\n }\n });\n }", "function endStart(){\n inquirer.prompt({\n name: \"confirm\",\n type: \"confirm\",\n message: \"continue shopping?\",\n // default: true\n }).then(function (data) {\n if (data.confirm === false)\n \n process.exit();\n else \n start();\n });\n}", "function shopAgain(){\n inquirer\n .prompt([\n {\n type: \"list\",\n name: \"shop\",\n message: \"Would you like to buy another item?\",\n choices: [\"YES\", \"NO\"]\n }\n ]).then(function(answer) {\n if (answer.shop === \"YES\") {\n runBamazon();\n } else {\n console.log(\"Thank you for shopping with us, have a nice day!\");\n connection.end();\n }\n })\n}", "eat() {\r\n let consume = this.food - 2\r\n if (consume > 1) {\r\n this.isHealthy = true\r\n return this.food = consume\r\n } if (consume <= 0) {\r\n this.isHealthy = false\r\n return this.food = 0\r\n }\r\n else if (consume <= 1) {\r\n return this.food = consume\r\n //alert(this.name + \" food supply reached to 0. It's time for a hunt\")\r\n //this.isHealthy = true\r\n }\r\n\r\n }", "function superAsk(){\n\n inquirer\n .prompt([\n // Here we create a basic text prompt.\n {\n type: \"rawlist\",\n message: \"Greetings, what action would you like to perform today? (select by picking a #)\",\n choices: ['View Product Sales by Department', 'Create New Department', 'Exit'],\n name: \"action\", \n },\n\n ])\n .then(function(response) {\n\n switch (response.action) {\n case 'View Product Sales by Department':\n viewProdSales();\n break;\n case 'Create New Department':\n createDept();\n break;\n case 'Exit':\n process.exit();\n break;\n default:\n console.log('Whoops! Looks like something went wrong. Are you sure you picked a number 1-2?');\n }\n });\n}", "function fightOrCave() {\n\n let whereNext = prompt(\"Vart vill du gå nu? Ange fight för att gå och bekämpa monstret eller grottan för att gå till grottan\").toLowerCase();\n\n if (whereNext === \"grottan\"){\n goToCaveSecondTime();\n }\n else if (whereNext === \"fight\") {\n alert(\"Oops, du har ju inte skölden än... Du måste hämta den först. Klicka ok för att gå till grottan.\")\n goToCaveSecondTime();\n }\n else {\n alert(\"Vänligen ange fight eller grottan\")\n fightOrCave()\n }\n\n \n}", "function runAgain2(){\n console.log('That item ID was not found in our records.');\n inquire.prompt([\n {\n name: 'again',\n message: 'Would you like to make another purchase?',\n type: 'confirm'\n }\n ]).then(function(res){\n if (res.again){\n customer();\n } else {\n console.log('We hope to see you at the Agora again!');\n checkout();\n }\n })\n}", "function handleNewMealRequest(response) {\n // Get a random meal from the random meals list\n var mealIndex = Math.floor(Math.random() * RANDOM_MEALS.length);\n var meal = RANDOM_MEALS[mealIndex];\n\n // Create speech output\n var speechOutput = \"Here's a suggestion: \" + meal;\n\n response.tellWithCard(speechOutput, \"MealRecommendations\", speechOutput);\n}", "function again() {\n inquirer.prompt({\n name: \"shop\",\n type: \"list\",\n message: \"Would you like to keep shopping?\",\n choices: [\"Yes\", \"No\"]\n }).then(function(answer){\n if(answer.shop == \"Yes\"){\n list();\n } else {\n console.log(\"Please come back soon!\");\n connection.end();\n }\n })\n}", "pickUpFood() {\n var surTile = this.Survivor.getCurrentTile();\n for (const f of this.foodStock) {\n if (surTile === f.getTile() && f.getActive()) {\n f.setActive(false);\n this.playerFood += this.foodValue;\n this.playerScore += 10;\n }\n }\n }", "function restartPrompt(){\n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"confirm\",\n message: \"Would you like to continue shopping?\".question,\n default: true\n }\n ]).then(function(input){\n // If customer wants to continue show products again\n if(input.confirm){\n showProducts();\n }\n else{\n console.log(\"Thank you for shopping with Bamazon!\".magenta);\n connection.end();\n }\n })\n}", "function startOver() {\n\tinquirer.prompt([\n\t\t{\n\t\t\tname: \"confirm\",\n\t\t\ttype: \"confirm\",\n\t\t\tmessage: \"Would you like to make another selection?\"\n\t\t}\n\t]).then(function(answer) {\n\t\tif (answer.confirm === true) {\n\t\t\tdisplayOptions();\n\t\t}\n\t\telse {\n\t\t\tconsole.log(\"Goodbye!\");\n\t\t}\n\t});\n}", "function keepShopping(){\n inquirer.prompt([\n {\n type: \"confirm\",\n message: \"do you want to keep shopping for beers?\",\n name: \"confirm\"\n }\n ]).then(function(res){\n if (res.confirm){\n console.log(\"----------------\");\n showProducts();\n } else {\n console.log('Thank you for shopping in our online bar, happy drinking!');\n connection.end();\n }\n })\n}", "function endRepeat() {\n inquirer\n .prompt([{\n type: \"list\",\n name: \"wish\",\n message: \"\\nDo you want to perform another operation?\",\n choices: [\"Yes\", \"No\"]\n }]).then( answer => {\n if (answer.wish === \"Yes\") {\n showMenu();\n } else {\n connection.end();\n }\n })\n}", "function resetProductView(){\n \n inquirer.prompt([\n {\n type: \"rawlist\",\n name: \"action\",\n message: \"What would you like to do next?\",\n choices:[\"I want to checkout\", \"I want to continue shopping\"]\n }\n\n ]).then(function(answers){\n if(answers.action === \"I want to checkout\"){\n console.log(\"Good Bye, hope to see you again!\");\n }else if (answers.action === \"I want to continue shopping\"){\n customerview();\n }\n });\n\n}", "function pickUp(index) {\n var pt = self[self.turn];\n var result = self.food[pt];\n if (!result) return; // Nothing to do\n if (result.length == 1) index = 0; // Unique\n if (index == null) { // Can't decide now...\n newState.pending = action;\n return;\n }\n reward += self.food[pt][index]; // Take the food\n newState.food[pt] = null; // Food is now gone\n }", "function another() {\n inquirer\n .prompt(\n {\n name: 'another',\n type: 'confirm',\n message: 'Would you like to continue shopping?'\n },\n\n )\n .then(function (answer) {\n if (answer.another === true) {\n start();\n } else {\n console.log('Thanks for shopping with us! Your orders will be shipped promptly.')\n connection.end();\n }\n });\n\n}", "function anotherAction() {\n\n inquirer\n .prompt([\n {\n name: \"confirm\",\n type: \"confirm\",\n message: \"Would you like to complete another action?\"\n }\n ])\n .then(function (answer) {\n if (answer.confirm == true) {\n showMenu();\n }\n else {\n console.log(\"Goodbye.\");\n connection.end();\n }\n\n });\n\n}", "function systemSelection(option){\n\tvar check = option; \n\tif(vehicleFuel<=0){\n\t\tgameOverLose();\n\t}\n\n\telse{\n\n\n\tif(currentLocation===check){\n\t\t\tgamePrompt(\"Sorry Captain, You're already there or have been there. I will return you to the main menu to make another choice\",beginTravel);\n\t\t\t}\n\n\telse{\n\t\n\t\t\tif(check.toLowerCase() === \"e\"){\n\t\t\t\tvehicleFuel=(vehicleFuel-10);\n\t\t\t\tcurrentLocation=\"e\" ;\n\t\t\t\tgamePrompt(\"Flying to Earth...You used 10 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToEarth);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"m\"){\n\t\t\t//need to add a 'visited' conditional\n\t\t\tvehicleFuel=(vehicleFuel-20);\n\t\t\tcurrentLocation=\"m\" ;\n\t\t\t\tgamePrompt(\"Flying to Mesnides...You used 20 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\", goToMesnides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"l\"){\n\t\t\tvehicleFuel=(vehicleFuel-50);\n\t\t\tcurrentLocation=\"l\" ;\n\t\t\tgamePrompt(\"Flying to Laplides...You used 50 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToLaplides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"k\"){\n\t\t\tvehicleFuel=(vehicleFuel-120);\n\t\t\tcurrentLocation=\"k\" ;\n\t\t\tgamePrompt(\"Flying to Kiyturn...You used 120 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToKiyturn);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"a\"){\n\t\t\tvehicleFuel=(vehicleFuel-25);\n\t\t\tcurrentLocation=\"a\";\n\t\t\tgamePrompt(\"Flying to Aenides...You used 25 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToAenides);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"c\"){\n\t\t\tvehicleFuel=(vehicleFuel-200);\n\t\t\tcurrentLocation=\"c\" ;\n\t\t\tgamePrompt(\"Flying to Cramuthea...You used 200 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToCramuthea);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"s\"){\n\t\t\tvehicleFuel=(vehicleFuel-400);\n\t\t\tcurrentLocation=\"s\" ;\n\t\t\tgamePrompt(\"Flying to Smeon T9Q...You used 400 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToSmeon);\n\t\t\t}\n\t\telse if(check.toLowerCase() === \"g\"){\n\t\t\tvehicleFuel=(vehicleFuel-85);\n\t\t\tcurrentLocation=\"g\" ;\n\t\t\tgamePrompt(\"Flying to Gleshan 7Z9...You used 85 gallons of gas. The \"+ vehicleName +\" now has \"+vehicleFuel+ \" gallons.\",goToGleshan);\n\t\t\t}\n\t\telse{\n\t\t\tgamePrompt(\"Sorry Captain, I did not understand you. I will return you to the main menu\",beginTravel);\n\t\t}\n\t}\n\t}\n}", "eat () {\n if (this.food === 0) {\n this.isHealthy = false;\n\n } else {\n this.food -= 1;\n }\n }", "function chap19(){\n var wantChicken = false;\n var foodArray = [\"Salmon\", \"Tilapia\", \"Tuna\", \"Lobster\"];\n var customerOrder = prompt(\"What would you like?\", \"Look the menu\");\n for (var i = 0; i <= 3; i++) {\n if (customerOrder === foodArray[i]) {\n wantChicken = true;\n alert(\"We have it on the menu!\");\n break;\n }\n }\n if(wantChicken===false) {\n\t\talert(\"We don't serve chicken here, sorry.\");\n\t}\n}", "function start() {\n inquirer.prompt([{\n name: \"entrance\",\n message: \"Would you like to shop with us today?\",\n type: \"list\",\n choices: [\"Yes\", \"No\"]\n }]).then(function(answer) {\n // if yes, proceed to shop menu\n if (answer.entrance === \"Yes\") {\n menu();\n } else {\n // if no, end node cli \n console.log(\"---------------------------------------\");\n console.log(\"No?!?!?! What do you mean no!?!?!?!?!?\");\n console.log(\"---------------------------------------\");\n connection.destroy();\n return;\n }\n });\n}", "function start() {\n inquirer.prompt({\n name: \"select\",\n type: \"rawlist\",\n message: \"What would you like to do?\",\n choices: [\"VIEW SALES\", \"CREATE NEW DEPARTMENT\", \"DELETE DEPARTMENT\", \"EXIT\"]\n }).then(function (answers) {\n if (answers.select.toUpperCase() === \"VIEW SALES\") {\n viewSales();\n } else if (answers.select.toUpperCase() === \"CREATE NEW DEPARTMENT\") {\n newDepartment();\n } else if (answers.select.toUpperCase() === \"DELETE DEPARTMENT\") {\n deleteDepartment();\n } else {\n // Selecting \"EXIT\" just takes the user here\n connection.end();\n }\n });\n}", "function start() {\n inquirer\n .prompt({\n name: \"choice\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View Products for Sale\",\n \"View Low Inventory Less than 30 items in stock\",\n \"Update current Items Stock Quantity\",\n \"Add New Product to Current Dept\"\n ]\n })\n .then(function(answer) {\n switch (answer.choice) {\n case \"View Products for Sale\":\n viewAll();\n break;\n case \"View Low Inventory Less than 30 items in stock\":\n viewLowInv();\n break;\n case \"Update current Items Stock Quantity\":\n // viewAll();\n addToInv();\n break;\n case \"Add New Product to Current Dept\":\n addNewProduct();\n break;\n }\n });\n}", "findCraving(type) {\n \n // Make sure a craving has been selected - if not alert user and abort.\n if (app.currentCraving === 0) {\n app.showAlert(\"No craving\", \"Please select a craving to continue!\");\n return;\n }\n // Opens the loading screen\n app.showLoadingScreen();\n // Builds our call url.\n // Base URL // Current LAT //Current Lon // CurrentCraving \n var callUrl = `${ apiUrls.zomatoBase }/search?lat=${ app.latLong[0] }&lon=${ app.latLong[1] }&cuisines=${ app.currentCraving }&radius=3000`;\n \n // See if the user opted to hide restaurants they've visited.\n var hidePrev = $(\"#chk-hide-previous\").is(\":checked\");\n \n // Zero out our array.\n app.restaurantResults.length = 0;\n\n // Performs the API call.\n app.callApi(\"get\", callUrl, apiKeys.zomato.header).then((response) => {\n // Loops through our responses\n for (var i = 0; i < response.restaurants.length; i++) {\n // Gets the current restaurant.\n var rest = response.restaurants[i].restaurant;\n // Creates an object\n var newRestaurant = new Restaurant(rest.id, rest.name, rest.location.address, rest.location.latitude, rest.location.longitude,\n rest.thumb, rest.price_range, rest.average_cost_for_two, rest.featured_image, rest.user_rating.rating_text, rest.user_rating.aggregate_rating);\n // Gets the distance as a float\n newRestaurant.distance = parseFloat(distance(app.latLong[0], app.latLong[1], newRestaurant.lat, newRestaurant.lon));\n // Assume we can push it into our results array.\n var canPush = true;\n // If we want to hide it\n if (hidePrev) {\n // Make sure we have a list of restaurants the user has been to\n if (app.currentUser.restaurants) {\n // Loop through the users' visited restaurants\n for (var j = 0; j < app.currentUser.restaurants.length; j++) {\n // Compare it with our current working restaurant\n if (newRestaurant.id === app.currentUser.restaurants[j]) {\n // If it's there, flag we cannot push it to the array.\n canPush = false;\n }\n }\n }\n }\n if (canPush) {\n // If we made it, push it into our results array.\n app.restaurantResults.push(newRestaurant);\n }\n };\n // if the user wanted\n if (type === \"fast\") {\n app.restaurantResults.sort(app.sortByDistance);\n } else {\n app.restaurantResults.sort(app.sortByQuality);\n }\n // Populate our results screen\n app.populateResults();\n // Hide the loading overlay\n app.hideLoadingScreen();\n // Fade into our results screen\n app.switchScreens(\"#craving-select-screen\", \"#results-screen\", true);\n });\n }", "function askIfDone() {\n inquirer.prompt([\n {\n type: \"confirm\",\n message: \"Would you like to return to the main menu?\",\n name: \"decision\"\n }\n ]).then(function(response){\n if(response.decision === true) {\n menu();\n }\n else {\n console.log(\"\\nThank you. Goodbye.\");\n console.log(\"\\n============================================\");\n connection.end();\n }\n });\n}", "function travelTypeChange (userInput) { //takes the result from changeDestinationResult and uses the yesOrNo function to give random part of trip the user wishes to switch.\n if(userInput === \"1\"){\n \n randomDestination = yesOrNo(destination,destination);\n \n }\n else if (userInput === \"2\") {\n \n randomRestaurant = yesOrNo(restaurant,restaurant);\n }\n else if (userInput === \"3\") {\n \n randomTravelType = yesOrNo(transportation, transportation);\n }\n else if (userInput === \"4\") {\n \n randomEntertainment = yesOrNo(entertainment,entertainment);\n }\n}", "function start(){\n inquirer.prompt({\n type: \"list\",\n message: \"What would you like to view?\",\n name: \"answer\",\n choices: [\"All inventory\", \"Electronics\", \"Furniture\", \"Apparel\", \"Camping/Outdoors\", \"Tools\", \"Exit\"]\n }).then(function(data){\n if(data.answer === \"Exit\"){\n console.log(\"\\nThanks for shopping with Bamazon!\\n\".green);\n connection.end();\n }\n else if(data.answer === \"All inventory\"){\n query = \"SELECT * FROM products\"\n showItems();\n }\n else{\n query = \"SELECT * FROM products WHERE department = \" + \"'\" + data.answer.toLowerCase() + \"'\"\n showItems();\n }\n \n }) \n}", "function callNextActionOrExit(answer) {\n if (answer.userSelection === \"View Products for Sale\") {\n console.log(\"You want to view products\");\n viewProducts();\n } else if (answer.userSelection === \"View Low Inventory\") {\n console.log(\"You want to view inventory\")\n viewLowInventory();\n } else if (answer.userSelection === \"Add to Inventory\") {\n console.log(\"You want to add to inventory\")\n addToInventory();\n } else if (answer.userSelection === \"Add New Product\") {\n console.log(\"You want to add a new product\")\n getNewItem();\n } else {\n database.endConnection();\n }\n}", "function optionMenu(){\n inquirer\n .prompt({\n name: \"menu\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View Products for Sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\",\n \"Nothing, I've changed my mind.\"\n ]\n })\n .then(function(answer) {\n switch(answer.menu){\n case \"View Products for Sale\":\n showProducts();\n\n // continuePrompt is delayed to allow showProducts to be completed\n setTimeout(continuePrompt,300);\n break;\n\n case \"View Low Inventory\":\n lowInventory();\n\n // continuePrompt is delayed to allow lowInventory to be completed\n setTimeout(continuePrompt,300);\n break;\n\n case \"Add to Inventory\":\n showProducts()\n\n // addInventory is delayed to allow lowInventory to be completed\n setTimeout(addInventory,300);\n break;\n\n case \"Add New Product\":\n newProduct();\n break;\n\n case \"Nothing, I've changed my mind.\":\n console.log(\"\\nHave a nice day!\\n\");\n connection.end();\n break;\n }\n });\n}", "function start() {\n inquirer.prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View All departments\",\n \"View All employees\",\n \"View All roles\",\n \"Add roles\",\n \"Add departments\",\n \"Add employees\",\n \"Delete roles\",\n \"Delete departments\",\n \"Exit\"\n ]\n })\n .then(function(res) { \n switch (res.action) {\n case \"View departments\":\n viewDep();\n break;\n \n case \"View All employees\":\n viewEmp();\n break;\n \n case \"View All roles\":\n viewRole();\n break;\n \n case \"Add roles\":\n addRole();\n break;\n \n case \"Add departments\":\n addDep();\n break;\n\n case \"Add employees\":\n addEmp();\n break;\n\n case \"Update employee roles\":\n updateEmpRole();\n break;\n \n case \"Delete roles\":\n deleteRole();\n break;\n \n case \"Delete departments\":\n deleteDep();\n break;\n \n case \"Exit\":\n end();\n break\n }\n });\n }", "async eatEnergy() {\n await this.updateAvailableEat();\n let response = await this.sendRequest(\"foodSystem.php\", { \"whatneed\": \"eatFrmHldnk\" });\n debug(\"Eating...\", response);\n return response;\n }", "function doChoice(e) {\n if (this.selectedIndex>0) {\n var c = favlist[this.options[this.selectedIndex].value];\n\t\tvar fail = false;\n if (c) {\n var i;\n setNotice('Loading fav ...');\n for (i=1;i<=c.length;i++) {\n fail |= setState(i,c[i-1]);\n }\n for (;i<=11;i++) {\n clearState(i);\n }\n }\n this.selectedIndex = 0;\n\t\tif (fail)\n\t\t\taddNotice('Item(s) not found!');\n\t\telse\n\t\t\taddNotice('Fav loaded!');\n }\n}", "function initSelectRestaurant(restaurants, searchTerm){\n $(function(){\n\n var getRestaurant = window.LE.restaurants.getRestaurant\n\n userdata.restaurant = null;\n\n //dummy var\n var isSearch = null;\n\n // prepare template\n var source = $(\"#restaurant-dropdown-template\").html();\n var template = Handlebars.compile(source);\n\n html = template(restaurants); \n\n // populate dropdown for restaurants\n var renderingRestaurants = $('#render-restaurants').after(html);\n\n // render confirmation of the search term so the user remembers what they were looking for\n var renderingSearchTerm = $('#select-restaurant-search-term').html(searchTerm);\n\n // when the restaurant changes, we need to display rate and other data\n $.when(renderingRestaurants, renderingSearchTerm).done(function(){\n renderRestaurantDetails(templates.templateRestInfo, getRestaurant, isSearch);\n });\n \n $(\"#select-restaurant-continue-button\").on(\"click\", function(){\n // this is the restaurant id to render later\n var selectedVal = $(\"#restaurant\").val();\n\n if(_debug){ console.log(selectedVal); }\n\n if(selectedVal == \"\"){\n document.getElementById(\"restaurant-alert\").innerHTML = \"Required.\";\n }else{\n\n // cleanup old event handlers before leaving home context\n destroyHome();\n\n userdata.currentRestaurant = selectedVal;\n initSelectItem(selectedVal);\n // ease scroll to top of next view\n $(\"html, body\").animate({ scrollTop: 0 }, \"slow\");\n }\n });\n });\n}", "function continuePrompt(){\n inquirer.prompt({\n type: \"confirm\",\n name: \"continue\",\n message: \"Continue....?\",\n }).then((answer) => {\n if (answer.continue){\n showMainMenu();\n } else{\n exit();\n }\n })\n}", "function start (p){\n\tresetting=true;\n\tfoodCounter=0;\n\tdeleteAllFood();\n\treset(p);\n}", "function promptAction() {\n inquirer.prompt([{\n type: 'list',\n message: 'Select from list below what action you would like to complete.',\n choices: ['View Products for Sale', 'View Low Inventory', 'Add to Inventory', 'Add New Product'],\n name: \"action\"\n }, ]).then(function(selection) {\n switch (selection.action) {\n case 'View Products for Sale':\n viewAllProducts();\n break;\n\n case 'View Low Inventory':\n lowInventoryList();\n break;\n\n case 'Add to Inventory':\n addInventory();\n break;\n\n case 'Add New Product':\n addNewProduct();\n break;\n }\n }).catch(function(error) {\n throw error;\n });\n}", "function nextAction() {\n\tinquirer.prompt({\n\t\tmessage: \"What would you like to do next?\",\n\t\ttype: \"list\",\n\t\tname: \"nextAction\",\n\t\tchoices: [\"Add More Items\", \"Remove Items\", \"Alter Item Order Amount\", \"Survey Cart\", \"Checkout\"]\n\t})\n\t\t.then(function (actionAnswer) {\n\t\t\tswitch (actionAnswer.nextAction) {\n\t\t\t\tcase \"Add More Items\":\n\t\t\t\t\t// go to the start function\n\t\t\t\t\tstart();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Remove Items\":\n\t\t\t\t\t// go to the removal function\n\t\t\t\t\tremoveItem();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Checkout\":\n\t\t\t\t\t// go to the checkout tree;\n\t\t\t\t\tverifyCheckout();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Alter Item Order Amount\":\n\t\t\t\t\t// go to the function that alters the shopping cart qty\n\t\t\t\t\talterItem();\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"Survey Cart\":\n\t\t\t\t\t// look at the cart\n\t\t\t\t\tcheckoutFunction();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault: console.log(\"how did you get here?\")\n\t\t\t}\n\t\t})\n}", "function continueShopping() {\n inquire.prompt([{\n message: \"Checkout or Continue Shopping?\",\n type: \"list\",\n name: \"continue\",\n choices: [\"Continue\", \"Go to checkout\"]\n }]).then(function (ans) {\n if (ans.continue === \"Continue\") {\n console.log(\" Items Added to Cart!\");\n shoppingCart();\n } else if (ans.continue === \"Go to checkout\") {\n checkOut(itemCart, cartQuant);\n }\n });\n}", "function regretsPrompt (res) {\n\tinquirer\n \t\t.prompt([\n \t\t\t{\n\t\t\t\ttype: \"list\",\n\t\t\t\tmessage: \"What would you like to do?\",\n\t\t\t\tchoices: [\"Change Quantity\", \"Start Over\"],\n\t\t\t\tname: \"selection\"\n\t\t }\n\t\t])\n\t\t.then(function(inqRes) {\n\t\t\tif (inqRes.selection == \"Change Quantity\"){\n\t\t\t\tquantityPrompt(res);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tdisplayAllProducts();\t\n\t\t\t}\n\n\n\t\t});//ends then\n}", "function noInventoryOptions() {\n inquirer.prompt([\n {\n type: \"list\",\n message: \"Do you want to choose a new item or quit?\",\n choices: [\"NEW-ITEM\", \"QUIT\"],\n name: \"startAgain\"\n }\n ])\n .then(function(answer6) {\n if (answer6.startAgain == \"NEW-ITEM\") {\n displayProducts(); \n }\n if (answer6.startAgain == \"QUIT\") {\n console.log(\"Thank you. Good-bye!\");\n connection.end();\n }\n });\n}", "function contShopping() {\n inquirer.prompt([\n {\n type: \"confirm\",\n message: \"Do you want to continue shopping?\",\n name: \"id\",\n\n }\n\n ])\n .then(function (cont) {\n\n if (cont.id === true) {\n readProducts();\n }\n else {\n console.log(\"Have a good day!\");\n connection.end();\n }\n })\n}", "function submitClicked () { \n let foodInput = $('#food').val();\n if(foodInput == \"\"){\n $('.noFoodItem').text(\"please enter a food item in the search bar\").css('color','red');\n return; \n }\n $('.noFoodItem').text('');\n food = $(\"#food\").val()\n initAutocomplete();\n changePage();\n}", "function menuoption(){\n inquirer.prompt({\n type: \"list\",\n name : \"menu\",\n message : \"What do you want to see ?\",\n choices : [\"\\n\",\"View Products for Sale\",\"View Low Inventory\",\"Add to Inventory\",\"Add New Product\"]\n\n }).then(function(answer){\n // var update;\n // var addnew;\n console.log(answer.menu);\n //if else option to compare user input and call the required function\n if(answer.menu == \"View Products for Sale\" ){\n showitem();\n }else if(answer.menu == \"View Low Inventory\"){\n \n lowinventory();\n }else if(answer.menu == \"Add to Inventory\"){\n updateinventory();\n // updateonecolumn(itemidinput);\n }else if(answer.menu == \"Add New Product\"){\n addnewproduct();\n }\n \n });\n }", "function shop() {\n\n inquirer.prompt([{\n name: \"menu\",\n type: \"list\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Update Inventory\", \"Add New Product\"]\n }]).then(function (answer) {\n\n switch (answer.menu) {\n case \"View Products for Sale\":\n forSale();\n break;\n\n case \"View Low Inventory\":\n lowStock();\n break;\n\n case \"Add New Product\":\n addThing();\n break;\n\n case \"Update Inventory\":\n moreStuff();\n break;\n }\n });\n}", "function ADMIN() {\n //SORT FLIGHTS BY ID, SET ALL DISPLAYS TO TRUE\n flights.sort((a, b) => a.id - b.id);\n for (let i = 0; i < flights.length; i++) {\n flights[i].display = true;\n }\n let ediDel;\n do {\n ediDel = prompt(\n \"Te encuentras en la funci\\u00F3n de ADMINISTRADOR. Indica la funci\\u00F3n a la que quieres acceder: EDIT, DELETE.\",\n \"EDIT,DELETE\"\n );\n salida(ediDel, ADMIN);\n ediDel = ediDel.toUpperCase();\n } while (ediDel !== \"EDIT\" && ediDel !== \"DELETE\");\n\n //JUMP TO NEXT FUNCITON\n if (ediDel === \"EDIT\") {\n EDIT();\n } else if (ediDel === \"DELETE\") {\n DELETE();\n } else {\n alert(\"No te he entendido\");\n ADMIN();\n }\n}", "function buyMore() {\n\n inquirer.prompt([\n {\n name: \"continue\",\n type: \"confirm\",\n message: \"Do you want to buy another product?\"\n }\n ]).then(function (answers) {\n if (answers.continue) {\n defId = null;\n defQty = 1;\n dispAll();\n } else {\n connection.end();\n }\n });\n\n}", "function start() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"What would you like to do?\",\n choices: [\"Purchase Items\", \n \"Exit\"],\n }\n ]).then(function(answer) {\n\n // Based on the selection, the user experience will be routed in one of these directions\n switch (answer.choice) {\n case \"Purchase Items\":\n displayItems();\n break;\n case \"Exit\":\n exit();\n break;\n }\n });\n} // End start function", "function askAgain() {\n inquirer.prompt({\n name: \"choice\",\n type: \"rawlist\",\n message: \"What you like to place another order?\",\n choices: [\"YES\", \"NO\"]\n })\n .then(function (answer) {\n if (answer.choice.toUpperCase() === \"YES\") {\n ask();\n } else {\n console.log(\"Thank you for shopping at Bamazon.\");\n connection.end();\n }\n })\n\n}", "onSelectRestaurant(restaurant){\n this.closeAllRestaurant()\n restaurant.viewDetailsComments()\n restaurant.viewImg()\n\n }", "function fightOrRun() {\n var choices = [\"Run\", \"Fight\"];\n var askPlayer = parseInt(readline.keyInSelect(choices, \"Do you want to fight like a shark or run like a shrimp???\\nThe next monster might be scarier.\\n \\n What are you going to do? Press 1 to run...Press 2 to fight.\"));\n if (choices === 1) {\n //call the function for deciding to run \n run();\n } else {\n //call the function for deciding to fight\n console.log('You decided to fight, bring it on!!.');\n fight();\n }\n }", "function OrderAgain(){ \r\n\tinquirer.prompt([{ \r\n\t\ttype: 'confirm', \r\n\t\tname: 'choice', \r\n\t\tmessage: 'Would you like to place another order?' \r\n\t}]).then(function(answer){ \r\n\t\tif(answer.choice){ \r\n\t\t\tplaceOrder(); \r\n\t\t} \r\n\t\telse{ \r\n\t\t\tconsole.log('Thank you for shopping at the Bamazon Mercantile!'); \r\n\t\t\tconnection.end(); \r\n\t\t} \r\n\t}) \r\n}", "function eat(food)\n\t\t{\n\t\t\t// Add the food's HTML element to a queue of uneaten food elements.\n\t\t\tuneatenFood.push(food.element);\n\n\t\t\t// Tell the fish to swim to the position of the specified food object, appending this swim instruction\n\t\t\t// to all other swim paths currently queued, and then when the swimming is done call back a function that\n\t\t\t// removes the food element.\n\t\t\tFish.swimTo(\n\t\t\t\tfood.position,\n\t\t\t\tFish.PathType.AppendPath,\n\t\t\t\tfunction()\n\t\t\t\t{\n\t\t\t\t\tlet eatenFood = uneatenFood.shift();\n\t\t\t\t\teatenFood.parentNode.removeChild(eatenFood);\n\t\t\t\t\tgrow();\n\t\t\t\t});\n\t\t} // end eat()", "function restaurantCheck (post) {\n\n\t\tvar zomatoKey = \"8eb908d1e6003b1c7643c94c50ecd283\";\n\n\t\t// J\n\t\t// Q\n\t\t// U\n\t\t// E\n\t\t// R\n\t\t// Y\n\t\t$.ajax ({\n\t\t\tmethod: \"GET\",\n\t\t\turl: \"https://developers.zomato.com/api/v2.1/search?apikey=\"+zomatoKey+\"&count=500&lat=42.4074843&lon=-71.11902320000002&radius=5000\",\n\t\t}).done(function (data) {\n\t\t\tdata.restaurants.forEach(function(element,index) {\n\t\t\t\tif (post.includes(element.restaurant.name)) {\n\t\t\t\t\tfood_list.push(element.restaurant.name);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function mainOptions() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View\",\n \"Add\",\n \"Delete\",\n \"Update\"\n ]\n })\n .then(function (answer) {\n switch (answer.action) {\n\n case \"View\":\n viewChoice();\n break;\n\n case \"Add\":\n addChoice();\n break;\n\n case \"Delete\":\n deleteChoice()\n break;\n\n case \"Update\":\n updateChoice()\n break;\n\n\n }\n });\n\n}", "function anythingElse() {\n inquirer\n .prompt([\n {\n type: \"confirm\",\n message: \"Anything Else?\",\n name: \"choice\"\n }\n ])\n .then(res => {\n if (res.choice) {\n displayProducts();\n } else {\n console.log(\"Thank You!\");\n console.log(`Total: $${total}`);\n connection.end();\n }\n });\n}", "function chooseAction() {\n\tinquirer\n\t\t.prompt({\n\t\t\tname: \"action\", \n\t\t\ttype: \"rawlist\", \n\t\t\tmessage: \"What do you want to do?\", \n\t\t\tchoices: [\"VIEW PRODUCTS\", \"VIEW LOW INVENTORY\", \"ADD TO INVENTORY\", \"ADD NEW PRODUCT\", \"QUIT\"]\n\t\t})\n\t\t.then(function(ans) {\n\t\t\tif(ans.action.toUpperCase() ===\"VIEW PRODUCTS\") {\n\t\t\t\tviewProducts(); \n\t\t\t} \n\t\t\telse if (ans.action.toUpperCase() === \"VIEW LOW INVENTORY\") {\n\t\t\t\tviewLowInventory(); \n\t\t\t}\n\t\t\telse if (ans.action.toUpperCase() === \"ADD TO INVENTORY\") {\n\t\t\t\taddInventory(); \n\t\t\t}\n\t\t\telse if (ans.action.toUpperCase() === \"ADD NEW PRODUCT\") {\n\t\t\t\taddNewProduct(); \n\t\t\t}\n\t\t\telse {\n\t\t\t\tendConnection(); \n\t\t\t}\n\t\t})\n}", "async promptForMenu(step) {\n return step.prompt(MENU_PROMPT, {\n choices: [\"Donate Food\", \"Find a Food Bank\", \"Contact Food Bank\"],\n prompt: \"Do you have food to donate, do you need food, or are you contacting a food bank?\",\n retryPrompt: \"I'm sorry, that wasn't a valid response. Please select one of the options\"\n });\n }", "function checkFood(food){\n\tvar food = [\"chicken\", \"beef\", \"fish\", \"lamb\", \"veal\"];\n\n\t//The first term starts with 0\n\n\tif(food == food[0] || food == food[1] || food == food[2] || food == food[3] || food == food [4]){\n\t\talert(\"You are considered as meat\");\n\t}else{\n\t\talert(\"You may or may not be considered as meat\");\n\t//if chicken, beef, fish, lamb or veal is entered, then a popup will appaer with \"You are considered as meat\"\n\t//if something else is entered, then a popup will appear saying \"you may or may not be considered as meat\"\t\n\t}\n}", "function startPrompt() {\n inquirer\n .prompt([\n {\n name: \"startOrStop\",\n type: \"list\",\n message: \"Would you like to make a purchase?\",\n choices: [\"Yes\", \"No\", \"Show me the choices again\"]\n }\n ])\n .then(function (answer) {\n if (answer.startOrStop === \"No\") {\n console.log(\"Goodbye!\");\n connection.end();\n } else if (answer.startOrStop === \"Show me the choices again\") {\n start();\n } else {\n buyPrompt();\n }\n\n });\n}", "function foodClickHandler(foodsitem) {\n setFood(foodsitem);\n }", "function keepShopping() {\n inquirer.prompt([{\n type: \"confirm\",\n name: \"shopping\",\n message: \"Would you like to keep shopping?\",\n }]).then(function (answer) {\n if (answer) {\n chooseShop();\n } else {\n // End the database connection\n connection.end();\n }\n })\n}", "async captureFood(step) {\n const user = await this.userProfile.get(step.context, {});\n\n // Perform a call to LUIS to retrieve results for the user's message.\n const results = await this.luisRecognizer.recognize(step.context);\n\n // Since the LuisRecognizer was configured to include the raw results, get the `topScoringIntent` as specified by LUIS.\n const topIntent = results.luisResult.topScoringIntent;\n const topEntity = results.luisResult.entities[0];\n\n if (step.result !== -1) {\n\n if (topIntent.intent == 'ChooseTypeOfFood') {\n user.food = topEntity.entity;\n await this.userProfile.set(step.context, user);\n\n //await step.context.sendActivity(`Entity: ${topEntity.entity}`);\n await step.context.sendActivity(`I'm going to find the restaurant to eat : ${topEntity.entity}`);\n //return await step.next();\n }\n else {\n await this.userProfile.set(step.context, user);\n await step.context.sendActivity(`Sorry, I do not understand or say cancel.`);\n return await step.replaceDialog(WHICH_FOOD);\n }\n\n // await step.context.sendActivity(`I will remember that you want this kind of food : ${ step.result } `);\n } else {// si l'user ne sait pas quelle genre de food il veut\n\n const { ActionTypes, ActivityTypes, CardFactory } = require('botbuilder');\n\n const reply = { type: ActivityTypes.Message };\n\n // // build buttons to display.\n const buttons = [\n { type: ActionTypes.ImBack, title: '1. European 🍝 🍲', value: '1' },\n { type: ActionTypes.ImBack, title: '2. Chinese 🍜 🍚', value: '2' },\n { type: ActionTypes.ImBack, title: '3. American 🍔 🍟', value: '3' }\n ];\n\n // // construct hero card.\n const card = CardFactory.heroCard('', undefined,\n buttons, { text: 'What type of restaurant do you want ?' });\n\n // // add card to Activity.\n reply.attachments = [card];\n\n // // Send hero card to the user.\n await step.context.sendActivity(reply);\n\n }\n //return await step.beginDialog(WHICH_PRICE);\n //return await step.endDialog();\n}", "function displayRestaurant() {\n restaurantDrop.on(\"click\", function (event) {\n if ($(event.target).attr(\"class\") === \"yes\") {\n console.log(\"hi\");\n $(\".body-container\").prepend($(\".location\").show());\n restaurantOption.hide();\n }\n if ($(event.target).attr(\"class\") === \"no\") {\n $(\".final-date\").removeClass(\"hide\");\n restaurantOption.hide();\n viewDate.append($(\".movie-display\"));\n $(\".movie-display\").show();\n restaurantStorage.push(\"\")\n localStorage.setItem(\"Restaurants\", JSON.stringify(restaurantStorage))\n }\n });\n}", "function start() {\n inquirer\n .prompt({\n name: \"selectOptions\",\n type: \"list\",\n message: \"Choose from the list of available options...\",\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\", \"View most expensive Inventory\"]\n })\n .then(function (answer) {\n\n // get the user choice and route to appropriate function.\n switch (answer.selectOptions) {\n case \"View Products for Sale\":\n listAllProducts();\n break;\n\n case \"View Low Inventory\":\n listLowInventory();\n break;\n\n case \"Add to Inventory\":\n addToInventory();\n break;\n\n case \"Add New Product\":\n addNewItemToInventory();\n break;\n\n case \"View most expensive Inventory\":\n listExpensiveItems();\n break;\n }\n\n //\n\n });\n}", "function nextPrompt(){\n inquirer.prompt([\n {\n name: \"status\",\n type: \"list\",\n message: \"Buy more?\",\n choices: [\"Buy more\", \"Exit\"]\n }\n ]).then(answer => {\n if(answer.status === \"Buy more\"){\n displayInventory();\n promptBuy();\n } else{\n console.log(\"Thank you. Goodbye.\");\n connection.end();\n }\n })\n}", "function foodRunnerSelector() {\n \n if (document.getElementById(\"foodRunnerYes\").checked == true) {\n\tdoTipFoodRunner = true;\n\tdocument.getElementById(\"foodRunnerConfirm\").innerHTML = \"Food Runner will be tipped out\";}\n else { \n\tdoTipFoodRunner = false;\n\tdocument.getElementById(\"foodRunnerConfirm\").innerHTML = \"No tip out for Food Runner\"; \n }\n return doTipFoodRunner\n}", "function setFoodType(type) {\n // This allows us to display items related to the choice on the map but also to style the buttons so the user knows that they have selected something\n if(type === 'kebab') {\n $scope.hammered = 'chosen-emotion';\n $scope.hungover = '';\n $scope.hangry = '';\n $scope.hardworking = '';\n } else if(type === 'cafe') {\n $scope.hammered = '';\n $scope.hungover = 'chosen-emotion';\n $scope.hangry = '';\n $scope.hardworking = '';\n } else if(type === 'fastfood') {\n $scope.hammered = '';\n $scope.hungover = '';\n $scope.hangry = 'chosen-emotion';\n $scope.hardworking = '';\n } else {\n $scope.hammered = '';\n $scope.hungover = '';\n $scope.hangry = '';\n $scope.hardworking = 'chosen-emotion';\n }\n vm.foodType = type;\n }", "function askToContinue() {\n\t\tinquirer\n\t\t\t.prompt([\n\t\t\t\t{\n\t\t\t\t\ttype: 'confirm',\n\t\t\t\t\tmessage: 'Do you want to play again?',\n\t\t\t\t\tname: 'confirm',\n\t\t\t\t\tdefault: true\n\t\t\t\t}\n\t\t\t])\n\t\t\t.then(function(response) {\n\t\t\t\tif (response.confirm === true) {\n\t\t\t\t\tstartGame();\n\t\t\t\t} \n\t\t\t});\n\t}", "function goPrompt() {\n inquirer.prompt([\n {\n type: \"list\",\n message: \"What action would you like to do?\",\n name: \"choice\",\n choices: [\n \"Check Departments\",\n \"Check Roles\",\n \"Check Employees\",\n \"Plus Employee\",\n \"Plus Role\",\n \"Plus Department\"\n ]\n }\n // switch replaces else if...selects parameter and javascript will look for the correct function\n ]).then(function (data) {\n switch (data.choice) {\n case \"Check Departments\":\n viewDepartments()\n break;\n case \"Check Roles\":\n viewRoles()\n break;\n case \"Check Employees\":\n viewEmployees()\n break;\n case \"Plus Employee\":\n plusEmployees()\n break;\n case \"Plus Department\":\n plusDepartment()\n break;\n case \"Plus Role\":\n plusRole()\n break;\n }\n })\n}", "function userSearch() {\n\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"What would you like to do:\",\n choices: [\"View product sales by Department\", \"Create new department\", \"Exit Supervisor Mode\"]\n }\n\n ]).then(function (manager) {\n\n switch (manager.choice) {\n case \"View product sales by Department\":\n viewDepartments();\n break;\n \n case \"Create new department\":\n addNewDepartment();\n break;\n\n case \"Exit Supervisor Mode\":\n console.log(\"\\nSee ya later!\\n\");\n connection.end ();\n break;\n }\n\n });\n\n}", "function orderAgain() {\n console.log(\"------\");\n inquirer.prompt({\n name: \"confirm\",\n type: \"list\",\n message: \"Would you like start over and view what's in stock again?\",\n choices: [\"Yes\", \"No\"]\n })\n .then(function(answer) {\n if (answer.confirm === \"Yes\") {\n displayStock();\n }\n\n else {\n console.log(\"------\")\n console.log(\"Thanks for shopping on Bamazon!\")\n connection.end();\n }\n })\n }", "function randomFood() {\n\n\t\tif (Math.random() > 0.5) {\n\t\t\treturn 'pizza';\n\t\t} \n\t\treturn 'ice cream';\n\t}", "function frostingChoice(item) {\n frostingChosen = true;\n if (typeof preFrostingChoice !== 'undefined'){\n preFrostingChoice.style.backgroundColor = \"white\";\n }\n\n item.style.backgroundColor = \"lightgray\";\n preFrostingChoice = item;\n\n checkPrice();\n}", "function pizzaFlavor() {\n // Logs menu to console after each action\n console.log(\"\");\n console.log(\"Please choose your actions:\");\n console.log(\"\");\n console.log(\"1 - List all the pizza flavors\");\n console.log(\"2 - Add a new pizza flavor\");\n console.log(\"3 - Remove a pizza flavor\");\n console.log(\"4 - Exit this program\");\n console.log(\"\");\n\n // Variable that stores menu option\n let x = Number(readlineSync.question(\"Enter your action's number: \"));\n\n // Logs list of pizza flavors to console when menu option 1 is chosen and returns to menu\n if (x === 1) {\n console.log(flavs);\n pizzaFlavor();\n }\n\n // Enters do while loop to keep asking for new pizza flavor input\n if (x === 2) {\n // Do while loop breaks when \"X\" is entered and returns to menu\n do {\n flavs.push(readlineSync.question(\"Please enter pizza flavor. \"));\n console.log(\"Enter X to return or press enter to add another pizza flavor.\");\n } while (readlineSync.question() != \"X\")\n pizzaFlavor();\n }\n\n // Will remove array item when menu option 3 is chosen\n if (x === 3) {\n // Variable that stores array item to be removed\n let rm = readlineSync.question(\"Please enter pizza flavor number to remove. \");\n\n // If statement to check is input matches an item in array\n if (flavs.includes(rm)) {\n // If item exists the given item will be removed from the array and returns to menu\n flavs.splice(flavs.indexOf(rm), 1);\n pizzaFlavor();\n } else {\n // If item does not exist a message will be logged to console and returns to menu\n console.log(`Pizza flavors does not include ${rm}.`);\n pizzaFlavor();\n }\n\n }\n\n // If menu option 4 is chosen a message will be returned before exiting\n if (x === 4) {\n return console.log(\"Goodbye\");\n }\n}" ]
[ "0.7001863", "0.657572", "0.6354631", "0.61981887", "0.61617345", "0.6039793", "0.59346044", "0.58597845", "0.5759057", "0.57568675", "0.5734756", "0.5711459", "0.56503254", "0.56424713", "0.5628671", "0.5624591", "0.56080526", "0.5606945", "0.55971736", "0.5590472", "0.55805224", "0.5552525", "0.5549805", "0.55494136", "0.5545532", "0.5539159", "0.5535191", "0.55203235", "0.5514501", "0.55144423", "0.55031675", "0.5489432", "0.5484783", "0.548163", "0.5478807", "0.54445267", "0.5437527", "0.54280317", "0.5413058", "0.54049426", "0.5403171", "0.53885347", "0.53851014", "0.5381898", "0.53776217", "0.53772664", "0.5375205", "0.5373364", "0.5351634", "0.53499365", "0.5347719", "0.53471416", "0.5346711", "0.5342911", "0.5339975", "0.53349847", "0.5328616", "0.5328096", "0.5323827", "0.5318714", "0.5316711", "0.53145766", "0.5310767", "0.5308874", "0.5305553", "0.52950686", "0.52929175", "0.5284329", "0.5282659", "0.52809423", "0.5276205", "0.5268632", "0.52637357", "0.5261021", "0.5259221", "0.525922", "0.5252799", "0.5247729", "0.5239674", "0.52379245", "0.52361894", "0.5234169", "0.523282", "0.52306706", "0.5225386", "0.5223008", "0.5222767", "0.52201265", "0.5219727", "0.52192503", "0.521583", "0.52148867", "0.5214068", "0.52120614", "0.5211861", "0.520734", "0.52044666", "0.52024543", "0.5200851", "0.5200763" ]
0.56144774
16
Fancy restaurant scene start.
function fancyRestauratMenu() { subTitle.innerText = fancyRestaurantWelcome; firstButton.classList.add("hidden"); secondButton.classList.add("hidden"); fancyDiv.classList.remove("hidden"); handleFancyRestaurantChoice(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function start() {\n // To present a scene, use the following line, replacing 'sample' with\n // the id of any scene you want to present.\n\n SceneManager.getSharedInstance().presentScene('newScene1');\n}", "function startup() {\n\tsceneTransition(\"start\");\n}", "function start() {\n for(var i = 0; i < sceneList.length; i++) {\n addScene(sceneList[i]); // sceneList.js is imported in html-file\n }\n setScene(\"start\");\n }", "static start() {\n this.buttonCreate();\n this.buttonHideModal();\n\n // Animal.createAnimal('Zebras', 36, 'black-white', false);\n // Animal.createAnimal('Zirafa', 30, 'brown-white', true);\n // Animal.createAnimal('Liutas', 35, 'brown', false);\n // Animal.createAnimal('Dramblys', 20, 'grey', false);\n\n this.load();\n }", "function main () {\n // Initialise application\n\n // Get director singleton\n var director = Director.sharedDirector\n\n // Wait for the director to finish preloading our assets\n events.addListener(director, 'ready', function (director) {\n // Create a scene and layer\n var scene = new Scene()\n , layer = new Plague()\n\n // Add our layer to the scene\n scene.addChild(layer)\n\n // Run the scene\n director.replaceScene(scene)\n })\n\n // Preload our assets\n director.runPreloadScene()\n}", "function sceneStart(){\n\t\t\t\tfor (n = 0; n < heroes.length; n++)\n\t\t\t\t\theroes[n].tl.delay(20).fadeIn(35);\n\t\t\t\tmonster.tl.delay(20).fadeIn(35).delay(10).then(function(){\n\t\t\t\tgame.sceneStarted = true;\n\t\t\t\tthreatBar.opacity = 1;\n\t\t\t\tthreatGuage.opacity = 1;\n\t\t\t\tmonsterBox.opacity = 1;\n\t\t\t\tmonsterName.opacity = 1;\n\t\t\t\tpartyBox.opacity = 1;\n\t\t\t\tmuteButton.opacity = 1;\n\t\t\t\tfor (n = 0; n < nameLabels.length; n++){\n\t\t\t\t\tnameLabels[n].opacity = 1;\n\t\t\t\t\thpLabels[n].opacity = 1;\n\t\t\t\t\tmaxhpLabels[n].opacity = 1;\n\t\t\t\t\tmpLabels[n].opacity = 1;\n\t\t\t\t}\n\t\t\t});\n\t\t\t}", "function main () {\n // Initialise application\n\n // Get director singleton\n var director = Director.sharedDirector\n\n // Wait for the director to finish preloading our assets\n events.addListener(director, 'ready', function (director) {\n // Create a scene and layer\n var scene = new Scene()\n , layer = new Galaga()\n\n // Add our layer to the scene\n scene.addChild(layer)\n\n // Run the scene\n director.replaceScene(scene)\n })\n\n // Preload our assets\n director.runPreloadScene()\n}", "_start() {\n\n this._menuView = new MenuView(\n document.querySelector('nav'),\n this.sketches\n );\n\n for (var key in this.sketches) {\n this.DEFAULT_SKETCH = key;\n break;\n }\n\n this._setupScroll();\n this._setupWindow();\n this._onHashChange();\n }", "function App() {\n var mouse = DreamsArk.module('Mouse');\n //\n // /**\n // * start Loading the basic scene\n // */\n DreamsArk.load();\n //\n // mouse.click('#start', function () {\n //\n // start();\n //\n // return true;\n //\n // });\n //\n // mouse.click('.skipper', function () {\n //\n // query('form').submit();\n //\n // return true;\n //\n // });\n //\n // mouse.click('#skip', function () {\n //\n // query('form').submit();\n //\n // return true;\n //\n // });\n //\n // mouse.click('.reseter', function () {\n //\n // location.reload();\n //\n // return true;\n //\n // });\n }", "function start() {\n restarts++;\n currentScene = scenes[0];\n currentTextIndex = 0;\n\n setMainImage();\n setMainText();\n hideSetup();\n updateStats();\n}", "function start(action) {\r\n\t\r\n\t\tswitch (action) {\r\n\t\t\tcase 'go look':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: What are you going to look at??\", 1000);\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'explore':\r\n\t\t\t\texploreship(gameobj.explore);\r\n\t\t\t\tgameobj.explore++;\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'sit tight':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: Good choice we should probably wait for John to get back.\", 1000);\r\n\t\t\t\tgameobj.sittight++;\r\n\t\t\tbreak;\t\r\n\t\t}\r\n}", "function go() {\n console.log('go...')\n \n const masterT = new TimelineMax();\n \n masterT\n .add(clearStage(), 'scene-clear-stage')\n .add(enterFloorVegetation(), 'scene-floor-vegetation')\n .add(enterTreeStuff(), 'scene-enter-treestuff')\n .add(enterGreet(), 'scene-enter-greet')\n ;\n }", "function main(){\n\t//Initialice with first episode\n\tvar sel_episodes = [1]\n\t//collage(); //Create a collage with all the images as initial page of the app\n\tpaintCharacters();\n\tpaintEpisodes();\n\tpaintLocations(sel_episodes);\n}", "startGame() {\n this.scene.start('MenuScene');\n }", "function start(){\n renderGameField();\n resizeGameField();\n spawnSnake();\n spawnFood();\n eatFood();\n renderSnake();\n}", "function loadStart() {\n // Prepare the screen and load new content\n collapseHeader(false);\n wipeContents();\n loadHTML('#info-content', 'ajax/info.html');\n loadHTML('#upper-content', 'ajax/texts.html #welcome-text');\n loadHTML('#burger-container', 'ajax/burger-background.html #burger-flags', function() {\n loadScript(\"js/flag-events.js\");\n });\n}", "function start(){\n\t\t //Initialize this Game. \n newGame(); \n //Add mouse click event listeners. \n addListeners();\n\t\t}", "function initScene1() {\n if (currentScene === 1) {\n\n $('#game1').show(\"fast\");\n\n //clique sur une porte\n $('.dungeon0Door').on('click', function (e) {\n console.log(currentScene);\n if (consumeEnergy(10)) {\n if (oD10.roll() >= 8) {\n printConsole('Vous vous echappez du donjon');\n loadScene(2);\n } else {\n printConsole(\"Ce n'est pas la bonne porte ..\");\n $('.dungeon0Door').animate({\n opacity: '0'\n }, 'slow', function () {\n $('.dungeon0Door').animate({\n opacity: '1'\n }, 'fast');\n });\n }\n }\n });\n }\n }", "create() {\n\n // add animations (for all scenes)\n this.addAnimations();\n\n // change to the \"Home\" scene and provide the default chord progression / sequence\n this.scene.start('Home', {sequence: [0, 1, 2, 3, 0, 1, 2, 3]});\n }", "function start(){\n\t\n}", "function Aside() {\n appStarted = true;\n // all objects added to the stage appear in \"layer order\"\n // add a helloLabel to the stage\n seeMore = new objects.Label(\"Click me to see more of my work\", \"32px\", \"Times New Roman\", \"#000000\", canvasHalfWidth, canvasHalfHeight + 200, true);\n stage.addChild(seeMore);\n // add a clickMeButton to the stage\n treesharksLogo = new objects.Icon(loader, \"treesharksLogo\", canvasHalfWidth, canvasHalfHeight - 100, true);\n stage.addChild(treesharksLogo);\n }", "start() {// [3]\n }", "function renderStartPage() {\n addView(startPage());\n}", "onCreate(scene, custom) {}", "function start() {\n startMove = -kontra.canvas.width / 2 | 0;\n startCount = 0;\n\n audio.currentTime = 0;\n audio.volume = options.volume;\n audio.playbackRate = options.gameSpeed;\n\n ship.points = [];\n ship.y = mid;\n\n tutorialMoveInc = tutorialMoveIncStart * audio.playbackRate;\n showTutorialBars = true;\n isTutorial = true;\n tutorialScene.show();\n}", "function startDemo() {\n View.set('Demo');\n }", "function start()\n{\n clear();\n console.log(\"==============================================\\n\");\n console.log(\" *** Welcome to the Interstellar Pawn Shop *** \\n\");\n console.log(\"==============================================\\n\");\n console.log(\"We carry the following items:\\n\");\n readCatalog();\n}", "function start() {\n\n console.log(\"\\n\\t ------------Welcome to Bamazon Store-------------\");\n showProducts();\n\n\n\n}", "function Start(){\n activeScene.traverse(function(child){\n if(child.awake != undefined){\n child.awake();\n }\n });\n\n activeScene.traverse(function(child){\n if(child.start != undefined){\n child.start();\n }\n });\n activeScene.isReady = true;\n}", "function setup_goToStart(){\n // what happens when we move to 'goToStart' section of a trial\n wp.trialSection = 'goToStart';\n unstageArray(fb_array);\n\n // update objects\n choiceSet.arc.visible = false;\n choiceSet.arc_glow.visible = false;\n startPoint.sp.visible = true;\n startPoint.sp_glow.visible = false;\n\n // update messages\n msgs.goToStart.visible = true;\n msgs.tooSlow.visible = false;\n\n stage.update();\n }", "function createStart(){\n // scene components\n startScreen = initScene();\n startText = createSkyBox('libs/Images/startscene.png', 10);\n startScreen.add(startText);\n\n // lights\n \t\tvar light = createPointLight();\n \t\tlight.position.set(0,200,20);\n \t\tstartScreen.add(light);\n\n // camera\n \t\tstartCam = new THREE.PerspectiveCamera( 90, window.innerWidth / window.innerHeight, 0.1, 1000 );\n \t\tstartCam.position.set(0,50,1);\n \t\tstartCam.lookAt(0,0,0);\n }", "function start() {\n\n // Make sure we've got all the DOM elements we need\n setupDOM();\n\n // Updates the presentation to match the current configuration values\n configure();\n\n // Read the initial hash\n readURL();\n\n // Notify listeners that the presentation is ready but use a 1ms\n // timeout to ensure it's not fired synchronously after #initialize()\n setTimeout(function () {\n dispatchEvent('ready', {\n 'indexh': indexh,\n 'indexv': indexv,\n 'currentSlide': currentSlide\n });\n }, 1);\n\n }", "start() {\n console.log(\"Die Klasse App sagt Hallo!\");\n }", "function start () {\n gmCtrl.setObj();\n uiCtrl.setUi();\n }", "function startGame(mapName = 'galaxy'){\n toggleMenu(currentMenu);\n if (showStats)\n $('#statsOutput').show();\n $('#ammoBarsContainer').show();\n scene.stopTheme();\n scene.createBackground(mapName);\n if (firstTime) {\n firstTime = false;\n createGUI(true);\n render();\n } else {\n requestAnimationFrame(render);\n }\n}", "function gamestart() {\n\t\tshowquestions();\n\t}", "function fastFoodRestaurantScene() {\n subTitle.innerText = fastfoodWelcome;\n firstButton.classList.add(\"hidden\");\n secondButton.classList.add(\"hidden\");\n fastDiv.classList.remove(\"hidden\");\n\n handleFastRestaurantChoice();\n}", "function begin() {\n\tbackgroundBox = document.getElementById(\"BackgroundBox\");\n\n\tbuildGameView();\n\tbuildMenuView();\n\n\tinitSFX();\n\tinitMusic();\n\n\tENGINE_INT.start();\n\n\tswitchToMenu(new TitleMenu());\n\t//startNewGame();\n}", "function startScreen() {\n mainContainer.append(startButton)\n }", "function startGame() {\n\t\tstatus.show();\n\t\tinsertStatusLife();\n\t\tsetLife(100);\n\t\tsetDayPast(1);\n\t}", "function start() {\n\n}", "async start() {\n // Navbar in header\n this.navbar = new Navbar();\n this.navbar.render('header');\n\n // Footer renderin\n this.footer = new Footer();\n this.footer.render('footer');\n\n this.myFavorites = new Favorites();\n\n setTimeout(() => {\n this.router = new Router(this.myFavorites);\n }, 0)\n }", "initializeScene(){}", "function startRitual() {\n\tconsole.log(\"** glitter **\");\n\tflash(pump);\n}", "StartGame(player, start){\n this.scene.start('level1');\n }", "function startGame(){\n getDictionary();\n var state = $.deparam.fragment();\n options.variant = state.variant || options.variant;\n makeGameBoard();\n loadState();\n }", "start () {\n // Draw the starting point for the view with no elements\n }", "start () {\n // Draw the starting point for the view with no elements\n }", "doReStart() {\n // Stoppe la musique d'intro\n this.musicIntro.stop();\n // Lance la scene de menus\n this.scene.start('MenuScene');\n }", "function start() {\n //Currently does nothing\n }", "async show() {\n // Anzuzeigenden Seiteninhalt nachladen\n let html = await fetch(\"page-start/page-start.html\");\n let css = await fetch(\"page-start/page-start.css\");\n\n if (html.ok && css.ok) {\n html = await html.text();\n css = await css.text();\n } else {\n console.error(\"Fehler beim Laden des HTML/CSS-Inhalts\");\n return;\n }\n\n // Seite zur Anzeige bringen\n this._pageDom = document.createElement(\"div\");\n this._pageDom.innerHTML = html;\n\n await this._renderReciepts(this._pageDom);\n\n this._app.setPageTitle(\"Startseite\", {isSubPage: true});\n this._app.setPageCss(css);\n this._app.setPageHeader(this._pageDom.querySelector(\"header\"));\n this._app.setPageContent(this._pageDom.querySelector(\"main\"));\n\n this._countDown();\n }", "function run() { \n\n moveToNewspaper();\n pickBeeper();\n returnHome();\n\n}", "start() {// Your initialization goes here.\n }", "function start() {\n\tdocument.body.appendChild(object({ type: \"main\", id: \"content\" }));\n}", "function start() {\n getTodosFromLs();\n addTodoEventListeners();\n sidebar();\n updateTodaysTodoList();\n calendar();\n}", "function createFirstScene() {\n makeRect(0, 0, 30000, 3000, \"darkcyan\", 1)\n makeRect(119, 30, 30, 2, \"brown\", 1)\n makeRect(51, 30, 30, 2, \"brown\", 1)\n makeCircle(100, 30, 20, \"white\", 1)\n makeEllipse(100, 10, 12, 10, \"white\", 1)\n makeCircle(100, 60, 30, \"white\", 1)\n \n \n}", "function startLevel1(){\n teleMode = false;\n fadeAll();\n game.time.events.add(500, function() {\n game.state.start('state0');\n }, this);\n}", "function start() {\n INFO(\"start\", clock()+\"msecs\")\n loadThemeScript();\n if (window.MathJax)\n MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n beginInteractionSessions(QTI.ROOT);\n setTimeout(initializeCurrentItem, 100);\n setInterval(updateTimeLimits, 100);\n document.body.style.display=\"block\";\n INFO(\"end start\", clock()+\"msecs\");\n }", "function initMenu() {\n // Connect Animation\n window.onStepped.Connect(stepMenu);\n\n // Make buttons do things\n let startbutton = document.getElementById('start_button');\n \n //VarSet('S:Continue', 'yielding')\n buttonFadeOnMouse(startbutton);\n startbutton.onclick = startDemo\n\n\n // run tests for prepar3d integration\n runTests();\n}", "function start(){\n // First/starting background\n imageMode(CENTER);\n image(gamebackground, width/2, height/2, width, height);\n fill(255);\n text(\"Master of Pie\", width/2 - width/20, height/4);\n text(\"Start\", width/2 - width/75, height/2);\n text(\"(Landscape Orientation Preferred)\", width/2 - width/10, height/4 + height/14);\n // Pizzas array is cleared\n pizzas = [];\n // Creates the ship\n ship = new Spacecraft();\n // Creates pizzas/asteroids at random places offscreen\n for(let i = 0; i < pizzaorder; i++){\n pizzas[i] = new Rock(random(0, width), random(0, height), random(width/40, width/10));\n }\n // Reset variables\n click3 = true;\n reload = 10;\n piecutter = [];\n pizzaorder = 1;\n level = 1;\n}", "create(){\n this.scene.start('MenuGame');\n }", "function startApp() {\n displayProducts();\n}", "function start() {\n\n id = realtimeUtils.getParam('id');\n if (id) {\n // Load the document id from the URL\n realtimeUtils.load(id.replace('/', ''), onFileLoaded, onInitialize);\n init();\n } else {\n // Create a new document, add it to the URL\n realtimeUtils.createRealtimeFile('MyWebb App', function (createResponse) {\n window.history.pushState(null, null, '?id=' + createResponse.id);\n id=createResponse.id;\n realtimeUtils.load(createResponse.id, onFileLoaded, onInitialize);\n init();\n });\n \n }\n \n \n }", "function startup() {\n\tsaveSlot('rainyDayZRestart');\n\tfooterVisibility = document.getElementById(\"footer\").style.visibility;\n\tfooterHeight = document.getElementById(\"footer\").style.height;\t\n\tfooterOverflow = document.getElementById(\"footer\").style.overflow;\t\n\twrapper.scrollTop = 0;\n\tupdateMenu();\n\thideStuff();\n\tif(localStorage.getItem('rainyDayZAuto')) {\n\t\tloadSlot('rainyDayZAuto');\n\t}\n\telse{\n\t\tsceneTransition('start');\n\t}\n}", "function requestFish() {\n // all_stopped = 1;\n //addFish++;\n\n view.resize(300,300);\n aquarium.viewport(300,300)\n aquarium.prepare();\n}", "function Main() {\n console.log(\"%c Scene Switched...\", \"color: green; font-size: 16px;\");\n // clean up\n if (currentSceneState != scenes.State.NO_SCENE) {\n currentScene.Clean();\n stage.removeAllChildren();\n }\n // switch to the new scene\n switch (config.Game.SCENE) {\n case scenes.State.START:\n console.log(\"switch to Start Scene\");\n currentScene = new scenes.Start();\n break;\n case scenes.State.PLAY:\n console.log(\"switch to Play Scene\");\n currentScene = new scenes.Play();\n break;\n case scenes.State.END:\n console.log(\"switch to End Scene\");\n currentScene = new scenes.End();\n break;\n }\n currentSceneState = config.Game.SCENE;\n stage.addChild(currentScene);\n }", "function startGame(){\n \t\tGameJam.sound.play('start');\n \t\tGameJam.sound.play('run');\n\t\t\n\t\t// Put items in the map\n\t\titemsToObstacles(true);\n\n\t\t// Create the prisoner path\n\t\tGameJam.movePrisoner();\n\n\t\t// Reset items, we dont want the user to be able to drag and drop them\n \t\tGameJam.items = [];\n \t\t\n \t\tfor (var item in GameJam.levels[GameJam.currentLevel].items) {\n \t\t\tGameJam.levels[GameJam.currentLevel].items[item].count = GameJam.levels[GameJam.currentLevel].items[item].countStart;\n \t\t}\n\n\t\t// Reset prisoner speed\n\t\tGameJam.prisoner[0].sprite.speed = 5;\n\n\t\t// Reset game time\n\t\tGameJam.tileCounter = 0;\n\t\tGameJam.timer.className = 'show';\n\t\tdocument.getElementById('obstacles').className = 'hide';\n\t\tdocument.getElementById('slider').className = 'hide';\n\t\tdocument.getElementById('start-button-wrapper').className = 'hide';\n\n\t\t// Game has started\n\t\tGameJam.gameStarted = true;\n\n\t\tGameJam.gameEnded = false;\n\n\t\tdocument.getElementById('static-canvas').className = 'started';\n\n\t\tconsole.log('-- Game started');\n\t}", "function start() {\n console.log(\"Animation Started\");\n\n let masterTl = new TimelineMax();\n\n //TODO: add childtimelines to master\n masterTl\n .add(clearStage(), \"scene-clear-stage\")\n .add(enterFloorVegetation(), \"scene-floor-vegitation\")\n .add(enterTreeStuff(), \"tree-stuff\");\n }", "function start() {\n init();\n run();\n }", "function startEncounter(){\n\tthis.scene.start('Battle', {type: 'encounter'})\n}", "startScene() {\n console.log('[Game] startScene');\n var that = this;\n\n if (this.scene) {\n console.log('[Game] loading scene');\n this.scene.load().then(() => {\n console.log('[Game] Scene', that.scene.name, 'loaded: starting run & render loops');\n // setTimeout(function() {\n debugger;\n that.scene.start();\n debugger;\n that._runSceneLoop();\n that._renderSceneLoop();\n // }, 0);\n });\n } else {\n console.log('[Game] nothing to start: no scene selected!!');\n }\n }", "go() {\n\t\tthis.context.analytics.record(\"Game Loaded\");\n\t\tthis._$template.css({ \"visibility\": \"visible\"}).hide().fadeIn();\n\t\tthis._$start = $(\".start\", this._$template);\n\n\t\tthis._$start.on('click', (e) => {\n\t\t\te.preventDefault();\n\t\t\tthis._$template.fadeOut(() => {\n\t\t\t\tthis.nextState(\"playing\");\n\t\t\t});\n\t\t});\n\t}", "Main() {\n // add the welcome label to the scene\n this.addChild(this._overLabel);\n // add the backButton to the scene\n this.addChild(this._backButton);\n // event listeners\n this._backButton.on(\"click\", this._backButtonClick);\n }", "function start_view() {\n editor_visibility(true);\n button_visibility('view-mode');\n d3.json(resource_url(), editor_callback);\n}", "function main() {\n startSlideShowAnimation();\n renderProject();\n}", "function start() {\n //switch to scene 1\n window.inventoryActive = \"\";\n window.inventoryActive2 = \"\";\n window.inventory[1]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[2]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[3]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[4]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[5]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[6]= {id:\"\", inspected:false, desciption:\"\"};\n window.timerTime = null;\n window.inspectResultReceived =0;\n window.activeSlot = \"\";\n window.inspectResult= \"\";\n \n}", "function start() {\n action(1, 0, 0);\n}", "create() {\n // We have nothing left to do here. Start the next scene.\n \n\n this.input.on('pointerdown', function (pointer) {\n\n this.scene.start('Game');\n }, this);\n\n \n }", "function initiatePage () {\n\t highlightDayOfTheWeek();\n\t populateHairdresserContainer();\n\t animateContainer(true, '#who');\n\t window.setTimeout(function () { autoScrollSlideshow(); }, 4000);\n\t}", "function createFirstScene() {\nmakeRect(0,25,200,100,\"black\",0.6) \n makeCircle(100,52,25,\"orange\",1)\nmakeRect(90,75,20,8,\"red\",1)\nmakeRect(90,37,20,3,\"red\",0.4)\nmakeCircle(115,43,4,\"black\",0.9)\nmakeCircle(85,43,4,\"black\",0.9)\nmakeCircle(100,53,2,\"black\",0.9)\nmakeEllipse(100,27,28,10,1)\nmakeLine(123,61,77,61,\"black\",1)\nmakeCircle(100,112,35,\"black\",0.9)\nmakeLine(124,87,76,87,\"white\",1)\nmakeLine(131,97,69,97,\"white\",1)\nmakeCircle(100,25,2,\"white\")\nmakeImage(\"http://www.drodd.com/images15/canada-flag15.gif\",0,1,70,30,1)\nmakeLine(12,20,12,50,\"white\",4,1)\n var randomstuff= Math.random()\n if(randomstuff <0.4){\n makeText(\"Im a Canadian\",80,80,20,10,\"red\")\n }\n}", "function showStart() {\n layout.RemoveChild(loading);\n layout.AddChild(text);\n layout.AddChild(startButton);\n clearInterval(loadTime);\n\n // Setup arrows\n res.arrowTL_png.SetPosition(0, 0);\n res.arrowTR_png.SetPosition(0.9, 0);\n res.arrowBL_png.SetPosition(0, 0.85);\n res.arrowBR_png.SetPosition(0.9, 0.85);\n}", "function init() {\n createWelcomeGraphic();\n console.log('WELCOME TO ASSOCIATE MANAGER!');\n console.log('FOLLOW THE PROMPTS TO COMPLETE YOUR TASKS.');\n}", "function Main() {\n console.log(\"%c Scene Switched...\", \"color: green; font-size: 16px;\");\n // clean up\n if (currentSceneState != scenes.State.NO_SCENE) {\n currentScene.removeAllChildren();\n stage.removeAllChildren();\n }\n // switch to the new scene\n switch (config.Game.SCENE) {\n case scenes.State.START:\n console.log(\"switch to Start Scene\");\n currentScene = new scenes.Start();\n break;\n case scenes.State.PLAY:\n console.log(\"switch to Play Scene\");\n currentScene = new scenes.Play();\n break;\n case scenes.State.END:\n console.log(\"switch to End Scene\");\n currentScene = new scenes.End();\n break;\n }\n currentSceneState = config.Game.SCENE;\n stage.addChild(currentScene);\n }", "function generateScenes() { \n\n\tsceneIndex.push(new Scene(1,'Change the Future',bg.themes.grey,{sel:'#future',offset:0}));\n\tsceneIndex.push(new Scene(2,'Bitcoin Intro',bg.themes.grey,{sel:'#intro',offset:0,segueEnterDown:animations.fadeIntroText}));\n\tsceneIndex.push(new Scene(3,'Bank',bg.themes.white,{sel:'#bank',offset:0,segueEnterDown:animations.decentralize},svg.drawBankLines));\n\tsceneIndex.push(new Scene(4,'Use Case',bg.themes.white,{sel:'#usecase',offset:0,segueEnterDown:interactions.waitUseCase}));\n\tsceneIndex.push(new Scene(5,'Addresses',bg.themes.white,{sel:'#address',offset:0}));\t\n\tsceneIndex.push(new Scene(6,'Pick Address',bg.themes.white,{sel:'#pickaddress',offset:0,segueEnterDown:interactions.waitAddress}));\t\n\tsceneIndex.push(new Scene(7,'Use Address',bg.themes.white,{sel:'#useaddress',offset:0}));\t\n\tsceneIndex.push(new Scene(8,'Secret Key',bg.themes.white,{sel:'#secretkey',offset:0,segueEnterDown:animations.rotateCycle}));\n\tsceneIndex.push(new Scene(9,'Your Account',bg.themes.white,{sel:'#account',offset:0}));\n\tsceneIndex.push(new Scene(10,'Transfer',bg.themes.white,{sel:'#transfer',offset:0,segueEnterDown:interactions.waitTransfer}));\n\tsceneIndex.push(new Scene(11,'Transaction',bg.themes.white,{sel:'#transaction',offset:0}));\n\tsceneIndex.push(new Scene(12,'Ledger',bg.themes.white,{sel:'#ledger',offset:0,segueEnterDown:animations.solveBlock,segueEnterUp:animations.undoBlock}));\n\tsceneIndex.push(new Scene(13,'Package',bg.themes.white,{sel:'#package',offset:0}));\n\tsceneIndex.push(new Scene(14,'Reward',bg.themes.gradient,{sel:'#reward',offset:0}));\n\tsceneIndex.push(new Scene(15,'Network',bg.themes.grey,{sel:'#network',offset:0}));\n\tsceneIndex.push(new Scene(16,'Block Chain',bg.themes.grey,{sel:'#blockchain',offset:0}));\n\tsceneIndex.push(new Scene(17,'Resolution',bg.themes.grey,{sel:'#resolution',offset:0}));\n\tsceneIndex.push(new Scene(18,'Medium',bg.themes.grey,{sel:'#medium',offset:0}));\n\n\t_.indexBy(sceneIndex,'sceneIndex');\n\n\t// Add ScrollMagic listeners for scenes\n\t_.each(sceneIndex, function(val,key) {\n\n\t\tval.init();\n\n\t\t// Animated segues\n\t\tvar trigger = new ScrollMagic.Scene({\n\t\ttriggerElement: val.segue.sel,\n\t\toffset: 200,\n\t\tduration: val.height\n\t\t})\n\t\t.on(\"enter leave\", function(e) {\n\t\t\tvar enter = e.type === \"enter\";\n\t\t\tvar down = e.scrollDirection === \"FORWARD\";\n\t\t\tval.segueScene(enter,down);\n\t\t})\n\t\t//.addIndicators()\n\t\t.addTo(window.controller);\n\n\t\t// Pin the page\n\t\tvar pin = new ScrollMagic.Scene({\n\t\t triggerElement: \".scene\"+val.sceneIndex, // point of execution\n\t\t duration: $(window).height() - val.segue.offset, // pin element for the window height - 1\n\t\t triggerHook: 0, // don't trigger until trigger hits the top of the viewport\n\t\t reverse: true // allows the effect to trigger when scrolled in the reverse direction\n\t\t})\n\t\t//.addIndicators()\n\t\t.setPin(\".scene\"+val.sceneIndex) // the element we want to pin\n\t\t.addTo(window.controller);\n\n\t\t// Background DOWNWARD transitions\n\t\tvar downward = new ScrollMagic.Scene({\n\t\t\ttriggerElement: '.scene'+val.sceneIndex,\n\t\t\toffset: -200,\n\t\t\tduration: val.height\n\t\t})\n\t\t.on(\"enter leave\", function(e) {\n\t\t\tvar enter = e.type === \"enter\";\n\t\t\tvar down = e.scrollDirection === \"FORWARD\";\n\t\t\t(enter && down) && val.bgState();\n\t\t\tenter && breadcrumbs.open(val.sceneIndex);\n\t\t})\n\t\t.addTo(window.controller);\n\n\t\t// Background UPWARD transitions\n\t\tvar upward = new ScrollMagic.Scene({\n\t\t\ttriggerElement: '.scene'+val.sceneIndex,\n\t\t\toffset: 400,\n\t\t\tduration: val.height\n\t\t})\n\t\t.on(\"enter leave\", function(e) {\n\t\t\tvar enter = e.type === \"enter\";\n\t\t\tvar down = e.scrollDirection === \"FORWARD\";\n\t\t\t(val.sceneIndex > 0) && (enter && !down) && sceneIndex[val.sceneIndex-1].bgState();\n\t\t})\n\t\t.addTo(window.controller);\n\t\t\t\t\n\t})\n\n\tgenerateTweens();\n\tgenerateSceneListeners();\n\tbreadcrumbs.init();\n}", "function start(){\r\n\t\t// for now, start() will call _draw(), which draws all the objects on the stage\r\n\t\t// but in the next lesson, we'll add an animation loop that calls _draw()\r\n\t\t_draw(ctx);\r\n\t}", "start() {\n console.log(\"Die Klasse App sagt Hallo!\");\n this._router.resolve();\n }", "show ()\n\t{\n\t\t//if the view hasn't been initialised, call setup (of the concrete view e.g. LOView)\n\t\tif(!this.initialised)\n\t\t{\n\t\t\tthis.setup();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t//unhide the elements of the scene\n\t\t\tthis.root.style.display = 'block';\n\t\t}\n\t}", "function startScreen() {\n\t\t\tinitialScreen =\n\t\t\t\t\"<p class='text-center main-button-container'><a class='btn btn-default btn-lg btn-block start-button' href='#' role='button'>Start Quiz</a></p>\";\n\t\t\t$( \".mainArea\" )\n\t\t\t\t.html( initialScreen );\n\t\t}", "function startGame() {\r\n if (pressed == 0) {\r\n createRain();\r\n animate();\r\n }\r\n }", "function start(){\n\tautoCompleteSearch();\n\tsubmitButton();\n\tsubmitButtonRandom();\n\tnewSearch();\n\trandomChar();\n\thideCarouselNav();\n}", "function tl_start() {\n $('#futureman_face, #menu-open').css('display', 'inherit');\n $('.menu-open').css('visibility', 'inherit');\n }", "create(){\n this.add.text(20, 20, \"LoadingGame...\")\n\n this.time.addEvent({\n delay: 3000, // ms\n callback: function(){this.scene.start('MenuScene')},\n //args: [],\n callbackScope: this,\n loop: true \n });\n\n \n }", "function frontPage() {\n console.log(\"Welcome to Reddit! the front page of the internet\");\n fpMenu();\n\n\n}", "function reactionStart () {\n if (bu2.state != 1) t0 = new Date(); // Falls Animation angeschaltet, neuer Anfangszeitpunkt\n switchButton2(); // Zustand des Schaltknopfs ändern\n enableInput(false); // Eingabefelder deaktivieren\n if (bu2.state == 1) startAnimation(); // Entweder Animation starten bzw. fortsetzen ...\n else stopAnimation(); // ... oder stoppen\n reaction(); // Eingegebene Werte übernehmen und rechnen\n paint(); // Neu zeichnen\n }", "function onCreate() {\n\n /* -------------------------------*/\n /* Setting the stage */\n /* -------------------------------*/\n\n // **** Create our scene ***\n initScene();\n\n // **** Set up the Renderer ***\n initRenderer();\n\n // **** Setup Container stuff ***\n initContainer();\n\n // *** Setup the Halo stats div ***\n initStatsInfo();\n\n // **** DAT GUI! ***\n initGUI();\n\n // **** Setup our slider ***\n initSlider();\n\n\n /* -------------------------------*/\n /* Organizing our Actors */\n /* -------------------------------*/\n\n // Load Data for Halo // TREE679582 TREE676638\n initHaloTree(TREE676638, true);\n\n // **** Lights! ***\n initLights();\n\n // **** Camera! ***\n initCamera();\n\n // **** Setup our Raycasting stuff ***\n initRayCaster();\n\n // **** Action! Listeners *** //\n initListeners();\n\n\n}", "constructor()\n {\n // calling the super to inniciate this class as a scene\n super();\n }", "function startGame() {\n let gameBoard = document.getElementById('gameBoard');\n let tutorial = document.getElementById('tutorial');\n gameBoard.style.display = \"block\";\n tutorial.style.display = \"none\";\n addGround();\n addTree(treeCenter, trunkHeight);\n addBush(bushStart);\n addStones(stoneStart);\n addCloud(cloudStartX, cloudStartY);\n addingEventListenersToGame();\n addingEventListenersToTools();\n addInventoryEventListeners()\n}", "function FXstart (){\n setTimeout(FXdisplayLaunch, 1500);\n FXweatherGeolocation();\n FXdisplayMarsWeather();\n }", "function start() {\n $('#waitPanel').remove();\n\n // build slides dynamically\n const slides = $('div.slides');\n const areyoureadyTemplate = $('#areyouready-template').html();\n slides.append(areyoureadyTemplate\n .replace(/VOICE_ID/g, sessionData['voice']['id'])\n );\n const wordTemplate = $('#word-template').html();\n $.each(sessionData['wordList'], function(idx, data) {\n slides.append(wordTemplate\n .replace(/ID/g, idx+1)\n );\n });\n const goodjobTemplate = $('#goodjob-template').html();\n slides.append(goodjobTemplate\n .replace(/VOICE_ID/g, sessionData['voice']['id'])\n );\n\n Reveal.initialize({\n controlsLayout: \"edges\",\n overview: false,\n autoPlayMedia: true,\n hash: false,\n viewDistance: Number.MAX_VALUE,\n keyboard: {\n 13: listenAgain,\n 65: listenAgain, // A - again\n 82: listenAgain, // R - repeat\n }\n });\n\n Reveal.addEventListener('slidechanged', function(p) {\n const slideNum = p['indexh'];\n playSound(slideNum);\n });\n\n // change to first (later changes will be captured above\n playSound(0);\n}", "start(event){\n console.warn(\"ZOOTYMON GO!\");\n $('.firstpage').hide();\n $('.dino2').hide();\n zootyMon.progressbar();\n const $name = $('input').val();\n $('.nameInput').text($name);\n zootyMon.increaseAge();\n zootyMon.morph();\n zootyMon.animateZootymon();\n \n \n }", "function Start() {\n console.log(`%c Start Function`, \"color: grey; font-size: 14px; font-weight: bold;\");\n stage = new createjs.Stage(canvas);\n createjs.Ticker.framerate = Config.Game.FPS;\n createjs.Ticker.on('tick', Update);\n stage.enableMouseOver(20);\n Config.Game.ASSETS = assets; // make a reference to the assets in the global config\n Main();\n }" ]
[ "0.74389476", "0.7310588", "0.70975536", "0.6952484", "0.6715637", "0.66859394", "0.663983", "0.6638555", "0.6571287", "0.65618575", "0.65270853", "0.6473177", "0.646615", "0.64646536", "0.6458617", "0.64431214", "0.6443038", "0.6418837", "0.6404111", "0.64015144", "0.6380875", "0.6348404", "0.63479435", "0.6347251", "0.634585", "0.63456863", "0.6344421", "0.6331548", "0.6305322", "0.63032794", "0.62967074", "0.6293326", "0.6290774", "0.6289273", "0.6284763", "0.62712044", "0.62665856", "0.625361", "0.6251022", "0.6232611", "0.6229435", "0.6222703", "0.62118804", "0.6211269", "0.61995584", "0.6193853", "0.6193189", "0.6193189", "0.6161966", "0.61595094", "0.61471444", "0.6140593", "0.61356044", "0.6129856", "0.6129199", "0.6126119", "0.6125271", "0.6099707", "0.6095008", "0.60944366", "0.60938627", "0.60920066", "0.6088571", "0.60833126", "0.6081371", "0.6071361", "0.6069223", "0.60576355", "0.60474247", "0.6045314", "0.60429096", "0.60364366", "0.6033361", "0.60257286", "0.6025719", "0.6018825", "0.6015323", "0.6014897", "0.6010746", "0.5998373", "0.599543", "0.59927905", "0.5991143", "0.598838", "0.59868", "0.5986538", "0.5985335", "0.59825665", "0.59821886", "0.59819", "0.5981512", "0.59686005", "0.5966992", "0.5966366", "0.596506", "0.59634614", "0.59591883", "0.59558636", "0.59542066", "0.59533006", "0.59526473" ]
0.0
-1
Dish menu for fancy restaurant scene.
function handleFancyRestaurantChoice() { /** @type {HTMLInputElement} Input field. */ const dishInput = document.getElementById("dish-input").value; const fancyMenu = ["pizza", "paella", "pasta"] if(dishInput == fancyMenu[0]) { restaurantClosing(); } else if (dishInput == fancyMenu[1]) { restaurantClosing(); } else if (dishInput == fancyMenu[2]) { restaurantClosing(); } else { fancyRestauratMenu(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayMenu() {\n const menu = document.querySelector(\"#menu\");\n let dishes = hard_coded_dishes;\n\n dishes.forEach(dish => {\n // generate template for main ingredient and the name of the dish\n const main = displayDish(\n dish.course,\n dish.name,\n dish.price,\n dish.ingredient\n );\n\n // generate options for each dish\n const options = [];\n\n if (dish.options) {\n dish.options.forEach(option => {\n options.push(displayOption(option.option, option.price));\n });\n }\n\n // add this to the DOM\n menu.insertAdjacentHTML(\"beforeend\", main + options.join(\"\"));\n });\n}", "addDishToMenu(dish) {\n if(this.menu.includes(dish))\n {\n this.removeDishFromMenu(dish.id);\n }\n this.menu.push(dish);\n }", "function showMenu(arg)\r\n\t{\r\n\t\tswitch(arg)\r\n\t\t{\r\n\t\t\tcase 0:\r\n\t\t\t\t$('#menu').html(\"\");\r\n\t\t\tbreak;\r\n\t\t\tcase 1:\r\n\t\t\t\t$('#menu').html(\"<h1 id='title' style='position:relative;top:20px;left:-40px;width:500px;'>Sheep's Snake</h1><p style='position:absolute;top:250px;left:-50px;font-size:1.1em;' id='playA'>Press A to play!</p><p style='position:absolute;top:280px;left:-50px;font-size:1.1em;' id='playB'>Press B for some help !</p>\");\r\n\t\t\t\t\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "function foodMenuItems() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar $foodItemOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '80%';\r\n\t\t\t\t\t$($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar $that = $(this),\r\n\t\t\t\t\t\twaypoint = new Waypoint({\r\n\t\t\t\t\t\t\telement: $that,\r\n\t\t\t\t\t\t\thandler: function () {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {\r\n\t\t\t\t\t\t\t\t\twaypoint.destroy();\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t$that.find('.nectar_food_menu_item').each(function (i) {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tvar $that = $(this);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t\t\t$that.addClass('animated-in');\r\n\t\t\t\t\t\t\t\t\t}, i * 150);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\twaypoint.destroy();\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\toffset: $foodItemOffsetPos\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t}", "getMenu() {alert(\"entering grocery.js getMenu()\")\n\t\t// Assemble the menu list (meal nodes)\n\t\tthis.menuCloset.destructBoxes()\n\t\tlet mealNodes = graph.getNodesByID_partial(\"meal\", \"\")\n\t\tfor (let meal of mealNodes) {\n\t\t\tif (meal.inMenu) { // i don't think we need to keep track of what's on the menu by using inMenu anymore. I think we can just use groceryListArea.menuCloset.boxes to see what's on the menu. This is the next thing to take a look at and understand better. (todo)\n\t\t\t\tthis.menuCloset.add(meal)\n\t\t\t}\n\t\t}\n\t\tthis.updateGroceryList()\n\t}", "function thememascot_menuzord() {\n $(\"#menuzord\").menuzord({\n align: \"left\",\n effect: \"slide\",\n animation: \"none\",\n indicatorFirstLevel: \"<i class='fa fa-angle-down'></i>\",\n indicatorSecondLevel: \"<i class='fa fa-angle-right'></i>\"\n });\n $(\"#menuzord-right\").menuzord({\n align: \"right\",\n effect: \"slide\",\n animation: \"none\",\n indicatorFirstLevel: \"<i class='fa fa-angle-down'></i>\",\n indicatorSecondLevel: \"<i class='fa fa-angle-right'></i>\"\n });\n }", "constructor(props) {\n super(props);\n\n // comente lo de abajo por que ahora lo estamos extrallendo del archivo dishes.js\n this.state = {\n selectedDish: null\n }\n console.log('menu constructor is invoke')\n \n }", "function onOpen() {\n createMenu();\n}", "function loadMenu(){\n\t\tpgame.state.start('menu');\n\t}", "function menu() {\n this.meal1 = \"Ham and Cheese Sandwich\",\n this.meal2 = \"Roastbeef Sandwich\"\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 lijstSubMenuItem() {\n\n if ($mLess.text() == \"meer\") {\n $mLess.text(\"minder\")\n } else {\n $mLess.text(\"meer\");\n\n }\n $list.toggleClass('hidden')\n $resum.get(0).scrollIntoView('slow');\n event.preventDefault()\n }", "function DfoMenu(/**string*/ menu)\r\n{\r\n\tSeS(\"G_Menu\").DoMenu(menu);\r\n\tDfoWait();\r\n}", "function showMenu() {\n // clear the console\n console.log('\\033c');\n // menu selection\n inquirer\n .prompt([\n {\n type: \"list\",\n name: \"wish\",\n choices: [\"View Product Sales by Department\", \"Create New Department\", \"Exit\"],\n message: '\\nWhat would you like to do? '\n }\n ]).then( answer => {\n switch (answer.wish){\n case \"View Product Sales by Department\":\n showSale();\n break;\n case \"Create New Department\":\n createDept();\n break;\n case \"Exit\":\n connection.end();\n break;\n default:\n console.log( `\\x1b[1m \\x1b[31m\\nERROR! Invalid Selection\\x1b[0m`);\n }\n })\n}", "function createMenu() {\n const menu = document.createElement(\"div\");\n for (let section in Menu) {\n menu.appendChild(createDishSection(Menu[section].name));\n menu.appendChild(createDishList(Menu[section].dishes));\n }\n return menu;\n}", "function menuhrres() {\r\n\r\n}", "function menuOptions() {}", "function showMainMenu(){\n addTemplate(\"menuTemplate\");\n showMenu();\n}", "function onOpen() { CUSTOM_MENU.add(); }", "function clickAddnewMenu(){\n\t\t\n\t\t$(\"#menuAddNew\").show();\n\t\t//$(\".categorydropList\").load(jssitebaseUrl+\"/ajaxActionRestaurant.php?action=categoryDropList\");\n\t\t$(\"#menuEdit\").hide();\n\t\t//$(\"#addnew_buttun\").hide();\n\t\t$(\".restaurantMenuContent\").hide();\n\t}", "function menuShow() {\n ui.appbarElement.addClass('open');\n ui.mainMenuContainer.addClass('open');\n ui.darkbgElement.addClass('open');\n}", "function onOpen() {\n SpreadsheetApp.getUi()\n .createMenu('Great Explorations')\n .addItem('Match Girls to Workshops', 'matchGirls')\n .addToUi();\n}", "function showMenu(){\n // shows panel for piano\n rectMode(CENTER);\n fill(0, 100, 255);\n rect(width/2, height/2 - 100, 400, 150);\n textAlign(CENTER, CENTER), textSize(75);\n fill(0);\n text('Piano', width/2, height/2 - 100);\n \n // shows panel for guitar\n rectMode(CENTER);\n fill(0, 240 , 250);\n rect(width/2, height/2 + 100, 400, 150);\n textAlign(CENTER, CENTER), textSize(75);\n fill(0);\n text('Guitar', width/2, height/2 + 100);\n}", "function fancyRestauratMenu() {\n subTitle.innerText = fancyRestaurantWelcome;\n firstButton.classList.add(\"hidden\");\n secondButton.classList.add(\"hidden\");\n fancyDiv.classList.remove(\"hidden\");\n\n handleFancyRestaurantChoice();\n}", "expandMenu() {\r\n\t}", "function fastFoodRestaurantScene() {\n subTitle.innerText = fastfoodWelcome;\n firstButton.classList.add(\"hidden\");\n secondButton.classList.add(\"hidden\");\n fastDiv.classList.remove(\"hidden\");\n\n handleFastRestaurantChoice();\n}", "function setMenu() {\n var menu = gId('menu');\n var menu_elements = menu.children;\n for (var i = 0; i < menu_elements.length; i++) {\n if (menu_elements[i].textContent != \"my stories\") {\n menu_elements[i].style.display = 'none';\n }\n }\n}", "function _createFoodMenu( data ) {\n var html = '', note = data.notification ? \n '<div class=\"notification\">'+data.notification+'</div>' : '';\n \n if ( data.headline ) {\n var id = getAutoId(); \n html = '<h2 id=\"'+id+'\">'+data.headline+'</h2>'+note;\n } else if ( data.subline ) {\n html = '<h3>'+data.subline+'</h3>'+note;\n } else if ( data.type === 'setmenu-price' ) {\n html = '<div class=\"setmenu-price price\">'+data.price+'</div>'+note;\n } else {\n var name = data.name ? '<div class=\"name\">'+data.name+'</div>' : '';\n var number = data.number ? '<div class=\"number\">'+data.number+'</div>' : '';\n var price = data.price ? '<div class=\"price\">'+data.price+'</div>' : '';\n\n var description = data.description ? \n '<div class=\"description\">'+data.description+'</div>' : '';\n var sashimi = data.sashimi ? \n '<div class=\"price sashimi\">'+data.sashimi+'</div>' : '';\n var type = 'food' + (data.type ? (' -'+data.type) : '') +\n (sashimi ? ' -has-sashimi' : '') + (number ? '' : ' -no-number');\n\n html = '<div class=\"'+type+'\">' +\n number + name + price + sashimi + description + note +\n '</div>'; \n }\n return html;\n}", "function renderMenu() {\n\tvar menu = com.dawgpizza.menu;\n\t// grab templates for duplication\n\tvar pizzaTemplate = $('.pizza-template');\n\tvar drinkDessertTemplate = $('.drink-dessert-template');\n\t$.each(com.dawgpizza.menu.pizzas, function() {\n\t\tvar pizzaTemplateClone = pizzaTemplate.clone();\n\t\t// populate the clone's fields\n \tpizzaTemplateClone.find('.name').html(this.name);\n \tpizzaTemplateClone.find('.description').html(this.description + \" \" \n \t\t+ this.prices[0]+\"/\"+this.prices[1]+\"/\"+this.prices[2]);\n\n \t// data-type=\"\" data-name=\"\" data-qty=\"\" data-price=\"\"\n \tpizzaTemplateClone.find('button.form-control').attr({\n \t\t\"data-type\": this.type,\n \t\t\"data-name\": this.name\n \t});\n \t// add prices to select options\n \tvar pizza = this;\n\t $.each(pizzaTemplateClone.find('select').children(), function(idx) {\n\t \t$(this).val(pizza.prices[idx]);\n\t });\n\t if(this.vegetarian) { // put in the vegetarian menu.\n\t \t$('#veggie-spot').append(pizzaTemplateClone);\n\t } else { // put in the carnivore menu.\n\t \t$('#meat-spot').append(pizzaTemplateClone);\n\t }\n\t});\n\n\t$.each(com.dawgpizza.menu.drinks, function() {\n\t\tvar drinkDessertTemplateClone = drinkDessertTemplate.clone();\n\t\t// populate the clone's fields\n\t\tdrinkDessertTemplateClone.find('.name').html(this.name);\n\n\t\t// data-type=\"\" data-name=\"\" data-qty=\"\" data-price=\"\"\n \tdrinkDessertTemplateClone.find('button.form-control').attr({\n \t\t\"data-type\": this.type,\n \t\t\"data-name\": this.name,\n \t\t\"data-price\": this.price\n \t});\n\n\t\t$('#drinks').append(drinkDessertTemplateClone);\n\t});\n\n\t$.each(com.dawgpizza.menu.desserts, function() {\n\t\tvar drinkDessertTemplateClone = drinkDessertTemplate.clone();\n\t\t// populate the clone's fields\n\t\tdrinkDessertTemplateClone.find('.name').html(this.name);\n\t\t// data-type=\"\" data-name=\"\" data-qty=\"\" data-price=\"\"\n \tdrinkDessertTemplateClone.find('button.form-control').attr({\n \t\t\"data-type\": this.type,\n \t\t\"data-name\": this.name,\n \t\t\"data-price\": this.price\n \t});\n\n\t\t$('#desserts').append(drinkDessertTemplateClone);\n\t});\n}", "function initMenu(){\n\toutlet(4, \"vpl_menu\", \"clear\");\n\toutlet(4, \"vpl_menu\", \"append\", \"properties\");\n\toutlet(4, \"vpl_menu\", \"append\", \"help\");\n\toutlet(4, \"vpl_menu\", \"append\", \"rename\");\n\toutlet(4, \"vpl_menu\", \"append\", \"expand\");\n\toutlet(4, \"vpl_menu\", \"append\", \"fold\");\n\toutlet(4, \"vpl_menu\", \"append\", \"---\");\n\toutlet(4, \"vpl_menu\", \"append\", \"duplicate\");\n\toutlet(4, \"vpl_menu\", \"append\", \"delete\");\n\n\toutlet(4, \"vpl_menu\", \"enableitem\", 0, myNodeEnableProperties);\n\toutlet(4, \"vpl_menu\", \"enableitem\", 1, myNodeEnableHelp);\n outlet(4, \"vpl_menu\", \"enableitem\", 3, myNodeEnableBody);\t\t\n outlet(4, \"vpl_menu\", \"enableitem\", 4, myNodeEnableBody);\t\t\n}", "function Estiliza_menu_itens()\n{\n //PARA CADA ITEM DO MENU, BASTA CHAMAR A FUNÇÃO ABAIXO, ESPECIFICANDO\n //SEU INDICE(NUMERO), SUA COR(STRING), SEU CONTEUDO(STRING), SEU LABEL(STRING)\n //Estiliza_item(Indice, Cor, Conteudo, Texto Lateral);\n Estiliza_item(0,\"blue\",\"+\",\"Adicionar\");\n Estiliza_item(1,\"red\",\"Botão\");\n}", "function gameMenuStartableDrawer() {\n if (store.getState().currentPage == 'GAME_MENU' && store.getState().lastAction == 'GAMEDATA_LOADED') {\n gameMenuStartableStarsid.innerHTML = store.getState().activeGameState.stars.toString() + '/77';\n }\n }", "function ciniki_musicfestivals_main() {\n //\n // The panel to list the festival\n //\n this.menu = new M.panel('Music Festivals', 'ciniki_musicfestivals_main', 'menu', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.menu');\n this.menu.data = {};\n this.menu.nplist = [];\n this.menu.sections = {\n// 'search':{'label':'', 'type':'livesearchgrid', 'livesearchcols':1,\n// 'cellClasses':[''],\n// 'hint':'Search festival',\n// 'noData':'No festival found',\n// },\n '_tabs':{'label':'', 'type':'paneltabs', 'selected':'festivals',\n 'visible':function() {return M.modFlagSet('ciniki.musicfestivals', 0x40); },\n 'tabs':{\n 'festivals':{'label':'Festivals', 'fn':'M.ciniki_musicfestivals_main.menu.switchTab(\"festivals\");'},\n 'trophies':{'label':'Trophies', 'fn':'M.ciniki_musicfestivals_main.menu.switchTab(\"trophies\");'},\n }},\n 'festivals':{'label':'Festival', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.menu.sections._tabs.selected == 'festivals' ? 'yes' : 'no';},\n 'noData':'No Festivals',\n 'addTxt':'Add Festival',\n 'addFn':'M.ciniki_musicfestivals_main.edit.open(\\'M.ciniki_musicfestivals_main.menu.open();\\',0,null);'\n },\n 'trophies':{'label':'Trophies', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.menu.sections._tabs.selected == 'trophies' ? 'yes' : 'no';},\n 'noData':'No Trophies',\n// 'headerValues':['Category', 'Name'],\n 'addTxt':'Add Trophy',\n 'addFn':'M.ciniki_musicfestivals_main.trophy.open(\\'M.ciniki_musicfestivals_main.menu.open();\\',0,null);'\n },\n }\n this.menu.liveSearchCb = function(s, i, v) {\n if( s == 'search' && v != '' ) {\n M.api.getJSONBgCb('ciniki.musicfestivals.festivalSearch', {'tnid':M.curTenantID, 'start_needle':v, 'limit':'25'}, function(rsp) {\n M.ciniki_musicfestivals_main.menu.liveSearchShow('search',null,M.gE(M.ciniki_musicfestivals_main.menu.panelUID + '_' + s), rsp.festivals);\n });\n }\n }\n this.menu.liveSearchResultValue = function(s, f, i, j, d) {\n return d.name;\n }\n this.menu.liveSearchResultRowFn = function(s, f, i, j, d) {\n return 'M.ciniki_musicfestivals_main.festival.open(\\'M.ciniki_musicfestivals_main.menu.open();\\',\\'' + d.id + '\\');';\n }\n this.menu.switchTab = function(tab) {\n if( tab != null ) { this.sections._tabs.selected = tab; }\n this.open();\n }\n this.menu.cellValue = function(s, i, j, d) {\n if( s == 'festivals' ) {\n switch(j) {\n case 0: return d.name;\n case 1: return d.status_text;\n }\n }\n if( s == 'trophies' ) {\n switch(j) {\n case 0: return d.category;\n case 1: return d.name;\n }\n }\n }\n this.menu.rowFn = function(s, i, d) {\n if( s == 'festivals' ) {\n return 'M.ciniki_musicfestivals_main.festival.open(\\'M.ciniki_musicfestivals_main.menu.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.nplist);';\n }\n if( s == 'trophies' ) {\n return 'M.ciniki_musicfestivals_main.trophy.open(\\'M.ciniki_musicfestivals_main.menu.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.menu.nplist);';\n }\n }\n this.menu.open = function(cb) {\n if( this.sections._tabs.selected == 'trophies' ) {\n M.api.getJSONCb('ciniki.musicfestivals.trophyList', {'tnid':M.curTenantID}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.menu;\n p.data = rsp;\n p.nplist = (rsp.nplist != null ? rsp.nplist : null);\n p.refresh();\n p.show(cb);\n });\n } else {\n M.api.getJSONCb('ciniki.musicfestivals.festivalList', {'tnid':M.curTenantID}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.menu;\n p.data = rsp;\n p.nplist = (rsp.nplist != null ? rsp.nplist : null);\n p.refresh();\n p.show(cb);\n });\n }\n }\n this.menu.addClose('Back');\n\n //\n // The panel to display Festival\n //\n this.festival = new M.panel('Festival', 'ciniki_musicfestivals_main', 'festival', 'mc', 'large narrowaside', 'sectioned', 'ciniki.musicfestivals.main.festival');\n this.festival.data = null;\n this.festival.festival_id = 0;\n this.festival.section_id = 0;\n this.festival.schedulesection_id = 0;\n this.festival.scheduledivision_id = 0;\n this.festival.invoice_typestatus = '';\n this.festival.list_id = 0;\n this.festival.listsection_id = 0;\n this.festival.nplists = {};\n this.festival.nplist = [];\n this.festival.messages_status = 10;\n this.festival.city_prov = 'All';\n this.festival.province = 'All';\n this.festival.registration_tag = '';\n this.festival.sections = {\n '_tabs':{'label':'', 'type':'menutabs', 'selected':'sections', 'tabs':{\n 'sections':{'label':'Syllabus', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'sections\\');'},\n 'registrations':{'label':'Registrations', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'registrations\\');'},\n 'schedule':{'label':'Schedule', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'schedule\\');'},\n 'videos':{'label':'Videos', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'videos\\');',\n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.data.flags&0x02) == 0x02 ? 'yes' : 'no'},\n },\n 'comments':{'label':'Comments', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'comments\\');',\n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.data.flags&0x02) == 0x02 ? 'yes' : 'no'},\n },\n 'competitors':{'label':'Competitors', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'competitors\\');'},\n// 'adjudicators':{'label':'Adjudicators', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'adjudicators\\');'},\n// 'files':{'label':'Files', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'files\\');'},\n 'photos':{'label':'Photos', \n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x04); },\n 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'photos\\');',\n },\n// 'sponsors':{'label':'Sponsors', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'sponsors\\');',\n// 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x10); },\n// },\n 'messages':{'label':'Messages', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'messages\\');',\n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x0400); },\n },\n// 'sponsors-old':{'label':'Sponsors', \n// 'visible':function() { \n// return (M.curTenant.modules['ciniki.sponsors'] != null && (M.curTenant.modules['ciniki.sponsors'].flags&0x02) == 0x02) ? 'yes':'no'; \n// },\n// 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'sponsors-old\\');',\n// },\n 'more':{'label':'More...', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'more\\');'},\n }},\n '_moretabs':{'label':'', 'type':'menutabs', 'selected':'adjudicators', \n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'more' ? 'yes' : 'no'; },\n 'tabs':{\n 'invoices':{'label':'Invoices', 'fn':'M.ciniki_musicfestivals_main.festival.switchMTab(\\'invoices\\');'},\n 'adjudicators':{'label':'Adjudicators', 'fn':'M.ciniki_musicfestivals_main.festival.switchMTab(\\'adjudicators\\');'},\n 'certificates':{'label':'Certificates', 'fn':'M.ciniki_musicfestivals_main.festival.switchMTab(\\'certificates\\');'},\n 'lists':{'label':'Lists', 'fn':'M.ciniki_musicfestivals_main.festival.switchMTab(\\'lists\\');',\n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x20); },\n },\n 'emails':{'label':'Emails', 'fn':'M.ciniki_musicfestivals_main.festival.switchMTab(\\'emails\\');',\n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x0200); },\n },\n 'files':{'label':'Files', 'fn':'M.ciniki_musicfestivals_main.festival.switchMTab(\\'files\\');'},\n 'sponsors':{'label':'Sponsors', 'fn':'M.ciniki_musicfestivals_main.festival.switchMTab(\\'sponsors\\');',\n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x10); },\n },\n/* 'sponsors-old':{'label':'Sponsors', \n 'visible':function() { \n return (M.curTenant.modules['ciniki.sponsors'] != null && (M.curTenant.modules['ciniki.sponsors'].flags&0x02) == 0x02) ? 'yes':'no'; \n },\n 'fn':'M.ciniki_musicfestivals_main.festival.switchMTab(\\'sponsors-old\\');',\n }, */\n }},\n 'details':{'label':'Details', 'aside':'yes', \n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'sections' ? 'yes' : 'no';},\n 'list':{\n 'name':{'label':'Name'},\n 'start_date':{'label':'Start'},\n 'end_date':{'label':'End'},\n 'num_registrations':{'label':'# Reg'},\n }},\n// '_more':{'label':'', 'aside':'yes', \n// 'list':{\n// 'adjudicators':{'label':'Adjudicators', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(\\'adjudicators\\');'},\n// }},\n 'download_buttons':{'label':'', 'aside':'yes',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'sections' && M.ciniki_musicfestivals_main.festival.sections._stabs.selected == 'sections' ? 'yes' : 'no'; },\n 'buttons':{\n 'download':{'label':'Download Syllabus (PDF)', \n 'fn':'M.ciniki_musicfestivals_main.festival.syllabusDownload();',\n },\n }},\n 'syllabus_search':{'label':'', 'type':'livesearchgrid', 'livesearchcols':5,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'sections' ? 'yes' : 'no'; },\n 'hint':'Search class names',\n 'noData':'No classes found',\n 'headerValues':['Section', 'Category', 'Class', 'Fee', 'Registrations'],\n },\n '_stabs':{'label':'', 'type':'paneltabs', 'selected':'sections', \n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'sections' ? 'yes' : 'no'; },\n 'tabs':{\n 'sections':{'label':'Sections', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(null,\\'sections\\');'},\n 'categories':{'label':'Categories', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(null,\\'categories\\');'},\n 'classes':{'label':'Classes', 'fn':'M.ciniki_musicfestivals_main.festival.switchTab(null,\\'classes\\');'},\n }},\n 'sections':{'label':'', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'sections' && M.ciniki_musicfestivals_main.festival.sections._stabs.selected == 'sections' ? 'yes' : 'no'; },\n 'sortable':'yes',\n 'sortTypes':['text', 'number'],\n 'headerValues':['Section', 'Registrations'],\n 'addTxt':'Add Section',\n 'addFn':'M.ciniki_musicfestivals_main.section.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n 'mailFn':function(s, i, d) {\n if( d != null ) {\n return 'M.ciniki_musicfestivals_main.message.addnew(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id,\\'ciniki.musicfestivals.section\\',\\'' + d.id + '\\');';\n } \n return '';\n },\n 'editFn':function(s,i,d) {\n if( d != null ) {\n return 'M.ciniki_musicfestivals_main.section.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.festival_id, M.ciniki_musicfestivals_main.festival.nplists.sections);';\n }\n return '';\n },\n },\n 'si_buttons':{'label':'', \n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'sections' && M.ciniki_musicfestivals_main.festival.sections._stabs.selected == 'sections' && M.ciniki_musicfestivals_main.festival.data.sections.length == 0 ? 'yes' : 'no'; },\n 'buttons':{\n 'copy':{'label':'Copy Previous Syllabus, Lists & Settings', \n 'fn':'M.ciniki_musicfestivals_main.festival.festivalCopy(\"previous\");',\n },\n }},\n 'categories':{'label':'', 'type':'simplegrid', 'num_cols':3,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'sections' && M.ciniki_musicfestivals_main.festival.sections._stabs.selected == 'categories' ? 'yes' : 'no'; },\n 'sortable':'yes',\n 'sortTypes':['text', 'text', 'number'],\n 'headerValues':['Section', 'Category', 'Registrations'],\n 'addTxt':'Add Category',\n 'addFn':'M.ciniki_musicfestivals_main.category.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,0,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n 'mailFn':function(s, i, d) {\n if( d != null ) {\n return 'M.ciniki_musicfestivals_main.message.addnew(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id,\\'ciniki.musicfestivals.category\\',\\'' + d.id + '\\');';\n } \n return '';\n },\n },\n 'classes':{'label':'', 'type':'simplegrid', 'num_cols':5,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'sections' && M.ciniki_musicfestivals_main.festival.sections._stabs.selected == 'classes' ? 'yes' : 'no'; },\n 'sortable':'yes',\n 'sortTypes':['text', 'text', 'text', 'number', 'number'],\n 'headerValues':['Section', 'Category', 'Class', 'Fee', 'Registrations'],\n 'addTxt':'Add Class',\n 'addFn':'M.ciniki_musicfestivals_main.class.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,0,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n 'mailFn':function(s, i, d) {\n if( d != null ) {\n return 'M.ciniki_musicfestivals_main.message.addnew(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id,\\'ciniki.musicfestivals.class\\',\\'' + d.id + '\\');';\n } \n return '';\n },\n },\n 'registration_tabs':{'label':'', 'aside':'yes', 'type':'paneltabs', 'selected':'sections',\n 'visible':function() { return ['registrations','videos'].indexOf(M.ciniki_musicfestivals_main.festival.sections._tabs.selected) >= 0 ? 'yes' : 'no'; },\n 'tabs':{\n 'sections':{'label':'Sections', 'fn':'M.ciniki_musicfestivals_main.festival.switchRegTab(\"sections\");'},\n 'teachers':{'label':'Teachers', 'fn':'M.ciniki_musicfestivals_main.festival.switchRegTab(\"teachers\");'},\n 'tags':{'label':'Tags', \n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x2000); },\n 'fn':'M.ciniki_musicfestivals_main.festival.switchRegTab(\"tags\");',\n },\n }}, \n 'ipv_tabs':{'label':'', 'aside':'yes', 'type':'paneltabs', 'selected':'all',\n 'visible':function() { return (['registrations','videos'].indexOf(M.ciniki_musicfestivals_main.festival.sections._tabs.selected) >= 0 && (M.ciniki_musicfestivals_main.festival.data.flags&0x02) == 0x02) ? 'yes' : 'no'; },\n 'tabs':{\n 'all':{'label':'All', 'fn':'M.ciniki_musicfestivals_main.festival.switchLVTab(\"all\");'},\n 'inperson':{'label':'Live', 'fn':'M.ciniki_musicfestivals_main.festival.switchLVTab(\"inperson\");'},\n 'virtual':{'label':'Virtual', 'fn':'M.ciniki_musicfestivals_main.festival.switchLVTab(\"virtual\");'},\n }}, \n 'registration_sections':{'label':'', 'aside':'yes', 'type':'simplegrid', 'num_cols':1,\n 'visible':function() { return ['registrations','videos'].indexOf(M.ciniki_musicfestivals_main.festival.sections._tabs.selected) >= 0 && M.ciniki_musicfestivals_main.festival.sections.registration_tabs.selected == 'sections' ? 'yes' : 'no'; },\n 'mailFn':function(s, i, d) {\n if( d != null ) {\n return 'M.ciniki_musicfestivals_main.message.addnew(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id,\\'ciniki.musicfestivals.section\\',\\'' + d.id + '\\');';\n } \n return '';\n },\n },\n 'registration_teachers':{'label':'', 'aside':'yes', 'type':'simplegrid', 'num_cols':1,\n 'visible':function() { return ['registrations','videos'].indexOf(M.ciniki_musicfestivals_main.festival.sections._tabs.selected) >= 0 && M.ciniki_musicfestivals_main.festival.sections.registration_tabs.selected == 'teachers' ? 'yes' : 'no'; },\n 'mailFn':function(s, i, d) {\n if( d != null ) {\n return 'M.ciniki_musicfestivals_main.message.addnew(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id,\\'ciniki.musicfestivals.students\\',\\'' + d.id + '\\');';\n } \n return '';\n },\n },\n 'registration_tags':{'label':'', 'aside':'yes', 'type':'simplegrid', 'num_cols':1,\n 'visible':function() { return ['registrations','videos'].indexOf(M.ciniki_musicfestivals_main.festival.sections._tabs.selected) >= 0 && M.ciniki_musicfestivals_main.festival.sections.registration_tabs.selected == 'tags' ? 'yes' : 'no'; },\n 'mailFn':function(s, i, d) {\n if( d != null ) {\n return 'M.ciniki_musicfestivals_main.message.addnew(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id,\\'ciniki.musicfestivals.registrationtag\\',\\'' + d.name + '\\');';\n } \n return '';\n },\n },\n 'registration_buttons':{'label':'', 'aside':'yes', \n 'visible':function() {return M.ciniki_musicfestivals_main.festival.sections._tabs.selected=='registrations'?'yes':'no';},\n 'buttons':{\n 'excel':{'label':'Export to Excel', \n 'fn':'M.ciniki_musicfestivals_main.festival.downloadExcel(M.ciniki_musicfestivals_main.festival.festival_id);',\n },\n 'pdf':{'label':'Registrations PDF ', \n 'visible':function() {return M.ciniki_musicfestivals_main.festival.sections.registration_tabs.selected=='sections'?'yes':'no';},\n 'fn':'M.ciniki_musicfestivals_main.festival.downloadPDF(M.ciniki_musicfestivals_main.festival.festival_id);',\n },\n }},\n 'registration_search':{'label':'', 'type':'livesearchgrid', 'livesearchcols':5,\n 'visible':function() {return M.ciniki_musicfestivals_main.festival.sections._tabs.selected=='registrations'?'yes':'no';},\n 'hint':'Search',\n 'noData':'No registrations found',\n 'headerValues':['Class', 'Registrant', 'Teacher', 'Fee', 'Status', 'Virtual'],\n 'cellClasses':['', 'multiline', '', '', '', 'alignright'],\n },\n 'registrations':{'label':'Registrations', 'type':'simplegrid', 'num_cols':6,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'registrations' ? 'yes' : 'no'; },\n 'headerValues':['Class', 'Registrant', 'Teacher', 'Fee', 'Status', 'Virtual'],\n 'sortable':'yes',\n 'sortTypes':['text', 'text', 'text', 'altnumber', 'altnumber', 'text'],\n 'cellClasses':['', 'multiline', '', '', '', 'alignright'],\n },\n 'registrations_emailbutton':{'label':'', \n 'visible':function() {return M.ciniki_musicfestivals_main.festival.sections._tabs.selected=='registrations' && M.ciniki_musicfestivals_main.festival.teacher_customer_id > 0 ?'yes':'no';},\n 'buttons':{\n 'email':{'label':'Email List to Teacher', 'fn':'M.ciniki_musicfestivals_main.festival.emailTeacherRegistrations();'},\n 'comments':{'label':'Download Comments PDF', 'fn':'M.ciniki_musicfestivals_main.festival.downloadTeacherComments();'},\n 'registrations':{'label':'Download Registrations PDF', 'fn':'M.ciniki_musicfestivals_main.festival.downloadTeacherRegistrations();'},\n }},\n 'schedule_sections':{'label':'Schedules', 'type':'simplegrid', 'num_cols':2, 'aside':'yes',\n// 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'schedule' ? 'yes' : 'no'; },\n 'visible':function() { return ['schedule', 'comments', 'photos'].indexOf(M.ciniki_musicfestivals_main.festival.sections._tabs.selected) >= 0 ? 'yes' : 'no'; },\n 'cellClasses':['', 'multiline alignright'],\n 'addTxt':'Unscheduled',\n 'addFn':'M.ciniki_musicfestivals_main.festival.openScheduleSection(\\'unscheduled\\',\"Unscheduled\");',\n 'changeTxt':'Add Schedule',\n 'changeFn':'M.ciniki_musicfestivals_main.schedulesection.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n 'mailFn':function(s, i, d) {\n if( M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'comments' ) {\n return null;\n }\n if( M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'photos' ) {\n return null;\n }\n if( d != null ) {\n return 'M.ciniki_musicfestivals_main.message.addnew(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id,\\'ciniki.musicfestivals.schedulesection\\',\\'' + d.id + '\\');';\n } \n return '';\n },\n 'editFn':function(s, i, d) {\n if( M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'comments' ) {\n return '';\n }\n if( M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'photos' ) {\n return '';\n }\n return 'M.ciniki_musicfestivals_main.schedulesection.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.festival_id,null);';\n },\n },\n 'schedule_divisions':{'label':'Divisions', 'type':'simplegrid', 'num_cols':1, 'aside':'yes',\n 'visible':function() { return ['schedule', 'comments', 'photos'].indexOf(M.ciniki_musicfestivals_main.festival.sections._tabs.selected) >= 0 && M.ciniki_musicfestivals_main.festival.schedulesection_id>0? 'yes' : 'no'; },\n 'cellClasses':['multiline', 'multiline alignright'],\n 'addTxt':'Add Division',\n 'addFn':'M.ciniki_musicfestivals_main.scheduledivision.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.schedulesection_id,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n 'mailFn':function(s, i, d) {\n if( M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'comments' ) {\n return null;\n }\n if( M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'photos' ) {\n return null;\n }\n if( d != null ) {\n return 'M.ciniki_musicfestivals_main.message.addnew(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id,\\'ciniki.musicfestivals.scheduledivision\\',\\'' + d.id + '\\');';\n } \n return '';\n },\n 'editFn':function(s, i, d) {\n if( M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'comments' ) {\n return '';\n }\n if( M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'photos' ) {\n return '';\n }\n return 'M.ciniki_musicfestivals_main.scheduledivision.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.schedulesection_id,M.ciniki_musicfestivals_main.festival.festival_id,null);';\n },\n },\n 'program_options':{'label':'Download Program', 'aside':'yes',\n// 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'schedule' ? 'yes' : 'no'; },\n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'schedule' && (M.ciniki_musicfestivals_main.festival.data.flags&0x02) == 0x02) ? 'yes' : 'no'; },\n 'fields':{\n 'ipv':{'label':'Type', 'type':'toggle', 'default':'all', \n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.data.flags&0x02) == 0x02 ? 'yes' : 'no'; },\n 'toggles':{'all':'All', 'inperson':'In Person', 'virtual':'Virtual'},\n },\n }},\n 'program_buttons':{'label':'', 'aside':'yes',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'schedule' ? 'yes' : 'no'; },\n 'buttons':{\n 'pdf':{'label':'Download Program PDF', 'fn':'M.ciniki_musicfestivals_main.festival.downloadProgramPDF();'},\n }},\n 'schedule_download':{'label':'Schedule PDF', 'aside':'yes',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'schedule' && M.ciniki_musicfestivals_main.festival.schedulesection_id>0? 'yes' : 'no'; },\n 'fields':{\n 'names':{'label':'Full Names', 'type':'toggle', 'default':'public', 'toggles':{'public':'No', 'private':'Yes'}},\n 's_titles':{'label':'Titles', 'type':'toggle', 'default':'yes', 'toggles':{'no':'No', 'yes':'Yes'}},\n 's_ipv':{'label':'Type', 'type':'toggle', 'default':'all', \n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.data.flags&0x02) == 0x02 ? 'yes' : 'no'; },\n 'toggles':{'all':'All', 'inperson':'In Person', 'virtual':'Virtual'},\n },\n 'footerdate':{'label':'Footer Date', 'type':'toggle', 'default':'yes', 'toggles':{'no':'No', 'yes':'Yes'}},\n }},\n 'schedule_buttons':{'label':'', 'aside':'yes',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'schedule' && M.ciniki_musicfestivals_main.festival.schedulesection_id>0? 'yes' : 'no'; },\n 'buttons':{\n 'pdf':{'label':'Download Schedule PDF', 'fn':'M.ciniki_musicfestivals_main.festival.downloadSchedulePDF();'},\n 'certs':{'label':'Certificates PDF', 'fn':'M.ciniki_musicfestivals_main.festival.downloadCertificatesPDF();'},\n 'comments':{'label':'Adjudicators Comments PDF', 'fn':'M.ciniki_musicfestivals_main.festival.downloadCommentsPDF();'},\n }},\n 'schedule_timeslots':{'label':'Time Slots', 'type':'simplegrid', 'num_cols':2, \n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'schedule' && M.ciniki_musicfestivals_main.festival.schedulesection_id>0 && M.ciniki_musicfestivals_main.festival.scheduledivision_id>0 ? 'yes' : 'no'; },\n 'cellClasses':['label multiline', 'multiline', 'fabuttons'],\n 'addTxt':'Add Time Slot',\n 'addFn':'M.ciniki_musicfestivals_main.scheduletimeslot.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.scheduledivision_id,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n },\n 'timeslot_photos':{'label':'Time Slots', 'type':'simplegrid', 'num_cols':3,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'photos' && M.ciniki_musicfestivals_main.festival.schedulesection_id>0 && M.ciniki_musicfestivals_main.festival.scheduledivision_id>0 ? 'yes' : 'no'; },\n 'cellClasses':['multiline', 'thumbnails', 'alignright fabuttons'],\n },\n 'timeslot_comments':{'label':'Time Slots', 'type':'simplegrid', 'num_cols':5, \n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'comments' && M.ciniki_musicfestivals_main.festival.schedulesection_id>0 && M.ciniki_musicfestivals_main.festival.scheduledivision_id>0 ? 'yes' : 'no'; },\n 'headerValues':['Time', 'Name', '', '', ''],\n 'headerClasses':['', '', 'aligncenter', 'aligncenter', 'aligncenter'],\n 'cellClasses':['', '', 'aligncenter', 'aligncenter', 'aligncenter'],\n },\n 'unscheduled_registrations':{'label':'Unscheduled', 'type':'simplegrid', 'num_cols':3,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'schedule' && M.ciniki_musicfestivals_main.festival.schedulesection_id == 'unscheduled' ? 'yes' : 'no'; },\n 'headerValues':['Class', 'Registrant', 'Status'],\n 'sortable':'yes',\n 'sortTypes':['text', 'text', 'text'],\n 'cellClasses':['', 'multiline', ''],\n },\n 'video_search':{'label':'', 'type':'livesearchgrid', 'livesearchcols':5,\n 'visible':function() {return M.ciniki_musicfestivals_main.festival.sections._tabs.selected=='videos'?'yes':'no';},\n 'hint':'Search',\n 'noData':'No registrations found',\n 'headerValues':['Class', 'Registrant', 'Video Link', 'PDF', 'Status'],\n 'cellClasses':['', '', '', '', ''],\n },\n 'videos':{'label':'Registrations', 'type':'simplegrid', 'num_cols':5,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'videos' ? 'yes' : 'no'; },\n 'headerValues':['Class', 'Registrant', 'Video Link', 'PDF', 'Status', ''],\n 'sortable':'yes',\n 'sortTypes':['text', 'text', 'text', 'text', 'altnumber', ''],\n 'cellClasses':['', 'multiline', '', '', '', 'alignright'],\n// 'addTxt':'Add Registration',\n// 'addFn':'M.ciniki_musicfestivals_main.registration.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,0,0,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n },\n 'competitor_tabs':{'label':'', 'aside':'yes', 'type':'paneltabs', 'selected':'cities',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'competitors' ? 'yes' : 'no'; },\n 'tabs':{\n 'cities':{'label':'Cities', 'fn':'M.ciniki_musicfestivals_main.festival.switchCompTab(\"cities\");'},\n 'provinces':{'label':'Provinces', 'fn':'M.ciniki_musicfestivals_main.festival.switchCompTab(\"provinces\");'},\n }}, \n 'competitor_cities':{'label':'', 'type':'simplegrid', 'num_cols':1, 'aside':'yes',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'competitors' && M.ciniki_musicfestivals_main.festival.sections.competitor_tabs.selected == 'cities' ? 'yes' : 'no'; },\n 'editFn':function(s, i, d) {\n if( d.city != null && d.province != null ) {\n return 'M.ciniki_musicfestivals_main.editcityprov.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + escape(d.city) + '\\',\\'' + escape(d.province) + '\\');';\n }\n return '';\n },\n },\n 'competitor_provinces':{'label':'', 'type':'simplegrid', 'num_cols':1, 'aside':'yes',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'competitors' && M.ciniki_musicfestivals_main.festival.sections.competitor_tabs.selected == 'provinces' ? 'yes' : 'no'; },\n 'editFn':function(s, i, d) {\n if( d.province != null ) {\n return 'M.ciniki_musicfestivals_main.editcityprov.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',null,\\'' + escape(d.province) + '\\');';\n }\n return '';\n },\n },\n 'competitors':{'label':'', 'type':'simplegrid', 'num_cols':3,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'competitors' ? 'yes' : 'no'; },\n 'headerValues':['Name', 'Classes', 'Waiver'],\n },\n 'lists':{'label':'Lists', 'type':'simplegrid', 'num_cols':1, 'aside':'yes',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'lists'); },\n 'addTxt':'Add List',\n 'addFn':'M.ciniki_musicfestivals_main.list.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n 'editFn':function(s, i, d) {\n return 'M.ciniki_musicfestivals_main.list.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.festival_id,null);';\n },\n },\n 'listsections':{'label':'Sections', 'type':'simplegrid', 'num_cols':1, 'aside':'yes',\n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.isSelected('more', 'lists') == 'yes' && M.ciniki_musicfestivals_main.festival.list_id > 0) ? 'yes' : 'no'; },\n 'addTxt':'Add Section',\n 'addFn':'M.ciniki_musicfestivals_main.listsection.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.list_id,null);',\n 'editFn':function(s, i, d) {\n return 'M.ciniki_musicfestivals_main.listsection.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.list_id,null);';\n },\n },\n 'listentries':{'label':'Sections', 'type':'simplegrid', 'num_cols':4, \n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.isSelected('more', 'lists') == 'yes' && M.ciniki_musicfestivals_main.festival.listsection_id > 0) ? 'yes' : 'no'; },\n 'headerValues':['Award', 'Amount', 'Donor', 'Winner'],\n 'addTxt':'Add Entry',\n 'addFn':'M.ciniki_musicfestivals_main.listentry.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.listsection_id,null);',\n 'seqDrop':function(e,from,to) {\n M.api.getJSONCb('ciniki.musicfestivals.festivalGet', {'tnid':M.curTenantID, \n 'action':'listentrysequenceupdate',\n 'festival_id':M.ciniki_musicfestivals_main.festival.festival_id,\n 'lists':'yes',\n 'list_id':M.ciniki_musicfestivals_main.festival.list_id,\n 'listsection_id':M.ciniki_musicfestivals_main.festival.listsection_id,\n 'entry_id':M.ciniki_musicfestivals_main.festival.data.listentries[from].id, \n 'sequence':M.ciniki_musicfestivals_main.festival.data.listentries[to].sequence, \n }, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.festival;\n p.data.listentries = rsp.festival.listentries;\n p.refreshSection(\"listentries\");\n });\n },\n },\n 'invoice_statuses':{'label':'Status', 'type':'simplegrid', 'num_cols':1, 'aside':'yes',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'invoices'); },\n },\n 'invoices':{'label':'Invoices', 'type':'simplegrid', 'num_cols':6,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'invoices'); },\n 'headerValues':['#', 'Customer', 'Students', 'Total', 'Status'],\n 'noData':'No invoices',\n 'sortable':'yes',\n 'sortTypes':['number', 'text', 'text', 'number', 'text', ''],\n },\n 'adjudicators':{'label':'', 'type':'simplegrid', 'num_cols':1,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'adjudicators'); },\n 'addTxt':'Add Adjudicator',\n 'addFn':'M.ciniki_musicfestivals_main.adjudicator.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,0,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n },\n 'files':{'label':'', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'files'); },\n 'addTxt':'Add File',\n 'addFn':'M.ciniki_musicfestivals_main.addfile.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id);',\n },\n 'certificates':{'label':'', 'type':'simplegrid', 'num_cols':1,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'certificates'); },\n 'headerValues':['Name', 'Section', 'Min Score'],\n 'addTxt':'Add Certificate',\n 'addFn':'M.ciniki_musicfestivals_main.certificate.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.festival_id);',\n },\n 'lists':{'label':'Lists', 'type':'simplegrid', 'num_cols':1, 'aside':'yes',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'lists'); },\n 'addTxt':'Add List',\n 'addFn':'M.ciniki_musicfestivals_main.list.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.festival_id,null);',\n 'editFn':function(s, i, d) {\n return 'M.ciniki_musicfestivals_main.list.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.festival_id,null);';\n },\n },\n 'message_statuses':{'label':'', 'type':'simplegrid', 'aside':'yes', 'num_cols':1,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('messages', ''); },\n },\n 'message_buttons':{'label':'', 'aside':'yes', \n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('messages', ''); },\n 'buttons':{\n 'add':{'label':'Add Message', 'fn':'M.ciniki_musicfestivals_main.message.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.festival_id);'},\n }},\n 'messages':{'label':'', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('messages', ''); },\n 'headerValues':['Subject', 'Date'],\n 'noData':'No Messages',\n },\n 'emails_tabs':{'label':'', 'aside':'yes', 'type':'paneltabs', 'selected':'all',\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'emails'); },\n 'tabs':{\n 'all':{'label':'All', 'fn':'M.ciniki_musicfestivals_main.festival.switchEmailsTab(\"all\");'},\n 'teachers':{'label':'Teachers', 'fn':'M.ciniki_musicfestivals_main.festival.switchEmailsTab(\"teachers\");'},\n 'competitors':{'label':'Competitors', 'fn':'M.ciniki_musicfestivals_main.festival.switchEmailsTab(\"competitors\");'},\n }}, \n 'emails_sections':{'label':'Sections', 'aside':'yes', 'type':'simplegrid', 'num_cols':1,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'emails'); },\n },\n 'emails_html':{'label':'Emails', 'type':'html', \n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'emails'); },\n },\n 'sponsors':{'label':'', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'sponsors'); },\n 'headerValues':['Name', 'Level'],\n 'addTxt':'Add Sponsor',\n 'addFn':'M.ciniki_musicfestivals_main.sponsor.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,M.ciniki_musicfestivals_main.festival.festival_id);',\n },\n 'sponsors-old':{'label':'', 'type':'simplegrid', 'num_cols':1,\n 'visible':function() { return M.ciniki_musicfestivals_main.festival.isSelected('more', 'sponsors-old'); },\n 'addTxt':'Manage Sponsors',\n 'addFn':'M.startApp(\\'ciniki.sponsors.ref\\',null,\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'mc\\',{\\'object\\':\\'ciniki.musicfestivals.festival\\',\\'object_id\\':M.ciniki_musicfestivals_main.festival.festival_id});',\n },\n }\n this.festival.isSelected = function(t, m) {\n if( this.sections._tabs.selected == t ) {\n if( t == 'more' ) {\n return this.sections._moretabs.selected == m ? 'yes' : 'no';\n }\n return 'yes';\n }\n return 'no';\n }\n this.festival.sectionData = function(s) {\n if( s == 'videos' ) {\n return this.data.registrations;\n }\n return M.panel.prototype.sectionData.call(this, s);\n }\n this.festival.downloadProgramPDF = function() {\n var args = {\n 'tnid':M.curTenantID, \n 'festival_id':this.festival_id, \n 'ipv':this.formValue('ipv'),\n };\n M.api.openPDF('ciniki.musicfestivals.programPDF',args);\n }\n this.festival.downloadSchedulePDF = function() {\n var args = {'tnid':M.curTenantID,\n 'festival_id':this.festival_id,\n 'schedulesection_id':this.schedulesection_id,\n 'names':this.formValue('names'),\n 'ipv':this.formValue('s_ipv'),\n 'titles':this.formValue('s_titles'),\n 'footerdate':this.formValue('footerdate'),\n };\n M.api.openPDF('ciniki.musicfestivals.schedulePDF',args);\n }\n this.festival.downloadCertificatesPDF = function() {\n var args = {'tnid':M.curTenantID,\n 'festival_id':this.festival_id,\n 'schedulesection_id':this.schedulesection_id,\n 'ipv':this.formValue('s_ipv'),\n };\n M.api.openFile('ciniki.musicfestivals.certificatesPDF',args);\n }\n this.festival.downloadCommentsPDF = function() {\n var args = {'tnid':M.curTenantID,\n 'festival_id':this.festival_id,\n 'schedulesection_id':this.schedulesection_id,\n 'ipv':this.formValue('s_ipv'),\n };\n M.api.openPDF('ciniki.musicfestivals.commentsPDF',args);\n }\n this.festival.downloadTeacherComments = function() {\n var args = {'tnid':M.curTenantID,\n 'festival_id':this.festival_id,\n 'teacher_customer_id':this.teacher_customer_id,\n };\n M.api.openPDF('ciniki.musicfestivals.commentsPDF',args);\n }\n this.festival.downloadTeacherRegistrations = function() {\n var args = {'tnid':M.curTenantID,\n 'festival_id':this.festival_id,\n 'teacher_customer_id':this.teacher_customer_id,\n };\n M.api.openPDF('ciniki.musicfestivals.teacherRegistrationsPDF',args);\n }\n this.festival.listLabel = function(s, i, d) { \n if( s == 'details' ) {\n return d.label; \n }\n return '';\n }\n this.festival.listValue = function(s, i, d) { \n if( s == 'details' ) {\n return this.data[i]; \n }\n if( s == '_more' ) {\n return d.label;\n }\n }\n this.festival.fieldValue = function(s, i, d) { \n if( this.data[i] == null ) { return ''; }\n return this.data[i]; \n }\n this.festival.liveSearchCb = function(s, i, v) {\n if( s == 'syllabus_search' && v != '' ) {\n M.api.getJSONBgCb('ciniki.musicfestivals.syllabusSearch', {'tnid':M.curTenantID, 'start_needle':v, 'festival_id':this.festival_id, 'limit':'50'}, function(rsp) {\n M.ciniki_musicfestivals_main.festival.liveSearchShow(s,null,M.gE(M.ciniki_musicfestivals_main.festival.panelUID + '_' + s), rsp.classes);\n if( M.ciniki_musicfestivals_main.festival.lastY > 0 ) {\n window.scrollTo(0,M.ciniki_musicfestivals_main.festival.lastY);\n }\n });\n }\n if( (s == 'registration_search' || s == 'video_search') && v != '' ) {\n M.api.getJSONBgCb('ciniki.musicfestivals.registrationSearch', {'tnid':M.curTenantID, 'start_needle':v, 'festival_id':this.festival_id, 'limit':'50'}, function(rsp) {\n M.ciniki_musicfestivals_main.festival.liveSearchShow(s,null,M.gE(M.ciniki_musicfestivals_main.festival.panelUID + '_' + s), rsp.registrations);\n if( M.ciniki_musicfestivals_main.festival.lastY > 0 ) {\n window.scrollTo(0,M.ciniki_musicfestivals_main.festival.lastY);\n }\n });\n }\n }\n this.festival.liveSearchResultValue = function(s, f, i, j, d) {\n if( s == 'syllabus_search' ) { \n return this.cellValue(s, i, j, d);\n }\n if( s == 'registration_search' ) { \n return this.cellValue(s, i, j, d);\n/* switch(j) {\n case 0: return d.class_code;\n case 1: return d.display_name;\n case 2: return d.teacher_name;\n case 3: return '$' + d.fee;\n case 4: return d.status_text;\n } */\n }\n if( s == 'video_search' ) { \n switch(j) {\n case 0: return d.class_code;\n case 1: return d.display_name;\n case 2: return M.hyperlink(d.video_url1);\n case 3: return d.music_orgfilename;\n case 4: return d.status_text;\n }\n }\n }\n this.festival.liveSearchResultRowFn = function(s, f, i, j, d) {\n if( s == 'syllabus_search' ) { \n return 'M.ciniki_musicfestivals_main.festival.savePos();M.ciniki_musicfestivals_main.class.open(\\'M.ciniki_musicfestivals_main.festival.reopen();\\',\\'' + d.id + '\\',0,M.ciniki_musicfestivals_main.festival.festival_id, M.ciniki_musicfestivals_main.festival.nplists.classes);';\n }\n if( s == 'registration_search' || s == 'video_search' ) { \n return 'M.ciniki_musicfestivals_main.festival.savePos();M.ciniki_musicfestivals_main.registration.open(\\'M.ciniki_musicfestivals_main.festival.reopen();\\',\\'' + d.id + '\\',0,0,M.ciniki_musicfestivals_main.festival.festival_id, M.ciniki_musicfestivals_main.festival.nplists.registrations,\\'festival\\');';\n }\n }\n this.festival.cellValue = function(s, i, j, d) {\n if( s == 'sections' ) {\n switch(j) {\n case 0: return d.name;\n case 1: return (d.num_registrations!=0 ? d.num_registrations : '');\n }\n }\n if( s == 'categories' ) {\n switch(j) {\n case 0: return d.section_name;\n case 1: return d.name;\n case 2: return (d.num_registrations!=0 ? d.num_registrations : '');\n }\n }\n if( s == 'classes' || s == 'syllabus_search' ) {\n switch(j) {\n case 0: return d.section_name;\n case 1: return d.category_name;\n case 2: return d.code + ' - ' + d.name;\n case 3: return d.earlybird_fee + '/' + d.fee;\n case 4: return (d.num_registrations!=0 ? d.num_registrations : '');\n }\n }\n if( s == 'unscheduled_registrations' ) {\n switch (j) {\n case 0: return d.class_code;\n case 1: return '<span class=\"maintext\">' + d.display_name + '</span><span class=\"subtext\">' + d.title1 + '</span>';\n case 2: return d.status_text;\n }\n }\n if( s == 'registrations' || s == 'registration_search' ) {\n switch (j) {\n case 0: return d.class_code;\n case 1: return '<span class=\"maintext\">' + d.display_name + '</span><span class=\"subtext\">' + d.title1 + '</span>';\n case 2: return d.teacher_name;\n case 3: return '$' + d.fee;\n case 4: return d.status_text;\n }\n if( j == 5 && (this.data.flags&0x10) == 0x10 ) {\n return (d.participation == 2 ? 'Plus' : '');\n } else if( j == 5 && (this.data.flags&0x02) == 0x02 ) {\n return (d.participation == 2 ? 'Virtual' : 'In Person');\n }\n }\n if( s == 'registration_sections' || s == 'emails_sections' ) {\n return M.textCount(d.name, d.num_registrations);\n }\n if( s == 'registration_teachers' ) {\n return M.textCount(d.display_name, d.num_registrations);\n }\n if( s == 'registration_tags' ) {\n return M.textCount(d.name, d.num_registrations);\n }\n if( s == 'schedule_sections' ) {\n switch(j) {\n case 0: return d.name;\n// case 1: return '<button onclick=\"event.stopPropagation();M.ciniki_musicfestivals_main.schedulesection.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.festival_id,null);\">Edit</span>';\n }\n }\n if( s == 'schedule_divisions' && M.ciniki_musicfestivals_main.festival.sections._tabs.selected == 'comments' ) {\n return '<span class=\"maintext\">' + d.name + ' <span class=\"subtext\">' + d.division_date_text + '</span>';\n }\n if( s == 'schedule_divisions' ) {\n return '<span class=\"maintext\">' + d.name + ' <span class=\"subdue\">' + d.division_date_text + '</span><span class=\"subtext\">' + d.address + '</span>';\n }\n if( s == 'schedule_timeslots' ) {\n switch(j) {\n case 0: return M.multiline(d.slot_time_text, d.perf_time_text);\n case 1: return '<span class=\"maintext\">' + d.name + '</span><span class=\"subtext\">' + d.description.replace(/\\n/g, '<br/>') + '</span>';\n }\n }\n if( s == 'timeslot_photos' ) {\n if( j == 1 && d.images != null && d.images.length > 0 ) {\n var thumbs = '';\n for(var k in d.images) {\n thumbs += '<img class=\"clickable\" onclick=\"M.ciniki_musicfestivals_main.timeslotimage.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.images[k].timeslot_image_id + '\\');\" width=\"50px\" height=\"50px\" src=\\'' + d.images[k].image + '\\' />';\n }\n return thumbs;\n }\n switch(j) {\n case 0: return M.multiline(d.slot_time_text, d.name);\n case 1: return '';\n case 2: return M.faBtn('&#xf030;', 'Photos', 'M.ciniki_musicfestivals_main.festival.timeslotImageAdd(' + d.id + ',' + i + ');');\n }\n }\n if( s == 'timeslot_comments' ) {\n switch(j) {\n case 0: return d.time;\n case 1: return '<span class=\"maintext\">' + d.name + '</span><span class=\"subtext\">' + d.description.replace(/\\n/g, '<br/>') + '</span>';\n case 2: return d.status1;\n case 3: return d.status2;\n case 4: return d.status3;\n }\n }\n if( s == 'videos' ) {\n switch (j) {\n case 0: return d.class_code;\n case 1: return '<span class=\"maintext\">' + d.display_name + '</span><span class=\"subtext\">' + d.title + '</span>';\n case 2: return M.hyperlink(d.video_url1);\n case 3: return d.music_orgfilename;\n case 4: return d.status_text;\n }\n }\n if( s == 'competitor_cities' ) {\n return M.textCount(d.name, d.num_competitors);\n }\n if( s == 'competitor_provinces' ) {\n return M.textCount(d.name, d.num_competitors);\n }\n if( s == 'competitors' ) {\n switch(j) {\n case 0: return d.name + M.subdue(' (',d.pronoun,')');\n case 1: return d.classcodes;\n case 2: return d.waiver_signed;\n }\n }\n if( s == 'invoice_statuses' ) {\n return M.textCount(d.status_text, d.num_invoices);\n }\n if( s == 'invoices' ) {\n switch(j) { \n case 0: return d.invoice_number;\n case 1: return d.customer_name;\n case 2: return d.competitor_names;\n case 3: return M.formatDollar(d.total_amount);\n case 4: return d.status_text;\n }\n if( j == 5 && d.status < 50 ) {\n return '<button onclick=\"event.stopPropagation();M.ciniki_musicfestivals_main.festival.invoiceTransaction(\\'' + d.id + '\\',\\'' + M.formatDollar(d.balance_amount) + '\\');\">Paid</button>';\n }\n }\n if( s == 'adjudicators' ) {\n return d.name;\n }\n if( s == 'certificates' ) {\n switch(j) {\n case 0: return d.name;\n case 1: return d.section_name;\n case 2: return d.min_score;\n }\n }\n if( s == 'files' ) {\n switch(j) {\n case 0: return d.name;\n case 1: return (d.webflags&0x01) == 0x01 ? 'Visible' : 'Hidden';\n }\n }\n if( s == 'message_statuses' ) {\n return M.textCount(d.label, d.num_messages);\n }\n if( s == 'messages' ) {\n switch(j) {\n case 0: return d.subject;\n case 1: return d.date_text;\n }\n }\n if( s == 'lists' ) {\n switch(j) { \n case 0: return d.name;\n }\n }\n if( s == 'listsections' ) {\n switch(j) { \n case 0: return d.name;\n }\n }\n if( s == 'listentries' ) {\n switch(j) { \n case 0: return d.award;\n case 1: return d.amount;\n case 2: return d.donor;\n case 3: return d.winner;\n }\n }\n if( s == 'sponsors' ) {\n switch(j) { \n case 0: return d.name;\n case 1: return d.level;\n }\n }\n if( s == 'sponsors-old' && j == 0 ) {\n return '<span class=\"maintext\">' + d.sponsor.title + '</span>';\n }\n }\n this.festival.cellSortValue = function(s, i , j, d) {\n if( s == 'registrations' ) {\n switch(j) {\n case 3: return d.fee;\n case 4: return d.status;\n }\n }\n if( s == 'videos' ) {\n switch(j) {\n case 4: return d.status;\n }\n }\n return '';\n }\n this.festival.rowFn = function(s, i, d) {\n switch(s) {\n// case 'sections': return 'M.ciniki_musicfestivals_main.section.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.festival_id, M.ciniki_musicfestivals_main.festival.nplists.sections);';\n case 'sections': return 'M.ciniki_musicfestivals_main.classes.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.festival_id, M.ciniki_musicfestivals_main.festival.nplists.sections);';\n case 'categories': return 'M.ciniki_musicfestivals_main.category.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',\\'' + d.section_id + '\\',M.ciniki_musicfestivals_main.festival.festival_id, M.ciniki_musicfestivals_main.festival.nplists.categories);';\n case 'classes': return 'M.ciniki_musicfestivals_main.class.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',0,M.ciniki_musicfestivals_main.festival.festival_id, M.ciniki_musicfestivals_main.festival.nplists.classes);';\n case 'unscheduled_registrations': \n case 'registrations': \n case 'videos':\n return 'M.ciniki_musicfestivals_main.registration.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',0,0,M.ciniki_musicfestivals_main.festival.festival_id, M.ciniki_musicfestivals_main.festival.nplists.registrations,\\'festival\\');';\n case 'registration_sections': return 'M.ciniki_musicfestivals_main.festival.openSection(\\'' + d.id + '\\',\"' + M.eU(d.name) + '\");';\n case 'emails_sections': return 'M.ciniki_musicfestivals_main.festival.openSection(\\'' + d.id + '\\',\"' + M.eU(d.name) + '\");';\n case 'registration_teachers': return 'M.ciniki_musicfestivals_main.festival.openTeacher(\\'' + d.id + '\\',\"' + M.eU(d.display_name) + '\");';\n case 'registration_tags': return 'M.ciniki_musicfestivals_main.festival.openTag(\\'' + M.eU(d.name) + '\\',\"' + M.eU(d.display_name) + '\");';\n case 'schedule_sections': return 'M.ciniki_musicfestivals_main.festival.openScheduleSection(\\'' + d.id + '\\',\"' + M.eU(d.name) + '\");';\n case 'schedule_divisions': return 'M.ciniki_musicfestivals_main.festival.openScheduleDivision(\\'' + d.id + '\\',\"' + M.eU(d.name) + '\");';\n// case 'schedule_sections': return 'M.ciniki_musicfestivals_main.schedulesection.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.festival_id,null);';\n// case 'schedule_divisions': return 'M.ciniki_musicfestivals_main.scheduledivision.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.schedulesection_id,M.ciniki_musicfestivals_main.festival.festival_id,null);';\n case 'schedule_timeslots': return 'M.ciniki_musicfestivals_main.scheduletimeslot.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.scheduledivision_id,M.ciniki_musicfestivals_main.festival.festival_id,null);';\n case 'timeslot_comments': return 'M.ciniki_musicfestivals_main.timeslotcomments.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.scheduledivision_id,M.ciniki_musicfestivals_main.festival.festival_id,null);';\n case 'timeslot_photos': return null;\n case 'competitor_cities': return 'M.ciniki_musicfestivals_main.festival.openCompetitorCity(\\'' + escape(d.name) + '\\');';\n case 'competitor_provinces': return 'M.ciniki_musicfestivals_main.festival.openCompetitorProv(\\'' + escape(d.name) + '\\');';\n case 'competitors': return 'M.ciniki_musicfestivals_main.competitor.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',M.ciniki_musicfestivals_main.festival.festival_id);';\n case 'invoice_statuses': return 'M.ciniki_musicfestivals_main.festival.openInvoiceStatus(\\'' + d.typestatus + '\\');';\n case 'invoices': return 'M.startApp(\\'ciniki.sapos.invoice\\',null,\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'mc\\',{\\'invoice_id\\':\\'' + d.id + '\\'});';\n case 'adjudicators': return 'M.ciniki_musicfestivals_main.adjudicator.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\',0,M.ciniki_musicfestivals_main.festival.festival_id, M.ciniki_musicfestivals_main.festival.nplists.adjudicators);';\n case 'certificates': return 'M.ciniki_musicfestivals_main.certificate.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\');';\n case 'files': return 'M.ciniki_musicfestivals_main.editfile.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\');';\n case 'message_statuses': return 'M.ciniki_musicfestivals_main.festival.openMessageStatus(' + d.status + ');';\n case 'messages': return 'M.ciniki_musicfestivals_main.message.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\');';\n case 'lists': return 'M.ciniki_musicfestivals_main.festival.openList(\\'' + d.id + '\\',\"' + M.eU(d.name) + '\");';\n case 'listsections': return 'M.ciniki_musicfestivals_main.festival.openListSection(\\'' + d.id + '\\',\"' + M.eU(d.name) + '\");';\n case 'listentries': return 'M.ciniki_musicfestivals_main.listentry.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\');';\n case 'sponsors': return 'M.ciniki_musicfestivals_main.sponsor.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + d.id + '\\');';\n case 'sponsors-old': return 'M.startApp(\\'ciniki.sponsors.ref\\',null,\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'mc\\',{\\'ref_id\\':\\'' + d.sponsor.ref_id + '\\'});';\n }\n return '';\n }\n this.festival.rowClass = function(s, i, d) {\n if( s == 'competitor_cities' && this.city_prov == d.name ) {\n return 'highlight';\n }\n if( s == 'competitor_provinces' && this.province == d.name ) {\n return 'highlight';\n }\n if( s == 'schedule_sections' && this.schedulesection_id == d.id ) {\n return 'highlight';\n }\n if( s == 'schedule_divisions' && this.scheduledivision_id == d.id ) {\n return 'highlight';\n }\n if( (s == 'registration_sections' || s == 'emails_sections') && this.section_id == d.id ) {\n return 'highlight';\n }\n if( s == 'registration_teachers' && this.teacher_customer_id == d.id ) {\n return 'highlight';\n }\n if( s == 'registration_tags' && this.registration_tag == d.name ) {\n return 'highlight';\n }\n if( s == 'lists' && this.list_id == d.id ) {\n return 'highlight';\n }\n if( s == 'listsections' && this.listsection_id == d.id ) {\n return 'highlight';\n }\n if( s == 'message_statuses' && this.messages_status == d.status ) {\n return 'highlight';\n }\n if( s == 'invoice_statuses' && this.invoice_typestatus == d.typestatus ) {\n return 'highlight';\n }\n if( s == 'invoices' && this.invoice_typestatus == '' && s == 'invoices' ) {\n switch(d.status) { \n case '10': return 'statusorange';\n case '15': return 'statusorange';\n case '40': return 'statusorange';\n case '42': return 'statusred';\n case '50': return 'statusgreen';\n case '55': return 'statusorange';\n case '60': return 'statusgrey';\n case '65': return 'statusgrey';\n }\n }\n }\n this.festival.switchTab = function(tab, stab) {\n if( tab != null ) { this.sections._tabs.selected = tab; }\n if( stab != null ) { this.sections._stabs.selected = stab; }\n this.open();\n }\n this.festival.switchMTab = function(t) {\n this.sections._moretabs.selected = t;\n this.open();\n }\n this.festival.switchRegTab = function(t) {\n this.sections.registration_tabs.selected = t;\n this.open();\n }\n this.festival.switchCompTab = function(t) {\n this.sections.competitor_tabs.selected = t;\n this.open();\n }\n this.festival.switchLVTab = function(t) {\n this.sections.ipv_tabs.selected = t;\n this.open();\n }\n this.festival.switchEmailsTab = function(t) {\n this.sections.emails_tabs.selected = t;\n this.open();\n }\n this.festival.emailTeacherRegistrations = function() {\n M.ciniki_musicfestivals_main.emailregistrations.open('M.ciniki_musicfestivals_main.festival.show();');\n }\n this.festival.openSection = function(id,n) {\n this.lastY = 0;\n this.section_id = id;\n this.teacher_customer_id = 0;\n this.registration_tag = '';\n if( id > 0 ) {\n this.sections.registrations.label = 'Registrations - ' + M.dU(n);\n// this.sections.emails_list.label = 'Emails - ' + M.dU(n);\n this.sections.emails_html.label = 'Emails - ' + M.dU(n);\n this.sections.videos.label = 'Registrations - ' + M.dU(n);\n } else {\n this.sections.registrations.label = 'Registrations';\n// this.sections.emails_list.label = 'Emails';\n this.sections.emails_html.label = 'Emails';\n this.sections.videos.label = 'Registrations';\n }\n this.open();\n }\n this.festival.openTeacher = function(id,n) {\n this.lastY = 0;\n this.teacher_customer_id = id;\n this.section_id = 0;\n this.registration_tag = '';\n if( id > 0 ) {\n this.sections.registrations.label = 'Registrations - ' + M.dU(n);\n this.sections.videos.label = 'Registrations - ' + M.dU(n);\n } else {\n this.sections.registrations.label = 'Registrations';\n this.sections.videos.label = 'Registrations';\n }\n this.open();\n }\n this.festival.openTag = function(name, n) {\n this.lastY = 0;\n this.section_id = 0;\n this.teacher_customer_id = 0;\n this.registration_tag = unescape(name);\n if( name != '' ) {\n this.sections.registrations.label = 'Registrations - ' + M.dU(n);\n this.sections.videos.label = 'Registrations - ' + M.dU(n);\n } else {\n this.sections.registrations.label = 'Registrations';\n this.sections.videos.label = 'Registrations';\n }\n this.open();\n \n }\n this.festival.openScheduleSection = function(i, n) {\n this.schedulesection_id = i;\n this.sections.schedule_divisions.label = M.dU(n);\n this.scheduledivision_id = 0;\n this.open();\n }\n this.festival.openScheduleDivision = function(i, n) {\n this.lastY = 0;\n this.scheduledivision_id = i;\n this.sections.schedule_timeslots.label = M.dU(n);\n this.open();\n }\n this.festival.openList = function(i, n) {\n this.list_id = i;\n this.sections.listsections.label = M.dU(n);\n this.scheduledivision_id = 0;\n this.open();\n }\n this.festival.openListSection = function(i, n) {\n this.lastY = 0;\n this.listsection_id = i;\n this.sections.listentries.label = M.dU(n);\n this.open();\n }\n this.festival.downloadExcel = function(fid) {\n if( this.sections.registration_tabs.selected == 'sections' && this.section_id > 0 ) {\n M.api.openFile('ciniki.musicfestivals.registrationsExcel', {'tnid':M.curTenantID, 'festival_id':fid, 'section_id':this.section_id});\n } else if( this.sections.registration_tabs.selected == 'teachers' && this.teacher_customer_id > 0 ) {\n M.api.openFile('ciniki.musicfestivals.registrationsExcel', {'tnid':M.curTenantID, 'festival_id':fid, 'teacher_customer_id':this.teacher_customer_id});\n } else if( this.sections.registration_tabs.selected == 'tags' && this.registration_tag != '' ) {\n M.api.openFile('ciniki.musicfestivals.registrationsExcel', {'tnid':M.curTenantID, 'festival_id':fid, 'registration_tag':this.registration_tag});\n } else {\n M.api.openFile('ciniki.musicfestivals.registrationsExcel', {'tnid':M.curTenantID, 'festival_id':fid});\n }\n }\n this.festival.downloadPDF = function(fid) {\n if( this.sections.registration_tabs.selected == 'sections' && this.section_id > 0 ) {\n M.api.openFile('ciniki.musicfestivals.registrationsPDF', {'tnid':M.curTenantID, 'festival_id':fid, 'section_id':this.section_id});\n } else {\n M.api.openFile('ciniki.musicfestivals.registrationsPDF', {'tnid':M.curTenantID, 'festival_id':fid});\n }\n }\n this.festival.openInvoiceStatus = function(s) {\n this.lastY = 0;\n this.invoice_typestatus = s;\n this.open();\n }\n this.festival.invoiceTransaction = function(i, t) {\n M.startApp('ciniki.sapos.invoice', null, 'M.ciniki_musicfestivals_main.festival.open();', 'mc', {'invoice_id':i, 'transaction_amount':t});\n }\n this.festival.openCompetitorCity = function(c) {\n this.lastY = 0;\n this.city_prov = unescape(c);\n this.open();\n }\n this.festival.openCompetitorProv = function(c) {\n this.lastY = 0;\n this.province = unescape(c);\n this.open();\n }\n this.festival.openMessageStatus = function(s) {\n this.messages_status = s;\n this.open();\n }\n this.festival.reopen = function(cb,fid,list) {\n if( this.sections._tabs.selected == 'sections' ) {\n if( M.gE(this.panelUID + '_syllabus_search').value != '' ) {\n this.sections.syllabus_search.lastsearch = M.gE(this.panelUID + '_syllabus_search').value;\n }\n }\n if( this.sections._tabs.selected == 'registrations' ) {\n if( M.gE(this.panelUID + '_registration_search').value != '' ) {\n this.sections.registration_search.lastsearch = M.gE(this.panelUID + '_registration_search').value;\n }\n }\n this.open(cb,fid,list);\n }\n this.festival.open = function(cb, fid, list) {\n if( fid != null ) { this.festival_id = fid; }\n var args = {'tnid':M.curTenantID, 'festival_id':this.festival_id};\n this.size = 'xlarge narrowaside';\n if( this.sections._tabs.selected == 'sections' ) {\n if( this.sections._stabs.selected == 'sections' ) {\n args['sections'] = 'yes';\n } else if( this.sections._stabs.selected == 'categories' ) {\n args['categories'] = 'yes';\n } else if( this.sections._stabs.selected == 'classes' ) {\n args['classes'] = 'yes';\n }\n } else if( this.sections._tabs.selected == 'registrations' || this.sections._tabs.selected == 'videos' ) {\n this.size = 'xlarge narrowaside';\n args['sections'] = 'yes';\n args['registrations'] = 'yes';\n args['ipv'] = this.sections.ipv_tabs.selected;\n\n } else if( this.sections._tabs.selected == 'schedule' ) {\n this.size = 'medium mediumaside';\n args['schedule'] = 'yes';\n args['ssection_id'] = this.schedulesection_id;\n args['sdivision_id'] = this.scheduledivision_id;\n this.sections.schedule_sections.changeTxt = 'Add Schedule';\n this.sections.schedule_sections.addTxt = 'Unscheduled';\n this.sections.schedule_divisions.addTxt = 'Add Division';\n } else if( this.sections._tabs.selected == 'comments' ) {\n this.size = 'xlarge narrowaside';\n args['schedule'] = 'yes';\n args['comments'] = 'yes';\n args['ssection_id'] = this.schedulesection_id;\n args['sdivision_id'] = this.scheduledivision_id;\n args['adjudicators'] = 'yes';\n this.sections.schedule_sections.addTxt = '';\n this.sections.schedule_sections.changeTxt = '';\n this.sections.schedule_divisions.addTxt = '';\n } else if( this.sections._tabs.selected == 'competitors' ) {\n this.size = 'xlarge narrowaside';\n args['competitors'] = 'yes';\n if( this.sections.competitor_tabs.selected == 'cities' ) {\n args['city_prov'] = M.eU(this.city_prov);\n } else if( this.sections.competitor_tabs.selected == 'provinces' ) {\n args['province'] = M.eU(this.province);\n } \n } else if( this.sections._tabs.selected == 'photos' ) {\n this.size = 'xlarge narrowaside';\n args['schedule'] = 'yes';\n args['photos'] = 'yes';\n args['ssection_id'] = this.schedulesection_id;\n args['sdivision_id'] = this.scheduledivision_id;\n args['adjudicators'] = 'no';\n this.sections.schedule_sections.addTxt = '';\n this.sections.schedule_sections.changeTxt = '';\n this.sections.schedule_divisions.addTxt = '';\n this.sections.schedule_divisions.changeTxt = '';\n } else if( this.isSelected('more', 'lists') == 'yes' ) {\n args['lists'] = 'yes';\n args['list_id'] = this.list_id;\n args['listsection_id'] = this.listsection_id;\n } else if( this.isSelected('more', 'invoices') == 'yes' ) {\n this.size = 'xlarge narrowaside';\n args['invoices'] = 'yes';\n if( this.invoice_typestatus > 0 ) {\n args['invoice_typestatus'] = this.invoice_typestatus;\n }\n } else if( this.isSelected('more', 'adjudicators') == 'yes' ) {\n this.size = 'xlarge';\n args['adjudicators'] = 'yes';\n } else if( this.isSelected('more', 'files') == 'yes' ) {\n this.size = 'xlarge';\n args['files'] = 'yes';\n } else if( this.isSelected('more', 'certificates') == 'yes' ) {\n this.size = 'xlarge';\n args['certificates'] = 'yes';\n } else if( this.sections._tabs.selected == 'messages' ) {\n args['messages'] = 'yes';\n // Which emails to get\n args['messages_status'] = this.messages_status;\n this.sections.messages.headerValues[1] = 'Date';\n if( this.messages_status == 30 ) {\n this.sections.messages.headerValues[1] = 'Scheduled';\n } else if( this.messages_status == 50 ) {\n this.sections.messages.headerValues[1] = 'Sent';\n }\n } else if( this.isSelected('more', 'emails') == 'yes' ) {\n args['sections'] = 'yes';\n // Which emails to get\n args['emails_list'] = this.sections.emails_tabs.selected;\n } else if( this.isSelected('more', 'sponsors') == 'yes' ) {\n //} else if( this.sections._tabs.selected == 'sponsors' ) {\n this.size = 'xlarge';\n args['sponsors'] = 'yes';\n } else if( this.isSelected('more', 'sponsors-old') == 'yes' ) {\n args['sponsors'] = 'yes';\n }\n if( this.section_id > 0 ) {\n args['section_id'] = this.section_id;\n }\n if( this.teacher_customer_id > 0 ) {\n args['teacher_customer_id'] = this.teacher_customer_id;\n }\n if( this.registration_tag != '' ) {\n args['registration_tag'] = this.registration_tag;\n }\n M.api.getJSONCb('ciniki.musicfestivals.festivalGet', args, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.festival;\n p.data = rsp.festival;\n p.label = rsp.festival.name;\n p.sections.registration_search.livesearchcols = 5;\n p.sections.registrations.num_cols = 5;\n p.sections.registration_search.headerValues = ['Class', 'Registrant', 'Teacher', 'Fee', 'Status'];\n if( (rsp.festival.flags&0x10) == 0x10 ) {\n p.sections.registration_search.livesearchcols = 6;\n p.sections.registrations.num_cols = 6;\n p.sections.registration_search.headerValues = ['Class', 'Registrant', 'Teacher', 'Fee', 'Status', 'Plus'];\n } else if( (rsp.festival.flags&0x02) == 0x02 ) {\n p.sections.registration_search.livesearchcols = 6;\n p.sections.registrations.num_cols = 6;\n p.sections.registration_search.headerValues = ['Class', 'Registrant', 'Teacher', 'Fee', 'Status', 'Virtual'];\n }\n p.sections.timeslot_comments.headerValues[2] = '';\n p.sections.timeslot_comments.headerValues[3] = '';\n p.sections.timeslot_comments.headerValues[4] = '';\n if( rsp.festival.sections != null ) {\n p.data.registration_sections = [];\n p.data.emails_sections = [];\n p.data.registration_sections.push({'id':0, 'name':'All'});\n p.data.emails_sections.push({'id':0, 'name':'All'});\n for(var i in rsp.festival.sections) {\n// p.data.registration_sections.push({'id':rsp.festival.sections[i].id, 'name':rsp.festival.sections[i].name});\n p.data.registration_sections.push(rsp.festival.sections[i]);\n p.data.emails_sections.push({'id':rsp.festival.sections[i].id, 'name':rsp.festival.sections[i].name});\n }\n// p.data.registration_sections = rsp.festival.sections;\n }\n if( rsp.festival.schedule_sections != null ) {\n for(var i in rsp.festival.schedule_sections) {\n if( p.schedulesection_id > 0 && rsp.festival.schedule_sections[i].id == p.schedulesection_id ) {\n if( rsp.festival.schedule_sections[i].adjudicator1_id > 0 && rsp.festival.adjudicators != null && rsp.festival.adjudicators[rsp.festival.schedule_sections[i].adjudicator1_id] != null ) {\n p.sections.timeslot_comments.headerValues[2] = rsp.festival.adjudicators[rsp.festival.schedule_sections[i].adjudicator1_id].name;\n }\n if( rsp.festival.schedule_sections[i].adjudicator2_id > 0 && rsp.festival.adjudicators != null && rsp.festival.adjudicators[rsp.festival.schedule_sections[i].adjudicator2_id] != null ) {\n p.sections.timeslot_comments.headerValues[2] = rsp.festival.adjudicators[rsp.festival.schedule_sections[i].adjudicator2_id].name;\n }\n if( rsp.festival.schedule_sections[i].adjudicator3_id > 0 && rsp.festival.adjudicators != null && rsp.festival.adjudicators[rsp.festival.schedule_sections[i].adjudicator3_id] != null ) {\n p.sections.timeslot_comments.headerValues[2] = rsp.festival.adjudicators[rsp.festival.schedule_sections[i].adjudicator3_id].name;\n }\n }\n }\n }\n p.nplists = {};\n if( rsp.nplists != null ) {\n p.nplists = rsp.nplists;\n }\n p.refresh();\n p.show(cb);\n // \n // Auto remember last search\n //\n if( p.sections['syllabus_search'].lastsearch != null \n && p.sections['syllabus_search'].lastsearch != '' \n ) {\n M.gE(p.panelUID + '_syllabus_search').value = p.sections['syllabus_search'].lastsearch;\n var t = M.gE(p.panelUID + '_syllabus_search_livesearch_grid');\n t.style.display = 'table';\n p.liveSearchCb('syllabus_search', null, p.sections['syllabus_search'].lastsearch);\n delete p.sections['syllabus_search'].lastsearch;\n }\n else if( p.sections['registration_search'].lastsearch != null \n && p.sections['registration_search'].lastsearch != '' \n ) {\n M.gE(p.panelUID + '_registration_search').value = p.sections['registration_search'].lastsearch;\n var t = M.gE(p.panelUID + '_registration_search_livesearch_grid');\n t.style.display = 'table';\n p.liveSearchCb('registration_search', null, p.sections['registration_search'].lastsearch);\n delete p.sections['registration_search'].lastsearch;\n }\n });\n }\n this.festival.timeslotImageAdd = function(tid, row) {\n this.timeslot_image_uploader_tid = tid;\n this.timeslot_image_uploader_row = row;\n this.image_uploader = M.aE('input', this.panelUID + '_' + tid + '_upload', 'file_uploader');\n this.image_uploader.setAttribute('name', tid);\n this.image_uploader.setAttribute('type', 'file');\n this.image_uploader.setAttribute('onchange', 'M.ciniki_musicfestivals_main.festival.timeslotImageUpload();');\n this.image_uploader.click();\n }\n this.festival.timeslotImageUpload = function() {\n var files = this.image_uploader.files;\n M.startLoad();\n M.api.postJSONFile('ciniki.musicfestivals.timeslotImageDrop', {'tnid':M.curTenantID, 'festival_id':this.festival_id, \n 'timeslot_id':this.timeslot_image_uploader_tid},\n files[0],\n function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.stopLoad();\n M.api.err(rsp);\n return false;\n }\n M.stopLoad();\n var p = M.ciniki_musicfestivals_main.festival;\n var t = M.gE(p.panelUID + '_timeslot_photos_grid');\n var cell = t.children[0].children[p.timeslot_image_uploader_row].children[1];\n cell.innerHTML += '<img class=\"clickable\" onclick=\"M.ciniki_musicfestivals_main.timeslotimage.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',\\'' + rsp.id + '\\');\" width=\"50px\" height=\"50px\" src=\\'' + rsp.image + '\\' />';\n });\n }\n this.festival.festivalCopy = function(old_fid) {\n M.api.getJSONCb('ciniki.musicfestivals.festivalCopy', {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'old_festival_id':old_fid}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.festival.open();\n });\n }\n this.festival.syllabusDownload = function() {\n M.api.openPDF('ciniki.musicfestivals.festivalSyllabusPDF', {'tnid':M.curTenantID, 'festival_id':this.festival_id});\n }\n this.festival.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.festival_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.festival.open(null,' + this.nplist[this.nplist.indexOf('' + this.festival_id) + 1] + ');';\n }\n return null;\n }\n this.festival.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.festival_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.festival_id.open(null,' + this.nplist[this.nplist.indexOf('' + this.festival_id) - 1] + ');';\n }\n return null;\n }\n this.festival.addButton('edit', 'Edit', 'M.ciniki_musicfestivals_main.edit.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',M.ciniki_musicfestivals_main.festival.festival_id);');\n this.festival.addClose('Back');\n this.festival.addButton('next', 'Next');\n this.festival.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Festival\n //\n this.edit = new M.panel('Festival', 'ciniki_musicfestivals_main', 'edit', 'mc', 'large mediumaside', 'sectioned', 'ciniki.musicfestivals.main.edit');\n this.edit.data = null;\n this.edit.festival_id = 0;\n this.edit.nplist = [];\n this.edit.sections = {\n/* '_document_logo_id':{'label':'Document Header Logo', 'type':'imageform', 'aside':'yes', 'fields':{\n 'header_logo_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.edit.setFieldValue('header_logo_id', iid);\n return true;\n },\n 'addDropImageRefresh':'',\n 'deleteImage':function(fid) {\n M.ciniki_musicfestivals_main.edit.setFieldValue(fid,0);\n return true;\n },\n },\n }}, */\n 'general':{'label':'', 'aside':'yes', 'fields':{\n 'name':{'label':'Name', 'type':'text'},\n 'start_date':{'label':'Start', 'type':'date'},\n 'end_date':{'label':'End', 'type':'date'},\n 'status':{'label':'Status', 'type':'toggle', 'toggles':{'10':'Active', '30':'Current', '60':'Archived'}},\n 'flags1':{'label':'Registrations Open', 'type':'flagtoggle', 'default':'off', 'bit':0x01, 'field':'flags'},\n 'flags2':{'label':'Virtual Option', 'type':'flagtoggle', 'default':'off', 'bit':0x02, 'field':'flags',\n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x4000); },\n 'on_fields':['flags3','virtual_date', 'upload_end_dt'],\n },\n 'flags3':{'label':'Virtual Pricing', 'type':'flagtoggle', 'default':'off', 'bit':0x04, 'field':'flags', 'visible':'no'},\n 'flags4':{'label':'Section End Dates', 'type':'flagtoggle', 'default':'off', 'bit':0x08, 'field':'flags'},\n 'flags5':{'label':'Adjudication Plus', 'type':'flagtoggle', 'default':'off', 'bit':0x10, 'field':'flags',\n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x0800); },\n },\n 'earlybird_date':{'label':'Earlybird Deadline', 'type':'datetime'},\n 'live_date':{'label':'Live Deadline', 'type':'datetime'},\n 'virtual_date':{'label':'Virtual Deadline', 'type':'datetime', 'visible':'no'},\n 'edit_end_dt':{'label':'Edit Titles Deadline', 'type':'datetime'},\n 'upload_end_dt':{'label':'Upload Deadline', 'type':'datetime', 'visible':'no'},\n }},\n '_settings':{'label':'', 'aside':'yes', 'fields':{\n 'age-restriction-msg':{'label':'Age Restriction Message', 'type':'text'},\n 'president-name':{'label':'President Name', 'type':'text'},\n }},\n// Remove 2022, could be readded in future\n// '_hybrid':{'label':'In Person/Virtual Choices', 'aside':'yes', 'fields':{\n// 'inperson-choice-msg':{'label':'In Person Choice', 'type':'text', 'hint':'in person on a scheduled date'},\n// 'virtual-choice-msg':{'label':'Virtual Choice', 'type':'text', 'hint':'virtually and submit a video'},\n// }},\n '_tabs':{'label':'', 'type':'paneltabs', 'selected':'documents', 'tabs':{\n// 'website':{'label':'Website', 'fn':'M.ciniki_musicfestivals_main.edit.switchTab(\\'website\\');'},\n 'documents':{'label':'Documents', 'fn':'M.ciniki_musicfestivals_main.edit.switchTab(\\'documents\\');'},\n 'registrations':{'label':'Registrations', 'fn':'M.ciniki_musicfestivals_main.edit.switchTab(\\'registrations\\');'},\n }},\n '_primary_image_id':{'label':'Primary Image', 'type':'imageform', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'website' ? 'yes' : 'hidden'; },\n 'fields':{\n 'primary_image_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.edit.setFieldValue('primary_image_id', iid, null, null);\n return true;\n },\n 'addDropImageRefresh':'',\n 'deleteImage':function(fid) {\n M.ciniki_musicfestivals_main.edit.setFieldValue(fid,0);\n return true;\n },\n },\n }},\n '_description':{'label':'Description', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'website' ? 'yes' : 'hidden'; },\n 'fields':{\n 'description':{'label':'', 'hidelabel':'yes', 'type':'textarea'},\n }},\n '_document_logo_id':{'label':'Document Image', 'type':'imageform',\n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'documents' ? 'yes' : 'hidden'; },\n 'fields':{\n 'document_logo_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.edit.setFieldValue('document_logo_id', iid, null, null);\n return true;\n },\n 'addDropImageRefresh':'',\n 'deleteImage':function(fid) {\n M.ciniki_musicfestivals_main.edit.setFieldValue(fid,0);\n return true;\n },\n },\n }},\n '_document_header_msg':{'label':'Header Message', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'documents' ? 'yes' : 'hidden'; },\n 'fields':{\n 'document_header_msg':{'label':'', 'hidelabel':'yes', 'type':'text'},\n }},\n '_document_footer_msg':{'label':'Footer Message', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'documents' ? 'yes' : 'hidden'; },\n 'fields':{\n 'document_footer_msg':{'label':'', 'hidelabel':'yes', 'type':'text'},\n }},\n '_comments_pdf':{'label':'Comments PDF Options', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'documents' ? 'yes' : 'hidden'; },\n 'fields':{\n 'flags6':{'label':'Header Adjudicator Name', 'type':'flagtoggle', 'default':'off', 'bit':0x20, 'field':'flags'},\n 'flags7':{'label':'Timeslot Date/Time', 'type':'flagtoggle', 'default':'off', 'bit':0x40, 'field':'flags'},\n 'comments_grade_label':{'label':'Grade Label', 'default':'Mark', 'type':'text'},\n 'comments_footer_msg':{'label':'Footer Message', 'type':'text'},\n }},\n '_certificates_pdf':{'label':'Certificates PDF Options', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'documents' ? 'yes' : 'hidden'; },\n 'fields':{\n 'flags8':{'label':'Include Pronouns', 'type':'flagtoggle', 'default':'off', 'bit':0x80, 'field':'flags'},\n }},\n '_syllabus':{'label':'Syllabus Options', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'documents' ? 'yes' : 'hidden'; },\n 'fields':{\n 'flags5':{'label':'Include Section/Category as Class Name', 'type':'flagtoggle', 'default':'off', 'bit':0x0100, 'field':'flags'},\n }},\n '_registration_parent_msg':{'label':'Registration Form', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'registrations' ? 'yes' : 'hidden'; },\n 'fields':{\n 'registration-parent-msg':{'label':'Parents Intro', 'type':'textarea', 'size':'medium'},\n 'registration-teacher-msg':{'label':'Teachers Intro', 'type':'textarea', 'size':'medium'},\n 'registration-adult-msg':{'label':'Adult Intro', 'type':'textarea', 'size':'medium'},\n }},\n '_competitor_parent_msg':{'label':'Individual Competitor Form', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'registrations' ? 'yes' : 'hidden'; },\n 'fields':{\n 'competitor-parent-msg':{'label':'Parent Intro', 'type':'textarea', 'size':'medium'},\n 'competitor-teacher-msg':{'label':'Teacher Intro', 'type':'textarea', 'size':'medium'},\n 'competitor-adult-msg':{'label':'Adult Intro', 'type':'textarea', 'size':'medium'},\n 'competitor-individual-study-level':{'label':'Study Level', 'type':'toggle', 'default':'optional', 'toggles':{\n 'options':'Optional', 'required':'Required', 'hidden':'Hidden',\n }},\n }},\n '_competitor_group_parent_msg':{'label':'Group/Ensemble Competitor Form', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'registrations' ? 'yes' : 'hidden'; },\n 'fields':{\n 'competitor-group-parent-msg':{'label':'Parent Intro', 'type':'textarea', 'size':'medium'},\n 'competitor-group-teacher-msg':{'label':'Teacher Intro', 'type':'textarea', 'size':'medium'},\n 'competitor-group-adult-msg':{'label':'Adult Intro', 'type':'textarea', 'size':'medium'},\n 'competitor-group-study-level':{'label':'Study Level', 'type':'toggle', 'default':'optional', 'toggles':{\n 'options':'Optional', 'required':'Required', 'hidden':'Hidden',\n }},\n }},\n '_waiver':{'label':'Waiver Message', \n 'visible':function() { return M.ciniki_musicfestivals_main.edit.sections._tabs.selected == 'registrations' ? 'yes' : 'hidden'; },\n 'fields':{\n 'waiver-title':{'label':'Title', 'type':'text'},\n 'waiver-msg':{'label':'Message', 'type':'textarea', 'size':'medium'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.edit.save();'},\n 'updatename':{'label':'Update Public Names', \n 'visible':function() {return M.ciniki_musicfestivals_main.edit.festival_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.edit.updateNames();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.edit.festival_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.edit.save();'},\n }},\n };\n this.edit.fieldValue = function(s, i, d) { return this.data[i]; }\n this.edit.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.festivalHistory', 'args':{'tnid':M.curTenantID, 'festival_id':this.festival_id, 'field':i}};\n }\n this.edit.switchTab = function(tab) {\n this.sections._tabs.selected = tab;\n this.showHideSection('_primary_image_id');\n this.showHideSection('_description');\n this.showHideSection('_document_logo_id');\n this.showHideSection('_document_header_msg');\n this.showHideSection('_document_footer_msg');\n this.showHideSection('_comments_pdf');\n this.showHideSection('_certificates_pdf');\n this.showHideSection('_syllabus');\n this.showHideSection('_registration_parent_msg');\n this.showHideSection('_registration_teacher_msg');\n this.showHideSection('_registration_adult_msg');\n this.showHideSection('_competitor_parent_msg');\n this.showHideSection('_competitor_teacher_msg');\n this.showHideSection('_competitor_adult_msg');\n this.showHideSection('_competitor_group_parent_msg');\n this.showHideSection('_competitor_group_teacher_msg');\n this.showHideSection('_competitor_group_adult_msg');\n this.showHideSection('_waiver');\n this.refreshSection('_tabs');\n }\n this.edit.updateNames = function() {\n M.api.getJSONCb('ciniki.musicfestivals.registrationNamesUpdate', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.alert(\"Done\");\n });\n }\n this.edit.open = function(cb, fid, list) {\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.festivalGet', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.edit;\n p.data = rsp.festival;\n if( (rsp.festival.flags&0x02) == 0x02 ) {\n p.sections.general.fields.flags3.visible = 'yes';\n p.sections.general.fields.virtual_date.visible = 'yes';\n p.sections.general.fields.upload_end_dt.visible = 'yes';\n } else {\n p.sections.general.fields.virtual_date.visible = 'no';\n p.sections.general.fields.upload_end_dt.visible = 'no';\n }\n p.refresh();\n p.show(cb);\n });\n }\n this.edit.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.edit.close();'; }\n if( this.festival_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.festivalUpdate', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.festivalAdd', {'tnid':M.curTenantID}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.edit.festival_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.edit.remove = function() {\n M.confirm('Are you sure you want to remove festival?',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.festivalDelete', {'tnid':M.curTenantID, 'festival_id':M.ciniki_musicfestivals_main.edit.festival_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.edit.close();\n });\n });\n }\n this.edit.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.festival_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.edit.save(\\'M.ciniki_musicfestivals_main.edit.open(null,' + this.nplist[this.nplist.indexOf('' + this.festival_id) + 1] + ');\\');';\n }\n return null;\n }\n this.edit.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.festival_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.edit.save(\\'M.ciniki_musicfestivals_main.festival_id.open(null,' + this.nplist[this.nplist.indexOf('' + this.festival_id) - 1] + ');\\');';\n }\n return null;\n }\n this.edit.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.edit.save();');\n this.edit.addClose('Cancel');\n this.edit.addButton('next', 'Next');\n this.edit.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Section\n //\n this.section = new M.panel('Section', 'ciniki_musicfestivals_main', 'section', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.section');\n this.section.data = null;\n this.section.festival_id = 0;\n this.section.section_id = 0;\n this.section.nplists = {};\n this.section.nplist = [];\n this.section.sections = {\n '_primary_image_id':{'label':'Image', 'type':'imageform', 'aside':'yes', 'fields':{\n 'primary_image_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.section.setFieldValue('primary_image_id', iid);\n return true;\n },\n 'addDropImageRefresh':'',\n 'deleteImage':function(fid) {\n M.ciniki_musicfestivals_main.section.setFieldValue('primary_image_id',0);\n return true;\n },\n },\n }},\n 'general':{'label':'Section', 'aside':'yes', 'fields':{\n 'name':{'label':'Name', 'type':'text', 'required':'yes'},\n 'sequence':{'label':'Order', 'type':'text', 'required':'yes', 'size':'small'},\n 'flags':{'label':'Options', 'type':'flags', 'flags':{'1':{'name':'Hidden'}}},\n 'live_end_dt':{'label':'Live Deadline', 'type':'datetime',\n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.data.flags&0x08) == 0x08 ? 'yes' : 'no';},\n },\n 'virtual_end_dt':{'label':'Virtual Deadline', 'type':'datetime',\n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.data.flags&0x0a) == 0x0a ? 'yes' : 'no';},\n },\n 'edit_end_dt':{'label':'Edit Titles Deadline', 'type':'datetime',\n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.data.flags&0x0a) == 0x0a ? 'yes' : 'no';},\n },\n 'upload_end_dt':{'label':'Upload Deadline', 'type':'datetime',\n 'visible':function() { return (M.ciniki_musicfestivals_main.festival.data.flags&0x0a) == 0x0a ? 'yes' : 'no';},\n },\n }},\n '_tabs':{'label':'', 'type':'paneltabs', 'selected':'categories', 'tabs':{\n 'categories':{'label':'Categories', 'fn':'M.ciniki_musicfestivals_main.section.switchTab(\\'categories\\');'},\n 'synopsis':{'label':'Description', 'fn':'M.ciniki_musicfestivals_main.section.switchTab(\\'synopsis\\');'},\n }},\n '_synopsis':{'label':'Synopsis', \n 'visible':function() { return M.ciniki_musicfestivals_main.section.sections._tabs.selected == 'synopsis' ? 'yes' : 'hidden'; },\n 'fields':{'synopsis':{'label':'', 'hidelabel':'yes', 'type':'textarea', 'size':'small'}},\n },\n '_description':{'label':'Description', \n 'visible':function() { return M.ciniki_musicfestivals_main.section.sections._tabs.selected == 'synopsis' ? 'yes' : 'hidden'; },\n 'fields':{'description':{'label':'', 'hidelabel':'yes', 'type':'textarea'}},\n },\n 'categories':{'label':'Categories', 'type':'simplegrid', 'num_cols':1,\n 'visible':function() { return M.ciniki_musicfestivals_main.section.sections._tabs.selected == 'categories' ? 'yes' : 'hidden'; },\n 'addTxt':'Add Category',\n 'addFn':'M.ciniki_musicfestivals_main.section.openCategory(0);',\n },\n '_buttons':{'label':'', 'buttons':{\n 'syllabuspdf':{'label':'Download Syllabus (PDF)', 'fn':'M.ciniki_musicfestivals_main.section.downloadSyllabusPDF();'},\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.section.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.section.section_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.section.remove();'},\n }},\n };\n this.section.fieldValue = function(s, i, d) { return this.data[i]; }\n this.section.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.sectionHistory', 'args':{'tnid':M.curTenantID, 'section_id':this.section_id, 'field':i}};\n }\n this.section.cellValue = function(s, i, j, d) {\n switch (j) {\n case 0: return d.name;\n }\n }\n this.section.rowFn = function(s, i, d) {\n return 'M.ciniki_musicfestivals_main.section.openCategory(\\'' + d.id + '\\');';\n }\n this.section.openCategory = function(cid) {\n this.save(\"M.ciniki_musicfestivals_main.category.open('M.ciniki_musicfestivals_main.section.open();', '\" + cid + \"', this.section_id, this.festival_id, this.nplists.categories);\");\n }\n this.section.switchTab = function(tab) {\n this.sections._tabs.selected = tab;\n this.refresh();\n this.show();\n }\n this.section.downloadSyllabusPDF = function() {\n M.api.openPDF('ciniki.musicfestivals.festivalSyllabusPDF', {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'section_id':this.section_id});\n }\n this.section.open = function(cb, sid, fid, list) {\n if( sid != null ) { this.section_id = sid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.sectionGet', {'tnid':M.curTenantID, 'section_id':this.section_id, 'festival_id':this.festival_id, 'categories':'yes'}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.section;\n p.data = rsp.section;\n p.festival_id = rsp.section.festival_id;\n p.nplists = {};\n if( rsp.nplists != null ) {\n p.nplists = rsp.nplists;\n }\n p.refresh();\n p.show(cb);\n });\n }\n this.section.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.section.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.section_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.sectionUpdate', {'tnid':M.curTenantID, 'section_id':this.section_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.sectionAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.section.section_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.section.remove = function() {\n M.confirm('Are you sure you want to remove section?',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.sectionDelete', {'tnid':M.curTenantID, 'section_id':M.ciniki_musicfestivals_main.section.section_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.section.close();\n });\n });\n }\n this.section.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.section_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.section.save(\\'M.ciniki_musicfestivals_main.section.open(null,' + this.nplist[this.nplist.indexOf('' + this.section_id) + 1] + ');\\');';\n }\n return null;\n }\n this.section.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.section_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.section.save(\\'M.ciniki_musicfestivals_main.section.open(null,' + this.nplist[this.nplist.indexOf('' + this.section_id) - 1] + ');\\');';\n }\n return null;\n }\n this.section.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.section.save();');\n this.section.addClose('Cancel');\n this.section.addButton('next', 'Next');\n this.section.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Section Classes\n //\n this.classes = new M.panel('Section', 'ciniki_musicfestivals_main', 'classes', 'mc', 'full', 'sectioned', 'ciniki.musicfestivals.main.classes');\n this.classes.data = null;\n this.classes.festival_id = 0;\n this.classes.section_id = 0;\n this.classes.nplists = {};\n this.classes.nplist = [];\n this.classes.sections = {\n '_tabs':{'label':'', 'type':'paneltabs', 'selected':'fees', \n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x40); },\n 'tabs':{\n 'fees':{'label':'Fees', 'fn':'M.ciniki_musicfestivals_main.classes.switchTab(\"fees\");'},\n 'trophies':{'label':'Trophies', 'fn':'M.ciniki_musicfestivals_main.classes.switchTab(\"trophies\");'},\n }},\n 'classes':{'label':'Classes', 'type':'simplegrid', 'num_cols':7,\n 'headerValues':['Order', 'Category', 'Code', 'Class', 'Levels', 'Earlybird', 'Live', 'Virtual'],\n 'sortable':'yes',\n 'sortTypes':['text', 'text', 'text', 'text', 'number', 'number', 'number'],\n 'dataMaps':['joined_sequence', 'category_name', 'code', 'class_name', 'level', 'earlybird_fee', 'fee', 'virtual_fee'],\n },\n/* '_buttons':{'label':'', 'halfsize':'yes', 'buttons':{\n 'syllabuspdf':{'label':'Download Syllabus (PDF)', 'fn':'M.ciniki_musicfestivals_main.section.downloadSyllabusPDF();'},\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.section.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.section.section_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.section.remove();'},\n }}, */\n };\n this.classes.switchTab = function(t) {\n this.sections._tabs.selected = t;\n this.open();\n }\n this.classes.cellValue = function(s, i, j, d) {\n if( this.sections.classes.dataMaps[j] != null ) {\n if( this.sections.classes.dataMaps[j].match(/fee/) ) {\n return M.formatDollar(d[this.sections.classes.dataMaps[j]]);\n }\n if( this.sections.classes.dataMaps[j] == 'num_registrations' && d[this.sections.classes.dataMaps[j]] == 0 ) {\n return '';\n }\n return d[this.sections.classes.dataMaps[j]];\n }\n }\n this.classes.rowFn = function(s, i, d) {\n return 'M.ciniki_musicfestivals_main.class.open(\\'M.ciniki_musicfestivals_main.classes.open();\\',\\'' + d.id + '\\',\\'' + d.category_id + '\\',\\'' + this.festival_id + '\\',M.ciniki_musicfestivals_main.classes.nplists.classes);';\n }\n this.classes.downloadSyllabusPDF = function() {\n M.api.openPDF('ciniki.musicfestivals.festivalSyllabusPDF', {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'section_id':this.section_id});\n }\n this.classes.open = function(cb, sid, fid, list) {\n if( sid != null ) { this.section_id = sid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.sectionClasses', {'tnid':M.curTenantID, 'section_id':this.section_id, 'festival_id':this.festival_id, 'list':this.sections._tabs.selected}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.classes;\n p.data = rsp;\n p.sections.classes.headerValues = ['Order', 'Category', 'Code', 'Class'];\n p.sections.classes.sortTypes = ['text', 'text', 'text', 'text'];\n p.sections.classes.dataMaps = ['joined_sequence', 'category_name', 'code', 'class_name'];\n if( p.sections._tabs.selected == 'trophies' ) {\n p.sections.classes.headerValues.push('Trophies');\n p.sections.classes.sortTypes.push('text');\n p.sections.classes.dataMaps.push('trophies');\n } else {\n if( M.modFlagOn('ciniki.musicfestivals', 0x1000) ) {\n p.sections.classes.headerValues.push('Levels');\n p.sections.classes.sortTypes.push('text');\n p.sections.classes.dataMaps.push('levels');\n }\n p.sections.classes.headerValues.push('Earlybird');\n p.sections.classes.sortTypes.push('number');\n p.sections.classes.dataMaps.push('earlybird_fee');\n p.sections.classes.headerValues.push('Fee');\n p.sections.classes.sortTypes.push('number');\n p.sections.classes.dataMaps.push('fee');\n if( (rsp.festival.flags&0x04) == 0x04 ) {\n p.sections.classes.headerValues.push('Virtual');\n p.sections.classes.sortTypes.push('number');\n p.sections.classes.dataMaps.push('virtual_fee');\n }\n if( M.modFlagOn('ciniki.musicfestivals', 0x0800) ) {\n p.sections.classes.headerValues.push('Earlybird Plus');\n p.sections.classes.sortTypes.push('number');\n p.sections.classes.dataMaps.push('earlybird_plus_fee');\n p.sections.classes.headerValues.push('Plus');\n p.sections.classes.sortTypes.push('number');\n p.sections.classes.dataMaps.push('plus_fee');\n }\n p.sections.classes.headerValues.push('Registrations');\n p.sections.classes.sortTypes.push('number');\n p.sections.classes.dataMaps.push('num_registrations');\n p.sections.classes.num_cols = p.sections.classes.headerValues.length;\n }\n\n p.festival_id = rsp.section.festival_id;\n p.sections.classes.label = rsp.section.name + ' - Classes';\n p.nplists = {};\n if( rsp.nplists != null ) {\n p.nplists = rsp.nplists;\n }\n p.refresh();\n p.show(cb);\n });\n }\n this.classes.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.section_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.classes.open(null,' + this.nplist[this.nplist.indexOf('' + this.section_id) + 1] + ');';\n }\n return null;\n }\n this.classes.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.section_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.classes.open(null,' + this.nplist[this.nplist.indexOf('' + this.section_id) - 1] + ');';\n }\n return null;\n }\n this.classes.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.section.save();');\n this.classes.addClose('Cancel');\n this.classes.addButton('next', 'Next');\n this.classes.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Category\n //\n this.category = new M.panel('Category', 'ciniki_musicfestivals_main', 'category', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.category');\n this.category.data = null;\n this.category.category_id = 0;\n this.category.nplists = {};\n this.category.nplist = [];\n this.category.sections = {\n '_primary_image_id':{'label':'Image', 'type':'imageform', 'aside':'yes', 'fields':{\n 'primary_image_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.category.setFieldValue('primary_image_id', iid);\n return true;\n },\n 'addDropImageRefresh':'',\n 'deleteImage':function(fid) {\n M.ciniki_musicfestivals_main.category.setFieldValue(fid,0);\n return true;\n },\n },\n }},\n 'general':{'label':'', 'aside':'yes', 'fields':{\n 'section_id':{'label':'Section', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}},\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'sequence':{'label':'Order', 'required':'yes', 'type':'text'},\n }},\n '_tabs':{'label':'', 'type':'paneltabs', 'selected':'classes', 'tabs':{\n 'classes':{'label':'Classes', 'fn':'M.ciniki_musicfestivals_main.category.switchTab(\\'classes\\');'},\n 'synopsis':{'label':'Description', 'fn':'M.ciniki_musicfestivals_main.category.switchTab(\\'synopsis\\');'},\n }},\n '_synopsis':{'label':'Synopsis', \n 'visible':function() { return M.ciniki_musicfestivals_main.category.sections._tabs.selected == 'synopsis' ? 'yes' : 'hidden'; },\n 'fields':{'synopsis':{'label':'', 'hidelabel':'yes', 'type':'textarea', 'size':'small'}},\n },\n '_description':{'label':'Description', \n 'visible':function() { return M.ciniki_musicfestivals_main.category.sections._tabs.selected == 'synopsis' ? 'yes' : 'hidden'; },\n 'fields':{'description':{'label':'', 'hidelabel':'yes', 'type':'textarea'}},\n },\n 'classes':{'label':'Classes', 'type':'simplegrid', 'num_cols':5,\n 'visible':function() { return M.ciniki_musicfestivals_main.category.sections._tabs.selected == 'classes' ? 'yes' : 'hidden'; },\n 'headerValues':['Code', 'Name', 'Earlybird', 'Fee', 'Virtual'],\n 'addTxt':'Add Class',\n 'addFn':'M.ciniki_musicfestivals_main.category.openClass(0);',\n },\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.category.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.category.category_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.category.remove();'},\n }},\n };\n this.category.fieldValue = function(s, i, d) { return this.data[i]; }\n this.category.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.categoryHistory', 'args':{'tnid':M.curTenantID, 'category_id':this.category_id, 'field':i}};\n }\n this.category.cellValue = function(s, i, j, d) {\n switch (j) {\n case 0: return d.code;\n case 1: return d.name;\n case 2: return (d.earlybird_fee > 0 ? M.formatDollar(d.earlybird_fee) : '');\n case 3: return (d.fee > 0 ? M.formatDollar(d.fee) : '');\n case 4: return (d.virtual_fee > 0 ? M.formatDollar(d.virtual_fee) : '');\n }\n }\n this.category.rowFn = function(s, i, d) {\n return 'M.ciniki_musicfestivals_main.category.openClass(\\'' + d.id + '\\');';\n }\n this.category.openClass = function(cid) {\n this.save(\"M.ciniki_musicfestivals_main.class.open('M.ciniki_musicfestivals_main.category.open();','\" + cid + \"', this.category_id, this.festival_id, this.nplists.classes);\");\n }\n this.category.switchTab = function(tab) {\n this.sections._tabs.selected = tab;\n this.refresh();\n this.show();\n }\n this.category.open = function(cb, cid, sid,fid,list) {\n if( cid != null ) { this.category_id = cid; }\n if( sid != null ) { this.section_id = sid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.categoryGet', {'tnid':M.curTenantID, \n 'category_id':this.category_id, 'festival_id':this.festival_id, 'section_id':this.section_id,\n 'sections':'yes', 'classes':'yes'}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.category;\n p.data = rsp.category;\n p.nplists = {};\n if( rsp.nplists != null ) {\n p.nplists = rsp.nplists;\n }\n p.sections.general.fields.section_id.options = rsp.sections;\n if( M.ciniki_musicfestivals_main.festival.data.flags != null \n && (M.ciniki_musicfestivals_main.festival.data.flags&0x04) == 0x04 \n ) {\n p.sections.classes.num_cols = 5;\n } else {\n p.sections.classes.num_cols = 4;\n }\n\n p.refresh();\n p.show(cb);\n });\n }\n this.category.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.category.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.category_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.categoryUpdate', {'tnid':M.curTenantID, 'category_id':this.category_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.categoryAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.category.category_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.category.remove = function() {\n M.confirm('Are you sure you want to remove category?',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.categoryDelete', {'tnid':M.curTenantID, 'category_id':M.ciniki_musicfestivals_main.category.category_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.category.close();\n });\n });\n }\n this.category.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.category_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.category.save(\\'M.ciniki_musicfestivals_main.category.open(null,' + this.nplist[this.nplist.indexOf('' + this.category_id) + 1] + ');\\');';\n }\n return null;\n }\n this.category.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.category_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.category.save(\\'M.ciniki_musicfestivals_main.category.open(null,' + this.nplist[this.nplist.indexOf('' + this.category_id) - 1] + ');\\');';\n }\n return null;\n }\n this.category.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.category.save();');\n this.category.addClose('Cancel');\n this.category.addButton('next', 'Next');\n this.category.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Class\n //\n this.class = new M.panel('Class', 'ciniki_musicfestivals_main', 'class', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.class');\n this.class.data = null;\n this.class.festival_id = 0;\n this.class.class_id = 0;\n this.class.nplists = {};\n this.class.nplist = [];\n this.class.sections = {\n 'general':{'label':'', 'aside':'yes', 'fields':{\n 'category_id':{'label':'Category', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}},\n 'code':{'label':'Code', 'type':'text', 'size':'small'},\n 'name':{'label':'Name', 'type':'text'},\n// 'level':{'label':'Level', 'type':'text', 'livesearch':'yes', 'livesearchempty':'yes',\n// 'visible':function() {return M.modFlagSet('ciniki.musicfestivals', 0x1000); },\n// },\n 'levels':{'label':'Level', 'type':'tags', 'tags':[], 'hint':'Enter a new level:', 'sort':'no',\n 'visible':function() {return M.modFlagSet('ciniki.musicfestivals', 0x1000); },\n },\n 'sequence':{'label':'Order', 'type':'text'},\n 'earlybird_fee':{'label':'Earlybird Fee', 'type':'text', 'size':'small'},\n 'fee':{'label':'Fee', 'type':'text', 'size':'small'},\n 'virtual_fee':{'label':'Virtual Fee', 'type':'text', 'size':'small',\n 'visible':function() { \n if( M.ciniki_musicfestivals_main.festival.data.flags != null \n && (M.ciniki_musicfestivals_main.festival.data.flags&0x04) == 0x04 \n ) {\n return 'yes';\n }\n return 'no';\n },\n },\n 'earlybird_plus_fee':{'label':'Earlybird Plus Fee', 'type':'text', 'size':'small',\n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x0800); },\n },\n 'plus_fee':{'label':'Plus Fee', 'type':'text', 'size':'small',\n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x0800); },\n },\n }},\n// '_tags':{'label':'Tags', \n// 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x2000); },\n// 'fields':{\n// }},\n 'registration':{'label':'Registration Options', 'aside':'yes', 'fields':{\n 'flags1':{'label':'Online Registrations', 'type':'flagtoggle', 'default':'on', 'bit':0x01, 'field':'flags'},\n 'flags2':{'label':'Multiple/Registrant', 'type':'flagtoggle', 'default':'on', 'bit':0x02, 'field':'flags'},\n 'flags5':{'label':'2nd Competitor', 'type':'flagtoggle', 'default':'off', 'bit':0x10, 'field':'flags'},\n 'flags6':{'label':'3rd Competitor', 'type':'flagtoggle', 'default':'off', 'bit':0x20, 'field':'flags'},\n 'flags7':{'label':'4th Competitor', 'type':'flagtoggle', 'default':'off', 'bit':0x40, 'field':'flags'},\n 'flags13':{'label':'2nd Title & Time', 'type':'flagtoggle', 'default':'off', 'bit':0x1000, 'field':'flags'},\n 'flags14':{'label':'2nd Title & Time Optional', 'type':'flagtoggle', 'default':'off', 'bit':0x2000, 'field':'flags'},\n 'flags15':{'label':'3rd Title & Time', 'type':'flagtoggle', 'default':'off', 'bit':0x4000, 'field':'flags'},\n 'flags16':{'label':'3rd Title & Time Optional', 'type':'flagtoggle', 'default':'off', 'bit':0x8000, 'field':'flags'},\n }},\n 'registrations':{'label':'Registrations', 'type':'simplegrid', 'num_cols':3, \n 'headerValues':['Competitor', 'Teacher', 'Status'],\n 'noData':'No registrations',\n// 'addTxt':'Add Registration',\n// 'addFn':'M.ciniki_musicfestivals_main.registration.open(\\'M.ciniki_musicfestivals_main.festival.open();\\',0,0,M.ciniki_musicfestivals_main.class.class_id,M.ciniki_musicfestivals_main.festival.festival_id,null,\\'festival\\');',\n },\n 'trophies':{'label':'Trophies', 'type':'simplegrid', 'num_cols':3, \n 'headerValues':['Category', 'Name'],\n 'cellClasses':['', '', 'alignright'],\n 'noData':'No trophies',\n 'addTxt':'Add Trophy',\n 'addFn':'M.ciniki_musicfestivals_main.class.save(\"M.ciniki_musicfestivals_main.class.addTrophy();\");',\n },\n '_buttons':{'label':'', 'aside':'yes', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.class.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.class.class_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.class.remove();'},\n }},\n };\n this.class.fieldValue = function(s, i, d) { return this.data[i]; }\n this.class.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.classHistory', 'args':{'tnid':M.curTenantID, 'class_id':this.class_id, 'field':i}};\n }\n this.class.cellValue = function(s, i, j, d) {\n if( s == 'registrations' ) {\n switch(j) {\n case 0: return d.display_name; // + M.subdue(' (',d.pronoun,')');\n case 1: return d.teacher_name;\n case 2: return d.status_text;\n }\n }\n if( s == 'trophies' ) {\n switch(j) {\n case 0: return d.category;\n case 1: return d.name;\n case 2: return '<button onclick=\"M.ciniki_musicfestivals_main.class.removeTrophy(\\'' + d.id + '\\');\">Remove</button>';\n }\n }\n }\n this.class.rowFn = function(s, i, d) {\n if( s == 'registrations' ) {\n return 'M.ciniki_musicfestivals_main.registration.open(\\'M.ciniki_musicfestivals_main.class.open();\\',\\'' + d.id + '\\',0,0,M.ciniki_musicfestivals_main.class.festival_id, null,\\'festival\\');';\n }\n return '';\n }\n this.class.addTrophy = function() {\n M.ciniki_musicfestivals_main.classtrophy.open('M.ciniki_musicfestivals_main.class.open();',this.class_id);\n }\n this.class.attachTrophy = function(i) {\n M.api.getJSONCb('ciniki.musicfestivals.classTrophyAdd', {'tnid':M.curTenantID, 'class_id':this.class_id, 'trophy_id':i}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.class.open();\n });\n }\n this.class.removeTrophy = function(i) {\n M.api.getJSONCb('ciniki.musicfestivals.classTrophyRemove', {'tnid':M.curTenantID, 'class_id':this.class_id, 'tc_id':i}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.class.open();\n });\n }\n/* this.class.liveSearchCb = function(s, i, value) {\n if( i == 'level' ) {\n M.api.getJSONBgCb('ciniki.musicfestivals.classFieldSearch', {'tnid':M.curTenantID, 'field':i, 'start_needle':value, 'festival_id':M.ciniki_musicfestivals_main.class.festival_id, 'limit':15}, \n function(rsp) {\n M.ciniki_musicfestivals_main.class.liveSearchShow(s, i, M.gE(M.ciniki_musicfestivals_main.class.panelUID + '_' + i), rsp.results); \n });\n }\n }\n this.class.liveSearchResultValue = function(s, f, i, j, d) {\n return d.name;\n }\n this.class.liveSearchResultRowFn = function(s, f, i, j, d) {\n if( f == 'level' ) {\n return 'M.ciniki_musicfestivals_main.class.updateField(\\'' + s + '\\',\\'' + f + '\\',\\'' + escape(d.name) + '\\');';\n }\n }\n this.class.updateField = function(s, f, r) {\n M.gE(this.panelUID + '_' + f).value = unescape(r);\n this.removeLiveSearch(s, f);\n } */\n this.class.open = function(cb, iid, cid, fid, list) {\n if( iid != null ) { this.class_id = iid; }\n if( cid != null ) { this.category_id = cid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.classGet', {'tnid':M.curTenantID, 'class_id':this.class_id, 'festival_id':this.festival_id, 'category_id':this.category_id, \n 'registrations':'yes', 'categories':'yes'}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.class;\n p.data = rsp.class;\n p.nplists = {};\n if( rsp.nplists != null ) {\n p.nplists = rsp.nplists;\n }\n p.sections.general.fields.category_id.options = rsp.categories;\n p.sections.general.fields.levels.tags = [];\n if( rsp.levels != null ) {\n p.sections.general.fields.levels.tags = rsp.levels;\n }\n p.refresh();\n p.show(cb);\n });\n }\n this.class.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.class.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.class_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.classUpdate', {'tnid':M.curTenantID, 'class_id':this.class_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.classAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.class.class_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.class.remove = function() {\n M.confirm('Are you sure you want to remove class?',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.classDelete', {'tnid':M.curTenantID, 'class_id':M.ciniki_musicfestivals_main.class.class_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.class.close();\n });\n });\n }\n this.class.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.class_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.class.save(\\'M.ciniki_musicfestivals_main.class.open(null,' + this.nplist[this.nplist.indexOf('' + this.class_id) + 1] + ');\\');';\n }\n return null;\n }\n this.class.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.class_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.class.save(\\'M.ciniki_musicfestivals_main.class.open(null,' + this.nplist[this.nplist.indexOf('' + this.class_id) - 1] + ');\\');';\n }\n return null;\n }\n this.class.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.class.save();');\n this.class.addClose('Cancel');\n this.class.addButton('next', 'Next');\n this.class.addLeftButton('prev', 'Prev');\n\n //\n // This panel lets the user select a trophy to attach to a class\n //\n this.classtrophy = new M.panel('Select Trophy', 'ciniki_musicfestivals_main', 'classtrophy', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.trophyclass');\n this.classtrophy.sections = {\n 'trophies':{'label':'Select Trophy', 'type':'simplegrid', 'num_cols':3,\n 'noData':'No trophies',\n },\n };\n this.classtrophy.cellValue = function(s, i, j, d) {\n if( s == 'trophies' ) {\n switch(j) {\n case 0: return d.category;\n case 1: return d.name;\n case 2: return '<button onclick=\"M.ciniki_musicfestivals_main.class.attachTrophy(\\'' + d.id + '\\');\">Add</button>';\n }\n }\n }\n this.classtrophy.open = function(cb, cid) {\n M.api.getJSONCb('ciniki.musicfestivals.trophyList', {'tnid':M.curTenantID, 'class_id':cid}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.classtrophy;\n p.data = rsp;\n p.refresh();\n p.show(cb);\n });\n }\n this.classtrophy.addClose('Back');\n\n //\n // Registration\n //\n this.registration = new M.panel('Registration', 'ciniki_musicfestivals_main', 'registration', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.registration');\n this.registration.data = null;\n this.registration.festival_id = 0;\n this.registration.teacher_customer_id = 0;\n this.registration.competitor1_id = 0;\n this.registration.competitor2_id = 0;\n this.registration.competitor3_id = 0;\n this.registration.competitor4_id = 0;\n// this.registration.competitor5_id = 0;\n this.registration.registration_id = 0;\n this.registration.nplist = [];\n this.registration._source = '';\n this.registration.sections = {\n// '_tabs':{'label':'', 'type':'paneltabs', 'field_id':'rtype', 'selected':'30', 'tabs':{\n// '30':{'label':'Individual', 'fn':'M.ciniki_musicfestivals_main.registration.switchTab(\"30\");'},\n// '50':{'label':'Duet', 'fn':'M.ciniki_musicfestivals_main.registration.switchTab(\"50\");'},\n// '60':{'label':'Trio', 'fn':'M.ciniki_musicfestivals_main.registration.switchTab(\"60\");'},\n// '90':{'label':'Ensemble', 'fn':'M.ciniki_musicfestivals_main.registration.switchTab(\"90\");'},\n// }},\n 'teacher_details':{'label':'Teacher', 'type':'simplegrid', 'num_cols':2, 'aside':'yes',\n 'cellClasses':['label', ''],\n 'addTxt':'Edit',\n 'addFn':'M.startApp(\\'ciniki.customers.edit\\',null,\\'M.ciniki_musicfestivals_main.registration.updateTeacher();\\',\\'mc\\',{\\'next\\':\\'M.ciniki_musicfestivals_main.registration.updateTeacher\\',\\'customer_id\\':M.ciniki_musicfestivals_main.registration.teacher_customer_id});',\n 'changeTxt':'Change',\n 'changeFn':'M.startApp(\\'ciniki.customers.edit\\',null,\\'M.ciniki_musicfestivals_main.registration.updateTeacher();\\',\\'mc\\',{\\'next\\':\\'M.ciniki_musicfestivals_main.registration.updateTeacher\\',\\'customer_id\\':0});',\n },\n '_display_name':{'label':'Duet/Trio/Ensemble Name', 'aside':'yes',\n 'visible':'hidden',\n// 'visible':function(){return (parseInt(M.ciniki_musicfestivals_main.registration.sections._tabs.selected)>60?'yes':'hidden');},\n 'fields':{ \n 'display_name':{'label':'', 'hidelabel':'yes', 'type':'text'},\n }},\n 'competitor1_details':{'label':'Competitor 1', 'aside':'yes', 'type':'simplegrid', 'num_cols':2,\n 'cellClasses':['label', ''],\n 'addTxt':'',\n 'addFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(M.ciniki_musicfestivals_main.registration.competitor1_id, 1);',\n 'changeTxt':'Add',\n 'changeFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(0, 1);',\n },\n 'competitor2_details':{'label':'Competitor 2', 'aside':'yes', 'type':'simplegrid', 'num_cols':2,\n 'visible':'hidden',\n// 'visible':function(){return (parseInt(M.ciniki_musicfestivals_main.registration.sections._tabs.selected)>30?'yes':'hidden');},\n 'cellClasses':['label', ''],\n 'addTxt':'Edit',\n 'addFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(M.ciniki_musicfestivals_main.registration.competitor1_id, 2);',\n 'changeTxt':'Change',\n 'changeFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(0, 2);',\n },\n 'competitor3_details':{'label':'Competitor 3', 'aside':'yes', 'type':'simplegrid', 'num_cols':2,\n 'visible':'hidden',\n// 'visible':function(){return (parseInt(M.ciniki_musicfestivals_main.registration.sections._tabs.selected)>50?'yes':'hidden');},\n 'cellClasses':['label', ''],\n 'addTxt':'Edit',\n 'addFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(M.ciniki_musicfestivals_main.registration.competitor1_id, 3);',\n 'changeTxt':'Change',\n 'changeFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(0, 3);',\n },\n 'competitor4_details':{'label':'Competitor 4', 'aside':'yes', 'type':'simplegrid', 'num_cols':2,\n 'visible':'hidden',\n// 'visible':function(){return (parseInt(M.ciniki_musicfestivals_main.registration.sections._tabs.selected)>60?'yes':'hidden');},\n 'cellClasses':['label', ''],\n 'addTxt':'Edit',\n 'addFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(M.ciniki_musicfestivals_main.registration.competitor1_id, 4);',\n 'changeTxt':'Change',\n 'changeFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(0, 4);',\n },\n/* 'competitor5_details':{'label':'Competitor 5', 'aside':'yes', 'type':'simplegrid', 'num_cols':2,\n 'visible':function(){return (parseInt(M.ciniki_musicfestivals_main.registration.sections._tabs.selected)>60?'yes':'hidden');},\n 'cellClasses':['label', ''],\n 'addTxt':'Edit',\n 'addFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(M.ciniki_musicfestivals_main.registration.competitor1_id, 5);',\n 'changeTxt':'Change',\n 'changeFn':'M.ciniki_musicfestivals_main.registration.addCompetitor(0, 5);',\n }, */\n 'invoice_details':{'label':'Invoice', 'type':'simplegrid', 'num_cols':2,\n 'cellClasses':['label', ''],\n },\n '_class':{'label':'Registration', 'fields':{\n// 'status':{'label':'Status', 'required':'yes', 'type':'toggle', 'toggles':{'5':'Draft', '10':'Applied', '50':'Paid', '60':'Cancelled'}},\n// 'payment_type':{'label':'Payment', 'type':'toggle', 'toggles':{'20':'Square', '50':'Visa', '55':'Mastercard', '100':'Cash', '105':'Cheque', '110':'Email', '120':'Other', '121':'Online'}},\n 'class_id':{'label':'Class', 'required':'yes', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}, \n 'onchangeFn':'M.ciniki_musicfestivals_main.registration.updateForm',\n },\n 'title1':{'label':'Title', 'type':'text'},\n 'perf_time1':{'label':'Perf Time', 'type':'minsec', 'size':'small'},\n 'title2':{'label':'2nd Title', 'type':'text',\n 'visible':'no',\n },\n 'perf_time2':{'label':'2nd Time', 'type':'minsec', 'max_minutes':30, 'second_interval':5, 'size':'small',\n 'visible':'no',\n },\n 'title3':{'label':'3rd Title', 'type':'text',\n 'visible':'no',\n },\n 'perf_time3':{'label':'3rd Time', 'type':'minsec', 'size':'small',\n 'visible':'no',\n },\n 'fee':{'label':'Fee', 'type':'text', 'size':'small'},\n 'participation':{'label':'Participate', 'type':'select', \n 'visible':function() { return (M.ciniki_musicfestivals_main.registration.data.festival.flags&0x12) > 0 ? 'yes' : 'no'},\n 'onchangeFn':'M.ciniki_musicfestivals_main.registration.updateForm',\n 'options':{\n '0':'in person on a date to be scheduled',\n '1':'virtually and submit a video online',\n }},\n 'video_url1':{'label':'1st Video', 'type':'text', \n 'visible':'no',\n },\n 'music_orgfilename1':{'label':'1st Music', 'type':'file',\n 'visible':'no',\n 'deleteFn':'M.ciniki_musicfestivals_main.registration.downloadMusic(1);',\n },\n 'video_url2':{'label':'2nd Video', 'type':'text', \n 'visible':'no',\n },\n 'music_orgfilename2':{'label':'2nd Music', 'type':'file',\n 'visible':'no',\n 'deleteFn':'M.ciniki_musicfestivals_main.registration.downloadMusic(2);',\n },\n 'video_url3':{'label':'3rd Video', 'type':'text', \n 'visible':'no',\n },\n 'music_orgfilename3':{'label':'3rd Music', 'type':'file',\n 'visible':'no',\n 'deleteFn':'M.ciniki_musicfestivals_main.registration.downloadMusic(3);',\n },\n 'placement':{'label':'Placement', 'type':'text',\n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x08); },\n },\n }},\n '_tags':{'label':'Tags', \n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x2000); },\n 'fields':{\n 'tags':{'label':'', 'hidelabel':'yes', 'type':'tags', 'tags':[], 'hint':'Enter a new tag:'},\n }},\n/* 'music_buttons':{'label':'', \n 'visible':function() { return (M.ciniki_musicfestivals_main.registration.data.festival.flags&0x02) == 0x02 ? 'yes' : 'no'},\n 'buttons':{\n 'add':{'label':'Upload Music PDF', 'fn':'M.ciniki_musicfestivals_main.registration.uploadPDF();',\n 'visible':function() { return M.ciniki_musicfestivals_main.registration.data.music_orgfilename == '' ? 'yes' : 'no'},\n },\n 'upload':{'label':'Replace Music PDF', 'fn':'M.ciniki_musicfestivals_main.registration.uploadPDF();',\n 'visible':function() { return M.ciniki_musicfestivals_main.registration.data.music_orgfilename != '' ? 'yes' : 'no'},\n },\n 'download':{'label':'Download PDF', 'fn':'M.ciniki_musicfestivals_main.registration.downloadPDF();',\n 'visible':function() { return M.ciniki_musicfestivals_main.registration.data.music_orgfilename != '' ? 'yes' : 'no'},\n },\n }}, */\n '_notes':{'label':'Registration Notes', 'fields':{\n 'notes':{'label':'', 'hidelabel':'yes', 'type':'textarea'},\n }},\n '_internal_notes':{'label':'Internal Admin Notes', 'fields':{\n 'internal_notes':{'label':'', 'hidelabel':'yes', 'type':'textarea'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.registration.save();'},\n 'printcert':{'label':'Download Certificate PDF', \n 'visible':function() {return M.ciniki_musicfestivals_main.registration.registration_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.registration.printCert();'},\n 'printcomments':{'label':'Download Comments PDF', \n 'visible':function() {return M.ciniki_musicfestivals_main.registration.registration_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.registration.printComments();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.registration.registration_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.registration.remove();'},\n }},\n };\n this.registration.fieldValue = function(s, i, d) { \n// if( i == 'music_orgfilename' ) {\n// if( this.data[i] == '' ) {\n// return '<button>Upload</button>';\n// } else {\n// return this.data[i] + ' <button>Upload</button>';\n// }\n// }\n return this.data[i]; \n }\n this.registration.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.registrationHistory', 'args':{'tnid':M.curTenantID, 'registration_id':this.registration_id, 'field':i}};\n }\n this.registration.cellValue = function(s, i, j, d) {\n if( s == 'competitor1_details' || s == 'competitor2_details' || s == 'competitor3_details' || s == 'competitor4_details' ) {\n switch(j) {\n case 0 : return d.label;\n case 1 : \n if( d.label == 'Email' ) {\n return M.linkEmail(d.value);\n } else if( d.label == 'Address' ) {\n return d.value.replace(/\\n/g, '<br/>');\n }\n return d.value;\n }\n }\n if( s == 'teacher_details' ) {\n switch(j) {\n case 0: return d.detail.label;\n case 1:\n if( d.detail.label == 'Email' ) {\n return M.linkEmail(d.detail.value);\n } else if( d.detail.label == 'Address' ) {\n return d.detail.value.replace(/\\n/g, '<br/>');\n }\n return d.detail.value;\n }\n }\n if( s == 'invoice_details' ) {\n switch(j) {\n case 0: return d.label;\n case 1: return d.value.replace(/\\n/, '<br/>');\n }\n }\n }\n this.registration.rowFn = function(s, i, d) {\n if( s == 'invoice_details' && this._source != 'invoice' && this._source != 'pos' ) {\n return 'M.startApp(\\'ciniki.sapos.invoice\\',null,\\'M.ciniki_musicfestivals_main.registration.open();\\',\\'mc\\',{\\'invoice_id\\':\\'' + this.data.invoice_id + '\\'});';\n }\n }\n this.registration.switchTab = function(t) {\n this.sections._tabs.selected = t;\n this.refreshSection('_tabs');\n this.showHideSection('_display_name');\n this.showHideSection('competitor2_details');\n this.showHideSection('competitor3_details');\n this.showHideSection('competitor4_details');\n// this.showHideSection('competitor5_details');\n }\n this.registration.updateForm = function(s, i, cf) {\n var festival = this.data.festival;\n var cid = this.formValue('class_id');\n var participation = this.formValue('participation');\n for(var i in this.classes) {\n if( this.classes[i].id == cid ) {\n var c = this.classes[i];\n if( cf == null ) {\n if( (festival.flags&0x10) == 0x10 && participation == 2 && c.earlybird_plus_fee > 0 ) {\n this.setFieldValue('fee', c.earlybird_plus_fee);\n } else if( (festival.flags&0x10) == 0x10 && participation == 2 && c.plus_fee > 0 ) {\n this.setFieldValue('fee', c.plus_fee);\n } else if( (festival.flags&0x04) == 0x04 && participation == 1 ) {\n this.setFieldValue('fee', c.virtual_fee);\n } else if( festival.earlybird == 'yes' && c.earlybird_fee > 0 ) {\n this.setFieldValue('fee', c.earlybird_fee);\n } else {\n this.setFieldValue('fee', c.fee);\n }\n }\n\n this.sections._class.fields.title2.visible = (c.flags&0x1000) == 0x1000 ? 'yes' : 'no';\n this.sections._class.fields.perf_time2.visible = (c.flags&0x1000) == 0x1000 ? 'yes' : 'no';\n this.sections._class.fields.title3.visible = (c.flags&0x4000) == 0x4000 ? 'yes' : 'no';\n this.sections._class.fields.perf_time3.visible = (c.flags&0x4000) == 0x4000 ? 'yes' : 'no';\n this.sections._class.fields.video_url1.visible = (participation == 1 ? 'yes' : 'no');\n this.sections._class.fields.video_url2.visible = (participation == 1 && (c.flags&0x1000) == 0x1000 ? 'yes' : 'no');\n this.sections._class.fields.video_url3.visible = (participation == 1 && (c.flags&0x4000) == 0x4000 ? 'yes' : 'no');\n this.sections._class.fields.music_orgfilename1.visible = (participation == 1 ? 'yes' : 'no');\n this.sections._class.fields.music_orgfilename2.visible = (participation == 1 && (c.flags&0x1000) == 0x1000 ? 'yes' : 'no');\n this.sections._class.fields.music_orgfilename3.visible = (participation == 1 && (c.flags&0x4000) == 0x4000 ? 'yes' : 'no');\n\n this.sections._display_name.visible = (c.flags&0x70) > 0 ? 'yes' : 'hidden';\n this.sections.competitor2_details.visible = (c.flags&0x10) == 0x10 ? 'yes' : 'hidden';\n this.sections.competitor3_details.visible = (c.flags&0x20) == 0x20 ? 'yes' : 'hidden';\n this.sections.competitor4_details.visible = (c.flags&0x40) == 0x40 ? 'yes' : 'hidden';\n this.showHideSection('competitor2_details');\n this.showHideSection('competitor3_details');\n this.showHideSection('competitor4_details');\n this.showHideSection('_display_name');\n this.showHideFormField('_class', 'title2');\n this.showHideFormField('_class', 'perf_time2');\n this.showHideFormField('_class', 'title3');\n this.showHideFormField('_class', 'perf_time3');\n this.showHideFormField('_class', 'video_url1');\n this.showHideFormField('_class', 'video_url2');\n this.showHideFormField('_class', 'video_url3');\n this.showHideFormField('_class', 'music_orgfilename1');\n this.showHideFormField('_class', 'music_orgfilename2');\n this.showHideFormField('_class', 'music_orgfilename3');\n }\n }\n }\n this.registration.addCompetitor = function(cid,c) {\n this.save(\"M.ciniki_musicfestivals_main.competitor.open('M.ciniki_musicfestivals_main.registration.updateCompetitor(\" + c + \");',\" + cid + \",\" + this.festival_id + \",null,M.ciniki_musicfestivals_main.registration.data.billing_customer_id);\");\n }\n this.registration.updateCompetitor = function(c) {\n var p = M.ciniki_musicfestivals_main.competitor;\n if( this['competitor' + c + '_id'] != p.competitor_id ) {\n this['competitor' + c + '_id'] = p.competitor_id;\n this.save(\"M.ciniki_musicfestivals_main.registration.open();\");\n } else { \n this.open();\n }\n/*\n M.api.getJSONCb('ciniki.musicfestivals.competitorGet', {'tnid':M.curTenantID, 'competitor_id':this['competitor'+c+'_id']}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.registration;\n p.data['competitor'+c+'_details'] = rsp.details;\n if( p['competitor' + c + '_id'] == 0 ) {\n p.sections['competitor'+c+'_details'].addTxt = '';\n p.sections['competitor'+c+'_details'].changeTxt = 'Add';\n } else {\n p.sections['competitor'+c+'_details'].addTxt = 'Edit';\n p.sections['competitor'+c+'_details'].changeTxt = 'Change';\n }\n p.refreshSection('competitor'+c+'_details');\n p.show();\n }); */\n }\n this.registration.updateTeacher = function(cid) {\n if( cid != null ) { \n this.teacher_customer_id = cid;\n if( this.teacher_customer_id > 0 ) {\n M.api.getJSONCb('ciniki.customers.customerDetails', {'tnid':M.curTenantID, 'customer_id':this.teacher_customer_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.registration;\n p.data.teacher_details = rsp.details;\n if( p.customer_id == 0 ) {\n p.sections.teacher_details.addTxt = '';\n p.sections.teacher_details.changeTxt = 'Add';\n } else {\n p.sections.teacher_details.addTxt = 'Edit';\n p.sections.teacher_details.changeTxt = 'Change';\n }\n p.refreshSection('teacher_details');\n p.show();\n });\n } else {\n this.data.teacher_details = [];\n this.sections.teacher_details.addTxt = '';\n this.sections.teacher_details.changeTxt = 'Add';\n this.refreshSection('teacher_details');\n this.show();\n }\n } else {\n this.show();\n }\n }\n this.registration.printCert = function() {\n M.api.openFile('ciniki.musicfestivals.registrationCertificatesPDF', {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'registration_id':this.registration_id});\n }\n this.registration.printComments = function() {\n M.api.openFile('ciniki.musicfestivals.registrationCommentsPDF', {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'registration_id':this.registration_id});\n }\n/* this.registration.uploadPDF = function() {\n if( this.upload == null ) {\n this.upload = M.aE('input', this.panelUID + '_music_orgfilename_upload', 'image_uploader');\n this.upload.setAttribute('name', 'music_orgfilename');\n this.upload.setAttribute('type', 'file');\n this.upload.setAttribute('onchange', this.panelRef + '.uploadFile();');\n }\n this.upload.value = '';\n this.upload.click();\n }\n this.registration.uploadFile = function() {\n var f = this.upload;\n M.api.postJSONFile('ciniki.musicfestivals.registrationMusicAdd', \n {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'registration_id':this.registration_id}, \n f.files[0], \n function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.registration;\n p.data.music_orgfilename = rsp.registration.music_orgfilename;\n// p.refreshSection('music_buttons');\n p.setFieldValue('music_orgfilename', rsp.registration.music_orgfilename);\n });\n } */\n this.registration.downloadMusic = function(i) {\n M.api.openFile('ciniki.musicfestivals.registrationMusicPDF',{'tnid':M.curTenantID, 'registration_id':this.registration_id, 'num':i});\n }\n// this.registration.downloadPDF = function() {\n// M.api.openFile('ciniki.musicfestivals.registrationMusicPDF',{'tnid':M.curTenantID, 'registration_id':this.registration_id});\n// }\n this.registration.open = function(cb, rid, tid, cid, fid, list, source) {\n if( rid != null ) { this.registration_id = rid; }\n if( tid != null ) { this.teacher_customer_id = tid; }\n if( fid != null ) { this.festival_id = fid; }\n if( cid != null ) { this.class_id = cid; }\n if( list != null ) { this.nplist = list; }\n if( source != null ) { this._source = source; }\n M.api.getJSONCb('ciniki.musicfestivals.registrationGet', {'tnid':M.curTenantID, 'registration_id':this.registration_id, \n 'teacher_customer_id':this.teacher_customer_id, 'festival_id':this.festival_id, 'class_id':this.class_id, \n }, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.registration;\n p.data = rsp.registration;\n p.classes = rsp.classes;\n if( p.festival_id == 0 ) {\n p.festival_id = rsp.registration.festival_id;\n }\n// p.sections._tabs.selected = rsp.registration.rtype;\n p.sections._class.fields.class_id.options = rsp.classes;\n p.sections._class.fields.class_id.options.unshift({'id':0, 'name':''});\n p.teacher_customer_id = parseInt(rsp.registration.teacher_customer_id);\n if( p.teacher_customer_id == 0 ) {\n p.sections.teacher_details.addTxt = '';\n p.sections.teacher_details.changeTxt = 'Add';\n } else {\n p.sections.teacher_details.addTxt = 'Edit';\n p.sections.teacher_details.changeTxt = 'Change';\n }\n for(var i = 1; i<= 4; i++) {\n p['competitor' + i + '_id'] = parseInt(rsp.registration['competitor' + i + '_id']);\n if( p['competitor' + i + '_id'] == 0 ) {\n p.sections['competitor' + i + '_details'].addTxt = '';\n p.sections['competitor' + i + '_details'].changeTxt = 'Add';\n } else {\n p.sections['competitor' + i + '_details'].addTxt = 'Edit';\n p.sections['competitor' + i + '_details'].changeTxt = 'Change';\n }\n }\n if( (p.data.festival.flags&0x10) == 0x10 ) {\n p.sections._class.fields.participation.options = {\n '0':'Regular Adjudication',\n '2':'Adjudication Plus',\n };\n }\n else if( (p.data.festival.flags&0x02) == 0x02 ) {\n p.sections._class.fields.participation.options = {\n '0':'in person on a date to be scheduled',\n '1':'virtually and submit a video online',\n };\n if( p.data.festival['inperson-choice-msg'] != null && p.data.festival['inperson-choice-msg'] != '' ) {\n p.sections._class.fields.participation.options[0] = p.data.festival['inperson-choice-msg'];\n }\n if( p.data.festival['virtual-choice-msg'] != null && p.data.festival['virtual-choice-msg'] != '' ) {\n p.sections._class.fields.participation.options[1] = p.data.festival['virtual-choice-msg'];\n }\n }\n if( rsp.tags != null ) {\n p.sections._tags.fields.tags.tags = rsp.tags;\n }\n p.refresh();\n p.show(cb);\n p.updateForm(null,null,'no');\n });\n }\n this.registration.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.registration.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.formValue('class_id') == 0 ) {\n M.alert(\"You must select a class.\");\n return false;\n }\n// if( this.competitor1_id == 0 ) {\n// M.alert(\"You must have a competitor.\");\n// return false;\n// }\n if( this.registration_id > 0 ) {\n var c = this.serializeFormData('no');\n if( this.teacher_customer_id != this.data.teacher_customer_id ) {\n c.append('teacher_customer_id', this.teacher_customer_id);\n }\n if( this.competitor1_id != this.data.competitor1_id ) { c.append('competitor1_id', this.competitor1_id); }\n if( this.competitor2_id != this.data.competitor2_id ) { c.append('competitor2_id', this.competitor2_id); }\n if( this.competitor3_id != this.data.competitor3_id ) { c.append('competitor3_id', this.competitor3_id); }\n if( this.competitor4_id != this.data.competitor4_id ) { c.append('competitor4_id', this.competitor4_id); }\n// if( this.competitor5_id != this.data.competitor5_id ) { c.append('competitor5_id', this.competitor5_id); }\n if( c != '' ) {\n \n M.api.postJSONFormData('ciniki.musicfestivals.registrationUpdate', {'tnid':M.curTenantID, 'registration_id':this.registration_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n c += '&teacher_customer_id=' + this.teacher_customer_id;\n c += '&competitor1_id=' + this.competitor1_id;\n c += '&competitor2_id=' + this.competitor2_id;\n c += '&competitor3_id=' + this.competitor3_id;\n c += '&competitor4_id=' + this.competitor4_id;\n// c += '&competitor5_id=' + this.competitor5_id;\n M.api.postJSONCb('ciniki.musicfestivals.registrationAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.registration.registration_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.registration.remove = function() {\n var msg = 'Are you sure you want to remove this registration?';\n if( this.data.invoice_id > 0 && this.data.invoice_status >= 50 ) {\n msg = '**WARNING** Removing this registration will NOT remove the item from the Invoice. You will need make sure they have received a refund for the registration.';\n }\n M.confirm(msg,null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.registrationDelete', {'tnid':M.curTenantID, 'registration_id':M.ciniki_musicfestivals_main.registration.registration_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.registration.close();\n });\n });\n }\n this.registration.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.registration_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.registration.save(\\'M.ciniki_musicfestivals_main.registration.open(null,' + this.nplist[this.nplist.indexOf('' + this.registration_id) + 1] + ');\\');';\n }\n return null;\n }\n this.registration.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.registration_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.registration.save(\\'M.ciniki_musicfestivals_main.registration_id.open(null,' + this.nplist[this.nplist.indexOf('' + this.registration_id) - 1] + ');\\');';\n }\n return null;\n }\n this.registration.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.registration.save();');\n this.registration.addClose('Cancel');\n this.registration.addButton('next', 'Next');\n this.registration.addLeftButton('prev', 'Prev');\n\n\n //\n // The panel to add/edit a competitor\n //\n this.competitor = new M.panel('Competitor', 'ciniki_musicfestivals_main', 'competitor', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.competitor');\n this.competitor.data = null;\n this.competitor.festival_id = 0;\n this.competitor.competitor_id = 0;\n this.competitor.billing_customer_id = 0;\n this.competitor.nplist = [];\n this.competitor.sections = {\n '_ctype':{'label':'', 'type':'paneltabs', 'selected':10, 'aside':'yes', 'tabs':{\n '10':{'label':'Individual', 'fn':'M.ciniki_musicfestivals_main.competitor.switchType(\"10\");'},\n '50':{'label':'Group/Ensemble', 'fn':'M.ciniki_musicfestivals_main.competitor.switchType(\"50\");'},\n }},\n 'general':{'label':'Competitor', 'aside':'yes', 'fields':{\n 'first':{'label':'First Name', 'required':'no', 'type':'text', 'livesearch':'yes', 'visible':'yes'},\n 'last':{'label':'Last Name', 'required':'no', 'type':'text', 'livesearch':'yes', 'visible':'yes'},\n 'name':{'label':'Name', 'required':'yes', 'type':'text', 'livesearch':'yes', 'visible':'hidden'},\n 'public_name':{'label':'Public Name', 'type':'text'},\n 'pronoun':{'label':'Pronoun', 'type':'text'},\n 'conductor':{'label':'Conductor', 'type':'text', 'visible':'no'},\n 'num_people':{'label':'# People', 'type':'number', 'size':'small', 'visible':'no'},\n 'parent':{'label':'Parent', 'type':'text', 'visible':'yes'},\n }},\n '_other':{'label':'', 'aside':'yes', 'fields':{\n 'age':{'label':'Age', 'type':'text'},\n 'study_level':{'label':'Study/Level', 'type':'text'},\n 'instrument':{'label':'Instrument', 'type':'text'},\n 'flags1':{'label':'Waiver', 'type':'flagtoggle', 'bit':0x01, 'field':'flags', 'toggles':{'':'Unsigned', 'signed':'Signed'}},\n }},\n '_tabs':{'label':'', 'type':'paneltabs', 'selected':'contact', 'visible':'yes',\n 'tabs':{\n 'contact':{'label':'Contact Info', 'fn':'M.ciniki_musicfestivals_main.competitor.switchTab(\"contact\");'},\n 'emails':{'label':'Emails', 'fn':'M.ciniki_musicfestivals_main.competitor.switchTab(\"emails\");'},\n 'registrations':{'label':'Registrations', 'fn':'M.ciniki_musicfestivals_main.competitor.switchTab(\"registrations\");'},\n }},\n '_address':{'label':'Contact Info', \n 'visible':function() { return M.ciniki_musicfestivals_main.competitor.sections._tabs.selected == 'contact' ? 'yes' : 'hidden';},\n 'fields':{\n 'address':{'label':'Address', 'type':'text'},\n 'city':{'label':'City', 'type':'text', 'size':'small'},\n 'province':{'label':'Province', 'type':'text', 'size':'small'},\n 'postal':{'label':'Postal Code', 'type':'text', 'size':'small'},\n 'country':{'label':'Country', 'type':'text', 'size':'small'},\n 'phone_home':{'label':'Home Phone', 'type':'text', 'size':'small'},\n 'phone_cell':{'label':'Cell Phone', 'type':'text', 'size':'small'},\n 'email':{'label':'Email', 'type':'text'},\n }},\n '_notes':{'label':'Competitor Notes', 'aside':'no', \n 'visible':function() { return M.ciniki_musicfestivals_main.competitor.sections._tabs.selected == 'contact' ? 'yes' : 'hidden';},\n 'fields':{\n 'notes':{'label':'', 'hidelabel':'yes', 'type':'textarea'},\n }},\n 'messages':{'label':'Draft Emails', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.competitor.sections._tabs.selected == 'emails' ? 'yes' : 'hidden';},\n 'headerValues':['Status', 'Subject'],\n 'noData':'No drafts or scheduled emails',\n 'addTxt':'Send Email',\n 'addFn':'M.ciniki_musicfestivals_main.competitor.save(\"M.ciniki_musicfestivals_main.competitor.addmessage();\");',\n },\n 'emails':{'label':'Send Emails', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.competitor.sections._tabs.selected == 'emails' ? 'yes' : 'hidden';},\n 'headerValues':['Date Sent', 'Subject'],\n 'noData':'No emails sent',\n },\n 'registrations':{'label':'Registrations', 'type':'simplegrid', 'num_cols':5,\n 'visible':function() { return M.ciniki_musicfestivals_main.competitor.sections._tabs.selected == 'registrations' ? 'yes' : 'hidden';},\n 'headerValues':['Category', 'Code', 'Class', 'Status'],\n 'noData':'No registrations',\n },\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.competitor.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.competitor.competitor_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.competitor.remove();'},\n }},\n };\n this.competitor.fieldValue = function(s, i, d) { return this.data[i]; }\n this.competitor.switchType = function(t) {\n this.sections._ctype.selected = t;\n if( t == 50 ) {\n this.sections.general.fields.first.visible = 'no';\n this.sections.general.fields.last.visible = 'no';\n this.sections.general.fields.name.visible = 'yes';\n this.sections.general.fields.public_name.visible = 'no';\n this.sections.general.fields.pronoun.visible = 'no';\n this.sections.general.fields.conductor.visible = 'yes';\n this.sections.general.fields.num_people.visible = 'yes';\n this.sections.general.fields.parent.label = 'Contact Person';\n } else {\n this.sections.general.fields.first.visible = 'yes';\n this.sections.general.fields.last.visible = 'yes';\n this.sections.general.fields.name.visible = 'no';\n this.sections.general.fields.public_name.visible = 'yes';\n this.sections.general.fields.pronoun.visible = M.modFlagSet('ciniki.musicfestivals', 0x80);\n this.sections.general.fields.conductor.visible = 'no';\n this.sections.general.fields.num_people.visible = 'no';\n this.sections.general.fields.parent.label = 'Parent';\n }\n this.showHideFormField('general', 'first');\n this.showHideFormField('general', 'last');\n this.showHideFormField('general', 'name');\n this.showHideFormField('general', 'public_name');\n this.showHideFormField('general', 'pronoun');\n this.showHideFormField('general', 'conductor');\n this.showHideFormField('general', 'num_people');\n this.showHideFormField('general', 'parent');\n this.refreshSections(['_ctype']);\n }\n this.competitor.switchTab = function(t) {\n this.sections._tabs.selected = t;\n this.refreshSections(['_tabs', '_address','_notes','messages', 'emails', 'registrations']);\n }\n this.competitor.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.competitorHistory', 'args':{'tnid':M.curTenantID, 'competitor_id':this.competitor_id, 'field':i}};\n }\n this.competitor.liveSearchCb = function(s, i, value) {\n if( i == 'name' || i == 'first' || i == 'last' ) {\n M.api.getJSONBgCb('ciniki.musicfestivals.competitorSearch', \n {'tnid':M.curTenantID, 'start_needle':value, 'limit':25}, function(rsp) { \n M.ciniki_musicfestivals_main.competitor.liveSearchShow(s, i, M.gE(M.ciniki_musicfestivals_main.competitor.panelUID + '_' + i), rsp.competitors); \n });\n }\n }\n this.competitor.liveSearchResultValue = function(s, f, i, j, d) {\n return d.name;\n }\n this.competitor.liveSearchResultRowFn = function(s, f, i, j, d) { \n return 'M.ciniki_musicfestivals_main.competitor.open(null,\\'' + d.id + '\\');';\n }\n this.competitor.cellValue = function(s, i, j, d) {\n if( s == 'messages' ) {\n switch(j) {\n case 0: return d.status_text;\n case 1: return d.subject;\n }\n }\n if( s == 'emails' ) {\n switch(j) {\n case 0: return (d.status != 30 ? d.status_text : d.date_sent);\n case 1: return d.subject;\n }\n }\n if( s == 'registrations' ) {\n switch(j) {\n case 0: return d.section_name + ' - ' + d.category_name;\n case 1: return d.class_code;\n case 2: return d.class_name;\n case 3: return d.status_text;\n }\n }\n }\n this.competitor.rowFn = function(s, i, d) {\n if( s == 'messages' ) {\n return 'M.ciniki_musicfestivals_main.competitor.save(\"M.ciniki_musicfestivals_main.message.open(\\'M.ciniki_musicfestivals_main.competitor.open();\\',\\'' + d.id + '\\');\");';\n }\n if( s == 'emails' ) {\n return 'M.startApp(\\'ciniki.mail.main\\',null,\\'M.ciniki_musicfestivals_main.competitor.reopen();\\',\\'mc\\',{\\'message_id\\':\\'' + d.id + '\\'});';\n }\n return '';\n }\n this.competitor.addmessage = function() {\n M.ciniki_musicfestivals_main.message.addnew('M.ciniki_musicfestivals_main.competitor.open();',this.festival_id,'ciniki.musicfestivals.competitor',this.competitor_id);\n }\n this.competitor.reopen = function() {\n this.show();\n }\n this.competitor.open = function(cb, cid, fid, list, bci) {\n if( cid != null ) { this.competitor_id = cid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n if( bci != null ) { this.billing_customer_id = bci; }\n M.api.getJSONCb('ciniki.musicfestivals.competitorGet', {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'competitor_id':this.competitor_id, 'emails':'yes', 'registrations':'yes'}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.competitor;\n p.data = rsp.competitor;\n if( p.competitor_id == 0 ) {\n p.sections._tabs.selected = 'contact';\n p.sections._tabs.visible = 'no';\n } else {\n p.sections._tabs.visible = 'yes';\n }\n p.sections._ctype.selected = rsp.competitor.ctype;\n p.refresh();\n p.show(cb);\n p.switchType(p.sections._ctype.selected);\n });\n }\n this.competitor.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.competitor.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.competitor_id > 0 ) {\n var c = this.serializeForm('no');\n if( this.sections._ctype.selected != this.data.ctype ) {\n c += '&ctype=' + this.sections._ctype.selected;\n }\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.competitorUpdate', {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'competitor_id':this.competitor_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n c += '&ctype=' + this.sections._ctype.selected;\n M.api.postJSONCb('ciniki.musicfestivals.competitorAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'billing_customer_id':this.billing_customer_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.competitor.competitor_name = rsp.name;\n M.ciniki_musicfestivals_main.competitor.competitor_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.competitor.remove = function() {\n M.confirm('Are you sure you want to remove competitor?',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.competitorDelete', {'tnid':M.curTenantID, 'competitor_id':M.ciniki_musicfestivals_main.competitor.competitor_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.competitor.close();\n });\n });\n }\n this.competitor.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.competitor_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.competitor.save(\\'M.ciniki_musicfestivals_main.competitor.open(null,' + this.nplist[this.nplist.indexOf('' + this.competitor_id) + 1] + ');\\');';\n }\n return null;\n }\n this.competitor.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.competitor_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.competitor.save(\\'M.ciniki_musicfestivals_main.competitor_id.open(null,' + this.nplist[this.nplist.indexOf('' + this.competitor_id) - 1] + ');\\');';\n }\n return null;\n }\n this.competitor.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.competitor.save();');\n this.competitor.addClose('Cancel');\n this.competitor.addButton('next', 'Next');\n this.competitor.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Schedule Section\n //\n this.schedulesection = new M.panel('Schedule Section', 'ciniki_musicfestivals_main', 'schedulesection', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.schedulesection');\n this.schedulesection.data = null;\n this.schedulesection.festival_id = 0;\n this.schedulesection.schedulesection_id = 0;\n this.schedulesection.nplist = [];\n this.schedulesection.sections = {\n 'general':{'label':'', 'fields':{\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'flags':{'label':'Options', 'type':'flags', 'flags':{\n '1':{'name':'Release Schedule'},\n '2':{'name':'Release Comments'},\n '3':{'name':'Release Certificates'},\n }},\n }},\n 'adjudicators':{'label':'Adjudicators', 'fields':{\n 'adjudicator1_id':{'label':'First', 'type':'select', 'complex_options':{'name':'name', 'value':'id'}, 'options':{}},\n 'adjudicator2_id':{'label':'Second', 'type':'select', 'complex_options':{'name':'name', 'value':'id'}, 'options':{}},\n 'adjudicator3_id':{'label':'Third', 'type':'select', 'complex_options':{'name':'name', 'value':'id'}, 'options':{}},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.schedulesection.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.schedulesection.schedulesection_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.schedulesection.remove();'},\n }},\n };\n this.schedulesection.fieldValue = function(s, i, d) { return this.data[i]; }\n this.schedulesection.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.scheduleSectionHistory', 'args':{'tnid':M.curTenantID, 'schedulesection_id':this.schedulesection_id, 'field':i}};\n }\n this.schedulesection.downloadPDF = function(f,i,n) {\n M.api.openFile('ciniki.musicfestivals.schedulePDF',{'tnid':M.curTenantID, 'festival_id':f, 'schedulesection_id':i, 'names':n});\n }\n this.schedulesection.open = function(cb, sid, fid, list) {\n if( sid != null ) { this.schedulesection_id = sid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.scheduleSectionGet', \n {'tnid':M.curTenantID, 'schedulesection_id':this.schedulesection_id, 'festival_id':this.festival_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.schedulesection;\n p.data = rsp.schedulesection;\n rsp.adjudicators.unshift({'id':'0', 'name':'None'});\n p.sections.adjudicators.fields.adjudicator1_id.options = rsp.adjudicators;\n p.sections.adjudicators.fields.adjudicator2_id.options = rsp.adjudicators;\n p.sections.adjudicators.fields.adjudicator3_id.options = rsp.adjudicators;\n p.refresh();\n p.show(cb);\n });\n }\n this.schedulesection.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.schedulesection.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.schedulesection_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.scheduleSectionUpdate', \n {'tnid':M.curTenantID, 'schedulesection_id':this.schedulesection_id, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.scheduleSectionAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.schedulesection.schedulesection_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.schedulesection.remove = function() {\n M.confirm('Are you sure you want to remove this section?',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.scheduleSectionDelete', {'tnid':M.curTenantID, 'schedulesection_id':M.ciniki_musicfestivals_main.schedulesection.schedulesection_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.schedulesection.close();\n });\n });\n }\n this.schedulesection.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.schedulesection_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.schedulesection.save(\\'M.ciniki_musicfestivals_main.schedulesection.open(null,' + this.nplist[this.nplist.indexOf('' + this.schedulesection_id) + 1] + ');\\');';\n }\n return null;\n }\n this.schedulesection.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.schedulesection_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.schedulesection.save(\\'M.ciniki_musicfestivals_main.schedulesection_id.open(null,' + this.nplist[this.nplist.indexOf('' + this.schedulesection_id) - 1] + ');\\');';\n }\n return null;\n }\n this.schedulesection.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.schedulesection.save();');\n this.schedulesection.addClose('Cancel');\n this.schedulesection.addButton('next', 'Next');\n this.schedulesection.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Schedule Division\n //\n this.scheduledivision = new M.panel('Schedule Division', 'ciniki_musicfestivals_main', 'scheduledivision', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.scheduledivision');\n this.scheduledivision.data = null;\n this.scheduledivision.festival_id = 0;\n this.scheduledivision.ssection_id = 0;\n this.scheduledivision.scheduledivision_id = 0;\n this.scheduledivision.nplist = [];\n this.scheduledivision.sections = {\n 'general':{'label':'', 'fields':{\n 'ssection_id':{'label':'Section', 'required':'yes', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}},\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'division_date':{'label':'Date', 'required':'yes', 'type':'date'},\n 'address':{'label':'Address', 'type':'text'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.scheduledivision.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.scheduledivision.scheduledivision_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.scheduledivision.remove();'},\n }},\n };\n this.scheduledivision.fieldValue = function(s, i, d) { return this.data[i]; }\n this.scheduledivision.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.scheduleDivisionHistory', 'args':{'tnid':M.curTenantID, 'scheduledivision_id':this.scheduledivision_id, 'field':i}};\n }\n this.scheduledivision.open = function(cb, sid, ssid, fid, list) {\n if( sid != null ) { this.scheduledivision_id = sid; }\n if( ssid != null ) { this.ssection_id = ssid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.scheduleDivisionGet', \n {'tnid':M.curTenantID, 'scheduledivision_id':this.scheduledivision_id, 'festival_id':this.festival_id, 'ssection_id':this.ssection_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.scheduledivision;\n p.data = rsp.scheduledivision;\n p.sections.general.fields.ssection_id.options = rsp.schedulesections;\n p.refresh();\n p.show(cb);\n });\n }\n this.scheduledivision.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.scheduledivision.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.scheduledivision_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.scheduleDivisionUpdate', \n {'tnid':M.curTenantID, 'scheduledivision_id':this.scheduledivision_id, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.scheduleDivisionAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.scheduledivision.scheduledivision_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.scheduledivision.remove = function() {\n M.confirm('Are you sure you want to remove this division?',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.scheduleDivisionDelete', {'tnid':M.curTenantID, 'scheduledivision_id':M.ciniki_musicfestivals_main.scheduledivision.scheduledivision_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.scheduledivision.close();\n });\n });\n }\n this.scheduledivision.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.scheduledivision_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.scheduledivision.save(\\'M.ciniki_musicfestivals_main.scheduledivision.open(null,' + this.nplist[this.nplist.indexOf('' + this.scheduledivision_id) + 1] + ');\\');';\n }\n return null;\n }\n this.scheduledivision.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.scheduledivision_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.scheduledivision.save(\\'M.ciniki_musicfestivals_main.scheduledivision_id.open(null,' + this.nplist[this.nplist.indexOf('' + this.scheduledivision_id) - 1] + ');\\');';\n }\n return null;\n }\n this.scheduledivision.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.scheduledivision.save();');\n this.scheduledivision.addClose('Cancel');\n this.scheduledivision.addButton('next', 'Next');\n this.scheduledivision.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Schedule Time Slot\n //\n this.scheduletimeslot = new M.panel('Schedule Time Slot', 'ciniki_musicfestivals_main', 'scheduletimeslot', 'mc', 'xlarge', 'sectioned', 'ciniki.musicfestivals.main.scheduletimeslot');\n this.scheduletimeslot.data = null;\n this.scheduletimeslot.festival_id = 0;\n this.scheduletimeslot.scheduletimeslot_id = 0;\n this.scheduletimeslot.sdivision_id = 0;\n this.scheduletimeslot.nplist = [];\n this.scheduletimeslot.sections = {\n 'general':{'label':'', 'fields':{\n 'sdivision_id':{'label':'Division', 'required':'yes', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}},\n 'slot_time':{'label':'Time', 'required':'yes', 'type':'text', 'size':'small'},\n 'class1_id':{'label':'Class 1', 'required':'yes', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}, \n 'onchangeFn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateRegistrations'},\n 'class2_id':{'label':'Class 2', 'required':'yes', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}, \n 'onchangeFn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateRegistrations'},\n 'class3_id':{'label':'Class 3', 'required':'yes', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}, \n 'onchangeFn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateRegistrations'},\n 'class4_id':{'label':'Class 4', 'required':'yes', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}, \n 'onchangeFn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateRegistrations'},\n 'class5_id':{'label':'Class 5', 'required':'yes', 'type':'select', 'complex_options':{'value':'id', 'name':'name'}, 'options':{}, \n 'onchangeFn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateRegistrations'},\n 'name':{'label':'Name', 'type':'text'},\n }},\n '_options':{'label':'',\n 'visible':function() {\n var p = M.ciniki_musicfestivals_main.scheduletimeslot;\n var c1 = p.formValue('class1_id');\n var c2 = p.formValue('class2_id');\n var c3 = p.formValue('class3_id');\n var c4 = p.formValue('class4_id');\n var c5 = p.formValue('class5_id');\n// if( c1 == null && p.data.class1_id > 0 && p.data.class2_id == 0 && p.data.class3_id == 0 && p.data.class4_id == 0 && p.data.class5_id == 0 ) { return 'yes'; }\n if( c1 == null && p.data.class1_id > 0 ) { \n return 'yes'; \n }\n// return (c1 != null && c1 > 0 && (c2 == null || c2 == 0) && (c3 == null || c3 == 0) ? 'yes' : 'hidden');\n return (c1 != null && c1 > 0 ? 'yes' : 'hidden');\n },\n 'fields':{\n 'flags1':{'label':'Split Class', 'type':'flagtoggle', 'default':'off', 'bit':0x01, 'field':'flags', \n 'fn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateRegistrations'},\n }},\n '_registrations1':{'label':'Class 1 Registrations', \n 'visible':'hidden',\n 'fields':{\n 'registrations1':{'label':'', 'hidelabel':'yes', 'type':'idlist', 'list':[], \n 'fn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateSorting',\n },\n }},\n '_registrations2':{'label':'Class 2 Registrations', \n 'visible':'hidden',\n 'fields':{\n 'registrations2':{'label':'', 'hidelabel':'yes', 'type':'idlist', 'list':[],\n 'fn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateSorting',\n },\n }},\n '_registrations3':{'label':'Class 3 Registrations', \n 'visible':'hidden',\n 'fields':{\n 'registrations3':{'label':'', 'hidelabel':'yes', 'type':'idlist', 'list':[],\n 'fn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateSorting',\n },\n }},\n '_registrations4':{'label':'Class 4 Registrations', \n 'visible':'hidden',\n 'fields':{\n 'registrations4':{'label':'', 'hidelabel':'yes', 'type':'idlist', 'list':[],\n 'fn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateSorting',\n },\n }},\n '_registrations5':{'label':'Class 5 Registrations', \n 'visible':'hidden',\n 'fields':{\n 'registrations5':{'label':'', 'hidelabel':'yes', 'type':'idlist', 'list':[],\n 'fn':'M.ciniki_musicfestivals_main.scheduletimeslot.updateSorting',\n },\n }},\n '_sorting1':{'label':'Class 1 Registrations - Sorting', \n 'visible':'hidden',\n 'fields':{\n }},\n '_sorting2':{'label':'Class 2 Registrations - Sorting', \n 'visible':'hidden',\n 'fields':{\n }},\n '_sorting3':{'label':'Class 3 Registrations - Sorting', \n 'visible':'hidden',\n 'fields':{\n }},\n '_sorting4':{'label':'Class 4 Registrations - Sorting', \n 'visible':'hidden',\n 'fields':{\n }},\n '_sorting5':{'label':'Class 5 Registrations - Sorting', \n 'visible':'hidden',\n 'fields':{\n }},\n '_description':{'label':'Description', 'fields':{\n 'description':{'label':'Description', 'hidelabel':'yes', 'type':'textarea'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.scheduletimeslot.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.scheduletimeslot.scheduletimeslot_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.scheduletimeslot.remove();'},\n }},\n };\n this.scheduletimeslot.fieldValue = function(s, i, d) { \n if( i == 'registrations1' || i == 'registrations2' || i == 'registrations3' || i == 'registrations4' || i == 'registrations5' ) {\n return this.data.registrations;\n }\n return this.data[i]; \n }\n this.scheduletimeslot.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.scheduleTimeslotHistory', 'args':{'tnid':M.curTenantID, 'scheduletimeslot_id':this.scheduletimeslot_id, 'field':i}};\n }\n this.scheduletimeslot.updateRegistrations = function() {\n var c1_id = this.formValue('class1_id');\n var c2_id = this.formValue('class2_id');\n var c3_id = this.formValue('class3_id');\n var c4_id = this.formValue('class4_id');\n var c5_id = this.formValue('class5_id');\n this.sections._registrations1.visible = 'hidden';\n this.sections._registrations2.visible = 'hidden';\n this.sections._registrations3.visible = 'hidden';\n this.sections._registrations4.visible = 'hidden';\n this.sections._registrations5.visible = 'hidden';\n if( this.formValue('flags1') == 'on' && this.formValue('class1_id') > 0 && this.data.classes != null ) {\n for(var i in this.data.classes) {\n if( this.data.classes[i].id == c1_id ) {\n if( this.data.classes[i].registrations != null ) {\n this.sections._registrations1.visible = 'yes';\n this.sections._registrations1.fields.registrations1.list = this.data.classes[i].registrations;\n }\n }\n if( this.data.classes[i].id == c2_id ) {\n if( this.data.classes[i].registrations != null ) {\n this.sections._registrations2.visible = 'yes';\n this.sections._registrations2.fields.registrations2.list = this.data.classes[i].registrations;\n }\n }\n if( this.data.classes[i].id == c3_id ) {\n if( this.data.classes[i].registrations != null ) {\n this.sections._registrations3.visible = 'yes';\n this.sections._registrations3.fields.registrations3.list = this.data.classes[i].registrations;\n }\n }\n if( this.data.classes[i].id == c4_id ) {\n if( this.data.classes[i].registrations != null ) {\n this.sections._registrations4.visible = 'yes';\n this.sections._registrations4.fields.registrations4.list = this.data.classes[i].registrations;\n }\n }\n if( this.data.classes[i].id == c5_id ) {\n if( this.data.classes[i].registrations != null ) {\n this.sections._registrations5.visible = 'yes';\n this.sections._registrations5.fields.registrations5.list = this.data.classes[i].registrations;\n }\n }\n }\n }\n this.showHideSection('_registrations1');\n this.showHideSection('_registrations2');\n this.showHideSection('_registrations3');\n this.showHideSection('_registrations4');\n this.showHideSection('_registrations5');\n if( this.sections._registrations1.visible == 'yes' ) {\n this.refreshSection('_registrations1');\n }\n if( this.sections._registrations2.visible == 'yes' ) {\n this.refreshSection('_registrations2');\n }\n if( this.sections._registrations3.visible == 'yes' ) {\n this.refreshSection('_registrations3');\n }\n if( this.sections._registrations4.visible == 'yes' ) {\n this.refreshSection('_registrations4');\n }\n if( this.sections._registrations5.visible == 'yes' ) {\n this.refreshSection('_registrations5');\n }\n this.updateSorting();\n }\n this.scheduletimeslot.updateSorting = function() {\n var c1_id = this.formValue('class1_id');\n var c2_id = this.formValue('class2_id');\n var c3_id = this.formValue('class3_id');\n var c4_id = this.formValue('class4_id');\n var c5_id = this.formValue('class5_id');\n // Update the class registrations\n this.sections._sorting1.fields = {};\n this.sections._sorting2.fields = {};\n this.sections._sorting3.fields = {};\n this.sections._sorting4.fields = {};\n this.sections._sorting5.fields = {};\n this.sections._sorting1.visible = 'hidden';\n this.sections._sorting2.visible = 'hidden';\n this.sections._sorting3.visible = 'hidden';\n this.sections._sorting4.visible = 'hidden';\n this.sections._sorting5.visible = 'hidden';\n for(var i in this.data.classes) {\n if( c1_id > 0 && this.data.classes[i].id == c1_id ) {\n for(var j in this.data.classes[i].registrations) {\n if( this.formValue('flags1') == 'on' ) {\n var t = this.formValue('registrations1');\n if( t == '' ) {\n break;\n } \n var r = t.split(/,/);\n if( r.indexOf(this.data.classes[i].registrations[j].id) < 0 ) {\n continue;\n }\n }\n this.sections._sorting1.visible = 'yes';\n this.sections._sorting1.fields['seq_' + this.data.classes[i].registrations[j].id] = {\n 'label':this.data.classes[i].registrations[j].name + ' - ' + this.data.classes[i].registrations[j].title1,\n 'type':'text', \n 'size':'small',\n };\n this.data['seq_' + this.data.classes[i].registrations[j].id] = this.data.classes[i].registrations[j].timeslot_sequence;\n }\n }\n if( c2_id > 0 && this.data.classes[i].id == c2_id ) {\n for(var j in this.data.classes[i].registrations) {\n if( this.formValue('flags1') == 'on' ) {\n var t = this.formValue('registrations2');\n if( t == '' ) {\n break;\n } \n var r = t.split(/,/);\n if( r.indexOf(this.data.classes[i].registrations[j].id) < 0 ) {\n continue;\n }\n }\n this.sections._sorting2.visible = 'yes';\n this.sections._sorting2.fields['seq_' + this.data.classes[i].registrations[j].id] = {\n 'label':this.data.classes[i].registrations[j].name + ' - ' + this.data.classes[i].registrations[j].title1,\n 'type':'text', \n 'size':'small',\n };\n this.data['seq_' + this.data.classes[i].registrations[j].id] = this.data.classes[i].registrations[j].timeslot_sequence;\n }\n }\n if( c3_id > 0 && this.data.classes[i].id == c3_id ) {\n for(var j in this.data.classes[i].registrations) {\n if( this.formValue('flags1') == 'on' ) {\n var t = this.formValue('registrations3');\n if( t == '' ) {\n break;\n } \n var r = t.split(/,/);\n if( r.indexOf(this.data.classes[i].registrations[j].id) < 0 ) {\n continue;\n }\n }\n this.sections._sorting3.visible = 'yes';\n this.sections._sorting3.fields['seq_' + this.data.classes[i].registrations[j].id] = {\n 'label':this.data.classes[i].registrations[j].name + ' - ' + this.data.classes[i].registrations[j].title1,\n 'type':'text', \n 'size':'small',\n };\n this.data['seq_' + this.data.classes[i].registrations[j].id] = this.data.classes[i].registrations[j].timeslot_sequence;\n }\n }\n if( c4_id > 0 && this.data.classes[i].id == c4_id ) {\n for(var j in this.data.classes[i].registrations) {\n if( this.formValue('flags1') == 'on' ) {\n var t = this.formValue('registrations4');\n if( t == '' ) {\n break;\n } \n var r = t.split(/,/);\n if( r.indexOf(this.data.classes[i].registrations[j].id) < 0 ) {\n continue;\n }\n }\n this.sections._sorting4.visible = 'yes';\n this.sections._sorting4.fields['seq_' + this.data.classes[i].registrations[j].id] = {\n 'label':this.data.classes[i].registrations[j].name + ' - ' + this.data.classes[i].registrations[j].title1,\n 'type':'text', \n 'size':'small',\n };\n this.data['seq_' + this.data.classes[i].registrations[j].id] = this.data.classes[i].registrations[j].timeslot_sequence;\n }\n }\n if( c5_id > 0 && this.data.classes[i].id == c5_id ) {\n for(var j in this.data.classes[i].registrations) {\n if( this.formValue('flags1') == 'on' ) {\n var t = this.formValue('registrations5');\n if( t == '' ) {\n break;\n } \n var r = t.split(/,/);\n if( r.indexOf(this.data.classes[i].registrations[j].id) < 0 ) {\n continue;\n }\n }\n this.sections._sorting5.visible = 'yes';\n this.sections._sorting5.fields['seq_' + this.data.classes[i].registrations[j].id] = {\n 'label':this.data.classes[i].registrations[j].name + ' - ' + this.data.classes[i].registrations[j].title1,\n 'type':'text', \n 'size':'small',\n };\n this.data['seq_' + this.data.classes[i].registrations[j].id] = this.data.classes[i].registrations[j].timeslot_sequence;\n }\n }\n }\n this.showHideSection('_options');\n this.refreshSection('_sorting1');\n this.refreshSection('_sorting2');\n this.refreshSection('_sorting3');\n this.refreshSection('_sorting4');\n this.refreshSection('_sorting5');\n this.showHideSection('_sorting1');\n this.showHideSection('_sorting2');\n this.showHideSection('_sorting3');\n this.showHideSection('_sorting4');\n this.showHideSection('_sorting5'); \n return true;\n }\n this.scheduletimeslot.open = function(cb, sid, did, fid, list) {\n if( sid != null ) { this.scheduletimeslot_id = sid; }\n if( did != null ) { this.sdivision_id = did; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.scheduleTimeslotGet', \n {'tnid':M.curTenantID, 'scheduletimeslot_id':this.scheduletimeslot_id, 'festival_id':this.festival_id, 'sdivision_id':this.sdivision_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.scheduletimeslot;\n p.data = rsp.scheduletimeslot;\n p.data.classes = rsp.classes;\n p.sections.general.fields.sdivision_id.options = rsp.scheduledivisions;\n rsp.classes.unshift({'id':0, 'name':'No Class'});\n p.sections.general.fields.class1_id.options = rsp.classes;\n p.sections.general.fields.class2_id.options = rsp.classes;\n p.sections.general.fields.class3_id.options = rsp.classes;\n p.sections.general.fields.class4_id.options = rsp.classes;\n p.sections.general.fields.class5_id.options = rsp.classes;\n/* p.sections._registrations1.visible = 'hidden';\n if( rsp.scheduletimeslot.class1_id > 0 && rsp.classes != null ) {\n for(var i in rsp.classes) {\n if( rsp.classes[i].id == rsp.scheduletimeslot.class1_id ) {\n if( rsp.classes[i].registrations != null ) {\n if( (rsp.scheduletimeslot.flags&0x01) > 0 ) {\n p.sections._registrations1.visible = 'yes';\n }\n p.sections._registrations1.fields.registrations1.list = rsp.classes[i].registrations;\n }\n }\n }\n } */\n p.refresh();\n p.show(cb);\n p.updateRegistrations();\n });\n }\n this.scheduletimeslot.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.scheduletimeslot.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.scheduletimeslot_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.scheduleTimeslotUpdate', \n {'tnid':M.curTenantID, 'scheduletimeslot_id':this.scheduletimeslot_id, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.scheduleTimeslotAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.scheduletimeslot.scheduletimeslot_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.scheduletimeslot.remove = function() {\n M.confirm('Are you sure you want to remove timeslot?',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.scheduleTimeslotDelete', {'tnid':M.curTenantID, 'scheduletimeslot_id':M.ciniki_musicfestivals_main.scheduletimeslot.scheduletimeslot_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.scheduletimeslot.close();\n });\n });\n }\n this.scheduletimeslot.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.scheduletimeslot_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.scheduletimeslot.save(\\'M.ciniki_musicfestivals_main.scheduletimeslot.open(null,' + this.nplist[this.nplist.indexOf('' + this.scheduletimeslot_id) + 1] + ');\\');';\n }\n return null;\n }\n this.scheduletimeslot.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.scheduletimeslot_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.scheduletimeslot.save(\\'M.ciniki_musicfestivals_main.scheduletimeslot_id.open(null,' + this.nplist[this.nplist.indexOf('' + this.scheduletimeslot_id) - 1] + ');\\');';\n }\n return null;\n }\n this.scheduletimeslot.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.scheduletimeslot.save();');\n this.scheduletimeslot.addClose('Cancel');\n this.scheduletimeslot.addButton('next', 'Next');\n this.scheduletimeslot.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Schedule Time Slot Comments\n //\n this.timeslotcomments = new M.panel('Comments', 'ciniki_musicfestivals_main', 'timeslotcomments', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.timeslotcomments');\n this.timeslotcomments.data = null;\n this.timeslotcomments.festival_id = 0;\n this.timeslotcomments.timeslot_id = 0;\n this.timeslotcomments.nplist = [];\n this.timeslotcomments.sections = {};\n this.timeslotcomments.fieldValue = function(s, i, d) { return this.data[i]; }\n this.timeslotcomments.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.scheduleTimeslotHistory', 'args':{'tnid':M.curTenantID, 'scheduletimeslot_id':this.timeslot_id, 'field':i}};\n }\n this.timeslotcomments.cellValue = function(s, i, j, d) {\n switch(j) {\n case 0 : return d.label;\n case 1 : return d.value;\n }\n }\n this.timeslotcomments.open = function(cb, tid, fid, list) {\n if( tid != null ) { this.timeslot_id = tid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.scheduleTimeslotCommentsGet', \n {'tnid':M.curTenantID, 'timeslot_id':this.timeslot_id, 'festival_id':this.festival_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.timeslotcomments;\n p.data = rsp.timeslot;\n p.sections = {};\n for(var i in rsp.timeslot.registrations) {\n var registration = rsp.timeslot.registrations[i];\n p.sections['details_' + i] = {'label':'Registration', 'type':'simplegrid', 'num_cols':2, 'aside':'yes'};\n p.data['details_' + i] = [\n {'label':'Class', 'value':registration.reg_class_name},\n {'label':'Participant', 'value':registration.name},\n {'label':'Title', 'value':registration.title1},\n {'label':'Video', 'value':M.hyperlink(registration.video_url1)},\n {'label':'Music', 'value':registration.music_orgfilename1},\n ];\n if( (registration.reg_flags&0x1000) == 0x1000 ) {\n p.data['details_' + i].push({'label':'2nd Title', 'value':registration.title2});\n p.data['details_' + i].push({'label':'2nd Video', 'value':M.hyperlink(registration.video_url2)});\n p.data['details_' + i].push({'label':'2nd Music', 'value':registration.music_orgfilename2});\n }\n if( (registration.reg_flags&0x4000) == 0x4000 ) {\n p.data['details_' + i].push({'label':'3rd Title', 'value':registration.title3});\n p.data['details_' + i].push({'label':'3rd Video', 'value':M.hyperlink(registration.video_url3)});\n p.data['details_' + i].push({'label':'3rd Music', 'value':registration.music_orgfilename3});\n }\n // \n // Setup the comment, grade & score fields, could be for multiple adjudicators\n //\n for(var j in rsp.adjudicators) {\n p.sections['comments_' + i] = {'label':rsp.adjudicators[j].display_name, 'fields':{}};\n p.sections['comments_' + i].fields['comments_' + rsp.timeslot.registrations[i].id + '_' + rsp.adjudicators[j].id] = {\n 'label':'Comments', \n 'type':'textarea', \n 'size':'large',\n };\n// p.sections['comments_' + i].fields['grade_' + rsp.timeslot.registrations[i].id + '_' + rsp.adjudicators[j].id] = {\n// 'label':'Grade', \n// 'type':'text', \n// 'size':'small',\n// };\n p.sections['comments_' + i].fields['score_' + rsp.timeslot.registrations[i].id + '_' + rsp.adjudicators[j].id] = {\n 'label':'Mark', \n 'type':'text', \n 'size':'small',\n };\n/* if( M.modFlagOn('ciniki.musicfestivals', 0x08) ) {\n p.sections['comments_' + i].fields['placement_' + rsp.timeslot.registrations[i].id + '_' + rsp.adjudicators[j].id] = {\n 'label':'Placement', \n 'type':'text', \n 'size':'large',\n };\n }*/\n }\n }\n p.refresh();\n p.show(cb);\n });\n }\n this.timeslotcomments.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.timeslotcomments.close();'; }\n if( !this.checkForm() ) { return false; }\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.scheduleTimeslotCommentsUpdate', \n {'tnid':M.curTenantID, 'timeslot_id':this.timeslot_id, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n }\n this.timeslotcomments.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.timeslotcomments.save();');\n this.timeslotcomments.addClose('Cancel');\n\n\n //\n // Adjudicators\n //\n this.adjudicator = new M.panel('Adjudicator', 'ciniki_musicfestivals_main', 'adjudicator', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.adjudicator');\n this.adjudicator.data = null;\n this.adjudicator.festival_id = 0;\n this.adjudicator.adjudicator_id = 0;\n this.adjudicator.customer_id = 0;\n this.adjudicator.nplist = [];\n this.adjudicator.sections = {\n '_image_id':{'label':'Adjudicator Photo', 'type':'imageform', 'aside':'yes', 'fields':{\n 'image_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.adjudicator.setFieldValue('image_id', iid);\n return true;\n },\n 'addDropImageRefresh':'',\n 'deleteImage':function(fid) {\n M.ciniki_musicfestivals_main.adjudicator.setFieldValue(fid,0);\n return true;\n },\n },\n }}, \n 'customer_details':{'label':'Adjudicator', 'type':'simplegrid', 'num_cols':2, 'aside':'yes',\n 'cellClasses':['label', ''],\n 'addTxt':'Edit',\n 'addFn':'M.startApp(\\'ciniki.customers.edit\\',null,\\'M.ciniki_musicfestivals_main.adjudicator.updateCustomer();\\',\\'mc\\',{\\'next\\':\\'M.ciniki_musicfestivals_main.adjudicator.updateCustomer\\',\\'customer_id\\':M.ciniki_musicfestivals_main.adjudicator.data.customer_id});',\n 'changeTxt':'Change customer',\n 'changeFn':'M.startApp(\\'ciniki.customers.edit\\',null,\\'M.ciniki_musicfestivals_main.adjudicator.updateCustomer();\\',\\'mc\\',{\\'next\\':\\'M.ciniki_musicfestivals_main.adjudicator.updateCustomer\\',\\'customer_id\\':0});',\n },\n '_discipline':{'label':'Discipline', 'fields':{\n 'discipline':{'label':'', 'hidelabel':'yes', 'type':'text'},\n }},\n '_description':{'label':'Full Bio', 'fields':{\n 'description':{'label':'', 'hidelabel':'yes', 'type':'textarea', 'size':'xlarge'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.adjudicator.save();'},\n 'delete':{'label':'Remove Adjudicator', \n 'visible':function() {return M.ciniki_musicfestivals_main.adjudicator.adjudicator_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.adjudicator.remove();'},\n }},\n };\n this.adjudicator.fieldValue = function(s, i, d) { return this.data[i]; }\n this.adjudicator.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.adjudicatorHistory', 'args':{'tnid':M.curTenantID, 'adjudicator_id':this.adjudicator_id, 'field':i}};\n }\n this.adjudicator.cellValue = function(s, i, j, d) {\n if( s == 'customer_details' && j == 0 ) { return d.detail.label; }\n if( s == 'customer_details' && j == 1 ) {\n if( d.detail.label == 'Email' ) {\n return M.linkEmail(d.detail.value);\n } else if( d.detail.label == 'Address' ) {\n return d.detail.value.replace(/\\n/g, '<br/>');\n }\n return d.detail.value;\n }\n };\n this.adjudicator.open = function(cb, aid, cid, fid, list) {\n if( cb != null ) { this.cb = cb; }\n if( aid != null ) { this.adjudicator_id = aid; }\n if( cid != null ) { this.customer_id = cid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n if( aid != null && aid == 0 && cid != null && cid == 0 ) {\n M.startApp('ciniki.customers.edit',null,this.cb,'mc',{'next':'M.ciniki_musicfestivals_main.adjudicator.openCustomer', 'customer_id':0});\n return true;\n }\n M.api.getJSONCb('ciniki.musicfestivals.adjudicatorGet', {'tnid':M.curTenantID, 'customer_id':this.customer_id, 'adjudicator_id':this.adjudicator_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.adjudicator;\n p.data = rsp.adjudicator;\n if( rsp.adjudicator.id > 0 ) {\n p.festival_id = rsp.adjudicator.festival_id;\n }\n p.customer_id = rsp.adjudicator.customer_id;\n if( p.customer_id == 0 ) {\n p.sections.customer_details.addTxt = '';\n p.sections.customer_details.changeTxt = 'Add';\n } else {\n p.sections.customer_details.addTxt = 'Edit';\n p.sections.customer_details.changeTxt = 'Change';\n }\n p.refresh();\n p.show();\n });\n }\n this.adjudicator.openCustomer = function(cid) {\n this.open(null,null,cid);\n }\n this.adjudicator.updateCustomer = function(cid) {\n if( cid != null ) { this.customer_id = cid; }\n M.api.getJSONCb('ciniki.customers.customerDetails', {'tnid':M.curTenantID, 'customer_id':this.customer_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.adjudicator;\n p.data.customer_details = rsp.details;\n if( p.customer_id == 0 ) {\n p.sections.customer_details.addTxt = '';\n p.sections.customer_details.changeTxt = 'Add';\n } else {\n p.sections.customer_details.addTxt = 'Edit';\n p.sections.customer_details.changeTxt = 'Change';\n }\n p.refreshSection('customer_details');\n p.show();\n });\n }\n this.adjudicator.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.adjudicator.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.adjudicator_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.adjudicatorUpdate', {'tnid':M.curTenantID, 'adjudicator_id':this.adjudicator_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.adjudicatorAdd', {'tnid':M.curTenantID, 'customer_id':this.customer_id, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.adjudicator.adjudicator_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.adjudicator.remove = function() {\n M.confirm('Are you sure you want to remove adjudicator?',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.adjudicatorDelete', {'tnid':M.curTenantID, 'adjudicator_id':M.ciniki_musicfestivals_main.adjudicator.adjudicator_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.adjudicator.close();\n });\n });\n }\n this.adjudicator.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.adjudicator_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.adjudicator.save(\\'M.ciniki_musicfestivals_main.adjudicator.open(null,' + this.nplist[this.nplist.indexOf('' + this.adjudicator_id) + 1] + ');\\');';\n }\n return null;\n }\n this.adjudicator.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.adjudicator_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.adjudicator.save(\\'M.ciniki_musicfestivals_main.adjudicator_id.open(null,' + this.nplist[this.nplist.indexOf('' + this.adjudicator_id) - 1] + ');\\');';\n }\n return null;\n }\n this.adjudicator.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.adjudicator.save();');\n this.adjudicator.addClose('Cancel');\n this.adjudicator.addButton('next', 'Next');\n this.adjudicator.addLeftButton('prev', 'Prev');\n\n //\n // The panel to display the add form\n //\n this.addfile = new M.panel('Add File', 'ciniki_musicfestivals_main', 'addfile', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.addfile');\n this.addfile.default_data = {'type':'20'};\n this.addfile.festival_id = 0;\n this.addfile.data = {}; \n this.addfile.sections = {\n '_file':{'label':'File', 'fields':{\n 'uploadfile':{'label':'', 'type':'file', 'hidelabel':'yes'},\n }},\n 'info':{'label':'Information', 'type':'simpleform', 'fields':{\n 'name':{'label':'Title', 'type':'text'},\n 'webflags':{'label':'Website', 'type':'flags', 'default':'1', 'flags':{'1':{'name':'Visible'}}},\n }},\n '_save':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.addfile.save();'},\n }},\n };\n this.addfile.fieldValue = function(s, i, d) { \n if( this.data[i] != null ) { return this.data[i]; } \n return ''; \n };\n this.addfile.open = function(cb, eid) {\n this.reset();\n this.data = {'name':''};\n this.file_id = 0;\n this.festival_id = eid;\n this.refresh();\n this.show(cb);\n };\n this.addfile.save = function() {\n var c = this.serializeFormData('yes');\n if( c != '' ) {\n M.api.postJSONFormData('ciniki.musicfestivals.fileAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c,\n function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n } \n M.ciniki_musicfestivals_main.addfile.file_id = rsp.id;\n M.ciniki_musicfestivals_main.addfile.close();\n });\n } else {\n this.close();\n }\n };\n this.addfile.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.addfile.save();');\n this.addfile.addClose('Cancel');\n\n //\n // The panel to display the edit form\n //\n this.editfile = new M.panel('File', 'ciniki_musicfestivals_main', 'editfile', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.info.editfile');\n this.editfile.file_id = 0;\n this.editfile.data = null;\n this.editfile.sections = {\n 'info':{'label':'Details', 'type':'simpleform', 'fields':{\n 'name':{'label':'Title', 'type':'text'},\n 'webflags':{'label':'Website', 'type':'flags', 'default':'1', 'flags':{'1':{'name':'Visible'}}},\n }},\n '_save':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.editfile.save();'},\n 'download':{'label':'Download', 'fn':'M.ciniki_musicfestivals_main.editfile.download(M.ciniki_musicfestivals_main.editfile.file_id);'},\n 'delete':{'label':'Delete', 'fn':'M.ciniki_musicfestivals_main.editfile.remove();'},\n }},\n };\n this.editfile.fieldValue = function(s, i, d) { \n return this.data[i]; \n }\n this.editfile.sectionData = function(s) {\n return this.data[s];\n };\n this.editfile.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.fileHistory', 'args':{'tnid':M.curTenantID, 'file_id':this.file_id, 'field':i}};\n };\n this.editfile.open = function(cb, fid) {\n if( fid != null ) { this.file_id = fid; }\n M.api.getJSONCb('ciniki.musicfestivals.fileGet', {'tnid':M.curTenantID, 'file_id':this.file_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.editfile;\n p.data = rsp.file;\n p.refresh();\n p.show(cb);\n });\n };\n this.editfile.save = function() {\n var c = this.serializeFormData('no');\n if( c != '' ) {\n M.api.postJSONFormData('ciniki.musicfestivals.fileUpdate', {'tnid':M.curTenantID, 'file_id':this.file_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n } \n M.ciniki_musicfestivals_main.editfile.close();\n });\n }\n };\n this.editfile.remove = function() {\n M.confirm('Are you sure you want to delete \\'' + this.data.name + '\\'? All information about it will be removed and unrecoverable.',null,function() {\n M.api.getJSONCb('ciniki.musicfestivals.fileDelete', {'tnid':M.curTenantID, 'file_id':M.ciniki_musicfestivals_main.editfile.file_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n } \n M.ciniki_musicfestivals_main.editfile.close();\n });\n });\n };\n this.editfile.download = function(fid) {\n M.api.openFile('ciniki.musicfestivals.fileDownload', {'tnid':M.curTenantID, 'file_id':fid});\n };\n this.editfile.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.editfile.save();');\n this.editfile.addClose('Cancel');\n\n //\n // The panel to email a teacher their list of registrations\n //\n this.emailregistrations = new M.panel('Email Registrations', 'ciniki_musicfestivals_main', 'emailregistrations', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.emailregistrations');\n this.emailregistrations.data = {};\n this.emailregistrations.sections = {\n '_subject':{'label':'', 'type':'simpleform', 'aside':'yes', 'fields':{\n 'subject':{'label':'Subject', 'type':'text'},\n }},\n '_message':{'label':'Message', 'type':'simpleform', 'aside':'yes', 'fields':{\n 'message':{'label':'', 'hidelabel':'yes', 'type':'textarea', 'size':'large'},\n }},\n '_save':{'label':'', 'aside':'yes', 'buttons':{\n 'send':{'label':'Send', 'fn':'M.ciniki_musicfestivals_main.emailregistrations.send();'},\n }},\n 'registrations':{'label':'Registrations', 'type':'simplegrid', 'num_cols':5,\n 'headerValues':['Class', 'Registrant', 'Title', 'Time', 'Virtual'],\n 'cellClasses':['', '', '', '', ''],\n },\n };\n this.emailregistrations.fieldValue = function(s, i, d) { return ''; }\n this.emailregistrations.cellValue = function(s, i, j, d) {\n if( s == 'registrations' ) {\n switch (j) {\n case 0: return d.class_code;\n case 1: return d.display_name;\n case 2: return d.title1;\n case 3: return d.perf_time1;\n case 4: return (d.participation == 1 ? 'Virtual' : 'In Person');\n }\n }\n }\n this.emailregistrations.open = function(cb, reg) {\n this.sections.registrations.label = M.ciniki_musicfestivals_main.festival.sections.registrations.label;\n this.data.registrations = M.ciniki_musicfestivals_main.festival.data.registrations;\n this.refresh();\n this.show(cb);\n };\n this.emailregistrations.send = function() {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.registrationsEmailSend', \n {'tnid':M.curTenantID, 'teacher_id':M.ciniki_musicfestivals_main.festival.teacher_customer_id, 'festival_id':M.ciniki_musicfestivals_main.festival.festival_id}, c, \n function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n } \n M.ciniki_musicfestivals_main.emailregistrations.close();\n });\n }\n this.emailregistrations.addButton('send', 'Send', 'M.ciniki_musicfestivals_main.emailregistrations.send();');\n this.emailregistrations.addClose('Cancel');\n\n //\n // The panel to edit Sponsor\n //\n this.sponsor = new M.panel('Sponsor', 'ciniki_musicfestivals_main', 'sponsor', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.sponsor');\n this.sponsor.data = null;\n this.sponsor.festival_id = 0;\n this.sponsor.sponsor_id = 0;\n this.sponsor.nplist = [];\n this.sponsor.sections = {\n '_image_id':{'label':'Logo', 'type':'imageform', 'aside':'yes', 'fields':{\n 'image_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.sponsor.setFieldValue('image_id', iid);\n return true;\n },\n 'addDropImageRefresh':'',\n 'deleteImage':function(fid) {\n M.ciniki_musicfestivals_main.sponsor.setFieldValue(fid, 0);\n return true;\n },\n },\n }},\n 'general':{'label':'', 'fields':{\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'url':{'label':'Website', 'type':'text'},\n 'sequence':{'label':'Order', 'type':'text', 'size':'small'},\n 'flags':{'label':'Options', 'type':'flags', 'flags':{'1':{'name':'Level 1'}, '2':{'name':'Level 2'}}},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.sponsor.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.sponsor.sponsor_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.sponsor.remove();'},\n }},\n };\n this.sponsor.fieldValue = function(s, i, d) { return this.data[i]; }\n this.sponsor.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.sponsorHistory', 'args':{'tnid':M.curTenantID, 'sponsor_id':this.sponsor_id, 'field':i}};\n }\n this.sponsor.open = function(cb, sid, fid) {\n if( sid != null ) { this.sponsor_id = sid; }\n if( fid != null ) { this.festival_id = fid; }\n M.api.getJSONCb('ciniki.musicfestivals.sponsorGet', {'tnid':M.curTenantID, 'sponsor_id':this.sponsor_id, 'festival_id':this.festival_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.sponsor;\n p.data = rsp.sponsor;\n p.refresh();\n p.show(cb);\n });\n }\n this.sponsor.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.sponsor.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.sponsor_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.sponsorUpdate', {'tnid':M.curTenantID, 'sponsor_id':this.sponsor_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.sponsorAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.sponsor.sponsor_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.sponsor.remove = function() {\n M.confirm('Are you sure you want to remove sponsor?', null, function(rsp) {\n M.api.getJSONCb('ciniki.musicfestivals.sponsorDelete', {'tnid':M.curTenantID, 'sponsor_id':M.ciniki_musisfestivals_main.sponsor.sponsor_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.sponsor.close();\n });\n });\n }\n this.sponsor.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.sponsor_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.sponsor.save(\\'M.ciniki_musicfestivals_main.sponsor.open(null,' + this.nplist[this.nplist.indexOf('' + this.sponsor_id) + 1] + ');\\');';\n }\n return null;\n }\n this.sponsor.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.sponsor_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.sponsor.save(\\'M.ciniki_musicfestivals_main.sponsor.open(null,' + this.nplist[this.nplist.indexOf('' + this.sponsor_id) - 1] + ');\\');';\n }\n return null;\n }\n this.sponsor.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.sponsor.save();');\n this.sponsor.addClose('Cancel');\n this.sponsor.addButton('next', 'Next');\n this.sponsor.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Schedule Time Slot Image\n //\n this.timeslotimage = new M.panel('Schedule Time Slot Image', 'ciniki_musicfestivals_main', 'timeslotimage', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.timeslotimage');\n this.timeslotimage.data = null;\n this.timeslotimage.timeslot_image_id = 0;\n this.timeslotimage.nplist = [];\n this.timeslotimage.sections = {\n '_image_id':{'label':'Image', 'type':'imageform', 'aside':'yes', 'fields':{\n 'image_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.timeslotimage.setFieldValue('image_id', iid);\n return true;\n },\n 'addDropImageRefresh':'',\n },\n }},\n 'general':{'label':'', 'fields':{\n 'title':{'label':'Title', 'type':'text'},\n 'flags':{'label':'Options', 'type':'text'},\n 'sequence':{'label':'Order', 'type':'text'},\n }},\n '_description':{'label':'Description', 'fields':{\n 'description':{'label':'', 'hidelabel':'yes', 'type':'textarea', 'size':'large'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.timeslotimage.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.timeslotimage.timeslot_image_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.timeslotimage.remove();'},\n }},\n };\n this.timeslotimage.fieldValue = function(s, i, d) { return this.data[i]; }\n this.timeslotimage.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.timeslotImageHistory', 'args':{'tnid':M.curTenantID, 'timeslot_image_id':this.timeslot_image_id, 'field':i}};\n }\n this.timeslotimage.open = function(cb, tid, list) {\n if( tid != null ) { this.timeslot_image_id = tid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.timeslotImageGet', {'tnid':M.curTenantID, 'timeslot_image_id':this.timeslot_image_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.timeslotimage;\n p.data = rsp.image;\n p.refresh();\n p.show(cb);\n });\n }\n this.timeslotimage.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.timeslotimage.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.timeslot_image_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.timeslotImageUpdate', {'tnid':M.curTenantID, 'timeslot_image_id':this.timeslot_image_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.timeslotImageAdd', {'tnid':M.curTenantID}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.timeslotimage.timeslot_image_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.timeslotimage.remove = function() {\n M.confirm('Are you sure you want to remove timeslotimage?', null, function(rsp) {\n M.api.getJSONCb('ciniki.musicfestivals.timeslotImageDelete', {'tnid':M.curTenantID, 'timeslot_image_id':M.ciniki_musicfestivals_main.timeslotimage.timeslot_image_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.timeslotimage.close();\n });\n });\n }\n this.timeslotimage.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.timeslot_image_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.timeslotimage.save(\\'M.ciniki_musicfestivals_main.timeslotimage.open(null,' + this.nplist[this.nplist.indexOf('' + this.timeslot_image_id) + 1] + ');\\');';\n }\n return null;\n }\n this.timeslotimage.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.timeslot_image_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.timeslotimage.save(\\'M.ciniki_musicfestivals_main.timeslotimage.open(null,' + this.nplist[this.nplist.indexOf('' + this.timeslot_image_id) - 1] + ');\\');';\n }\n return null;\n }\n this.timeslotimage.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.timeslotimage.save();');\n this.timeslotimage.addClose('Cancel');\n this.timeslotimage.addButton('next', 'Next');\n this.timeslotimage.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit a List\n //\n this.list = new M.panel('List', 'ciniki_musicfestivals_main', 'list', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.list');\n this.list.data = null;\n this.list.list_id = 0;\n this.list.festival_id = 0;\n this.list.nplist = [];\n this.list.sections = {\n 'general':{'label':'', 'fields':{\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'category':{'label':'Category', 'required':'yes', 'type':'text'},\n }},\n '_intro':{'label':'Introduction', 'fields':{\n 'intro':{'label':'', 'hidelabel':'yes', 'type':'textarea'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.list.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.list.list_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.list.remove();'},\n }},\n };\n this.list.fieldValue = function(s, i, d) { return this.data[i]; }\n this.list.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.listHistory', 'args':{'tnid':M.curTenantID, 'list_id':this.list_id, 'field':i}};\n }\n this.list.open = function(cb, lid, fid, list) {\n if( lid != null ) { this.list_id = lid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.listGet', {'tnid':M.curTenantID, 'list_id':this.list_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.list;\n p.data = rsp.list;\n p.refresh();\n p.show(cb);\n });\n }\n this.list.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.list.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.list_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.listUpdate', {'tnid':M.curTenantID, 'list_id':this.list_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.listAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.list.list_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.list.remove = function() {\n M.confirm('Are you sure you want to remove list?', null, function(rsp) {\n M.api.getJSONCb('ciniki.musicfestivals.listDelete', {'tnid':M.curTenantID, 'list_id':this.list_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.list.close();\n });\n });\n }\n this.list.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.list_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.list.save(\\'M.ciniki_musicfestivals_main.list.open(null,' + this.nplist[this.nplist.indexOf('' + this.list_id) + 1] + ');\\');';\n }\n return null;\n }\n this.list.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.list_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.list.save(\\'M.ciniki_musicfestivals_main.list.open(null,' + this.nplist[this.nplist.indexOf('' + this.list_id) - 1] + ');\\');';\n }\n return null;\n }\n this.list.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.list.save();');\n this.list.addClose('Cancel');\n this.list.addButton('next', 'Next');\n this.list.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit List Section\n //\n this.listsection = new M.panel('List Section', 'ciniki_musicfestivals_main', 'listsection', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.listsection');\n this.listsection.data = null;\n this.listsection.list_id = 0;\n this.listsection.listsection_id = 0;\n this.listsection.nplist = [];\n this.listsection.sections = {\n 'general':{'label':'', 'fields':{\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'sequence':{'label':'Order', 'type':'text'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.listsection.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.listsection.listsection_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.listsection.remove();'},\n }},\n };\n this.listsection.fieldValue = function(s, i, d) { return this.data[i]; }\n this.listsection.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.listSectionHistory', 'args':{'tnid':M.curTenantID, 'listsection_id':this.listsection_id, 'field':i}};\n }\n this.listsection.open = function(cb, lid, list_id, list) {\n if( lid != null ) { this.listsection_id = lid; }\n if( list_id != null ) { this.list_id = list_id; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.listSectionGet', {'tnid':M.curTenantID, 'listsection_id':this.listsection_id, 'list_id':this.list_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.listsection;\n p.data = rsp.listsection;\n p.refresh();\n p.show(cb);\n });\n }\n this.listsection.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.listsection.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.listsection_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.listSectionUpdate', {'tnid':M.curTenantID, 'listsection_id':this.listsection_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.listSectionAdd', {'tnid':M.curTenantID, 'list_id':this.list_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.listsection.listsection_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.listsection.remove = function() {\n M.confirm('Are you sure you want to remove listsection?', null, function(rsp) {\n M.api.getJSONCb('ciniki.musicfestivals.listSectionDelete', {'tnid':M.curTenantID, 'listsection_id':M.ciniki_musicfestivals_main.listsection.listsection_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.listsection.close();\n });\n });\n }\n this.listsection.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.listsection_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.listsection.save(\\'M.ciniki_musicfestivals_main.listsection.open(null,' + this.nplist[this.nplist.indexOf('' + this.listsection_id) + 1] + ');\\');';\n }\n return null;\n }\n this.listsection.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.listsection_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.listsection.save(\\'M.ciniki_musicfestivals_main.listsection.open(null,' + this.nplist[this.nplist.indexOf('' + this.listsection_id) - 1] + ');\\');';\n }\n return null;\n }\n this.listsection.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.listsection.save();');\n this.listsection.addClose('Cancel');\n this.listsection.addButton('next', 'Next');\n this.listsection.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit List Entry\n //\n this.listentry = new M.panel('List Entry', 'ciniki_musicfestivals_main', 'listentry', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.listentry');\n this.listentry.data = null;\n this.listentry.listsection_id = 0;\n this.listentry.listentry_id = 0;\n this.listentry.nplist = [];\n this.listentry.sections = {\n 'general':{'label':'List Entry', 'fields':{\n 'sequence':{'label':'Number', 'type':'text'},\n 'award':{'label':'Award', 'type':'text'},\n 'amount':{'label':'Amount', 'type':'text'},\n 'donor':{'label':'Donor', 'type':'text'},\n 'winner':{'label':'Winner', 'type':'text'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.listentry.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.listentry.listentry_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.listentry.remove();'},\n }},\n };\n this.listentry.fieldValue = function(s, i, d) { return this.data[i]; }\n this.listentry.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.listEntryHistory', 'args':{'tnid':M.curTenantID, 'listentry_id':this.listentry_id, 'field':i}};\n }\n this.listentry.open = function(cb, lid, sid, list) {\n if( lid != null ) { this.listentry_id = lid; }\n if( sid != null ) { this.listsection_id = sid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.listEntryGet', {'tnid':M.curTenantID, 'listentry_id':this.listentry_id, 'section_id':this.listsection_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.listentry;\n p.data = rsp.listentry;\n p.refresh();\n p.show(cb);\n });\n }\n this.listentry.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.listentry.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.listentry_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.listEntryUpdate', {'tnid':M.curTenantID, 'listentry_id':this.listentry_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.listEntryAdd', {'tnid':M.curTenantID, 'section_id':this.listsection_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.listentry.listentry_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.listentry.remove = function() {\n M.confirm('Are you sure you want to remove listentry?', null, function(rsp) {\n M.api.getJSONCb('ciniki.musicfestivals.listEntryDelete', {'tnid':M.curTenantID, 'listentry_id':M.ciniki_musicfestivals_main.listentry.listentry_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.listentry.close();\n });\n });\n }\n this.listentry.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.listentry_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.listentry.save(\\'M.ciniki_musicfestivals_main.listentry.open(null,' + this.nplist[this.nplist.indexOf('' + this.listentry_id) + 1] + ');\\');';\n }\n return null;\n }\n this.listentry.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.listentry_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.listentry.save(\\'M.ciniki_musicfestivals_main.listentry.open(null,' + this.nplist[this.nplist.indexOf('' + this.listentry_id) - 1] + ');\\');';\n }\n return null;\n }\n this.listentry.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.listentry.save();');\n this.listentry.addClose('Cancel');\n this.listentry.addButton('next', 'Next');\n this.listentry.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Certificate\n //\n this.certificate = new M.panel('Certificate', 'ciniki_musicfestivals_main', 'certificate', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.certificate');\n this.certificate.data = null;\n this.certificate.festival_id = 0;\n this.certificate.certificate_id = 0;\n this.certificate.nplist = [];\n this.certificate.sections = {\n '_image_id':{'label':'Image', 'type':'imageform', 'aside':'yes', 'fields':{\n 'image_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.certificate.setFieldValue('image_id', iid);\n return true;\n },\n 'addDropImageRefresh':'',\n },\n }},\n 'general':{'label':'Certificate', 'fields':{\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'orientation':{'label':'Orientation', 'type':'toggle', 'toggles':{'L':'Landscape', 'P':'Portrait'}},\n// FIXME: Add section support and min score support\n// 'section_id':{'label':'Section', 'type':'select', 'options':{}, 'complex_options':{'name':'name', 'value':'id'}},\n// 'min_score':{'label':'Minimum Score', 'type':'text', 'size':'small'},\n }},\n 'fields':{'label':'Auto Filled Fields', 'type':'simplegrid', 'num_cols':1,\n 'addTxt':'Add Field',\n 'addFn':'M.ciniki_musicfestivals_main.certificate.save(\"M.ciniki_musicfestivals_main.certfield.open(\\'M.ciniki_musicfestivals_main.certificate.open();\\',0,M.ciniki_musicfestivals_main.certificate.certificate_id);\");',\n },\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.certificate.save();'},\n 'download':{'label':'Generate Test', \n 'visible':function() {return M.ciniki_musicfestivals_main.certificate.certificate_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.certificate.generateTestOutlines();',\n },\n 'download2':{'label':'Generate Test No Outlines', \n 'visible':function() {return M.ciniki_musicfestivals_main.certificate.certificate_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.certificate.generateTest();',\n },\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.certificate.certificate_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.certificate.remove();',\n },\n }},\n };\n this.certificate.fieldValue = function(s, i, d) { return this.data[i]; }\n this.certificate.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.certificateHistory', 'args':{'tnid':M.curTenantID, 'certificate_id':this.certificate_id, 'field':i}};\n }\n this.certificate.cellValue = function(s, i, j, d) {\n if( s == 'fields' ) {\n switch(j) {\n case 0: return d.name;\n }\n }\n }\n this.certificate.rowFn = function(s, i, d) {\n return 'M.ciniki_musicfestivals_main.certificate.save(\"M.ciniki_musicfestivals_main.certfield.open(\\'M.ciniki_musicfestivals_main.certificate.open();\\',' + d.id + ',M.ciniki_musicfestivals_main.certificate.certificate_id);\");';\n }\n this.certificate.open = function(cb, cid, fid, list) {\n if( cid != null ) { this.certificate_id = cid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.certificateGet', {'tnid':M.curTenantID, 'certificate_id':this.certificate_id, 'festival_id':this.festival_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.certificate;\n p.data = rsp.certificate;\n// p.sections.general.fields.section_id.options = rsp.sections;\n p.refresh();\n p.show(cb);\n });\n }\n this.certificate.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.certificate.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.certificate_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.certificateUpdate', {'tnid':M.curTenantID, 'certificate_id':this.certificate_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.certificateAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.certificate.certificate_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.certificate.generateTestOutlines = function() {\n M.api.openFile('ciniki.musicfestivals.certificateGet', {'tnid':M.curTenantID, 'certificate_id':this.certificate_id, 'festival_id':this.festival_id, 'output':'pdf', 'outlines':'yes'});\n }\n this.certificate.generateTest = function() {\n M.api.openFile('ciniki.musicfestivals.certificateGet', {'tnid':M.curTenantID, 'certificate_id':this.certificate_id, 'festival_id':this.festival_id, 'output':'pdf'});\n }\n this.certificate.remove = function() {\n M.confirm('Are you sure you want to remove certificate?', null, function(rsp) {\n M.api.getJSONCb('ciniki.musicfestivals.certificateDelete', {'tnid':M.curTenantID, 'certificate_id':M.ciniki_musicfestivals_main.certificate.certificate_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.certificate.close();\n });\n });\n }\n this.certificate.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.certificate_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.certificate.save(\\'M.ciniki_musicfestivals_main.certificate.open(null,' + this.nplist[this.nplist.indexOf('' + this.certificate_id) + 1] + ');\\');';\n }\n return null;\n }\n this.certificate.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.certificate_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.certificate.save(\\'M.ciniki_musicfestivals_main.certificate.open(null,' + this.nplist[this.nplist.indexOf('' + this.certificate_id) - 1] + ');\\');';\n }\n return null;\n }\n this.certificate.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.certificate.save();');\n this.certificate.addClose('Cancel');\n this.certificate.addButton('next', 'Next');\n this.certificate.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Certificate Field\n //\n this.certfield = new M.panel('Certificate Field', 'ciniki_musicfestivals_main', 'certfield', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.certfield');\n this.certfield.data = null;\n this.certfield.field_id = 0;\n this.certfield.certificate_id = 0;\n this.certfield.nplist = [];\n this.certfield.sections = {\n 'general':{'label':'', 'fields':{\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'field':{'label':'Field', 'type':'select', 'options':{\n 'class':'Class',\n 'timeslotdate':'Timeslot Date',\n 'participant':'Participant',\n 'title':'Title',\n 'adjudicator':'Adjudicator',\n 'placement':'Placement',\n 'text':'Text',\n }},\n 'xpos':{'label':'X Position', 'required':'yes', 'type':'text'},\n 'ypos':{'label':'Y Position', 'required':'yes', 'type':'text'},\n 'width':{'label':'Width', 'required':'yes', 'type':'text'},\n 'height':{'label':'Height', 'required':'yes', 'type':'text'},\n 'font':{'label':'Font', 'type':'select', 'options':{\n 'times':'Times',\n 'helvetica':'Helvetica',\n 'vidaloka':'Vidaloka',\n 'scriptina':'Scriptina',\n 'allison':'Allison',\n 'greatvibes':'Great Vibes',\n }},\n 'size':{'label':'Size', 'type':'text'},\n 'style':{'label':'Style', 'type':'select', 'options':{\n '':'Normal',\n 'B':'Bold',\n 'I':'Italic',\n 'BI':'Bold Italic',\n }},\n 'align':{'label':'Align', 'type':'select', 'options':{\n 'L':'Left',\n 'C':'Center',\n 'R':'Right',\n }},\n 'valign':{'label':'Vertial', 'type':'select', 'options':{\n 'T':'Top',\n 'M':'Middle',\n 'B':'Bottom',\n }},\n// 'color':{'label':'Color', 'type':'text'},\n// 'bgcolor':{'label':'Background Color', 'type':'text'},\n 'text':{'label':'Text', 'type':'text'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.certfield.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.certfield.field_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.certfield.remove();'},\n }},\n };\n this.certfield.fieldValue = function(s, i, d) { return this.data[i]; }\n this.certfield.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.certfieldHistory', 'args':{'tnid':M.curTenantID, 'field_id':this.field_id, 'field':i}};\n }\n this.certfield.open = function(cb, fid, cid, list) {\n if( fid != null ) { this.field_id = fid; }\n if( cid != null ) { this.certificate_id = cid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.certfieldGet', {'tnid':M.curTenantID, 'field_id':this.field_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.certfield;\n p.data = rsp.field;\n p.refresh();\n p.show(cb);\n });\n }\n this.certfield.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.certfield.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.field_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.certfieldUpdate', {'tnid':M.curTenantID, 'field_id':this.field_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.certfieldAdd', {'tnid':M.curTenantID, 'certificate_id':this.certificate_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.certfield.field_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.certfield.remove = function() {\n M.confirm('Are you sure you want to remove certfield?', null, function(rsp) {\n M.api.getJSONCb('ciniki.musicfestivals.certfieldDelete', {'tnid':M.curTenantID, 'field_id':M.ciniki_musicfestivals_main.certfield.field_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.certfield.close();\n });\n });\n }\n this.certfield.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.field_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.certfield.save(\\'M.ciniki_musicfestivals_main.certfield.open(null,' + this.nplist[this.nplist.indexOf('' + this.field_id) + 1] + ');\\');';\n }\n return null;\n }\n this.certfield.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.field_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.certfield.save(\\'M.ciniki_musicfestivals_main.certfield.open(null,' + this.nplist[this.nplist.indexOf('' + this.field_id) - 1] + ');\\');';\n }\n return null;\n }\n this.certfield.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.certfield.save();');\n this.certfield.addClose('Cancel');\n this.certfield.addButton('next', 'Next');\n this.certfield.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Trophy\n //\n this.trophy = new M.panel('Trophy', 'ciniki_musicfestivals_main', 'trophy', 'mc', 'medium mediumaside', 'sectioned', 'ciniki.musicfestivals.main.trophy');\n this.trophy.data = null;\n this.trophy.trophy_id = 0;\n this.trophy.nplist = [];\n this.trophy.sections = {\n '_primary_image_id':{'label':'Image', 'type':'imageform', 'aside':'yes', 'fields':{\n 'primary_image_id':{'label':'', 'type':'image_id', 'hidelabel':'yes', 'controls':'all', 'history':'no',\n 'addDropImage':function(iid) {\n M.ciniki_musicfestivals_main.trophy.setFieldValue('primary_image_id', iid);\n return true;\n },\n 'addDropImageRefresh':'',\n },\n }},\n 'general':{'label':'', 'aside':'yes', 'fields':{\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'category':{'label':'Category', 'type':'text'},\n 'donated_by':{'label':'Donated By', 'type':'text'},\n 'first_presented':{'label':'First Presented', 'type':'text'},\n 'criteria':{'label':'Criteria', 'type':'text'},\n }},\n '_description':{'label':'Description', 'fields':{\n 'description':{'label':'', 'hidelabel':'yes', 'type':'textarea', 'size':'large'},\n }},\n 'winners':{'label':'Winners', 'type':'simplegrid', 'num_cols':2, \n 'addTxt':'Add Winner',\n 'addFn':'M.ciniki_musicfestivals_main.trophy.save(\"M.ciniki_musicfestivals_main.trophywinner.open(\\'M.ciniki_musicfestivals_main.trophy.open();\\',0,M.ciniki_musicfestivals_main.trophy.trophy_id);\");',\n },\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.trophy.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.trophy.trophy_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.trophy.remove();'},\n }},\n };\n this.trophy.fieldValue = function(s, i, d) { return this.data[i]; }\n this.trophy.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.trophyHistory', 'args':{'tnid':M.curTenantID, 'trophy_id':this.trophy_id, 'field':i}};\n }\n this.trophy.cellValue = function(s, i, j, d) {\n if( s == 'winners' ) {\n switch(j) {\n case 0: return d.year;\n case 1: return d.name;\n }\n }\n }\n this.trophy.rowFn = function(s, i, d) {\n if( s == 'winners' ) {\n return 'M.ciniki_musicfestivals_main.trophy.save(\"M.ciniki_musicfestivals_main.trophywinner.open(\\'M.ciniki_musicfestivals_main.trophy.open();\\',' + d.id + ',M.ciniki_musicfestivals_main.trophy.trophy_id);\");';\n }\n }\n this.trophy.open = function(cb, tid, list) {\n if( tid != null ) { this.trophy_id = tid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.trophyGet', {'tnid':M.curTenantID, 'trophy_id':this.trophy_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.trophy;\n p.data = rsp.trophy;\n p.refresh();\n p.show(cb);\n });\n }\n this.trophy.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.trophy.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.trophy_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.trophyUpdate', {'tnid':M.curTenantID, 'trophy_id':this.trophy_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.trophyAdd', {'tnid':M.curTenantID}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.trophy.trophy_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.trophy.remove = function() {\n M.confirm('Are you sure you want to remove trophy?', null, function(rsp) {\n M.api.getJSONCb('ciniki.musicfestivals.trophyDelete', {'tnid':M.curTenantID, 'trophy_id':M.ciniki_musicfestivals_main.trophy.trophy_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.trophy.close();\n });\n });\n }\n this.trophy.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.trophy_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.trophy.save(\\'M.ciniki_musicfestivals_main.trophy.open(null,' + this.nplist[this.nplist.indexOf('' + this.trophy_id) + 1] + ');\\');';\n }\n return null;\n }\n this.trophy.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.trophy_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.trophy.save(\\'M.ciniki_musicfestivals_main.trophy.open(null,' + this.nplist[this.nplist.indexOf('' + this.trophy_id) - 1] + ');\\');';\n }\n return null;\n }\n this.trophy.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.trophy.save();');\n this.trophy.addClose('Cancel');\n this.trophy.addButton('next', 'Next');\n this.trophy.addLeftButton('prev', 'Prev');\n\n //\n // The panel to edit Trophy Winner\n //\n this.trophywinner = new M.panel('Trophy Winner', 'ciniki_musicfestivals_main', 'trophywinner', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.trophywinner');\n this.trophywinner.data = null;\n this.trophywinner.trophy_id = 0;\n this.trophywinner.winner_id = 0;\n this.trophywinner.nplist = [];\n this.trophywinner.sections = {\n 'general':{'label':'', 'fields':{\n 'name':{'label':'Name', 'required':'yes', 'type':'text'},\n 'year':{'label':'Year', 'type':'text'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.trophywinner.save();'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.trophywinner.winner_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.trophywinner.remove();'},\n }},\n };\n this.trophywinner.fieldValue = function(s, i, d) { return this.data[i]; }\n this.trophywinner.fieldHistoryArgs = function(s, i) {\n return {'method':'ciniki.musicfestivals.trophyWinnerHistory', 'args':{'tnid':M.curTenantID, 'winner_id':this.winner_id, 'field':i}};\n }\n this.trophywinner.open = function(cb, wid, tid, list) {\n if( wid != null ) { this.winner_id = wid; }\n if( tid != null ) { this.trophy_id = tid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.trophyWinnerGet', {'tnid':M.curTenantID, 'winner_id':this.winner_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.trophywinner;\n p.data = rsp.winner;\n p.refresh();\n p.show(cb);\n });\n }\n this.trophywinner.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.trophywinner.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.winner_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.trophyWinnerUpdate', {'tnid':M.curTenantID, 'winner_id':this.winner_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.trophyWinnerAdd', {'tnid':M.curTenantID, 'trophy_id':this.trophy_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.trophywinner.winner_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.trophywinner.remove = function() {\n M.confirm('Are you sure you want to remove trophywinner?', null, function(rsp) {\n M.api.getJSONCb('ciniki.musicfestivals.trophyWinnerDelete', {'tnid':M.curTenantID, 'winner_id':M.ciniki_musicfestivals_main.trophywinner.winner_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.trophywinner.close();\n });\n });\n }\n this.trophywinner.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.winner_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.trophywinner.save(\\'M.ciniki_musicfestivals_main.trophywinner.open(null,' + this.nplist[this.nplist.indexOf('' + this.winner_id) + 1] + ');\\');';\n }\n return null;\n }\n this.trophywinner.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.winner_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.trophywinner.save(\\'M.ciniki_musicfestivals_main.trophywinner.open(null,' + this.nplist[this.nplist.indexOf('' + this.winner_id) - 1] + ');\\');';\n }\n return null;\n }\n this.trophywinner.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.trophywinner.save();');\n this.trophywinner.addClose('Cancel');\n this.trophywinner.addButton('next', 'Next');\n this.trophywinner.addLeftButton('prev', 'Prev');\n\n \n //\n // This panel will allow mass updates to City and Province\n //\n this.editcityprov = new M.panel('Update', 'ciniki_musicfestivals_main', 'editcityprov', 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.editcityprov');\n this.editcityprov.data = null;\n this.editcityprov.city = '';\n this.editcityprov.province = '';\n this.editcityprov.sections = {\n 'general':{'label':'', 'fields':{\n 'city':{'label':'City', 'type':'text', 'visible':'yes'},\n 'province':{'label':'Province', 'type':'text'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', 'fn':'M.ciniki_musicfestivals_main.editcityprov.save();'},\n }},\n };\n this.editcityprov.open = function(cb, c, p) {\n if( c != null ) {\n this.city = unescape(c);\n this.sections.general.fields.city.visible = 'yes';\n } else {\n this.sections.general.fields.city.visible = 'no';\n }\n this.province = unescape(p);\n this.data = {\n 'city':unescape(c),\n 'province':unescape(p),\n };\n this.refresh();\n this.show(cb);\n }\n this.editcityprov.save = function() {\n var args = {\n 'tnid':M.curTenantID, \n 'festival_id':M.ciniki_musicfestivals_main.festival.festival_id,\n };\n if( this.sections.general.fields.city.visible == 'yes' ) {\n args['old_city'] = M.eU(this.city);\n args['new_city'] = M.eU(this.formValue('city'));\n }\n args['old_province'] = M.eU(this.province);\n args['new_province'] = M.eU(this.formValue('province'));\n M.api.getJSONCb('ciniki.musicfestivals.competitorCityProvUpdate', args, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.editcityprov.close();\n });\n }\n this.editcityprov.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.editcityprov.save();');\n this.editcityprov.addClose('Cancel');\n\n //\n // Create and send a email message to a selection of competitors/teachers with\n // filtering for section, timeslot sections, etc\n //\n this.message = new M.panel('Message',\n 'ciniki_musicfestivals_main', 'message',\n 'mc', 'xlarge mediumaside', 'sectioned', 'ciniki.musicfestivals.main.message');\n this.message.data = {};\n this.message.festival_id = 0;\n this.message.message_id = 0;\n this.message.upload = null;\n this.message.nplist = [];\n this.message.sections = {\n 'details':{'label':'Details', 'type':'simplegrid', 'num_cols':2, 'aside':'yes',\n 'cellClasses':['label mediumlabel', ''],\n // Status\n // # competitors\n // # teachers\n // 'dt_sent':{'label':'Year', 'type':'text'},\n },\n 'objects':{'label':'Recipients', 'type':'simplegrid', 'num_cols':2, 'aside':'yes',\n 'cellClasses':['label', ''],\n 'addTxt':'Add/Remove Recipient(s)',\n //'addFn':'M.ciniki_musicfestivals_main.messagerefs.open(\\'M.ciniki_musicfestivals_main.message.open();\\',M.ciniki_musicfestivals_main.message.message_id);',\n 'addFn':'M.ciniki_musicfestivals_main.message.save(\"M.ciniki_musicfestivals_main.message.openrefs();\");',\n },\n '_subject':{'label':'Subject', 'fields':{\n 'subject':{'label':'Subject', 'hidelabel':'yes', 'type':'text'},\n }},\n '_content':{'label':'Message', 'fields':{\n 'content':{'label':'', 'hidelabel':'yes', 'type':'textarea', 'size':'large'},\n }},\n/* '_file':{'label':'Attach Files', \n 'fields':{\n 'attachment1':{'label':'File 1', 'type':'file', 'hidelabel':'no'},\n 'attachment2':{'label':'File 2', 'type':'file', 'hidelabel':'no'},\n 'attachment3':{'label':'File 3', 'type':'file', 'hidelabel':'no'},\n 'attachment4':{'label':'File 4', 'type':'file', 'hidelabel':'no'},\n 'attachment5':{'label':'File 5', 'type':'file', 'hidelabel':'no'},\n }}, */\n 'files':{'label':'Attachments', 'type':'simplegrid', 'num_cols':2,\n 'cellClasses':['', 'alignright fabuttons'],\n 'noData':'No attachments',\n 'addTxt':'Attach File',\n 'addTopFn':'M.ciniki_musicfestivals_main.message.save(\"M.ciniki_musicfestivals_main.message.fileAdd();\");',\n },\n '_buttons':{'label':'', 'buttons':{\n 'save':{'label':'Save', \n 'visible':function() {return M.ciniki_musicfestivals_main.message.data.status == 10 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.message.save();',\n },\n 'back':{'label':'Back', \n 'visible':function() {return M.ciniki_musicfestivals_main.message.data.status > 10 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.message.close();',\n },\n 'sendtest':{'label':'Send Test Message', \n 'visible':function() {return M.ciniki_musicfestivals_main.message.data.send == 'yes' ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.message.save(\"M.ciniki_musicfestivals_main.message.sendTest();\");',\n },\n 'schedule':{'label':'Schedule', \n 'visible':function() {return M.ciniki_musicfestivals_main.message.data.send == 'yes' ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.message.schedule();',\n },\n 'unschedule':{'label':'Unschedule', \n 'visible':function() {return M.ciniki_musicfestivals_main.message.data.status == 30 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.message.unschedule();',\n },\n 'sendnow':{'label':'Send Now', \n 'visible':function() {return M.ciniki_musicfestivals_main.message.data.send == 'yes' ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.message.save(\"M.ciniki_musicfestivals_main.message.sendNow();\");'},\n 'delete':{'label':'Delete', \n 'visible':function() {return M.ciniki_musicfestivals_main.message.message_id > 0 && M.ciniki_musicfestivals_main.message.data.status == 10 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.message.remove();',\n },\n }},\n };\n// this.message.fieldValue = function(s, i, d) {\n// return this.data[i];\n// }\n this.message.cellValue = function(s, i, j, d) {\n if( s == 'details' ) {\n switch(j) {\n case 0: return d.label;\n case 1: return d.value;\n }\n }\n if( s == 'objects' ) {\n switch(j) {\n case 0: return d.type;\n case 1: return d.label;\n }\n }\n if( s == 'files' ) {\n switch(j) {\n case 0: return d.filename;\n }\n if( this.data.status == 10 && j == 1 ) {\n return M.faBtn('&#xf019;', 'Download', 'M.ciniki_musicfestivals_main.message.fileDownload(\\'' + escape(d.filename) + '\\');')\n + M.faBtn('&#xf014;', 'Delete', 'M.ciniki_musicfestivals_main.message.fileDelete(\\'' + escape(d.filename) + '\\');');\n }\n if( this.data.status > 10 && j == 1 ) {\n return M.faBtn('&#xf019;', 'Download', 'M.ciniki_musicfestivals_main.message.fileDownload(\\'' + escape(d.filename) + '\\');');\n }\n return '';\n }\n }\n// this.message.cellFn = function(s, i, j, d) {\n// if( s == 'objects' ) {\n// }\n// return '';\n// }\n // Add a new message with object and object_id\n this.message.addnew = function(cb, fid, o, oid) {\n var args = {'tnid':M.curTenantID, 'festival_id':fid};\n args['subject'] = '';\n args['object'] = o;\n args['object_id'] = oid;\n M.api.getJSONCb('ciniki.musicfestivals.messageAdd', args, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.message.open(cb, rsp.id);\n });\n }\n this.message.openrefs = function() {\n M.ciniki_musicfestivals_main.messagerefs.open('M.ciniki_musicfestivals_main.message.open();', M.ciniki_musicfestivals_main.message.message_id);\n }\n this.message.fileAdd = function() {\n if( this.upload == null ) {\n this.upload = M.aE('input', this.panelUID + '_file_upload', 'image_uploader');\n this.upload.setAttribute('name', 'filename');\n this.upload.setAttribute('type', 'file');\n this.upload.setAttribute('onchange', this.panelRef + '.uploadFile();');\n }\n this.upload.value = '';\n this.upload.click();\n }\n this.message.uploadFile = function() {\n var f = this.upload;\n M.api.postJSONFile('ciniki.musicfestivals.messageFileAdd', {'tnid':M.curTenantID, 'message_id':this.message_id}, f.files[0],\n function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.message;\n p.data.files = rsp.files;\n p.refreshSection('files');\n });\n }\n this.message.fileDelete = function(f) {\n M.api.getJSONCb('ciniki.musicfestivals.messageFileDelete', {'tnid':M.curTenantID, 'message_id':this.message_id, 'filename':f}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.message;\n p.data.files = rsp.files;\n p.refreshSection('files');\n });\n }\n this.message.fileDownload = function(f) {\n M.api.openFile('ciniki.musicfestivals.messageFileDownload', {'tnid':M.curTenantID, 'message_id':this.message_id, 'filename':f});\n }\n this.message.open = function(cb, mid, fid, list) {\n if( mid != null ) { this.message_id = mid; }\n if( fid != null ) { this.festival_id = fid; }\n if( list != null ) { this.nplist = list; }\n M.api.getJSONCb('ciniki.musicfestivals.messageGet', {'tnid':M.curTenantID, 'message_id':this.message_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.message;\n p.data = rsp.message;\n if( rsp.message.status == 10 ) {\n p.sections.objects.addTxt = \"Add/Remove Recipients\";\n } else {\n p.sections.objects.addTxt = \"View Recipients\";\n }\n if( rsp.message.status == 10 ) {\n p.addClose('Cancel');\n p.sections._subject.fields.subject.editable = 'yes';\n p.sections._content.fields.content.editable = 'yes';\n } else {\n p.addClose('Back');\n p.sections._subject.fields.subject.editable = 'no';\n p.sections._content.fields.content.editable = 'no';\n }\n p.refresh();\n p.show(cb);\n });\n }\n this.message.save = function(cb) {\n if( cb == null ) { cb = 'M.ciniki_musicfestivals_main.message.close();'; }\n if( !this.checkForm() ) { return false; }\n if( this.message_id > 0 ) {\n var c = this.serializeForm('no');\n if( c != '' ) {\n M.api.postJSONCb('ciniki.musicfestivals.messageUpdate', {'tnid':M.curTenantID, 'message_id':this.message_id}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n eval(cb);\n });\n } else {\n eval(cb);\n }\n } else {\n var c = this.serializeForm('yes');\n M.api.postJSONCb('ciniki.musicfestivals.messageAdd', {'tnid':M.curTenantID, 'festival_id':this.festival_id, 'status':10}, c, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.message.message_id = rsp.id;\n eval(cb);\n });\n }\n }\n this.message.sendTest = function() {\n M.api.getJSONCb('ciniki.musicfestivals.messageSend', {'tnid':M.curTenantID, 'message_id':this.message_id, 'send':'test'}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.alert(rsp.msg);\n M.ciniki_musicfestivals_main.message.open();\n });\n }\n this.message.sendNow = function() {\n var msg = '<b>' + (this.data.num_teachers == 0 ? 'No' : this.data.num_teachers) + '</b> teacher' + (this.data.num_teachers != 1 ? 's' :'')\n + ' and <b>' + (this.data.num_competitors == 0 ? 'no' : this.data.num_competitors) + '</b> competitor' + (this.data.num_competitors != 1 ? 's' : '') \n + ' will receive this email. <br/></br>';\n M.confirm(msg + ' Is this email correct and ready to send?', null, function() {\n M.api.getJSONCb('ciniki.musicfestivals.messageSend', {'tnid':M.curTenantID, 'message_id':M.ciniki_musicfestivals_main.message.message_id, 'send':'all'}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.alert(rsp.msg);\n M.ciniki_musicfestivals_main.message.open();\n });\n });\n }\n this.message.schedule = function() {\n var msg = '<b>' + (this.data.num_teachers == 0 ? 'No' : this.data.num_teachers) + '</b> teacher' + (this.data.num_teachers != 1 ? 's' :'')\n + ' and <b>' + (this.data.num_competitors == 0 ? 'no' : this.data.num_competitors) + '</b> competitor' + (this.data.num_competitors != 1 ? 's' : '') \n + ' will receive this email. <br/></br>';\n M.confirm(msg + 'Are you sure the email is correct and ready to be sent?', null, function() {\n M.ciniki_musicfestivals_main.messageschedule.open();\n });\n }\n this.message.schedulenow = function() {\n var sd = M.ciniki_musicfestivals_main.messageschedule.formValue('dt_scheduled');\n if( sd != this.data.dt_scheduled ) {\n M.api.getJSONCb('ciniki.musicfestivals.messageUpdate', {'tnid':M.curTenantID, 'message_id':this.message_id, 'dt_scheduled':sd, 'status':30}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.message.close();\n });\n } else {\n this.close();\n }\n }\n this.message.unschedule = function() {\n M.api.getJSONCb('ciniki.musicfestivals.messageUpdate', {'tnid':M.curTenantID, 'message_id':this.message_id, 'status':10}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.message.open();\n });\n }\n this.message.remove = function() {\n M.confirm('Are you sure you want to remove message?', null, function() {\n M.api.getJSONCb('ciniki.musicfestivals.messageDelete', {'tnid':M.curTenantID, 'message_id':M.ciniki_musicfestivals_main.message.message_id}, function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n M.ciniki_musicfestivals_main.message.close();\n });\n });\n }\n this.message.nextButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.message_id) < (this.nplist.length - 1) ) {\n return 'M.ciniki_musicfestivals_main.message.save(\\'M.ciniki_musicfestivals_main.message.open(null,' + this.nplist[this.nplist.indexOf('' + this.message_id) + 1] + ');\\');';\n }\n return null;\n }\n this.message.prevButtonFn = function() {\n if( this.nplist != null && this.nplist.indexOf('' + this.message_id) > 0 ) {\n return 'M.ciniki_musicfestivals_main.message.save(\\'M.ciniki_musicfestivals_main.message.open(null,' + this.nplist[this.nplist.indexOf('' + this.message_id) - 1] + ');\\');';\n }\n return null;\n }\n this.message.addButton('save', 'Save', 'M.ciniki_musicfestivals_main.message.save();');\n this.message.addButton('next', 'Next');\n this.message.addLeftButton('prev', 'Prev');\n this.message.helpSections = function() {\n return {\n 'help':{'label':'Substitutions', 'type':'htmlcontent',\n 'html':'The following substitutions are available in the Message:<br/><br/>'\n + '{_first_} = Teacher/Individual first name, Group/Ensemble full name<br/>'\n + '{_name_} = Teacher/Individual/Group full name<br/>'\n },\n };\n }\n\n //\n // This panel will let the user select a date and time to send the scheduled message\n //\n this.messageschedule = new M.panel('Schedule Message',\n 'ciniki_musicfestivals_main', 'messageschedule',\n 'mc', 'medium', 'sectioned', 'ciniki.musicfestivals.main.messageschedule');\n this.messageschedule.data = {};\n this.messageschedule.sections = {\n 'general':{'label':'Schedule Date and Time', 'fields':{\n 'dt_scheduled':{'label':'', 'hidelabel':'yes', 'type':'datetime'},\n }},\n '_buttons':{'label':'', 'buttons':{\n 'send':{'label':'Schedule', \n 'fn':'M.ciniki_musicfestivals_main.message.schedulenow();',\n },\n 'delete':{'label':'Cancel',\n 'fn':'M.ciniki_musicfestivals_main.message.open();',\n },\n }},\n };\n this.messageschedule.open = function() {\n if( M.ciniki_musicfestivals_main.message.data.dt_scheduled != '0000-00-00 00:00:00' ) {\n this.data = {\n 'dt_scheduled':M.ciniki_musicfestivals_main.message.data.dt_scheduled_text,\n };\n } else {\n this.data.dt_scheduled = '';\n }\n this.refresh();\n this.show();\n }\n\n\n //\n // This panel shows the available objects that can be used to send a message to.\n //\n this.messagerefs = new M.panel('Message Recipients',\n 'ciniki_musicfestivals_main', 'messagerefs',\n 'mc', 'xlarge mediumaside', 'sectioned', 'ciniki.musicfestivals.main.messagerefs');\n this.messagerefs.data = {};\n this.messagerefs.festival_id = 0;\n this.messagerefs.message_id = 0;\n this.messagerefs.section_id = 0;\n this.messagerefs.category_id = 0;\n this.messagerefs.schedule_id = 0;\n this.messagerefs.division_id = 0;\n this.messagerefs.nplist = [];\n this.messagerefs.sections = {\n 'details':{'label':'Details', 'type':'simplegrid', 'num_cols':2, 'aside':'yes',\n 'cellClasses':['label mediumlabel', ''],\n // Status\n // # competitors\n // # teachers\n // 'dt_sent':{'label':'Year', 'type':'text'},\n },\n 'excluded':{'label':'', 'aside':'yes', 'fields':{\n 'flags1':{'label':'Include', 'type':'flagspiece', 'default':'off', 'mask':0x03,\n 'field':'flags', 'toggle':'yes', 'join':'yes',\n\n 'flags':{'0':{'name':'Everybody'},'2':{'name':'Only Competitors'}, '1':{'name':'Only Teachers'}},\n 'onchange':'M.ciniki_musicfestivals_main.messagerefs.updateFlags',\n },\n }},\n/* '_excluded':{'label':'', 'aside':'yes', 'fields':{\n 'flags1':{'label':'Exclude Competitors', 'type':'flagtoggle', 'default':'off', 'bit':0x01,\n 'field':'flags',\n 'onchange':'M.ciniki_musicfestivals_main.messagerefs.updateFlags',\n },\n 'flags2':{'label':'Exclude Teachers', 'type':'flagtoggle', 'default':'off', 'bit':0x02,\n 'field':'flags',\n 'onchange':'M.ciniki_musicfestivals_main.messagerefs.updateFlags',\n },\n }}, */\n 'objects':{'label':'Recipients', 'type':'simplegrid', 'num_cols':3, 'aside':'yes',\n 'cellClasses':['label mediumlabel', '', 'alignright'],\n 'noData':'No Recipients',\n// 'addTxt':'Add Recipient(s)',\n// 'addFn':'M.ciniki_musicfestivals_main.message.addobjects();',\n },\n '_extract':{'label':'', 'aside':'yes', 'buttons':{\n 'extract':{'label':'Extract Recipients', 'fn':'M.ciniki_musicfestivals_main.messagerefs.extractRecipients();'},\n }},\n '_tabs':{'label':'', 'type':'paneltabs', 'selected':'sections', 'tabs':{\n 'sections':{'label':'Syllabus', 'fn':'M.ciniki_musicfestivals_main.messagerefs.switchTab(\"sections\");'},\n 'categories':{'label':'Categories', \n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.section_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.messagerefs.switchTab(\"categories\");',\n },\n 'classes':{'label':'Classes', \n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.category_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.messagerefs.switchTab(\"classes\");',\n },\n 'schedule':{'label':'Schedule', 'fn':'M.ciniki_musicfestivals_main.messagerefs.switchTab(\"schedule\");'},\n 'divisions':{'label':'Divisions', \n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.schedule_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.messagerefs.switchTab(\"divisions\");',\n },\n 'timeslots':{'label':'Timeslots', \n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.division_id > 0 ? 'yes' : 'no'; },\n 'fn':'M.ciniki_musicfestivals_main.messagerefs.switchTab(\"timeslots\");',\n },\n 'tags':{'label':'Registration Tags', \n 'visible':function() { return M.modFlagSet('ciniki.musicfestivals', 0x2000); },\n 'fn':'M.ciniki_musicfestivals_main.messagerefs.switchTab(\"tags\");',\n },\n 'teachers':{'label':'Teachers', 'fn':'M.ciniki_musicfestivals_main.messagerefs.switchTab(\"teachers\");'},\n 'competitors':{'label':'Competitors', 'fn':'M.ciniki_musicfestivals_main.messagerefs.switchTab(\"competitors\");'},\n }},\n/* '_file':{'label':'Attach Files', \n 'fields':{\n 'attachment1':{'label':'File 1', 'type':'file', 'hidelabel':'no'},\n 'attachment2':{'label':'File 2', 'type':'file', 'hidelabel':'no'},\n 'attachment3':{'label':'File 3', 'type':'file', 'hidelabel':'no'},\n 'attachment4':{'label':'File 4', 'type':'file', 'hidelabel':'no'},\n 'attachment5':{'label':'File 5', 'type':'file', 'hidelabel':'no'},\n }}, */\n 'sections':{'label':'Syllabus', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'sections' ? 'yes' : 'no';},\n 'cellClasses':['', 'alignright fabuttons'],\n },\n 'categories':{'label':'Categories', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'categories' ? 'yes' : 'no';},\n 'cellClasses':['', 'alignright fabuttons'],\n },\n 'classes':{'label':'Classes', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'classes' ? 'yes' : 'no';},\n 'cellClasses':['', 'alignright fabuttons'],\n },\n 'schedule':{'label':'Schedule', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'schedule' ? 'yes' : 'no';},\n 'cellClasses':['', 'alignright fabuttons'],\n },\n 'divisions':{'label':'Divisions', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'divisions' ? 'yes' : 'no';},\n 'cellClasses':['', 'alignright fabuttons'],\n },\n 'timeslots':{'label':'Timeslots', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'timeslots' ? 'yes' : 'no';},\n 'cellClasses':['', 'alignright fabuttons'],\n },\n 'tags':{'label':'Registration Tags', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'tags' ? 'yes' : 'no';},\n 'cellClasses':['', 'alignright fabuttons'],\n },\n// 'competitor_search':{'label':'Search Competitors', 'type':'simplegrid', 'num_cols':2,\n// 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'competitors' ? 'yes' : 'no';},\n// 'cellClasses':['', 'alignright fabuttons'],\n// },\n 'competitors':{'label':'Competitors', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'competitors' ? 'yes' : 'no';},\n 'headerValues':['Name', 'Status'],\n 'headerClasses':['', 'alignright'],\n 'cellClasses':['', 'alignright fabuttons'],\n 'sortable':'yes',\n 'sortTypes':['text', 'alttext'],\n },\n 'teachers':{'label':'Teachers', 'type':'simplegrid', 'num_cols':2,\n 'visible':function() { return M.ciniki_musicfestivals_main.messagerefs.sections._tabs.selected == 'teachers' ? 'yes' : 'no';},\n 'headerValues':['Name', 'Status'],\n 'headerClasses':['', 'alignright'],\n 'cellClasses':['', 'alignright fabuttons'],\n 'sortable':'yes',\n 'sortTypes':['text', 'alttext'],\n },\n '_buttons':{'label':'', 'buttons':{\n 'done':{'label':'Done', 'fn':'M.ciniki_musicfestivals_main.messagerefs.close();'},\n }},\n };\n this.messagerefs.cellSortValue = function(s, i, j, d) {\n if( d.added != null && d.added == 'yes' ) {\n return 1;\n } else if( d.included != null && d.included == 'yes' ) {\n return 2;\n } else {\n return 3;\n }\n }\n this.messagerefs.cellValue = function(s, i, j, d) {\n if( s == 'details' ) {\n switch(j) {\n case 0: return d.label;\n case 1: return d.value;\n }\n }\n if( s == 'objects' ) {\n switch(j) {\n case 0: return d.type;\n case 1: return d.label;\n case 2: return '<span class=\"faicon\">&#xf014;</span>&nbsp;';\n }\n }\n if( s == 'sections' || s == 'categories' || s == 'classes' || s == 'schedule' || s == 'divisions' || s == 'timeslots' || s == 'tags' || s == 'competitors' ) {\n if( j == 0 ) {\n return d.name;\n }\n if( j == 1 ) {\n if( d.added != null && d.added == 'yes' ) {\n if( this.data.message.status == 10 ) {\n return '<button onclick=\"event.stopPropagation();M.ciniki_musicfestivals_main.messagerefs.removeObject(\\'' + d.object + '\\',\\'' + d.id + '\\');\">Remove</button>';\n } else {\n return 'Added';\n }\n } else if( d.included != null && d.included == 'yes' ) {\n return 'Included';\n } else if( d.object != null && d.partial == null ) {\n if( this.data.message.status == 10 ) {\n return '<button onclick=\"event.stopPropagation();M.ciniki_musicfestivals_main.messagerefs.addObject(\\'' + d.object + '\\',\\'' + d.id + '\\');\">Add</button>';\n } else {\n return '';\n }\n } else if( d.object != null && d.partial == null ) {\n return '';\n }\n }\n }\n if( s == 'teachers' ) {\n if( j == 0 ) {\n return d.name;\n }\n if( j == 1 ) {\n var html = '';\n if( d.included != null ) {\n return 'Included';\n }\n else if( d.students != null ) {\n return '<button onclick=\"event.stopPropagation();M.ciniki_musicfestivals_main.messagerefs.removeObject(\\'ciniki.musicfestivals.students\\',\\'' + d.id + '\\');\">Remove Teacher & Students</button>';\n }\n else if( d.added != null ) {\n return '<button onclick=\"event.stopPropagation();M.ciniki_musicfestivals_main.messagerefs.removeObject(\\'ciniki.musicfestivals.teacher\\',\\'' + d.id + '\\');\">Remove Teacher</button>';\n }\n else { \n return '<button onclick=\"event.stopPropagation();M.ciniki_musicfestivals_main.messagerefs.addObject(\\'ciniki.musicfestivals.students\\',\\'' + d.id + '\\');\">Add Teacher & Students</button>'\n + ' <button onclick=\"event.stopPropagation();M.ciniki_musicfestivals_main.messagerefs.addObject(\\'ciniki.musicfestivals.teacher\\',\\'' + d.id + '\\');\">Add Teacher Only</button>';\n }\n }\n \n }\n }\n this.messagerefs.cellFn = function(s, i, j, d) {\n if( s == 'objects' && j == 2 ) { \n return 'M.ciniki_musicfestivals_main.messagerefs.removeObject(\\'' + d.object + '\\',\\'' + d.object_id + '\\');';\n }\n }\n this.messagerefs.rowClass = function(s, i, d) {\n if( (d.partial != null && d.partial == 'yes') ) {\n return 'statusorange';\n }\n else if( (d.added != null && d.added == 'yes')\n || (d.included != null && d.included == 'yes') \n || (d.students != null && d.students == 'yes') \n ) {\n return 'statusgreen';\n }\n }\n this.messagerefs.rowFn = function(s, i, d) {\n if( s == 'sections' || s == 'categories' || s == 'schedule' || s == 'divisions' ) {\n if( d.added == null && d.included == null ) {\n return 'M.ciniki_musicfestivals_main.messagerefs.switchSubTab(\\'' + s + '\\',' + d.id + ');';\n }\n }\n return '';\n }\n this.messagerefs.extractRecipients = function() {\n M.api.getJSONCb('ciniki.musicfestivals.messageGet', {'tnid':M.curTenantID, \n 'message_id':this.message_id, \n 'allrefs':'yes', \n 'section_id':this.section_id, \n 'category_id':this.category_id,\n 'schedule_id':this.schedule_id, \n 'division_id':this.division_id,\n 'action':'extractrecipients',\n }, this.openFinish);\n }\n this.messagerefs.switchTab = function(t) {\n this.sections._tabs.selected = t;\n if( t == 'sections' || t == 'schedule' || t == 'teachers' || t == 'competitors' || t == 'tags' ) {\n this.section_id = 0;\n this.category_id = 0;\n this.schedule_id = 0;\n this.division_id = 0;\n this.registration_tag = '';\n }\n else if( t == 'categories' ) {\n this.category_id = 0;\n this.schedule_id = 0;\n this.division_id = 0;\n this.registration_tag = '';\n }\n else if( t == 'divisions' ) {\n this.section_id = 0;\n this.category_id = 0;\n this.division_id = 0;\n this.registration_tag = '';\n }\n this.open();\n }\n this.messagerefs.switchSubTab = function(s, id) {\n/* if( s == 'sections' || s == 'schedule' || s == 'teachers' || s == 'competitors' ) {\n this.section_id = 0;\n this.category_id = 0;\n this.schedule_id = 0;\n this.division_id = 0;\n }\n else if( s == 'categories' ) {\n this.category_id = 0;\n this.schedule_id = 0;\n this.division_id = 0;\n }\n else if( s == 'divisions' ) {\n this.section_id = 0;\n this.category_id = 0;\n this.division_id = 0;\n } */\n if( s == 'sections' ) {\n this.section_id = id;\n this.switchTab('categories');\n }\n if( s == 'categories' ) {\n this.category_id = id;\n this.switchTab('classes');\n }\n if( s == 'schedule' ) {\n this.schedule_id = id;\n this.switchTab('divisions');\n }\n if( s == 'divisions' ) {\n this.division_id = id;\n this.switchTab('timeslots');\n }\n }\n this.messagerefs.updateFlags = function() {\n var f = this.data.message.flags;\n if( (this.formValue('flags1')&0x01) == 0x01 ) {\n f |= 0x01;\n } else {\n f &= 0xFFFE;\n }\n if( (this.formValue('flags1')&0x02) == 0x02 ) {\n f |= 0x02;\n } else {\n f &= 0xFFFD;\n }\n if( f != this.data.message.flags ) {\n M.api.getJSONCb('ciniki.musicfestivals.messageGet', {'tnid':M.curTenantID, \n 'message_id':this.message_id, \n 'allrefs':'yes', \n 'section_id':this.section_id, \n 'category_id':this.category_id,\n 'schedule_id':this.schedule_id, \n 'division_id':this.division_id,\n 'action':'updateflags',\n 'flags':f,\n }, this.openFinish);\n } \n }\n this.messagerefs.addObject = function(o, oid) {\n M.api.getJSONCb('ciniki.musicfestivals.messageGet', {'tnid':M.curTenantID, \n 'message_id':this.message_id, \n 'allrefs':'yes', \n 'section_id':this.section_id, \n 'category_id':this.category_id,\n 'schedule_id':this.schedule_id, \n 'division_id':this.division_id,\n 'action':'addref',\n 'object':o,\n 'object_id':oid,\n }, this.openFinish);\n }\n this.messagerefs.removeObject = function(o, oid) {\n M.api.getJSONCb('ciniki.musicfestivals.messageGet', {'tnid':M.curTenantID, \n 'message_id':this.message_id, \n 'allrefs':'yes', \n 'section_id':this.section_id, \n 'category_id':this.category_id,\n 'schedule_id':this.schedule_id, \n 'division_id':this.division_id,\n 'action':'removeref',\n 'object':o,\n 'object_id':oid,\n }, this.openFinish);\n }\n this.messagerefs.open = function(cb, mid) {\n if( cb != null ) { this.cb = cb; }\n if( mid != null ) { this.message_id = mid; }\n M.api.getJSONCb('ciniki.musicfestivals.messageGet', {'tnid':M.curTenantID, \n 'message_id':this.message_id, \n 'allrefs':'yes', \n 'section_id':this.section_id, \n 'category_id':this.category_id,\n 'schedule_id':this.schedule_id, \n 'division_id':this.division_id,\n }, this.openFinish);\n }\n this.messagerefs.openFinish = function(rsp) {\n if( rsp.stat != 'ok' ) {\n M.api.err(rsp);\n return false;\n }\n var p = M.ciniki_musicfestivals_main.messagerefs;\n p.data = rsp;\n p.data.flags = rsp.message.flags;\n p.data.details = rsp.message.details;\n p.data.objects = rsp.message.objects;\n p.refresh();\n p.show();\n }\n this.messagerefs.goback = function() {\n if( this.sections._tabs.selected == 'categories' ) {\n this.switchTab(\"sections\");\n } else if( this.sections._tabs.selected == 'classes' ) {\n this.switchTab(\"categories\");\n } else if( this.sections._tabs.selected == 'divisions' ) {\n this.switchTab(\"schedule\");\n } else if( this.sections._tabs.selected == 'timeslots' ) {\n this.switchTab(\"divisions\");\n } else {\n this.close();\n }\n }\n this.messagerefs.addLeftButton('back', 'Back', 'M.ciniki_musicfestivals_main.messagerefs.goback();');\n\n //\n // Start the app\n // cb - The callback to run when the user leaves the main panel in the app.\n // ap - The application prefix.\n // ag - The app arguments.\n //\n this.start = function(cb, ap, ag) {\n args = {};\n if( ag != null ) {\n args = eval(ag);\n }\n \n //\n // Create the app container\n //\n var ac = M.createContainer(ap, 'ciniki_musicfestivals_main', 'yes');\n if( ac == null ) {\n M.alert('App Error');\n return false;\n }\n\n //\n // Initialize for tenant\n //\n if( this.curTenantID == null || this.curTenantID != M.curTenantID ) {\n this.tenantInit();\n this.curTenantID = M.curTenantID;\n }\n\n if( args.item_object != null && args.item_object == 'ciniki.musicfestivals.registration' && args.item_object_id != null ) {\n this.registration.open(cb, args.item_object_id, 0, 0, 0, null, args.source);\n } else if( args.registration_id != null && args.registration_id != '' ) {\n this.registration.open(cb, args.registration_id, 0, 0, 0, null, '');\n } else if( args.festival_id != null && args.festival_id != '' ) {\n this.festival.list_id = 0;\n this.festival.open(cb, args.festival_id, null);\n } else {\n this.festival.list_id = 0;\n this.menu.sections._tabs.selected = 'festivals';\n this.menu.open(cb);\n }\n }\n\n this.tenantInit = function() {\n this.festival.typestatus = '';\n this.festival.sections.ipv_tabs.selected = 'all';\n this.classes.sections._tabs.selected = 'fees';\n this.festival.section_id = 0;\n this.festival.schedulesection_id = 0;\n this.festival.scheduledivision_id = 0;\n this.festival.list_id = 0;\n this.festival.listsection_id = 0;\n this.festival.nplists = {};\n this.festival.nplist = [];\n this.festival.messages_status = 10;\n this.festival.city_prov = 'All';\n this.festival.province = 'All';\n this.festival.registration_tag = '';\n }\n}", "function toMenu()\n {\n /**\n * Opens a fan of a desk in the pause menu\n */\n function openFan()\n {\n toggleHideElements([DOM.pause.deskContainer], animation.duration.hide, false);\n desk.toggleFan(4, 35, 10, true);\n for (var counter = 0; counter < desk.cards.length; counter++)\n {\n if (state.isWin)\n {\n desk.cards[counter].turn(true);\n desk.cards[counter].dataset.turned = true;\n }\n else if (desk.cards[counter].dataset.turned == true)\n {\n desk.cards[counter].turn(true);\n }\n }\n state.isWin = false;\n }\n\n /**\n * Shows menu elements\n */\n function showMenu()\n {\n if (state.screen == \"GAME\")\n {\n cards[0].removeEventListener(\"move\", showMenuId);\n DOM.pause.deskContainer.style.opacity = 1;\n DOM.cardsContainer.classList.add(CSS.hidden);\n }\n\n if (state.isWin)\n {\n DOM.pause.deskContainer.style.opacity = 0;\n DOM.pause.headline.innerHTML = (state.score >= 0 ? \"Победа со счётом: \" : \"Потрачено: \") + state.score;\n DOM.pause.options.continue.disabled = true;\n state.score = 0;\n }\n else\n {\n DOM.pause.headline.innerHTML = \"MEMORY GAME\";\n }\n\n DOM.container.classList.remove(CSS.container.game);\n DOM.container.classList.add(CSS.container.pause);\n state.screen = \"MENU\";\n\n toggleHideElements(\n [DOM.pause.options.continue, DOM.pause.options.newGame, DOM.pause.headline],\n animation.duration.hide,\n false,\n openFan.bind(this)\n );\n }\n\n /**\n * Hides a game field\n */\n function hideGameField(follower)\n {\n toggleHideElements([DOM.game.score, DOM.game.pauseButton], animation.duration.hide, true, follower);\n }\n\n /**\n * Moves cards from the field to the desk\n */\n function takeCards()\n {\n if (state.turnedCard)\n {\n state.turnedCard.turn(true);\n }\n\n showMenuId = cards[0].addEventListener(\"move\", showMenu);\n\n for (var counter = 0; counter < cards.length; counter++)\n {\n cards[counter].move(DOM.cardsContainer, {width: sizes.desk.width + \"PX\", height: sizes.desk.height + \"PX\"}, true);\n }\n }\n\n state.cardsTurnable = false;\n if (state.screen == \"GAME\")\n {\n var showMenuId;\n hideGameField();\n takeCards();\n }\n else\n {\n hideGameField(showMenu.bind(this));\n }\n }", "function HappyMealMenu() {\n \n const dispatch = useDispatch();\n const menu = useSelector(state => state.happyMeal.menu, shallowEqual);\n \n // use 'react-redux' to load in happy meals from backend. \n useEffect(() => {\n dispatch(fetchMenuFromAPI('LOAD_HAPPY_MEAL_MENU', 'happy-meal'));\n }, [dispatch]);\n \n return (\n // render happy meal items as a list of buttons. \n <div className=\"Happy-Meals-Container\">\n {menu && menu.map(food => \n <DessertButton \n key={uuidv4()}\n id={uuidv4()} \n name={food.name} \n image={food.imagesrc}\n />)\n }\n </div>\n )\n}", "function spellsMenu() {\n $scope.menuTitle = createText(\"Spells\", [20, 10]);\n createText(\"Not yet implemented\", [50, 80], {});\n }", "function showMenu() {\n rectMode(CENTER);\n fill(colorList[2]);\n rect(buttonX, buttonY, buttonWidth, buttonHeight);\n \n textAlign(CENTER, CENTER);\n fill(colorList[5]);\n text(\"How to Play\", buttonX, buttonY);\n\n fill(colorList[3]);\n rect(buttonX, secondButtonYpos, buttonWidth, buttonHeight);\n \n textAlign(CENTER, CENTER);\n fill(colorList[4]);\n text(\"Dancing Block\", buttonX, secondButtonYpos);\n \n}", "function simulat_menu_infos() {\n display_menu_infos();\n}", "createMenus (){\n \n $.each(MenuData.menus, ( menuName, menuItems )=>{\n \n $('#gameNav-'+menuName+'Panel > .menu-links').html('');\n \n $.each(menuItems,( index, item )=>{\n \n var realRoute,itemLink,action,routeId;\n \n if(item.hideIfNotAuthenticated && !this.get('session.isAuthenticated')){\n return true;\n }\n \n if(item.label){\n // Translate item label\n let key = \"menu.\"+Ember.String.dasherize(menuName)+\".\"+Ember.String.dasherize(item.label);\n item.tLabel = this.get('i18n').t(key);\n }\n \n // Serialize route name for use as CSS id name\n item.cssRoute = item.route.replace(/\\./g,'_');\n \n // Track actionable link\n let addEvent = true;\n \n if(item.menuRoute){\n \n // For routes which don't appear in the menu but will cause a different menu link to highlight\n itemLink = $('<a id=\"menuItem_'+item.cssRoute+'\" class=\"menu-link game-nav hidden\" data-menu-route=\"'+item.menuRoute+'\"></a>');\n addEvent = false;\n \n } else if(item.tempRoute){\n itemLink = $('<a href=\"/'+item.tempRoute+'\" id=\"menuItem_'+item.cssRoute+'\" class=\"btn-a menu-link game-nav\">'+item.tLabel+'</a>');\n action = 'transitionAction';\n realRoute = item.tempRoute;\n \n } else if(item.route){\n itemLink = $('<a href=\"/'+item.route+'\" id=\"menuItem_'+item.cssRoute+'\" class=\"btn-a menu-link game-nav\">'+item.tLabel+'</a>');\n action = 'transitionAction';\n realRoute = item.route;\n \n if(item.params && item.params.id){\n routeId = item.params.id;\n }\n \n } else if(item.action) {\n itemLink = $('<a class=\"btn-a menu-link game-nav\">'+item.tLabel+'</a>');\n let actionName = 'menuAction'+item.label.alphaNumeric();\n action = actionName;\n this.set(actionName,item.action);\n }\n \n if(itemLink){\n \n if(addEvent){\n itemLink.on('click',(e)=>{\n e.preventDefault();\n this.sendAction(action,realRoute,routeId);\n \n if(routeId){\n Ember.Blackout.transitionTo(realRoute,routeId);\n } else {\n Ember.Blackout.transitionTo(realRoute);\n }\n \n this.selectMenuLink(item.route);\n return false;\n });\n }\n \n $('#gameNav-'+menuName+'Panel > .menu-links').append(itemLink);\n }\n \n });\n });\n\n // Manually update hover watchers\n Ember.Blackout.refreshHoverWatchers();\n \n }", "function showMenu(type) {\n switch (type) {\n case 'beer':\n addBasicMenu();\n lastMenu = type;\n showParticularMenu(allBeveragesOfType(\"Öl\"));\n break;\n case 'wine':\n addBasicMenu();\n lastMenu = type;\n showParticularMenu(allBeveragesOfType(\"vin\"));\n break;\n case 'spirits':\n addBasicMenu();\n lastMenu = type;\n showParticularMenu(allBeveragesWithStrength(\"above\", 20));\n break;\n case 'alcoAbove':\n lastMenu = type;\n if (document.getElementById(\"alco_percent\") != null) {\n alcoPercent = document.getElementById(\"alco_percent\").value;\n }\n addBasicMenu();\n showParticularMenu(allBeveragesWithStrength(\"above\", alcoPercent));\n break;\n case 'alcoBelow':\n lastMenu = type;\n if (document.getElementById(\"alco_percent\") != null) {\n alcoPercent = document.getElementById(\"alco_percent\").value;\n }\n addBasicMenu();\n showParticularMenu(allBeveragesWithStrength(\"below\", alcoPercent));\n break;\n case 'tannin':\n addBasicMenu();\n lastMenu = type;\n showParticularMenu([]);\n break;\n case 'gluten':\n addBasicMenu();\n lastMenu = type;\n showParticularMenu([]);\n break;\n case 'rest':\n currentFiltering = \"rest\";\n showMenu(lastMenu);\n break;\n case 'cat':\n currentFiltering = \"cat\";\n showMenu(lastMenu);\n break;\n case 'back':\n currentFiltering = \"none\";\n showMenu(allMenuBeverages());\n break;\n default:\n addBasicMenu();\n lastMenu = type;\n showParticularMenu(allMenuBeverages());\n }\n}", "function showmenu(ev, category, deleted = false) {\n //stop the real right click menu\n ev.preventDefault();\n var mouseX;\n let element = \"\";\n if (ev.pageX <= 200) {\n mouseX = ev.pageX + 10;\n } else {\n let active_class = $(\"#sidebarCollapse\").attr(\"class\");\n if (active_class.search(\"active\") == -1) {\n mouseX = ev.pageX - 210;\n } else {\n mouseX = ev.pageX - 50;\n }\n }\n\n var mouseY = ev.pageY - 10;\n\n if (category === \"folder\") {\n if (deleted) {\n $(menuFolder)\n .children(\"#reg-folder-delete\")\n .html(\"<i class='fas fa-undo-alt'></i> Restore\");\n $(menuFolder).children(\"#reg-folder-rename\").hide();\n $(menuFolder).children(\"#folder-move\").hide();\n $(menuFolder).children(\"#folder-description\").hide();\n } else {\n if ($(\".selected-item\").length > 2) {\n $(menuFolder)\n .children(\"#reg-folder-delete\")\n .html('<i class=\"fas fa-minus-circle\"></i> Delete All');\n $(menuFolder)\n .children(\"#folder-move\")\n .html('<i class=\"fas fa-external-link-alt\"></i> Move All');\n $(menuFolder).children(\"#reg-folder-rename\").hide();\n $(menuFolder).children(\"#folder-description\").hide();\n } else {\n $(menuFolder)\n .children(\"#reg-folder-delete\")\n .html(\"<i class='far fa-trash-alt fa-fw'></i>Delete\");\n $(menuFolder)\n .children(\"#folder-move\")\n .html('<i class=\"fas fa-external-link-alt\"></i> Move');\n $(menuFolder).children(\"#folder-move\").show();\n $(menuFolder).children(\"#reg-folder-rename\").show();\n $(menuFolder).children(\"#folder-description\").show();\n }\n }\n menuFolder.style.display = \"block\";\n $(\".menu.reg-folder\").css({ top: mouseY, left: mouseX }).fadeIn(\"slow\");\n } else if (category === \"high-level-folder\") {\n if (deleted) {\n $(menuHighLevelFolders)\n .children(\"#high-folder-delete\")\n .html(\"<i class='fas fa-undo-alt'></i> Restore\");\n $(menuHighLevelFolders).children(\"#high-folder-rename\").hide();\n $(menuHighLevelFolders).children(\"#folder-move\").hide();\n $(menuHighLevelFolders).children(\"#tooltip-folders\").show();\n } else {\n if ($(\".selected-item\").length > 2) {\n $(menuHighLevelFolders)\n .children(\"#high-folder-delete\")\n .html('<i class=\"fas fa-minus-circle\"></i> Delete All');\n $(menuHighLevelFolders).children(\"#high-folder-delete\").show();\n $(menuHighLevelFolders).children(\"#high-folder-rename\").hide();\n $(menuHighLevelFolders).children(\"#folder-move\").hide();\n $(menuHighLevelFolders).children(\"#tooltip-folders\").show();\n } else {\n $(menuHighLevelFolders)\n .children(\"#high-folder-delete\")\n .html(\"<i class='far fa-trash-alt fa-fw'></i>Delete\");\n $(menuHighLevelFolders).children(\"#high-folder-delete\").show();\n $(menuHighLevelFolders).children(\"#high-folder-rename\").hide();\n $(menuHighLevelFolders).children(\"#folder-move\").hide();\n $(menuHighLevelFolders).children(\"#tooltip-folders\").show();\n }\n }\n menuHighLevelFolders.style.display = \"block\";\n $(\".menu.high-level-folder\")\n .css({ top: mouseY, left: mouseX })\n .fadeIn(\"slow\");\n } else {\n if (deleted) {\n $(menuFile)\n .children(\"#file-delete\")\n .html(\"<i class='fas fa-undo-alt'></i> Restore\");\n $(menuFile).children(\"#file-rename\").hide();\n $(menuFile).children(\"#file-move\").hide();\n $(menuFile).children(\"#file-description\").hide();\n } else {\n if ($(\".selected-item\").length > 2) {\n $(menuFile)\n .children(\"#file-delete\")\n .html('<i class=\"fas fa-minus-circle\"></i> Delete All');\n $(menuFile)\n .children(\"#file-move\")\n .html('<i class=\"fas fa-external-link-alt\"></i> Move All');\n $(menuFile).children(\"#file-rename\").hide();\n $(menuFile).children(\"#file-description\").hide();\n } else {\n $(menuFile)\n .children(\"#file-delete\")\n .html(\"<i class='far fa-trash-alt fa-fw'></i>Delete\");\n $(menuFile)\n .children(\"#file-move\")\n .html('<i class=\"fas fa-external-link-alt\"></i> Move');\n $(menuFile).children(\"#file-rename\").show();\n $(menuFile).children(\"#file-move\").show();\n $(menuFile).children(\"#file-description\").show();\n }\n }\n menuFile.style.display = \"block\";\n $(\".menu.file\").css({ top: mouseY, left: mouseX }).fadeIn(\"slow\");\n }\n}", "function menu(menuArray)\n{\n if(skip === true) {\n skip = false;\n }\n novel.ignoreClicks = true;\n novel.dialog.innerHTML =\n menuArray[0].replace(/{{(.*?)}}/g, novel_interpolator);\n novel.dialog.style.textAlign=\"center\";\n for (var i = 1; i < menuArray.length; i += 2)\n {\n var mItem = new MenuItem((i-1) / 2, menuArray[i], menuArray[i+1]); \n var el = mItem.domRef;\n novel_addOnClick(el, menuArray[i+1]);\n el.innerHTML = menuArray[i].replace(/{{(.*?)}}/g, novel_interpolator);\n novel.tableau.appendChild(el);\n novel.actors.push(mItem);\n }\n novel.paused = true;\n}", "openMenu(scene, index = 0) {\n this.index = index;\n this.parentIndex = undefined;\n\n //A few initial variables\n const gameWidth = scene.sys.game.config.width;\n const gameHeight = scene.sys.game.config.height;\n const cellWidth = 500;\n const cellHeight = 48;\n const length = this.categoriesGroup.getLength();\n\n //Remove old listeners & reset\n this.closeMenus(scene);\n\n //Change alpha of selected menu\n this.categoriesGroup.children.entries[index].setAlpha(1);\n // this.categoriesGroup.children.entries[index].setBackgroundColor('#000000');\n\n //Vertical Line\n const graphics = scene.add.graphics();\n graphics.lineStyle(1, 0xffffff);\n graphics.lineBetween(gameWidth - cellWidth, gameHeight * 2 / 3, gameWidth - cellWidth, gameHeight);\n\n const actions = this.categoriesGroup.children.entries[index].children;\n this.actionsGroup = scene.add.group();\n let nOfOptions = actions.length;\n\n for (let i = 0; i < nOfOptions; i++) {\n let itemsLeft = \"\";\n if (actions[i].supply > 0 && actions[i]) {\n itemsLeft = ` (${ actions[i].supply })`;\n }\n else if (actions[i].supply <= 0) {\n actions.pop(actions[i--]);\n nOfOptions--;\n continue;\n }\n\n const y = gameHeight * 2 / 3 + cellHeight * i;\n const x = 10 + gameWidth - cellWidth;\n\n let addedText = scene.add.bitmapText(x, y, 'welbutrin', `${ actions[i].name + itemsLeft }`, 32);\n addedText.setAlpha(0.5);\n this.actionsGroup.add(addedText);\n }\n\n //If there are no options in a particular menu, display an error\n if (this.actionsGroup.children.size === 0) {\n const y = gameHeight * 2 / 3;\n const x = 10 + gameWidth - cellWidth;\n\n let addedText = scene.add.bitmapText(x, y, 'welbutrin', 'Nothing to see here!', 32);\n this.actionsGroup.add(addedText);\n }\n }", "function ocultarMenu(){\n\t\t$(\"#js-menu-recipe\").hide();\n}", "function addPlantMenu(menu) {\n \n //call a function to create UL with plants at the position of a click\n const dropDownMenu = getUL(menu);\n \n //assign an onclick response that adds a plant(s)\n dropDownMenu.addEventListener(\"click\", function(evt) {\n \n //make sure the click is on a custom choice (inside a menu)\n if (!evt.target.classList.contains(\"customChoice\")) {\n return;\n }\n \n //capture plant li elements from the menu into an array so that their properties can be accessed\n const ar = Array.from(evt.target.parentElement.getElementsByTagName(\"li\"));\n \n //when adding plants to a garden, x-offset is calculated for each height group; the following determines how many plants fall into each height group, then the width is divided by the number of plants to calculate the available horizontal space between plants\n const xSp1 = menu.gW / (ar.filter(x => rangeCheck(x.getAttribute(\"data-avgh\"),0,24)).length);\n const xSp2 = menu.gW / (ar.filter(x => rangeCheck(x.getAttribute(\"data-avgh\"),24,48)).length);\n const xSp3 = menu.gW / (ar.filter(x => rangeCheck(x.getAttribute(\"data-avgh\"),48,72)).length);\n const xSp4 = menu.gW / (ar.filter(x => Number(x.getAttribute(\"data-avgh\")) >= 72).length);\n\n //when adding plants to a garden, x-offset variable is calculated for each height group and 1x..4 is for current plant's offset\n let x1 = x2 = x3 = x4 = 0;\n //for vertical offset, the yOffset is for each plant height group then the y1..4 is the small offset for each plant, so that they're not clustered together\n let y1 = y2 = y3 = y4 = 0;\n \n //loop through filtered plants and add them; when adding to a garden, the plant is centered within the garden; otherwise, it's placed to the left of menu; \n //if the menu was brought up too close to the left edge of the screen, the plant is placed to the right; vertically, the plant is at the position of its listing in the menu\n //unless 'Add All Plants' option is clicked, add 1 plant (because liCnt includes the 'Add All Plants' option, the itiration starts at 1, thus set liCnt to 2 for a sinlge addition)\n for (let i = 1, liCnt = evt.target.innerText === \"Add All Plants\"? ar.length : 2; i < liCnt; i++) {\n \n //the x and y offsets for plants added to a garden or freestanding\n let xOffset = yOffset = 0;\n\n //for plants added to a garden\n if (menu.gId) {\n //if adding all plants to a garden, space them at the intervals calculated below\n if (evt.target.innerText === \"Add All Plants\") {\n\n //using garden height, gH, calculate the desired vertical spacing of plant groups; horizontally, plants are placed at xOffset intervals\n yOffset = menu.gH / 3; //3 spaces between 4 groups\n if (Number(evt.target.parentElement.children[i].getAttribute(\"data-avgh\")) < 24) {\n //the shortest plants go to the front (bottom), thus the biggest offset\n yOffset *= 2; \n xOffset = menu.gX + x1 * xSp1;\n x1++;\n } else if (Number(evt.target.parentElement.children[i].getAttribute(\"data-avgh\")) < 48) {\n yOffset *= 1.5;\n xOffset = menu.gX + x2 * xSp2;\n x2++;\n } else if (Number(evt.target.parentElement.children[i].getAttribute(\"data-avgh\")) < 72) {\n xOffset = menu.gX + x3 * xSp3;\n x3++;\n } else {\n yOffset *= 0.5;\n xOffset = menu.gX + x4 * xSp4;\n x4++;\n }\n \n yOffset = menu.gY + yOffset;\n \n //alternate vertical position slightly\n if (i%2) yOffset += munit*2;\n\n }\n else {\n xOffset = menu.gX + menu.gW/2;\n yOffset = menu.gY + menu.gH/2;\n }\n }\n \n //for freestanding plants\n else {\n //Y-OFFSET: when adding all plants, space them vertically 16px apart; otherwise, the vertical placing is at the location of the name in the list; \n yOffset = evt.target.innerText === \"Add All Plants\" ? \n parseInt(window.getComputedStyle(evt.target.parentElement).top) + 16 * i : \n event.pageY;\n //X-OFFSET: if the menu is too close (within 150px) to the left edge of the screen, add the plant on the right, otherwise - left\n// todo: check if the x-calculation creates a result that's too long\n if (parseInt(evt.target.parentElement.style.left) < 150) {\n //xOffset needs to include the alphabet shortcuts that all plants have on the sides\n xOffset = menu.type === \"all\" ? \n parseInt(evt.target.parentElement.nextSibling.nextSibling.style.left) + munit * 5 : \n parseInt(evt.target.parentElement.style.left) + parseInt(window.getComputedStyle(evt.target.parentElement).width) + munit * 3;\n } else {\n xOffset = menu.type === \"all\" ? \n parseInt(evt.target.parentElement.nextSibling.style.left) - parseInt(window.getComputedStyle(evt.target.parentElement).width) * 0.7 : \n parseInt(evt.target.parentElement.style.left) - parseInt(window.getComputedStyle(evt.target.parentElement).width) * 0.7;\n }\n }\n \n const plantLi = evt.target.innerText != \"Add All Plants\" ? evt.target : evt.target.parentElement.children[i];\n\n addPlant({\n pId:null, //plant id is set to null, when creating a new plant\n x: parseFloat(xOffset),\n y: parseFloat(yOffset),\n w:Number(plantLi.getAttribute(\"data-avgw\")),\n h:Number(plantLi.getAttribute(\"data-avgh\")),\n nm:plantLi.innerText, //plant's common name\n gId:menu.gId?menu.gId:0, //a garden id, where the new plant is planted, 0 at first\n lnm:plantLi.getAttribute(\"data-lnm\"), //plant's latin name\n shp:plantLi.getAttribute(\"data-shp\"),\n clr:plantLi.getAttribute(\"data-bloomC\"),\n blm:plantLi.getAttribute(\"data-bloomM\")\n });\n }\n });\n \n //the menu with event listeners have been created, now the menu is added to the document's body, not svg\n document.body.appendChild(dropDownMenu);\n}", "function startMenu() {\n createManager();\n}", "function menu(){\n background(img,0);\n //retangulo para selecionar a tela\n fill(255, 204, 0)\n rect(imgpont,xrectmenu,yrectmenu,larguramenu,alturamenu,20)\n image(imgpont,xrectmenu,yrectmenu,larguramenu,alturamenu,20)\n fill(233,495,67);\n textSize(26);\n text('JOGAR ', 250, 100)\n //detalhes do texto abaixo\n fill(233,495,67);\n textSize(26);\n text('INSTRUÇÕES', 230, 200);\n text('CREDITOS', 230, 300);\n }", "function RenderDish({selectedDish}){\n //check for null dish\n if(selectedDish!=null){\n return(\n <Card>\n <CardImg width=\"100%\" top src={selectedDish.image} alt={selectedDish.name}/>\n <CardBody>\n <CardTitle>{selectedDish.name}</CardTitle>\n <CardText>{selectedDish.description}</CardText>\n </CardBody>\n </Card>\n );\n }else{\n return(\n <div></div>\n );\n }\n \n }", "function menuItems() {\n const farmMenu = document.createElement('div');\n farmMenu.classList.add('menu');\n \n farmMenu.appendChild(createItem(\n 'beef tartare', \n '$14',\n 'egestas pretium aenean pharetra magna ac placerat vestibulum'));\n farmMenu.appendChild(createItem(\n 'mussels provencale',\n '$20',\n 'sed adipiscing diam donec adipiscing tristique risus nec'));\n farmMenu.appendChild(createItem(\n 'scallops', \n '$18',\n 'vitae congue mauris rhoncus aenean vel elit scelerisque'));\n farmMenu.appendChild(createItem(\n 'flemish onion soup', \n '$10',\n 'elit ullamcorper dignissim cras tincidunt lobortis feugiat vivamus'));\n farmMenu.appendChild(createItem(\n 'braised short ribs', \n '$22',\n 'sagittis purus sit amet volutpat consequat mauris nunc'));\n farmMenu.appendChild(createItem(\n 'wedge salad', \n '$10',\n 'nibh sed pulvinar proin gravida hendrerit lectus a'));\n farmMenu.appendChild(createItem(\n 'charcuterie', \n '$16',\n 'non blandit massa enim nec dui nunc mattis'));\n\n return farmMenu;\n }", "function showShop() {\n\tmenuHideAll();\n\t$('#shop').show();\n\tmenuResetColors();\n\tmenuSetColor('shopBox');\n}", "function showMenu( el, type ) {\n\tvar list;\n\tvar type;\n\tvar target;\n\n\tlist = el.childNodes;\n\n\tif( type == null ) {\n\t\ttype = 'TABLE';\n\t}\n\n\tif ( el.className == \"menutitle\" ) {\n\t\t// el.style.color = \"#4c6490\";\n\t\tel.style.color = \"#eeeeff\";\n\t\tel.style.backgroundColor = 'white';\n\t\tel.style.borderStyle = 'solid';\n\t\tel.style.borderWidth = '1px';\n\t\tel.style.borderColor = '#4c6490';\n\t\tel.style.margin = '1px';\n\t}\n\n\tfor ( i=0; i < list.length; i++ ) {\n\t\tif(( list[i].nodeName == 'DIV' ) &&\n\t\t\t( list[i].className == \"submenuitem\" ) ) {\n\t\t\tlist[i].style.borderStyle = 'solid';\n\t\t\tlist[i].style.borderColor = '#ccc';\n\t\t\tlist[i].style.borderWidth = '1px';\n\t\t\tlist[i].style.backgroundColor = '#fefeff';\n\t\t}\n\n\t\tif( list[i].nodeName != type ) {\n\t\t\tcontinue;\n\t\t};\n\n\t\tfadeInit ( list[i], 'in' );\n\t}\n}", "function display_start_menu() {\n\tstart_layer.show();\n\tstart_layer.moveToTop();\n\t\n\tdisplay_menu(\"start_layer\");\n\tcharacter_layer.moveToTop();\n\tcharacter_layer.show();\n\tinventory_bar_layer.show();\n\t\n\tstage.draw();\n\t\n\tplay_music('start_layer');\n}", "function getMenu(str) {\n \n\tmanageDOM.clearContent(\"content\");\n \n\t// query mongoDB for cached menu\n\tlet day = str === \"today\" ? \"Today\" : \"Tomorrow\";\n\tlet menuDay = Menu.findOne( {\"day\": day});\n \n\t// Builds html elements for either today's or tomorrow's menu\n\tmenuDay.exec( (err, data) => {\n\t\tif (err) throw (err);\n\t\telse if (data != null) {\n\t\t\tlet arr = [];\n\t\t\tlet i = 1;\n\n\t\t\tif (data.meal_0 != null) { arr.push(JSON.parse(data.meal_0)); }\n\t\t\tif (data.meal_1 != null) { arr.push(JSON.parse(data.meal_1)); }\n\t\t\tif (data.meal_2 != null) { arr.push(JSON.parse(data.meal_2)); }\n \n\t\t\t// create an array of elements to build the DOM\n\t\t\tlet meal_list = [\"cantina-wrapper center-div\", \"cantina-greet\"];\n\t\t\tfor (let j = 0; j < arr.length; j++) {\n\t\t\t\tmeal_list.push(\"spacer\" + i);\n\t\t\t\tmeal_list.push(\"time\" + i);\n\t\t\t\tmeal_list.push(\"meal\" + i);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tif (data.cafe42 != null) {\n\t\t\t\tmeal_list.push(\"spacer\" + i);\n\t\t\t\tmeal_list.push(\"cafe\");\n\t\t\t}\n\n\t\t\tmanageDOM.array2Div(meal_list);\n \n\t\t\tdocument.getElementById(\"cantina-greet\").innerHTML = \"the 42 cantina menu for \" + str + \" is\";\n \n\t\t\t// for each div, give it a class and add appropriate content whether it is time or meal descroption\n\t\t\tfor (i = 2; i < meal_list.length; i++) {\n\t\t\t\tif (meal_list[i][0] === \"t\") {\n\t\t\t\t\tlet date = new moment(Date.parse(arr[Math.floor((i - 2) / 3)].begin_at));\n\t\t\t\t\tlet date_end = new moment(Date.parse(arr[Math.floor((i - 2) / 3)].end_at));\n\t\t\t\t\tlet t = document.getElementById(meal_list[i]);\n\t\t\t\t\tlet item = arr[Math.floor((i - 1) / 3)];\n\t\t\t\t\tt.setAttribute(\"class\", \"cantina-hours\");\n\t\t\t\t\tt.innerHTML = \"<span style='text-decoration:underline'>\\\n $\" + item.price + \"</span> -- \\\n Served from \" + date.format(\"HH:mm\") + \" until \" + date_end.format(\"HH:mm\") + \":\"; \n\t\t\t\t}\n\t\t\t\telse if (meal_list[i][0] === \"m\") {\n\t\t\t\t\tlet m = document.getElementById(meal_list[i]);\n\t\t\t\t\tm.setAttribute(\"class\", \"meal\");\n\t\t\t\t\tlet item = arr[Math.floor((i - 2) / 3)];\n\t\t\t\t\tlet br = item.menu;\n\n\t\t\t\t\t// Replaces 'line feed' and 'carriage return' with and HTML break\n\t\t\t\t\tbr = br.replace(/\\r\\n/g, \"<br />\");\n\t\t\t\t\tm.innerHTML = br; \n\t\t\t\t}\n\t\t\t\telse if (meal_list[i][0] === \"c\") {\n\t\t\t\t\tlet c = document.getElementById(\"cafe\");\n\t\t\t\t\tc.setAttribute(\"class\", \"meal\");\n\t\t\t\t\tlet cafe42 = JSON.parse(data.cafe42);\n\t\t\t\t\tlet cafe42Menu = cafe42.menu;\n\t\t\t\t\tcafe42Menu = cafe42Menu.replace(/\\r\\n/g, \"<br />\").replace(\"cafe 42\",\n\t\t\t\t\t\t\"<span class=\\\"cafe\\\">Cafe 42:</span> ~ \\\n <span style=\\\"font-style:italic;text-decoration:underline\\\">\\\n $\" + cafe42.price + \"</span>\");\n\t\t\t\t\tc.innerHTML = cafe42Menu;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tlet s = document.getElementById(meal_list[i]);\n\t\t\t\t\ts.setAttribute(\"class\", \"spacing\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconsole.log(\"Error retrieving Cantina menu from Mongo DB\");\n\t\t}\n\t});\n}", "function dashSubMenu(){\n\t\t\tif(wid <= 600){\n\t\t\t\tmenuHS();\t\n\t\t\t}\n\t\t\t\n\t\t\t$(\"#dashInSubMenuId\").css(\"background-color\", \"#0E0E0E\");\n\t\t\t$(\"#costInSubMenuId\").css(\"background-color\", \"#3C3C3C\");\n\t\t\t$(\"#sellInSubMenuId\").css(\"background-color\", \"#3C3C3C\");\n\t\t\t$(\"#stockMenuId\").css(\"background-color\", \"#3C3C3C\");\n\t\t\t$(\"#settingInSubMenuId\").css(\"background-color\", \"#3C3C3C\");\n\t\t\twindow.location.assign(\"index.php\");\n}", "function openNewGameMenu () {\n document.getElementById('menu-background').style.display = 'block';\n document.getElementById('menu-content').style.display = 'block';\n}", "function AddCustomMenuItems(menu) {\n menu.AddItem(strMenuItemLoop, \n (doLoop == 1) ? gddMenuItemFlagChecked : 0, OnMenuClicked);\n menu.AddItem(strMenuItemShuffle, \n (doShuffle == 1) ? gddMenuItemFlagChecked : 0, OnMenuClicked);\n}", "function supervisorMenu() {\n inquirer\n .prompt({\n name: 'apple',\n type: 'list',\n message: 'What would you like to do?'.yellow,\n choices: ['View Product Sales by Department',\n 'View/Update Department',\n 'Create New Department',\n 'Exit']\n })\n .then(function (pick) {\n switch (pick.apple) {\n case 'View Product Sales by Department':\n departmentSales();\n break;\n case 'View/Update Department':\n updateDepartment();\n break;\n case 'Create New Department':\n createDepartment();\n break;\n case 'Exit':\n connection.end();\n break;\n }\n });\n}", "function init_dash() {\n dropDown();\n}", "setupMenu () {\n let dy = 17;\n // create buttons for the action categories\n this.menu.createButton(24, 0, () => this.selectionMode = 'info', this, null, 'info');\n this.menu.createButton(41, 0, () => this.selectionMode = 'job', this, null, 'job');\n // create buttons for each command\n for (let key of Object.keys(this.jobCommands)) {\n let button = this.menu.createButton(0, dy, () => this.jobCommand = key, this, this.jobCommands[key].name);\n dy += button.height + 1;\n }\n // set the hit area for the menu\n this.menu.calculateHitArea();\n // menu is closed by default\n this.menu.hideMenu();\n }", "function displayMenu() {\n inquirer.prompt(menuChoices).then((response) => {\n switch (response.selection) {\n case \"View Departments\":\n //call function that shows all departments\n viewDepartments();\n break;\n\n case \"Add Department\":\n //call function that adds a department\n addDepartment();\n break;\n\n case \"View Roles\":\n getRole();\n break;\n\n case \"Add Role\":\n addRole();\n break;\n\n case \"View Employees\":\n viewEmployee();\n break;\n\n case \"Add Employee\":\n addEmployee();\n break;\n\n case \"Update Employee\":\n break;\n\n default:\n connection.end();\n process.exit();\n // quit the app\n }\n });\n}", "function onOpen() {\n ui.createMenu('Daily Delivery Automation')\n .addItem('Run', 'confirmStart').addToUi();\n}", "function menu() {\n\t\n // Title of Game\n title = new createjs.Text(\"Poker Room\", \"50px Bembo\", \"#FF0000\");\n title.x = width/3.1;\n title.y = height/4;\n\n // Subtitle of Game\n subtitle = new createjs.Text(\"Let's Play Poker\", \"30px Bembo\", \"#FF0000\");\n subtitle.x = width/2.8;\n subtitle.y = height/2.8;\n\n // Creating Buttons for Game\n addToMenu(title);\n addToMenu(subtitle);\n startButton();\n howToPlayButton();\n\n // update to show title and subtitle\n stage.update();\n}", "function Restaurant(name, menu){\n this.name = name;\n this.menu = menu;\n}", "function menuzordActive () {\n if ($(\"#menuzord\").length) {\n $(\"#menuzord\").menuzord({\n indicatorFirstLevel: '<i class=\"fa fa-angle-down\"></i>'\n });\n };\n}", "function C999_Common_Achievements_MainMenu() {\n C999_Common_Achievements_ResetImage();\n\tSetScene(\"C000_Intro\", \"ChapterSelect\");\n}", "function getMenus(restaurant) {\n restaurantId = restaurant || \"\";\n if (restaurantId) {\n restaurantId = \"/?restaurant_id=\" + restaurantId;\n }\n $.get(\"/api/menus\" + restaurantId, function (data) {\n console.log(\"Menus\", data);\n menus = data;\n if (!menus || !menus.length) {\n displayEmpty(restaurant);\n }\n else {\n initializeRows();\n }\n });\n }", "showMenu() {\n this._game = null;\n this.stopRefresh();\n this._view.renderMenu();\n this._view.bindStartGame(this.startGame.bind(this));\n this._view.bindShowScores(this.showScores.bind(this));\n }", "function mainMenu() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"rawlist\",\n message: \"What would you like to do?\",\n choices: [\n \"Add Departments\",\n \"Add Roles\",\n \"Add Employees\",\n \"View Departments\",\n \"View Roles\",\n \"View Employees\",\n \"Update Role\",\n \"Update Manager\"\n // \"View Employees by Manager\"\n ]\n })\n // Case statement for selection of menu item\n .then(function(answer) {\n switch (answer.action) {\n case \"Add Departments\":\n addDepartments();\n break;\n case \"Add Roles\":\n addRoles();\n break;\n case \"Add Employees\":\n addEmployees();\n break;\n case \"View Departments\":\n viewDepartments();\n break;\n\n case \"View Roles\":\n viewRoles();\n break;\n case \"View Employees\":\n viewEmployees();\n break;\n case \"Update Role\":\n updateRole();\n break;\n case \"Update Manager\":\n updateManager();\n break;\n // case \"View Employees by Manager\":\n // viewEmployeesByManager();\n // break;\n }\n });\n}", "renderMenu(data) {\n // check if there is 1 valid category\n if (data.size < 1) {\n selectors.$content.append(`<p class=\"text-center font-weight-bold\">Infelizmente, nenhuma notícia foi encontrada!</p>`)\n console.log(\"nenhuma categoria encontrada\");\n return;\n }\n\n data.forEach(el => {\n selectors.$menu.append(`<li class=\"nav-item item\" id=\"${el.id}\" data-item><p class=\"nav-link\">${el.nome}</p></li>`)\n })\n\n\n selectors.$menu.find(\"li\").filter(\".item\").on('click', (e) => {\n this._initShowNews(e.currentTarget.id)\n })\n }", "function toMenu() {\n\tclearScreen();\n\tviewPlayScreen();\n}", "function menu() {\n inquirer\n .prompt({\n name: \"menuOptions\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\"View Products\", \"View Low Inventory\", \"Add Inventory\", \"Add New Product\"]\n })\n .then(function(answer) {\n // based on their answer, run appropriate function\n if (answer.menuOptions === \"View Products\") {\n viewProducts();\n }\n else if (answer.menuOptions === \"View Low Inventory\") {\n viewLowInventory();\n }\n else if (answer.menuOptions === \"Add Inventory\") {\n addInventory();\n }\n else if (answer.menuOptions === \"Add New Product\") {\n addNewProduct();\n }\n else {\n connection.end();\n }\n });\n}", "function testMenuPostion( menu ){\n \n }", "showQuickMenu() { $(`#${this.quickMenuId}`).show(); }", "function menu(){\n inquirer.prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View Products for Sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\",\n \"exit\"\n ]\n }).then(function(answer){\n switch(answer.action){\n case \"View Products for Sale\":\n products();\n break;\n\n case \"View Low Inventory\":\n lowInventory();\n break;\n\n case \"Add to Inventory\":\n addToInventory();\n break;\n\n case \"Add New Product\":\n addProduct();\n break;\n\n case \"exit\":\n connection.end();\n break;\n }\n });\n}", "function itemMenu(e) {\n\te.preventDefault();\n\tItemSelection = e.target;\n\tconst[idx, isSource] = findNode(ItemSelection);\n\tconst elemName = (isSource) ? \"sourceDropdown\" : \"deviceDropdown\";\n\tconst menu = document.getElementById(elemName);\n\tmenu.style.top = `${e.pageY}px`;\n\tmenu.style.left = `2rem`;\n\tmenu.classList.toggle(\"show\");\n}", "function showHoodies()\n{\n\t//show all items with theid 'hoodies'\n\tdocument.getElementById('hoodies').style.display = \"block\";\n\t//hide all other items\n\tdocument.getElementById('hats').style.display = \"none\";\n\tdocument.getElementById('accessories').style.display = \"none\";\n\tdocument.getElementById('skate').style.display = \"none\";\n\tdocument.getElementById('show').style.display = \"block\";\n}", "constructor(){\n super();\n this.menu = [\n {\n path: '/',\n title: 'Home'\n },\n {\n path: '/npc',\n title: 'Npc\\'s'\n },\n {\n path: '/enemies',\n title: 'Enemies'\n },\n {\n path: '/bosses',\n title: 'Bosses'\n },\n {\n path: '/places',\n title: 'Places'\n },\n {\n path: '/about',\n title: 'About'\n },\n ];\n }", "function showMenu() {\n if(newGame) {\n $('#main').show();\n }\n else {\n $('#end').show();\n }\n}", "function superfishSetup() {\n\t\t$('#navigation').find('.menu').superfish({\n\t\t\tdelay: 200,\n\t\t\tanimation: {opacity:'show', height:'show'},\n\t\t\tspeed: 'fast',\n\t\t\tcssArrows: true,\n\t\t\tautoArrows: true,\n\t\t\tdropShadows: false\n\t\t});\n\t}", "function renderDish(dish) {\n //setting up column and cards to add to the row\n let column = $(\"<div>\");\n //Create dish card\n let card = $(\"<div>\");\n card.addClass(\"card z-depth-4\");\n card.attr(\"data-number\", dish.dishNumber);\n\n //set up image with title and button---------\n let cardImg = $(\"<div>\");\n cardImg.addClass(\"card-image\");\n let img = $(\"<img>\");\n img.attr(\"src\", dish.foodImg);\n //setting up title\n let titleSpan = $(\"<span>\");\n titleSpan.addClass(\"card-title\");\n let title = $(\"<h3>\");\n titleSpan.append(title);\n cardImg.append(img);\n cardImg.append(titleSpan);\n\n let recipe = $(\"<p>\");\n //If no ingredients, dish is part of a choice\n if (!dish.ingredients) {\n //Choices is 3x2 at l\n column.addClass(\"col s12 m6 l4\");\n // Add choice class to attach to an event listener\n card.addClass(\"hoverable choices\");\n // Add button\n let aTag = $(\"<a>\");\n aTag.addClass(\"btn-floating btn-large btn waves-effect waves-red halfway-fab cyan pulse\");\n let iTag = $(\"<i>\");\n iTag.addClass(\"material-icons\");\n iTag.text(\"add\");\n aTag.append(iTag);\n cardImg.append(aTag);\n // Title goes in content \n recipe.text(dish.foodName);\n } else {\n // If dish is not a choice is final result title goes in header and ingredients go in content\n column.addClass(\"col s12 m6 l6\");\n title.text(dish.foodName);\n let header = $(\"<h4>\").text(\"Ingredients:\");\n recipe.append(header);\n for (let i = 0; i < dish.ingredients.length; i++){\n let ingredient = $(\"<p>\");\n ingredient.text(`${i + 1}. ${dish.ingredients[i]}`)\n recipe.append(ingredient);\n }\n }\n\n //setting up content-----------------------\n let content = $(\"<div>\");\n content.addClass(\"card-content\");\n content.append(recipe);\n\n //done setting up content / Append everythin to row\n card.append(cardImg);\n card.append(content);\n column.append(card);\n $(\"#choices\").append(column);\n}", "function openMenu() {\n g_IsMenuOpen = true;\n}", "function handleFastRestaurantChoice() {\n /** @type {HTMLInputElement} Input field. */\n const fastDishInput = document.getElementById(\"fast-input\").value;\n const fastfoodMenu = [\"cheeseburger\", \"doubleburger\", \"veganburger\"]\n\n if(fastDishInput == fastfoodMenu[0]) {\n restaurantClosing();\n } else if (fastDishInput == fastfoodMenu[1]) {\n restaurantClosing();\n } else if (fastDishInput == fastfoodMenu[2]) {\n restaurantClosing();\n } else {\n fastFoodRestaurantScene();\n }\n}", "function getSubChapterMenu(){\n\t\n}", "function createMenu() {\n zeroStarArrays();\n num_stars_input = createInput('');\n num_stars_input.position(20, 50);\n submit_num = createButton('# Stars');\n submit_num.position(20 + num_stars_input.width, 50);\n submit_num.mousePressed(setNumStars);\n num_planets_input = createInput('');\n num_planets_input.position(20 + num_stars_input.width + 70, 50);\n submit_num_planets = createButton('# Planets');\n submit_num_planets.position(20 + num_planets_input.width + num_stars_input.width + 70, 50);\n submit_num_planets.mousePressed(setNumPlanets);\n}", "function tl_start() {\n $('#futureman_face, #menu-open').css('display', 'inherit');\n $('.menu-open').css('visibility', 'inherit');\n }", "function setMenu(menu){ \n switch(menu){\n case 'food-input-icon':\n loadFoodMenu();\n break; \n \n case 'stats-icon':\n loadStatsMenu(); \n break; \n \n case 'settings-icon':\n loadSettingsMenu(); \n break;\n \n case 'share-icon':\n loadShareMenu(); \n break;\n \n case 'sign-out-icon':\n signOut(); \n break;\n case 'nav-icon':\n loadNavMenu(); \n \n }\n}", "function handleMenu(){\n\t$(\"#examples-menu\").mouseover(function(){\n\t\tvar position = $(\"#examples-menu\").offset();\n\t\tvar top = $(\"#examples-menu\").outerHeight();\n\t\t$(\"ul.examples\").offset({left:position.left, top:top+position.top});\n\t\t$(\"ul.examples\").show();\n\t})\n\t$(\"h1,table,img,form\").mouseover(function(){\n\t\t$(\"ul.examples\").offset({left:0, top:0});\n\t\t$(\"ul.examples\").hide();\n\t})\t\n}", "function mainMenu() {\n inquirer.prompt({\n type: \"list\",\n name: \"action\",\n message: \"What would you like to do?\",\n choices: [\n { name: \"Add something\", value: createMenu },\n { name: \"View something\", value: readMenu },\n { name: \"Change something\", value: updateMenu },\n { name: \"Remove something\", value: deleteMenu },\n { name: \"Quit\", value: quit }\n ]\n }).then(({ action }) => action());\n}", "function menu() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"Supervisor's Menu Options:\",\n choices: [\"View Product Sales By Department\", \"Create New Department\", \"Exit\"]\n }\n ]).then(function (answers) {\n if (answers.choice === \"View Product Sales By Department\") {\n displaySales();\n }\n else if (answers.choice === \"Create New Department\") {\n createDepartment();\n }\n else {\n connection.end();\n }\n });\n}", "showQuickMenu() { $(`.${this.quickMenu}`).show(); }", "function actionOnClick () {\r\n game.state.start(\"nameSelectionMenu\");\r\n}", "function mainMenuShow () {\n $ (\"#menuButton\").removeAttr (\"title-1\");\n $ (\"#menuButton\").attr (\"title\", htmlSafe (\"Stäng menyn\")); // i18n\n $ (\"#menuButton\").html (\"×\");\n $ (\".mainMenu\").show ();\n}", "function burstMenu(title,color,selected) {\t\njQuery('.menu-item-'+title).mouseover(function () {\n \n jQuery('.show-item-'+title).css({\n visibility: 'visible',\n\t\t'z-index': '2'\n });\n\t\n\t\n jQuery('.menu-item-'+title+' > a').css({\n background: color\n })\n\n jQuery('.show-item-'+title).mouseover(function () {\n jQuery('.show-item-'+title).css({\n visibility: 'visible',\n\t\t\t'z-index': '2'\n });\n jQuery('.menu-item-'+title+' > a').css({\n background: color\n })\n });\n\n jQuery('.show-item-'+title).mouseout(function () {\n jQuery('.show-item-'+title).css({\n visibility: 'hidden'\n });\n jQuery('.menu-item-'+title+' > a').css({\n background: 'inherit'\n })\n });\n\n});\n\njQuery('.menu-item-'+title).mouseout(function () {\n jQuery('.show-item-'+title).css({\n visibility: 'hidden'\n });\n jQuery('.menu-item-'+title+' > a').css({\n background: 'inherit'\n })\n});\n\nif (selected == true) {\n \njQuery('.show-item-'+title).css('cssText', 'visibility: visible !important');\n\n\t jQuery('.menu-item-'+title+' > a').css({\n background: color\n })\n\t\t\t\n\tjQuery('.menu-item-'+title).mouseout(function () {\n jQuery('.show-item-'+title).css('cssText', 'visibility: visible !important');\n jQuery('.menu-item-'+title+' > a').css({\n background: color\n })\n\t\n\t jQuery('.show-item-'+title).mouseout(function () {\n jQuery('.show-item-'+title).css('cssText', 'visibility: visible !important');\n\t jQuery('.menu-item-'+title+' > a').css({\n background: color\n })\n });\n\t\n});\n\t\t\n}\n\t\n}", "function qll_module_erepmenu()\r\n{\r\n\tvar menu= new Array();\r\n\tvar ul = new Array();\r\n\r\n\tmenu[0]=document.getElementById('menu');\r\n\tfor(i=1;i<=6;i++)\r\n\t\tmenu[i]=document.getElementById('menu'+i);\r\n\t\r\n//\tmenu[1].innerHTML=menu[1].innerHTML + '<ul></ul>';\r\n\tmenu[2].innerHTML=menu[2].innerHTML + '<ul></ul>';\r\n\tmenu[3].innerHTML=menu[3].innerHTML + '<ul></ul>';\r\n\tmenu[6].innerHTML=menu[6].innerHTML + '<ul></ul>';\r\n\t\r\n\tfor(i=1;i<=6;i++)\r\n\t\tul[i]=menu[i].getElementsByTagName(\"ul\")[0];\r\n\t\r\n\tif(qll_opt['module:erepmenu:design'])\r\n\t{\r\n\t\r\n\t\t//object.setAttribute('class','new_feature_small');\r\n\t\t\t\r\n\t//\tmenu[2].getElementsByTagName(\"a\")[0].href = \"http://economy.erepublik.com/en/time-management\";\r\n\t\t\r\n\t\t/*aux = ul[2].removeChild(ul[2].getElementsByTagName(\"li\")[6]);\t// adverts\r\n\t\tul[6].appendChild(aux);\r\n\t\t\r\n\t\t*/\r\n\t\t\r\n\t\tobject = document.createElement(\"li\"); \r\n\t\tobject.innerHTML='<a href=\"http://economy.erepublik.com/en/work\">' + \"Work\" + '</a>';\r\n\t\tul[2].appendChild(object);\r\n\t\t\r\n\t\tobject = document.createElement(\"li\"); \r\n\t\tobject.innerHTML='<a href=\"http://economy.erepublik.com/en/train\">' + \"Training grounds\" + '</a>';\r\n\t\tul[2].appendChild(object);\r\n\t\t\t\r\n\t\tobject = document.createElement(\"li\"); \r\n\t\tobject.innerHTML='<a href=\"http://www.erepublik.com/en/my-places/newspaper\">' + \"Newspaper\" + '</a>';\r\n\t\tul[2].appendChild(object);\r\n\t\t\r\n\t\tobject = document.createElement(\"li\"); \r\n\t\tobject.innerHTML='<a href=\"http://www.erepublik.com/en/economy/inventory\">' + \"Inventory\" + '</a>';\r\n\t\tul[2].appendChild(object);\r\n\t\t\r\n\t\tobject = document.createElement(\"li\"); \r\n\t\tobject.innerHTML='<a href=\"http://www.erepublik.com/en/my-places/organizations\">' + \"Organizations\" + '</a>';\r\n\t\tul[2].appendChild(object);\r\n\t\t\r\n\t\tobject = document.createElement(\"li\"); \r\n\t\tobject.innerHTML='<a href=\"http://economy.erepublik.com/en/company/create\">' + qll_lang[97] + '</a>';\r\n\t\tul[2].appendChild(object);\r\n\t\r\n\t\tobject = document.createElement(\"li\"); \r\n\t\tobject.innerHTML='<a href=\"http://www.erepublik.com/en/military/campaigns\">' + qll_lang[69] + '</a>';\r\n\t\tul[3].appendChild(object);\r\n\t\t//ul[4].insertBefore(object,ul[4].getElementsByTagName(\"li\")[3])\r\n\t\t\r\n\t\tobject = document.createElement(\"li\"); \r\n\t\tobject.innerHTML='<a href=\"http://www.erepublik.com/en/loyalty/program\">' + \"Loyalty program\" + '</a>';\r\n\t\tul[6].appendChild(object);\r\n\t\t\r\n\t\tobject = document.createElement(\"li\"); \r\n\t\tobject.innerHTML='<a href=\"http://www.erepublik.com/en/gold-bonus/1\">' + \"Gold bonus\" + '</a>';\r\n\t\tul[6].appendChild(object);\r\n\t\t\r\n\t}\r\n}", "function goToMenu() {\n stopTTS();\n cStatus = undefined;\n cStatus = new CurrentStatus();\n $('#quiz').hide('slow');\n $('#game').hide('slow');\n $('#menu').show('slow');\n}", "removeDishFromMenu(id) {\n this.menu = this.menu.filter(dish => dish.id !== id)\n }", "function initMenu() {\n // Connect Animation\n window.onStepped.Connect(stepMenu);\n\n // Make buttons do things\n let startbutton = document.getElementById('start_button');\n \n //VarSet('S:Continue', 'yielding')\n buttonFadeOnMouse(startbutton);\n startbutton.onclick = startDemo\n\n\n // run tests for prepar3d integration\n runTests();\n}", "function dropMenu() {\r\n // the menu content\r\n document.getElementById(\"menu1\").innerHTML = \"Guess Table\";\r\n\r\n}", "function menu() {\n if (currentPlayerPokemon.fainted == true) {\n return;\n }\n rollText(\"battle_text\", `What will ${currentPlayerPokemon.name} do?`, 25);\n document.getElementById('buttonsBattle').style['display'] = 'block';\n button1.className = `buttons`;\n button2.className = `buttons`;\n button3.className = `buttons`;\n button4.className = `buttons`;\n button1.innerHTML = `FIGHT`;\n button2.innerHTML = `ITEM`;\n button3.innerHTML = `POKEMON`;\n button4.innerHTML = `RUN`;\n\n button1.onclick = () => fight(currentPlayerPokemon);\n button2.onclick = () => item();\n button3.onclick = () => pokemon(playerParty);\n button4.onclick = () => run();\n}", "function mainMenu(){\n\tinquirer.prompt([{\n\t\ttype: \"list\",\n\t\tname: \"introAction\",\n\t\tmessage: \"Welcome, pick an action: \",\n\t\tchoices: [\"Create a Basic Card\", \"Create a Cloze Card\", \"Review Existing Cards\"]\n\t}]).then(function(answers){\n\t\tswitch (answers.introAction) {\n\t\t\tcase \"Create a Basic Card\":\n\t\t\t\tcreateBasicCard();\n\t\t\t\tbreak;\n\t\t\tcase \"Create a Cloze Card\":\n\t\t\t\tcreateClozeCard();\n\t\t\t\tbreak;\n\t\t\tcase \"Review Existing Cards\":\n\t\t\t\treviewCards();\n\t\t\t\tbreak;\n\t\t}\n\t});\n}" ]
[ "0.66595", "0.64337385", "0.6374985", "0.63151807", "0.62984025", "0.6261499", "0.6255055", "0.6168333", "0.61503583", "0.6132916", "0.61064476", "0.6048671", "0.6040572", "0.6017006", "0.5998923", "0.59902024", "0.5983666", "0.59650725", "0.5962446", "0.5915375", "0.5912792", "0.59121364", "0.5911866", "0.5911696", "0.5905214", "0.59035945", "0.5899958", "0.5891164", "0.5882462", "0.58595324", "0.58547086", "0.5854284", "0.58526087", "0.583259", "0.5830709", "0.58274823", "0.5813961", "0.5812124", "0.5797904", "0.5759864", "0.5732339", "0.57148737", "0.5710819", "0.5699959", "0.5686173", "0.56829816", "0.5677685", "0.56698877", "0.5659554", "0.56568444", "0.5652748", "0.56493646", "0.56424826", "0.5642481", "0.5641755", "0.564039", "0.56296396", "0.5629234", "0.5629091", "0.56274974", "0.5624148", "0.5619158", "0.5611", "0.56060624", "0.5605676", "0.5599713", "0.5596655", "0.5595992", "0.55835587", "0.55754477", "0.556761", "0.55617565", "0.55570567", "0.5550096", "0.55421996", "0.553594", "0.5530451", "0.5529532", "0.55289465", "0.5528202", "0.5525739", "0.5524392", "0.55229825", "0.55216175", "0.5516837", "0.5515344", "0.5509678", "0.5508808", "0.5508006", "0.5507807", "0.550743", "0.5506251", "0.55015975", "0.54994977", "0.5493036", "0.548052", "0.547813", "0.54749167", "0.5469427", "0.5464616" ]
0.6014771
14
Fastfood restaurant scene start.
function fastFoodRestaurantScene() { subTitle.innerText = fastfoodWelcome; firstButton.classList.add("hidden"); secondButton.classList.add("hidden"); fastDiv.classList.remove("hidden"); handleFastRestaurantChoice(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startup() {\n\tsceneTransition(\"start\");\n}", "function start() {\n // To present a scene, use the following line, replacing 'sample' with\n // the id of any scene you want to present.\n\n SceneManager.getSharedInstance().presentScene('newScene1');\n}", "function start() {\n for(var i = 0; i < sceneList.length; i++) {\n addScene(sceneList[i]); // sceneList.js is imported in html-file\n }\n setScene(\"start\");\n }", "function start(){\n renderGameField();\n resizeGameField();\n spawnSnake();\n spawnFood();\n eatFood();\n renderSnake();\n}", "function sceneStart(){\n\t\t\t\tfor (n = 0; n < heroes.length; n++)\n\t\t\t\t\theroes[n].tl.delay(20).fadeIn(35);\n\t\t\t\tmonster.tl.delay(20).fadeIn(35).delay(10).then(function(){\n\t\t\t\tgame.sceneStarted = true;\n\t\t\t\tthreatBar.opacity = 1;\n\t\t\t\tthreatGuage.opacity = 1;\n\t\t\t\tmonsterBox.opacity = 1;\n\t\t\t\tmonsterName.opacity = 1;\n\t\t\t\tpartyBox.opacity = 1;\n\t\t\t\tmuteButton.opacity = 1;\n\t\t\t\tfor (n = 0; n < nameLabels.length; n++){\n\t\t\t\t\tnameLabels[n].opacity = 1;\n\t\t\t\t\thpLabels[n].opacity = 1;\n\t\t\t\t\tmaxhpLabels[n].opacity = 1;\n\t\t\t\t\tmpLabels[n].opacity = 1;\n\t\t\t\t}\n\t\t\t});\n\t\t\t}", "_start() {\n\n this._menuView = new MenuView(\n document.querySelector('nav'),\n this.sketches\n );\n\n for (var key in this.sketches) {\n this.DEFAULT_SKETCH = key;\n break;\n }\n\n this._setupScroll();\n this._setupWindow();\n this._onHashChange();\n }", "function start()\n{\n clear();\n console.log(\"==============================================\\n\");\n console.log(\" *** Welcome to the Interstellar Pawn Shop *** \\n\");\n console.log(\"==============================================\\n\");\n console.log(\"We carry the following items:\\n\");\n readCatalog();\n}", "static start() {\n this.buttonCreate();\n this.buttonHideModal();\n\n // Animal.createAnimal('Zebras', 36, 'black-white', false);\n // Animal.createAnimal('Zirafa', 30, 'brown-white', true);\n // Animal.createAnimal('Liutas', 35, 'brown', false);\n // Animal.createAnimal('Dramblys', 20, 'grey', false);\n\n this.load();\n }", "function start(action) {\r\n\t\r\n\t\tswitch (action) {\r\n\t\t\tcase 'go look':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: What are you going to look at??\", 1000);\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'explore':\r\n\t\t\t\texploreship(gameobj.explore);\r\n\t\t\t\tgameobj.explore++;\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'sit tight':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: Good choice we should probably wait for John to get back.\", 1000);\r\n\t\t\t\tgameobj.sittight++;\r\n\t\t\tbreak;\t\r\n\t\t}\r\n}", "function Start(){\n activeScene.traverse(function(child){\n if(child.awake != undefined){\n child.awake();\n }\n });\n\n activeScene.traverse(function(child){\n if(child.start != undefined){\n child.start();\n }\n });\n activeScene.isReady = true;\n}", "function start() {\n restarts++;\n currentScene = scenes[0];\n currentTextIndex = 0;\n\n setMainImage();\n setMainText();\n hideSetup();\n updateStats();\n}", "function start(){\n\t\n}", "startGame() {\n this.scene.start('MenuScene');\n }", "function main () {\n // Initialise application\n\n // Get director singleton\n var director = Director.sharedDirector\n\n // Wait for the director to finish preloading our assets\n events.addListener(director, 'ready', function (director) {\n // Create a scene and layer\n var scene = new Scene()\n , layer = new Galaga()\n\n // Add our layer to the scene\n scene.addChild(layer)\n\n // Run the scene\n director.replaceScene(scene)\n })\n\n // Preload our assets\n director.runPreloadScene()\n}", "function start() {\n\n console.log(\"\\n\\t ------------Welcome to Bamazon Store-------------\");\n showProducts();\n\n\n\n}", "function main () {\n // Initialise application\n\n // Get director singleton\n var director = Director.sharedDirector\n\n // Wait for the director to finish preloading our assets\n events.addListener(director, 'ready', function (director) {\n // Create a scene and layer\n var scene = new Scene()\n , layer = new Plague()\n\n // Add our layer to the scene\n scene.addChild(layer)\n\n // Run the scene\n director.replaceScene(scene)\n })\n\n // Preload our assets\n director.runPreloadScene()\n}", "function start() {\n startMove = -kontra.canvas.width / 2 | 0;\n startCount = 0;\n\n audio.currentTime = 0;\n audio.volume = options.volume;\n audio.playbackRate = options.gameSpeed;\n\n ship.points = [];\n ship.y = mid;\n\n tutorialMoveInc = tutorialMoveIncStart * audio.playbackRate;\n showTutorialBars = true;\n isTutorial = true;\n tutorialScene.show();\n}", "function go() {\n console.log('go...')\n \n const masterT = new TimelineMax();\n \n masterT\n .add(clearStage(), 'scene-clear-stage')\n .add(enterFloorVegetation(), 'scene-floor-vegetation')\n .add(enterTreeStuff(), 'scene-enter-treestuff')\n .add(enterGreet(), 'scene-enter-greet')\n ;\n }", "start() {\n console.log(\"Die Klasse App sagt Hallo!\");\n }", "async start() {\n // Navbar in header\n this.navbar = new Navbar();\n this.navbar.render('header');\n\n // Footer renderin\n this.footer = new Footer();\n this.footer.render('footer');\n\n this.myFavorites = new Favorites();\n\n setTimeout(() => {\n this.router = new Router(this.myFavorites);\n }, 0)\n }", "StartGame(player, start){\n this.scene.start('level1');\n }", "function start() {\n init();\n run();\n }", "function start(){\n\tcreateDucks(amountDucks, startGame);\n}", "start() {// [3]\n }", "function setup_goToStart(){\n // what happens when we move to 'goToStart' section of a trial\n wp.trialSection = 'goToStart';\n unstageArray(fb_array);\n\n // update objects\n choiceSet.arc.visible = false;\n choiceSet.arc_glow.visible = false;\n startPoint.sp.visible = true;\n startPoint.sp_glow.visible = false;\n\n // update messages\n msgs.goToStart.visible = true;\n msgs.tooSlow.visible = false;\n\n stage.update();\n }", "function FXstart (){\n setTimeout(FXdisplayLaunch, 1500);\n FXweatherGeolocation();\n FXdisplayMarsWeather();\n }", "function start (p){\n\tresetting=true;\n\tfoodCounter=0;\n\tdeleteAllFood();\n\treset(p);\n}", "function start(){\n // First/starting background\n imageMode(CENTER);\n image(gamebackground, width/2, height/2, width, height);\n fill(255);\n text(\"Master of Pie\", width/2 - width/20, height/4);\n text(\"Start\", width/2 - width/75, height/2);\n text(\"(Landscape Orientation Preferred)\", width/2 - width/10, height/4 + height/14);\n // Pizzas array is cleared\n pizzas = [];\n // Creates the ship\n ship = new Spacecraft();\n // Creates pizzas/asteroids at random places offscreen\n for(let i = 0; i < pizzaorder; i++){\n pizzas[i] = new Rock(random(0, width), random(0, height), random(width/40, width/10));\n }\n // Reset variables\n click3 = true;\n reload = 10;\n piecutter = [];\n pizzaorder = 1;\n level = 1;\n}", "function start(){\n\t\t //Initialize this Game. \n newGame(); \n //Add mouse click event listeners. \n addListeners();\n\t\t}", "function start() {\n\n}", "start() {\n console.log(\"Die Klasse App sagt Hallo!\");\n this._router.resolve();\n }", "function start() {\n //Currently does nothing\n }", "function start() {\n getTodosFromLs();\n addTodoEventListeners();\n sidebar();\n updateTodaysTodoList();\n calendar();\n}", "function startLevel1(){\n teleMode = false;\n fadeAll();\n game.time.events.add(500, function() {\n game.state.start('state0');\n }, this);\n}", "function startGame(){\n getDictionary();\n var state = $.deparam.fragment();\n options.variant = state.variant || options.variant;\n makeGameBoard();\n loadState();\n }", "function initScene1() {\n if (currentScene === 1) {\n\n $('#game1').show(\"fast\");\n\n //clique sur une porte\n $('.dungeon0Door').on('click', function (e) {\n console.log(currentScene);\n if (consumeEnergy(10)) {\n if (oD10.roll() >= 8) {\n printConsole('Vous vous echappez du donjon');\n loadScene(2);\n } else {\n printConsole(\"Ce n'est pas la bonne porte ..\");\n $('.dungeon0Door').animate({\n opacity: '0'\n }, 'slow', function () {\n $('.dungeon0Door').animate({\n opacity: '1'\n }, 'fast');\n });\n }\n }\n });\n }\n }", "function App() {\n var mouse = DreamsArk.module('Mouse');\n //\n // /**\n // * start Loading the basic scene\n // */\n DreamsArk.load();\n //\n // mouse.click('#start', function () {\n //\n // start();\n //\n // return true;\n //\n // });\n //\n // mouse.click('.skipper', function () {\n //\n // query('form').submit();\n //\n // return true;\n //\n // });\n //\n // mouse.click('#skip', function () {\n //\n // query('form').submit();\n //\n // return true;\n //\n // });\n //\n // mouse.click('.reseter', function () {\n //\n // location.reload();\n //\n // return true;\n //\n // });\n }", "startScene() {\n console.log('[Game] startScene');\n var that = this;\n\n if (this.scene) {\n console.log('[Game] loading scene');\n this.scene.load().then(() => {\n console.log('[Game] Scene', that.scene.name, 'loaded: starting run & render loops');\n // setTimeout(function() {\n debugger;\n that.scene.start();\n debugger;\n that._runSceneLoop();\n that._renderSceneLoop();\n // }, 0);\n });\n } else {\n console.log('[Game] nothing to start: no scene selected!!');\n }\n }", "async function start() {\n await hydrate();\n\n new Search(\".search\");\n\n const keywords = new Keywords(\".keywords\");\n searchStore.subscribe(keywords);\n\n const menuDevices = new Devices(\".menu-devices\");\n deviceStore.subscribe(menuDevices);\n dataStore.subscribe(menuDevices);\n\n const menuIngredients = new Ingredients(\".menu-ingredients\");\n dataStore.subscribe(menuIngredients);\n ingredientStore.subscribe(menuIngredients);\n\n const menuUstensils = new Ustensils(\".menu-ustensils\");\n dataStore.subscribe(menuUstensils);\n ustensilStore.subscribe(menuUstensils);\n\n const recipes = new Recipes(\".recipes\");\n dataStore.subscribe(recipes);\n searchStore.subscribe(recipes);\n}", "function start() {\n\n id = realtimeUtils.getParam('id');\n if (id) {\n // Load the document id from the URL\n realtimeUtils.load(id.replace('/', ''), onFileLoaded, onInitialize);\n init();\n } else {\n // Create a new document, add it to the URL\n realtimeUtils.createRealtimeFile('MyWebb App', function (createResponse) {\n window.history.pushState(null, null, '?id=' + createResponse.id);\n id=createResponse.id;\n realtimeUtils.load(createResponse.id, onFileLoaded, onInitialize);\n init();\n });\n \n }\n \n \n }", "function startGame(){\n \t\tGameJam.sound.play('start');\n \t\tGameJam.sound.play('run');\n\t\t\n\t\t// Put items in the map\n\t\titemsToObstacles(true);\n\n\t\t// Create the prisoner path\n\t\tGameJam.movePrisoner();\n\n\t\t// Reset items, we dont want the user to be able to drag and drop them\n \t\tGameJam.items = [];\n \t\t\n \t\tfor (var item in GameJam.levels[GameJam.currentLevel].items) {\n \t\t\tGameJam.levels[GameJam.currentLevel].items[item].count = GameJam.levels[GameJam.currentLevel].items[item].countStart;\n \t\t}\n\n\t\t// Reset prisoner speed\n\t\tGameJam.prisoner[0].sprite.speed = 5;\n\n\t\t// Reset game time\n\t\tGameJam.tileCounter = 0;\n\t\tGameJam.timer.className = 'show';\n\t\tdocument.getElementById('obstacles').className = 'hide';\n\t\tdocument.getElementById('slider').className = 'hide';\n\t\tdocument.getElementById('start-button-wrapper').className = 'hide';\n\n\t\t// Game has started\n\t\tGameJam.gameStarted = true;\n\n\t\tGameJam.gameEnded = false;\n\n\t\tdocument.getElementById('static-canvas').className = 'started';\n\n\t\tconsole.log('-- Game started');\n\t}", "function begin() {\n\tbackgroundBox = document.getElementById(\"BackgroundBox\");\n\n\tbuildGameView();\n\tbuildMenuView();\n\n\tinitSFX();\n\tinitMusic();\n\n\tENGINE_INT.start();\n\n\tswitchToMenu(new TitleMenu());\n\t//startNewGame();\n}", "start() {\n this.currentTaskType = \"teil-mathe\";\n this.v.setup();\n this.loadTask();\n }", "doReStart() {\n // Stoppe la musique d'intro\n this.musicIntro.stop();\n // Lance la scene de menus\n this.scene.start('MenuScene');\n }", "function start() {\n action(1, 0, 0);\n}", "function start () {\n gmCtrl.setObj();\n uiCtrl.setUi();\n }", "function startApp() {\n displayProducts();\n}", "function loadStart() {\n // Prepare the screen and load new content\n collapseHeader(false);\n wipeContents();\n loadHTML('#info-content', 'ajax/info.html');\n loadHTML('#upper-content', 'ajax/texts.html #welcome-text');\n loadHTML('#burger-container', 'ajax/burger-background.html #burger-flags', function() {\n loadScript(\"js/flag-events.js\");\n });\n}", "function start() {\r\n var questions = [{\r\n type: 'rawlist',\r\n name: 'choice',\r\n message: 'What would you like to do?',\r\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\", \"Exit Store\"]\r\n }];\r\n inquirer.prompt(questions).then(answers => {\r\n mainMenu(answers.choice);\r\n });\r\n}", "function startGame(mapName = 'galaxy'){\n toggleMenu(currentMenu);\n if (showStats)\n $('#statsOutput').show();\n $('#ammoBarsContainer').show();\n scene.stopTheme();\n scene.createBackground(mapName);\n if (firstTime) {\n firstTime = false;\n createGUI(true);\n render();\n } else {\n requestAnimationFrame(render);\n }\n}", "function start() { \n initiate_graph_builder();\n initiate_job_info(); \n initiate_aggregate_info();\n initiate_node_info();\n}", "function startup() {\n\tsaveSlot('rainyDayZRestart');\n\tfooterVisibility = document.getElementById(\"footer\").style.visibility;\n\tfooterHeight = document.getElementById(\"footer\").style.height;\t\n\tfooterOverflow = document.getElementById(\"footer\").style.overflow;\t\n\twrapper.scrollTop = 0;\n\tupdateMenu();\n\thideStuff();\n\tif(localStorage.getItem('rainyDayZAuto')) {\n\t\tloadSlot('rainyDayZAuto');\n\t}\n\telse{\n\t\tsceneTransition('start');\n\t}\n}", "function start() {\n \tkran.init(\"all\");\n \trequestAnimationFrame(gameLoop);\n }", "create() {\n\n // add animations (for all scenes)\n this.addAnimations();\n\n // change to the \"Home\" scene and provide the default chord progression / sequence\n this.scene.start('Home', {sequence: [0, 1, 2, 3, 0, 1, 2, 3]});\n }", "function start(){\r\n\t\t// for now, start() will call _draw(), which draws all the objects on the stage\r\n\t\t// but in the next lesson, we'll add an animation loop that calls _draw()\r\n\t\t_draw(ctx);\r\n\t}", "function createStart(){\n // scene components\n startScreen = initScene();\n startText = createSkyBox('libs/Images/startscene.png', 10);\n startScreen.add(startText);\n\n // lights\n \t\tvar light = createPointLight();\n \t\tlight.position.set(0,200,20);\n \t\tstartScreen.add(light);\n\n // camera\n \t\tstartCam = new THREE.PerspectiveCamera( 90, window.innerWidth / window.innerHeight, 0.1, 1000 );\n \t\tstartCam.position.set(0,50,1);\n \t\tstartCam.lookAt(0,0,0);\n }", "function startGame() {\n\t\tstatus.show();\n\t\tinsertStatusLife();\n\t\tsetLife(100);\n\t\tsetDayPast(1);\n\t}", "function start(){\n\tautoCompleteSearch();\n\tsubmitButton();\n\tsubmitButtonRandom();\n\tnewSearch();\n\trandomChar();\n\thideCarouselNav();\n}", "function requestFish() {\n // all_stopped = 1;\n //addFish++;\n\n view.resize(300,300);\n aquarium.viewport(300,300)\n aquarium.prepare();\n}", "function start() {\n console.log(\"Loop\");\n generateArt();\n}", "function start() {\n\t\t\tsetTimeout(startUp, 0);\n\t\t}", "function startRitual() {\n\tconsole.log(\"** glitter **\");\n\tflash(pump);\n}", "start() {\n\t\tthis.emit(\"game_start\");\n\t}", "function initMenu() {\n // Connect Animation\n window.onStepped.Connect(stepMenu);\n\n // Make buttons do things\n let startbutton = document.getElementById('start_button');\n \n //VarSet('S:Continue', 'yielding')\n buttonFadeOnMouse(startbutton);\n startbutton.onclick = startDemo\n\n\n // run tests for prepar3d integration\n runTests();\n}", "start() {// Your initialization goes here.\n }", "function startEncounter(){\n\tthis.scene.start('Battle', {type: 'encounter'})\n}", "function start() {\n INFO(\"start\", clock()+\"msecs\")\n loadThemeScript();\n if (window.MathJax)\n MathJax.Hub.Queue([\"Typeset\", MathJax.Hub]);\n beginInteractionSessions(QTI.ROOT);\n setTimeout(initializeCurrentItem, 100);\n setInterval(updateTimeLimits, 100);\n document.body.style.display=\"block\";\n INFO(\"end start\", clock()+\"msecs\");\n }", "function gamestart() {\n\t\tshowquestions();\n\t}", "function start() {\n\n // Make sure we've got all the DOM elements we need\n setupDOM();\n\n // Updates the presentation to match the current configuration values\n configure();\n\n // Read the initial hash\n readURL();\n\n // Notify listeners that the presentation is ready but use a 1ms\n // timeout to ensure it's not fired synchronously after #initialize()\n setTimeout(function () {\n dispatchEvent('ready', {\n 'indexh': indexh,\n 'indexv': indexv,\n 'currentSlide': currentSlide\n });\n }, 1);\n\n }", "function startGame() {\n\tsetup();\n\tmainLoop();\n}", "function startScreen() {\n mainContainer.append(startButton)\n }", "function start() {\n console.log(\"Welcome to the Employee Tracker\");\n inquirer\n .prompt(menuOptions)\n .then((response) => {\n console.log(response);\n switch (response.mainMenu) {\n case \"View all departments\":\n queries.viewDepartments();\n break;\n\n case \"View all roles\":\n queries.viewRoles();\n break;\n\n case \"View all employees\":\n queries.viewEmployees();\n break;\n\n case \"Add a department\":\n queries.addDepartment();\n break;\n\n case \"Add a role\":\n queries.addRole();\n break;\n\n case \"Add an employee\":\n queries.addEmployee();\n break;\n\n case \"Update an employee role\":\n queries.updateRole();\n break;\n\n case \"Quit\":\n queries.quit();\n break;\n\n default:\n break;\n }\n });\n}", "function main(){\n\t//Initialice with first episode\n\tvar sel_episodes = [1]\n\t//collage(); //Create a collage with all the images as initial page of the app\n\tpaintCharacters();\n\tpaintEpisodes();\n\tpaintLocations(sel_episodes);\n}", "create() {\n // We have nothing left to do here. Start the next scene.\n \n\n this.input.on('pointerdown', function (pointer) {\n\n this.scene.start('Game');\n }, this);\n\n \n }", "create(){\n this.scene.start('MenuGame');\n }", "function start() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View Products for Sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\",\n \"Exit\"\n ]\n })\n .then(function (answer) {\n switch (answer.action) {\n case \"View Products for Sale\":\n viewProducts();\n break;\n\n case \"View Low Inventory\":\n viewLowInventory();\n break;\n\n case \"Add to Inventory\":\n addInventory();\n break;\n\n case \"Add New Product\":\n addProduct();\n break;\n\n case \"exit\":\n connection.end();\n break;\n }\n });\n}", "function start() {\n console.log(\"Animation Started\");\n\n let masterTl = new TimelineMax();\n\n //TODO: add childtimelines to master\n masterTl\n .add(clearStage(), \"scene-clear-stage\")\n .add(enterFloorVegetation(), \"scene-floor-vegitation\")\n .add(enterTreeStuff(), \"tree-stuff\");\n }", "function run() { \n\n moveToNewspaper();\n pickBeeper();\n returnHome();\n\n}", "function start() {\n\tconsole.log(\"\\nWELCOME TO THE BAMAZON STORE!\\n\");\n\tinquirer.prompt(\n\t\t{\n\t\t\tname: \"browse\",\n\t\t\ttype: \"confirm\",\n\t\t\tmessage: \"Would you like to browse the available products?\"\n\t\t}\n\t).then(function(answer) {\n\t\tif (answer.browse) {\n\t\t\tdisplayProducts();\n\t\t} else {\n console.log(\"Come back soon, have a nice day!\")\n\t\t\tconnection.end();\n\t\t}\n });\n \n}", "function start() {\n inquirer\n .prompt([\n {\n type: \"list\",\n name: \"choice\",\n choices: [\n \"View Products for Sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\"\n ],\n message: \"Select an option.\"\n }\n ])\n .then(function (answers) {\n switch (answers.choice) {\n case \"View Products for Sale\":\n productsForSale();\n break;\n case \"View Low Inventory\":\n lowInventory();\n break;\n case \"Add to Inventory\":\n addInventory();\n break;\n case \"Add New Product\":\n newProduct();\n break;\n }\n });\n}", "function start () {\n\t\t\n\t\t// if has not started planting and plant is valid\n\t\t\n\t\tif ( this.started !== true && this.puzzle instanceof _Puzzle.Instance && this.puzzle.started === true && this.plant instanceof _GridElement.Instance ) {\n\t\t\tconsole.log('start PLANTING!');\n\t\t\t\n\t\t\t// set started\n\t\t\t\n\t\t\tthis.started = true;\n\t\t\t\n\t\t\t// start updating planting\n\t\t\t\n\t\t\tthis.update();\n\t\t\tshared.signals.gameUpdated.add( this.update, this );\n\t\t\t\n\t\t}\n\t\t\n\t}", "start () {\n this.stateLoop();\n }", "function startMenu() {\n createManager();\n}", "initializeScene(){}", "start () {\n // Draw the starting point for the view with no elements\n }", "start () {\n // Draw the starting point for the view with no elements\n }", "function Aside() {\n appStarted = true;\n // all objects added to the stage appear in \"layer order\"\n // add a helloLabel to the stage\n seeMore = new objects.Label(\"Click me to see more of my work\", \"32px\", \"Times New Roman\", \"#000000\", canvasHalfWidth, canvasHalfHeight + 200, true);\n stage.addChild(seeMore);\n // add a clickMeButton to the stage\n treesharksLogo = new objects.Icon(loader, \"treesharksLogo\", canvasHalfWidth, canvasHalfHeight - 100, true);\n stage.addChild(treesharksLogo);\n }", "function renderStartPage() {\n addView(startPage());\n}", "function Start() {\n console.log(\"%c Game Started!\", \"color: blue; font-size: 20px; font-weight: bold;\");\n stage = new createjs.Stage(canvas);\n createjs.Ticker.framerate = 60; // 60 FPS\n createjs.Ticker.on('tick', Update);\n stage.enableMouseOver(20);\n currentSceneState = scenes.State.NO_SCENE;\n config.Game.SCENE = scenes.State.START;\n }", "start(){\r\n if (this.scene.scene\r\n .get(\"levelMap\")\r\n .localStorage.getItem(`${this.scene.key}R`) === null) {\r\n this.intro();\r\n }\r\n }", "function startGame() {\r\n if (pressed == 0) {\r\n createRain();\r\n animate();\r\n }\r\n }", "function start() {\n fly();\n\n}", "function Start() {\n console.log(`%c Start Function`, \"color: grey; font-size: 14px; font-weight: bold;\");\n stage = new createjs.Stage(canvas);\n createjs.Ticker.framerate = Config.Game.FPS;\n createjs.Ticker.on('tick', Update);\n stage.enableMouseOver(20);\n Config.Game.ASSETS = assets; // make a reference to the assets in the global config\n Main();\n }", "function start() {\r\n\tconst config = validateConfiguration();\r\n\tif(config === false) {\r\n\t\talert(\"Please choose a proper configuration!\");\r\n\t\treturn;\r\n\t}\r\n\ttg = new TaskGenerator(config);\r\n\r\n\tdocument.getElementsByName(\"state:start\").forEach(function(e) {\r\n\t\te.style.display = \"none\";\r\n\t});\r\n\r\n\tdocument.getElementsByName(\"state:task\").forEach(function(e) {\r\n\t\te.style.display = \"block\";\r\n\t});\r\n\tdisplayTask();\r\n}", "create(){\n this.add.text(20, 20, \"LoadingGame...\")\n\n this.time.addEvent({\n delay: 3000, // ms\n callback: function(){this.scene.start('MenuScene')},\n //args: [],\n callbackScope: this,\n loop: true \n });\n\n \n }", "function start(state) { \n service.goNext(state);\n }", "function reactionStart () {\n if (bu2.state != 1) t0 = new Date(); // Falls Animation angeschaltet, neuer Anfangszeitpunkt\n switchButton2(); // Zustand des Schaltknopfs ändern\n enableInput(false); // Eingabefelder deaktivieren\n if (bu2.state == 1) startAnimation(); // Entweder Animation starten bzw. fortsetzen ...\n else stopAnimation(); // ... oder stoppen\n reaction(); // Eingegebene Werte übernehmen und rechnen\n paint(); // Neu zeichnen\n }", "function startScreen() {\n\tdraw();\n\tif(usuario_id !== -1)\n\t\tstartBtn.draw();\n}", "function runStart()/* : void*/\n {\n this.setUp();\n }", "function start() {\n //switch to scene 1\n window.inventoryActive = \"\";\n window.inventoryActive2 = \"\";\n window.inventory[1]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[2]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[3]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[4]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[5]= {id:\"\", inspected:false, desciption:\"\"};\n window.inventory[6]= {id:\"\", inspected:false, desciption:\"\"};\n window.timerTime = null;\n window.inspectResultReceived =0;\n window.activeSlot = \"\";\n window.inspectResult= \"\";\n \n}" ]
[ "0.7005796", "0.6905421", "0.6712243", "0.6531578", "0.6511532", "0.65048075", "0.6440274", "0.6435362", "0.6370753", "0.63203603", "0.6283713", "0.62831676", "0.62555844", "0.6246311", "0.6242093", "0.6232279", "0.6213741", "0.6201732", "0.61525476", "0.6120415", "0.61030513", "0.6102915", "0.6099659", "0.60980535", "0.60968626", "0.60946804", "0.6064788", "0.6059272", "0.60587984", "0.6052239", "0.60380757", "0.60338104", "0.60203964", "0.60176796", "0.60087675", "0.6003453", "0.5996396", "0.5996006", "0.5993157", "0.5982755", "0.5982082", "0.5981742", "0.5978043", "0.5975088", "0.5970169", "0.5954277", "0.59318703", "0.5926054", "0.59214985", "0.5921152", "0.5916003", "0.59122425", "0.58993447", "0.58988607", "0.58817333", "0.58723485", "0.5870934", "0.58631575", "0.5859006", "0.5856763", "0.5855876", "0.5853492", "0.5837363", "0.5832727", "0.58242106", "0.58228964", "0.5819396", "0.581897", "0.58140326", "0.5809035", "0.58079207", "0.58051044", "0.58045405", "0.579916", "0.5794586", "0.5788267", "0.5780983", "0.5780677", "0.5772165", "0.57690555", "0.5768784", "0.5763662", "0.5759042", "0.5755316", "0.5753908", "0.5753908", "0.5753484", "0.57457274", "0.5740867", "0.57379127", "0.5736859", "0.57314205", "0.57307184", "0.57289165", "0.57266337", "0.5725584", "0.57202995", "0.5720104", "0.57172763", "0.57156134" ]
0.6223574
16
Dish menu for fastfood restaurant scene start.
function handleFastRestaurantChoice() { /** @type {HTMLInputElement} Input field. */ const fastDishInput = document.getElementById("fast-input").value; const fastfoodMenu = ["cheeseburger", "doubleburger", "veganburger"] if(fastDishInput == fastfoodMenu[0]) { restaurantClosing(); } else if (fastDishInput == fastfoodMenu[1]) { restaurantClosing(); } else if (fastDishInput == fastfoodMenu[2]) { restaurantClosing(); } else { fastFoodRestaurantScene(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initMenu() {\n // Connect Animation\n window.onStepped.Connect(stepMenu);\n\n // Make buttons do things\n let startbutton = document.getElementById('start_button');\n \n //VarSet('S:Continue', 'yielding')\n buttonFadeOnMouse(startbutton);\n startbutton.onclick = startDemo\n\n\n // run tests for prepar3d integration\n runTests();\n}", "function loadMenu(){\n\t\tpgame.state.start('menu');\n\t}", "function startMenu() {\n createManager();\n}", "function onOpen() {\n ui.createMenu('Daily Delivery Automation')\n .addItem('Run', 'confirmStart').addToUi();\n}", "function gameMenuStartableDrawer() {\n if (store.getState().currentPage == 'GAME_MENU' && store.getState().lastAction == 'GAMEDATA_LOADED') {\n gameMenuStartableStarsid.innerHTML = store.getState().activeGameState.stars.toString() + '/77';\n }\n }", "function StartMenu() {\n //this.menu = new Menu('start-menu');\n this.shutDownMenu = new Menu('shutdown-menu');\n this.shutDownButton = new MenuButton('options-button', this.shutDownMenu);\n Menu.apply(this, ['start-menu']);\n}", "constructor(props) {\n super(props);\n\n // comente lo de abajo por que ahora lo estamos extrallendo del archivo dishes.js\n this.state = {\n selectedDish: null\n }\n console.log('menu constructor is invoke')\n \n }", "function display_start_menu() {\n\tstart_layer.show();\n\tstart_layer.moveToTop();\n\t\n\tdisplay_menu(\"start_layer\");\n\tcharacter_layer.moveToTop();\n\tcharacter_layer.show();\n\tinventory_bar_layer.show();\n\t\n\tstage.draw();\n\t\n\tplay_music('start_layer');\n}", "start() {\n if (this.showHideStartMenu === true) {\n this.showHideStartMenu = false;\n } else {\n this.showHideStartMenu = true;\n }\n }", "function foodMenuItems() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tvar $foodItemOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '80%';\r\n\t\t\t\t\t$($fullscreenSelector + '.nectar_food_menu_item').parent().each(function () {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar $that = $(this),\r\n\t\t\t\t\t\twaypoint = new Waypoint({\r\n\t\t\t\t\t\t\telement: $that,\r\n\t\t\t\t\t\t\thandler: function () {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif ($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) {\r\n\t\t\t\t\t\t\t\t\twaypoint.destroy();\r\n\t\t\t\t\t\t\t\t\treturn;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t$that.find('.nectar_food_menu_item').each(function (i) {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tvar $that = $(this);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t\t\t$that.addClass('animated-in');\r\n\t\t\t\t\t\t\t\t\t}, i * 150);\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\twaypoint.destroy();\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\toffset: $foodItemOffsetPos\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t});\r\n\t\t\t\t}", "function onOpen() {\n createMenu();\n}", "function showMenu(arg)\r\n\t{\r\n\t\tswitch(arg)\r\n\t\t{\r\n\t\t\tcase 0:\r\n\t\t\t\t$('#menu').html(\"\");\r\n\t\t\tbreak;\r\n\t\t\tcase 1:\r\n\t\t\t\t$('#menu').html(\"<h1 id='title' style='position:relative;top:20px;left:-40px;width:500px;'>Sheep's Snake</h1><p style='position:absolute;top:250px;left:-50px;font-size:1.1em;' id='playA'>Press A to play!</p><p style='position:absolute;top:280px;left:-50px;font-size:1.1em;' id='playB'>Press B for some help !</p>\");\r\n\t\t\t\t\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}", "function tl_start() {\n $('#futureman_face, #menu-open').css('display', 'inherit');\n $('.menu-open').css('visibility', 'inherit');\n }", "function fastFoodRestaurantScene() {\n subTitle.innerText = fastfoodWelcome;\n firstButton.classList.add(\"hidden\");\n secondButton.classList.add(\"hidden\");\n fastDiv.classList.remove(\"hidden\");\n\n handleFastRestaurantChoice();\n}", "function showMenu() {\n // clear the console\n console.log('\\033c');\n // menu selection\n inquirer\n .prompt([\n {\n type: \"list\",\n name: \"wish\",\n choices: [\"View Product Sales by Department\", \"Create New Department\", \"Exit\"],\n message: '\\nWhat would you like to do? '\n }\n ]).then( answer => {\n switch (answer.wish){\n case \"View Product Sales by Department\":\n showSale();\n break;\n case \"Create New Department\":\n createDept();\n break;\n case \"Exit\":\n connection.end();\n break;\n default:\n console.log( `\\x1b[1m \\x1b[31m\\nERROR! Invalid Selection\\x1b[0m`);\n }\n })\n}", "function start() {\r\n var questions = [{\r\n type: 'rawlist',\r\n name: 'choice',\r\n message: 'What would you like to do?',\r\n choices: [\"View Products for Sale\", \"View Low Inventory\", \"Add to Inventory\", \"Add New Product\", \"Exit Store\"]\r\n }];\r\n inquirer.prompt(questions).then(answers => {\r\n mainMenu(answers.choice);\r\n });\r\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}", "_start() {\n\n this._menuView = new MenuView(\n document.querySelector('nav'),\n this.sketches\n );\n\n for (var key in this.sketches) {\n this.DEFAULT_SKETCH = key;\n break;\n }\n\n this._setupScroll();\n this._setupWindow();\n this._onHashChange();\n }", "function superfishSetup() {\n\t\t$('#navigation').find('.menu').superfish({\n\t\t\tdelay: 200,\n\t\t\tanimation: {opacity:'show', height:'show'},\n\t\t\tspeed: 'fast',\n\t\t\tcssArrows: true,\n\t\t\tautoArrows: true,\n\t\t\tdropShadows: false\n\t\t});\n\t}", "function DfoMenu(/**string*/ menu)\r\n{\r\n\tSeS(\"G_Menu\").DoMenu(menu);\r\n\tDfoWait();\r\n}", "pressedStart()\n\t\t\t{\n\t\t\tif(this.gamestate === 'starting')\n\t\t\t\t{\n\t\t\t\tthis.gamestate = 'choose';\n\t\t\t\t}\n\t\t\telse if(this.gamestate === 'choose')\n\t\t\t\t{\n\t\t\t\t}\n\t\t\telse if(this.gamestate === 'stats')\n\t\t\t\t{\n\t\t\t\tthis.gamestate = 'bedroom';\n\t\t\t\t}\n\t\t\telse if(this.gamestate === 'bedroom')\n\t\t\t\t{\n\t\t\t\tthis.menu.RunFunction(this);\n\t\t\t\t}\n\t\t\t}", "function actionOnClick () {\r\n game.state.start(\"nameSelectionMenu\");\r\n}", "function menuShow() {\n ui.appbarElement.addClass('open');\n ui.mainMenuContainer.addClass('open');\n ui.darkbgElement.addClass('open');\n}", "createMenu()\n {\n currentScene.add.image(topBackgroundXOrigin, topBackgroundYOrigin, 'Fondo');\n\n // The first button that will enable audio\n let firstBtn = currentScene.add.image(topBackgroundXOrigin, topBackgroundYOrigin, 'FirstStart');\n\n firstBtn.setInteractive();\n firstBtn.on('pointerdown',function()\n {\n this.setScale(1.05);\n });\n firstBtn.on('pointerup',function()\n {\n firstBtn.disableInteractive();\n // We play the Button pressed SFX \n sfxManager.playSupahStar();\n firstBtn.destroy();\n });\n firstBtn.on('pointerup', () => this.startMainMenu());\n\n // We set the fonts according to the browser\n if(theGame.device.browser.firefox)\n {\n boldFontName = 'Asap-Bold';\n regularFontName = 'Asap';\n }\n else\n {\n boldFontName = 'Asap-Bold';\n regularFontName = 'Asap';\n }\n }", "function startup() {\n\tsceneTransition(\"start\");\n}", "function menuhrres() {\r\n\r\n}", "function displayMenu() {\n const menu = document.querySelector(\"#menu\");\n let dishes = hard_coded_dishes;\n\n dishes.forEach(dish => {\n // generate template for main ingredient and the name of the dish\n const main = displayDish(\n dish.course,\n dish.name,\n dish.price,\n dish.ingredient\n );\n\n // generate options for each dish\n const options = [];\n\n if (dish.options) {\n dish.options.forEach(option => {\n options.push(displayOption(option.option, option.price));\n });\n }\n\n // add this to the DOM\n menu.insertAdjacentHTML(\"beforeend\", main + options.join(\"\"));\n });\n}", "function thememascot_menuzord() {\n $(\"#menuzord\").menuzord({\n align: \"left\",\n effect: \"slide\",\n animation: \"none\",\n indicatorFirstLevel: \"<i class='fa fa-angle-down'></i>\",\n indicatorSecondLevel: \"<i class='fa fa-angle-right'></i>\"\n });\n $(\"#menuzord-right\").menuzord({\n align: \"right\",\n effect: \"slide\",\n animation: \"none\",\n indicatorFirstLevel: \"<i class='fa fa-angle-down'></i>\",\n indicatorSecondLevel: \"<i class='fa fa-angle-right'></i>\"\n });\n }", "function main() {\n menu = new states.Menu();\n currentstate = menu;\n}", "function runMenu() {\n inquirer.prompt([\n {\n name: 'menu',\n type: 'list',\n choices: [\n 'View Products for Sale',\n 'View Low Inventory',\n 'Add to Inventory',\n 'Add New Product',\n 'Exit'\n ],\n message: chalk.cyan('Select an option:')\n }\n ]).then(function(answers) {\n switch (answers.menu) {\n case 'View Products for Sale':\n getProducts(false);\n break;\n case 'View Low Inventory':\n getProducts(true);\n break;\n case 'Add to Inventory':\n addInventory();\n break;\n case 'Add New Product':\n addProduct();\n break;\n default:\n connection.end();\n }\n });\n}", "addDishToMenu(dish) {\n if(this.menu.includes(dish))\n {\n this.removeDishFromMenu(dish.id);\n }\n this.menu.push(dish);\n }", "function supervisorMenu() {\n inquirer\n .prompt({\n name: 'apple',\n type: 'list',\n message: 'What would you like to do?'.yellow,\n choices: ['View Product Sales by Department',\n 'View/Update Department',\n 'Create New Department',\n 'Exit']\n })\n .then(function (pick) {\n switch (pick.apple) {\n case 'View Product Sales by Department':\n departmentSales();\n break;\n case 'View/Update Department':\n updateDepartment();\n break;\n case 'Create New Department':\n createDepartment();\n break;\n case 'Exit':\n connection.end();\n break;\n }\n });\n}", "function toMenu()\n {\n /**\n * Opens a fan of a desk in the pause menu\n */\n function openFan()\n {\n toggleHideElements([DOM.pause.deskContainer], animation.duration.hide, false);\n desk.toggleFan(4, 35, 10, true);\n for (var counter = 0; counter < desk.cards.length; counter++)\n {\n if (state.isWin)\n {\n desk.cards[counter].turn(true);\n desk.cards[counter].dataset.turned = true;\n }\n else if (desk.cards[counter].dataset.turned == true)\n {\n desk.cards[counter].turn(true);\n }\n }\n state.isWin = false;\n }\n\n /**\n * Shows menu elements\n */\n function showMenu()\n {\n if (state.screen == \"GAME\")\n {\n cards[0].removeEventListener(\"move\", showMenuId);\n DOM.pause.deskContainer.style.opacity = 1;\n DOM.cardsContainer.classList.add(CSS.hidden);\n }\n\n if (state.isWin)\n {\n DOM.pause.deskContainer.style.opacity = 0;\n DOM.pause.headline.innerHTML = (state.score >= 0 ? \"Победа со счётом: \" : \"Потрачено: \") + state.score;\n DOM.pause.options.continue.disabled = true;\n state.score = 0;\n }\n else\n {\n DOM.pause.headline.innerHTML = \"MEMORY GAME\";\n }\n\n DOM.container.classList.remove(CSS.container.game);\n DOM.container.classList.add(CSS.container.pause);\n state.screen = \"MENU\";\n\n toggleHideElements(\n [DOM.pause.options.continue, DOM.pause.options.newGame, DOM.pause.headline],\n animation.duration.hide,\n false,\n openFan.bind(this)\n );\n }\n\n /**\n * Hides a game field\n */\n function hideGameField(follower)\n {\n toggleHideElements([DOM.game.score, DOM.game.pauseButton], animation.duration.hide, true, follower);\n }\n\n /**\n * Moves cards from the field to the desk\n */\n function takeCards()\n {\n if (state.turnedCard)\n {\n state.turnedCard.turn(true);\n }\n\n showMenuId = cards[0].addEventListener(\"move\", showMenu);\n\n for (var counter = 0; counter < cards.length; counter++)\n {\n cards[counter].move(DOM.cardsContainer, {width: sizes.desk.width + \"PX\", height: sizes.desk.height + \"PX\"}, true);\n }\n }\n\n state.cardsTurnable = false;\n if (state.screen == \"GAME\")\n {\n var showMenuId;\n hideGameField();\n takeCards();\n }\n else\n {\n hideGameField(showMenu.bind(this));\n }\n }", "function onOpen() {\n \n SpreadsheetApp.getUi().createMenu('Merchant Center')\n .addItem('Run Now', 'main')\n .addToUi()\n }", "function onOpen() { CUSTOM_MENU.add(); }", "getMenu() {alert(\"entering grocery.js getMenu()\")\n\t\t// Assemble the menu list (meal nodes)\n\t\tthis.menuCloset.destructBoxes()\n\t\tlet mealNodes = graph.getNodesByID_partial(\"meal\", \"\")\n\t\tfor (let meal of mealNodes) {\n\t\t\tif (meal.inMenu) { // i don't think we need to keep track of what's on the menu by using inMenu anymore. I think we can just use groceryListArea.menuCloset.boxes to see what's on the menu. This is the next thing to take a look at and understand better. (todo)\n\t\t\t\tthis.menuCloset.add(meal)\n\t\t\t}\n\t\t}\n\t\tthis.updateGroceryList()\n\t}", "function gotoMenu(){\n x = 200;\n dx = 1;\n y = 200;\n dy = 1;\n fuel = 5000;\n landed = false;\n crashed = false;\n fuelout = false;\n gameTimer = 0;\n canvas_x=0;\t\n gamestart = false;\n levelselect = true;\n bonus = 0;\n score = 0;\n}", "start() {\r\n //Below are methods that dont exist YET and to build out our menu; what we think it will look like and then we are going to implement \r\n //those methods this is referred to as the top-down development approach. Where we start from the top then implement those methods.\r\n //this.showMainMenuOptions(method) will return the selection that the user gives us \r\n let selection = this.showMainMenuOptions();\r\n //selection is a variable we're gonna use to get user input of what option out menu has the user selected. We will use 0=exit and do \r\n //something based off of it, so below is a switch. \r\n while (selection != 0) {\r\n switch (selection) {\r\n case \"1\":\r\n //reminder that these are sort of placeholders that will be implemented later according to the top down development approach\r\n this.createAllignmentGroup();\r\n break;\r\n case \"2\":\r\n this.viewAllignmentGroup();\r\n break;\r\n case \"3\":\r\n this.deleteAllignmentGroup();\r\n break;\r\n case \"4\":\r\n this.displayAllignmentGroup();\r\n break;\r\n default:\r\n selection = 0;\r\n }\r\n //outside of our switch here we get the selection like at the beginning to ensure the loop keeps looping as long as we do not select 0 \r\n //or select 1-4\r\n //So this is basically the flow of our application, we are going to prompt/show the menu options the user is going to select something\r\n //we're going to say as long as 0 isnt selected we are going to continue with our determination of what they did select and based on \r\n //what they selected it will show the cases above. \r\n selection = this.showMainMenuOptions();\r\n }\r\n alert(\"Farewell!\");\r\n }", "function onOpen() {\n SpreadsheetApp.getUi().createMenu('Equipment requests')\n .addItem('Set up', 'setup_')\n .addItem('Clean up', 'cleanup_')\n .addToUi();\n}", "function initMenu(){\n\toutlet(4, \"vpl_menu\", \"clear\");\n\toutlet(4, \"vpl_menu\", \"append\", \"properties\");\n\toutlet(4, \"vpl_menu\", \"append\", \"help\");\n\toutlet(4, \"vpl_menu\", \"append\", \"rename\");\n\toutlet(4, \"vpl_menu\", \"append\", \"expand\");\n\toutlet(4, \"vpl_menu\", \"append\", \"fold\");\n\toutlet(4, \"vpl_menu\", \"append\", \"---\");\n\toutlet(4, \"vpl_menu\", \"append\", \"duplicate\");\n\toutlet(4, \"vpl_menu\", \"append\", \"delete\");\n\n\toutlet(4, \"vpl_menu\", \"enableitem\", 0, myNodeEnableProperties);\n\toutlet(4, \"vpl_menu\", \"enableitem\", 1, myNodeEnableHelp);\n outlet(4, \"vpl_menu\", \"enableitem\", 3, myNodeEnableBody);\t\t\n outlet(4, \"vpl_menu\", \"enableitem\", 4, myNodeEnableBody);\t\t\n}", "function menu() {\n this.meal1 = \"Ham and Cheese Sandwich\",\n this.meal2 = \"Roastbeef Sandwich\"\n }", "function start() {\n\n inquirer.prompt({\n name: \"menu\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View Products for Sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\",\n \"Delete Product\",\n \"EXIT\"\n ]\n }).then(function(answer) {\n switch (answer.menu) {\n case \"View Products for Sale\":\n productsForSale();\n break;\n\n case \"View Low Inventory\":\n lowInventory();\n break;\n\n case \"Add to Inventory\":\n addInventory();\n break;\n\n case \"Add New Product\":\n addProduct();\n break;\n\n case \"Delete Product\":\n deleteProduct();\n break;\n\n case \"EXIT\":\n connection.end();\n break;\n }\n });\n}", "function showMenu(fast) {\n\t\t\t\tif ((smallBreakpoint && !opt.everySizes) || opt.everySizes) {\n\t\t\t\t\tmenuOpen = true;\n\t\t\t\t\t$html.addClass('extra-menu-open');\n\t\t\t\t\t$html.removeClass('extra-menu-close');\n\t\t\t\t\tif (fast) {\n\t\t\t\t\t\ttimeline.totalProgress(1);\n\t\t\t\t\t\t$window.trigger('extra:menu:ShowComplete');\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttimeline.play();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\thideMenu(true);\n\t\t\t\t}\n\t\t\t}", "function showMainMenu(){\n addTemplate(\"menuTemplate\");\n showMenu();\n}", "function mainMenu() {\n INQUIRER.prompt([{\n name: 'next',\n type: 'list',\n message: 'Welcome',\n choices: [\n 'View All Products',\n `View Low Inventory`,\n 'Add to Inventory',\n 'Add New Product',\n 'Exit'\n ]\n }]).then(function(input) {\n\n switch (input.next) {\n case 'View All Products':\n displayAll();\n break;\n\n case 'View Low Inventory':\n displayLow();\n break;\n\n case 'Add to Inventory':\n addToInventory();\n\n case 'Exit':\n connection.end();\n break;\n\n //add product\n default:\n addNewProduct();\n break;\n }\n });\n}", "function StartFishing() {\n\n DebugStart()\n // How far to look for trees from the player\n var range = 16;\n AutoFisherman(range);\n}", "expandMenu() {\r\n\t}", "function mainMenu(){\n\tinquirer.prompt([{\n\t\ttype: \"list\",\n\t\tname: \"introAction\",\n\t\tmessage: \"Welcome, pick an action: \",\n\t\tchoices: [\"Create a Basic Card\", \"Create a Cloze Card\", \"Review Existing Cards\"]\n\t}]).then(function(answers){\n\t\tswitch (answers.introAction) {\n\t\t\tcase \"Create a Basic Card\":\n\t\t\t\tcreateBasicCard();\n\t\t\t\tbreak;\n\t\t\tcase \"Create a Cloze Card\":\n\t\t\t\tcreateClozeCard();\n\t\t\t\tbreak;\n\t\t\tcase \"Review Existing Cards\":\n\t\t\t\treviewCards();\n\t\t\t\tbreak;\n\t\t}\n\t});\n}", "function goToMenu() {\n stopTTS();\n cStatus = undefined;\n cStatus = new CurrentStatus();\n $('#quiz').hide('slow');\n $('#game').hide('slow');\n $('#menu').show('slow');\n}", "setupMenu () {\n let dy = 17;\n // create buttons for the action categories\n this.menu.createButton(24, 0, () => this.selectionMode = 'info', this, null, 'info');\n this.menu.createButton(41, 0, () => this.selectionMode = 'job', this, null, 'job');\n // create buttons for each command\n for (let key of Object.keys(this.jobCommands)) {\n let button = this.menu.createButton(0, dy, () => this.jobCommand = key, this, this.jobCommands[key].name);\n dy += button.height + 1;\n }\n // set the hit area for the menu\n this.menu.calculateHitArea();\n // menu is closed by default\n this.menu.hideMenu();\n }", "prepare() { this.createTopMenu(); this.createQuickMenu(); this.showQuickMenu(); }", "function onOpen() {\n SpreadsheetApp.getUi()\n .createMenu('Great Explorations')\n .addItem('Match Girls to Workshops', 'matchGirls')\n .addToUi();\n}", "function menu() {\n document.getElementById(\"menuStart\").classList.toggle(\"show\");\n}", "function C999_Common_Achievements_MainMenu() {\n C999_Common_Achievements_ResetImage();\n\tSetScene(\"C000_Intro\", \"ChapterSelect\");\n}", "function start(action) {\r\n\t\r\n\t\tswitch (action) {\r\n\t\t\tcase 'go look':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: What are you going to look at??\", 1000);\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'explore':\r\n\t\t\t\texploreship(gameobj.explore);\r\n\t\t\t\tgameobj.explore++;\r\n\t\t\tbreak;\r\n\r\n\t\t\tcase 'sit tight':\r\n\t\t\t\ttextDialogue(narrator, \"Narocube: Good choice we should probably wait for John to get back.\", 1000);\r\n\t\t\t\tgameobj.sittight++;\r\n\t\t\tbreak;\t\r\n\t\t}\r\n}", "function menu() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"Supervisor's Menu Options:\",\n choices: [\"View Product Sales By Department\", \"Create New Department\", \"Exit\"]\n }\n ]).then(function (answers) {\n if (answers.choice === \"View Product Sales By Department\") {\n displaySales();\n }\n else if (answers.choice === \"Create New Department\") {\n createDepartment();\n }\n else {\n connection.end();\n }\n });\n}", "function menu() {\n\t\n // Title of Game\n title = new createjs.Text(\"Poker Room\", \"50px Bembo\", \"#FF0000\");\n title.x = width/3.1;\n title.y = height/4;\n\n // Subtitle of Game\n subtitle = new createjs.Text(\"Let's Play Poker\", \"30px Bembo\", \"#FF0000\");\n subtitle.x = width/2.8;\n subtitle.y = height/2.8;\n\n // Creating Buttons for Game\n addToMenu(title);\n addToMenu(subtitle);\n startButton();\n howToPlayButton();\n\n // update to show title and subtitle\n stage.update();\n}", "function init() {\n console.log('Welcome to your company employee manager.')\n menu()\n}", "startGame() {\n this.scene.start('MenuScene');\n }", "function showMenu() {\n rectMode(CENTER);\n fill(colorList[2]);\n rect(buttonX, buttonY, buttonWidth, buttonHeight);\n \n textAlign(CENTER, CENTER);\n fill(colorList[5]);\n text(\"How to Play\", buttonX, buttonY);\n\n fill(colorList[3]);\n rect(buttonX, secondButtonYpos, buttonWidth, buttonHeight);\n \n textAlign(CENTER, CENTER);\n fill(colorList[4]);\n text(\"Dancing Block\", buttonX, secondButtonYpos);\n \n}", "function start() {\n inquirer\n .prompt([{\n type: \"list\",\n name: \"menu\",\n message: \"What would you like to do?\",\n choices: [\"View Products for sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\"\n ]\n }\n\n ])\n .then(function (answers) {\n if (answers.menu === \"View Products for sale\") {\n return viewProducts();\n } else if (answers.menu === \"View Low Inventory\") {\n return lowInventory();\n } else if (answers.menu === \"Add to Inventory\") {\n return addInventory();\n } else if (answers.menu === \"Add New Product\") {\n return addProduct();\n }\n });\n}", "function menu(){\n inquirer.prompt({\n name: \"action\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\n \"View Products for Sale\",\n \"View Low Inventory\",\n \"Add to Inventory\",\n \"Add New Product\",\n \"exit\"\n ]\n }).then(function(answer){\n switch(answer.action){\n case \"View Products for Sale\":\n products();\n break;\n\n case \"View Low Inventory\":\n lowInventory();\n break;\n\n case \"Add to Inventory\":\n addToInventory();\n break;\n\n case \"Add New Product\":\n addProduct();\n break;\n\n case \"exit\":\n connection.end();\n break;\n }\n });\n}", "function onOpen() {\n var menu = [\n { name: \"Fill all items list\", functionName: \"fillAllItemsData\" },\n null,\n { name: \"Schedule run task every hour\", functionName: \"configureRun\"},\n { name: \"Remove schedule\", functionName: \"configureStop\"},\n ];\n \n SpreadsheetApp.getActiveSpreadsheet().addMenu(\"➪ Tarkov-Market\", menu);\n}", "function start() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"choice\",\n message: \"What would you like to do?\",\n choices: [\"Purchase Items\", \n \"Exit\"],\n }\n ]).then(function(answer) {\n\n // Based on the selection, the user experience will be routed in one of these directions\n switch (answer.choice) {\n case \"Purchase Items\":\n displayItems();\n break;\n case \"Exit\":\n exit();\n break;\n }\n });\n} // End start function", "function initSuperFish(){\r\n\t\t\r\n\t\t$(\".sf-menu\").superfish({\r\n\t\t\t delay: 50,\r\n\t\t\t autoArrows: true,\r\n\t\t\t animation: {opacity:'show'}\r\n\t\t\t //cssArrows: true\r\n\t\t});\r\n\t\t\r\n\t\t// Replace SuperFish CSS Arrows to Font Awesome Icons\r\n\t\t$('nav > ul.sf-menu > li').each(function(){\r\n\t\t\t$(this).find('.sf-with-ul').append('<i class=\"fa fa-angle-down\"></i>');\r\n\t\t});\r\n\t}", "function init_dash() {\n dropDown();\n}", "doReStart() {\n // Stoppe la musique d'intro\n this.musicIntro.stop();\n // Lance la scene de menus\n this.scene.start('MenuScene');\n }", "function mainMenu() {\n\n inquirer\n .prompt({\n type: \"list\",\n name: \"task\",\n message: \"Plz, select your entry ?\",\n choices: [\n \"View Employees\",\n \"View Departments\",\n \"View Roles\",\n \"Add Employees\",\n \"Update EmployeeRole\",\n \"Add Role\",\n \"Exit\"]\n })\n .then(function ({ task }) {\n switch (task) {\n case \"View Employees\":\n viewEmployee();\n break;\n case \"View Departments\":\n viewDepartmnt();\n break;\n case \"View Roles\":\n viewRole();\n break;\n case \"Add Employees\":\n addEmployee();\n break;\n case \"Update EmployeeRole\":\n updateEmployeeRole();\n break;\n case \"Add Role\":\n addRole();\n break;\n case \"Exit\":\n connection.end();\n break;\n \n }\n });\n}", "function openMenu() {\n g_IsMenuOpen = true;\n}", "function start() {\n inquirer.prompt([{\n name: \"entrance\",\n message: \"Would you like to shop with us today?\",\n type: \"list\",\n choices: [\"Yes\", \"No\"]\n }]).then(function(answer) {\n // if yes, proceed to shop menu\n if (answer.entrance === \"Yes\") {\n menu();\n } else {\n // if no, end node cli \n console.log(\"---------------------------------------\");\n console.log(\"No?!?!?! What do you mean no!?!?!?!?!?\");\n console.log(\"---------------------------------------\");\n connection.destroy();\n return;\n }\n });\n}", "function runSupervisorMenu() {\n inquirer.prompt([\n {\n type: \"list\",\n message: \"Please select from menu: \".magenta.italic.bold,\n name: \"menu\",\n choices: [\"View Product Sales By Department\", \"Create New Department\", \"View All Users\", \"Create User\", \"Exit\"]\n }\n ]).then(function (inquirerResponse) {\n switch (inquirerResponse.menu) {\n case \"View Product Sales By Department\":\n viewDepartmentSales();\n break;\n case \"Create New Department\":\n addDepartment();\n break;\n case \"View All Users\":\n viewAllUsers();\n break;\n case \"Create User\":\n addUser();\n break;\n case \"Exit\":\n process.exit();\n break;\n }\n });\n}", "function gameMenutoMainMenu() {\n if (store.getState().lastAction == MENU_CHANGE && store.getState().previousPage == 'GAME_MENU' && store.getState().currentPage == 'MAIN_MENU') {\n mainSfxController(preloaderSfxSource);\n preloaderStarter();\n\n setTimeout(function(){\n gameMenu.classList.add('pagehide');\n mainMenu.classList.remove('pagehide');\n gameMenuStartableid.classList.remove('game-menu-startable');\n gameMenuBattlepointer1id.classList.remove('game-menu-battlepointer');\n if (store.getState().activeGameState.isMap1Completed != true) {\n gameMenuStarthereTextid.classList.add('nodisplay');\n }\n }, 600);\n\n setTimeout(function(){\n mainMenuCreditsButtonid.classList.remove('nodisplay');\n mainMenuStartButtonid.classList.remove('nodisplay');\n }, 1400);\n\n mainMenuPlayonmobileButtonid.classList.add('main-menu-playonmobile-button');\n\n loadSavedMenuid.classList.remove('load-saved-menu');\n loadSavedMenuid.classList.add('load-saved-menu-reverse');\n mainMenuArmorgamesImageid.classList.add('main-menu-armorgames-image');\n mainMenuIronhideImageid.classList.add('main-menu-ironhide-image');\n mainMenuStartImageid.classList.add('main-menu-start-image');\n mainMenuCreditsImageid.classList.add('main-menu-credits-image');\n }\n }", "function menu() {\n inquirer\n .prompt({\n name: \"menuOptions\",\n type: \"list\",\n message: \"What would you like to do?\",\n choices: [\"View Products\", \"View Low Inventory\", \"Add Inventory\", \"Add New Product\"]\n })\n .then(function(answer) {\n // based on their answer, run appropriate function\n if (answer.menuOptions === \"View Products\") {\n viewProducts();\n }\n else if (answer.menuOptions === \"View Low Inventory\") {\n viewLowInventory();\n }\n else if (answer.menuOptions === \"Add Inventory\") {\n addInventory();\n }\n else if (answer.menuOptions === \"Add New Product\") {\n addNewProduct();\n }\n else {\n connection.end();\n }\n });\n}", "function Menu() {\n\t\n\tPhaser.State.call(this);\n\t\n}", "function menuGame(){\n startScene.visible = true;\n helpScene.visible = false;\n gameOverScene.visible = false;\n gameScene.visible = false;\n}", "function showMenu() {\n if(newGame) {\n $('#main').show();\n }\n else {\n $('#end').show();\n }\n}", "function toMenu() {\n\tclearScreen();\n\tviewPlayScreen();\n}", "startMainMenu()\n {\n // We check if the player is on mobile and open fullscreen\n let os = theGame.device.os;\n if(os.android || os.iOS || os.iPad || os.iPhone || os.windowsPhone)\n {\n openFullScreen();\n }\n \n let gameCredits;\n let goat = currentScene.add.image(-100, topBackgroundYOrigin+35, 'GoatMenu');\n let fondo2 = currentScene.add.image(topBackgroundXOrigin, topBackgroundYOrigin, 'Fondo2');\n fondo2.visible = false;\n let logo = currentScene.add.image(topBackgroundXOrigin, topBackgroundYOrigin, 'Logo');\n //logo.visible = false;\n \n // Start Btn\n let startBtn = currentScene.add.image(topBackgroundXOrigin-40, topBackgroundYOrigin+125, 'StartBtn');\n let startHigh = currentScene.add.image(topBackgroundXOrigin-40, topBackgroundYOrigin+125, 'StartHigh');\n startBtn.setInteractive();\n startBtn.on('pointerover', ()=> this.onMenuBtnInteracted(startHigh, true));\n startBtn.on('pointerdown', ()=> this.onMenuBtnInteracted(startHigh, true));\n startBtn.on('pointerup', ()=> this.onMenuBtnInteracted(startHigh, false));\n startBtn.on('pointerout', ()=> this.onMenuBtnInteracted(startHigh, false));\n startBtn.on('pointerup', ()=> interacionManager.interactMenu(\"Start\"));\n\n startBtn.visible = false;\n startHigh.visible = false;\n\n // Continue Btn\n let continueBtn = currentScene.add.image(topBackgroundXOrigin-186, topBackgroundYOrigin+128, 'ContinueBtn');\n let continueHigh = currentScene.add.image(topBackgroundXOrigin-186, topBackgroundYOrigin+128, 'ContinueHigh');\n continueBtn.setInteractive();\n continueBtn.on('pointerover', ()=> this.onMenuBtnInteracted(continueHigh, true));\n continueBtn.on('pointerdown', ()=> this.onMenuBtnInteracted(continueHigh, true));\n continueBtn.on('pointerup', ()=> this.onMenuBtnInteracted(continueHigh, false));\n continueBtn.on('pointerout', ()=> this.onMenuBtnInteracted(continueHigh, false));\n continueBtn.on('pointerup', ()=> interacionManager.interactMenu(\"Continue\"));\n\n continueBtn.visible = false;\n continueHigh.visible = false;\n\n // Credits Btn\n let creditsBtn = currentScene.add.image(topBackgroundXOrigin-308, topBackgroundYOrigin+128, 'CreditsBtn');\n let creditsHigh = currentScene.add.image(topBackgroundXOrigin-308, topBackgroundYOrigin+128, 'CreditsHigh');\n creditsBtn.setInteractive();\n creditsBtn.on('pointerover', ()=> this.onMenuBtnInteracted(creditsHigh, true));\n creditsBtn.on('pointerdown', ()=> this.onMenuBtnInteracted(creditsHigh, true));\n creditsBtn.on('pointerup', ()=> this.onMenuBtnInteracted(creditsHigh, false));\n creditsBtn.on('pointerout', ()=> this.onMenuBtnInteracted(creditsHigh, false));\n creditsBtn.on('pointerup', ()=> enableCredits(this.gameCredits, true));\n\n creditsBtn.visible = false;\n creditsHigh.visible = false;\n\n // Mute Btn\n let muteBtn = currentScene.add.image(topBackgroundXOrigin-395, topBackgroundYOrigin+128, 'MenuMuteBtn');\n let muteHigh = currentScene.add.image(topBackgroundXOrigin-395.9, topBackgroundYOrigin+128, 'MenuMuteHigh');\n muteBtn.setInteractive();\n muteBtn.on('pointerover', ()=> this.onMenuBtnInteracted(muteHigh, true));\n muteBtn.on('pointerdown', ()=> this.onMenuBtnInteracted(muteHigh, true));\n muteBtn.on('pointerup', ()=> this.onMenuBtnInteracted(muteHigh, false));\n muteBtn.on('pointerout', ()=> this.onMenuBtnInteracted(muteHigh, false));\n muteBtn.on('pointerup', ()=> interacionManager.interactMenu(\"Mute\"));\n\n muteBtn.visible = false;\n muteHigh.visible = false;\n\n let timeline = currentScene.tweens.createTimeline();\n\n timeline.add(\n {\n targets: goat,\n x: topBackgroundXOrigin + 175,\n duration: 900\n }\n );\n\n timeline.add( \n {\n targets: fondo2,\n onStart: function()\n {\n fondo2.visible = true;\n let timedEvent = currentScene.time.delayedCall(1300, function()\n {\n musicManager.playThemeSong('Main');\n startBtn.visible = true;\n continueBtn.visible = true;\n creditsBtn.visible = true;\n muteBtn.visible = true;\n\n } , currentScene);\n } \n } \n );\n timeline.play(); \n this.gameCredits = currentScene.add.image(topBackgroundXOrigin, topBackgroundYOrigin, 'GameCredits');\n this.gameCredits.setInteractive();\n this.gameCredits.on('pointerdown', ()=> enableCredits(this.gameCredits, false));\n this.gameCredits.visible = false;\n }", "function onOpen(e) {\n var menu = SpreadsheetApp.getUi()\n .createMenu('Flights')\n .addItem('Check Flights', 'getFlights'); \n \n menu.addToUi();\n}", "function app(){\n mainMenu();\n}", "showMenu() {\n this._game = null;\n this.stopRefresh();\n this._view.renderMenu();\n this._view.bindStartGame(this.startGame.bind(this));\n this._view.bindShowScores(this.showScores.bind(this));\n }", "function onOpen() {\n var ui = DocumentApp.getUi();\n ui.createMenu('Script menu')\n .addItem('Setup', 'setup')\n .addItem('Create Events First Time', 'createDocForEvents')\n .addToUi();\n}", "function preMenutoMainMenu() {\n if (store.getState().lastAction == MENU_CHANGE && store.getState().previousPage == 'PRE_MENU' && store.getState().currentPage == 'MAIN_MENU') {\n mainSfxController(preloaderSfxSource);\n preloaderStarter();\n loadSavedMenuGameslotDisplayHandler();\n\n setTimeout(function(){\n preMenu.classList.add('pagehide');\n mainMenu.classList.remove('pagehide');\n }, 600);\n\n mainMenuPlayonmobileButtonid.classList.add('main-menu-playonmobile-button');\n mainMenuArmorgamesImageid.classList.add('main-menu-armorgames-image');\n mainMenuIronhideImageid.classList.add('main-menu-ironhide-image');\n mainMenuStartImageid.classList.add('main-menu-start-image');\n mainMenuCreditsImageid.classList.add('main-menu-credits-image');\n }\n }", "function frontPage() {\n console.log(\"Welcome to Reddit! the front page of the internet\");\n fpMenu();\n\n\n}", "function playbutton(){\n document.querySelector('#startMenu').style.display = \"none\";\n bg_call();\n }", "start() {\n super.start(this.game.menuOptions);\n this.game.display.draw(0, 0, 'a');\n this.game.display.draw(0, 1, 'b');\n this.game.display.draw(0, 2, 'c');\n this.game.display.draw(0, 3, 'd');\n this.game.display.draw(0, 4, 'e');\n this.game.display.draw(0, 5, ['f', '➧']);\n this.game.display.draw(0, 6, 'g');\n this.game.display.draw(0, 7, 'h');\n this.game.display.draw(0, 8, 'i');\n this.game.display.draw(1, 0, 'j');\n this.game.display.draw(1, 1, 'k');\n this.game.display.draw(1, 2, 'l');\n this.game.display.draw(1, 3, 'm');\n this.game.display.draw(1, 4, 'n');\n this.game.display.draw(1, 5, 'o');\n this.game.display.draw(1, 6, 'p');\n this.game.display.draw(1, 7, 'q');\n this.game.display.draw(1, 8, this.game.music.muted ? ['r', '♩'] : 'r');\n this.selected = 0;\n }", "function menu() {\n inquirer.prompt([\n {\n name: \"menu\",\n message: \"Menu:\",\n type: \"list\",\n choices: [\"Products for Sale\", \"Low Inventory\", \"Add to Inventory\", \"New Product\", \"Exit\"],\n }]).then(function (answer) {\n\n // depending on the option picked for the chosen call the correct function\n switch (answer.menu) {\n case \"Products for Sale\": {\n showInventory();\n break;\n }\n case \"Low Inventory\": {\n lowerInventory();\n break;\n }\n case \"Add to Inventory\": {\n addInventory();\n \n break;\n }\n case \"New Product\": {\n addNewProduct();\n break;\n }\n case \"Exit\": {\n connection.end();\n break;\n }\n }\n\n });\n}", "function menuzordActive () {\n if ($(\"#menuzord\").length) {\n $(\"#menuzord\").menuzord({\n indicatorFirstLevel: '<i class=\"fa fa-angle-down\"></i>'\n });\n };\n}", "function createMainMenu(game) {\n // Fade in transition\n fadeSceneIn(game, 1000, \"Linear\");\n\n // Background\n game.add.image(0, 0, 'menu-bg').setOrigin(0, 0);\n\n // Game version\n var verStyle = { font: \"14px Optima\", fill: \"#fff\" };\n var versionText = game.add.text(2, 626, \"v\" + version(), verStyle).setOrigin(0, 1);\n versionText.setShadow(2, 2, \"#000\", 2);\n versionText.alpha = 0.3;\n\n // Title Text\n var titleStyle = { font: \"100px FrizQuadrata\", fill: \"#000\", stroke: \"#fff\", strokeThickness: 7 };\n var titleText = game.add.text(512, 250, \"Fate/Grand Wars\", titleStyle).setOrigin(0.5, 0.5);\n titleText.setShadow(1, 1, 'rgba(0,0,0,0.9)', 2, true, false);\n\n // Music\n var music = game.sound.add('menu-bgm', { volume: 0.5 } );\n music.loop = true;\n music.play();\n\n\n // Button sprite\n var button = game.add.sprite(512, 400, 'button-medium').setInteractive( useHandCursor() );\n button.on('pointerdown', (pointer) => {\n if (!pointer.rightButtonDown()) {\n button.tint = 0xbbbbbb;\n button.removeInteractive();\n startGame(game, music);\n }\n } );\n button.on('pointerover', function (pointer) { button.tint = 0xbbbbbb; } );\n button.on('pointerout', function (pointer) { button.tint = 0xffffff; } );\n\n // Start Text\n var startStyle = { font: \"35px Optima\", fill: \"#000\" };\n var startText = game.add.text(512, 400, \"START\", startStyle).setOrigin(0.5, 0.5);\n}", "function mainMenu() {\n inquirer.prompt({\n type: \"list\",\n name: \"action\",\n message: \"What would you like to do?\",\n choices: [\n { name: \"Add something\", value: createMenu },\n { name: \"View something\", value: readMenu },\n { name: \"Change something\", value: updateMenu },\n { name: \"Remove something\", value: deleteMenu },\n { name: \"Quit\", value: quit }\n ]\n }).then(({ action }) => action());\n}", "function menuOptions() {}", "function handleFancyRestaurantChoice() {\n /** @type {HTMLInputElement} Input field. */\n const dishInput = document.getElementById(\"dish-input\").value;\n const fancyMenu = [\"pizza\", \"paella\", \"pasta\"]\n\n if(dishInput == fancyMenu[0]) {\n restaurantClosing();\n } else if (dishInput == fancyMenu[1]) {\n restaurantClosing();\n } else if (dishInput == fancyMenu[2]) {\n restaurantClosing();\n } else {\n fancyRestauratMenu();\n }\n}", "function onOpen() {\n var ui = SpreadsheetApp.getUi();\n // Or DocumentApp or FormApp.\n ui.createMenu('Own scripts')\n .addItem('Search Calendar Events', 'searchCalendarEvents')\n .addSeparator()\n .addSubMenu(ui.createMenu('Development')\n .addItem('First item', 'devMenuItem1')\n .addItem('Second item', 'devMenuItem2')\n )\n .addToUi();\n}", "_initMenu() {\n this.menu.parentMenu = this.triggersSubmenu() ? this._parentMenu : undefined;\n this.menu.direction = this.dir;\n this._setMenuElevation();\n this._setIsMenuOpen(true);\n this.menu.focusFirstItem(this._openedBy || 'program');\n }", "function mainMenu() {\n inquirer\n .prompt({\n name: \"action\",\n type: \"rawlist\",\n message: \"What would you like to do?\",\n choices: [\n \"Add Departments\",\n \"Add Roles\",\n \"Add Employees\",\n \"View Departments\",\n \"View Roles\",\n \"View Employees\",\n \"Update Role\",\n \"Update Manager\"\n // \"View Employees by Manager\"\n ]\n })\n // Case statement for selection of menu item\n .then(function(answer) {\n switch (answer.action) {\n case \"Add Departments\":\n addDepartments();\n break;\n case \"Add Roles\":\n addRoles();\n break;\n case \"Add Employees\":\n addEmployees();\n break;\n case \"View Departments\":\n viewDepartments();\n break;\n\n case \"View Roles\":\n viewRoles();\n break;\n case \"View Employees\":\n viewEmployees();\n break;\n case \"Update Role\":\n updateRole();\n break;\n case \"Update Manager\":\n updateManager();\n break;\n // case \"View Employees by Manager\":\n // viewEmployeesByManager();\n // break;\n }\n });\n}", "function initialLoad() {\n $('ul.sf-menu').superfish({\n delay: 500,\n animation: {opacity:'show',height:'show'},\n speed: 'slow',\n autoArrows: true,\n dropShadows: false\n });\n $('.toolTipCls').tooltip();\n ITL.view.datePicker($(\".datepicker\"));\n }", "function Scene_GFMenu() {\n this.initialize.apply(this, arguments);\n}", "function fecharMenu() {\n\t\t$('div.menu-mobile').stop(true, true).animate({'marginLeft':'-550px'}, 300);\n\t\t$('.fundo-preto-mobile').stop(true, true).removeClass('active').hide();\n\t\t$('#menumobile a.fecharmenu').stop(true, true).removeClass('fadeIn').addClass('animated fadeOut').hide();\n\t\t$('div.menu-mobile ul.primeira').stop(true, true).hide();\n\t\t$('.menu-mobile ul.primeira li.um').stop(true, true).hide();\n\t\t$('.menu-mobile ul.primeira li.dois').stop(true, true).hide();\n\t\t$('.menu-mobile ul.primeira li.tres').stop(true, true).hide();\n\t\t$('.menu-mobile ul.primeira li.quatro').stop(true, true).hide();\n\t\t$('.menu-mobile ul.primeira li.cinco').stop(true, true).hide();\n\t\t$('.menu-mobile ul.primeira li.seis').stop(true, true).hide();\n\t\t$('.menu-mobile ul.primeira li.sete').stop(true, true).hide();\n\t\t$('div.menu-mobile > ul.primeira > li').stop(true, true).removeClass('flipInX').addClass('animated flipOutX').hide();\n\t\t$('div.menu-mobile').stop(true, true).removeClass('open');\n\t\t$('span.flaticon-arrow').stop(true, true).removeClass('flaticon-arrow').addClass('flaticon-arrow-down-sign-to-navigate');\n\t\t$('ul.esconder').stop(true, true).removeClass('bounceInLeft').hide();\n\t}", "function fancyRestauratMenu() {\n subTitle.innerText = fancyRestaurantWelcome;\n firstButton.classList.add(\"hidden\");\n secondButton.classList.add(\"hidden\");\n fancyDiv.classList.remove(\"hidden\");\n\n handleFancyRestaurantChoice();\n}", "function walkHome(){\r\n\tbackground(0);\r\n\tfirstOption.hide();\r\n\tsecondOption.hide();\r\n\tuserName.hide();\r\n\r\n\t//change the text for the title\r\n\ttitle.html(\"You have gone home. Good Night.\");\r\n\r\n\t//startOver = createA(\"index.html\", \"Start Over\")\r\n\t//firstOption.mousePressed(startOver);\r\n}" ]
[ "0.65776086", "0.65583575", "0.65202", "0.6496863", "0.6446255", "0.6437807", "0.6436781", "0.64309365", "0.6362453", "0.6336776", "0.6317718", "0.6301867", "0.6280807", "0.6278971", "0.6271259", "0.62144846", "0.6179938", "0.6157224", "0.6079268", "0.6076413", "0.6034619", "0.6029177", "0.59927243", "0.5964183", "0.59235823", "0.59214294", "0.5916339", "0.5899422", "0.5889041", "0.58886987", "0.58853495", "0.5881217", "0.5871996", "0.5862523", "0.58601534", "0.5856003", "0.5831402", "0.58295476", "0.58288664", "0.5826047", "0.5825483", "0.58118355", "0.5811118", "0.58062553", "0.58027154", "0.5800293", "0.5796981", "0.57861143", "0.5781985", "0.5778237", "0.5771747", "0.5770944", "0.57669604", "0.57635635", "0.57555807", "0.57539654", "0.57530385", "0.5745582", "0.57405066", "0.57396847", "0.5736355", "0.5729542", "0.5724832", "0.5723902", "0.57185555", "0.57114834", "0.57074267", "0.57036585", "0.57005155", "0.5700176", "0.56981987", "0.56966174", "0.56944776", "0.56926364", "0.5688518", "0.56851935", "0.56845534", "0.5671059", "0.56694376", "0.56685084", "0.5666951", "0.5666337", "0.5659075", "0.56590444", "0.56467944", "0.56407386", "0.56365424", "0.5635241", "0.5630158", "0.5628872", "0.562164", "0.561832", "0.5617711", "0.56088185", "0.56058514", "0.56051934", "0.5603087", "0.55950725", "0.558658", "0.5584327" ]
0.58811235
32
Endning scene, when button is clicked the page refreshes to starting point.
function restaurantClosing() { subTitle.innerText = gameExit; firstButton.innerText = "Play again?"; firstButton.classList.remove("hidden"); fancyDiv.classList.add("hidden"); fastDiv.classList.add("hidden"); firstButton.onclick = function() { location.reload(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function end(){\n Manager.clearGame();\n changeState(gameConfig.GAME_STATE_START_SCENE);\n}", "function endGame() {\n $('.home').css({ 'margin-top': '0px' });\n disappear('.instructions');\n hide('.view-button');\n disappear('.follow-circle');\n disappear('.instructions');\n state = \"view\";\n }", "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 end() {\n gameScene.visible = false;\n gameOverScene.visible = true;\n}", "function end() {\n gameScene.visible = false;\n gameOverScene.visible = true;\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 endGame() {\n resetMainContainer();\n loadTemplate(\"result\", displayResults);\n}", "function lightningEnd(){\n currentScene = \"congrats\"\n }", "function end () {\n //the page goes white\n $('body').css({\n backgroundColor: 'white',\n });\n $('#canvas').css({\n visibility: 'hidden',\n });\n\n //the final package downloads\n window.open('https://whogotnibs.github.io/dart450/assignment02/downloads/package03.zip', '_blank');\n\n //the game functions stop running\n end = true;\n\n //the music stops\n Gibber.clear();\n}", "function loadEnd() {\n quizPage.style.display = \"none\";\n endPage.style.display = \"block\";\n clearInterval(timeInterval);\n}", "function endPage() {\n next.classList.add(\"hide\");\n quizMain.classList.add(\"hide\");\n endSection.classList.remove(\"hide\");\n start.classList.remove(\"hide\");\n start.innerHTML = \"Restart\";\n score.innerHTML = \"You got \" + scoreNum + \" questions correct\";\n clearInterval(timeInterval);\n}", "function endQuiz() {\n quizPage.hidden = true;\n finalPage.hidden = false;\n quizTimer.hidden = true;\n}", "function handleFinalPage() {\r\n $(`main`).on(`click`, `#restart`, function () {\r\n store.quizStarted = false;\r\n store.questionNumber = 0;\r\n store.score = 0;\r\n render();\r\n });\r\n}", "function end() {\n menuScene.visible = false;\n musicPacmanBeginning.stop();\n soundPacmanIntermission.stop();\n// gameSceneLevel2.visible = false;\n gameSceneLevel1.visible = false;\n gameOverScene.visible = true;\n}", "function checkForEnd() {\n\t\tsetTimeout(function () {\n\t\t\t$(\"#content\").fadeOut(500, function () {\n\n\t\t\t\twindow.location = \"scene_pig3story.html\";\n\t\t\t});\n\t\t}, 2400);\n\t\tsetTimeout(function () {\n\t\t\t$(\"body\").removeClass(\"blackFade\");\n\t\t}, 1900);\n\t}", "function endGame() {\n location.reload();\n}", "function endGame() {\n // Réinitialisation de l'affichage du dé\n resetImage(); \n // Position du sélecteur\n selector();\n //Lancement nouvelle partie\n newGame();\n}", "end(){\n this.request({\"component\":this.component,\"method\":\"end\",\"args\":[\"\"]})\n this.running = false\n }", "function endOfGame() {\n\tcreatesMensg();\n\tstopTime();\n\tshowModal();\n}", "function showNextScene() {\n // clear screen\n ((sceneCount + sceneIndex) + 0.5) % sceneCount\n}", "function endGame() {\n location.href = \"index.html\";\n}", "function returnToMain(){\n teleMode = false;\n console.log('reutrn to main');\n fadeAll();\n game.time.events.add(500, function() {\n game.state.start('startScreen');\n }, this);\n}", "function endGame(){\n // Make the correct scenes visible\n titleScene.visible = false;\n gameScene.visible = false;\n gameOverScene.visible = true;\n // Set the background\n renderer.backgroundColor = GAME_OVER_BACKGROUND_COLOR;\n // Use white audio icons\n audioHelper.whiteIcons();\n // Add the game over message to the end scene\n gameOverMessage = new PIXI.Text(\n \"GAME OVER!\",\n {fontFamily: GAME_FONT, fontSize: 60, fill: 0xEA212E}\n );\n gameOverMessage.position.set(GAME_WIDTH/2-gameOverMessage.width/2, GAME_HEIGHT/2-gameOverMessage.height);\n gameOverScene.addChild(gameOverMessage);\n // Create a score ScoreSubmitter\n scoreSubmitter = new ScoreSubmitter();\n // Bind the end-game keys\n bindEndKeys();\n // Stop the timer and set to end\n gameTimer.stop();\n gameTimer.whiteText();\n scoreKeeper.whiteText();\n gameState = end;\n}", "function endOfGame() {\n var reset = document.getElementById(\"newGame\");\n reset.addEventListener(\"click\", function() {\n window.location.reload();\n });\n}", "endGame() {\n this.state = \"endOfGame\";\n\n var resetButton = $(\"<button>Reset</button>\");\n\n resetButton.on(\"click\", function() {\n // Empty all game zones of any remaining content\n $(\"#characterSelect\").empty();\n $(\"#opponentSelect\").empty();\n $(\"#battleZone\").empty();\n $(\"#combatLog\").empty();\n\n // Recreate character cards and set game to character selection\n game.setupCharCards();\n game.state = \"charSelect\";\n\n // Remove reset button\n $(this).remove();\n\n });\n\n resetButton.insertAfter($(\"#atkBtn\"));\n }", "function 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 endGame(){\n\tspawnBall();\n\tcenterBall();\n\tspawnPlayerOne();\n\tspawnPlayerTwo();\n\tupdateScore();\n\t$('#menuCanvas').show();\n}", "function exitGame(){\n selectModalButton($('#exit'));\n window.location.assign(\"../start.html\");\n }", "function scene4() {\n animateBottle(0);\n\n // window.removeEventListener(\"click\", scene3);\n $(\"#btn\").off(\"click\");\n tl = new TimelineLite();\n tl.to($(\"#grass\"), 1, { autoAlpha: 1 })\n .to($(\"#coral\"), 1, {\n autoAlpha: 1,\n delay: 0\n })\n .to($(\"#d-2\"), 1, { autoAlpha: 1 })\n .to($(\"#d-2\"), 1, { autoAlpha: 0 })\n .to($(\"#d-4\"), 1, { autoAlpha: 1 });\n\n localStorage.setItem(\"currentScene\", 4);\n console.log(\"Scene 4 starting\");\n\n $(\"#btn\").on(\"click\", function() {\n tl.to($(\"#d-4\"), 1, { autoAlpha: 0 });\n tl.to($(\"#coral\"), 0.3, { autoAlpha: 0 });\n scene5();\n });\n\n $(\"#read-more\").on(\"click\", function() {\n tl.pause();\n });\n $(\"#back\").on(\"click\", function() {\n tl.play(scene5());\n });\n}", "function LoadNextScene()\n{\n\t// This special Unity function loads the scene with the exact name that you send it - as long as the scene is in the project's build settings!\n\t// If you have trouble with this, double check the name, spelling, case and build settings\n\tApplication.LoadLevel(\"End-scene\");\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 backButtonClicked(event) {\n stage.removeChild(game);\n game.removeAllChildren();\n game.removeAllEventListeners();\n currentState = constants.MENU_STATE;\n changeState(currentState);\n }", "function finishGame() {\n $('#startGame').removeClass('hidden');\n $('#startButton').addClass('btn-danger');\n $('#answers').addClass('hidden');\n $('#titleDiv').addClass('hidden');\n $('#imageDiv').addClass('hidden');\n $('#answers').addClass('hidden');\n $('#startButton').text('Play again?');\n $('#startButton').attr('onclick', 'location.reload()');\n}", "function shutdown () {\n // Volvemos a crear el boton de start y lo llevamos al frente\n startButton = game.add.button(game.width / 2, 300, 'startButton', startClick, this);\n startButton.anchor.setTo(0.5, 0.5);\n // Ponemos imagen Game Over\n this.add.sprite(50, 200, 'gameOver');\n}", "function endGame() {\n window.location.href = \"scores.html\"\n\n}", "function navigateToScoreOverview(){\n ApplicationEnded=true;\n gotoScoreOverview();\n}", "function sceneBack() {\n\t// if can pop scene\n\tif ( App.sceneStack.length > 1 ){\n\t\tvar scene = App.popScene();\n\t\ttransitionScene( App.scene, scene, 1 );\n\t// otherwise quit\n\t} else {\n\t\tquit();\n\t}\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 endGame() {\n\n partidas++;\n tiempoJugadores();\n\n //Si se termina la segunda ronda va al estado ranking\n if (partidas == 2)\n game.state.start('ranking', true, false, tj1, tj2);\n\n //Si termina la primera ronda, va al estado win\n else\n game.state.start('win', true, false);\n\n}", "moveToNextScene()\n {\n\n if(seconds2 < 0)\n {\n this.add.text(240, 345, 'Survived green and red bug\\n Click to meet yellow bug', { fontSize: '18px', fill: '#000000' })\n this.input.on(\"pointerup\", () => {\n this.scene.stop(\"GameScene\");\n this.scene.start('YellowBugScene');\n });\n //reset time\n seconds = 1;\n seconds2 = 1;\n }\n }", "function showEnd() {\n console.log(\"showEnd ran\");\n getResult();\n $(\"#topright\").hide();\n $(\"#gamecontents\").hide();\n $(\"#end\").show();\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 endGame() {\n gameStarted = false;\n background('Black');\n fill(255)\n text(\"GAME OVER\", width / 2, height /2);\n cursor();\n \n tryAgainButton = createButton(\"Try Again?\");\n tryAgainButton.position(width / 2 - ((width / 4) / 2), height * 0.7);\n tryAgainButton.size(width /4, height / 8);\n tryAgainButton.mousePressed(tryAgain);\n \n}", "function backClicked(event) {\n stage.removeChild(game);\n game.removeAllChildren();\n game.removeAllEventListeners();\n constants.engineSound.stop();\n currentState = constants.MENU_STATE;\n changeState(currentState);\n }", "function actionOnClickBack() {\n\t\t\t//alert('Saldras de la carrera');\n\t\t\tgame.state.start('mainMenuState')\n\t\t}", "finish(){\n model.stat.timer.stop();\n alert(model.algorithm.getCurrStep().description+' '+model.algorithm.getCurrStep().help);\n\t\tdocument.getElementById('nextBtn').disabled=true;\n\t\tdocument.getElementById('autoRunBtn').disabled=true;\n }", "function handleEndQuiz() {\n $('main').on('click', '.js-end-button', (event) => {\n store.score = 0;\n store.questionNumber = 0;\n store.quizStarted = false;\n renderQuizScreen();\n });\n}", "function endQuiz(){\n clearInterval(timerInterval);\n document.querySelector('.endPage').style.display = \"block\";\n document.getElementById('quiz').style.display = \"none\";\n \n }", "function finish () {\n $(\".game\").html(\"\");\n $(\"#choices\").html(\"\");\n $(\"#wins\").text(\"Correct: \" + wins);\n $(\"#losses\").text(\"Incorrect: \" + losses);\n restart();\n }", "function scene5() {\n animateBottle(0);\n\n // window.removeEventListener(\"click\", scene3);\n $(\"#btn\").off(\"click\");\n tl = new TimelineLite();\n tl.to($(\"#dirt\"), 1, { autoAlpha: 1 })\n .to($(\".help-1\"), 5, { autoAlpha: 1, ease: Bounce.easeOut })\n .to($(\".help-1\"), 0, { autoAlpha: 0, ease: Bounce.easeOut })\n .to($(\".help-2\"), 5, { autoAlpha: 1, ease: Bounce.easeOut })\n .to($(\".help-2\"), 0, { autoAlpha: 0, ease: Bounce.easeOut })\n .to($(\".help-3\"), 5, { autoAlpha: 1, ease: Bounce.easeOut })\n .to($(\".help-3\"), 0, { autoAlpha: 0, ease: Bounce.easeOut })\n .to($(\".help-4\"), 5, { autoAlpha: 1, ease: Bounce.easeOut })\n .to($(\".help-4\"), 0, { autoAlpha: 0, ease: Bounce.easeOut })\n .to($(\".help-5\"), 5, { autoAlpha: 1, ease: Bounce.easeOut })\n .to($(\".help-5\"), 0, { autoAlpha: 0, ease: Bounce.easeOut });\n\n localStorage.setItem(\"currentScene\", 5);\n console.log(\"Scene 5 starting\");\n}", "goToScene(){\n this.return = false;\n this.nameArea.text = \"\";\n }", "function endGame(){\r\n youWonGif();\r\n document.getElementById(\"canvas\").style.display = \"none\";\r\n document.getElementById(\"level\").style.display = \"none\";\r\n document.getElementById(\"scorePoint\").style.display = \"none\";\r\n document.getElementById(\"scoreCat1\").style.display = \"none\";\r\n document.getElementById(\"endScorePoint\").style.display = \"block\";\r\n document.getElementById(\"startbtn\").style.display = \"none\";\r\n document.getElementById(\"newbtn\").style.display = \"block\";\r\n document.getElementById(\"intro\").style.display = \"none\";\r\n document.getElementById(\"endGame\").style.display = \"block\";\r\n \r\n}", "function onNextClick() {\n\n\tAlloy.Globals.NAVIGATION_CONTROLLER.openWindow('startScreen');\n\tAlloy.Globals.NAVIGATION_CONTROLLER.closeWindow('welcomeScreen');\n\tAlloy.Globals.NAVIGATION_CONTROLLER.closeWindow('welcomeContentScreen');\n}", "function handleStartOver() {\n $('body').on('click', '#restart-button', (e) => {\n \n store.view = 'landing';\n store.questionNumber = 0;\n store.score = 0;\n render()\n })\n\n}", "function endQuiz() {\n\n // clear page\n clearPage();\n\n // replace start button\n $(\"#start-button\").append(\"<button>Click here to try again!</button>\");\n\n // show user how they did\n quizQuestion.append(\"<div>Correct Guesses: \" + correctGuesses + \"</div>\");\n quizQuestion.append(\"<div>Incorrect Guesses: \" + (questions.length - correctGuesses) + \"</div>\");\n\n }", "function redoScene() {\n drawBox(guiParams.mode);\n TW.render();\n}", "function endWizardPlanes () {\n\t\t\t$('.wizardPlanes-pasos:not(.pasoFinal)').slideUp();\n\t\t\t$('.wizardPlanes-pasos.wizard-pasoFinal').slideDown();\n\t\t\t$('header h3.ta-center').html('El plan más conveniente para ti es');\n\t\t\t$('header h4').remove();\n\t\t\t$('html, body').animate({scrollTop: $('header h3').offset().top}, 500);\n\t\t}", "function gameRestartFragment()\n{\n\ttextSize(100);\n\ttext(\"GAMEOVER\", width/2, height/2);\n\ttextAlign(CENTER, CENTER);\n\n\t//resetBtn = createButton('RESET');\n \t//resetBtn.position(width/2 - 70, height/2 + 100);\n \t//resetBtn.mousePressed(mousePressed);\n}", "function endGame(){\n $('.card-container').removeClass(\"selected-card\");\n $('.card-container').remove();\n while(model.getCardObjArr().length > 0){\n model.removeFromCardObjArr(0);\n }\n\n while(model.getDisplayedCardArr().length > 0){\n model.removeFromDisplayedCardArr(0)\n }\n\n while(model.getSelectedCardObjArr().length > 0){\n model.removeFromSelectedCardArr(0)\n }\n if(($(\".card-display-container\").find(\".game-over-page\").length) === 0){\n createGameOverPage();\n createWinnerPage();\n } else {\n return;\n }\n }", "function endgame() {\n $(\"flee-btn\").classList.add(\"hidden\");\n $(\"endgame\").classList.add(\"hidden\");\n $(\"their-card\").classList.add(\"hidden\");\n $(\"pokedex-view\").classList.remove(\"hidden\");\n qs(\"#my-card .buffs\").classList.add(\"hidden\");\n qs(\"#my-card .health-bar\").style.width = \"100%\";\n qs(\"#my-card .hp\").innerHTML = pokeHP + \"HP\";\n $(\"results-container\").classList.add(\"hidden\");\n $(\"p1-turn-results\").classList.add(\"hidden\");\n $(\"title\").innerHTML = \"Your Pokedex\";\n $(\"start-btn\").classList.remove(\"hidden\");\n }", "end() {\n this.endZoomInMode();\n this.endHandMode();\n }", "function endGame() {\n // Overlay\n // Show score\n // Show table \n // Give user chance to restart\n // TODO: add high score to renderGUI\n\n uploadScore(score);\n score = 0;\n}", "function endGame() {\n var unansewerPoint = questions.length - currentQuestionNumber + skipQuestionPoint;\n $('.btn-group-vertical').empty();\n stop();\n //when time out, show the number of correct guesses, wrong guesses, unansewer and show start over button\n $('#currQuestion').html('You have ' + correctPoint + ' correct scorrect point! <br> You have ' + incorrectPoint + ' incorrect scorrect point! <br> You have ' + unansewerPoint + ' unansewer!<br>');\n // Start over, do not reload the page, just reset the game\n var restbtn = $('<button>');\n restbtn.text('Reset');\n restbtn.attr('class', 'btn btn-secondary btn-block mt-4');\n $('#currQuestion').append(restbtn);\n //click the reset function make variable reset\n $('.btn').on('click', reset);\n}", "function handleEnd(){\n if ((tracksBtn.value === 'playing') && !unpause){\n tracksBtn.value = 'paused';\n tracksBtn.innerHTML = 'Play';\n if(gl){\n endVisualizations();\n }\n }\n}", "function endGame() {\n pongball.x = width / 2;\n pongball.y = -20;\n window.location.reload();\n}", "onDestroy() {\n this.scene.time.addEvent({ // go to game over scene\n delay: 1000,\n callback: function () {\n this.scene.scene.start(\"SceneGameOver\");\n },\n callbackScope: this,\n loop: false\n });\n }", "finish () {\n this.menuView.draw(this.sections)\n }", "function end() {\n stopTime();\n promptText.innerText = \"Test Complete\";\n pegDisplay.classList.add(\"gone\");\n homeButton.classList.remove(\"gone\");\n resultsButton.classList.remove(\"gone\");\n}", "function maybeExit() {\n\t// 'this' here is Controller instance\n\tif ( this.get( 'select' ) && this.get( 'start' ) ) {\n\t\tstopEvent();\n\t\tsceneBack();\n\t}\n}", "function endGame()\n{\n\tfor(var i = 0; i < 16; i++)\n\t{\n\t\tapp.coverImgArr[i].style.visibility = 'hidden';\n\t\t//app.tileImgArr[i].style.visibility = 'hidden';\n\t}\n\n\tapp.pairsFound = 0;\n\n\tapp.startBtn.disabled = false;\n\tapp.endBtn.disabled = true;\n\n\tremoveTiles();\n\t\n\tinitVars();\n}", "function endGame () {\n renderFlag = false;\n document.getElementById('pointsSummary').innerHTML = totalPoints;\n document.getElementById('gameScreen').style.display = 'block';\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 endGame() {\n localStorage.setItem(\"qIndex\", 0);\n localStorage.setItem(\"score\", score);\n localStorage.setItem(\"totalTime\", totalTime)\n window.location.href = \"./endgame.html\";\n}", "function endScreen() {\n clearScreen();\n var allDone = $(\"<h2>\").text(\"All done, here's how you did!\");\n var correct = $(\"<h3>\").text(\"Correct Answers: \" + correctNumber);\n var incorrect = $(\"<h3>\").text(\"Incorrect Answers: \" + incorrectNumber);\n var unanswered = $(\"<h3>\").text(\"Unanswered: \" + unansweredNumber);\n var resetBtn = $(\"<button>\").text(\"Play Again!\");\n allDone.attr({ id: \"all-done\", class: \"animated fadeInUp\" });\n correct.attr({ id: \"correct-number\", class: \"animated fadeInUp\" });\n incorrect.attr({ id: \"incorrect-number\", class: \"animated fadeInUp\" });\n unanswered.attr({ id: \"unanswered-number\", class: \"animated fadeInUp\" });\n resetBtn.attr({\n id: \"reset-btn\",\n class: \"btn btn-light animated fadeInUp\"\n });\n $(\"#question-section\").append(allDone);\n $(\"#answers-section\").append(correct, incorrect, unanswered);\n $(\"#btn-section\").append(resetBtn);\n }", "function BackButtonClickHandler()\n{\n SlideToPage(\"workersnearby.html\");\n}", "endGame(){\n this.state = END;\n }", "function endStage() {\n $('#opening').css('display','block')\n $('#opentext').text('Thank you for playing! Click to play again.')\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 Scene_GameEnd() {\n this.initialize.apply(this, arguments);\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 endGame(){\n if(trivia[currentQAndA] === (trivia.length)){\n stop();\n \n $(\".quiz\").html(\"<h1>\" + 'Done!' + \"</h1>\")\n }\n else{\n loading();\n }\n }", "function end() {\r\n bg.visible = false;\r\n monkey.visible = false;\r\n\r\n bananaGroup.destroyEach();\r\n stoneGroup.destroyEach();\r\n}", "function endingScreen(STORE, questionNumber, totalQuestions, score) {\r\n $('.results').on('click', '.restartButton', function (event) {\r\n let questionNumberDisp = 1;\r\n\r\n updateAnswerList(STORE, questionNumber, totalQuestions, questionNumberDisp, score);\r\n\r\n $('.results').css('display', 'none');\r\n $('.quizQuestions').css('display', 'block'); \r\n });\r\n\r\n return questionNumber;\r\n}", "function endEarlyButton() {\n endEarlyDetails();\n}", "function scene3() {\n animateBottle(0);\n\n // window.removeEventListener(\"click\", scene3);\n $(\"#btn\").off(\"click\");\n tl = new TimelineLite();\n tl.to($(\"#turt\"), 1, {\n autoAlpha: 1,\n delay: 1\n })\n .to($(\"#d-1\"), 1, { autoAlpha: 1 })\n .to($(\"#d-1\"), 1, { autoAlpha: 0 })\n .to($(\"#d-4\"), 1, { autoAlpha: 1 });\n\n localStorage.setItem(\"currentScene\", 3);\n console.log(\"Scene 3 starting\");\n\n $(\"#btn\").on(\"click\", function() {\n tl.to($(\"#d-4\"), 1, { autoAlpha: 0 });\n tl.to($(\"#turt\"), 0.3, { autoAlpha: 0 });\n scene4();\n });\n $(\"#read-more\").on(\"click\", function() {\n tl.pause();\n });\n $(\"#back\").on(\"click\", function() {\n tl.play(scene4());\n });\n\n // window.addEventListener(\"click\", scene4);\n}", "function endReached() {\n stopDriving();\n updateProgressBar(0);\n showInstruction(\"You have reached your destination\");\n document.getElementById(\"step\" + selectedStep).style.backgroundColor = \"white\";\n selectedStep = null;\n }", "function goBackToStart() {\n const quizPage = document.getElementById(\"quiz-page\");\n const startPage = document.getElementById(\"start-page\");\n const resultPage = document.getElementById(\"result-page\");\n let resultContainer = document.getElementById(\"resultContainer\");\n quizPage.style.display = \"none\";\n startPage.style.display = \"block\";\n resultPage.style.display = \"none\";\n resultContainer.innerHTML = \"\";\n}", "function endOfGame() {\n if(confirm(`*** Game over! ***\\n** You scored ${snake.body.length-3} points! **\\n* Start a new game? *`)) {\n document.location.reload(true);\n }\n else clearInterval(playgroundRefresh);\n}", "function goBackBtnClicked(event) {\n stage.removeChild(game);\n game.removeAllChildren();\n game.removeAllEventListeners();\n //change state to menu state\n currentState = constants.MENU_STATE;\n changeState(currentState);\n }", "returnToTitle(){\n //console.log(\"returnToTitle FUNCIONA\");\n this.scene.stop('CONTROL_KEYS_SCENE_KEY');\n this.scene.resume('TITLE_SCENE_KEY');\n }", "function gameEnd(){\n questionsEl.className = \"hide\";\n gameEnd.className = \"show\";\n }", "function endScreen(){\n toggleModalOn();\n var newGameSelector = document.getElementById('modal-new-game');\n var modalCancel = document.getElementById('modal-cancel');\n \n newGameSelector.addEventListener('click', event=>{\n toggleModalOff();\n newGame();\n })\n \n modalCancel.addEventListener('click', event =>{\n toggleModalOff();\n })\n \n}", "exit() {\n this.setState(new MyStateMainMenu(this.scene, this));\n }", "function C007_LunchBreak_Natalie_EndChapter() {\r\n C007_LunchBreak_ActorSelect_Kinbaku = true;\r\n SetScene(CurrentChapter, \"Outro\");\r\n}", "function goBackToStart() {\n location.reload();\n}", "function finish() {\n model.style.display = \"block\";\n modelMoves.innerText = moves;\n modelStars.innerText = starsNumber;\n modelMins.innerText = mins.textContent;\n modelSec.innerText = sec.textContent;\n clearInterval(time);\n\n // reset the game after click on restartBtn\n modelRstart.addEventListener('click', function(){\n reset();\n });\n\n}", "function makeEndPage() {\n\tpartialClear();\n\tvar result = $(\"<h2>\");\n\tvar correct = $(\"<p>\");\n\tvar wrong = $(\"<p>\");\n\tvar unanswered = $(\"<p>\");\n\tif (numCorrect === 10) {\n\t\taudioEn.play();\n\t\tresult.text(\"10 out of 10! A perfect score!\")\n\t\t$(\"#questDiv\").append(result); \n\t\tvar missy = $('<img id=\"answerImg\" src=\"assets/images/missy.gif\">');\n\t\t$(\"#questDiv\").append(missy);\n\t\tcorrect.text(\"You might know *too much* about the Daleks. I'd watch my back if I were you.\");\n\t\t$(\"#questDiv\").append(correct);\n\t}\n\telse {\n\t\taudioDes.play();\n\t\tresult.text(\"Did you get everything correct?\");\n\t\t$(\"#questDiv\").append(result);\n\t\tvar nopelek = $('<img id=\"answerImg\" src=\"assets/images/nopelek.gif\">');\n\t\t$(\"#questDiv\").append(nopelek);\n\t\tcorrect.text(\"Correct Answers: \" + numCorrect);\n\t\t$(\"#questDiv\").append(correct);\n\t\twrong.text(\"Wrong Answers: \" + numWrong);\n\t\t$(\"#questDiv\").append(wrong);\n\t\tunanswered.text(\"Unanswered: \" + numTimedout);\n\t\t$(\"#questDiv\").append(unanswered);\n\t\t\n\t}\n\tvar startButton = $(\"<button>\");\n\tstartButton.addClass(\"start button-special\");\n\tstartButton.text(\"Start New Game\");\n\t$(\"#buttonDiv\").append(startButton);\n}", "function endGame() {\n dingSFX.play();\n speak(lineEndGame);\n boxWrite(boxTextEndGame);\n gameState = 20;\n}", "finish() {\n document.querySelector(\".game-page\").style.display = \"none\";\n document.querySelector(\".scores-page\").style.display = \"block\";\n localStorage.setItem(\n \"game\" + Date.now(),\n this.player.name + \",\" + this.player.score\n );\n this.reset();\n mylib.createHighscoresTable();\n }", "function endGame() {\n $('#instructions').remove();\n $('#story').remove();\n $('#question').remove();\n $('#narrator').show();\n $('#narrator').css({'color':'white'});\n $('#narrator').text('You are missing something');\n $('#narrator').fadeOut(3000);\n $('body').css({'background-image':'url(\"assets/images/clown.jpg\")'});;\n}", "function bringBackContent() {\n bringBack2.hidden = true;\n bringBack.hidden = false;\n livesFinished.hidden = false;\n bringBack.addEventListener(\"click\", function(){\n window.location.reload(false)\n });\n}" ]
[ "0.7501099", "0.7182471", "0.71448046", "0.71136594", "0.71136594", "0.67926484", "0.6751904", "0.660751", "0.6588003", "0.65868604", "0.6547606", "0.6524403", "0.6503534", "0.64659953", "0.64595336", "0.6429853", "0.6414972", "0.6357407", "0.6339703", "0.6338195", "0.6336011", "0.63147616", "0.6300167", "0.6288281", "0.6281238", "0.62734276", "0.6260925", "0.6239826", "0.6236789", "0.62114984", "0.620852", "0.62039125", "0.6185326", "0.61685234", "0.6152771", "0.6152622", "0.6148333", "0.61476", "0.6144386", "0.6143196", "0.61415", "0.6127764", "0.61244404", "0.61225957", "0.61058754", "0.61022353", "0.6096331", "0.60945034", "0.6094089", "0.6092853", "0.6085777", "0.6070399", "0.6063811", "0.606311", "0.6062806", "0.60486394", "0.6044759", "0.6043587", "0.6042978", "0.60421675", "0.6036883", "0.6035671", "0.603387", "0.6027592", "0.6027461", "0.6026074", "0.60107267", "0.60089225", "0.60082406", "0.600003", "0.599934", "0.59991914", "0.5997861", "0.5995463", "0.5984811", "0.59745634", "0.5972155", "0.59714115", "0.5970824", "0.59685576", "0.5966424", "0.5962517", "0.5960628", "0.5958428", "0.59571683", "0.59509695", "0.5949362", "0.5945516", "0.59449476", "0.59434026", "0.5941286", "0.59346455", "0.5934424", "0.59341395", "0.59288883", "0.5928733", "0.592657", "0.5924887", "0.5923649", "0.5922707", "0.59169" ]
0.0
-1
Change the BG of body
function bodyBG(image) { let bg = "linear-gradient(45deg,rgba(0, 0, 0, 0.6) 65%, rgba(250, 250, 250, 0.34))"; if (window.innerWidth < 800) { document.body.style.backgroundImage = bg + ",url('img/sm/" + image + "')"; } else { document.body.style.backgroundImage = bg + ",url('img/" + image + "')"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function changeBodyBg(color){\r\n document.body.style.background = color;\r\n }", "function setBackground (bg) {\n\tif (bg.img.length > 0) {\n\t\tbgImgObj.onload = function(){\n\t\t\tdocument.body.style.backgroundImage =\"url('\" + bg.img + \"')\";\n\t };\n\n\t\tbgImgObj.src = bg.img;\n\n\t document.body.style.backgroundRepeat =\"no-repeat\";\n\t document.body.style.backgroundAttachment =\"fixed\";\n\t}\n\n\t// Change body background\n\tif(bg.color.length > 0){\n\t\tdocument.body.style.backgroundColor = bg.color;\n\t}\n\n\tsetDoneBG(bg);\n}", "function setBG () {\n document.body.style.backgroundImage = \"url('venice.jpg')\"\n document.body.setAttribute('class','questionBG');\n}", "function changeBackGroundColor() {\n \n \n document.body.style.backgroundColor =\n \"#2c7e87\";\n document.body.setAttribute('class', 'note'); \n \n }", "function changeBg() {\r\n\t\r\n\tdocument.body.style.backgroundColor='lightgrey';\r\n\t\r\n}", "function changeBG(){\n document.body.style.backgroundColor = \"red\";\n}", "function setBackgroundToBody() {\n \n body.style.backgroundImage = slides[activeSlide].style.backgroundImage;\n}", "function changebackground(){\n\tdocument.body.style.backgroundColor = 'green';\n}", "function aliceBG () {\n\n aliceBGInterval = setInterval( function() {\n\n $(\"body\").animate({\n backgroundColor: '#333',\n }, 1250);\n\n setTimeout( function() {\n $(\"body\").animate({\n backgroundColor: '#665F5C',\n }, 750);\n }, 2250);\n\n }, 3000);\n }", "function changeBackground() {\r\n\r\n // Generate random colors..\r\n const colorIndex = Math.floor((Math.random() * colors.length))\r\n body.style.backgroundColor = colors[colorIndex]\r\n}", "function backgroundChange () {\n\tvar red = Math.floor(Math.random() * 255);\n\tvar green = Math.floor(Math.random() * 255);\n\tvar blue = Math.floor(Math.random() * 255);\n\n\tdocument.body.style.backgroundColor = 'rgb(' + red + ',' + green + ',' + blue + ')';\n}", "function changeBackground(){\n document.getElementsByTagName('body')[0].style.background = color[Math.floor(Math.random() * color.length)];\n}", "function changeBackground () {\n document.body.style.backgroundColor = `rgb( ${getRandomColour()} )`;\n}", "function changeBackground(){\n const colourIndex= parseInt(Math.random()*colours.length)\n body.style.backgroundColor = colours[colourIndex];\n}", "function setBackgroundColor() {\n document.body.style.backgroundColor = bg_color;\n}", "function plainBackground(){\n document.body.style.backgroundColor = \"#ffffff\";\n}", "function SetBackgroundandGretting ()\n{\n let body = document.getElementById('body');\n let _gethour = new Date().getHours();\n\n if(_gethour < 12 )\n {\n greeting.innerHTML= \"Good Morning\";\n body.style.background = \"#dfdfdf url('../img/goodmorning.png') no-repeat center center\";\n body.style.backgroundSize= \"cover\";\n body.style.color = \"white\";\n }\n else if( _gethour < 18)\n {\n greeting.innerHTML= \"Good Afternoon\";\n body.style.background = \"#dfdfdf url('../img/goodafternoon.png') no-repeat center center\";\n body.style.backgroundSize= \"cover\";\n }\n else\n {\n greeting.innerHTML= \"Good Evening\";\n body.style.background = \"#dfdfdf url('../img/goodevening.png') no-repeat center center\";\n body.style.backgroundSize= \"cover\";\n body.style.color = \"white\";\n }\n}", "function setPageBackground() {\n TweenMax.set(page, {backgroundColor: '#000'});\n TweenMax.set(pageContent, {opacity: '1'});\n TweenLite.to(revealContainer, 1, {opacity:'0', ease: Power3.easeOut, onComplete: removeFromDom});\n }", "function changeBGAct4 (){\n removeClasses();\n body.classList.add(\"act4\");\n}", "function changeColor() {\n body = document.body;\n body.style.backgroundColor = randomRgbVal();\n}", "function colorBg(colorBg) {\n noteDiv.style.background = colorBg;\n }", "function bgcolor(fn){\n\t// body.style.background = \"rgb(\"+r+\",\"+g+\",\"+b+\")\"; //Single color\n\tbody.style.background=fn();\n\tif(r===225 && g<225){\n\t\tif(b!=0)b--;\n\t\telse g++;\n\t}else if(g===225 && b<225)\t{\n\t\tif(r!=0)r--;\n\t\telse b++;\n\t}else if(b===225 && r<225){\n\t\tif(g!=0)g--;\n\t\telse r++;\n\t}\n\t\t\n}", "function setWhite() {\r\n document.body.style.background = \"white\";\r\n}", "function updateBackground(){\n gameWorld.ctx.fillStyle = \"rgb(0,0,0)\";\n gameWorld.ctx.fillRect(0, 0, gameWorld.canvas.width, gameWorld.canvas.height);\n}", "function changeBGAct5 (){\n removeClasses();\n body.classList.add(\"act5\");\n}", "function changeBackground() {\n let b = document.body // documnet.body // because there is only one body\n //let randomIndex = Math.floor(Math.random() * colors.length) \n // let randomColor = colors[randomIndex]\n if (isGreen) {\n b.style.backgroundColor = 'red'\n //b.style.backgroundColor = randomColor\n } else {\n b.style.backgroundColor = '#00FF00'\n }\n isGreen = !isGreen\n}", "function changeBg(color) {\n block.style.backgroundColor = color;\n block.style.backgroundImage = null;\n}", "function randomBg(){\n\t\tsetInterval(function(){\n\t\t\tvar rand = Math.round(100 + Math.random() * (999 - 100));\n\t\t\tvar hex = rand.toString(16);\n\t\t\t$(\"body\").css(\"background-color\", \"#\" + hex);\n\t\t}, 5000);\n\t}", "drawBg() {\n let g = this,\n cxt = g.context,\n sunnum = window._main.sunnum,\n cards = window._main.cards,\n img = imageFromPath(allImg.bg);\n cxt.drawImage(img, 0, 0);\n sunnum.draw(cxt);\n }", "function changePageBg() {\n console.log('changePagebg')\n let url = clock.userPageBg.imageUrl;\n if (!clock.userPageBg.showUserImage) url = '';\n if (clock.userPageBg.random) url = 'https://source.unsplash.com/1600x900/?nature,sky,galaxy';\n\n // if no url show only bg color\n if (!url) {\n body.style.background = `#${clock.userPageBg.color} url('${url}')`;\n return;\n }\n // if url - load image and show \n let img = new Image();\n img.onload = function () {\n body.style.background = `#${clock.userPageBg.color} url('${url}')`;\n body.style.backgroundPosition = \"center\";\n body.style.backgroundOrigin = \"center\";\n body.style.backgroundRepeat = \"no-repeat\";\n body.style.backgroundSize = \"cover\";\n img = null;\n };\n\n img.src = url;\n}", "setBackground(background) {\n this.background = background\n }", "function viewport_bg(e){\n\tsettings.colors.bg=e.srcElement.value;\n\tvp.bg=settings.colors.bg;\n\tvp.clear();\n}", "function setWOBgImg (){\n\t\t\t$(\"#colorbgrnd\").css({display: 'block'});\n\t\t\t//canvas.add(bgRect).sendToBack(bgRect);\t\n\t\t\tcanvas.setBackgroundImage(null);\n\t\t\t//console.log('clear bg image! bg fill = '+newRectBg.fill);\t\n\t\t\tcanvas.renderAll();\n\t\n\t\t}", "function drawAnimation(){\n //Turn backgroud black\n document.body.style.backgroundColor = \"black\";\n}", "function transitionToStarryBackground() {\n\t\t$('.container').removeClass('valign-wrapper');\n\t\tlet imageUrl = 'assets/img/stars.jpg';\n\t\t$('body').css('background', 'url(' + imageUrl + ')');\n\t\t$('body').css('background-size', 'cover');\n\t\t$('body').css('background-position', 'bottom');\n\t\t$('body').css('height', '100vh');\n\t\t$('#intro').remove();\n\t}", "function render() {\n // useful variables\n var canvasWidth = app.canvas.width;\n var canvasHeight = app.canvas.height;\n var groundY = ground.y;\n\n background.removeAllChildren();\n\n // TODO: 3 - YOUR DRAW CODE GOES HERE\n\n // this fills the background with a obnoxious yellow\n // you should modify this to suit your game\n\n document.body.style.backgroundImage = \"url('img/BackTest2.gif')\";\n document.body.style.backgroundSize = \"1720px 820px\";\n document.body.style.backgroundRepeat = \"no-repeat\";\n\n\n }", "function changeBGAct1 (){\n removeClasses();\n body.classList.add(\"act1\");\n}", "function drawBackground() {\n let randomNumber = Math.floor(Math.random() * 3);\n if (randomNumber == 2) {\n bgColor = \"whitesmoke\";\n }\n else {\n bgColor = \"black\";\n }\n crc2.fillStyle = bgColor;\n crc2.fillRect(0, 0, crc2.canvas.width, crc2.canvas.height);\n }", "setupBackground() {\n this.bgRect = new paper.Path.Rectangle(new paper.Point(), view.size);\n this.bgRect.fillColor = this.backgroundColor;\n this.bgRect.sendToBack();\n }", "function randomBackGroundColor () {\n {\n var x = Math.floor(Math.random() * 256);\n var y = Math.floor(Math.random() * 256);\n var z = Math.floor(Math.random() * 256);\n var bgColor = \"rgb(\" + x + \",\" + y + \",\" + z + \")\";\n\n document.body.style.background = bgColor;\n }\n\n\n}", "function newColorBg(){\n var r=Math.floor(Math.random()*256);\n var g=Math.floor(Math.random()*256);\n var b=Math.floor(Math.random()*256);\n\n rrggbb= `rgb(` + r + `,` + g + `,` + b + `)`;\n\n document.body.style.background = rrggbb;\n\n\n}", "function setBodyBackgroundFormatting() {\n document.body.style.backgroundColor=\"#E1D6A9\";\n document.body.style.margin=\"0px 0px 0px 0px\";\n}", "function changeBGAct2 (){\n removeClasses();\n body.classList.add(\"act2\");\n}", "function setRed() {\r\n document.body.style.background = \"Red\";\r\n}", "redrawBg() {\n this.clearBg();\n this.drawBg();\n }", "function randomBackgroundColor() {\n document.body.style.backgroundColor = randomRGB();\n} //set body background to random rgb value", "function Background() {\n\tctx.beginPath();\n\tctx.rect(0, 0, 1140, 600);\n\tctx.fillStyle = \"black\";\n\tctx.fill();\n}", "function AdjustBG(){\n if ($body.width() > 1600) {\n $body.css('background-size','100%');\n } else {\n $body.css('background-size','');\n }\n }", "generateBg() {\n this.addChild(BgContainer.generateRect());\n }", "function changeBackground() {\n let colorArray = [\"#ffadad\", \"#ffd6a5\", \"#fdffb6\", \"#caffbf\", \"#9bf6ff\",\n \"#a0c4ff\", \"#bdb2ff\", \"#ffc6ff\", \"#fffffc\"\n ];\n let randColor = Math.floor(Math.random() * colorArray.length);\n $('body').css(\"background-color\", colorArray[randColor]);\n}", "function drawBG()\n{\n ctx.beginPath();\n ctx.rect(0, 0, DEFAULT_CANVAS_SIZE, DEFAULT_CANVAS_SIZE);\n ctx.fillStyle = '#333'; // Gray\n ctx.fill();\n}", "function changeBodyBackground(currentPath, callback) {\n\tvar imageUrl;\n\t\n\t// select image filename based on path\n\tif (currentPath === '/') {\n\t\timageUrl = 'red_gig';\n\t} else if (currentPath === '/register') {\n\t\timageUrl = 'town';\n\t} else if (currentPath === '/login') {\n\t\timageUrl = 'lights';\n\t} else {\n\t\timageUrl = '/stardust.png';\n\t}\n\t\n\t// complete image filename based on window size \n\tif (/venues/.test(currentPath) === false) {\n\t\tvar innerWidth = window.innerWidth;\n\t\tif (innerWidth > 1199) {\n\t\t\timageUrl = imageUrl + '.jpg';\n\t\t} else if (innerWidth < 1200 && innerWidth > 991) {\n\t\t\timageUrl = imageUrl + '_md.jpg';\n\t\t} else if (innerWidth < 992 && innerWidth > 767) {\n\t\t\timageUrl = imageUrl + '_sm.jpg';\n\t\t} else if (innerWidth < 768) {\n\t\t\timageUrl = imageUrl + '_xs.jpg';\n\t\t}\n\t}\n\t\n\timageUrl = 'url(' + imageUrl + ')';\n\treturn callback(imageUrl);\t\t\n}", "function setbg(bg, context) {\n var hRatio = canvas.width / bg.width ;\n var vRatio = canvas.height / bg.height ;\n var ratio = Math.min ( hRatio, vRatio );\n context.clearRect(0,0,canvas.width, canvas.height);\n context.drawImage(bg, 0,0, bg.width, bg.height, 0, 0, \n bg.width*ratio, bg.height*ratio); \n canvasState.save();\n}", "function setBg(hour) {\n document.body.style.backgroundImage = `url(${bgArray[hour]})`;\n}", "function changeBackgroundColor(){\n document.body.style.backgroundColor = getRandomItem(colors);\n}", "function changeBGAct3 (){\n removeClasses();\n body.classList.add(\"act3\");\n}", "function changeBackgroundColor() {\n document.querySelector('body').style = `background-color: rgb(${getRandomNumber(256)}, ${getRandomNumber(256)}, ${getRandomNumber(256)})`;\n}", "_drawBackground() {\n const { x, y, width, height } = this.config;\n this._background = this.scene.add.rectangle( x, y, width, height,\n this.config.backgroundColor );\n this._background.setOrigin( 0, 0 );\n }", "function createBackground(){\n\t\tvar bg = createSquare(stageWidth, stageHeight, 0, 0, null, Graphics.getRGB(0,0,0,0));\n\t\tstage.addChild( bg );\n\t\tupdate = true;\n\t}", "function drawBackGround() {\n\t//for (let i = 0; i < 14; i++) {\n\t//\tfor (let j = 0; j < 10; j++) {\n\t//\t\tcontext.drawImage(bg, 64*i, 64*j);\n\t//\t}\n\t//}\n\tcontext.drawImage(bg, 0, 0,800,600);\n\n}", "function set_background (r, g, b) {\r\n red = r;\r\n green = g;\r\n blue = b;\r\n}", "function changeBackground(theme)\n {\n document.body.className = theme ;\n }", "function makeGreen() {\n document.body.style.backgroundColor = \"green\";\n}", "function bgChanger(){\n if(this.scrollY > this.innerHeight / 2){\n document.body.classList.add('bg-active');\n }else {\n document.body.classList.remove('bg-active');\n }\n}", "function scene(param)\n{\n novel_changeBackground(param, true);\n}", "function changeBg() {\n if (counter === bgArray.length) counter = 0;\n\n const index = counter % bgArray.length;\n const img = document.createElement('img');\n img.src = bgArray[index];\n img.onload = () => {\n document.body.style.backgroundImage = `url(${img.src})`;\n };\n counter++;\n}", "function setBg() {\r\n let today = new Date(),\r\n hour = today.getHours();\r\n if (hour < 12) {\r\n // Morning\r\n document.body.style.backgroundImage = \"url('https://i.ibb.co/7vDLJFb/morning.jpg')\";\r\n document.body.style.backgroundSize = \"cover\";\r\n } else if (hour < 18) {\r\n // Afternoon\r\n document.body.style.backgroundImage = \"url('https://i.ibb.co/3mThcXc/afternoon.jpg')\";\r\n document.body.style.backgroundSize = \"cover\";\r\n } else {\r\n // Evening\r\n document.body.style.backgroundImage = \"url('https://i.ibb.co/924T2Wv/night.jpg')\";\r\n document.body.style.backgroundSize = \"cover\";\r\n document.querySelector('.clock').style.backgroundColor = \"rgba(219, 219, 219, 0.7)\";\r\n }\r\n}", "function drawImage() {\n document.body.style.backgroundImage = `url(${ store.State.image.large_url})`\n document.body.classList.add('bg-image')\n}", "function loserAnimation(){\n //Turn background red\n document.body.style.backgroundColor = \"red\";\n}", "function randomBodyColor() {\n const r = Math.floor(Math.random() * 256);\n const g = Math.floor(Math.random() * 256);\n const b = Math.floor(Math.random() * 256);\n const bgColor = `rgb(${r},${g},${b})`;\n\n document.body.style.backgroundColor = bgColor;\n}", "function changeBackgroundColor() {\n function colorNum() {\n return Math.ceil(Math.random() * 255);\n }\n let color = \"rgb(\" + colorNum() + \",\" + colorNum() + \",\" + colorNum() + \")\";\n document.body.style.background = color;\n}", "function changeBackgroundColor(){\n var red = Math.floor(Math.random() * 256 );\n var green = Math.floor(Math.random() * 256 );\n var blue = Math.floor(Math.random() * 256 );\n var rgbColor = 'rgb(' + red + ',' + green + ',' + blue + ')';\n document.body.style.background = rgbColor; \n}", "function changeBackgroundColor(){\n let background_hex = new THREE.Color(menu.background).getHexString();\n if ( isHex(background_hex) && scene.background != \"#\" + background_hex ){\n scene.background = new THREE.Color(\"#\"+background_hex); }\n // backgroundScene = menu.background;\n // scene.background.color.setHex(backgroundScene);\n }", "function changeBackgroundColor(){\n //rgb values from 0 to 255\n var r = getRandomNumber(255);\n var g = getRandomNumber(255);\n var b = getRandomNumber(255);\n var rgb = \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\n document.body.style.backgroundColor = rgb;\n}", "function _drawBackgroundImage() {\n console.log(\"_drawBackgroundImage\");\n let template = \"\";\n let backgroundImage = store.State.backgroundImage;\n console.log(\"backgroundImage for _drawBackgroundImage\", backgroundImage);\n template = `<div style=\"background-image: url('${backgroundImage}');\" class=\"fixed-top\" id=\"background-image-css\">`;\n document.querySelector(\"#bg-image\").innerHTML = template;\n}", "function bg() {\n // // Loading particles (stars)\n particlesJS.load('particles-js', 'js/libraries/particles.json', function() {\n // Callback to let us know if particle.js successfully loaded\n console.log('callback - particles.js config loaded');\n });\n\n // Creating the fog\n VANTA.FOG({\n el: \"#fog\", // apply it to the body (so the entire canvas)\n highlightColor: 0xe2a, // navy blue\n midtoneColor: 0x311a, // dark green\n lowlightColor: 0x6978aa, // navy blue\n baseColor: 0x0, // black\n blurFactor: 0.6,\n speed: 4,\n zoom: 0.5\n });\n}", "function background(param)\n{\n novel_changeBackground(param, false);\n}", "function changeBackGroundColor() {\n let randomColor = () => Math.floor(Math.random() * 255);\n let newColor = `rgb(${randomColor()}, ${randomColor()}, ${randomColor()})`;\n return document.body.style.backgroundColor = newColor;\n}", "function bgChanger() {\n var colorArr = ['red', 'blue', 'yellow', 'gold', 'pink']\n var colorIndex = Math.floor(Math.random() * 6)\n var $body = $('body')\n\n var hue = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';\n\n $body.css('backgroundColor', hue)\n $body.css('transition', 'all, 0.5s ease-out')\n\n}", "launchModal() {\n document.body.style.background = \"linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7) ), url('./bgs/waterfall.jpg')\";\n document.body.style.backgroundSize = 'cover';\n }", "function setBgGreet() {\n let today = new Date(),\n hour = today.getHours();\n\n if (hour < 12) {\n //morning\n document.body.style.backgroundImage = \"url(./images/morning.jpg)\";\n document.body.style.backgroundSize = \"1366px 768px\";\n document.body.style.color = \"#f4f4f4\";\n } else if (hour < 17) {\n //afternoon\n document.body.style.backgroundImage = \"url(./images/afternoon.jpg)\";\n document.body.style.backgroundSize = \"1366px 768px\";\n temperature.style.color = \"#000\";\n document.body.style.color = \"#f4f4f4\";\n } else {\n //evening\n document.body.style.backgroundImage = \"url(./images/evening.jpg)\";\n document.body.style.backgroundSize = \"1366px 768px\";\n thought.style.color = \"#f4f4f4\";\n temperature.style.color = \"#f4f4f4\";\n }\n}", "function createBackground(ctx){\n ctx.clearRect(0, 30, 400, 600);\n ctx.fillStyle = bgColour;\n ctx.fillRect(0, 30, 400, 600);\n}", "function bg_change(next) {\n document.body.className = '';\n document.body.classList.add('is-' + next);\n}", "function bg_change(next) {\n document.body.className = '';\n document.body.classList.add('is-' + next);\n}", "function createBackground() {\n\t\t\tbg = new createjs.Shape();\t\t\n\t\t\tstage.addChild(bg);\n \t}", "function checkBg(){\n if (changeBg){\n bgX =bgX - 150/36;\n bgY = bgY - 75/36;\n if(millis()>enterTime + 4000 && welcomeBgm.isPlaying()){\n menuBgm.loop();\n welcomeBgm.stop();\n }\n\n if(millis()>enterTime + 6000){\n \n changeBg =false;\n }\n }\n\n \n}", "function setBgGreet() {\n let today = new Date(),\n hour = today.getHours();\n\n if (hour > 5 && hour < 12) {\n //Morning\n getImage();\n greeting.textContent = 'Good Morning';\n } else if (hour >= 12 && hour < 18) {\n //Afternoon\n getImage();\n greeting.textContent = 'Good Afternoon';\n } else if (hour>= 18 && hour < 24) {\n //Evening\n document.body.style.backgroundImage = \"url('https://github.com/Antongron/Momentum/blob/gh-pages/img/evening.jpg?raw=true')\";\n greeting.textContent = 'Good Evening';\n } else {\n //Night\n document.body.style.backgroundImage = \"url('https://github.com/Antongron/Momentum/blob/gh-pages/img/afternoon.jpg?raw=true')\";\n greeting.textContent = 'Good Night';\n document.body.style.color = 'white';\n }\n }", "function updateBG() {\n\tvar d = new Date();\n\tvar n = d.getHours();\n\tif (n >= 21 || n <= 4){\n\t\tmessage = \"Goodnight\";\n\t\tbg.style.background = \"url('https://source.unsplash.com/featured/?night,space,northernlights') no-repeat center center fixed\";\n\t\tbg.style.backgroundSize = \"cover\";\n\t} else if ( n >= 5 && n <= 11 ) {\n\t\tmessage = \"Good Morning\";\n\t\tbg.style.background = \"url('https://source.unsplash.com/featured/?sunrise,morning') no-repeat center center fixed\";\n\t\tbg.style.backgroundSize = \"cover\";\n\t} else if ( n >= 12 && n <= 16 ) {\n\t\tmessage = \"Good Afternoon\";\n\t\tbg.style.background = \"url('https://source.unsplash.com/featured/?sky,city,architecture') no-repeat center center fixed\";\n\t\tbg.style.backgroundSize = \"cover\";\n\t} else if ( n >= 17 && n <= 20 ) {\n\t\tmessage = \"Good Evening\";\n\t\tbg.style.background = \"url('https://source.unsplash.com/featured/?sunset') no-repeat center center fixed\";\n\t\tbg.style.backgroundSize = \"cover\";\n\t}\n}", "function backgroundColor() {\n if($(\"body\").css(\"backgroundColor\") === \"rgb(128, 0, 128)\") {\n \n $(\"body\").css(\"backgroundColor\", \"green\")\n\n } else {\n\n $(\"body\").css(\"backgroundColor\", \"purple\");\n\n };\n // if () {\n // } else {\n // // change to a different color\n // }\n\n var background = setTimeout(backgroundColor, 300000);\n\n }", "function pinkerton() {\n $('body').css('background', 'pink');\n $('header').css('background', 'pink');\n }", "function use_plyr_bg_color() {\n ctx.strokeStyle = BLACK;\n ctx.fillStyle = BLACK;\n if (sessionStorage.getItem(\"page\") === BLACK) {\n ctx.strokeStyle = WHITE;\n ctx.fillStyle = WHITE;\n }\n }", "function customBg(url) {\n document.body.style.background =\n \"linear-gradient(#00000050, #00000050),url(\" + url + \")\";\n document.body.style.backgroundColor = \"#000000\";\n // document.body.style.backgroundImage = \"url(\" + url + \")\";\n document.body.style.backgroundRepeat = \"no-repeat\";\n document.body.style.backgroundSize = \"cover\";\n }", "function bgChanger() {\n if(this.scrollY > this.innerHeight / 2)\n{\n\tdocument.body.classList.add(\"bg-active\");\n}\n\nelse {\n\n\tdocument.body.classList.remove(\"bg-active\");\n}\n\n}", "function bg() {\n document.querySelector('main').style.background = 'green';\n \n}", "function Background() {\n _super.call(this, \"BG_Game\");\n this._repeat(0);\n this.name = \"background\";\n // If _speed.x = -1, loops once.\n // move slower, so image doesn't \"loop\" before the chimney/end shows update\n this._speed.x = -0.65;\n }", "function renderBackground(group, bg, useUpperLabel) {\n\t var ecData = getECData(bg); // For tooltip.\n\t\n\t ecData.dataIndex = thisNode.dataIndex;\n\t ecData.seriesIndex = seriesModel.seriesIndex;\n\t bg.setShape({\n\t x: 0,\n\t y: 0,\n\t width: thisWidth,\n\t height: thisHeight,\n\t r: borderRadius\n\t });\n\t\n\t if (thisInvisible) {\n\t // If invisible, do not set visual, otherwise the element will\n\t // change immediately before animation. We think it is OK to\n\t // remain its origin color when moving out of the view window.\n\t processInvisible(bg);\n\t } else {\n\t bg.invisible = false;\n\t var style = thisNode.getVisual('style');\n\t var visualBorderColor = style.stroke;\n\t var normalStyle = getItemStyleNormal(itemStyleNormalModel);\n\t normalStyle.fill = visualBorderColor;\n\t var emphasisStyle = getStateItemStyle(itemStyleEmphasisModel);\n\t emphasisStyle.fill = itemStyleEmphasisModel.get('borderColor');\n\t var blurStyle = getStateItemStyle(itemStyleBlurModel);\n\t blurStyle.fill = itemStyleBlurModel.get('borderColor');\n\t var selectStyle = getStateItemStyle(itemStyleSelectModel);\n\t selectStyle.fill = itemStyleSelectModel.get('borderColor');\n\t\n\t if (useUpperLabel) {\n\t var upperLabelWidth = thisWidth - 2 * borderWidth;\n\t prepareText(bg, visualBorderColor, upperLabelWidth, upperHeight, style.opacity, {\n\t x: borderWidth,\n\t y: 0,\n\t width: upperLabelWidth,\n\t height: upperHeight\n\t });\n\t } // For old bg.\n\t else {\n\t bg.removeTextContent();\n\t }\n\t\n\t bg.setStyle(normalStyle);\n\t bg.ensureState('emphasis').style = emphasisStyle;\n\t bg.ensureState('blur').style = blurStyle;\n\t bg.ensureState('select').style = selectStyle;\n\t setDefaultStateProxy(bg);\n\t }\n\t\n\t group.add(bg);\n\t }", "function bg_change(next) {\n document.body.className = '';\n document.body.classList.add('is-' + next);\n}", "drawbackground(){\n CTX.fillStyle = \"#41f459\";\n CTX.fillRect(this.x,this.y, this.width, this.height);\n\n\n }", "function makeRed() {\n document.body.style.backgroundColor = 'red';\n}", "function randBGColor(){\n var randomColor = \"#\"+((1<<24)*Math.random()|0).toString(16); \n document.body.style.setProperty('--main-bg-color', randomColor)\n}", "function animateBackground() {\n\t\tbgStateOn = !bgStateOn;\n\t\tswitch (bgStateOn) {\n\t\tcase true:\n\t\t\t$.alertT10.backgroundImage = \"/images/blueiPadBg.png\";\n\t\t\tbreak;\n\n\t\tcase false:\n\t\t\t$.alertT10.backgroundImage = \"/images/rediPadBg.png\";\n\t\t\tbreak\n\t\t}\n\t}" ]
[ "0.76715577", "0.73678327", "0.73218066", "0.7317351", "0.7225835", "0.71228945", "0.70734984", "0.6943245", "0.691535", "0.6907454", "0.6903787", "0.69023407", "0.68907183", "0.68554646", "0.6825707", "0.6818228", "0.6811231", "0.67675275", "0.6664751", "0.6652312", "0.664699", "0.6631957", "0.6622898", "0.6622021", "0.6619964", "0.66037625", "0.66016966", "0.65757674", "0.657043", "0.6560041", "0.65478706", "0.6544558", "0.65379924", "0.65335155", "0.65220153", "0.6514813", "0.6508066", "0.6506078", "0.65033925", "0.64910614", "0.6487638", "0.6484299", "0.64836305", "0.64525294", "0.6447273", "0.6446277", "0.6434091", "0.643234", "0.64187753", "0.6414738", "0.64103055", "0.6410251", "0.64084816", "0.6400178", "0.63985354", "0.6394089", "0.6391158", "0.63709694", "0.63691264", "0.6366623", "0.63618267", "0.635539", "0.6354167", "0.6353398", "0.6337464", "0.63312644", "0.6330444", "0.6329549", "0.6323087", "0.6319374", "0.6280066", "0.62788945", "0.6263197", "0.6260998", "0.62548727", "0.62469727", "0.6243078", "0.6237918", "0.62375045", "0.6237308", "0.6235474", "0.62242216", "0.62241465", "0.62241465", "0.6217875", "0.621582", "0.6204246", "0.62019724", "0.6201942", "0.62006676", "0.61974573", "0.6196549", "0.6192355", "0.6186934", "0.61861795", "0.6184864", "0.6183966", "0.6182265", "0.61760604", "0.6164309", "0.6158339" ]
0.0
-1
Drag element when mouse down on it
function drag (el) { el.addEventListener('mousedown', () => { el.style.cursor = grab window.addEventListener('mousemove', dragBox(el)) el.style.zIndex = index + 1 console.log(window.getComputedStyle(el).zIndex) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseDownEvent(eb){\r\n dragging = eb\r\n}", "onMouseDrag(e) {}", "mouseDrag(prev, pt) {}", "mouseDrag(prev, pt) {}", "function onMouseDown(event)\n{\n dragging = true;\n var pos = getRelative(event);\n mouseDragStartX = pos.x;\n mouseDragStartY = pos.y;\n}", "startDrag(x, y) {}", "function OnMouseDown(){\n\tbeingDragged = true;\n}", "function pointerDown(event) {\n dragging = true;\n pointerMove(event);\n \n }", "drag(ev) {\n // console.log('drag')\n }", "mouseDown(pt) {}", "mouseDown(pt) {}", "mouseDownUp(start, end) {}", "onDrag(mousePosition) {\n }", "function mousedown(e){\n e.preventDefault();\n state.dragging = {};\n state.dragging.start = {\n x: e.pageX,\n y: e.pageY\n }\n state.dragging.original_x = state.center.x;\n state.dragging.original_y = state.center.y;\n $(document).bind(\"mousemove\", mousemove);\n $(document).bind(\"mouseup\", mouseup);\n }", "function drag(e){\ndraggedItem=e.target;\ndragging=true;\n}", "drag(x, y) {\n this.doDrag(x, y);\n }", "function dragElement( event ) {\r\n xPosition = document.all ? window.event.clientX : event.pageX;\r\n yPosition = document.all ? window.event.clientY : event.pageY;\r\n if ( selected !== null ) {\r\n selected.style.left = ((xPosition - xElement) + selected.offsetWidth / 2) + 'px';\r\n selected.style.top = ((yPosition - yElement) + selected.offsetHeight / 2) + 'px';\r\n }\r\n }", "function handleDragStart(){\n this.isMouseDown = true\n}", "mouseUp(pt) {}", "mouseUp(pt) {}", "function elementDrag(e) {\n e = e || window.event;\n // Calculate the new cursor position:\n pos1 = pos3 - e.clientX;\n pos2 = pos4 - e.clientY;\n pos3 = e.clientX;\n pos4 = e.clientY;\n // Set the element's new position:\n divCont.style.marginLeft = divCont.offsetLeft - _self._ratio * pos1 + \"px\";\n divCont.style.marginTop = divCont.offsetTop - _self._ratio * pos2 + \"px\";\n }", "function CdkDragEnter() {}", "function CdkDragEnter() {}", "mouseDownUp(start, end) {\n \n }", "startDrag(e) {\n const selectedElement = e.target.parentElement,\n offset = this.getMousePosition(e, selectedElement);\n if ($(selectedElement).hasClass( \"sticker\" )) {\n offset.x -= parseFloat(selectedElement.getAttributeNS(null, \"x\")),\n offset.y -= parseFloat(selectedElement.getAttributeNS(null, \"y\"));\n this.setState({\n selectedElement:selectedElementom ,\n offset: offset\n })\n }\n }", "onMouseDown(e) {\n // start dragging\n this.isMouseDown = true;\n\n // apply specific styles\n this.options.element.classList.add(\"dragged\");\n\n // get our touch/mouse start position\n var mousePosition = this.getMousePosition(e);\n // use our slider direction to determine if we need X or Y value\n this.startPosition = mousePosition[this.direction];\n\n // drag start hook\n this.onDragStarted(mousePosition);\n }", "function dragElement(elmnt){\n var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;\n elmnt.onmousedown = dragMouseDown;\n \n function dragMouseDown(e){\n e = e || window.event;\n e.preventDefault();\n // get the mouse cursor position at startup:\n pos3 = e.clientX;\n pos4 = e.clientY;\n document.onmouseup = closeDragElement;\n // call a function whenever the cursor moves:\n document.onmousemove = elementDrag;\n }\n \n function elementDrag(e) {\n e = e || window.event;\n e.preventDefault();\n // calculate the new cursor position:\n pos1 = pos3 - e.clientX;\n pos2 = pos4 - e.clientY;\n pos3 = e.clientX;\n pos4 = e.clientY;\n // set the element's new position:\n elmnt.style.top = (elmnt.offsetTop - pos2) + \"px\";\n elmnt.style.left = (elmnt.offsetLeft - pos1) + \"px\";\n }\n function closeDragElement() {\n /* stop moving when mouse button is released:*/\n document.onmouseup = null;\n document.onmousemove = null;\n }\n}", "function dragMouseDown(e) {\n e.stopImmediatePropagation();\n divCont.style.zIndex = \"\" + ++currentZIndex;\n\n e = e || window.event;\n // get the mouse cursor position at startup:\n pos3 = e.clientX;\n pos4 = e.clientY;\n divCont.onmouseup = closeDragElement;\n divCont.onpointerup = closeDragElement;\n divCont.onmouseleave = closeDragElement;\n // call a function whenever the cursor moves:\n document.onmousemove = elementDrag;\n }", "function drag(){\n console.log(\"Being dragged around\");\n}", "function drag(e) {\n draggedItem = e.target\n dragging = true\n}", "function dragElement(elmnt) {\n var pos1 = 0; pos2 = 0; pos3 = 0; pos4 = 0;\n document.getElementById(elmnt.id + \"Mover\").onmousedown = dragMouseDown;\n function dragMouseDown(e) {\n e = e || window.event;\n // get the mouse cursor position at startup:\n pos3 = e.clientX;\n pos4 = e.clientY;\n document.onmouseup = closeDragElement;\n // call a function whenever the cursor moves:\n document.onmousemove = elementDrag;}\n function elementDrag(e) {\n e = e || window.event;\n // calculate the new cursor position:\n pos1 = pos3 - e.clientX;\n pos2 = pos4 - e.clientY;\n pos3 = e.clientX;\n pos4 = e.clientY;\n // set the element's new position:\n elmnt.style.top = (elmnt.offsetTop - pos2) + \"px\";\n elmnt.style.left = (elmnt.offsetLeft - pos1) + \"px\";}\n function closeDragElement() {\n /* stop moving when mouse button is released:*/\n document.onmouseup = null;\n document.onmousemove = null;}}", "function drag(ev) {\n ev.dataTransfer.setData(\"text\", ev.target.id);\n ev.dataTransfer.setDragImage(ev.target, 25,25, 0);\n Array.from(document.getElementsByClassName(\"drop_target\")).forEach(o => {\n o.style.pointerEvents = \"auto\";\n });\n}", "function drag(e) {\n draggedItem = e.target;\n dragging = true;\n}", "function do_drop(e, attachedElement) {\r\n log(\"do drop: \" + e.clientX + \", \" + e.clientY);\r\n letGo(attachedElement);\r\n}", "function drag(e) {\r\n draggedItem = e.target;\r\n dragging = true;\r\n}", "_onMouseUp () {\n Actions.changeDragging(false);\n }", "function mouseDragged(){\r\n inputForMDragging(mouseX, mouseY);\r\n\r\n\r\n}", "function CdkDragMove() {}", "function CdkDragMove() {}", "handleMouseDown(e) {\n this.start = pos(e);\n this.w0 = this.state.w;\n d.addEventListener('mousemove', this.handleDrag)\n d.addEventListener('mouseup', this.handleMouseUp.bind(this))\n }", "mouseDown(e){\n if(e.button == 0){\n e.stopPropagation();\n e.preventDefault();\n\n this.set('moveStart', true);\n\n const self = this;\n this.set('mouseMoveListener', function(e){\n if(self.mouseMove){\n self.mouseMove(e);\n }\n });\n\n this.set('mouseUpListener', function(e){\n if(self.mouseUp){\n self.mouseUp(e);\n }\n });\n\n document.addEventListener('mousemove', this.get('mouseMoveListener'));\n document.addEventListener('mouseup', this.get('mouseUpListener'));\n }\n }", "function onMouseDown(event) { }", "function md(e) {\n e.preventDefault();\n if (e.type === \"touchstart\") {\n dx = e.touches[0].clientX - this.getBoundingClientRect().x;\n dy = e.touches[0].clientY - this.getBoundingClientRect().y;\n } else {\n dx = e.clientX - this.getBoundingClientRect().x;\n dy = e.clientY - this.getBoundingClientRect().y;\n }\n let dpx = this.parentElement.getBoundingClientRect().x;\n let dpy = this.parentElement.getBoundingClientRect().y;\n dx = dpx + dx;\n dy = dpy + dy;\n this.setAttribute(\"dragging\", \"yes\");\n let parent = this.parentElement;\n parent.removeChild(this);\n parent.appendChild(this);\n\n}", "function mousedown() { // pan\n d3.event.preventDefault();\n if (d3.event.which !== 1 || d3.event.ctrlKey) { return; } // ingore other mouse buttons\n startposX = curX - d3.event.clientX;\n startposY = curY - d3.event.clientY;\n el.on('mousemove', mousemove, true);\n el.on('mouseup', mouseup, true);\n }", "dragEnter(ev) {\n this.dragOver(ev);\n }", "function drag(event) {\n draggedItem = event.target;\n dragging = true;\n}", "onElementMouseUp(event) {\n if (this.dragContext) {\n this.endMove();\n event.preventDefault();\n }\n }", "onElementMouseUp(event) {\n if (this.dragContext) {\n this.endMove();\n event.preventDefault();\n }\n }", "function drag(e) {\n // If grab isn't empty, there's currently an object being dragged, do this\n if (grab !== 0) {\n // Let's find the element on the page whose data-drag=\"\" value matches the value of grab right now\n const element = document.querySelector('[data-drag=\"' + grab + '\"]');\n if (!element) {\n return;\n }\n\n // And to that element, let the new value of `top: ;` be equal to the old top position, plus the difference between the original top position and the current cursor position\n element.style.top =\n parseInt(oldTop) +\n parseInt((e.clientY || e.touches[0].clientY) - startY) +\n 'px';\n\n // And let the new value of `left: ;` be equal to the old left position, plus the difference between the original left position and the current cursor position\n element.style.left =\n parseInt(oldLeft) +\n parseInt((e.clientX || e.touches[0].clientX) - startX) +\n 'px';\n\n // That's all we do for dragging elements\n }\n}", "onElementMouseUp(event) {}", "onElementMouseUp(event) {}", "onmousedown(e) {\n\n\n //set state\n this.resizable = true;\n\n\n //disable sortable when resizing\n if (this.vGridConfig.isSortableHeader) {\n this.vGridSortable.option(\"disabled\", this.resizable);\n }\n\n\n //get som vars\n this.screenX = e.screenX;\n this.xElement = e.target;\n this.originalWidth = this.xElement.offsetParent.style.width;\n this.index = this.xElement.offsetParent.getAttribute(\"column-no\");\n\n\n //add mouse move event\n this.vGridGenerator.htmlCache.header.onmousemove = (e) => {\n this.onmousemove(e)\n }\n\n\n }", "function onMouseDrag(event) {\n\tpuzzle.dragTile(event.delta);\n}", "function onMouseUp(event)\n{\n onMouseMove(event); // just reusing the above code\n dragging = false; // adding one line here\n}", "function down(evt){mouseDown(getMousePos(evt));}", "function down(evt){mouseDown(getMousePos(evt));}", "onElementMouseMove(event) {}", "function dragstart(element) {\r\n dragobjekt = element;\r\n dragx = posx - dragobjekt.offsetLeft;\r\n dragy = posy - dragobjekt.offsetTop;\r\n}", "function mouseup() {\n var currentNode,\n elementIndexToAdd, elementIndexToRemove,\n addAfterElement,\n parentScopeData,\n deferred = $q.defer(),\n newCopyOfNode = {},\n promise = deferred.promise;\n\n if (isMoving) {\n // take actions if valid drop happened\n if (target.isDroppable) {\n // Scope where element should be dropped\n target.scope = target.treeview.scope();\n\n // Element where element should be dropped\n target.node = target.scope.treeData || target.scope.subnode;\n\n // Dragged element\n currentNode = scope.treedata;\n\n // Get Parent scope for element\n parentScopeData = scope.$parent.$parent.treedata;\n elementIndexToRemove = parentScopeData.subnodes.indexOf(currentNode);\n\n // Dragged element can be dropped directly to directory (via node label)\n if (target.dropToDir) {\n elementIndexToAdd = target.node.subnodes.length;\n\n // Expand directory if user want to put element to it\n if (!target.node.expanded) {\n target.node.expanded = true;\n }\n } else {\n addAfterElement = target.el.scope().treedata;\n\n // Calculate new Index for dragged node (it's different for dropping node before or after target)\n if (target.addAfterEl) {\n elementIndexToAdd = target.node.subnodes.indexOf(addAfterElement) + 1;\n } else {\n elementIndexToAdd = target.node.subnodes.indexOf(addAfterElement);\n }\n }\n target.elementIndexToAdd = elementIndexToAdd;\n\n // \"Resolve\" promise - rearrange nodes\n promise.then(function (passedObj) {\n var newElementIndex = passedObj.index || 0,\n newId;\n\n if (target.node.subnodes === parentScopeData.subnodes && newElementIndex < elementIndexToRemove) {\n parentScopeData.subnodes.splice(elementIndexToRemove, 1);\n target.node.subnodes.splice(newElementIndex, 0, currentNode);\n } else {\n // Check if node is comming from another treeview\n if (currentNode.getScope().treeid !== target.node.getScope().treeid) {\n // If node was selected and is comming from another tree we need to select parent node in old tree\n if (currentNode.selected) {\n TreeviewManager.selectNode(currentNode.getParent(), currentNode.getScope().treeid);\n currentNode.selected = false;\n }\n\n // Assigning new id for node to avoid duplicates\n // Developer can provide his own id and probably should\n newId = passedObj.newId || TreeviewManager.makeNewNodeId();\n\n if (TreeviewManager.trees[scope.treeid].scope.treeAllowCopy) {\n // makes copy of node\n newCopyOfNode = angular.copy(currentNode);\n newCopyOfNode.id = newId;\n newCopyOfNode.level = ++target.node.level;\n newCopyOfNode.getParent = function () {\n return target.node;\n };\n\n target.node.subnodes.splice(newElementIndex, 0, newCopyOfNode);\n } else {\n // cut node from one tree and put into another\n currentNode.id = newId;\n\n target.node.subnodes.splice(newElementIndex, 0, currentNode);\n parentScopeData.subnodes.splice(elementIndexToRemove, 1);\n\n currentNode.setParent(target.node);\n }\n } else {\n target.node.subnodes.splice(newElementIndex, 0, currentNode);\n parentScopeData.subnodes.splice(elementIndexToRemove, 1);\n }\n }\n });\n\n /* Custom method for DRAG END\n If there is no any custom method for Drag End - resolve promise and finalize dropping action\n */\n if (typeof scope.settings.customMethods !== 'undefined' && angular.isFunction(scope.settings.customMethods.dragEnd)) {\n scope.settings.customMethods.dragEnd(target.isDroppable, TreeviewManager.trees[scope.treeid].element, scope, target, deferred);\n } else {\n deferred.resolve({index: elementIndexToAdd});\n }\n } else {\n if (typeof scope.settings.customMethods !== 'undefined' && angular.isFunction(scope.settings.customMethods.dragEnd)) {\n scope.settings.customMethods.dragEnd(target.isDroppable, TreeviewManager.trees[scope.treeid].element, scope, target, deferred);\n }\n }\n\n // reset positions\n startX = startY = 0;\n\n // remove ghost\n elementCopy.remove();\n elementCopy = null;\n\n // remove drop area indicator\n if (typeof dropIndicator !== 'undefined') {\n dropIndicator.remove();\n }\n\n // Remove styles from old drop to directory indicator (DOM element)\n if (typeof dropToDirEl !== 'undefined') {\n dropToDirEl.removeClass('dropToDir');\n }\n\n // reset droppable\n target.isDroppable = false;\n\n // remove styles for whole treeview\n TreeviewManager.trees[scope.treeid].element.removeClass('dragging');\n\n // reset styles for dragged element\n element\n .removeClass('dragged')\n .removeAttr('style');\n }\n\n // remove events from $document\n $document\n .off('mousemove', mousemove)\n .off('mouseup', mouseup);\n\n firstMove = true;\n }", "function win_drag_start(ftWin){draggingShape = true;}", "function drag(e) {\n if (active) { //check whether the drag is active\n \n //tell the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be (MDN)\n e.preventDefault();\n \n //set the value of currentX and currentY to the result of the current pointer position with an adjustment from initialX and initialY\n if (e.type === \"touchmove\") {\n currentX = e.touches[0].clientX - initialX;\n currentY = e.touches[0].clientY - initialY;\n } else {\n currentX = e.clientX - initialX;\n currentY = e.clientY - initialY;\n }\n\n //set the new Offset\n xOffset = currentX;\n yOffset = currentY;\n\n //set the new position for our dragged element\n setTranslate(currentX, currentY, dragItem);\n }\n }", "mouseDown(x, y, _isLeftButton) {}", "function drop(event) {\n\tvar offset = event.dataTransfer.getData(\"application/x-moz-node\").split(',');\n\n\tvar mv = document.getElementsByClassName('moveable');\n\tmv[offset[2]].style.left = (event.clientX + parseInt(offset[0], 10)) + 'px';\n\tmv[offset[2]].style.top = (event.clientY + parseInt(offset[1], 10)) + 'px';\n\tevent.preventDefault();\n\treturn false;\n}", "handleMouseDown(e) {\n if (this.state.canDrag) {\n this.setState({\n isDragging: true,\n });\n }\n this.setState({\n cursor: 'grabbing'\n });\n }", "function D_D (main_el,par,pos_x,pos_y,def_el,fdfex) {\n//main_el is a trigger, elemet that start drag&drop\n//par is for collision, so element can't go out of parent\n//with pos_x and pos_y you can set position for element\n//with def_el you can move another element\n//*fdfex is a function definition expression. And a function definition expression it is a function is passed as an argument to another function\n\nlet el = main_el;\nel.setAttribute('onselectstart',\"return false\");\n\nel.addEventListener('mousedown',mdD_D);\n\nif (def_el !== undefined && def_el != 0 && def_el != \"\"){\n\tel = def_el;\n}\n\nif (pos_x !== undefined && !isNaN(pos_x)) {\n\tel.style.left = Number(pos_x)+\"px\";\n}\nif (pos_y !== undefined && !isNaN(pos_x)) {\n\tel.style.top = Number(pos_y)+\"px\";\n}\n\nfunction mdD_D (e) {\n\twindow.addEventListener('mousemove',mvD_D);\n\twindow.addEventListener('mouseup',muD_D);\n\n\tlet elCrd = {\n\t\tx:el.offsetLeft,\n\t\ty:el.offsetTop,\n\t\tw:el.offsetWidth,\n\t\th:el.offsetHeight\n\t}\n\n\tlet mouse = {\n\t\tx:e.x,\n\t\ty:e.y\n\t}\n\n\tif (e.target != this & e.target.tagName != \"svg\" & e.target.tagName != \"line\") {\n\t\twindow.removeEventListener('mousemove',mvD_D);\n\n\t}else {\n\t\tel.style.boxShadow = \"0 0 5px 2px #b3e0f9\";\n\t}\n\n\tfunction mvD_D (e) {\n\nif (!isResizing){\n\nmouse.x = e.x - mouse.x;\nmouse.y = e.y - mouse.y;\n\nif (par) {\n//this if is for collision with parent\nlet speed = internalColision (el,mouse.x,mouse.y,par);\n//and this for change coords of element\nelCrd.x += speed.x;\nelCrd.y += speed.y;\n\n}else {\n\telCrd.x += mouse.x;\n\telCrd.y += mouse.y;\n}\n\n\t\telCrd.X = getCoords(el).left;\n\t\telCrd.Y = getCoords(el).top;\n\n//here I set another position of element with css\n\t\tif (fdfex !== undefined && fdfex !== \"\" && fdfex !== 0) {\n\t\t\tlet status = 1;\n\t\t\tif (typeof fdfex == \"function\") {\n\t\t\t\tfdfex(e,status);\n\t\t\t}\n\t\t\tif (typeof fdfex == \"object\") {\n\t\t\t\tlet move = fdfex.f(e,fdfex.arg,status,elCrd.X,elCrd.Y);\n\t\t\t}\n\t\t}\n\n\t\tel.style.left = elCrd.x + \"px\";\n\t\tel.style.top = elCrd.y + \"px\";\n\t\tmouse.x = e.x;\n\t\tmouse.y = e.y;\n}\n\n\t}\n\nfunction muD_D (e) {\n\twindow.removeEventListener('mousemove',mvD_D);\n\twindow.removeEventListener('mouseup',muD_D);\n\n//here I set another position of element with css\n\n\tif (fdfex !== undefined && fdfex !== \"\" && fdfex !== 0) {\n\t\tlet status = 0;\n\t\tif (typeof fdfex == \"function\") {\n\t\t\tfdfex(e,status);\n\t\t}\n\t\tif (typeof fdfex == \"object\") {\n\t\t\tlet change = fdfex.f(e,fdfex.arg,status,e.x,e.y);\n\t\t}\n\t}\n\n\tel.style.boxShadow = \"none\";\n\tisDraging = false;\n\t}\n}\n\nel.ondragstart = function() {\n return false;\n};\n\n}", "function dragElement(element, xAmount, yAmount) {\n var $element = $(element);\n var start = {\n x: $element.offset().left + 5,\n y: $element.offset().top + 5\n };\n var end = {\n x: start.x + xAmount,\n y: start.y + yAmount\n };\n\n // need to mouseover so that it sets up some internal state property\n var mousedown = testUtils.createMouseEvent('mousedown', start.x, start.y);\n var drag = testUtils.createMouseEvent('mousemove', end.x, end.y);\n var mouseup = testUtils.createMouseEvent('mouseup', end.x, end.y);\n\n element.dispatchEvent(mousedown);\n element.dispatchEvent(drag);\n element.dispatchEvent(mouseup);\n}", "onMouseDown(event) {\n // only dragging with left mouse button\n if (event.button === 0) {\n this.onPointerDown(event);\n }\n }", "onMouseDown(event) {\n // only dragging with left mouse button\n if (event.button === 0) {\n this.onPointerDown(event);\n }\n }", "function onMouseUp() {\n // sets the new location to default till moved again\n mouseDown = false;\n }", "mouseDown(x, y)\n {\n let splitterX = this.x + this.position;\n if (x >= splitterX - 5 && x <= splitterX + 5) {\n this.isDragged = true;\n }\n else if (x < splitterX) {\n this.updateFocus(this.leftPanel);\n this.leftPanel.mouseDown(x, y);\n }\n else {\n this.updateFocus(this.rightPanel);\n this.rightPanel.mouseDown(x, y);\n }\n }", "onMouseDown(e) {}", "function handle_mousedown(e){\n window.my_dragging = {};\n my_dragging.pageX0 = e.pageX;\n my_dragging.pageY0 = e.pageY;\n my_dragging.elem = this;\n my_dragging.offset0 = $(this).offset();\n\n\n function handle_dragging(e){\n if(e.shiftKey){\n var left = my_dragging.offset0.left + (e.pageX - my_dragging.pageX0);\n var top = my_dragging.offset0.top + (e.pageY - my_dragging.pageY0);\n $(my_dragging.elem)\n .offset({top: top, left: left});\n }\n }\n\n function handle_mouseup(e){\n $('body')\n .off('mousemove', handle_dragging)\n .off('mouseup', handle_mouseup);\n }\n $('body')\n .on('mouseup', handle_mouseup)\n .on('mousemove', handle_dragging);\n }", "function xl_DragMe(event) \n{\n\tvar target = xl_GetEventTarg(event); \n\txl_Drag(target, event); \n}", "function mouseDragged(){\n if(b){\n b.addPoint(mouseX, mouseY);\n }\n \n}", "function dragStarted () {\n d3.select(this).raise()\n d3.select(this).attr('cursor', 'grabbing')\n }", "function draggable() {\n\t$(\".bird\").draggable();\n}", "function dragMouseDown(e) {\n\t\tdrag.x = e.clientX;\n\t\tdrag.y = e.clientY;\n\t\tdocument.onmousemove = onMouseMove;\n\t\tdocument.onmouseup = () => { document.onmousemove = document.onmouseup = null; }\n\t}", "function dragging(evt){\n let pt = editor.createSVGPoint();\n pt.x = evt.clientX;\n pt.y = evt.clientY;\n svgP = pt.matrixTransform(inv_ctm);\n svgP.x += dx;\n svgP.y += dy;\n target.setAttribute('x', svgP.x);\n target.setAttribute('y', svgP.y);\n }", "function dragElement(elmnt) {\n var x_1 = 0,\n x_2 = 0;\n elmnt.addEventListener(\"touchstart\", dragMouseDown);\n elmnt.addEventListener(\"mousedown\", dragMouseDown);\n\n function dragMouseDown(e) {\n e = e || window.event;\n e.preventDefault();\n // get event's x coordinate\n x_2 = e.type === \"touchmove\" ? e.touches[0].clientX : e.clientX;\n\n document.addEventListener(\"touchend\", closeDragElement);\n document.addEventListener(\"mouseup\", closeDragElement);\n\n document.addEventListener(\"touchmove\", elementDrag);\n document.addEventListener(\"mousemove\", elementDrag);\n }\n\n function elementDrag(e) {\n e = e || window.event;\n // e.preventDefault();\n\n // get event's x coordinate\n var clientX = e.type === \"touchmove\" ? e.touches[0].clientX : e.clientX;\n\n // calculate the new cursor position and update\n x_1 = x_2 - clientX;\n x_2 = clientX;\n\n // set the element's new position. max: 0%, min: -85%.\n elmnt.style.left =\n Math.max(\n 0,\n Math.min(85, ((elmnt.offsetLeft - x_1) / elmnt.offsetWidth) * 100)\n ) + \"%\";\n }\n\n // stop moving when mouse button is released\n function closeDragElement() {\n document.removeEventListener(\"touchend\", closeDragElement);\n document.removeEventListener(\"mouseup\", closeDragElement);\n document.removeEventListener(\"touchmove\", elementDrag);\n document.removeEventListener(\"mousemove\", elementDrag);\n }\n }", "function mouseDragged() {\n flock.addBoid(new Boid(mouseX, mouseY));\n}", "function onMouseUp(evt) {\n if (evt.button === DRAG_BUTTON) {\n dragButtonIsDown = false;\n }\n evt.stopPropagation();\n evt.preventDefault();\n }", "function mouse_down_handler(e) {\n\t//console.log(\"mouse down\");\n\tvar evn;\n\tevn = e || event;\n\tevent = evn;\n\n\tif (evn.target) {\n\t\tcurrent_obj = evn.target;\n\t} else {\n\t\tcurrent_obj = evn.srcElement;\n\t}\n\t//console.log(\"current obj classame: \" + current_obj.className);\n\tif (isDraggable(current_obj)) {\n\t\tcalc_tag_chosen(current_obj);\t\t\n\t\tset_drag_from();\n\t\tif (drag_from == \"right\") {\n\t\t\tif (tag_chosen.nextSibling != null\n\t\t\t\t\t&& tag_chosen.nextSibling.className == \"clip\") {\n\t\t\t\talert(\"Only leaf node can be dragged.\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tis_drag = true;\n\t\tgetClone();\n\n\t\t// set drag_clone position and visibility\n\t\tobj_x = current_obj.offsetLeft\n\t\tobj_y = tag_chosen.offsetTop;\n\t\tvar temp = current_obj;\n\t\twhile (temp.offsetParent) {\n\t\t\ttemp = temp.offsetParent;\n\t\t\tobj_x = obj_x + temp.offsetLeft;\n\t\t\tobj_y = obj_y + temp.offsetTop;\n\t\t}\n\n\t\tif (drag_from == \"left\") {\n\t\t\tobj_y = obj_y - document.getElementById('availableTags').scrollTop;\n\t\t} else {\n\t\t\tobj_y = obj_y - document.getElementById('hierarchyTree').scrollTop;\n\t\t}\n\t\tdrag_clone.style[\"top\"] = obj_y + \"px\";// bug\n\t\tdrag_clone.style[\"left\"] = obj_x + \"px\";\n\t\t$(\"#\" + maskName).hide();\n\t}\n\treturn false;\n}", "function dragEl (el) {\n window.addEventListener('mouseup', (e) => {\n el.style.cursor = grab\n window.removeEventListener('mousemove', dragBox(el))\n el.style.zIndex -= 1\n console.log(window.getComputedStyle(el).zIndex)\n })\n}", "function dragstart(element) {\r\n //Wird aufgerufen, wenn ein Objekt bewegt werden soll.\r\n dragobjekt = element;\r\n dragx = posx - dragobjekt.offsetLeft;\r\n dragy = posy - dragobjekt.offsetTop;\r\n}", "dragButtonDown() {\n if (!this.fontPercentDrag) {\n this.fontPercentDrag = true;\n Events.on(this.fontSizeBox, 'mousemove', Fn.bind(this, this.dragButtonMove));\n }\n }", "function drag(ev){\r\n\t//console.log(ev.target.parentNode);\r\n\tvar ss = (parseInt($(ev.target.parentNode).position().left,10) - ev.clientX) + ',' + (parseInt($(ev.target.parentNode).position().top,10) - ev.clientY);\r\n\tev.dataTransfer.setData(\"text/plain\", ss + ',' + $(ev.target.parentNode).attr('id'));\r\n\t//ev.dataTransfer.setDragImage(document.getElementById(\"draggit\"), 10, 10);\r\n\t//console.log(\"drag:target\", $(ev.target).position().left + \",\" + $(ev.target).position().top);\r\n\t//console.log(\"drag:offset\", ss);\r\n\t//console.log();\r\n}", "onDragStarted(mousePosition) {\n }", "onMouseDown(event) {\n // only dragging with left mouse button\n if (event.button !== 0) {\n return;\n }\n\n this.onPointerDown(false, event);\n }", "onMouseDown(event) {\n // only dragging with left mouse button\n if (event.button !== 0) {\n return;\n }\n\n this.onPointerDown(false, event);\n }", "function mouseDown(e) {\n mousePress(e.button, true);\n}", "function drag(ev) \n{\n ev.dataTransfer.setData(\"text\", ev.target.id);\n //$('#'+ev.target.id).draggable( {cursor: 'move'} );\n}", "function dragMouseStart(e) {\n console.log('dragMouseStart');\n // allow effect data transfer on the start of mouse move\n e.dataTransfer.effectAllowed = 'move'\n // drop effect on start of mouse move\n e.dataTransfer.dropEffect = 'move';\n\n e = e || window.event;\n // get the mouse cursor position at startup:\n pos3 = e.clientX;\n pos4 = e.clientY;\n console.log(pos3 + \" \" + pos4);\n // get the element from the mouse position\n var node = document.elementFromPoint(pos3, pos4);\n // get the parent node of the elemnt \n node = node.parentNode;\n console.log(node);\n // create a selection to hold the cards to be moved\n selection = getSelection(node);\n selectednode = node;\n document.dragend = dragMouseEnd;\n \n }", "onMouseDown (e) {\n this.isMouseDown = true;\n\n this.emit('mouse-down', {x: e.offsetX, y: e.offsetY});\n }", "drag_feedback(){\r\n this.dragging = true;\r\n }", "onMouseDown(event) {\n let object = event.currentTarget;\n \n if(!Draggable.enabled(object)) {\n return;\n }\n \n event.preventDefault();\n\n Draggable.cacheProperties(object);\n Draggable.cacheProperties(this.container);\n Draggable.cacheProperties(this.container);\n\n let cursorPosRelativeToContainer = Draggable.getCursorPositionRelativeTo(event, this.container),\n cursorPosRelativeToObject = Draggable.getCursorPositionRelativeTo(event, object),\n matrixString = window.getComputedStyle(object).transform,\n matrix = Draggable.parseMatrix(matrixString),\n position = {\n X: 0,\n Y: 0\n };\n\n ['X', 'Y'].forEach(axis => position[axis] = cursorPosRelativeToContainer[axis] - cursorPosRelativeToObject[axis]);\n\n Object.assign(object.__draggable_cache, {\n initialCursorPosRelativeToObject: cursorPosRelativeToObject,\n objectBounds: Draggable.getBoundsRelativeTo(object, this.container),\n time: Date.now(),\n velocity: {\n X: 0,\n Y: 0\n },\n hasMoved: false,\n position,\n matrix\n });\n\n let stackIndex = this.decelerationStack.indexOf(object);\n\n if(stackIndex !== -1) {\n this.decelerationStack.splice(stackIndex, 1);\n\n --this.stackLength;\n }\n\n object.__draggable_mouseIsDown = true;\n\n this.currentObject = object;\n\n this.trigger('drag-start', [object, position]);\n }", "function mousedownMoveHandler(event) {\n setSelection();\n releaseSelection(event);\n $(document).mousemove(moveSelection);\n $(document).mouseup(releaseMoveSelection);\n}", "onDragEnded(mousePosition) {\n }", "dragStart(e) {\n var dragImage = document.createElement('img');\n dragImage.width = 1;\n e.originalEvent.dataTransfer.setDragImage(dragImage, 0, 0);\n\n e.originalEvent.dataTransfer.effectsAllowed = 'none';\n e.originalEvent.dataTransfer.dropEffect = 'none';\n\n // Response the position of this component e.g.: {top: 5, left: 5}\n const pos = this.$().position();\n\n const clientX = parseInt(e.originalEvent.clientX);\n const clientY = parseInt(e.originalEvent.clientY);\n\n // Calculate distance between mouse pointer and\n // the corner position of this div component.\n const offsetX = clientX - pos.left;\n const offsetY = clientY - pos.top;\n\n this.set('offsetX', offsetX);\n this.set('offsetY', offsetY);\n }", "function mouseReleased(){\r\n constr.fly();\r\n}", "function mousedown(e){\n\t\t// console.log(e);\n\t\tmouseIsDown = true;\n\t}" ]
[ "0.7448934", "0.7445981", "0.7434803", "0.7434803", "0.73383325", "0.72711074", "0.71712095", "0.71278065", "0.70817447", "0.7007203", "0.7007203", "0.70053345", "0.7001513", "0.6993286", "0.6958098", "0.6944916", "0.69328177", "0.69316167", "0.6918795", "0.6918795", "0.6906045", "0.68825585", "0.68825585", "0.68788034", "0.6876294", "0.6871641", "0.68533367", "0.683491", "0.6812596", "0.67747176", "0.676953", "0.67669255", "0.6765415", "0.67575395", "0.6754435", "0.6746003", "0.67344624", "0.6733339", "0.6733339", "0.67275304", "0.67135775", "0.6706642", "0.66838056", "0.6664894", "0.66479963", "0.6622111", "0.6601771", "0.6601771", "0.6597234", "0.6582393", "0.6582393", "0.65735936", "0.6562289", "0.6557434", "0.6556941", "0.6556941", "0.6554708", "0.6550717", "0.6544912", "0.6540605", "0.65386325", "0.6537984", "0.653642", "0.6532028", "0.6521741", "0.65174735", "0.6510321", "0.6510321", "0.6509806", "0.65064543", "0.64898074", "0.64874876", "0.64854366", "0.64842665", "0.64800584", "0.6479949", "0.6478959", "0.6466871", "0.64668506", "0.6466235", "0.64606535", "0.64596236", "0.6453395", "0.6450872", "0.64503264", "0.6449555", "0.64475834", "0.6443794", "0.6443794", "0.64388", "0.643644", "0.6434103", "0.64301527", "0.6427186", "0.6424758", "0.6416455", "0.6412964", "0.64114577", "0.6410748", "0.640979" ]
0.65766144
51
Stop drag when mouse up on an element
function dragEl (el) { window.addEventListener('mouseup', (e) => { el.style.cursor = grab window.removeEventListener('mousemove', dragBox(el)) el.style.zIndex -= 1 console.log(window.getComputedStyle(el).zIndex) }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pointerUp(event) {\n dragging = false;\n }", "onElementMouseUp(event) {\n if (this.dragContext) {\n this.endMove();\n event.preventDefault();\n }\n }", "onElementMouseUp(event) {\n if (this.dragContext) {\n this.endMove();\n event.preventDefault();\n }\n }", "_onMouseUp () {\n Actions.changeDragging(false);\n }", "function mouseup(e) {\n angular.element(document).unbind('mousemove', mousemove);\n angular.element(document).unbind('mouseup', mouseup);\n dragging = false;\n }", "function mouse_up_handler() {\n mouse.down = false; \n }", "onElementMouseUp(event) {\n if (this.dragContext) {\n this.endMove();\n event.preventDefault();\n }\n }", "stopDrag() {\n document.body.onmousemove = null;\n document.body.onmouseup = null;\n }", "function onMouseUp(e){\n mouseDown = false;\n}", "function mouseup(){\n mouse_down = false;\n}", "function mouseReleased() {\n if (!running) {\n // Quit dragging\n draggingStart = false;\n draggingEnd = false;\n }\n}", "dragToStop() {\n this.drag.status = false;\n }", "function mouseUp(event) {\n mouseIsDown = false;\n // if (drawHandle !== -1) {\n // clearInterval(drawHandle);\n // drawHandle = -1;\n // }\n }", "function mouseUp() {\n console.log(\"Mouse Up\");\n mouseDownPress = false;\n}", "function handleMouseUp(e) {\r\n // tell the browser we're handling this event\r\n e.preventDefault()\r\n e.stopPropagation()\r\n\r\n // clear the isDragging flag\r\n isDown = false\r\n}", "function mouseUp(e) {\n clickObj.mouseDown = false;\n $(window).unbind('mousemove');\n }", "function mouseReleased() {\r\n mouseIsDown = false;\r\n}", "function dragstop() {\r\n dragobjekt=null;\r\n}", "function stopDrag() {\n document.removeEventListener('mousemove', moveAlong);\n document.removeEventListener('mouseup', stopDrag);\n }", "function mouseUp(e) {\n mousePress(e.button, false);\n}", "function mouseUp(){\r\n isDown = false;\r\n box.style.border = 'none';\r\n }", "_mouseUp() {\n if (this._currentHandle) {\n this._currentHandle.style.cursor = 'grab';\n this._currentHandle.classList.remove('is-dragged');\n }\n document.body.classList.remove('u-coral-closedHand');\n\n events.off('mousemove.Slider', this._draggingHandler);\n events.off('touchmove.Slider', this._draggingHandler);\n events.off('mouseup.Slider', this._mouseUpHandler);\n events.off('touchend.Slider', this._mouseUpHandler);\n events.off('touchcancel.Slider', this._mouseUpHandler);\n\n this._currentHandle = null;\n this._draggingHandler = null;\n this._mouseUpHandler = null;\n }", "function mouseUp()\n {\n ThemerService.mouseDown = false;\n $document.unbind('mouseup', mouseUp);\n }", "e_mouseUp(e)\n\t{\n\t\tthis.mouseState.isDown = false;\n\t\tthis.mouseState.dragEventFired = false;\n\n\t\tthis.componentsDragged.forEach(function(component)\n\t\t{\n\t\t\tcomponent.isDragged = false;\n\t\t});\n\t}", "function mouseUpDragging() {\n \"use strict\";\n window.removeEventListener('mousemove', divMoveDragging, false);\n}", "function onMouseUp(event)\n{\n onMouseMove(event); // just reusing the above code\n dragging = false; // adding one line here\n}", "function onMouseUpWindow(event)\n{\n dragging = false;\n}", "function onMouseUpListener(evnt) {\n\tif (dragging && playing)\n\t\tdragging = false;\n}", "function dragStop(event) {\n // Stop capturing mousemove and mouseup events.\n document.removeEventListener(\"mousemove\", dragGo, true);\n document.removeEventListener(\"mouseup\", dragStop, true);\n d = null;\n}", "function pointerDown(event) {\n dragging = true;\n pointerMove(event);\n \n }", "function OnMouseUp() {\n\tisMouseDown = false;\n\t\n}", "function dragEnd(e) {\n active = false;\n}", "function draggingUp(e) {\n if (!module.isDragging) {\n return;\n }\n module.draggingMouseDown = {};\n // e.preventDefault();\n module.isDragging = false;\n // reset the mouse out state\n module.mouseOutState = 0;\n // if the area is too small, it is judged as invalid area then delete\n if (module.currentDraggingNode.getWidth() < 5 || module.currentDraggingNode.getHeight() < 5) {\n module.removeById(module.currentDraggingNode.id);\n }\n return false\n }", "function sliderMouseUp(mouseUpEvent) {\r\n if(mouseDownEvent.button === 0) {\r\n // Remove all 'while grabbing' styling\r\n mouseDownEvent.target.classList.remove('sliding');\r\n document.body.style.cursor = '';\r\n // Remove the event mouse move and mouse up listeners from the window\r\n window.removeEventListener('mousemove', sliderMouseMove)\r\n window.removeEventListener('mouseup', sliderMouseUp)\r\n // Prevent any default action of the mouse up event\r\n mouseUpEvent.preventDefault();\r\n }\r\n }", "function mouseUpEvent(e) {\n\tswitch (e.button) {\n\t\tcase 0:\n\t\t\tleft_click_drag_flag = false;\t\t\t\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tright_click_drag_flag = false;\n\t\t\tbreak;\n\t}\n}", "onPointerUp() {\n\t\tif (draggingEl) {\n\t\t\tthis.$clonedEl.remove();\n\t\t\tdocument.body.classList.remove(this.docBodyClass);\n\t\t\temit(draggingEl, 'dragend');\n\t\t\tdraggingEl = null;\n\t\t}\n\t\tdocument.removeEventListener(events.move, this.onPointerMove);\n\n\t\t// for auto-scroll\n\t\tthis.scrollParent.removeEventListener(events.enter, this.onPointerEnter);\n\t\tthis.scrollParent.removeEventListener(events.leave, this.onPointerLeave);\n\t\tthis.onPointerLeave();\n\t}", "onMouseUp(event) {\n event.preventDefault();\n\n if(!this.currentObject) {\n return;\n }\n\n let object = this.currentObject,\n cache = object.__draggable_cache,\n time = Date.now(),\n deltaTime = time - cache.time,\n objectBounds = cache.objectBounds,\n position = cache.position;\n\n if(deltaTime > 25 && cache.hasMoved) {\n cache.velocity.X = cache.velocity.Y = 0;\n }\n\n ['X', 'Y'].forEach((axis, index) => {\n ['min', 'max'].forEach(bound => {\n if(Math[bound](position[axis], objectBounds[bound + axis]) === position[axis])\n cache.velocity[axis] = -((position[axis] - objectBounds[bound + axis]) / 100);\n });\n });\n\n this.trigger('drag-end', [object, position]);\n\n if(\n this.settings.deceleration && (\n Math.abs(cache.velocity.X) > 0 ||\n Math.abs(cache.velocity.Y) > 0\n )\n ) {\n this.animateDeceleration(this.currentObject);\n } else {\n // If no deceleration to consider, fire stop event.\n this.trigger('stop', [object, position]);\n }\n\n this.currentObject = null;\n }", "function mouseDownEvent(eb){\r\n dragging = eb\r\n}", "_stopDragging() {\n this._isDragging = false;\n this._translate.x += this._translate.dx;\n this._translate.y += this._translate.dy;\n this._translate.dx = 0;\n this._translate.dy = 0;\n this._updateZoomerStyle();\n }", "function mouseup(event) {\n current_slider = null;\n}", "function stopDrag() {\n document.documentElement.removeEventListener(\"mousemove\", doDrag, false);\n document.documentElement.removeEventListener(\"pointerup\", stopDrag, false);\n document.documentElement.removeEventListener(\"mouseup\", stopDrag, false);\n }", "function onMouseUp() {\n // sets the new location to default till moved again\n mouseDown = false;\n }", "function mup(e) {\r\n\t\t\t\t\t//remove event handler\r\n\t\t\t\t\t$(frameBody).off(\"mousemove\",mmove);\r\n\t\t\t\t\t$(frameBody).off(\"mouseleave\",mup);\r\n\t\t\t\t\t$(e.target).off(\"mouseup\",mup);\r\n\t\t\t\t\tisDrag=false;\r\n\t\t\t\t\tix=iy=\"\";\r\n\t\t\t\t}", "handleMouseUp() {\n this.setState({\n isDragging: false,\n cursor: 'grab'\n });\n }", "endDrag(x, y) {}", "mouseDownUp(start, end) {}", "function ev_mouseup(e) {\n\t//e.preventDefault();\n\t//canEl.onmousemove = null;\n\tif (dimmerUpdateId != -1)\n\t\tobjArr[dimmerUpdateId].onMouseUp();\n\tdimmerUpdateId = -1;\n}", "stopDrag(evt) {\n const elem = DragAndDrop_1.DD._dragElements.get(this._id);\n if (elem) {\n elem.dragStatus = 'stopped';\n }\n DragAndDrop_1.DD._endDragBefore(evt);\n DragAndDrop_1.DD._endDragAfter(evt);\n }", "function reactionMouseUp (e) { \n drag = false; // Zugmodus deaktivieren \n }", "function reactionMouseUp (e) { \n drag = false; // Zugmodus deaktivieren \n }", "function reactionMouseUp (e) { \r\n drag = false; // Zugmodus deaktivieren \r\n reactionUp(e.clientX,e.clientY); // Hilfsroutine aufrufen \r\n }", "onMouseUp(e) {\n // we have finished dragging\n this.isMouseDown = false;\n\n // remove specific styles\n this.options.element.classList.remove(\"dragged\");\n\n // update our end position\n this.endPosition = this.currentPosition;\n\n // send our mouse/touch position to our hook\n var mousePosition = this.getMousePosition(e);\n\n // drag ended hook\n this.onDragEnded(mousePosition);\n }", "function mousedown(e){\n e.preventDefault();\n state.dragging = {};\n state.dragging.start = {\n x: e.pageX,\n y: e.pageY\n }\n state.dragging.original_x = state.center.x;\n state.dragging.original_y = state.center.y;\n $(document).bind(\"mousemove\", mousemove);\n $(document).bind(\"mouseup\", mouseup);\n }", "function MouseUpEvent() {}", "function unlistenDrag(){\n S.lib.removeEvent(document, 'mousemove', positionDrag);\n S.lib.removeEvent(document, 'mouseup', unlistenDrag); // clean up\n\n if(S.client.isGecko)\n U.get(drag_id).style.cursor = '-moz-grab';\n }", "mouseUp(pt) {}", "mouseUp(pt) {}", "handleMouseUp() {\n let { map, isDrawingEnabled, option } = this.state;\n\n /**\n * We track it only for \"Draw\" drawing mode\n */\n if ( ! (isDrawingEnabled && option === \"draw\") ) return;\n\n this.refs.map.leafletElement.dragging.enable();\n map.mouseDown = false;\n this.setState({\n map: map,\n isDrawingEnabled: false\n });\n }", "function mouseUp(e) {\n removeMoveListener();\n removeUpListener();\n _callbacks.end.forEach(function(callback) {\n callback.call();\n });\n }", "function onMouseUp(evt) {\n if (evt.button === DRAG_BUTTON) {\n dragButtonIsDown = false;\n }\n evt.stopPropagation();\n evt.preventDefault();\n }", "function onMouseMoveEventOffHandler(ev){\n if(WorkStore.isSelected()) return;\n\n\n window.removeEventListener(MOUSE_DOWN, onMouseDownHandler);\n document.body.classList.remove(\"drag\");\n document.body.classList.remove(\"dragging\");\n}", "listenDragging() {\n this.pointRender.pause();\n }", "onMouseUp( event ) {\n //console.log(\"MultiControls.onMouseUp\");\n event.preventDefault();\n //event.stopPropagation();\n this.mouseDragOn = false;\n var mousePtUp = this.getMousePt(event);\n if (mousePtUp.x == this.mousePtDown.x && mousePtUp.y == this.mousePtDown.y) {\n var t = Util.getClockTime();\n var dt = t - this.mouseDownTime;\n if (dt < 0.6)\n this.handleMuseEvent(event, 'click');\n else {\n console.log(\"Lazy click... ignored...\");\n }\n }\n }", "function onMouseUp(event){if(preventMouseUp){event.preventDefault();}}", "function release_drag_flag(){\n\n\tclearTimeout(drag_manager.click_timeout);\n\n\tdrag_manager.drag_flag=false;\n\n}", "function mouseReleased() {\n direction = null;\n}", "function dropper(event) {\n\n// Unregister the event handlers for mouseup and mousemove\n\n document.removeEventListener(\"mouseup\", dropper, true);\n document.removeEventListener(\"mousemove\", mover, true);\n\n// Prevent propagation of the event\n\n event.stopPropagation();\n} //** end of dropper", "function stopDragover() {\n placeholder.remove();\n element.removeClass(\"dndDragover\");\n return true;\n }", "function stopDragover() {\n placeholder.remove();\n element.removeClass(\"dndDragover\");\n return true;\n }", "function onMouseMove(evt) {\n if (dragButtonIsDown) {\n player.stop();\n dragging = true;\n sozi.events.fire('cleanup');\n display.drag(evt.clientX - dragClientX, evt.clientY - dragClientY);\n dragClientX = evt.clientX;\n dragClientY = evt.clientY;\n }\n evt.stopPropagation();\n }", "mouseDownUp(start, end) {\n \n }", "function OnMouseDown(){\n\tbeingDragged = true;\n}", "function mouseUp() { }", "function upHandler(e){\n\te.preventDefault();\n\te.stopPropagation();\n\n\twindow.removeEventListener(\"mouseup\", upHandler, false);\n\twindow.removeEventListener(\"mousemove\", moveHandler, false);\n\tconsole.log(\"upHandler\");\n\timgDiv.style.cursor = \"\";\n\n}", "function handleMouseOut(e) {\r\n // tell the browser we're handling this event\r\n e.preventDefault()\r\n e.stopPropagation()\r\n\r\n // clear the isDragging flag\r\n isDown = false\r\n}", "onMouseUp(event) {\n\t\t// console.log(\"mouse up\");\n\t\tthis.props.setIsDrawing(false);\n\t}", "mouseUp(e){\n this._super(...arguments);\n\n\n if(e.path === undefined || e.path[0].tagName !== \"MULTI-SELECTION\"){\n return;\n }\n\n if(e.button == 0){\n e.stopPropagation();\n e.preventDefault();\n\n this.set('moveStart', false);\n }\n\n\n\n document.removeEventListener('mousemove', this.get('mouseMoveListener'));\n document.removeEventListener('mouseup', this.get('mouseUpListener'));\n\n\n }", "onMouseUp(event) {\n this.isDragging = false;\n this.isPanning = false;\n this.isMinimapPanning = false;\n if (this.layout && typeof this.layout !== 'string' && this.layout.onDragEnd) {\n this.layout.onDragEnd(this.draggingNode, event);\n }\n }", "function mouseUpHandler(e) {\n //middle button\n if (e.which == 2) {\n container.off('mousemove');\n }\n }", "function myUp() {\n canvas.onmousemove = null;\n}", "onElementMouseUp(event) {}", "onElementMouseUp(event) {}", "function mouseupSlider(e) {\n loc_document.unbind('mousemove', moveSlider);\n }", "function mouseUpHandler(e){\n //middle button\n if (e.which == 2){\n container.off('mousemove');\n }\n }", "function mouseUpHandler(e){\n //middle button\n if (e.which == 2){\n container.off('mousemove');\n }\n }", "function mouseUpHandler(e){\n //middle button\n if (e.which == 2){\n container.off('mousemove');\n }\n }", "function mouseUpHandler(e){\n //middle button\n if (e.which == 2){\n container.off('mousemove');\n }\n }", "function MouseUpHandler(e) {\n pan_context = false;\n}", "function upHandler(event) {\n if (!event) event = window.event; // IE Event Model\n\n // Unregister the capturing event handlers.\n if (document.removeEventListener) { // DOM event model\n document.removeEventListener(bTouchMode? \"touchend\": \"mouseup\", upHandler, true);\n document.removeEventListener(bTouchMode? \"touchmove\": \"mousemove\", moveHandler, true);\n }\n else if (document.detachEvent) { // IE 5+ Event Model\n elementToDrag.detachEvent(\"onlosecapture\", upHandler);\n elementToDrag.detachEvent(bTouchMode? \"touchend\": \"onmouseup\", upHandler);\n elementToDrag.detachEvent(bTouchMode? \"touchmove\": \"onmousemove\", moveHandler);\n elementToDrag.releaseCapture();\n }\n\n if (options.stop) options.stop(event);\n // And don't let the event propagate any further.\n if (event.stopPropagation) event.stopPropagation(); // Standard model\n else event.cancelBubble = true; // IE\n \n }", "onMouseUp(event) {\n const me = this,\n context = me.context;\n\n me.removeListeners();\n\n if (context) {\n me.scrollManager && me.scrollManager.stopMonitoring(me.dragWithin || me.outerElement);\n\n if (context.action === 'container') {\n me.finishContainerDrag(event);\n } else if (context.started && context.action.startsWith('translate')) {\n me.finishTranslateDrag(event);\n }\n\n if (context.started) {\n // Prevent the impending document click from the mouseup event from propagating\n // into a click on our element.\n const clickPreventer = EventHelper.on({\n element: document,\n thisObj: me,\n click: documentListeners.docclick,\n capture: true,\n once: true\n });\n // In case a click did not ensue, remove the listener\n me.setTimeout(clickPreventer, 50);\n } else {\n me.reset();\n }\n }\n }", "mouseUp(x, y, _isLeftButton) {}", "function documentMouseUpHandler(event) {\n mouseIsDown = false;\n }", "function myUp(){\n canvas.onmousemove=null;\n}", "onMouseUp(event) {\n const me = this,\n context = me.context;\n me.removeListeners();\n\n if (context) {\n me.scrollManager && me.scrollManager.stopMonitoring(me.dragWithin || me.outerElement);\n\n if (context.action === 'container') {\n me.finishContainerDrag(event);\n } else if (context.started && context.action.startsWith('translate')) {\n me.finishTranslateDrag(event);\n }\n\n if (context.started) {\n // Prevent the impending document click from the mouseup event from propagating\n // into a click on our element.\n EventHelper.on({\n element: document,\n thisObj: me,\n click: documentListeners.docclick,\n capture: true,\n expires: me.clickSwallowDuration,\n // In case a click did not ensue, remove the listener\n once: true\n });\n } else {\n me.reset(true);\n }\n }\n }", "function handleDragEnd(){\n this.isMouseDown = false\n this.lastX = null\n}", "function noDragStart() {\n return false;\n}", "function noDragStart() {\n return false;\n}", "function noDragStart() {\n return false;\n}", "onDragEnd(e) {\n this.isDown = false;\n }", "function mouseup(e) {\r\n fsw_state = 0;\r\n ui_modified = true;\r\n}", "function sketchpad_mouseUp() {\n mouseDown=0;\n }" ]
[ "0.7828176", "0.7713579", "0.7713579", "0.76460505", "0.7573367", "0.75427765", "0.7493127", "0.74205", "0.74172616", "0.7387032", "0.73673016", "0.73669547", "0.7278426", "0.7272666", "0.72687185", "0.7268313", "0.71928036", "0.7182019", "0.7163921", "0.7142748", "0.7140526", "0.7115769", "0.7111453", "0.71082926", "0.7087807", "0.7070046", "0.7065366", "0.7064937", "0.70281243", "0.7027998", "0.69865024", "0.6942808", "0.69284064", "0.691546", "0.68994594", "0.68876016", "0.68802124", "0.6870192", "0.6851953", "0.68508875", "0.6834103", "0.6833751", "0.6830262", "0.6825786", "0.6811214", "0.6806953", "0.67837644", "0.6780403", "0.67791766", "0.67755306", "0.6766544", "0.67509675", "0.67505926", "0.67324066", "0.6727266", "0.6718918", "0.6718918", "0.67130965", "0.669546", "0.6693277", "0.66886616", "0.6677943", "0.667533", "0.6671483", "0.6669043", "0.666311", "0.6646811", "0.6646311", "0.6646311", "0.6639084", "0.6637231", "0.6624091", "0.661566", "0.6613821", "0.66017437", "0.6593197", "0.6589807", "0.65807605", "0.6576468", "0.6567107", "0.6563285", "0.6563285", "0.6555228", "0.6550857", "0.6550857", "0.6550857", "0.6550857", "0.65446883", "0.6544343", "0.65385836", "0.6532955", "0.65301377", "0.6511326", "0.6509724", "0.6507355", "0.65015376", "0.65015376", "0.65015376", "0.6499567", "0.649787", "0.64933264" ]
0.0
-1
Fly sequence Portals activation procedure Switch division
function SwitchDivision(target,Manual){ const rebu = $("#Reach"); Section = false; Active.SwitchDivision = true; Forward.obj = false; Dur = 2; for(X = 0; X < Portal.length; X++) { if (target.hasClass(Portal[X])) { const prtl = $("#" + Portal[X]); // Setting .Flow's background color TweenMax.to(target.find(".Flow"),.5,{background: Active.Color,autoAlpha: 0}); // Activating the new section Section = prtl.children().first(); if( Active.Division.attr("id") === "Temporary" ){target = $("#Temporary");} // Switching Active.Division = Section; Dimension = prtl; ChildrenLen = Dimension.children("footer,header,article").length; if ((!Reverse.pedal && (ChildrenLen > 1 && Active.Division.index() + 1 < ChildrenLen))) { Forward.obj = Dimension.children().eq(Active.Division.index() + 1); } Forward.isAvailable = true; Forward.isAllowed(true); Glitch.on("#Gandalf", null); } } // Boosting active fly's speed to wrap up faster if( Shrinker && Shrinker.isActive() ) { Shrinker.duration(2); Shrinker.eventCallback("onComplete",LoadSection,[FlyAssociates]); }else{ // Hiding the current section TweenMax.to(Active.Division, .5, {autoAlpha: 0,onComplete: LoadSection,onCompleteParams: [FlyAssociates]}); } Locked = true; Active.Portal = false; // Prepping the spaceship for the next section if( Section === false || Manual ){ Dimension = Active.Division.parent(); ChildrenLen = Dimension.children("footer,header,article").length; Forward.isAvailable = true; Forward.isAllowed(true); Glitch.on("#Gandalf", null); if( !Manual ) { // Keeping the current division in target variable target = Active.Division; // Set upcoming sibling of the last division as current division when: if ( // Last division isn't reversed to this division !Reverse.pedal && // Current division has upcoming siblings ( Active.Division.index() + 1 < ChildrenLen && // Next division when set, isn't the Temporary division (Current main division) Dimension.children().eq(Active.Division.index() + 1).attr("id") !== "Temporary" ) ) { Active.Division = Dimension.children().eq(Active.Division.index() + 1); } else if ((Active.Portal === false && !Reverse.pedal)) { Active.Division = Subject = $("#Temporary"); Forward.isAvailable = false; // Resetting portals affected assets if (Rotten.Direct !== false) { Rotten.Direct.play(); GetPortal = $(Rotten.Direct.target[0]).closest(".Portal"); CheckForToggle(GetPortal); // Fly Config Active.Portal = Subject = GetPortal; Parent = Subject.parent(); Forward.isAvailable = true; }else{ rebu.data({GandalfOpt: 1}); Forward.isAllowed(false); } } else if (Reverse.pedal) { Active.Division = Reverse.obj; Subject = Active.Division.find(".Entry"); Parent = Active.Division; // Resetting portals affected assets if (Rotten.Direct !== false && Active.Division.attr("id") === "Temporary") { Rotten.Direct.play(); GetPortal = $(Rotten.Direct.target[0]).closest(".Portal"); CheckForToggle(GetPortal); // Fly Config Active.Portal = GetPortal; if (Active.Division.attr("id") === "Temporary") { Subject = GetPortal; } } } // Set the upcoming sibling as next division when current division has followed siblings if ( Active.Division.index() + 1 < ChildrenLen ) { Forward.obj = Dimension.children().eq(Active.Division.index() + 1); } // Or reset to the main division else if( Active.Division.attr("id") !== "Temporary" ){ Forward.obj = $("#Temporary"); } } if( !Forward.obj.length && Active.Dimension === Portal[0] ){ rebu.data({GandalfOpt: 2}); Forward.isAvailable = false; Forward.isAllowed(false); } Section = Active.Division; } Section.css({visibility: "", opacity: "", transform : "", transformOrigin: ""}); function LoadSection(Flyascs){ // Actions that should be done only when shrinker is available $(".Flow ,.Shrinker").css({transform: "", visibility: "", opacity: "", background: ""}); // Resetting fly associates $(target).css({opacity: 0, visibility: "hidden",zIndex: -1,transform : "", transformOrigin: ""}); TweenMax.set(Flyascs.toString(), {y: 0, x: 0, scale: 1, rotation: 0}); Section.css({zIndex: 1}); Active.SwitchDivision = false; } Draggable.get(".Pedal").endDrag(); ReverseSequence(); DivisionSequence(true); Pathfinder(); DivisionExpress.set.Beam(); URI(true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "activate() {\n this.active = true\n this.activatedComponents.forEach(contact => {\n contact.activate(this.value < 9 ? ActivationSources.ALGEDONODE : ActivationSources.DIAL_OUTPUT)\n })\n }", "async activate(){\n\t\tfor(const node of this.flowTree[0])\n\t\t\tawait node.activate();\n\t}", "onSwitch() {}", "onSwitch() {}", "onSwitch() {}", "function activate() {\n\n\n }", "activate() {}", "function linkToSwitch(swNum, port) {\n let level = port < 3 ? 1 : 3;\n // console.log(swNum, port);\n if (swNum % 2 === 1) {\n if (level === 3) {\n return { level: level, swNum: port - 2 };\n } else {\n return { level: level, swNum: swNum + port - 1 };\n }\n } else {\n if (level === 3) {\n return { level: level, swNum: port };\n } else {\n return { level: level, swNum: swNum + port - 2 };\n }\n }\n}", "function activate() {\n\n }", "passPhase1Clicked() {\n \tthis.model.gamePhase = 2;\n \tthis.view.changeButtons(this.model.gamePhase);\n }", "activate() {\n if(turn.actions < this.actions) {\n hand.deselect();\n return;\n }\n resolver.proccess(this.results, this.actions, this.discard.bind(this));\n }", "function activate(){\n\n\t\t}", "function activate() {\n NighShift.start();\n}", "activate() {\n\t\tthis.active = true;\n\t\tthis.duration = this.savedDuration;\n\t\tif (this.partial) {\n\t\t\tthis.cycle = Math.ceil((1/this.density));\n\t\t}\n\t\telse {\n\t\t\tthis.cycle = 1;\n\t\t}\n\t\tthis.counter = 0;\n\t}", "function toggleTrain() {\n\tif(dead)loop();\n\tstate = TRAINING;\n\tnextGeneration();\n}", "function activate() {\n\t\t}", "function FLIPON(state) {\n if (exports.DEBUG) {\n console.log(state.step, 'FLIPON[]');\n }\n state.autoFlip = true;\n }", "activate() {\n\n }", "function FLIPON(state) {\n if (exports.DEBUG) console.log(state.step, 'FLIPON[]');\n state.autoFlip = true;\n}", "function FLIPON(state) {\n if (DEBUG) console.log(state.step, 'FLIPON[]');\n state.autoFlip = true;\n}", "activate() {\n\n\t\tthis.arbitrate();\n\n\t}", "function playerswitch() {}", "activate() {\n }", "function activateSolve() {\n // Execute the route task with atleat 2 stops\n if (routeParams.stops.features.length >= 2) {\n routeTask.solve(routeParams).then(showRoute);\n }\n }", "instruct(){\n var text1;\n var determinant;\n\n \n if(this.on == 1){\n determinant = 0;\n text1 = 'TURN '+this.name+' to off';\n }\n else if(this.on == 0){\n determinant = 1;\n text1 = 'TURN '+this.name+' to on';\n }\n\n //when at initial state\n //this.on is not initialized yet\n else if(this.on == -1){\n //console.log(this.flip);\n if(this.flip == 1){\n determinant = 0;\n text1 = 'TURN '+this.name+' to off';\n }\n else{\n determinant = 1;\n text1 = 'TURN '+this.name+' to on';\n }\n }\n \n //return:\n //the name of the interacts\n //the instruction texts\n //the state that needs to be achieved \n return [this.name,text1,determinant];\n }", "startup()\n\t{\n\t\tthis.angle = 1;\n\t\tthis.rows(5, 11, 1);\n\t\tthis.action(0);\n\t}", "changeState(state)\r\n {\r\n if(state==\"hungry\"||state==\"busy\"||state==\"normal\"||state==\"sleeping\")\r\n {\r\n this.usteps.push(this.initial);\r\n this.rsteps=[];\r\n this.initial=state;\r\n }\r\n else\r\n {\r\n throw new Error();\r\n }\r\n }", "function backToSwitchStates(){\n\t\tif (compMode()==\"data\"){\n\t\t\t$('.led-a').each(function(){ toggleLedOff($(this)); });\n\t\t\tfor(var i=0; i<=7; i++){\n\t\t\t\tif (isOn($('.switch-a'+i))){ toggleLedOn($('.led-d'+i)); }\n\t\t\t\telse{ toggleLedOff($('.led-d'+i)); }\n\t\t\t}\n\t\t}\n\t\telse if (compMode()==\"addr\"){\n\t\t\t$('.led-d').each(function(){ toggleLedOff($(this)); });\n\t\t\tfor(var i=0; i<=15; i++){\n\t\t\t\tif (isOn($('.switch-a'+i))){ toggleLedOn($('.led-a'+i)); }\n\t\t\t\telse{ toggleLedOff($('.led-a'+i)); }\n\t\t\t}\n\t\t}\n\t}", "function Activate()\r\t{\r\t\tif (slideState < eSlideState.Opening)\r\t\t\tslideState = eSlideState.Opening;\r\t}", "fire() {\n\t\tfor (var i = 0; i < this.outputs.length; i++) {\n\t\t\tthis.outputs[i].fire(this.activation);\n\t\t}\n\t}", "function stay(){\n for (var i = 0; i < cycles; i++) {\n myNetwork.activate([amount,.5]);\n myNetwork.propagate(learningRate, [0]);\n }\n}", "function switchMode(){\n\t\ttoggleSwitch(addrSwitch);\n\t\tif (compMode()==\"data\"){\n\t\t\t//$('.led-a').each(function(){ toggleLedOff($(this)); });\n\t\t\tfor(var i=0; i<=7; i++){\n\t\t\t\tif (isOn($('.switch-a'+i))){ toggleLedOn($('.led-d'+i)); }\n\t\t\t\telse{ toggleLedOff($('.led-d'+i)); }\n\t\t\t}\n\t\t}\n\t\telse if (compMode()==\"addr\"){\n\t\t\t//$('.led-d').each(function(){ toggleLedOff($(this)); });\n\t\t\tfor(var i=0; i<=15; i++){\n\t\t\t\tif (isOn($('.switch-a'+i))){ toggleLedOn($('.led-a'+i)); }\n\t\t\t\telse{ toggleLedOff($('.led-a'+i)); }\n\t\t\t}\n\t\t}\n\t\tflashSwitchStatesToTempMemory();\n\t}", "linkMainToggleSwitchToTables(){\n this.getStructuredData()\n .then((structuredData) => {\n for(let i = 0; i < structuredData.length; i++){\n const LastIndex= structuredData[i][0][0].indexOf(0);\n const portName = structuredData[i][0][0].substring(0, LastIndex);\n // console.log(portName);\n const parent = \".\" + portName + \"Parent\";\n const child = \".\" + portName + \"Child\";\n this.toggleMainSwitch(parent, child);\n }\n });\n }", "step() { }", "function toggle_features(callback) {\n csnLow();\n spi.transfer(ACTIVATE);\n Q().then(function() {\n var deferred = Q.defer();\n var buf = new Buffer(1);\n buf[0] = consts.ACTIVATE;\n spi.transfer(buf, new Buffer(buf.length), deferred.makeNodeResolver());\n return deferred.promise;\n }).then(function() {\n var deferred = Q.defer();\n var buf = new Buffer(1);\n buf[0] = 0x73;\n spi.transfer(buf, new Buffer(buf.length), deferred.makeNodeResolver());\n return deferred.promise;\n }).then(function() {\n csnHigh();\n callback();\n });\n }", "propagateValue() {\n this.dialOutputs[this.value - 1].activate()\n }", "start() {\n this.isActive = true;\n return new Promise(resolve => {\n this.execute().then(() => {\n this.isActive = false;\n this.shouldSkip = false;\n const nextState = this.getNextState();\n if (this.permittedStates.indexOf(nextState) !== -1) {\n resolve(nextState);\n }\n else {\n AppLogger.log(`you can't switch to ${nextState} from ${this.id}`, AppLoggerMessageType.ERROR);\n }\n });\n });\n }", "function customersSwitch() {\n let inQueueSwitch = document.querySelector( '.in-queue-switch' );\n let inServingSwitch = document.querySelector( '.in-serving-switch' );\n let inQueueContainer = document.querySelector( '#in-queue' );\n let inServingContainer = document.querySelector( '#in-serving' );\n\n inQueueSwitch.addEventListener( 'click', function() {\n if ( inServingSwitch.classList.contains('active') ) {\n inServingSwitch.classList.remove( 'active' );\n inServingContainer.classList.remove( 'active' );\n inQueueSwitch.classList.add( 'active' );\n inQueueContainer.classList.add( 'active' );\n }\n });\n inServingSwitch.addEventListener( 'click', function() {\n if ( inQueueSwitch.classList.contains('active') ) {\n inQueueSwitch.classList.remove( 'active' );\n inQueueContainer.classList.remove( 'active' );\n inServingSwitch.classList.add( 'active' );\n inServingContainer.classList.add( 'active' );\n }\n });\n}", "begin() {\n //for (let [, arr] of this.arrangements.filter(a => a.at === this.iterations && a.when === \"start\")) arr.exe();\n this.engine.phases.current = this;\n this.engine.events.emit(this.name, this);\n }", "function startTap(print){\n\treset(print);\n\n\tvar ans = downFlow(springCoord.x,springCoord.y,dir[\"down\"]);\n\tvar ans2 = document.getElementsByClassName(\"stable\").length;\n\tdocument.getElementById(\"out_data\").innerHTML = \"Answer (tap constantly on): \"+ans;\n\tdocument.getElementById(\"out_data\").innerHTML += \"<br>Answer (tap turns off): \"+ans2;\n}", "function startCircuitSw() {\n //findbest route\n totalMessageTime = ((MsgLength / TransRate) + TransDelay) * 1000;\n totalSwitchTime = totalMessageTime + CircSetupTime;\n for (let index = 0; index < SndRecArray.length; index++) {\n const pair = SndRecArray[index];\n\n if (index == 0) {\n startIndSw(pair);\n }\n else {\n setTimeout(() => { startIndSw(pair) }, totalSwitchTime * index);\n }\n\n }\n}", "transitionToRemap() {\n if (this.tick <= 50) {\n this.tutorial.alpha -= 0.02;\n this.fireToContinue.alpha -= 0.02;\n }\n else if (this.tick <= 100) {\n this.remapHeaderText.alpha += 0.02;\n this.remapKB.alpha += 0.02;\n this.remapButtonText.alpha += 0.02;\n }\n else {\n this.state = 4;\n this.tick = 0;\n this.remapPressText.alpha = 1;\n }\n }", "nextPhaseBtnState (phase) {\n if (\n THIS.view.currentPlayer.name == THIS.currentUserName &&\n THIS.currentPhase != phase\n ) {\n THIS.btnState = true\n THIS.currentPhase = phase\n } else {\n THIS.btnState = false\n }\n }", "act(state){\n\n }", "function callHeater(){\n\tif(step_no == 2){\n\t\tstep_no++;\t\n\t\t$(\"#heater_arrow\").hide();\t// Hide arrow pointing to heater\n\t\t$(\"#heater_txt\").hide();\t// Hide text regarding heater\n\t\t$(\"#stir_txt\").show();\t\t// Show text regarding the stirrer\n\t\t$(\"#stir_arrow\").show();\t// Show arrow pointing to the stirrer button\n\t\t$(\"#change\").html(\"Click on the Stirrer Switch to turn the Magnetic Stirrer On..\");\n\t\tremovePointer(heater_button);\t// Remove pointer from heater button\n\t\taddPointer(stir_button);\t// Add pointer to the stir button\n\t}\n}", "step(action){\r\n\r\n }", "toggle4() {\r\n }", "async pin_enable(state) { throw Error('Virtual function'); }", "step() {\n }", "update() {\n\n //CAN LNAV EVEN RUN?\n this._activeWaypoint = this.flightplan.waypoints[this.flightplan.activeWaypointIndex];\n this._previousWaypoint = this.flightplan.waypoints[this.flightplan.activeWaypointIndex - 1];\n const navModeActive = SimVar.GetSimVarValue(\"L:WT_CJ4_NAV_ON\", \"number\") == 1;\n this._inhibitSequence = SimVar.GetSimVarValue(\"L:WT_CJ4_INHIBIT_SEQUENCE\", \"number\") == 1;\n\n if (this._activeWaypoint && this._activeWaypoint.hasHold && this._holdsDirector.isReadyOrEntering(this.flightplan.activeWaypointIndex)) {\n this._holdsDirector.update(this.flightplan.activeWaypointIndex);\n }\n else if (this._previousWaypoint && this._previousWaypoint.hasHold && !this._holdsDirector.isHoldExited(this.flightplan.activeWaypointIndex - 1)) {\n this._holdsDirector.update(this.flightplan.activeWaypointIndex - 1);\n }\n\n if (this._holdsDirector.state !== HoldsDirectorState.NONE && this._holdsDirector.state !== HoldsDirectorState.EXITED) {\n return;\n }\n\n const flightPlanVersion = SimVar.GetSimVarValue('L:WT.FlightPlan.Version', 'number');\n if (flightPlanVersion !== this._currentFlightPlanVersion) {\n if (this._waypointSequenced) {\n this._waypointSequenced = false;\n }\n else {\n this._isTurnCompleting = false;\n this._executeInhibited = false;\n }\n\n this._currentFlightPlanVersion = flightPlanVersion;\n }\n\n //CHECK IF DISCO/VECTORS\n if (this._onDiscontinuity) {\n if (!this._activeWaypoint.endsInDiscontinuity) {\n SimVar.SetSimVarValue(\"L:WT_CJ4_IN_DISCONTINUITY\", \"number\", 0);\n this._onDiscontinuity = false;\n }\n else if (navModeActive) {\n this.deactivate();\n }\n }\n\n\n\n this._planePos = new LatLon(SimVar.GetSimVarValue(\"GPS POSITION LAT\", \"degree latitude\"), SimVar.GetSimVarValue(\"GPS POSITION LON\", \"degree longitude\"));\n const planePosLatLong = new LatLong(this._planePos.lat, this._planePos.lon);\n\n const navSensitivity = this.getNavSensitivity(planePosLatLong);\n SimVar.SetSimVarValue('L:WT_NAV_SENSITIVITY', 'number', navSensitivity);\n\n const navSensitivityScalar = this.getNavSensitivityScalar(planePosLatLong, navSensitivity);\n SimVar.SetSimVarValue('L:WT_NAV_SENSITIVITY_SCALAR', 'number', navSensitivityScalar);\n\n if (!this._onDiscontinuity && this.waypoints.length > 0 && this._activeWaypoint && this._previousWaypoint) {\n this._lnavDeactivated = false;\n\n //LNAV CAN RUN, UPDATE DATA\n this._groundSpeed = SimVar.GetSimVarValue(\"GPS GROUND SPEED\", \"knots\");\n const airspeedTrue = SimVar.GetSimVarValue('AIRSPEED TRUE', 'knots');\n const planeHeading = SimVar.GetSimVarValue('PLANE HEADING DEGREES TRUE', 'Radians') * Avionics.Utils.RAD2DEG;\n\n this._activeWaypointDist = Avionics.Utils.computeGreatCircleDistance(planePosLatLong, this._activeWaypoint.infos.coordinates);\n this._previousWaypointDist = Avionics.Utils.computeGreatCircleDistance(planePosLatLong, this._previousWaypoint.infos.coordinates);\n this._bearingToWaypoint = Avionics.Utils.computeGreatCircleHeading(planePosLatLong, this._activeWaypoint.infos.coordinates);\n\n const prevWptPos = new LatLon(this._previousWaypoint.infos.coordinates.lat, this._previousWaypoint.infos.coordinates.long);\n const nextWptPos = new LatLon(this._activeWaypoint.infos.coordinates.lat, this._activeWaypoint.infos.coordinates.long);\n\n //CASE WHERE WAYPOINTS OVERLAP\n if (prevWptPos.distanceTo(nextWptPos) < 50) {\n this._fpm.setActiveWaypointIndex(this.flightplan.activeWaypointIndex + 1, EmptyCallback.Void, 0);\n return;\n }\n\n this._xtk = this._planePos.crossTrackDistanceTo(prevWptPos, nextWptPos) * (0.000539957); //meters to NM conversion\n this._dtk = AutopilotMath.desiredTrack(this._previousWaypoint.infos.coordinates, this._activeWaypoint.infos.coordinates, new LatLongAlt(this._planePos.lat, this._planePos.lon));\n const correctedDtk = this.normalizeCourse(GeoMath.correctMagvar(this._dtk, SimVar.GetSimVarValue(\"MAGVAR\", \"degrees\")));\n\n SimVar.SetSimVarValue(\"L:WT_CJ4_XTK\", \"number\", this._xtk);\n SimVar.SetSimVarValue(\"L:WT_CJ4_DTK\", \"number\", correctedDtk);\n SimVar.SetSimVarValue(\"L:WT_CJ4_WPT_DISTANCE\", \"number\", this._activeWaypointDist);\n\n const nextActiveWaypoint = this.flightplan.waypoints[this.flightplan.activeWaypointIndex + 1];\n\n //Remove heading instruction inhibition when near desired track\n const windCorrectedDtk = this.normalizeCourse(this._dtk - this.calculateWindCorrection(this._dtk, airspeedTrue));\n if (Math.abs(Avionics.Utils.angleDiff(windCorrectedDtk, planeHeading)) < 25) { //CWB adjusted from 15 to 25 to reduce the oversteer\n this._isTurnCompleting = false;\n this._executeInhibited = false;\n }\n\n this._setHeading = this._dtk;\n const interceptAngle = this.calculateDesiredInterceptAngle(this._xtk, navSensitivity);\n\n let deltaAngle = Avionics.Utils.angleDiff(this._dtk, this._bearingToWaypoint);\n this._setHeading = this.normalizeCourse(this._dtk + interceptAngle);\n\n let isLandingRunway = false;\n if (this.flightplan.activeWaypointIndex == this.flightplan.length - 2 && this._activeWaypoint.isRunway) {\n isLandingRunway = true;\n }\n\n //CASE WHERE WE ARE PASSED THE WAYPOINT AND SHOULD SEQUENCE THE NEXT WPT\n if (!this._activeWaypoint.endsInDiscontinuity && Math.abs(deltaAngle) >= 90 && this._groundSpeed > 10 && !isLandingRunway) {\n this._setHeading = this._dtk;\n if (!this._inhibitSequence) {\n this._fpm.setActiveWaypointIndex(this.flightplan.activeWaypointIndex + 1, EmptyCallback.Void, 0);\n SimVar.SetSimVarValue('L:WT_CJ4_WPT_ALERT', 'number', 0);\n this._isWaypointAlerting = false;\n this._waypointSequenced = true;\n\n this._isTurnCompleting = false;\n this._executeInhibited = false;\n\n this._nextTurnHeading = this._setHeading;\n this.execute();\n this._isTurnCompleting = true;\n } else {\n const planeHeading = SimVar.GetSimVarValue('PLANE HEADING DEGREES MAGNETIC', 'Radians') * Avionics.Utils.RAD2DEG;\n this._setHeading = planeHeading;\n this.execute();\n }\n return;\n }\n //CASE WHERE INTERCEPT ANGLE IS NOT BIG ENOUGH AND INTERCEPT NEEDS TO BE SET TO BEARING\n else if (Math.abs(deltaAngle) > Math.abs(interceptAngle)) {\n this._setHeading = this._bearingToWaypoint;\n }\n\n //TURN ANTICIPATION & TURN WAYPOINT SWITCHING\n const turnRadius = Math.pow(this._groundSpeed / 60, 2) / 9;\n const maxAnticipationDistance = SimVar.GetSimVarValue('AIRSPEED TRUE', 'Knots') < 350 ? 7 : 10;\n\n if (!isLandingRunway && !this._inhibitSequence && this._activeWaypoint && !this._activeWaypoint.endsInDiscontinuity && nextActiveWaypoint && this._activeWaypointDist <= maxAnticipationDistance && this._groundSpeed < 700) {\n\n let toCurrentFixHeading = Avionics.Utils.computeGreatCircleHeading(new LatLongAlt(this._planePos._lat, this._planePos._lon), this._activeWaypoint.infos.coordinates);\n let toNextFixHeading = Avionics.Utils.computeGreatCircleHeading(this._activeWaypoint.infos.coordinates, nextActiveWaypoint.infos.coordinates);\n\n let nextFixTurnAngle = Avionics.Utils.angleDiff(this._dtk, toNextFixHeading);\n let currentFixTurnAngle = Avionics.Utils.angleDiff(planeHeading, toCurrentFixHeading);\n\n let enterBankDistance = (this._groundSpeed / 3600) * 5;\n\n const getDistanceToActivate = turnAngle => Math.min((turnRadius * Math.tan((Math.abs(Math.min(110, turnAngle) * Avionics.Utils.DEG2RAD) / 2))) + enterBankDistance, maxAnticipationDistance);\n\n let activateDistance = Math.max(getDistanceToActivate(Math.abs(nextFixTurnAngle)), getDistanceToActivate(Math.abs(currentFixTurnAngle)));\n let alertDistance = activateDistance + (this._groundSpeed / 3600) * 5; //Alert approximately 5 seconds prior to waypoint change\n\n if (this._activeWaypointDist <= alertDistance) {\n SimVar.SetSimVarValue('L:WT_CJ4_WPT_ALERT', 'number', 1);\n this._isWaypointAlerting = true;\n }\n // console.log(\"d/a/ta: \" + this._activeWaypointDist.toFixed(2) + \"/\" + activateDistance.toFixed(2) + \"/\" + Math.abs(currentFixTurnAngle).toFixed(2) + \"/\" + this._activeWaypoint.ident);\n\n if (this._activeWaypointDist <= activateDistance && this._groundSpeed > 10) { //TIME TO START TURN\n // console.log(\"ACTIVATE \" + this._activeWaypoint.ident);\n this._setHeading = toNextFixHeading;\n this._fpm.setActiveWaypointIndex(this.flightplan.activeWaypointIndex + 1, EmptyCallback.Void, 0);\n\n SimVar.SetSimVarValue('L:WT_CJ4_WPT_ALERT', 'number', 0);\n this._isWaypointAlerting = false;\n this._waypointSequenced = true;\n\n this._isTurnCompleting = false;\n this._executeInhibited = false;\n\n this._nextTurnHeading = this._setHeading;\n this.execute();\n this._isTurnCompleting = true; //Prevent heading changes until turn is near completion\n\n return;\n }\n } else if (isLandingRunway && this._activeWaypointDist < 0.1) {\n\n this._setHeading = this._dtk;\n SimVar.SetSimVarValue(\"L:WT_CJ4_INHIBIT_SEQUENCE\", \"number\", 1);\n this.execute();\n return;\n }\n\n //DISCONTINUITIES\n if (this._activeWaypoint.endsInDiscontinuity) {\n let alertDisco = this._activeWaypointDist < (this._groundSpeed / 3600) * 120;\n SimVar.SetSimVarValue(\"L:WT_CJ4_IN_DISCONTINUITY\", \"number\", alertDisco ? 1 : 0);\n if (alertDisco === 1) {\n MessageService.getInstance().post(FMS_MESSAGE_ID.FPLN_DISCO, () => {\n return SimVar.GetSimVarValue(\"L:WT_CJ4_IN_DISCONTINUITY\", \"number\") === 0;\n });\n }\n if (this._activeWaypointDist < 0.25) {\n this._setHeading = this._dtk;\n this.executeDiscontinuity();\n return;\n }\n } else {\n SimVar.SetSimVarValue(\"L:WT_CJ4_IN_DISCONTINUITY\", \"number\", 0);\n }\n\n //NEAR WAYPOINT TRACKING\n if (navModeActive && this._activeWaypointDist < 1.0 && !this._isWaypointAlerting) { //WHEN NOT MUCH TURN, STOP CHASING DTK CLOSE TO WAYPOINT\n this._setHeading = this._bearingToWaypoint;\n this._executeInhibited = true;\n }\n this.execute();\n }\n else {\n if (!this._lnavDeactivated) {\n this.deactivate();\n }\n }\n }", "_makeSwap(e) {\n console.log(this, e);\n this._deactivateCurrent(e.path[0]);\n this._activateClicked(e.path[0]);\n }", "function map_trans_wis() {\n current_background = Graphics[\"background2\"];\n actors.push( new BigText(\"Level 1 Complete\") );\n actors.push( new SubText(\"Hmmm... Gurnok must be close.\", 330) );\n actors.push( new Continue(\"Click to continue!\", map_wizard1) );\n }", "function nextAssistState () {\n\tswitch (assistInfo.state) {\n\t\tcase 'intro':\n\t\t\tassistInfo.curGame = curGame; //temporary\n\t\t\tloadAssistState('chooseOrder');\n\t\t\tbreak;\n\t\tcase 'chooseOrder':\n\t\t\tassistInfo.board = getValue('assistStageSelect'); //todo: should probably also be moved\n\t\t\tloadAssistState('turn');\n\t\t\tbreak;\n\t\tcase 'turn':\n\t\t\t//loadAssistState('minigame');\n\t\t\tbreak;\n\t}\n}", "function Behold(){}", "activate() {\n this.active = true;\n }", "changeState(leftBoarderDistance, downDistance, board, bS, next) {\n let distanceB = Math.round(downDistance / blockSize); // Distance in blocks to bottom border\n let distance = (Math.round(leftBoarderDistance / blockSize)); // Distance in blocks to left border\n if (this.calc == false) {\n if (this.check(leftBoarderDistance, downDistance, board, bS, next) == false) {\n return;\n }\n }\n switch (this.blockNumber) { // Switch depending on block\n case 1: {\n switch (this.state) { //Check state\n case 1: {\n if (distance < 5) {\n for (let i = 0; i < this.res.children.length; i++) {\n this.res.children[i].y = 3 * blockSize;\n this.res.children[i].x = (i) * blockSize;\n }\n }\n else {\n for (let i = 0; i < this.res.children.length; i++) {\n this.res.children[i].y = 3 * blockSize;\n this.res.children[i].x = (i - 3) * blockSize;\n }\n }\n this.state = 2;\n break;\n }\n case 2: {\n if (distance < 5) {\n for (let i = 0; i < this.res.children.length; i++) {\n this.res.children[i].x = 0;\n this.res.children[i].y = blockSize * i;\n }\n }\n else {\n for (let i = 0; i < this.res.children.length; i++) {\n this.res.children[i].x = 0;\n this.res.children[i].y = blockSize * i;\n }\n }\n this.state = 1;\n break;\n }\n }\n }\n case 2: {\n break;\n }\n case 3: {\n // Variable holding next/previous state, we don't want to change main variable until we change the state\n let state = this.stateChanger(next);\n switch (state) {\n case 1: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize * i;\n this.res.children[i].x = 0;\n }\n else {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = blockSize * (i - 1);\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 2: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = 0;\n this.res.children[i].x = blockSize * (i + 1);\n }\n else {\n this.res.children[i].y = blockSize * (i - 1);\n this.res.children[i].x = blockSize;\n }\n }\n if (next) {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 3: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = blockSize * i;\n }\n else {\n this.res.children[i].y = blockSize * (i - 1);\n this.res.children[i].x = blockSize * 2;\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n this.state = state;\n break;\n }\n case 4: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize * 2;\n this.res.children[i].x = blockSize * i;\n }\n else {\n this.res.children[i].y = blockSize * (i - 2);\n this.res.children[i].x = blockSize;\n }\n }\n if (!next) {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n }\n break;\n }\n case 4: {\n // Variable holding next/previous state, we don't want to change main variable until we change the state\n let state = this.stateChanger(next);\n switch (state) {\n case 1: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i == 0) {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = 0;\n }\n else {\n this.res.children[i].y = (i - 1) * blockSize;\n this.res.children[i].x = blockSize;\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n else {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 2: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i == 0) {\n this.res.children[i].y = 0;\n this.res.children[i].x = blockSize;\n }\n else {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = (i - 1) * blockSize;\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 3: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i == 0) {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = 2 * blockSize;\n }\n else {\n this.res.children[i].y = (i - 1) * blockSize;\n this.res.children[i].x = blockSize;\n }\n }\n if (next) {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n this.state = state;\n break;\n }\n case 4: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 3) {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = i * blockSize;\n }\n else {\n this.res.children[i].y = 2 * blockSize;\n this.res.children[i].x = blockSize;\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n this.state = state;\n break;\n }\n }\n break;\n }\n case 5: {\n // Variable holding next/previous state, we don't want to change main variable until we change the state\n let state = this.stateChanger(next);\n switch (state) {\n case 1: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = blockSize * i;\n }\n else {\n this.res.children[i].y = 0;\n this.res.children[i].x = blockSize * (i - 1);\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 2: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize * i;\n this.res.children[i].x = blockSize;\n }\n else {\n this.res.children[i].y = blockSize * (i - 1);\n this.res.children[i].x = blockSize * 2;\n }\n }\n if (next) {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 3: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize * 2;\n this.res.children[i].x = blockSize * i;\n }\n else {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = blockSize * (i - 1);\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n this.state = state;\n break;\n }\n case 4: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize * i;\n this.res.children[i].x = 0;\n }\n else {\n this.res.children[i].y = blockSize * (i - 1);\n this.res.children[i].x = blockSize;\n }\n }\n if (!next) {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n }\n break;\n }\n case 6: {\n // Variable holding next/previous state, we don't want to change main variable until we change the state\n let state = this.stateChanger(next);\n switch (state) {\n case 1: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 3) {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = blockSize * i;\n }\n else {\n this.res.children[i].y = 0;\n this.res.children[i].x = blockSize * (i - 1);\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 2: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 3) {\n this.res.children[i].y = blockSize * i;\n this.res.children[i].x = blockSize;\n }\n else {\n this.res.children[i].y = blockSize * 2;\n this.res.children[i].x = blockSize * 2;\n }\n }\n if (next) {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 3: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 3) {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = blockSize * i;\n }\n else {\n this.res.children[i].y = blockSize * 2;\n this.res.children[i].x = 0;\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n this.state = state;\n break;\n }\n case 4: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 3) {\n this.res.children[i].y = blockSize * i;\n this.res.children[i].x = blockSize;\n }\n else {\n this.res.children[i].y = 0;\n this.res.children[i].x = 0;\n }\n }\n if (!next) {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n }\n break;\n }\n case 7: {\n let state = this.stateChanger(next);\n switch (state) {\n case 1: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = 0;\n this.res.children[i].x = blockSize * i;\n }\n else {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = blockSize * (i - 1);\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 2: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize * (i + 1);\n this.res.children[i].x = blockSize;\n }\n else {\n this.res.children[i].y = blockSize * (i - 2);\n this.res.children[i].x = blockSize * 2;\n }\n }\n if (next) {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n case 3: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize;\n this.res.children[i].x = blockSize * i;\n }\n else {\n this.res.children[i].y = blockSize * 2;\n this.res.children[i].x = blockSize * (i - 1);\n }\n }\n if (next) {\n this.res.x += blockSize * (distance == 0 ? 1 : 0);\n }\n else {\n this.res.x += blockSize * (distance == 8 ? -1 : 0);\n }\n this.state = state;\n break;\n }\n case 4: {\n for (let i = 0; i < this.res.children.length; i++) {\n if (i < 2) {\n this.res.children[i].y = blockSize * (i + 1);\n this.res.children[i].x = 0;\n }\n else {\n this.res.children[i].y = blockSize * (i - 2);\n this.res.children[i].x = blockSize;\n }\n }\n if (!next) {\n this.res.y -= blockSize * (distanceB == 0 ? 1 : 0);\n }\n this.state = state;\n break;\n }\n }\n break;\n }\n }\n }", "engage() {\n\n this.value = this.incomingSignal;\n this.incomingSignal = 0;\n\n //bias is always 1.\n if (this.type == 'b') {\n this.value = 1;\n }\n }", "function enteric_fermentation(){\n a_FAO_i='enteric_fermentation';\n initializing_change();\n change();\n}", "function setTarget() {\n step_target=100;\n step_direction=step_direction*-1;\n step_number=0;\n\n// step_off();\n console.log(\"Interval Start\");\n}", "reverseActivate(target) {\n\t \tconst hexagon = this.hexagonList.get(IDToKey(target));\n\t \tconst targetUnit = hexagon.getUnit();\n\t \ttargetUnit.resetActivation();\n\t}", "function v5(pong,side=\"right\"){\n\n var myNetwork = new synaptic.Architect.Perceptron(5, 20, 2);\n // var trainer = new synaptic.Trainer(myNetwork)\n var cpt = 0;\n var ball = pong.ball;\n var paddle = pong[side+\"Paddle\"];\n\n var target,output,position,pt;\n\n var middle = pong.cfg.height/2;\n\n var i = setInterval(function(){\n\n output = myNetwork.activate( getInputs( ball,paddle ) );\n\n position = paddle.y + paddle.height/2;\n\n pt = predictbis(ball,side);\n\n if (!pt) {\n pt = {\n y : middle\n }\n }\n\n target = [\n pt.y > position ? 1 : 0,\n pt.y < position ? 1 : 0\n ];\n myNetwork.propagate(1, target);\n\n move(output,paddle)\n\n\n },10);\n\n\n}", "function init() {\r\n //If we pressed the rest button mid Ai thinking, stop it.\r\n clearTimeout(aiDelay);\r\n state.phase = 'setup';\r\n state.shipPrimed = null;\r\n state.orientation = null;\r\n state.turn = 1;\r\n for (row=0; row < 10; row++) {\r\n for(col=0; col < 10; col++) {\r\n playerCoordinateEl[row][col].className = '';\r\n opponentCoordinateEl[row][col].className = '';\r\n }\r\n }\r\n for (let ship in playerShipState) {\r\n playerShipState[ship].orientation = 'horizontal';\r\n playerShipState[ship].health.fill(0);\r\n playerShipState[ship].coordinate = [null, null];\r\n playerShipState[ship].counter = 1;\r\n if (playerBoardContainerEl.contains(playerShipState[ship].attachedImage)) {\r\n playerShipState[ship].attachedImage.parentNode.removeChild(playerShipState[ship].attachedImage);\r\n }\r\n }\r\n for (let ship in enemyShipState) {\r\n enemyShipState[ship].orientation = 'horizontal';\r\n enemyShipState[ship].health.fill(0);\r\n enemyShipState[ship].coordinate = [null, null];\r\n enemyShipState[ship].counter = 1;\r\n if (opponentBoardContainerEl.contains(enemyShipState[ship].attachedImage)) {\r\n enemyShipState[ship].attachedImage.parentNode.removeChild(enemyShipState[ship].attachedImage);\r\n }\r\n }\r\n readyEl.textContent = 'Ready?';\r\n //Reset the styling for the ships at port.\r\n portEl.querySelectorAll('img').forEach((element) => {\r\n element.classList.remove('unavailable');\r\n })\r\n render();\r\n}", "function firstPhase(distance){\n if(distance < 0){\n return\n }\n if(distance >= PLANTING_PHASE_STEPS){\n phaseBottomElements.forEach(item => item.classList.add('step-1'))\n phaseTopElements.forEach(item => item.classList.add('step-1'))\n }else{\n phaseBottomElements.forEach(item => item.classList.remove('step-1'))\n phaseTopElements.forEach(item => item.classList.remove('step-1'))\n }\n return distance - PLANTING_PHASE_STEPS\n}", "onBaseFramePreselection(params) {\n let siblingInteractables = [];\n let baseFrame = this.vLab.SceneDispatcher.currentVLabScene.interactables['baseFrame'];\n baseFrame.siblings.forEach((siblingInteractable) => {\n siblingInteractables.push(siblingInteractable);\n });\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['bodyFrame']);\n\n\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['torsoFrame']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['headYawLink']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['headTiltLink']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['headFrame']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['kinectHead']);\n\n\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['shoulderFrameR']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['armR']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['limbLinkR']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['forearmRollLinkR']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['forearmFrameR']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['palmTiltR']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['palmR']);\n\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger0P1R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger0P2R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger0P3R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger1P1R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger1P2R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger1P3R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger2P1R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger2P2R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger2P3R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger3P1R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger3P2R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger3P3R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger4P1R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger4P2R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger4P3R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger5P1R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger5P2R']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger5P3R']);\n\n\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['shoulderFrameL']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['armL']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['limbLinkL']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['forearmRollLinkL']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['forearmFrameL']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['palmTiltL']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['palmL']);\n\n\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger0P1L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger0P2L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger0P3L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger1P1L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger1P2L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger1P3L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger2P1L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger2P2L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger2P3L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger3P1L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger3P2L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger3P3L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger4P1L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger4P2L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger4P3L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger5P1L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger5P2L']);\n siblingInteractables.push(this.vLab.SceneDispatcher.currentVLabScene.interactables['finger5P3L']);\n\n siblingInteractables.forEach((siblingInteractable) => {\n siblingInteractable.keepPreselection = true;\n siblingInteractable.preselect(true);\n });\n }", "function handleSwitch() {\n setswitchst(prev=>!prev);\n }", "function activatePhase() {\n currentPhase = \"Activate\";\n turns++;\n alert(\"Turn \" + turns + \"!\");\n monstersHaveEvolved = [0,0,0,0,0];\n if (monstersRolled.indexOf(1) === -1) {\n for (let i = 0; i < 5; i++) {\n if (monstersRolled[i] === 1) {\n console.log(i);\n }\n }\n }\n }", "function land_use(){\n a_FAO_i='land_use';\n initializing_change();\n change();\n}", "function flow(flowName, states, beginArgs) {\n var name = flowName;\n var activePhases = {};\n var flowStatus = \"created\";\n var statesRegister = {};\n var joinsRegister = {};\n var self = this;\n var currentPhase = undefined;\n var states = states;\n\n function attachStatesToFlow(states) {\n\n function registerState(state) {\n function wrapUpdates(stateName) {\n\n var dynamicMotivation = undefined;\n\n function WHYDynamicResolver() {\n function toBeExecutedWithWHY() {\n var parentPhase = currentPhase;\n currentPhase = stateName;\n registerNewFunctionCall(stateName);\n var ret = states[stateName].apply(self, mkArgs(arguments, 0));\n makePhaseUpdatesAfterCall(stateName);\n currentPhase = parentPhase;\n return ret;\n }\n\n toBeExecutedWithWHY.why = dummyWhy;\n return addErrorTreatment(toBeExecutedWithWHY.why(decideMotivation(self, state))).apply(self, mkArgs(arguments, 0))\n }\n\n function decideMotivation(flow, stateName) {\n if (dynamicMotivation === undefined) {\n if (flow.getCurrentPhase()) {\n motivation = flow.getCurrentPhase() + \" to \" + stateName;\n } else {\n motivation = stateName;\n }\n } else {\n motivation = dynamicMotivation;\n }\n dynamicMotivation = undefined;\n return motivation;\n }\n\n WHYDynamicResolver.why = function (motivation) {\n dynamicMotivation = motivation;\n return this;\n }\n return WHYDynamicResolver;\n }\n\n statesRegister[state] = {\n code: states[state],\n joins: []\n }\n\n self[state] = wrapUpdates(state);\n }\n\n function registerJoin(join) {\n joinsRegister[join] = {\n code: states[join].code,\n inputStates: {},\n tryOnNextTick: false\n }\n\n var inStates = states[state].join.split(',');\n inStates.forEach(function (input) {\n input = input.trim();\n joinsRegister[join].inputStates[input] = {\n calls: 0,\n finishedCalls: 0\n };\n })\n\n }\n\n function joinStates() {\n for (var join in joinsRegister) {\n for (var inputState in joinsRegister[join].inputStates) {\n statesRegister[inputState].joins.push(join);\n }\n }\n }\n\n self.error = function (error) {\n if (error) {\n var motivation = currentPhase + \" failed\";\n if (states['error'] !== undefined) {\n states['error'].why = dummyWhy;\n states['error'].why(motivation).apply(self, [error]);\n }\n else {\n function defaultErrorWHY(error) {\n if (error) {\n console.error(self.getCurrentPhase() + \" failed\");\n console.log(error.stack);\n }\n }\n\n defaultErrorWHY.why = dummyWhy;\n\n defaultErrorWHY.why(motivation)(error);\n }\n }\n }\n\n for (var state in states) {\n\n if (state == \"error\") {\n continue;\n }\n\n if (typeof states[state] === \"function\") {\n registerState(state);\n }\n else {\n registerJoin(state);\n }\n }\n joinStates();\n }\n\n this.next = function () {\n process.nextTick(this.continue.apply(this, mkArgs(arguments, 0)));\n }\n\n function registerNewFunctionCall(stateName) {\n\n updateStatusBeforeCall(stateName);\n notifyJoinsOfNewCall(stateName);\n\n function notifyJoinsOfNewCall(stateName) {\n statesRegister[stateName].joins.forEach(function (join) {\n joinsRegister[join].inputStates[stateName]['calls']++\n });\n }\n }\n\n this.getStatus = function () {\n return flowStatus;\n };\n this.getCurrentPhase = function () {\n return currentPhase;\n }\n this.getActivePhases = function () {\n return activePhases;\n };\n this.getName = function () {\n return name;\n }\n\n function updateStatusBeforeCall(stateName) {\n if (activePhases[stateName] == undefined) {\n activePhases[stateName] = 1;\n } else {\n activePhases[stateName]++;\n }\n }\n\n function updateStatusAfterCall(stateName) {\n activePhases[stateName]--;\n\n if (activePhases[stateName] === 0) {\n var done = true;\n for (var phase in activePhases) {\n if (activePhases[phase] > 0) {\n done = false;\n break;\n }\n }\n if (done) {\n flowStatus = \"done\";\n }\n }\n }\n\n function makePhaseUpdatesAfterCall(stateName) {\n updateJoinsAfterCall(stateName);\n updateStatusAfterCall(stateName);\n\n function updateJoinsAfterCall(stateName) {\n statesRegister[stateName].joins.forEach(function (joinName) {\n joinsRegister[joinName].inputStates[stateName]['finishedCalls']++;\n if (joinsRegister[joinName]['tryOnNextTick'] === false) {\n joinsRegister[joinName]['tryOnNextTick'] = true;\n var caller = null;\n try {\n if (global.__global__enable_RUN_WITH_WHYS) {\n caller = whys.getGlobalCurrentContext().currentRunningItem;\n }\n } catch (err) {\n }\n ; //TODO: strange, refactoring\n updateStatusBeforeCall(joinName);\n var parentPhase = self.getCurrentPhase();\n process.nextTick(function () {\n tryRunningJoin(joinName, caller, parentPhase);\n updateStatusAfterCall(joinName);\n })\n }\n });\n\n\n function tryRunningJoin(joinName, caller, parentPhase) {\n\n joinsRegister[joinName]['tryOnNextTick'] = false;\n\n function joinReady(joinName) {\n var join = joinsRegister[joinName];\n var gotAllInputs = true;\n for (var inputState in join.inputStates) {\n if (join.inputStates[inputState]['finishedCalls'] == 0) {\n gotAllInputs = false;\n break;\n }\n if (join.inputStates[inputState]['finishedCalls'] != join.inputStates[inputState]['calls']) {\n gotAllInputs = false;\n break;\n }\n }\n return gotAllInputs;\n }\n\n async function runJoin(joinName) {\n var currentPhase = joinName;\n updateStatusBeforeCall(joinName);\n reinitializeJoin(joinName);\n await joinsRegister[joinName].code.apply(self, []);\n updateStatusAfterCall(joinName);\n currentPhase = parentPhase;\n\n function reinitializeJoin(joinName) {\n for (var inputState in joinsRegister[joinName].inputStates) {\n joinsRegister[joinName].inputStates = {\n calls: 0,\n finishedCalls: 0\n }\n }\n }\n }\n\n runJoin.why = dummyWhy;\n\n if (joinReady(joinName)) {\n var toRun = runJoin.why(decideMotivation(self, joinName, joinName), caller);\n toRun = addErrorTreatment(toRun);\n toRun(joinName);\n }\n\n function decideMotivation(flow, joinName, stateName) {\n return parentPhase + \" to \" + joinName;\n }\n\n }\n }\n }\n\n\n this.continue = function () {\n var stateName = arguments[0];\n var motivation = arguments[1];\n\n if (!motivation) {\n motivation = self.getCurrentPhase() + \" to \" + stateName;\n }\n var args = mkArgs(arguments, 2);\n registerNewFunctionCall(stateName);\n\n var continueFn = async function () {\n currentPhase = stateName;\n\n if (args.length == 0) {\n args = mkArgs(arguments, 0)\n }\n await statesRegister[stateName].code.apply(self, args);\n makePhaseUpdatesAfterCall(stateName);\n };\n continueFn.why = dummyWhy;\n\n return addErrorTreatment(continueFn.why(motivation));\n };\n\n function addErrorTreatment(func) {\n async function flowErrorTreatmentWHY() {\n try {\n return await func.apply(this, mkArgs(arguments, 0));\n }\n catch (error) {\n flowStatus = \"failed\";\n return self.error(error);\n }\n }\n\n return flowErrorTreatmentWHY;\n }\n\n\n attachStatesToFlow(states);\n flowStatus = \"running\";\n\n function startFlow() {\n self.begin.apply(this, beginArgs);\n }\n\n startFlow.why = dummyWhy;\n startFlow.why(flowName)();\n return this;\n}", "async toggle_cpu_pin(port, bit) {\n try {\n\t let cmd_index; // map port/bit to cmd_index\n\t if (port==\"A\") {\n switch (bit) {\n case 0: cmd_index=0; break;\n case 2: cmd_index=1; break;\n case 3: cmd_index=2; break;\n\t }\n\t } else {\n\t cmd_index = 3; \n\t }\n\n this.log(`Toggling Programmer Port ${port} bit ${bit}...\\n`, \"blue\");\n await this.at_verify(\"AFCIO\", /^Done/, cmd_index);\n this.log(`P${port}${bit} was toggled.\\n`, \"blue\");\n } catch (e) {\n this.log(\"error: failed to toggle bit.\\n\", \"red\");\n console.error(e);\n }\n }", "addPreActivateStep(step) {\r\n return this.addPipelineStep(\"preActivate\" /* PreActivate */, step);\r\n }", "changeMode() {\n this.attendBooths = !this.attendBooths;\n }", "stateTransition(){return}", "function manualController(pin, state) {\n if (state === false) {\n securityState(false);\n switch (pin) {\n case Config.elevator.Up.PIN:\n that.Log.WriteLog(\"Elevador subiendo de forma manual\", ci_syslog_1.Logger.Severities.Debug);\n that.mcp2.digitalWrite(Config.MCP_Motor.UP.value, that.mcp2.HIGH);\n that.stateMachine.motorState = 1;\n that.emit(\"Sensor\", { cmd: \"machine\", data: \"Motor Start Up by Control Board\" });\n break;\n case Config.elevator.Down.PIN:\n that.Log.WriteLog(\"Elevador bajando de forma manual\", ci_syslog_1.Logger.Severities.Debug);\n that.mcp2.digitalWrite(Config.MCP_Motor.Down.value, that.mcp2.HIGH);\n that.stateMachine.motorState = 2;\n that.emit(\"Sensor\", { cmd: \"machine\", data: \"Motor Start Down by Control Board\" });\n break;\n case Config.general.Stop.PIN:\n that.Log.WriteLog(\"Pines detenidos por Controladora\", ci_syslog_1.Logger.Severities.Debug);\n stopAll(null);\n that.stateMachine.motorState = 0;\n break;\n }\n }\n else {\n that.Log.WriteLog(\"Elevador se detuvo de forma manual\", ci_syslog_1.Logger.Severities.Debug);\n that.motorStop(null,()=>{});\n that.emit(\"Sensor\", { cmd: \"machine\", data: \"Motor Stop Up by Control Board\" });\n securityState(true);\n }\n }", "start() {\r\n\r\n switch (this._stage) {\r\n // ? STAGE FOR TRANSFORM MAP\r\n case 0: {\r\n // STAGE ZERO\r\n this.displayMessage(\"Rotate/Resize House Map for best fit\", \"danger\");\r\n let stageZero = new StageZero();\r\n stageZero.startDrawing(this);\r\n\r\n }\r\n break;\r\n // ? STAGE FOR PIN BOUNDARIES\r\n case 1:\r\n {\r\n // STAGE FIRST\r\n this.wrapperDelete('map');\r\n this.displayMessage(\"Start pinning by simply clicking on map borders\", \"danger\");\r\n let stageFirst = new StageFirst({ layer: this.canvas, className: \"map-surface\" });\r\n stageFirst.startDrawing(this);\r\n }\r\n break;\r\n // ? STAGE FOR FACING POINT SELECTION\r\n case 2:\r\n {\r\n // STAGE SECOND\r\n let stageSecond = new StageSecond();\r\n\r\n if(this._type == \"custom\") {\r\n this.wrapperDelete('map');\r\n this.displayMessage(\"Select facing wall\", \"danger\");\r\n this.assist.drawMask({ layer: this.canvas, points: this.mapBoundariesCoords, size: this.RECT_SIZE });\r\n this.assist.drawBoundaries({ layer: this.canvas, points: this.mapBoundariesCoords });\r\n this.assist.drawBharamNabhi({ layer: this.canvas, centroid: this.centroid });\r\n stageSecond.startDrawing(this);\r\n } else {\r\n d3.select('.properties-section.decs').classed('d-none',true);\r\n this.wrapperDelete('map');\r\n this.hideMessage();\r\n this.division = 8;\r\n this.selectedDirection = this.DIRECTION_DATA.eight;\r\n this.faceCoords = [this.mapBoundariesCoords[0],this.mapBoundariesCoords[1]];\r\n\r\n this.assist.drawMask({ layer: this.canvas, points: this.mapBoundariesCoords, size: this.RECT_SIZE });\r\n this.assist.drawPolygon(this.canvas, this.mapBoundariesCoords, 3, true, false);\r\n this.assist.drawBharamNabhi({ layer: this.canvas, centroid: this.centroid });\r\n this.assist.drawGrid(this.canvas, this.centroid, this.faceCoords, this.screenBoundariesCoords, this.division, this.angle, this.selectedDirection, this._type);\r\n this.assist.drawDirectionLines(this.canvas, this.faceCoords, this.centroid, this.division, this.angle);\r\n stageSecond.startVedic(this);\r\n }\r\n }\r\n break;\r\n case 3:\r\n {\r\n // STAGE THIRD\r\n this.hideMessage();\r\n this.wrapperDelete('map');\r\n\r\n d3.select('.align-center-wrapper').classed('d-none',false);\r\n d3.select('.zoom-state-wrapper').classed('d-none',false);\r\n d3.select('.zoom-wrapper').classed('d-none',false);\r\n\r\n this.assist.drawBackgroundGrid(this.canvas, this.centroid, this.faceCoords, this.division, this.angle, this.DIRECTION_DATA.sixteen);\r\n this.assist.drawMask({ layer: this.canvas, points: this.mapBoundariesCoords, size: this.RECT_SIZE });\r\n this.assist.drawBoundaries({ layer: this.canvas, points: this.mapBoundariesCoords });\r\n this.assist.drawBharamNabhi({ layer: this.canvas, centroid: this.centroid });\r\n this.assist.drawDirectionLines(this.canvas, this.faceCoords, this.centroid, this.division, this.angle);\r\n this.assist.drawFacingLine(this.canvas, this.centroid, this.faceCoords);\r\n this.assist.drawGrid(this.canvas, this.centroid, this.faceCoords, this.screenBoundariesCoords, this.division, this.angle, this.DIRECTION_DATA.sixteen);\r\n d3.select('.facing-degree').text(`${Math.abs(this.angle)}°`)\r\n\r\n this.screenPolygons = Utility.getIntersectionPoints(this.calNorthAngle(), this.centroid, this.screenBoundariesCoords, this.division);\r\n this.mapPolygonsArray = Utility.getIntersectionPoints(this.calNorthAngle()+this.angle, this.centroid, this.mapBoundariesCoords, this.division);\r\n this.mapPolygonsAreaArray = Utility.getPolygonsArea(this.mapPolygonsArray);\r\n\r\n // console.log(this.screenBoundariesCoords,this.mapBoundariesCoords,this.faceCoords,typeof this.centroid.x);\r\n // console.log(this.screenPolygons,this.mapPolygonsArray,this.mapPolygonsAreaArray);\r\n\r\n // ? DRAW BAR CHART\r\n this.modal.drawMap({ areaArr: this.mapPolygonsAreaArray, division: this.division, dimension: this.distanceBetweenTwoPoints });\r\n\r\n let stageThird = new StageThird(this.attribute);\r\n stageThird.startDrawing(this);\r\n }\r\n break;\r\n case 4:\r\n {\r\n\r\n // STAGE FOURTH\r\n this.displayMessage(\"Select two points to define scale of the drawing\", \"danger\");\r\n let layer = d3.select('#drawArea').append('svg').attr('id','drawCanvas');\r\n let stageFourth = new StageFourth({ layer: layer, className: \"find-distance\" });\r\n stageFourth.startDrawing(this);\r\n\r\n }\r\n break;\r\n case 5:\r\n {\r\n\r\n // STAGE FOURTH\r\n this.displayMessage(\"Select two points to define scale of the drawing\", \"danger\");\r\n let layer = d3.select('#drawArea').append('svg').attr('id','drawCanvas');\r\n let stageFifth = new StageFifth({ layer: layer, className: \"find-distance\" });\r\n stageFifth.startDrawing(this);\r\n\r\n }\r\n break;\r\n default:\r\n break;\r\n\r\n }\r\n\r\n }", "activate (pPlayer) {}", "listen(){\n //recognize as a hit\n //return an array\n //[0]: true if triggered\n //[1]: switch data\n // if(this.initial == 0){\n // console.log(\"the flip is \"+this.flip)\n // }\n\n if(this.flip == 1 && this.state[0] == false){\n this.state[0] = true;\n this.state[1] = false;\n this.on = 1;\n // console.log(\"good hit\")\n // console.log(\"initial is \"+this.initial)\n // console.log(\"this on is \"+ this.on)\n var result1 = this.avoidInitial(this.on);\n //console.log(result1);\n \n if(result1){\n return [true,this.on];\n }\n else{\n return [false,this.on];\n } \n }\n else if(this.flip == 0 && this.state[1] == false){\n this.state[1] = true;\n this.state[0] = false;\n this.on = 0;\n //console.log(\"good hit\")\n var result1 = this.avoidInitial(this.on);\n //console.log(result1);\n if(result1){\n return [true,this.on];\n }\n else{\n return [false,this.on];\n }\n }\n else{\n return [false,this.on];\n }\n }", "function v4(pong,side=\"right\"){\n\n var myNetwork = new synaptic.Architect.Perceptron(5, 20, 2);\n // var trainer = new synaptic.Trainer(myNetwork)\n var cpt = 0;\n var ball = pong.ball;\n var paddle = pong[side+\"Paddle\"];\n\n var target,output,position,pt;\n\n var middle = pong.cfg.height/2;\n\n var i = setInterval(function(){\n\n output = myNetwork.activate( getInputs( ball,paddle ) );\n\n position = paddle.y + paddle.height/2;\n\n pt = predictTarget(ball,paddle);\n\n if (!pt) {\n pt = {\n y : middle\n }\n }\n\n target = [\n pt.y > position ? 1 : 0,\n pt.y < position ? 1 : 0\n ];\n myNetwork.propagate(1, target);\n\n move(output,paddle)\n\n\n },10);\n\n\n}", "function sequencing() {\n if (started) {\n $('.simonButton').removeClass('clicks');\n cpuTurn(0);\n playerTurn(0);\n }\n}", "static planRoute () {\n return new NavComputer({\n route: sample(ROUTES),\n invert: sample([true, false])\n })\n }", "function steps_init(turn) {\n\tturn.phases = [] ;\n\tturn.steps = [] ;\n\t// Begin\n\tnew Phase(turn, 'begin', \n\t\t// Untap : untap permanents\n\t\t//\tmenu allowing to forbid untaping of one type of permanents\t\n\t\tnew Step('untap', 'Untap.png', function(turn) {\n\t\t\tif ( turn.mine() )\n\t\t\t\tturn.current_player.battlefield.untapall() ;\n\t\t}, function(menu) {\n\t\t\tvar func_lands = null ;\n\t\t\tvar func_creatures = null ;\n\t\t\tvar func_all = null ;\n\t\t\tif ( ! spectactor ) {\n\t\t\t\tfunc_all = function(plop) {\n\t\t\t\t\tgame.player.attrs.untap_all = ! game.player.attrs.untap_all ;\n\t\t\t\t}\n\t\t\t\tif ( game.player.attrs.untap_all ) {\n\t\t\t\t\tfunc_lands = function(plop) {\n\t\t\t\t\t\tgame.player.attrs.untap_lands = ! game.player.attrs.untap_lands ;\n\t\t\t\t\t} ;\n\t\t\t\t\tfunc_creatures = function(plop) {\n\t\t\t\t\t\tgame.player.attrs.untap_creatures = ! game.player.attrs.untap_creatures ;\n\t\t\t\t\t} ;\n\t\t\t\t}\n\t\t\t}\n\t\t\tmenu.addline('Lands', func_lands, this.thing).checked = ( game.player.attrs.untap_lands && game.player.attrs.untap_all ) ;\n\t\t\tmenu.addline('Creatures', func_creatures, this.thing).checked = ( game.player.attrs.untap_creatures && game.player.attrs.untap_all ) ;\n\t\t\tmenu.addline('All', func_all, this.thing).checked = game.player.attrs.untap_all ;\n\t\t}), \n\t\t// Upkeep : various triggers\n\t\t//\tno menu\n\t\tnew Step('upkeep', 'Upkeep.png', function(turn) {\n\t\t\tif ( turn.mine() && game.options.get('remind_triggers') ) {\n\t\t\t\tvar trigger_list = create_ul() ;\n\t\t\t\tvar player = turn.current_player ;\n\t\t\t\tvar cards = player.battlefield.cards ;\n\t\t\t\tcards = cards.concat(player.opponent.battlefield.cards) ;\n\t\t\t\tfor ( var i = 0 ; i < cards.length ; i++ ) {\n\t\t\t\t\tvar card = cards[i] ;\n\t\t\t\t\tvar atto = cards[i].get_attachedto() ; // Unless they're attached to a permanent controled by current player\n\t\t\t\t\tif ( ( atto != null ) && ( atto.zone.player == turn.current_player ) && iso(card.attrs.bonus) && iss(card.attrs.bonus.trigger_upkeep) )\n\t\t\t\t\t\ttrigger_li(trigger_list, card, card.attrs.bonus.trigger_upkeep) ; // In that case, consider bonus\n\t\t\t\t\tif ( card.zone.player != turn.current_player ) // Consider only card controled by current player\n\t\t\t\t\t\tcontinue ;\n\t\t\t\t\tvar c = card.getcounter() ;\n\t\t\t\t\tif ( card.attrs.vanishing && ( c > 0 ) ) {\n\t\t\t\t\t\tvar li = popup_li(card, trigger_list) ;\n\t\t\t\t\t\tli.title = 'Remove a time counter' ;\n\t\t\t\t\t\tli.func = function(card) {\n\t\t\t\t\t\t\tif ( c > 0 )\n\t\t\t\t\t\t\t\tcard.addcounter(-1) ;\n\t\t\t\t\t\t\tif ( c == 1 )\n\t\t\t\t\t\t\t\tcard.changezone(card.owner.graveyard) ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tvar c = card.getcounter() ;\n\t\t\t\t\tif ( card.attrs.fading && ( c >= 0 ) ) {\n\t\t\t\t\t\tvar li = popup_li(card, trigger_list) ;\n\t\t\t\t\t\tli.title = 'Remove a fade counter' ;\n\t\t\t\t\t\tli.func = function(card) {\n\t\t\t\t\t\t\tif ( c == 0 )\n\t\t\t\t\t\t\t\tcard.changezone(card.owner.graveyard) ;\n\t\t\t\t\t\t\tif ( c >= 0 )\n\t\t\t\t\t\t\t\tcard.addcounter(-1) ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tvar c = card.getcounter() ;\n\t\t\t\t\tif ( card.attrs.suspend && ( c > 0 ) ) {\n\t\t\t\t\t\tvar li = popup_li(card, trigger_list) ;\n\t\t\t\t\t\tli.title = 'Remove a time counter' ;\n\t\t\t\t\t\tli.func = function(card) {\n\t\t\t\t\t\t\tvar c = card.getcounter() ;\n\t\t\t\t\t\t\tif ( c > 0 )\n\t\t\t\t\t\t\t\tcard.addcounter(-1) ;\n\t\t\t\t\t\t\tif ( c == 1 )\n\t\t\t\t\t\t\t\tcard.place(0, card.grid_y) ; // Suspended card is now cast\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( card.attrs.echo ) {\n\t\t\t\t\t\tvar li = popup_li(card, trigger_list) ;\n\t\t\t\t\t\tli.title = 'Pay echo' ;\n\t\t\t\t\t\tli.func = function(card) {\n\t\t\t\t\t\t\tif ( confirm('Pay Echo cost of '+card.attrs.echo+' for '+card.get_name()+' ?') ) { // Echo paid, won't have to pay anymore\n\t\t\t\t\t\t\t\tdelete card.attrs.echo ;\n\t\t\t\t\t\t\t\tcard.sync() ;\n\t\t\t\t\t\t\t} else // Not paid, sacrificed\n\t\t\t\t\t\t\t\tcard.changezone(card.owner.graveyard) ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( iss(card.attrs.trigger_upkeep) )\n\t\t\t\t\t\ttrigger_li(trigger_list, card, card.attrs.trigger_upkeep) ;\n\t\t\t\t}\n\t\t\t\tvar cards = player.hand.cards ;\n\t\t\t\tfor ( var i = 0 ; i < cards.length ; i++ ) {\n\t\t\t\t\tvar card = cards[i] ;\n\t\t\t\t\tif ( iss(card.attrs.forecast) ) {\n\t\t\t\t\t\tvar li = popup_li(card, trigger_list) ;\n\t\t\t\t\t\tli.func = function(card) {\n\t\t\t\t\t\t\talert('Forecast '+card.get_name()+' ('+card.attrs.forecast+')') ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( trigger_list.children.length == 0 )\n\t\t\t\t\treturn false ;\n\t\t\t\tfor ( var i = 0 ; i < trigger_list.children.length ; i++ ) {\n\t\t\t\t\tvar li = trigger_list.children[i] ;\n\t\t\t\t\tli.addEventListener('click', function(ev) {\n\t\t\t\t\t\tgame.selected.set(ev.target.card) ;\n\t\t\t\t\t}, false) ;\n\t\t\t\t\tli.addEventListener('dblclick', function(ev) {\n\t\t\t\t\t\tvar li = ev.target ;\n\t\t\t\t\t\tif ( isf(li.func) )\n\t\t\t\t\t\t\tli.func(li.card) ;\n\t\t\t\t\t\tvar ul = li.parentNode ;\n\t\t\t\t\t\tul.removeChild(li) ;\n\t\t\t\t\t\tif ( ul.childNodes.length == 0 ) {\n\t\t\t\t\t\t\ttrigger_win.parentNode.removeChild(trigger_win) ;\n\t\t\t\t\t\t\tgame.turn.incstep() ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}, false) ;\n\t\t\t\t\tli.addEventListener('contextmenu', function(ev) {\n\t\t\t\t\t\tev.preventDefault() ;\n\t\t\t\t\t\tvar li = ev.target ;\n\t\t\t\t\t\tvar ul = li.parentNode ;\n\t\t\t\t\t\tul.removeChild(li) ;\n\t\t\t\t\t\tif ( ul.childNodes.length == 0 ) {\n\t\t\t\t\t\t\ttrigger_win.parentNode.removeChild(trigger_win) ;\n\t\t\t\t\t\t\tgame.turn.incstep() ;\n\t\t\t\t\t\t}\n\t\t\t\t\t}, false) ;\n\t\t\t\t\tli.title = 'Double click to trigger ('+li.title+'), right click to ignore' ;\n\t\t\t\t}\n\t\t\t\tvar trigger_win = popup('Upkeep triggers', function(ev) {\n\t\t\t\t\tvar but = ev.target ;\n\t\t\t\t\tvar div = but.parentNode.parentNode ;\n\t\t\t\t\tfor ( var i = 0 ; i < trigger_list.children.length ; i++ ) {\n\t\t\t\t\t\tvar li = trigger_list.children[i] ;\n\t\t\t\t\t\tif ( isf(li.func) )\n\t\t\t\t\t\t\tli.func(li.card) ;\n\t\t\t\t\t}\n\t\t\t\t\ttrigger_win.parentNode.removeChild(trigger_win) ;\n\t\t\t\t\tgame.turn.incstep() ;\n\t\t\t\t}, 'Trigger all', function(ev) {\n\t\t\t\t\ttrigger_win.parentNode.removeChild(trigger_win) ;\n\t\t\t\t\tgame.turn.incstep() ;\n\t\t\t\t}, 'Trigger none') ;\n\t\t\t\ttrigger_win.appendChild(trigger_list) ;\n\t\t\t\tpopup_resize(trigger_win, 265) ; // After adding childs\n\t\t\t\treturn true ;\n\t\t\t}\n\t\t}), \n\t\t// Draw : triggers dredge, if not, draw\n\t\t//\tmenu allowing to change number of cards drawn\n\t\tnew Step('draw', 'Draw.png', function(turn) { // Draw step (dredge)\n\t\t\tif ( turn.mine() ) {\n\t\t\t\tvar player = turn.current_player ;\n\t\t\t\t// List\n\t\t\t\tdredge_list = create_ul() ;\n\t\t\t\tif ( game.options.get('remind_triggers') ) {\n\t\t\t\t\tfor ( var i in player.graveyard.cards ) { // Search for dredge cards\n\t\t\t\t\t\tvar card = player.graveyard.cards[i] ;\n\t\t\t\t\t\tif ( isn(card.attrs.dredge) ) { // Card has dredge, create a li\n\t\t\t\t\t\t\tvar dredge_li = popup_li(card, dredge_list) ;\n\t\t\t\t\t\t\t// Events\n\t\t\t\t\t\t\tif ( card.attrs.dredge <= player.library.cards.length ) { // Clicks events if card is dredgeable\n\t\t\t\t\t\t\t\tdredge_li.addEventListener('click', function(ev) { // Click to select\n\t\t\t\t\t\t\t\t\tif ( dredge_win.selected != null )\n\t\t\t\t\t\t\t\t\t\tdredge_win.selected.classList.remove('selected') ;\n\t\t\t\t\t\t\t\t\tdredge_win.selected = ev.target ;\n\t\t\t\t\t\t\t\t\tdredge_win.selected.classList.add('selected') ;\n\t\t\t\t\t\t\t\t\tdocument.getElementById('button_ok').disabled = false ;\n\t\t\t\t\t\t\t\t}, false) ;\n\t\t\t\t\t\t\t\tdredge_li.addEventListener('dblclick', function(ev) { // DblClick to dredge\n\t\t\t\t\t\t\t\t\tif ( ev.target.card.dredge() )\n\t\t\t\t\t\t\t\t\t\tdredge_win.parentNode.removeChild(dredge_win) ;\n\t\t\t\t\t\t\t\t\tgame.turn.incstep() ;\n\t\t\t\t\t\t\t\t}, false) ;\n\t\t\t\t\t\t\t\tdredge_li.title = 'Click to select, double click to dredge, or cancel button to draw' ;\n\t\t\t\t\t\t\t} else { // Indicate card isn't dredgeable\n\t\t\t\t\t\t\t\tdredge_li.classList.add('no') ;\n\t\t\t\t\t\t\t\tdredge_li.title = 'Impossible to dredge '+card.name+' (Dredge '+card.attrs.dredge+') with '\n\t\t\t\t\t\t\t\tdredge_li.title += player.library.cards.length+' card'+prepend_s(player.library.cards.length)+' in library' ;\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\tif ( dredge_list.childNodes.length == 0 ) { // No card to dredge, do alternative\n\t\t\t\t\tplayer.hand.draw_card(player.attrs.draw) ;\n\t\t\t\t\treturn false ;\n\t\t\t\t}\n\t\t\t\tvar dredge_win = popup('Dredge', function(ev) {\n\t\t\t\t\tif ( ( dredge_win.selected != null ) && dredge_win.selected.card.dredge() ) {\n\t\t\t\t\t\tdredge_win.parentNode.removeChild(dredge_win) ;\n\t\t\t\t\t\tgame.turn.incstep() ;\n\t\t\t\t\t}\n\t\t\t\t}, 'Dredge selected card', function(ev) {\n\t\t\t\t\tplayer.hand.draw_card(player.attrs.draw) ;\n\t\t\t\t\tdredge_win.parentNode.removeChild(dredge_win) ;\n\t\t\t\t\tgame.turn.incstep() ;\n\t\t\t\t}, 'Draw '+player.attrs.draw+' card'+prepend_s(player.attrs.draw)) ;\n\t\t\t\tdredge_win.appendChild(dredge_list) ;\n\t\t\t\tpopup_resize(dredge_win, 265) ; // After adding childs\n\t\t\t\t// Selection\n\t\t\t\tdredge_win.selected = null ;\n\t\t\t\tif ( ( dredge_list.childNodes.length == 1 ) && ( dredge_list.firstChild.card.attrs.dredge <= player.library.cards.length ) ) { // Preselection if only one and able\n\t\t\t\t\tdredge_win.selected = dredge_list.firstChild ;\n\t\t\t\t\tdredge_win.selected.classList.add('selected') ;\n\t\t\t\t} else // Force player to select a card\n\t\t\t\t\tdocument.getElementById('button_ok').disabled = true ;\n\t\t\t\treturn true ;\n\t\t\t}\n\t\t}, function(menu) {\n\t\t\tvar func_draw = null ;\n\t\t\tif ( ! spectactor )\n\t\t\t\tfunc_draw = function(plop) {\n\t\t\t\t\tnb = prompt_int('Number of cards to draw on draw step', game.player.attrs.draw) ;\n\t\t\t\t\tif ( nb >= 0 ) {\n\t\t\t\t\t\tgame.player.attrs.draw = nb ;\n\t\t\t\t\t\tgame.player.sync() ;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tmenu.addline('Cards drawn : '+game.player.attrs.draw, func_draw, this.thing) ;\n\t\t})\n\t) ;\n\t// First main phase : nothing, no menu\n\tnew Phase(turn, 'main1', \n\t\tnew Step('main1', 'Precombat.png')\n\t) ;\n\t// Combat\n\tnew Phase(turn, 'combat',\n\t\t// Begin : nothing\n\t\t//\tno menu\n\t\tnew Step('begin', 'BeginningCombat.png', function(turn){\n\t\t\tif ( turn.mine() )\n\t\t\t\tgame.selected.clear() ;\n\t\t}), \n\t\t// Attackers : exalt, battlecry\n\t\t//\tno menu\n\t\tnew Step('attackers', 'DeclareAtackers.png', function(turn) {\n\t\t\tif ( turn.mine() ) {\n\t\t\t\tvar attacking = new Selection() ;\n\t\t\t\tvar battlecry = new Selection() ;\n\t\t\t\tvar exalted = 0 ;\n\t\t\t\tfor ( var i in game.player.battlefield.cards ) {\n\t\t\t\t\tvar card = game.player.battlefield.cards[i] ;\n\t\t\t\t\tif ( card.attacking ) { // Attacking creatures\n\t\t\t\t\t\tattacking.add(card) ;\n\t\t\t\t\t\tif ( card.attrs.battle_cry ) // Battlecry\n\t\t\t\t\t\t\tbattlecry.add(card) ;\n\t\t\t\t\t}\n\t\t\t\t\tif ( card.attrs.exalted ) // Exalted\n\t\t\t\t\t\texalted++ ;\n\t\t\t\t}\n\t\t\t\tif ( ( exalted > 0 ) && ( attacking.cards.length == 1 ) ) // Trigger Exalted \n\t\t\t\t\tattacking.add_powthou_eot(exalted, exalted) ;\n\t\t\t\tif ( ( battlecry.cards.length > 0 ) && ( attacking.cards.length > 1 ) ) { // Trigger BattleCry\n\t\t\t\t\tattacking.add_powthou_eot(battlecry.cards.length, 0) ;\n\t\t\t\t\tbattlecry.add_powthou_eot(-1, 0) ; // No self boost\n\t\t\t\t}\n\t\t\t}\n\t\t}), \n\t\t// Blockers : nothing\n\t\t//\tno menu\n\t\tnew Step('blockers', 'DeclareBlockers.png'), \n\t\t//new Step('firststrike', 'FirstStrikeDamage.png'),\n\t\t// Damages : apply damages (+life gain & poison) on blocking & blocked creatures & players\n\t\t//\tno menu\n\t\tnew Step('damage', 'CombatDamage.png', function(turn) { // Combat damage step\n\t\t\tvar a_player = turn.current_player ;\n\t\t\tvar d_player = a_player.opponent ;\n\t\t\tvar dmg = sum_attackers_powers(d_player) ;\n\t\t\tvar life = sum_attackers_powers(a_player) ;\n\t\t\tif ( ! d_player.me ) { // I'm attacking player : set damage and gain life\n\t\t\t\tif ( dmg[0] != 0 ) {\n\t\t\t\t\tvar n = prompt_int('How many damages to set',-dmg[0]) ;\n\t\t\t\t\tif ( isn(n) && ( n != 0 ) )\n\t\t\t\t\t\td_player.life.damages_set(d_player.attrs.damages+n)\n\t\t\t\t}\n\t\t\t\tif ( life[0] > 0 )\n\t\t\t\t\ta_player.life.changelife(life[0]) ;\n\t\t\t} else { // I'm defending player | Goldfish : set life\n\t\t\t\tif ( dmg[0] < 0 )\n\t\t\t\t\td_player.life.changelife(dmg[0]) ;\n\t\t\t\tif ( dmg[1] > 0 )\n\t\t\t\t\td_player.life.changepoison(dmg[1]) ;\n\t\t\t\tif ( life[0] > 0 )\n\t\t\t\t\ta_player.life.changelife(life[0]) ;\n\t\t\t}\n\t\t\tcreatures_deal_dmg(a_player) ;\n\t\t}), \n\t\t// End : nothing\n\t\t//\tno menu\n\t\tnew Step('end', 'EndCombat.png')\n\t) ;\n\t// Second main phase : nothing, no menu\n\tnew Phase(turn, 'main2', \n\t\tnew Step('main2', 'Postcombat.png')\n\t) ;\n\t// End phase : nothing, no menu\n\tnew Phase(turn, 'end', \n\t\tnew Step('eot', 'Cleanup.png'), \n\t\tnew Step('cleanup', 'EndOfTurn.png', null, function(menu) {\n\t\t\tmenu.addline('Take another turn', play_turn) ;\n\t\t})\n\t) ;\n}", "setRowOutputConnections() {\n /* create 2 subpartitions of equal size\n all the 0 output pads of this partition activate the first subpartition\n all the 1 output pads of this partition activate the second subpartition\n */\n this.linkPartitions(0, 0, 7)\n\n // also need to link the lights in with dial outputs 9 and 10\n for (let c = 0; c < 8; c++) {\n this.dials[3].link9and10(this.lights[c][0], this.lights[c][1])\n }\n }", "function \r\ncTransit(\r\n)\r\n{\t\r\n}", "function go_wild_pressed(){\n controllers.free_flow_flag = !controllers.free_flow_flag;\n}", "function computerMediumModeTurn() {\n \n}", "function animation() {\r\n switchOn();\r\n switchOff();\r\n}", "takeTurn() {\n //all ants take a turn\n this._colony.allAnts.forEach(function(ant){\n ant.act(this._colony); //pass in colony reference if needed\n }, this);\n \n //all bees take a turn\n this._colony.allBees.forEach(function(bee){\n bee.act();\n }, this); \n \n //new bees arrive\n this._hive.invade(this._colony, this._turn);\n \n //turn finished\n this._turn++; \n }", "function ToggleSwitchControl(action) {\n if ($(this).hasClass('active')) {\n $(this).removeClass('active');\n $(this).parent().removeClass('active');\n }\n else {\n $(this).addClass('active');\n $(this).parent().addClass('active');\n }\n // Change Text and React based on ID\n switch ($(this).attr('id')) {\n case 'pieceTypeLine':\n {\n $(this).hasClass('active') ? $(this).html('Line') : $(this).html('Shape');\n $('#PTcutout').css('display', $(this).hasClass('active') ? 'none' : 'inline-block');\n $('#PTcutoutLbl').css('display', $('#PTcutout').css('display'));\n for (var _i = 0, selectedPieces_3 = selectedPieces; _i < selectedPieces_3.length; _i++) {\n var piece = selectedPieces_3[_i];\n piece.Line = $(this).hasClass('active');\n }\n Redraw();\n break;\n }\n case 'spotTypeConnect':\n {\n $(this).hasClass('active') ? $('#spotTypeTension').removeClass('folded') :\n $('#spotTypeTension').addClass('folded');\n $(this).hasClass('active') ? $(this).html('Curve') : $(this).html('Corner');\n // Whole Piece\n if (selectedSpots.length < 1) {\n for (var _a = 0, selectedPieces_4 = selectedPieces; _a < selectedPieces_4.length; _a++) {\n var piece = selectedPieces_4[_a];\n for (var _b = 0, _c = piece.Data; _b < _c.length; _b++) {\n var spot = _c[_b];\n spot.Connection = $(this).hasClass('active') ? Connector.Curve : Connector.Corner;\n }\n }\n }\n // Selected Spots\n else {\n for (var _d = 0, selectedSpots_3 = selectedSpots; _d < selectedSpots_3.length; _d++) {\n var spot = selectedSpots_3[_d];\n spot.Connection = $(this).hasClass('active') ? Connector.Curve : Connector.Corner;\n }\n }\n Redraw();\n break;\n }\n }\n}", "function hyperdrive()\n{\n if(powerCore===true && newhyperdrive===false && airFilter===false && hyperdriveCounter===0)\n {\n \n advanceTalkCounter=710;\n advanceTalk();\n hyperdriveCounter++;\n }\n else if(powerCore===true && newhyperdrive===true && airFilter===false && hyperdriveCounter===1)\n {\n hyperdriveCounter++;\n advanceTalkCounter=810;\n advanceTalk();\n }\n else if(powerCore===true && newhyperdrive===true && airFilter===true && hyperdriveCounter===2)\n {\n hyperdriveCounter++;\n advanceTalkCounter=906;\n advanceTalk();\n }\n else if(powerCore===true && newhyperdrive===true && airFilter===true && hyperdriveCounter===3 && battle===true)\n {\n hyperdriveCounter++;\n advanceTalkCounter=935;\n advanceTalk();\n }\n else\n {\n advanceTalkCounter=714;\n advanceTalk();\n }\n \n}", "async start() {\n const { config, emitter, states } = this;\n\n let curr;\n\n if(config.initial) {\n curr = config.initial;\n } else {\n curr = Object.keys(config.states)[0];\n }\n\n const details = {\n curr : states.get(curr),\n };\n\n await emitter.emit(`enter`, details);\n await emitter.emitSerial(`enter:${curr}`, details);\n\n this.state = curr;\n }", "nextProtocolStage() {\n log.trace('ProtocolEngine::nextProtocolStage');\n\n if (!this.setCurrentProtocolStage(1)) {\n log.trace('ProtocolEngine::nextProtocolStage failed');\n }\n }", "bootstrap(swaps){\n this.reset();\n swaps.forEach(swap => {\n this.add(swap.T);\n this.solve(() => swap.price(this));\n });\n }", "function setupFsm() {\n // when jumped to drag mode, enter\n fsm.when(\"* -> drag\", function() {});\n fsm.when(\"drag -> *\", function(exit, enter, reason) {\n if (reason == \"drag-finish\") {}\n });\n }", "function Burnisher () {}", "function pinState(a) {\n outlet(0, 240, 109, a, 247);\n}", "trainingRun(input){\r\n this.resetTime();\r\n for(let i = 0; i < input.length; i++){\r\n this.activate(input[i]);\r\n }\r\n }", "function toSwitch(trackingActive, calMets)\n{\n if (!trackingActive && calMets > 10)\n {\n return \"go active\";\n }\n else if (trackingActive && calMets <= 10)\n {\n return \"go inactive\";\n }\n return \"continue\";\n}", "function setSimulationActiveState(active) {\n if(active) {\n $(\"#startButton\").attr(\"data-running\",\"true\").removeClass(\"btn-success\").addClass(\"btn-danger\").text(\"Stop\");\n $(\"#optionsButton\").attr(\"disabled\",\"\");\n startSimulation();\n }\n else {\n $(\"#startButton\").attr(\"data-running\",\"false\").removeClass(\"btn-danger\").addClass(\"btn-success\").text(\"Start\");\n $(\"#optionsButton\").removeAttr(\"disabled\");\n clearInterval(moveAgentsRandomly);\n }\n }", "function InstructionState() { }", "function wlChange (wlSetpoint) {\n \n let direction = null;\n // checks if dhSetpoint is an integer, then updates gobal variable\n if (Number.isInteger(wlSetpoint) == false) {\n wlSetpoint = parseInt(wlSetpoint)\n }\n waterLevelsp = wlSetpoint\n\n // does things to get current state of water level\n if (waterLevel <= wlSetpoint) {\n port.write('2')\n port.write('3')\n direction = 'down';\n } else {\n port.write('4')\n port.write('1')\n direction = 'up';\n }\n\n // starts movement after ANS has time to prepare \n // (aka switch motor power connections)\n setTimeout(() => {\n port.write('5')\n }, 250)\n\n // enters routine to monitor actual v target\n var ctrlwlh = setInterval(() =>{\n if (direction == 'down') {\n if (waterLevel > wlSetpoint) {\n clearInterval(ctrlwlh);\n port.write('6')\n\n }\n } else {\n if (waterLevel < wlSetpoint) {\n clearInterval(ctrlwlh);\n port.write('6')\n }\n }\n }, 200);\n}", "function calculatePlan(actor) \n{\n var teamColor = actor.getKnowledge(\"team_color\");\n var otherFlag = teamColor == \"red\" ? flag_green.position : flag_red.position;\n var ownFlag = teamColor == \"red\" ? flag_red.position : flag_green.position;\n\n var planner = new Planner();\n var actionSet = [new MoveToFlagAction(teamColor, ownFlag), \n \t\t\t\t new MoveToFlagAction(teamColor, otherFlag),\n \t\t\t\t new ReloadAction(),\n \t\t\t\t new ShootAction()]\n\n var allActions = {}\n \tvar preconditionSet = []\n\tfor(var i = 0; i < actionSet.length; ++i) {\n\t\tvar action = actionSet[i]\n\t planner.addAction(action.precondition,\n\t action.postcondition,\n\t action.cost,\n\t action.perform, \n\t action.name);\n\n\t allActions[action.name] = action\n\t preconditionSet = preconditionSet.concat(action.preconditions)\n }\n\n //var tree = [\"[L3\",\"[S2\",\"s\",\"r\",\"[S4\",{\"enemy_in_range\":true},\"t\",\"[S2\",\"s\",\"r\",\"s\",\"[S2\",\"g\",\"r\"]\n //printTree(treeFromString(tree,0,allActions).root)\n\n testApproachRandom(10);\n //testApproachRandom(0, allActions, {\"made_points\" : true});\n}" ]
[ "0.60313374", "0.5884927", "0.5854123", "0.5854123", "0.5854123", "0.5756651", "0.5733953", "0.5701265", "0.57011676", "0.5696058", "0.56745774", "0.56244195", "0.5612491", "0.5596226", "0.5581617", "0.55560327", "0.5531749", "0.5509789", "0.54743826", "0.541155", "0.5393223", "0.5385419", "0.537653", "0.5341935", "0.5320589", "0.53157693", "0.531475", "0.526568", "0.5260875", "0.5255344", "0.5233458", "0.52275443", "0.52226293", "0.5221727", "0.52208686", "0.52192235", "0.5208774", "0.51942533", "0.51883614", "0.51686054", "0.5167939", "0.5166776", "0.5155339", "0.51529086", "0.5147957", "0.5147433", "0.5144155", "0.51428336", "0.5139812", "0.5139757", "0.51396865", "0.5135", "0.51273197", "0.5126952", "0.5119671", "0.51128465", "0.5112553", "0.510932", "0.50961995", "0.50942266", "0.50923055", "0.50907665", "0.5086072", "0.5085751", "0.5085429", "0.5081862", "0.50777924", "0.50743085", "0.5070293", "0.50697917", "0.5063965", "0.50587034", "0.50505906", "0.5047593", "0.50415266", "0.5041255", "0.5032018", "0.5023573", "0.50221413", "0.5021921", "0.5019535", "0.5016793", "0.50098324", "0.499592", "0.49935976", "0.49825242", "0.4977756", "0.49734834", "0.49730968", "0.49645352", "0.496242", "0.49624053", "0.4961565", "0.49609548", "0.49567336", "0.4950518", "0.494979", "0.494789", "0.49471313", "0.4946745" ]
0.53914255
21
recursion (flat tree structure)
function flatRecord(record, indent, childrenColumnName, expandedKeys, getRowKey) { var arr = []; arr.push({ record: record, indent: indent }); var key = getRowKey(record); var expanded = expandedKeys === null || expandedKeys === void 0 ? void 0 : expandedKeys.has(key); if (record && Array.isArray(record[childrenColumnName]) && expanded) { // expanded state, flat record for (var i = 0; i < record[childrenColumnName].length; i += 1) { var tempArr = flatRecord(record[childrenColumnName][i], indent + 1, childrenColumnName, expandedKeys, getRowKey); arr.push.apply(arr, (0, _toConsumableArray2.default)(tempArr)); } } return arr; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function iterativeFlatten(root) {\n var nodes = [], i = 0;\n var toRecurse = [root];\n\n function recurse() {\n var nextGen = []\n toRecurse.forEach(function(node){\n if (!node.id) node.id = ++i;\n nodes.push(node);\n\n if (node.children) nextGen = nextGen.concat(node.children);\n\n })\n\n toRecurse = nextGen\n }\n\n while (toRecurse.length>0) {\n recurse();\n }\n\n console.log(JSON.stringify(nodes))\n return nodes;\n}", "function recurse(data, depth, nodes) {\n var childs = children.call(hierarchy, data, depth),\n node = d3_layout_hierarchyInline ? data : {data: data};\n node.depth = depth;\n nodes.push(node);\n if (childs && (n = childs.length)) {\n var i = -1,\n n,\n c = node.children = [],\n v = 0,\n j = depth + 1;\n while (++i < n) {\n d = recurse(childs[i], j, nodes);\n d.parent = node;\n c.push(d);\n v += d.value;\n }\n if (sort) c.sort(sort);\n if (value) node.value = v;\n } else if (value) {\n node.value = +value.call(hierarchy, data, depth) || 0;\n }\n return node;\n }", "function recurse(data, depth, nodes) {\n var childs = children.call(hierarchy, data, depth),\n node = d3_layout_hierarchyInline ? data : {data: data};\n node.depth = depth;\n nodes.push(node);\n if (childs && (n = childs.length)) {\n var i = -1,\n n,\n c = node.children = [],\n v = 0,\n j = depth + 1;\n while (++i < n) {\n d = recurse(childs[i], j, nodes);\n d.parent = node;\n c.push(d);\n v += d.value;\n }\n if (sort) c.sort(sort);\n if (value) node.value = v;\n } else if (value) {\n node.value = +value.call(hierarchy, data, depth) || 0;\n }\n return node;\n }", "function recurse(data, depth, nodes) {\n var childs = children.call(hierarchy, data, depth),\n node = d3_layout_hierarchyInline ? data : {data: data};\n node.depth = depth;\n nodes.push(node);\n if (childs && (n = childs.length)) {\n var i = -1,\n n,\n c = node.children = [],\n v = 0,\n j = depth + 1;\n while (++i < n) {\n d = recurse(childs[i], j, nodes);\n d.parent = node;\n c.push(d);\n v += d.value;\n }\n if (sort) c.sort(sort);\n if (value) node.value = v;\n } else if (value) {\n node.value = +value.call(hierarchy, data, depth) || 0;\n }\n return node;\n }", "function renderAllTree(nodeObj, parent) {\n var i=0;\n nodeObj.renderOb(parent)\n if (supportsDeferral)\n for (i=nodeObj.nChildren-1; i>=0; i--) \n renderAllTree(nodeObj.children[i], nodeObj.navObj)\n else\n for (i=0 ; i < nodeObj.nChildren; i++) \n renderAllTree(nodeObj.children[i], null)\n}", "function buildFlatArray(root){\n\n\n for(var i = 0; i < root.length; i++){\n\n // If this node doesn't exist push it to flat array\n function checkDups(oneN){\n return oneN.id == root[i].id;\n }\n var exists = $rootScope.nodesFlat.find(checkDups);\n\n console.log(exists);\n\n if(!exists){\n $rootScope.nodesFlat.push({ id: root[i].id, name: root[i].name });\n }\n\n if(root[i].children.length != null){\n buildFlatArray(root[i].children);\n }\n\n }\n\n }", "function renderAllTree(nodeObj, parent) {\n var i=0;\n nodeObj.renderOb(parent);\n if (supportsDeferral)\n for (i=nodeObj.nChildren-1; i>=0; i--) \n renderAllTree(nodeObj.children[i], nodeObj.navObj);\n else\n for (i=0 ; i < nodeObj.nChildren; i++) \n renderAllTree(nodeObj.children[i], null);\n}", "buildHierarchy () {\n for (var i = this.layers.length - 1; i >= 0; i--) {\n for (var j = 0; j < this.layers[i].length; j++) {\n for (var k = 0; k < this.layers[i][j].length; k++) {\n if (this.layers[i][j][k] === null) {\n continue\n }\n if (this.layers[i][j][k].parents.length < 1) {\n this.roots.push(this.layers[i][j][k].findChildren(this, this.numChildren))\n }\n }\n }\n }\n }", "recountTree() {\n const flatNodes = this.getFlatNodes();\n const rootNodeValues = Object.keys(flatNodes).filter((value) => {\n return !this.getFlatNodeByValue(value).parent.id;\n });\n\n rootNodeValues.forEach((value) => {\n const flatNode = this.getFlatNodeByValue(value).self;\n const allNodesToRecount = this.getAllNodesToRecount(flatNode);\n\n allNodesToRecount.forEach(item => this.recountParentsCheck(getNodeValue(item)));\n });\n }", "depthFirstForEach(cb) {\n console.log(this);\n cb(this.value);\n if (this.left !== null) this.left.depthFirstForEach(cb);\n if (this.right !== null) this.right.depthFirstForEach(cb);\n }", "static flattenDepth() {\n let array = [1, [2, [3, [4]], 5]];\n console.log(_.flattenDepth(array, 30));\n array = [[[[[[{b: 34}]]], {a: 34}]]];\n console.log(_.flattenDepth(array, 2));\n }", "function makeHierarchy(array)\n{\n\n\n var i = array.length - 1;\n var j = 0;\n\n for(i; i > -1; i--)\n {\n \n if (array[i].parent == -1) \n {\n \n return array;\n }\n if(array[i].children)\n {\n \n\n for(j = 0;j < array[array[i].parent].children.length; j++)\n {\n \n if (array[array[i].parent].children[j].name == array[i].name) \n {\n \n array[array[i].parent].children[j].children = array[i].children;\n }\n }\n }\n }\n\n}", "depthFirstTraversal(fn) {\n fn(this.value);\n\n if (this.left) {\n this.left.depthFirstTraversal(fn);\n }\n\n if (this.right) {\n this.right.depthFirstTraversal(fn);\n }\n }", "depthFirstForEach(cb) {\n cb(this.value);\n if (this.left) this.left.depthFirstForEach(cb);\n if (this.right) this.right.depthFirstForEach(cb);\n }", "function TypeRecursion() {}", "function flattenTreeData() {\n var treeNodeList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var expandedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var expandedKeySet = new Set(expandedKeys === true ? [] : expandedKeys);\n var flattenList = [];\n\n function dig(list) {\n var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return list.map(function (treeNode, index) {\n var pos = Object(_util__WEBPACK_IMPORTED_MODULE_5__[\"getPosition\"])(parent ? parent.pos : '0', index);\n var mergedKey = getKey(treeNode.key, pos); // Add FlattenDataNode into list\n\n var flattenNode = _objectSpread(_objectSpread({}, treeNode), {}, {\n parent: parent,\n pos: pos,\n children: null,\n data: treeNode,\n isStart: [].concat(Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(parent ? parent.isStart : []), [index === 0]),\n isEnd: [].concat(Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(parent ? parent.isEnd : []), [index === list.length - 1])\n });\n\n flattenList.push(flattenNode); // Loop treeNode children\n\n if (expandedKeys === true || expandedKeySet.has(mergedKey)) {\n flattenNode.children = dig(treeNode.children || [], flattenNode);\n } else {\n flattenNode.children = [];\n }\n\n return flattenNode;\n });\n }\n\n dig(treeNodeList);\n return flattenList;\n}", "function traverseTree(fn, node, depth = 0) {\n return fn(\n node,\n // TODO: depth + 1 === maxDepth don't render children\n node.children.map(child =>\n traverseTree(child.value.render, child, depth + 1)\n ),\n depth\n );\n}", "function dataToHierarchy(data){\n\n var root= {name: \"root\", children:[]};\n getChildren(data, root);\n console.log(root);\n return root;\n}", "function SubTree(){\r\n\r\n\r\n}", "depthFirstForEach(cb) {\n // const traversePreOrder = (node) => {\n // cb(node.value); // Call the Callback on the First item and every item after that!\n // if (node.left) { // If there is a left node, then go left!\n // traversePreOrder(node.left); // Recursive call until there is no more left nodes!\n // }\n // if (node.right) { // If there is a right node, then go right!\n // traversePreOrder(node.right); // Recursive call until there is no more right nodes!\n // }\n // };\n // traversePreOrder(this); // Execute traversePreOrder on the tree!\n cb(this.value);\n if (this.left !== null) this.left.depthFirstForEach(cb);\n if (this.right !== null) this.right.depthFirstForEach(cb);\n }", "depthFirstSearch(array) {\n array.push(this.name);\n for (let child of this.children) {\n child.depthFirstSearch(array);\n }\n return array;\n }", "function flattenTree(data) {\n\n newList = [];\n\n //console.log(\"Data in: \");\n //console.log(data);\n\n recurseThroughTreeAndAddToList(data, newList, \"\");\n\n //console.log(\"List out: \");\n //console.log(newList);\n //console.log(\"flattenTree is done!\");\n\n return newList;\n}", "function flattenTreeData() {\n var treeNodeList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var expandedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var expandedKeySet = new Set(expandedKeys === true ? [] : expandedKeys);\n var flattenList = [];\n\n function dig(list) {\n var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return list.map(function (treeNode, index) {\n var pos = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__util__[\"b\" /* getPosition */])(parent ? parent.pos : '0', index);\n var mergedKey = getKey(treeNode.key, pos); // Add FlattenDataNode into list\n\n var flattenNode = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__babel_runtime_helpers_esm_objectSpread2__[\"a\" /* default */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__babel_runtime_helpers_esm_objectSpread2__[\"a\" /* default */])({}, treeNode), {}, {\n parent: parent,\n pos: pos,\n children: null,\n data: treeNode,\n isStart: [].concat(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__babel_runtime_helpers_esm_toConsumableArray__[\"a\" /* default */])(parent ? parent.isStart : []), [index === 0]),\n isEnd: [].concat(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__babel_runtime_helpers_esm_toConsumableArray__[\"a\" /* default */])(parent ? parent.isEnd : []), [index === list.length - 1])\n });\n\n flattenList.push(flattenNode); // Loop treeNode children\n\n if (expandedKeys === true || expandedKeySet.has(mergedKey)) {\n flattenNode.children = dig(treeNode.children || [], flattenNode);\n } else {\n flattenNode.children = [];\n }\n\n return flattenNode;\n });\n }\n\n dig(treeNodeList);\n return flattenList;\n}", "depthFirstSearch(array) {\n // append the name/value to input array\n array.push(this.name);\n \n // call the function again on all children\n for (let child of this.children) {\n child.depthFirstSearch(array);\n }\n return array;\n }", "function flatten(root) \n{\n var nodes = [];\n var i = 0;\n var depth = 0;\n\n\n function recurse(node) \n {\n if(typeof node.depth === \"undefined\")\n {\n node.depth = depth;\n }\n\n if((typeof node.children !== \"undefined\") && (node.children.length > 0)) \n {\n depth++;\n node.children.forEach(recurse);\n depth--;\n }\n if(typeof node.id === \"undefined\") \n {\n node.id = ++i;\n }\n nodes.push(node);\n }\n\n recurse(root);\n return nodes;\n}", "function flattenTreeData() {\n var treeNodeList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var expandedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var expandedKeySet = new Set(expandedKeys === true ? [] : expandedKeys);\n var flattenList = [];\n\n function dig(list) {\n var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return list.map(function (treeNode, index) {\n var pos = getPosition(parent ? parent.pos : '0', index);\n var mergedKey = getKey(treeNode.key, pos); // Add FlattenDataNode into list\n\n var flattenNode = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, treeNode), {}, {\n parent: parent,\n pos: pos,\n children: null,\n data: treeNode,\n isStart: [].concat((0, _toConsumableArray2.default)(parent ? parent.isStart : []), [index === 0]),\n isEnd: [].concat((0, _toConsumableArray2.default)(parent ? parent.isEnd : []), [index === list.length - 1])\n });\n flattenList.push(flattenNode); // Loop treeNode children\n\n if (expandedKeys === true || expandedKeySet.has(mergedKey)) {\n flattenNode.children = dig(treeNode.children || [], flattenNode);\n } else {\n flattenNode.children = [];\n }\n\n return flattenNode;\n });\n }\n\n dig(treeNodeList);\n return flattenList;\n}", "function flattenTreeData() {\n var treeNodeList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var expandedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var expandedKeySet = new Set(expandedKeys === true ? [] : expandedKeys);\n var flattenList = [];\n\n function dig(list) {\n var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return list.map(function (treeNode, index) {\n var pos = (0, _util.getPosition)(parent ? parent.pos : '0', index);\n var mergedKey = getKey(treeNode.key, pos); // Add FlattenDataNode into list\n\n var flattenNode = _objectSpread(_objectSpread({}, treeNode), {}, {\n parent: parent,\n pos: pos,\n children: null,\n data: treeNode,\n isStart: [].concat((0, _toConsumableArray2.default)(parent ? parent.isStart : []), [index === 0]),\n isEnd: [].concat((0, _toConsumableArray2.default)(parent ? parent.isEnd : []), [index === list.length - 1])\n });\n\n flattenList.push(flattenNode); // Loop treeNode children\n\n if (expandedKeys === true || expandedKeySet.has(mergedKey)) {\n flattenNode.children = dig(treeNode.children || [], flattenNode);\n } else {\n flattenNode.children = [];\n }\n\n return flattenNode;\n });\n }\n\n dig(treeNodeList);\n return flattenList;\n}", "function expand1Level(d) {\n var q = [d]; // non-recursive\n var cn;\n var done = null;\n while (q.length > 0) {\n cn = q.shift();\n if (done !== null && done < cn.depth) { return; }\n if (cn._children) {\n done = cn.depth;\n cn.children = cn._children;\n cn._children = null;\n cn.children.forEach(collapse);\n }\n if (cn.children) { q = q.concat(cn.children); }\n }\n // no nodes to open\n }", "function traverse(node) {\n const tree = { value: node.value };\n tree.left = node.left === null ? null : traverse(node.left);\n tree.right = node.right === null ? null : traverse(node.right);\n return console.log(tree);\n}", "function depthFirstFill(node) {\n if (node) {\n for (var i = 0; i < nodesArray.length; i++) {\n if (nodesArray[i].parentId === node.uuid) {\n node.children.push(nodesArray[i]);\n }\n }\n for (var i = 0; i < node.children.length; i++) {\n depthFirstFill(node.children[i]);\n }\n }\n }", "depthFirstSearch(array) {\n // Write your code here.\n\n // Step3: Push the first name property of this node object\n array.push(this.name);\n // console.log(`Array has this nodes name: ${array}`);\n\n //Step4: Loop through the nested Node objects and recursively call depth first search, with a specific node. Each recursive call will push the name of each childNode from left to right.\n for (let index in this.children) {\n console.log(`childNode: ${JSON.stringify(this.children[index])}`);\n const childNode = this.children[index];\n childNode.depthFirstSearch(array);\n }\n console.log(`Array Final: ${array}`);\n return array;\n }", "function fnTraversal(root, node, preorder, postorder) {\n\t\tnode.childnodes.forEach((child, i) => { //iterate over next deep level\n\t\t\tpreorder(root, node, child, i) && fnTraversal(root, child, preorder, postorder); //preorder = cut/poda\n\t\t\tpostorder(root, node, child, i);\n\t\t});\n\t\treturn self;\n\t}", "function nestRecursive(parent, object, offset, func)\n\t{\n\t\tobject.forEach(function(child)\n\t\t{\n\t\t\tchild.parent = parent;\n\t\t\tvar tempincrease = child.size;\n\t\t\tvar no = 0;\n\t\t\tchild.parent.sibling = [];\n\t\t\twhile (tempincrease <= (parent.size - 1))\n\t\t\t{\n\t\t\t\tchild.idx = (offset + tempincrease);\n\t\t\t\tchild.no = no;\n\t\t\t\ttempincrease += child.size;\n\t\t\t\tchild.parent.sibling.push((offset + (child.size * (no + 1))));\n\t\t\t\tnestRecursive(child, child.children, offset + (child.size * (no)), func)\n\t\t\t\tno++;\n\t\t\t}\n\t\t});\n\t\tfunc(parent);\n\t}", "function dfs(root){\r\n\r\n}", "function traverse(root) {}", "DFSPreOrder() {\n let data = [];\n let current = this.root;\n\n function traverse(node) {\n data.push(node.value);\n if (node.left) traverse(node.left);\n if (node.right) traverse(node.right);\n }\n traverse(current)\n console.log(data)\n return data;\n }", "function flatten(root) {\n\n var nodes = [], i = 0;\n\n function recurse(node) {\n\n if (node.children) node.children.forEach(recurse);\n if (!node.id) node.id=++i;\n nodes.push(node);\n \n }\n\n recurse(root);\n return nodes;\n }", "function buildTree(node) {\n if (node.value.length == 1) {\n node.value = node.value[0];\n node.arrayIndex = node.arrayIndex[0];\n } else if (findHighestSymbol(node.value)) {\n let topNodeSymbol = findHighestSymbol(node.value);\n setNodeAndChildren(node, topNodeSymbol);\n node.children.forEach(child => buildTree(child));\n } else {\n removeBrackets(node);\n buildTree(node);\n }\n}", "function preOrder_recursive(tree, index) {\n \n if (isUndefined(tree[index])) {\n return;\n }\n \n console.log(tree[index]);\n preOrder_recursive(tree, left(index));\n preOrder_recursive(tree, right(index));\n}", "function callDFS(arr) {\n // boundary and base case check:\n if(!arr.length) return null;\n // create variables to keep track of last element in postorder array \n const postRoot = postorder.pop(); // -> this is the root \n const index = arr.indexOf(postRoot); // --> find the root's index value within the inorder array\n const node = new TreeNode(postRoot); // -> construct new binary tree with found root \n\n // build right side leaves\n // slice will grab all of the items to the right of the index value of our postRoot variable\n node.right = callDFS(arr.slice(index + 1));\n\n // build left side leaves\n // slice will grab all of the items to the left of the index value of our postRoot variable\n // end will not be included. if omitted slice will go until the end of the sequence or arr.length \n node.left = callDFS(arr.slice(0, index));\n return node;\n }", "depthFirstSearch(array) {\n array.push(this.name);\n for (const child of this.children) {\n child.depthFirstSearch(array);\n }\n\n return array;\n }", "function recursivelyAggregateNodes(node, state) {\n // aggregate the current node\n node.rowData = aggregateSector(node.ultimateChildren, state.columnDefs, state.subtotalBy);\n\n // for each child - aggregate those as well\n if (node.children.length > 0) {\n for (var i = 0; i < node.children.length; i++)\n recursivelyAggregateNodes(node.children[i], state);\n }\n}", "function walkTreeRecursive($node) {\n\t// try visit me 1st\n\tif ($node[0].count==0 ) {\n\t\t$node[0].count++;\n\t\tif ( !$node.hasClass(abstractClass)) { // $node.hasClass(abstractClass) is an interesting part, bottom up parsing, we see a handle not a top node.\n\t\t\tsetFocus($node);\n\t\t\t_.delay(walkTreeRecursive, calcDelay($node), $node);\n\t\t\treturn ;\n\t\t}\n\t}\n\t// try visit any unvisited children - 1st time\n\tif ( $node[0].children && $node[0].children.length )\n\t\tfor (var i=0; i<$node[0].children.length; i++) \n\t\t{\n\t\t\tif ( $node[0].children[i].count==0 ) {\n\t\t\t\twalkTreeRecursive( $( $node[0].children[i] ) ) ;\n\t\t\t\treturn ;\n\t\t\t}\n\t\t\telse { // so remove focus when we move to sibling, but keep focus if i am last sibling\n\t\t\t\tvar isEdge = i == $node[0].children.length-1; \n\t\t\t\tunfocusDecendantsAndOptionallyLeaves( $($node[0].children[i] ), isEdge );\n\t\t\t}\n\t\t}\n\n\t// try visit myself 2nd time\n\tif ($node[0].count==1 ) {\n\t\t$node[0].count++;\n\t\t//unfocusLeaf($node);\n\t\tvar delay = $node.hasClass(abstractClass) ? calcDelay($node) : 0 ;\n\t\t_.delay(walkTreeRecursive, calcDelay($node), $node.parent());\n\t\treturn ;\n\t}\n\n}", "function recurse(tree,path) \n{\n for (var key in tree) \n {\n\tif (key == 'model') \n\t{\n\t compile(tree[key], path);\n\t continue;\n\t}\n\n\trecurse(tree[key], path == '' ? key : path + '.' + key)\n }\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flattenIter(data, depth, callback)\n{\n\tdoFlattenIter(data, depth, [], callback);\n}", "function flatten_recursive(obj)\n{\n\tif (typeof obj === 'function')\n\t\treturn undefined;\n\n\tif (typeof obj !== 'object')\n\t\treturn obj;\n\t\n\tif (Array.isArray(obj))\n\t\treturn obj.map(flatten_recursive);\n\t\n\tlet result = Object.create(null);\n\n\tfor(var key in obj)\n\t\tresult[key] = flatten_recursive(obj[key]);\n\n\treturn result;\n}", "_traverse(n, state, f) {\n var content = \"\";\n\n if (TreeTransformer.isNode(n)) {\n // If we were called on a node object, then we handle it\n // this way.\n var node = n; // safe cast; we just tested\n // Put the node on the stack before recursing on its children\n\n state._containers.push(node);\n\n state._ancestors.push(node); // Record the node's text content if it has any.\n // Usually this is for nodes with a type property of \"text\",\n // but other nodes types like \"math\" may also have content.\n\n\n if (typeof node.content === \"string\") {\n content = node.content;\n } // Recurse on the node. If there was content above, then there\n // probably won't be any children to recurse on, but we check\n // anyway.\n //\n // If we wanted to make the traversal completely specific to the\n // actual Perseus parse trees that we'll be dealing with we could\n // put a switch statement here to dispatch on the node type\n // property with specific recursion steps for each known type of\n // node.\n\n\n var keys = Object.keys(node);\n keys.forEach(key => {\n // Never recurse on the type property\n if (key === \"type\") {\n return;\n } // Ignore properties that are null or primitive and only\n // recurse on objects and arrays. Note that we don't do a\n // isNode() check here. That is done in the recursive call to\n // _traverse(). Note that the recursive call on each child\n // returns the text content of the child and we add that\n // content to the content for this node. Also note that we\n // push the name of the property we're recursing over onto a\n // TraversalState stack.\n\n\n var value = node[key];\n\n if (value && typeof value === \"object\") {\n state._indexes.push(key);\n\n content += this._traverse(value, state, f);\n\n state._indexes.pop();\n }\n }); // Restore the stacks after recursing on the children\n\n state._currentNode = state._ancestors.pop();\n\n state._containers.pop(); // And finally call the traversal callback for this node. Note\n // that this is post-order traversal. We call the callback on the\n // way back up the tree, not on the way down. That way we already\n // know all the content contained within the node.\n\n\n f(node, state, content);\n } else if (Array.isArray(n)) {\n // If we were called on an array instead of a node, then\n // this is the code we use to recurse.\n var nodes = n; // Push the array onto the stack. This will allow the\n // TraversalState object to locate siblings of this node.\n\n state._containers.push(nodes); // Now loop through this array and recurse on each element in it.\n // Before recursing on an element, we push its array index on a\n // TraversalState stack so that the TraversalState sibling methods\n // can work. Note that TraversalState methods can alter the length\n // of the array, and change the index of the current node, so we\n // are careful here to test the array length on each iteration and\n // to reset the index when we pop the stack. Also note that we\n // concatentate the text content of the children.\n\n\n var index = 0;\n\n while (index < nodes.length) {\n state._indexes.push(index);\n\n content += this._traverse(nodes[index], state, f); // Casting to convince Flow that this is a number\n\n index = state._indexes.pop() + 1;\n } // Pop the array off the stack. Note, however, that we do not call\n // the traversal callback on the array. That function is only\n // called for nodes, not arrays of nodes.\n\n\n state._containers.pop();\n } // The _traverse() method always returns the text content of\n // this node and its children. This is the one piece of state that\n // is not tracked in the TraversalState object.\n\n\n return content;\n }", "function buildTree(arr) {\r\n\t \r\n\tlet findNestedObj = function (obj, parent, id) {\r\n\r\n\t\tif(Object.keys(obj).map(Number).indexOf(parent) != -1) {\r\n\t\t\treturn obj[parent][id]={};\r\n\t\t}\r\n\r\n\t\tfor (let i in obj) {\r\n\t\t\t\r\n\t\t\tif (Object.keys(obj[i]).length > 0) {\r\n\t\t\t\t findNestedObj(obj[i], parent, id);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\t\r\n\t}\r\n\t\r\n\tlet tree = arr.reduce(function (t, el){\r\n\r\n\t\t\t\t\tif(el.parent == null) t[el.id] = {};\r\n\t\t\t\t\telse findNestedObj (t, el.parent, el.id);\r\n\r\n\t\t\t\treturn t;\r\n\t\t\t\t\r\n\t\t\t},{});\r\n\r\n\treturn tree;\r\n\t\r\n}", "function flattenTree(tree) {\n let flatTree = {};\n\n addCounts('START', tree);\n\n function addCounts(parentLetter, subTree) {\n // Add the entry at the root level if we never saw that letter before\n if (!_.has(flatTree, parentLetter)) {\n flatTree[parentLetter] = {};\n }\n let parentTree = flatTree[parentLetter];\n\n // Add counts of each deep branch to the root level\n _.each(subTree, (data, letter) => {\n if (!_.has(parentTree, letter)) {\n parentTree[letter] = 0;\n }\n\n // Increase the count\n parentTree[letter] += data.count;\n\n // Go recursively in sub branches\n if (!_.isEmpty(data.branches)) {\n addCounts(letter, data.branches);\n return;\n }\n\n // If last branch, mark it as a leaf\n if (!_.has(parentTree, 'END')) {\n parentTree.END = 0;\n }\n parentTree.END++;\n });\n }\n\n return flatTree;\n}", "function makeTree(data){\r\n\t// *********** Convert flat data into a nice tree ***************\r\n\t// create a name: node map\r\n\tvar dataMap = data.reduce(function(map, node) {\r\n\t\tmap[node.name] = node;\r\n\t\treturn map;\r\n\t}, {});\r\n\t\r\n\tthis.dataMap = dataMap;\r\n\r\n\t// create the tree array\r\n\tvar treeData = [];\r\n\tdata.forEach(function(node) {\r\n\t\t// add to parent\r\n\t\tvar parent = dataMap[node.parent];\r\n\t\tif (parent) {\r\n\t\t\t// create child array if it doesn't exist\r\n\t\t\t(parent.children || (parent.children = []))\r\n\t\t\t\t// add node to child array\r\n\t\t\t\t.push(node);\r\n\t\t} else {\r\n\t\t\t// parent is null or missing\r\n\t\t\ttreeData.push(node);\r\n\t\t}\r\n\t});\r\n\tthis.treeData = treeData;\r\n\treturn treeData;\r\n\t\r\n}", "function perLevel (root){\n var result = [];\n var queue = [];\n queue.push(root);\n queue.push(null);\n var i = 0;\n while (i< queue.length){\n var curr = queue[i];\n if(curr === null){\n if(i<queue.length-1){\n queue.push(null);\n }\n console.log(result);\n result = [];\n i++;\n continue;\n }\n if(curr.left !== null){\n var left = curr.left;\n queue.push(left);\n }\n if(curr.right !== null){\n var right = curr.right;\n queue.push(right);\n }\n result.push(curr.value);\n i++;\n }\n return result;\n}", "function callDFS(start, end) {\n // base case\n if(start > end) return null;\n // create variables to keep track of root value and index\n const postRoot = postorder.pop();\n const index = map.get(postRoot);\n const node = new TreeNode(postRoot);\n\n // build left and right side leaves\n node.right = callDFS(index + 1, end);\n node.left = callDFS(start, index - 1);\n return node;\n }", "$_fillRecursive(formData) {}", "function createTree(data, portlist, hier, cols, label='Grand', accum='') {\n let total = calcTotal(data, portlist, cols)\n\n if (hier.length == 0) {\n return {\n label : label,\n total : total,\n uid : accum,\n children: mergeDataRow(data, cols)\n }\n } else if (label=='Grand') {\n return {\n label : \"\",\n total : total,\n uid : \"grand\",\n children : applyHierarchy(_.groupBy(data, item=>item[hier[0]]),\n portlist, hier.slice(1), cols, accum)\n }\n } else {\n return {\n label : label,\n total : total,\n uid : accum,\n children : applyHierarchy(_.groupBy(data, item=>item[hier[0]]),\n portlist, hier.slice(1), cols, accum)\n }\n }\n\n}", "DFSPreOrder(){\n var data = [],\n current = this.root\n \n function traverse(node) {\n data.push(node.value)\n if (node.left) traverse(node.left)\n if (node.right) traverse(node.right)\n }\n traverse(current)\n return data\n }", "function flattenIter(data, depth, callback) {\n\tdoFlattenIter(data, depth, [], callback);\n}", "breadthFirst() {\n\n let iteration = [];\n\n let traversal = (current, num) => {\n if (!current) {\n return null;\n }\n\n if (!iteration[num]) {\n iteration[num] = [current.value];\n } else {\n iteration[num].push(current.value);\n }\n\n traversal(current.left, num + 1);\n traversal(current.right, num + 1);\n };\n\n traversal(this.root, 0);\n\n let flattenArray = (array, result = []) => {\n\n for (let i = 0; i < array.length; i++) {\n let value = array[i];\n if (Array.isArray(value)) {\n flattenArray(value, result);\n } else {\n result[result.length] = value;\n }\n }\n\n return result;\n };\n\n return flattenArray(iteration);\n }", "depthFirstSearch(array) {\n // Write your code here.\n\t\t// console.log(array), array = []\n\t\tarray.push(this.name);\n\t\t// console.log(array)\n\t\tfor (const child of this.children) {\n\t\t\tchild.depthFirstSearch(array);\n\t\t\t// console.log(child)\n\t\t}\n\t\treturn array;\n }", "depthFirst() {\n let repr = ''\n function helper(node) {\n if (node) {\n let val = node.value\n repr += val.toString() + ' '\n helper(node.left)\n helper(node.right)\n }\n }\n helper(this.root)\n return repr\n }", "function preorder(root){\r\n if (!root) return;\r\n\r\n console.log(root.val);\r\n preorder(root.left);\r\n preorder(root.right);\r\n // F, B, A, D, C, E, G, I, H\r\n}", "function postOrderTraverse(tree, array) {\n // Write your code here.\n\tif(tree !== null){\n\t\tpostOrderTraverse(tree.left, array);\n\t\tpostOrderTraverse(tree.right, array);\n\t\tarray.push(tree.value);\n\t}\n\n\treturn array;\n}", "function tree(t){\n // if the tree is empy, return 0\n if(!t){\n return 0;\n }\n // Sums up all the nodes of a tree.\n return tree(t.left) + t.value + tree(t.right)\n}", "dfsInOrder() {\r\n let result = []\r\n\r\n const traverse = node => {\r\n if (node.left) traverse(node.left)\r\n result.push(node.data) //push to stack\r\n if (node.right) traverse(node.right)\r\n }\r\n\r\n traverse(this.root)\r\n return result\r\n }", "dfsPreOrder() {\n let result = []\n const traverse = (node) => {\n // capture root node value\n result.push(node.value);\n // if left exists, go left again\n if (node.left) {\n traverse(node.left);\n } \n // if right child exists, go right again\n if (node.right) { \n traverse(node.right);\n }\n }\n traverse(this.root);\n return result;\n }", "function assembleTree(data) {\n var t = [];\n var list = data.map(function (i) {\n return {\n id: i.id,\n icon: i.icon,\n label: i.name,\n action: i.url,\n parentId: i.parentId\n };\n });\n\n function findChild(i) {\n var c = list.filter(function (c) {\n return c.parentId == i.id;\n });\n if (c && c.length) {\n i.terminal = false;\n var f = false;\n c.forEach(function (ci) {\n var cf = findChild(ci);\n if (cf) f = true;\n });\n i.children = c;\n i.ismenu = f;\n return true;\n }\n i.terminal = true;\n return false;\n }\n\n list.forEach(function (i) {\n if (!i.parentId) {\n findChild(i);\n t.push(i);\n }\n });\n return t;\n }", "function walkTheDOMRecursive(func,node,depth,returnedFromParent) {\n\t var root = node || window.document;\n\t returnedFromParent = func.call(root,depth++,returnedFromParent);\n\t node = root.firstChild;\n\t while(node) {\n\t walkTheDOMRecursive(func,node,depth,returnedFromParent);\n\t node = node.nextSibling;\n\t }\n\t}", "function makeUL(topName) {\n var result = '<ul>';//starting point\n for (var k in topName) {\n result = result + '<li>' + topName[k] + '</li>';//adding each node\n result = result + makeUL(findChildren(topName[k], parents, children));//recursion\n//console.log(childs);\n\n }\n result = result + '</ul>';\n return result;\n}", "function tree(t){\n if(!t){\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right)\n}", "function tree(t){\n if(!t){\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right)\n}", "function getTree(id, li_id, nodeif){\n $(li_id).parent().parent().parent().find(\"input\").val(0);\n var nextstr = '<ul class=\"hierarchy\">';\n for (var i = 0; i < subcat.length; i++) {\n if (subcat[i][2] == id) {\n if (subcat[i][4] == 0) {\n nextstr += '<li onclick=\"treeok(' + subcat[i][1] + ',this,1)\" title=\"' + subcat[i][0] + '\">' + subcat[i][0] + '</li>';\n }else{\n nextstr += '<li onclick=\"getTree(' + subcat[i][1] + ',this,1)\" title=\"' + subcat[i][0] + '\"><b class=\"arr\"></b>' + subcat[i][0] + '</li>';\n }\n }\n }\n nextstr += '</ul>';\n $(li_id).parent().find(\"li\").removeClass(\"current\");\n $(li_id).addClass(\"current\");\n $(li_id).parent().nextAll().remove();\n $(li_id).parent().parent().append(nextstr);\n\n var lic = $(li_id).parent().parent().find(\"li\");\n var arrCategory = [];\n for (var i = 0; i < lic.length; i++) {\n if( lic.eq(i).hasClass('current') ){\n tree0 = setContent( $(lic.eq(i)).html());\n arrCategory.push(tree0);\n }\n };\n tree0 = arrCategory.join(\">\");\n\n $(li_id).parent().parent().parent().find(\".analog-select\").html('<em></em>' + tree0);\n $(li_id).parents('.editlayout').find('.msgs').html('');\n}", "makeTree() {\n\t\tif (this.length === 0)\n\t\t\treturn [];\n\t\tlet base = this.data;\n\t\tlet dataTree = [];\n\t\tconst mappedWFItems = new Map();\n\t\tbase.forEach(wfItem => mappedWFItems.set(wfItem.id, {...wfItem}));\n\t\tbase.forEach(wfItem => {\n\t\t\tif (wfItem.parentID) {\n\t\t\t\tlet mfwItem = mappedWFItems.get(wfItem.parentID);\n\t\t\t\tif (!mfwItem.children)\n\t\t\t\t\tmfwItem.children = [];\n\t\t\t\tmfwItem.children.push(mappedWFItems.get(wfItem.id));\n\t\t\t}\n\t\t\telse dataTree.push(mappedWFItems.get(wfItem.id));\n\t\t});\n\t\t//Sort children via order prop!\n\t\tdataTree.forEach(twfItem => {\n\t\t\tif(twfItem.children && twfItem.children.length > 0){\n\t\t\t\ttwfItem.children = sortChildren(twfItem.children); \n\t\t\t}\n\t\t});\n\t\tthis.tree = dataTree;\n\t\tthis._mappedWFs = mappedWFItems;\n\t\treturn dataTree;\n\t}", "function traverse(node, func) {\n\tfunc(node);//1\n\tfor (var key in node) { //2\n\t\tif (node.hasOwnProperty(key)) { //3\n\t\t\tvar child = node[key];\n\t\t\tif (typeof child === 'object' && child !== null) { //4\n\n\t\t\t\tif (Array.isArray(child)) {\n\t\t\t\t\tchild.forEach(function (node) { //5\n\t\t\t\t\t\ttraverse(node, func);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\ttraverse(child, func); //6\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "function _makeFlat(recursive) {\n return function flatt(list) {\n var value, result = [], idx = -1, j, ilen = list.length, jlen;\n while (++idx < ilen) {\n if (isArrayLike(list[idx])) {\n value = (recursive) ? flatt(list[idx]) : list[idx];\n j = -1;\n jlen = value.length;\n while (++j < jlen) {\n result.push(value[j]);\n }\n } else {\n result.push(list[idx]);\n }\n }\n return result;\n };\n }", "function preOrderTraverse(tree, array) {\n // Write your code here.\n\tif (tree !== null){\n\t\tarray.push(tree.value);\n\t\tpreOrderTraverse(tree.left, array);\n\t\tpreOrderTraverse(tree.right, array);\n\t}\n\n\treturn array;\n}", "function preOrder(root) {\n console.log(root.data) \n root.left && preOrder(root.left) \n root.right && preOrder(root.right) \n }", "function tree(t) {\n if(!t){\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right);\n}", "function tree(t){\n if(!t){\n return 0;\n }\n return tree(t.left) + t.value + tree(t.right);\n}", "function recurse(d) {\n var tree = rootedTree.apply(null, [square(9).round(2)].concat(wholeNumbers(d < D ? B : 0).map(function(i) {\n return recurse(d+1);\n }))).bareHead().xmargin(2).ymargin(50);\n if (opts.pause) tree.showLevel(d);\n return tree;\n }", "recursiveDepthCalc(el, sum) {\n if (el.parentElement.id === 'fatherNode') {\n return sum+1;\n }\n else if (el.tagName !== 'UL') {\n return this.recursiveDepthCalc(el.parentElement, sum);\n }\n else {\n return this.recursiveDepthCalc(el.parentElement, sum + 1);\n }\n }", "preOrder() { //DLR\n let results = [];\n\n let _walk = node => {\n results.push(node.value); //executing code\n if(node.left) _walk(node.left); //go left - if node,left is null, we are at a leaf - traversing\n if(node.right) _walk(node.right); // go right - if node.right=null then we are at a leaf - traversing\n };\n console.log(_walk(this.root));\n _walk(this.root); // for whiteboard use ll.root instead of this.root, unless using a class constructor\n return results;\n }", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n }", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n }", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n }", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n }", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n }", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n }", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n }", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n }", "function flatten$1(array, depth) {\n return flatten(array, depth, false);\n }" ]
[ "0.6545768", "0.6522955", "0.6522955", "0.6522955", "0.63996917", "0.6390482", "0.63771105", "0.63418573", "0.63144714", "0.6300509", "0.62738794", "0.62598526", "0.6240276", "0.62336373", "0.62021476", "0.61904514", "0.61747825", "0.6170924", "0.6166377", "0.61520875", "0.61497337", "0.61479384", "0.61464626", "0.61333257", "0.61124545", "0.6110174", "0.6104413", "0.6095773", "0.6088119", "0.6082584", "0.60581374", "0.60511076", "0.6024732", "0.6021293", "0.60199463", "0.60114443", "0.6008102", "0.6003324", "0.59899956", "0.5983259", "0.5983172", "0.598058", "0.5974178", "0.59671354", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.59659606", "0.5964132", "0.59574324", "0.59427077", "0.59352124", "0.5934561", "0.59333444", "0.592909", "0.5925294", "0.5917382", "0.5911324", "0.5908917", "0.5897404", "0.5879183", "0.58763295", "0.5865835", "0.58653915", "0.586493", "0.5864929", "0.5864626", "0.5861933", "0.58561915", "0.58504695", "0.584679", "0.584679", "0.58459437", "0.58451045", "0.5844348", "0.58410996", "0.58372563", "0.5829102", "0.582088", "0.5811601", "0.580925", "0.58052486", "0.57944626", "0.5794449", "0.5794449", "0.5794449", "0.5794449", "0.5794449", "0.5794449", "0.5794449", "0.5794449", "0.5794449" ]
0.0
-1
Return a promise to load features for the genomic interval
async readFeatures(chr, start, end) { const index = await this.getIndex() if (index) { this.indexed = true return this.loadFeaturesWithIndex(chr, start, end) } else if (this.dataURI) { this.indexed = false return this.loadFeaturesFromDataURI() } else { this.indexed = false return this.loadFeaturesNoIndex() } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async readFeatures(chr, start, end) {\n\n const index = await this.getIndex()\n if (index) {\n return this.loadFeaturesWithIndex(chr, start, end);\n } else if (this.dataURI) {\n return this.loadFeaturesFromDataURI();\n } else {\n return this.loadFeaturesNoIndex()\n }\n\n }", "load () {\n this.fire('dataLoading') // for supporting loading spinners\n \n let promise = this.coverage.loadDomain().then(domain => {\n this.domain = domain\n \n ;[this._projX, this._projY] = getHorizontalCRSComponents(domain)\n return loadProjection(domain)\n }).then(proj => {\n this.projection = proj\n })\n if (this._loadCoverageSubset) {\n promise = promise.then(() => this._loadCoverageSubset())\n } else if (this.parameter) {\n promise = promise.then(() => this.coverage.loadRange(this.parameter.key)).then(range => {\n this.range = range\n })\n }\n \n promise = promise.then(() => {\n this.fire('dataLoad')\n }).catch(e => {\n console.error(e)\n this.fire('error', {error: e})\n this.fire('dataLoad')\n })\n return promise\n }", "function get_features(refseqID) {\n\n\tvar myFeatures;\t\n\tglue.inMode(\"reference/\"+refseqID, function(){\n\t\tmyFeatures = glue.getTableColumn(glue.command([\"list\", \"feature-location\"]), \"feature.name\");\n\t});\n\treturn myFeatures;\n}", "getFeaturesInRange(contig: string, start: number, stop: number): Q.Promise<string> {\n start--; // switch to zero-based indices\n stop--;\n return this._getSequenceHeader(contig).then(header => {\n var dnaOffset = header.offset + header.dnaOffsetFromHeader;\n var offset = Math.floor(dnaOffset + start/4);\n var byteLength = Math.ceil((stop - start + 1) / 4) + 1;\n return this.remoteFile.getBytes(offset, byteLength).then(dataView => {\n return markUnknownDNA(\n unpackDNA(dataView, start % 4, stop - start + 1), start, header)\n .join('');\n });\n });\n }", "getFeaturesByTagExpression() {\n return getTestCasesFromFilesystem({\n cwd: '',\n eventBroadcaster: eventBroadcaster,\n featurePaths: this.getFeatures(),\n pickleFilter: new PickleFilter({\n tagExpression: this.getCucumberCliTags()\n }),\n order: 'defined'\n }).then(function (results) {\n let features = [];\n let scenarios = [];\n _.forEach(results, function (result) {\n if (argv.parallelFeatures) {\n features.push(result.uri);\n } else {\n let lineNumber = result.pickle.locations[0].line;\n let uri = result.uri;\n let scenario = `${uri}:${lineNumber}`;\n scenarios.push(scenario);\n }\n });\n\n return {\n features: _.sortedUniq(features),\n scenarios: scenarios\n };\n });\n }", "getFeatures() {\n let filesGlob = 'e2e/features/**/*.feature';\n let files = glob.sync(filesGlob);\n return _.sortedUniq(files);\n }", "async function loadData() {\r\n\tlet result = [];\r\n\tlet resp = await fetch('./cats.geojson');\r\n\tlet data = await resp.json();\r\n\tdata.features.forEach(f => {\r\n\t\tresult.push({\r\n\t\t\tlat:f.geometry.coordinates[1],\r\n\t\t\tlng:f.geometry.coordinates[0]\r\n\t\t});\r\n\t});\r\n\treturn result;\r\n}", "function gvpLoadPromise () {\n if (context.uriAddressableDefsEnabled) {\n return Promise[\"resolve\"]();\n } else {\n return context.globalValueProviders.loadFromStorage();\n }\n }", "function loadFeature( feature, data ) {\n // Add a Spinner\n var bodyNode = can.$('body');\n var waitingNode = can.$('<div class=\"dg-feature-loading\"><span class=\"dg-square-spinner\">&nbsp;</span></div>');\n waitingNode.appendTo(bodyNode);\n\n // Loads the feature files and templates, feature name is critical to the file name\n require(['js/features/'+feature+'.min.js'], function( init ){\n fadeOut(waitingNode, function(){\n init( data );\n waitingNode.remove();\n });\n }, onInternetDown);\n \n currentFeature = feature;\n\n return feature;\n}", "load ()\n {\n let thisObj = this;\n return new Promise (function (resolve, reject)\n {\n //run async mode\n (async function () { \n try {\n\n\n \n //pull the feature service definition'\n logger.info(\"Fetching the feature service definition...\")\n let featureServiceJsonResult = await makeRequest({method: 'POST', timeout: 120000, url: thisObj.featureServiceUrl, params: {f : \"json\", token: thisObj.token}});\n thisObj.featureServiceJson = featureServiceJsonResult\n //check to see if the feature service has a UN\n if (thisObj.featureServiceJson.controllerDatasetLayers != undefined)\n { \n thisObj.layerId = thisObj.featureServiceJson.controllerDatasetLayers.utilityNetworkLayerId;\n let queryDataElementUrl = thisObj.featureServiceUrl + \"/queryDataElements\";\n let layers = \"[\" + thisObj.layerId + \"]\"\n \n let postJson = {\n token: thisObj.token,\n layers: layers,\n f: \"json\"\n }\n logger.info(\"Fetching the utility network data element ...\")\n //pull the data element definition of the utility network now that we have the utility network layer\n let undataElement = await makeRequest({method: 'POST', url: queryDataElementUrl, params: postJson });\n \n //request the un layer defition which has different set of information\n let unLayerUrl = thisObj.featureServiceUrl + \"/\" + thisObj.layerId;\n postJson = {\n token: thisObj.token,\n f: \"json\"\n }\n\n logger.info(\"Fetching the utility network layer definition ...\")\n\n let unLayerDef = await makeRequest({method: 'POST', url: unLayerUrl, params: postJson });\n \n thisObj.dataElement = undataElement.layerDataElements[0].dataElement;\n thisObj.layerDefinition = unLayerDef\n thisObj.subnetLineLayerId = thisObj.getSubnetLineLayerId(); \n resolve(thisObj);\n }\n else\n reject(\"No Utility Network found in this feature service\");\n\n }\n\n catch(ex){\n reject(ex)\n }\n })();\n })\n\n \n }", "async function getData() {\n request.open('GET',\n 'https://services1.arcgis.com/0n2NelSAfR7gTkr1/arcgis/rest/services/Business_Licenses/FeatureServer/0/query?where=FID' + ' > ' + lastFID + ' AND FID <= ' + (lastFID + 500) + '&outFields=*&outSR=4326&f=json',\n true);\n\n //comment out the following line to quickly edit ui without making requests\n request.send();\n}", "load() {\n return this.loading || (this.loading = this.loadFunc().then(support => this.support = support, err => { this.loading = null; throw err; }));\n }", "function get_features(res, mysql, context, complete){\r\n mysql.pool.query(\"SELECT * FROM features\", function(error, results, fields){\r\n if(error){\r\n res.write(JSON.stringify(error));\r\n res.end();\r\n }\r\n context.features = results;\r\n complete();\r\n });\r\n }", "getGC() {\n return this.$http.get(PATH + \"gc_polygon.topo.json\", {cache: true})\n .then(function(data, status) {\n return topojson.feature(data.data, data.data.objects['dc_polygon.geo']);\n });\n }", "async function fetchData(data) {\n let fetchedData = await fetch(data);\n let json = await fetchedData.json();\n let features = json.features;\n return features\n}", "async getLoadOperation() {}", "load() {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function* () { });\n }", "$onInit() {\n\n \tPromise.all([\n \t\tthis.loadLocations(),\n \t\tthis.loadCategories(), \n \t\tthis.loadCollections()\n \t]).then(() => this.loadFeatures(this.filter))\n }", "get features() {\r\n return new Features(this);\r\n }", "get features() {\r\n return new Features(this);\r\n }", "async loadFeatureList(list) {\n await import(\"./subcomp/facility.js\")\n .then(() => {\n // API call for get Facilities List\n list.forEach(\n (item) =>\n (this._qs(\".features\").innerHTML += `\n <facility-comp \n key=\"${item.featureId}\" \n name=\"${item.feature}\" \n measurable=\"${item.quantity == \"null\" ? \"false\" : \"1\"}\" \n checked=\"true\" \n quantity=\"${item.quantity}\"\n ></facility-comp>\n `)\n );\n })\n .catch((err) => this.popup(err, \"error\"));\n }", "getContigList(): Q.Promise<string[]> {\n return this.header.then(header => header.sequences.map(seq => seq.name));\n }", "async function getFeatures() {\n // Read JSON file\n return await fetch(base_url + '/content/mapping_metrics_definition.json')\n .then(response => response.json())\n .then(data => {\n let features = data['features'];\n getButtonType().then(button => {\n\n document.getElementById('buttons').innerHTML = '';\n let div = document.createElement('div');\n div.className = 'control-area';\n\n let buttonType;\n if (typeof uid !== undefined && uid !== \"\" && uid != null) {\n buttonType = button[0];\n } else {\n buttonType = button[1];\n }\n div.innerHTML = `<button id=\"save-button\" class=\"create-button\" onclick=\"createEditProcess()\" type=\"button\"> ` + buttonType + ` </button>`\n\n // Append element to document\n document.getElementById('buttons').appendChild(div);\n })\n return features;\n });\n}", "async function getData(){\r\n\r\n //Fetch the data from the geojson file\r\n fetch(\"BEWES_Building_Data.geojson\").then(response => response.json()).then(data => {addToTable(data);});\r\n\r\n }", "getFeatures() {\n\t\tfetch(`https://maximum-arena-3000.codio-box.uk/api/features/${this.state.prop_ID}`, {\n\t\t\tmethod: \"GET\",\n\t\t\tbody: null,\n\t\t\theaders: {\n\t\t\t\t\"Authorization\": \"Basic \" + btoa(this.context.user.username + \":\" + this.context.user.password)\n\t\t\t}\n\t\t})\n\t\t\t.then(status)\n\t\t\t.then(json)\n\t\t\t.then(dataFromServer => {\n\t\t\t\tthis.setState({\n\t\t\t\t\tfeatures: dataFromServer,\n\t\t\t\t});\n\t\t\t\tconsole.log(dataFromServer, 'features here')\n\t\t\t})\n\t\t\t.catch(error => {\n\t\t\t\tconsole.log(error)\n\t\t\t\tmessage.error('Could not get the features. Try Again!', 5);\n\t\t\t});\n\t}", "async function loadCoreData() {\n await Promise.all([\n loadExercises(),\n loadCategories(),\n loadSessions(),\n ]);\n}", "function load() {\n return Promise.all([storage.getTree(), storage.getTokenIndex(), storage.getEntries()])\n .then(function(result) {\n console.log('load results')\n tree = result[0];\n dbIndex = new Index(result[1]);\n entries = result[2];\n });\n}", "load() {\n return Promise.resolve(false /* identified */);\n }", "async fetchDvFeatures() {\n await fetch(\n `${this.mapboxLayer.url}/data/ch.sbb.direktverbindungen.public.json?key=${this.mapboxLayer.apiKey}`,\n )\n .then((res) => res.json())\n .then((data) => {\n this.allFeatures = data['geops.direktverbindungen'].map((line) => {\n return new Feature({\n ...line,\n geometry: new LineString([\n [line.bbox[0], line.bbox[1]],\n [line.bbox[2], line.bbox[3]],\n ]),\n });\n });\n this.syncFeatures();\n })\n // eslint-disable-next-line no-console\n .catch((err) => console.error(err));\n }", "async function load() { // returns a promise of an array\n const rawData = await fsp.readFile('./restaurant.json');\n const restaurantsArray = (JSON.parse(String(rawData)));\n return restaurantsArray;\n}", "async loadLazy () {\n /**\n if(this.load && !this.loadComplete) {\n import('./lazy-element.js').then((LazyElement) => {\n this.loadComplete = true;\n console.log(\"LazyElement loaded\");\n }).catch((reason) => {\n console.log(\"LazyElement failed to load\", reason);\n });\n }\n */\n }", "loadLevels() {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function* () {\n const level_list = yield Object(_placeos_ts_client__WEBPACK_IMPORTED_MODULE_2__[\"queryZones\"])({ tags: 'level', limit: 2500 })\n .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__[\"map\"])((i) => i.data))\n .toPromise();\n const levels = level_list.map((lvl) => new _level_class__WEBPACK_IMPORTED_MODULE_7__[\"BuildingLevel\"](lvl));\n levels.sort((a, b) => (a.name || '').localeCompare(b.name || ''));\n this.levels_subject.next(levels);\n });\n }", "load() {\n return __awaiter(this, undefined, undefined, function* () {\n yield Promise.all([\n this._strings.load(),\n this._pedal.load(),\n this._keybed.load(),\n this._harmonics.load(),\n ]);\n this._loaded = true;\n });\n }", "function loadAllRegimes() {\n //also get the available regimens here for later\n return conceptService.get(Bahmni.Common.Constants.arvRegimensConvSet).then(function (result) {\n vm.allRegimes = result.data;\n });\n }", "async getFeaturesAtLocation(latLngHeight, providerCoords) {\n const pickPosition = this.scene.globe.ellipsoid.cartographicToCartesian(Cartographic.fromDegrees(latLngHeight.longitude, latLngHeight.latitude, latLngHeight.height));\n const pickPositionCartographic = Ellipsoid.WGS84.cartesianToCartographic(pickPosition);\n const promises = [];\n const imageryLayers = [];\n for (let i = this.scene.imageryLayers.length - 1; i >= 0; i--) {\n const imageryLayer = this.scene.imageryLayers.get(i);\n const imageryProvider = imageryLayer.imageryProvider;\n // @ts-ignore\n const imageryProviderUrl = imageryProvider.url;\n if (imageryProviderUrl && providerCoords[imageryProviderUrl]) {\n var tileCoords = providerCoords[imageryProviderUrl];\n const pickPromise = imageryProvider.pickFeatures(tileCoords.x, tileCoords.y, tileCoords.level, pickPositionCartographic.longitude, pickPositionCartographic.latitude);\n if (pickPromise) {\n promises.push(pickPromise);\n }\n imageryLayers.push(imageryLayer);\n }\n }\n const pickedFeatures = this._buildPickedFeatures(providerCoords, pickPosition, [], promises, imageryLayers, pickPositionCartographic.height, true);\n await pickedFeatures.allFeaturesAvailablePromise;\n return pickedFeatures.features;\n }", "async function importFeatureSuggestions(p) {\n if (!confirm(\"Import feature suggestions?\\n(This adds a lot of data.)\")) return\n await loadCompendiumFeatureSuggestions()\n // console.log(\"compendiumFeatureSuggestionsTables\", compendiumFeatureSuggestionsTables)\n const nodeTable = compendiumFeatureSuggestionsTables[\"Node\"]\n importNodeTable(p, nodeTable)\n const viewNodeTable = compendiumFeatureSuggestionsTables[\"ViewNode\"]\n importViewNodeTable(p, viewNodeTable)\n const linkTable = compendiumFeatureSuggestionsTables[\"Link\"]\n importLinkTable(p, linkTable)\n const viewLinkTable = compendiumFeatureSuggestionsTables[\"ViewLink\"]\n importViewLinkTable(p, viewLinkTable)\n}", "function fetchGeoData(){\n $.ajax({\n dataType: \"json\",\n url: \"data/map.geojson\",\n success: function(data) {\n $(data.features).each(function(key, data) {\n geoDataLocations.push(data);\n });\n startMap();\n },\n error: function(error){\n console.log(error);\n return error;\n }\n });\n }", "function got_features(bbox, features){\n console.log('got features')\n\n sort_features(features)\n\n features.forEach(function(feature){\n console.log(new Date(feature.attributes.acquisitionDate))\n })\n\n var dates = []\n for(var i = 1999; i <= 2013; i++){\n for(var j = 1; j <= 12; j++){\n dates.push(new Date( '' + j + '/01/' + i + ' GMT-0800 (PST)'))\n }\n }\n // dates.push(new Date('1/01/2014 GMT-0800 (PST)'))\n // dates.push(new Date('2/01/2014 GMT-0800 (PST)'))\n // dates.push(new Date('3/01/2010 GMT-0800 (PST)'))\n // dates.push(new Date('3/01/2011 GMT-0800 (PST)'))\n // dates.push(new Date('3/01/2012 GMT-0800 (PST)'))\n // dates.push(new Date('3/01/2013 GMT-0800 (PST)'))\n // dates.push(new Date('3/01/2014 GMT-0800 (PST)'))\n console.log(dates)\n\n dates.map(function(date){\n date = Number(date)\n console.log('features for date', new Date(date))\n var date_features = features_by_timestamp(date, features)\n date_features.sort(function(a, b){\n return a.attributes.acquisitionDate - b.attributes.acquisitionDate\n })\n var ids = date_features\n .map(function(feature){ return feature.attributes.OBJECTID })\n console.log('\\tfeatures:', date_features.map(function(f){ return JSON.stringify([new Date(f.attributes.acquisitionDate), f.attributes.OBJECTID]) }))\n return {\n // find all the closest ids by date without going over\n ids: ids\n , date: date\n , bbox: bbox\n }\n }).map(function(obj){\n save_image_from_date(obj, 'test-' + obj.date + '.jpg')\n })\n}", "async load () {}", "function og(){ci()(this,{$featuresCollection:{enumerable:!0,get:this.getFeaturesCollection}})}", "async initializeDataLoad() {\n }", "loadAgencies() {\n\t\tgetAgencies()\n\t\t\t.then((ans) => {\n\t\t\t\tvar fastAccess = {};\n\t\t\t\tfor(var i = 0; i < ans.length; i++) {\n\t\t\t\t\tlet ag = ans[i];\n\t\t\t\t\tfastAccess[ag.title] = ag.tag;\n\t\t\t\t}\n\n\t\t\t\tthis.setState({\n\t\t\t\t\tagencies: ans,\n\t\t\t\t\tfastAccess: fastAccess,\n\t\t\t\t})\n\t\t\t});\n\t}", "function loadSmallTrail(evt) {\n var req = $.ajax({\n url: \"http://localhost:3000/w_pathnondistinct\",\n type: \"GET\",\n });\n req.done(function (resp_json) {\n console.log(JSON.stringify(resp_json));\n var listaFeat = jsonAnswerDataToListElements(resp_json);\n var linjedata = {\n \"type\": \"FeatureCollection\",\n \"features\": listaFeat\n };\n smallTrailArray.addFeatures((new ol.format.GeoJSON()).readFeatures(linjedata, { featureProjection: 'EPSG: 3856' }));\n });\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 initiateFeatures() {\r\n\tfeatures = [];\r\n\tfor (var i = featuresNames.length - 1; i >= 0; i--) {\r\n\t\tlet feature = {\r\n\t\t\tname: featuresNames[i],\r\n\t\t\tHTMLbutton: $(\"#button-feature\" + i)[0],\r\n\t\t\tHTMLelement: $(\"#feature\" + i)[0]};\r\n\t\tfeatures.push(feature);\r\n\t}\r\n}", "function readCustomFeatures(options) {\n return getCustomFeatureXmlFilenames(options.paths.featureXmlDir)\n .then(function (filenames) {\n return getCustomFiles(options.paths.featureXmlDir)\n .then(function (files) {\n return {\n files: files,\n customFeatureFilepath: filenames\n };\n });\n });\n}", "function get_all_loads(){\n const q = datastore.createQuery(LOADS);\n return datastore.runQuery(q).then( (entities) =>{\n return entities[0].map(fromDatastore);\n });\n}", "toDataSourceEntities(options = {}, promiseCallback = () => {}) {\n let dataSource = new cesium.GeoJsonDataSource();\n let promise = dataSource.load(this.json, options);\n\n promise.then(function (dataSource) {\n let entities = dataSource.entities.values;\n for (let i = 0; i < entities.length; i++) {\n promiseCallback(entities[i]);\n }\n });\n }", "loadFromFile(path, callback){\n\t\tfs.readFile(path, 'utf8', function(err, data){\n\t\t\tif(err){\n\t\t\t\tconsole.log(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t//data is the string returned by fs's readFile function.\n\t\t\tlet newData = JSON.parse(data);\n\n\t\t\tthis.idIterator = newData.idIterator;\n\t\t\tthis.currentFeature = newData.currentFeature;\n\t\t\tthis.geo = newData.geo;\n\t\t\tcallback();\n\t\t}.bind(this))\n\t}", "function getFragLocs(uris) {\n if (uris)\n return Promise.all(uris.map(uri => \n\t {console.log(\"GETLOC:\", uri)\n return ( getTurtle(uri)\n .then(store => {\n const fragnode = store.any(rdf.sym(uri), REMIX(\"fragment\"), undefined)\n\t\t console.log(uri, fragnode)\n return Promise.resolve(getNodeURI(fragnode))\n })\n\t .catch(e=>{console.log(e);return Promise.resolve(undefined)})\n\t\t )}\n ))\n else return Promise.resolve([])\n}", "async features() {\n const res = await this.sendIgnoringError(\"FEAT\");\n const features = new Map();\n // Not supporting any special features will be reported with a single line.\n if (res.code < 400 && (0, parseControlResponse_1.isMultiline)(res.message)) {\n // The first and last line wrap the multiline response, ignore them.\n res.message.split(\"\\n\").slice(1, -1).forEach(line => {\n // A typical lines looks like: \" REST STREAM\" or \" MDTM\".\n // Servers might not use an indentation though.\n const entry = line.trim().split(\" \");\n features.set(entry[0], entry[1] || \"\");\n });\n }\n return features;\n }", "async loadStartData() {\n console.timeStart('track');\n for (let document of this.documents.all()) {\n if (this.shouldTrackFile(vscode_uri_1.URI.parse(document.uri).fsPath)) {\n this.trackOpenedDocument(document);\n }\n }\n if (this.alwaysIncludeGlobPattern) {\n let alwaysIncludePaths = await util_1.promisify(glob_1.glob)(this.alwaysIncludeGlobPattern, {\n cwd: this.startPath || undefined,\n absolute: true,\n });\n for (let filePath of alwaysIncludePaths) {\n filePath = vscode_uri_1.URI.file(filePath).fsPath;\n if (this.shouldTrackFile(filePath)) {\n this.trackFile(filePath);\n }\n }\n }\n await this.trackFileOrFolder(this.startPath);\n console.timeEnd('track', `${this.map.size} files tracked`);\n this.startDataLoaded = true;\n }", "async load(indexRootUrl, searchHint) {\n const enumValueIds = searchHint;\n const promises = enumValueIds.map(async (valueId) => {\n const value = this.values[valueId];\n if (value.dataRowIds)\n return Promise.resolve();\n const promise = loadCsv(joinUrl(indexRootUrl, value.url), {\n dynamicTyping: true,\n header: true\n }).then(rows => rows.map(({ dataRowId }) => dataRowId));\n value.dataRowIds = promise;\n return promise;\n });\n await Promise.all(promises);\n }", "get feature() { return features.findById(this.get()); }", "static loadGenres() {\n // Returns a new promise to the user\n return new Promise((success, fail) => {\n var genres = [] // Stores the Genre objects\n // Reads all of the movie information\n firebase.database().ref(\"items\").once('value').then(function(snapshot) {\n // Explores all of the movies\n for(var i = 0; i < snapshot.val().length; i++) {\n var info = snapshot.val()[i] // Stores the movie info\n var genre = info.genre; // Stores the movie's genre array\n // Explores the genre's\n for(var i2 = 0; i2 < genre.length; i2++) {\n // Checks to see if the given genre is already in the genres array\n if(genres.indexOf(genre[i2]) == -1) {\n genres.push(genre[i2]) // Adds the entry to the genres array\n }\n }\n // Checks if this is the last movie to be evaluated\n if(i+1 == snapshot.val().length) {\n success(genres) // Returns the genre array to the user\n }\n } \n })\n })\n }", "async populateSensorList() {\n\n let url = \"http://air.eng.utah.edu/dbapi/api/liveSensors/\"+this.sensorSource;\n if(this.sensorSource == \"airu\"){\n url = \"http://air.eng.utah.edu/dbapi/api/liveSensors/airU\";\n }\n //let url = \"http://air.eng.utah.edu/dbapi/api/sensorsAtTime/airU&2019-01-04T22:00:00Z\"\n let req = fetch(url)\n console.log(\"INSIDE OF POPULATE!!!\",this.sensorList)\n /* Adds each sensor to this.sensorList */\n req.then((response) => {\n return response.text();\n })\n .then((myJSON) => {\n myJSON = JSON.parse(myJSON);\n let sensors = [];\n for (let i = 0; i < myJSON.length; i++) {\n let val = {\n id: myJSON[i].ID,\n lat: myJSON[i].Latitude,\n long: myJSON[i].Longitude\n };\n sensors.push(val)\n }\n\n this.sensorList = sensors;\n });\n }", "function n$1(r){return r&&g.fromJSON(r).features.map((r=>r))}", "loadState() {\n return Promise.resolve();\n }", "async loadData() {\n if (!this.load_data) throw new Error('no load data callback provided');\n\n return await Q.nfcall(this.load_data);\n }", "async function loadEndpoints()\n{\n let result = [];\n\n const { db, sessionId } = this.global;\n\n const endpoints = await queryEndpoint.selectAllEndpoints(db, sessionId);\n\n // Selection is one by one since existing API does not seem to provide\n // linkage between cluster and what endpoint it belongs to.\n //\n // TODO: there should be a better way\n for (const endpoint of endpoints) {\n const endpointClusters\n = await queryEndpointType.selectAllClustersDetailsFromEndpointTypes(db, [ { endpointTypeId : endpoint.endpointTypeRef } ]);\n result.push({...endpoint, clusters : endpointClusters.filter(c => c.enabled == 1) });\n }\n\n return result;\n}", "async getCockpitRegions() {\n const regions = await this.getRegionNames();\n return Promise.all(regions.map(name => {\n var i = this.getRegionItems(name);\n return i;\n }));\n }", "function loadData(data) {\r\n // returns a promise\r\n }", "function restcountries(restcountriesurl){\r\n return new Promise((res,rej)=>{\r\n let req= new XMLHttpRequest();\r\n req.open(\"GET\",restcountriesurl,true);\r\n req.addEventListener('load',function(){\r\n if(this.readyState===4 && this.status===200)\r\n res(req.responseText);\r\n else\r\n rej(\"unable to fetch\");\r\n })\r\n req.send();\r\n })\r\n}", "async function getVectorLayer() {\n\n let places = await fetch('/lugares/')\n .then(resp => resp.json())\n .then(data => data.features )\n\n let vectorSource = new VectorSource({\n features: places.map(createIcon)\n });\n\n let vectorLayer = new VectorLayer({\n source: vectorSource\n });\n\n return vectorLayer;\n}", "function fetchRegions() {\n return (dispatch, getState) => {\n const store = getState();\n const {\n primaryMetricId,\n relatedMetricIds,\n filters,\n currentStart,\n currentEnd\n } = store.primaryMetric;\n\n const metricIds = [primaryMetricId, ...relatedMetricIds].join(',');\n // todo: identify better way for query params\n return fetch(`/data/anomalies/ranges?metricIds=${metricIds}&start=${currentStart}&end=${currentEnd}&filters=${encodeURIComponent(filters)}`)\n .then(res => res.json())\n .then(res => dispatch(loadRegions(res)))\n .catch(() => {\n dispatch(requestFail());\n });\n\n };\n}", "async function getRegions() {\n let fetchRegions = await fetch(`${APP_SERVER}/regions`, {\n method: 'GET',\n headers: {\n \"Content-Type\": \"application/json\",\n \"Authorization\": `Bearer ${token}`\n }\n });\n\n let allRegions = await fetchRegions.json();\n let regions = allRegions.data;\n \n console.log(regions);\n\n if (regions) {\n return regions;\n } else {\n console.log(\"[ERROR] Regions: NO REGIONS FOUND!, error msg: \" + regions);\n }\n}", "async loadGemfile() {\n let gemfilePath = nova.workspace.config.get('rubygems.workspace.gemfileLocation')\n let gemfileHandler = null\n let gemfileLinesArray = []\n\n if (FUNCTIONS.isWorkspace()) {\n // If no Gemfile is set in the workspace preferences, try to open one in the root directory.\n if (gemfilePath == null) {\n try {\n gemfileHandler = nova.fs.open(`${FUNCTIONS.normalizePath(nova.workspace.path)}/Gemfile`)\n } catch (error) { }\n } else {\n try {\n gemfileHandler = nova.fs.open(`${FUNCTIONS.normalizePath(gemfilePath)}`)\n } catch (error) {\n console.log(\n 'The \\'Gemfile\\' location set in the workspace preferences could not be found. Please check ' +\n 'the location and try again.')\n }\n }\n }\n\n if (gemfileHandler !== null) {\n gemfileLinesArray = gemfileHandler.readlines()\n gemfileHandler.close()\n\n this._gems = await this._evaluateGemfileLines(gemfileLinesArray)\n }\n\n return this._gems\n }", "function loadGCI() {\n return fs.readFileSync('gci.txt','utf8')\n }", "async function processHygrodataSeries(rawdata, pointID, marker, sourceElement, markerName, dataObj)\r\n{\r\n return new Promise((resolve, reject) => {\r\n // console.log(\"processHygrodataSeries()\");\r\n\r\n var lines = rawdata.split('\\n');\r\n var data = [];\r\n \r\n for(var line of lines)\r\n {\r\n var fields = line.split(',');\r\n \r\n // console.log(\"Line:\");\r\n // console.log(fields);\r\n \r\n if(fields.length < 2)\r\n {\r\n continue;\r\n }\r\n \r\n data.push(fields);\r\n }\r\n \r\n\r\n var intervals = new Array();\r\n\r\n // skip headers line\r\n for(let i = 1; i < data.length; i++)\r\n {\r\n // console.log(\"Snapshot \" + data[i][0]);\r\n\r\n var startDate = new Date(data[i][1], data[i][2], data[i][3], data[i][4], data[i][5], data[i][6]);\r\n var endInterval = new Date(startDate);\r\n endInterval.setSeconds(startDate.getSeconds() + 3599);\r\n\r\n var interval = new Cesium.TimeInterval(\r\n {\r\n \"start\" : Cesium.JulianDate.fromDate(startDate),\r\n \"stop\" : Cesium.JulianDate.fromDate(endInterval),\r\n \"isStartIncluded\" : true,\r\n \"isStopIncluded\" : false,\r\n // \"isStopIncluded\" : true,//false,\r\n // \"data\" : { \"temperature\" : data[i][7], \"humidity\" : data[i][8] }\r\n \"data\" : //[\r\n { \r\n \"element\" : marker,\r\n \"type\" : \"hygro\",\r\n \"owner\" : markerName,\r\n \"value\" : {\r\n \"temperature\" : data[i][7], \"humidity\" : data[i][8]\r\n }\r\n }\r\n //]\r\n }\r\n );\r\n\r\n // console.log(\"Adding interval\");\r\n intervals.push(interval);\r\n }\r\n\r\n // g_intervalGroups.set(sourceElement.name, new Cesium.TimeIntervalCollection(intervals));\r\n var intervalCollection = new Cesium.TimeIntervalCollection(intervals);\r\n g_intervalGroups.set(markerName, intervalCollection);\r\n\r\n dataObj.data.source = intervalCollection;\r\n\r\n // g_timeIntervals = new Cesium.TimeIntervalCollection(intervals);\r\n g_hygroData.set(pointID, { \"intervals\" : new Cesium.TimeIntervalCollection(intervals), \"marker\" : marker, \"caption\" : marker.label.text });\r\n\r\n resolve();\r\n });\r\n}", "function eng_gen() {\n var condition1 = function () {\n len_eng = corpus_eng.length;\n // console.log(len_eng)\n for (i = 0; i < len_eng; i++) {\n var temp = corpus_eng[i].split(\"\\t\");\n eng_ans.push(temp);\n eng_words.add(eng_ans[i][0]);\n }\n }\n $.when($.get(\"features_english.txt\", function (data_eng) { corpus_eng = data_eng.split(\"\\n\") })).then(condition1);\n}", "function pollForCoremetricsReady(){\n\n\t\tvar promise = new Promise(function(resolve, reject){\n\n\t\t\tif ( window.cmCreateElementTag && window.cm_ClientID ){\n\t\t\t\treturn resolve( window.cmCreateElementTag );\n\t\t\t}\n\n\t\t\tvar interval = setInterval(function(){\n\n\t\t\t\tif ( window.cmCreateElementTag && window.cm_ClientID ){\n\t\t\t\t\tclearInterval( interval );\n\t\t\t\t\tresolve( window.cmCreateElementTag );\n\t\t\t\t}\n\t\t\t }, 500);\n\n\t\t});\n\n\t\treturn promise;\n\n\t}", "fetchData() {\n const url = 'http://data.unhcr.org/api/population/regions.json';\n return fetch(url, {\n method: 'GET',\n })\n .then((resp) => resp.json())\n .then((json) => this.parseRefugeeData(json))\n .catch((error) => Notification.logError(error, 'RefugeeCampMap.fetchData'));\n }", "async loadIndex() {\n const indexURL = this.config.indexURL\n return loadIndex(indexURL, this.config, this.genome)\n }", "featureTypeIriSelect(iri) {\n this.props.loadingOn();\n Actions.executeQueryForDatasetSource(\n DatasetSourceStore.getSelectedDatasetSource().id,\n \"spatial/get_feature_geometry\",\n {object_type: \"<\"+iri+\">\"}\n );\n this.setState({value : iri,geometries:[]})\n }", "async import(uri, options) {\n const basePath = uri.substring(0, uri.lastIndexOf('/')) + '/'; // location of model file as basePath\n const defaultOptions = _misc_DataUtil__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createDefaultGltfOptions();\n if (options && options.files) {\n for (let fileName in options.files) {\n const fileExtension = _misc_DataUtil__WEBPACK_IMPORTED_MODULE_0__[\"default\"].getExtension(fileName);\n if (fileExtension === 'gltf' || fileExtension === 'glb') {\n return await this.__loadFromArrayBuffer(options.files[fileName], defaultOptions, basePath, options);\n }\n }\n }\n const arrayBuffer = await _misc_DataUtil__WEBPACK_IMPORTED_MODULE_0__[\"default\"].fetchArrayBuffer(uri);\n return await this.__loadFromArrayBuffer(arrayBuffer, defaultOptions, basePath, options);\n }", "function trackFeatures(final_track_list) {\n return new Promise(function(resolve, reject) {\n let xhr = new XMLHttpRequest();\n let url = 'https://api.spotify.com/v1/audio-features';\n xhr.open(\"GET\", url + '?ids=' + final_track_list);\n xhr.setRequestHeader('Authorization', 'Bearer ' + access_token);\n xhr.onload = () => resolve(xhr.responseText);\n xhr.onerror = () => reject(xhr.statusText);\n xhr.send();\n });\n }", "load(src=[],opts={}){\n\t\t// files loaded\n\t\twindow.trs.loadedScript = window.trs.loadedScript || [] \n\t\treturn new Promise((resolve,reject)=>{\n\t\t\t//options\n\t\t\tlet opt=opts\n\t\t\topt.async=opts.async||false\n\t\t\topt.once=opts.once||false\n\n\t\t\tfor(let file of src){\n\t\t\t\t// script\n\t\t\t\tlet sc=document.createElement('script')\n\t\t\t\tsc.src=file\n\t\t\t\t// attributes\n\t\t\t\tif(opt.async) sc.setAttribute('async','')\n\n\t\t\t\t// mark as loaded by lazy loader func\n\t\t\t\tif(opt.once) {\n\t\t\t\t\tif (window.trs.loadedScript.indexOf(file) == -1 ) {\n\t\t\t\t\t\twindow.trs.loadedScript.push(file)\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// load\n\t\t\t\tif(opt.module) sc.setAttribute('type','module')\n\t\t\t\tsc.setAttribute('lazy-loaded','')\n\t\t\t\tdocument.body.appendChild(sc)\n\t\t\t\tresolve(sc)\n\t\t\t\t\t\t\t\t\n\t\t\t}\n\t\t})\n\t}", "fetchArtifacts() {\n const artifactLocation = getSrc(this.props.path, this.props.runUuid);\n this.props\n .getArtifact(artifactLocation)\n .then((rawFeatures) => {\n const parsedFeatures = JSON.parse(rawFeatures);\n this.setState({ features: parsedFeatures, loading: false });\n })\n .catch((error) => {\n this.setState({ error: error, loading: false, features: undefined });\n });\n }", "getGroupsOfaPerson() {\n return this.#fetchAdvanced(this.#getGroupsOfPersonURL()).then((responseJSON) => {\n let groupBOs = GroupBO.fromJSON(responseJSON);\n return new Promise(function (resolve) {\n resolve(groupBOs);\n })\n })\n}", "async function loadFromFile (file) {\n const deferred = createDeferred()\n\n const fileReader = new window.FileReader()\n\n fileReader.onload = onLoad\n fileReader.onabort = () => {\n deferred.reject(new Error(`file load interrupted: ${file}`))\n }\n fileReader.onerror = () => {\n deferred.reject(new Error(`file load error: ${file}`))\n }\n\n fileReader.readAsText(file)\n\n return deferred.promise\n\n function onLoad (event) {\n const data = event.target && event.target.result\n if (data == null) {\n return deferred.reject(new Error(`no data in file: ${file.name}`))\n }\n\n let profileData\n try {\n profileData = JSON.parse(data)\n } catch (err) {\n return deferred.reject(new Error(`file is not JSON: ${file.name}`))\n }\n\n const profileInfo = ProfileInfo.create(profileData)\n if (profileInfo == null) {\n return deferred.reject(new Error(`file is not a V8 CPU profile: ${file.name}`))\n }\n\n profileInfo.fileName = file.name\n\n Store.set({\n profileInfo,\n pkgIdSelected: null,\n modIdSelected: null,\n fnIdSelected: null\n })\n\n deferred.resolve(profileInfo)\n }\n}", "async loadTokensList() {\n return null;\n }", "async function readFile(){\n return new Promise((resolve,reject)=>{\n fs.readFile('../dataset/smallDataSet.csv','utf8',(err, data)=>{\n if(err) reject(err);\n resolve(data);\n });\n })\n}", "function loadSequence() {\n var _args = arguments;\n return {\n deps: ['$ocLazyLoad', '$q',\n\t\t\tfunction ($ocLL, $q) {\n\t\t\t var promise = $q.when(1);\n\t\t\t for (var i = 0, len = _args.length; i < len; i++) {\n\t\t\t promise = promiseThen(_args[i]);\n\t\t\t }\n\t\t\t return promise;\n\n\t\t\t function promiseThen(_arg) {\n\t\t\t if (typeof _arg == 'function')\n\t\t\t return promise.then(_arg);\n\t\t\t else\n\t\t\t return promise.then(function () {\n\t\t\t var nowLoad = requiredData(_arg);\n\t\t\t if (!nowLoad)\n\t\t\t return $.error('Route resolve: Bad resource name [' + _arg + ']');\n\t\t\t return $ocLL.load(nowLoad);\n\t\t\t });\n\t\t\t }\n\n\t\t\t function requiredData(name) {\n\t\t\t if (jsRequires.modules)\n\t\t\t for (var m in jsRequires.modules)\n\t\t\t if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)\n\t\t\t return jsRequires.modules[m];\n\t\t\t return jsRequires.scripts && jsRequires.scripts[name];\n\t\t\t }\n\t\t\t}]\n };\n }", "function loadSequence() {\n var _args = arguments;\n return {\n deps: ['$ocLazyLoad', '$q',\n\t\t\tfunction ($ocLL, $q) {\n\t\t\t var promise = $q.when(1);\n\t\t\t for (var i = 0, len = _args.length; i < len; i++) {\n\t\t\t promise = promiseThen(_args[i]);\n\t\t\t }\n\t\t\t return promise;\n\n\t\t\t function promiseThen(_arg) {\n\t\t\t if (typeof _arg == 'function')\n\t\t\t return promise.then(_arg);\n\t\t\t else\n\t\t\t return promise.then(function () {\n\t\t\t var nowLoad = requiredData(_arg);\n\t\t\t if (!nowLoad)\n\t\t\t return $.error('Route resolve: Bad resource name [' + _arg + ']');\n\t\t\t return $ocLL.load(nowLoad);\n\t\t\t });\n\t\t\t }\n\n\t\t\t function requiredData(name) {\n\t\t\t if (jsRequires.modules)\n\t\t\t for (var m in jsRequires.modules)\n\t\t\t if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)\n\t\t\t return jsRequires.modules[m];\n\t\t\t return jsRequires.scripts && jsRequires.scripts[name];\n\t\t\t }\n\t\t\t}]\n };\n }", "function pullDatabase(){\n return new Promise((resolve, reject) => {\n try{\n db.collection(\"Classic\").get().then((snapshot) => {\n //characterArray will become filled with the documents from our Firebase database converted into Character classes\n var characterArray = [];\n snapshot.forEach((doc) => {\n //console.log(doc.id, '=>', doc.data());\n var character = doc.data();\n characterArray.push(new Character(character.name, character.realm, character.level, character.race, character.class));\n });\n //returns the array of Character classes\n resolve(characterArray);\n })\n .catch((err) => {\n console.log('Error getting documents', err);\n });\n } catch (e){\n reject(e);\n }\n }) \n}", "listenForFeature(featuresRef) {\n featuresRef.on('value', (dataSnapshot) => {\n var tasks = [];\n dataSnapshot.forEach((child) => {\n tasks.push({\n title: child.val().title,\n uri: child.val().uri,\n date: child.val().date,\n type: child.val().type,\n _key: child.key\n });\n });\n\n this.setState({\n dataFeatures:tasks,\n loading: false,\n });\n });\n }", "function loadScene(url) {\n let newObjects = [];\n return new Promise((resolve, reject) => {\n new GLTFLoader().load( url, \n function (object) {\n // On Load\n console.log(object);\n object.scene.children.forEach((prop, i) => newObjects[i] = prop); // Add all props from the scene into the objects array.\n //scene.add(object.scene);\n resolve(newObjects);\n },\n function (XMLHttpRequest) {\n // On Progress\n console.log(\"Loading Scene... \", XMLHttpRequest);\n },\n function (err) {\n // On Error\n console.log(err);\n reject(err);\n });\n });\n }", "async function getDataset() {\n const [dataset, perfTimes] = await fetchMorpheusJson(\n studyAccession,\n genes,\n cluster,\n annotation.name,\n annotation.type,\n annotation.scope,\n subsample\n )\n logFetchMorpheusDataset(perfTimes, cluster, annotation, genes)\n return dataset\n }", "function readIndividualFeatures(egoCenter, callback) {\n console.log(\" - - Reading individual features.\");\n var data = fs.readFileSync(\"../data/\" + egoCenter + \".feat\", 'utf8');\n var featureArray = data.split(\"\\n\");\n for (var feature of featureArray) {\n var spaceIndex = feature.indexOf(\" \");\n if (spaceIndex > 0) {\n individualFeatures[feature.substring(0, spaceIndex)] = feature.substring(spaceIndex + 1, feature.length).split(\" \");\n }\n }\n}", "function init(count) {\n var count = count || 1\n var promise = new Promise((resolve, reject) => {\n getLookupData(odsaStore)\n .then((lookups) => {\n getTimeTrackingData(odsaStore, lookups, count)\n .then((vizData) => {\n $('#reload_data').show()\n $('#generate_data').show()\n $('.accordionjs').show()\n initViz(vizData, lookups)\n .then(() => {\n $(\"#tools-accordion\").accordionjs({ activeIndex: false, closeAble: true })\n $(\"#tools-accordion-exs\").accordionjs({ activeIndex: false, closeAble: true })\n initExTools(lookups)\n resolve()\n })\n })\n .catch((err) => {\n console.log(err)\n errDialog(err)\n })\n })\n .catch((err) => {\n console.log(err)\n errDialog(err)\n })\n })\n return promise\n }", "function resolvePromises() {\n resolvePromisesFn(autoflow);\n }", "function fetchCountries(){\n console.log('IMonData: [Countries] Fetching data..');\n var store = new Store();\n var futures = [];\n var baseUrl = 'https://thenetmonitor.org/v2/countries';\n\n var fut = HTTP.get.future()(baseUrl, { timeout: Settings.timeout*3 });\n futures.push(fut);\n var results = fut.wait();\n store.sync(results.data);\n _.each(results.data.data, function(d){\n store.sync(d.relationships.data_points);\n });\n\n console.log('IMonData: [Countries] Data fetched.');\n Future.wait(futures);\n\n var insert = function(){\n console.log('IMonData: [Countries] Inserting...');\n _.each(store.findAll('countries'), insertCountryData);\n console.log('IMonData: [Countries] Inserted.');\n };\n\n Future.task(insert);\n\n}", "function loadSequence() {\n var _args = arguments;\n return {\n deps: ['$ocLazyLoad', '$q',\n function ($ocLL, $q) {\n var promise = $q.when(1);\n for (var i = 0, len = _args.length; i < len; i++) {\n promise = promiseThen(_args[i]);\n }\n return promise;\n\n function promiseThen(_arg) {\n if (typeof _arg == 'function')\n return promise.then(_arg);\n else\n return promise.then(function () {\n var nowLoad = requiredData(_arg);\n if (!nowLoad)\n return $.error('Route resolve: Bad resource name [' + _arg + ']');\n return $ocLL.load(nowLoad);\n });\n }\n\n function requiredData(name) {\n if (jsRequires.modules)\n for (var m in jsRequires.modules)\n if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)\n return jsRequires.modules[m];\n return jsRequires.scripts && jsRequires.scripts[name];\n }\n }]\n };\n }", "function loadSequence() {\n var _args = arguments;\n return {\n deps: ['$ocLazyLoad', '$q',\n function ($ocLL, $q) {\n var promise = $q.when(1);\n for (var i = 0, len = _args.length; i < len; i++) {\n promise = promiseThen(_args[i]);\n }\n return promise;\n\n function promiseThen(_arg) {\n if (typeof _arg == 'function')\n return promise.then(_arg);\n else\n return promise.then(function () {\n var nowLoad = requiredData(_arg);\n if (!nowLoad)\n return $.error('Route resolve: Bad resource name [' + _arg + ']');\n return $ocLL.load(nowLoad);\n });\n }\n\n function requiredData(name) {\n if (jsRequires.modules)\n for (var m in jsRequires.modules)\n if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)\n return jsRequires.modules[m];\n return jsRequires.scripts && jsRequires.scripts[name];\n }\n }]\n };\n }", "function loadSequence() {\n var _args = arguments;\n return {\n deps: ['$ocLazyLoad', '$q',\n function ($ocLL, $q) {\n var promise = $q.when(1);\n for (var i = 0, len = _args.length; i < len; i++) {\n promise = promiseThen(_args[i]);\n }\n return promise;\n\n function promiseThen(_arg) {\n if (typeof _arg == 'function')\n return promise.then(_arg);\n else\n return promise.then(function () {\n var nowLoad = requiredData(_arg);\n if (!nowLoad)\n return $.error('Route resolve: Bad resource name [' + _arg + ']');\n return $ocLL.load(nowLoad);\n });\n }\n\n function requiredData(name) {\n if (jsRequires.modules)\n for (var m in jsRequires.modules)\n if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)\n return jsRequires.modules[m];\n return jsRequires.scripts && jsRequires.scripts[name];\n }\n }]\n };\n }", "function loadSequence() {\n var _args = arguments;\n return {\n deps: ['$ocLazyLoad', '$q',\n function ($ocLL, $q) {\n var promise = $q.when(1);\n for (var i = 0, len = _args.length; i < len; i++) {\n promise = promiseThen(_args[i]);\n }\n return promise;\n\n function promiseThen(_arg) {\n if (typeof _arg == 'function')\n return promise.then(_arg);\n else\n return promise.then(function () {\n var nowLoad = requiredData(_arg);\n if (!nowLoad)\n return $.error('Route resolve: Bad resource name [' + _arg + ']');\n return $ocLL.load(nowLoad);\n });\n }\n\n function requiredData(name) {\n if (jsRequires.modules)\n for (var m in jsRequires.modules)\n if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)\n return jsRequires.modules[m];\n return jsRequires.scripts && jsRequires.scripts[name];\n }\n }]\n };\n }", "function loadfloodIncidentlayer(floodincidentdata){\r\nfloodincidentjson = JSON.parse(floodincidentdata);\r\n\r\nvar features = []; \r\nfeatures = floodincidentjson.features; \r\nvar jproperties = floodincidentjson.features.map(function (el) { return el.properties; });\r\nvar i;\r\nfor (i = 0; i < jproperties.length; i++) { \r\n\tfloodincarray.push(Object.values(jproperties[i]));\r\n}\r\n\r\n}", "function loadSequence() {\n var _args = arguments;\n return {\n deps: ['$ocLazyLoad', '$q',\n function ($ocLL, $q) {\n var promise = $q.when(1);\n for (var i = 0, len = _args.length; i < len; i++) {\n promise = promiseThen(_args[i]);\n }\n return promise;\n\n function promiseThen(_arg) {\n if (typeof _arg === 'function')\n return promise.then(_arg);\n else\n return promise.then(function () {\n var nowLoad = requiredData(_arg);\n if (!nowLoad)\n return $.error('Route resolve: Bad resource name [' + _arg + ']');\n return $ocLL.load(nowLoad);\n });\n }\n\n function requiredData(name) {\n if (jsRequires.modules)\n for (var m in jsRequires.modules)\n if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)\n return jsRequires.modules[m];\n return jsRequires.scripts && jsRequires.scripts[name];\n }\n }]\n };\n }", "function loadSequence() {\r\n var _args = arguments;\r\n return {\r\n deps: ['$ocLazyLoad', '$q',\r\n\t\t\tfunction ($ocLL, $q) {\r\n\t\t\t var promise = $q.when(1);\r\n\t\t\t for (var i = 0, len = _args.length; i < len; i++) {\r\n\t\t\t promise = promiseThen(_args[i]);\r\n\t\t\t }\r\n\t\t\t return promise;\r\n\r\n\t\t\t function promiseThen(_arg) {\r\n\t\t\t if (typeof _arg == 'function')\r\n\t\t\t return promise.then(_arg);\r\n\t\t\t else\r\n\t\t\t return promise.then(function () {\r\n\t\t\t var nowLoad = requiredData(_arg);\r\n\t\t\t if (!nowLoad)\r\n\t\t\t return $.error('Route resolve: Bad resource name [' + _arg + ']');\r\n\t\t\t return $ocLL.load(nowLoad);\r\n\t\t\t });\r\n\t\t\t }\r\n\r\n\t\t\t function requiredData(name) {\r\n\t\t\t if (jsRequires.modules)\r\n\t\t\t for (var m in jsRequires.modules)\r\n\t\t\t if (jsRequires.modules[m].name && jsRequires.modules[m].name === name)\r\n\t\t\t return jsRequires.modules[m];\r\n\t\t\t return jsRequires.scripts && jsRequires.scripts[name];\r\n\t\t\t }\r\n\t\t\t}]\r\n };\r\n }", "function initFeatureList() {\n var task = $(parameterAnalysisDateId).val();\n if (task) {\n $(featureListId).multiselect({\n dropRight: true,\n buttonWidth: \"100%\",\n enableFiltering: true,\n enableCaseInsensitiveFiltering: true,\n nonSelectedText: \"请选择Feature\",\n filterPlaceholder: \"搜索\",\n nSelectedText: \"项被选中\",\n includeSelectAllOption: true,\n selectAllText: \"全选/取消全选\",\n allSelectedText: \"已选中所有平台类型\",\n maxHeight: 200,\n width: 220\n });\n var url = \"paramQuery/getFeatureList\";\n $.ajax({\n type: \"post\",\n url: url,\n data: { db: task },\n dataType: \"json\",\n success: function(data) {\n var newOptions = [];\n var obj = {};\n $(data).each(function(k, v) {\n v = eval(\"(\" + v + \")\");\n obj = {\n label: v.text,\n value: v.value\n };\n newOptions.push(obj);\n });\n obj = {\n label: \"未知\",\n value: \"unknow\"\n };\n newOptions.push(obj);\n $(featureListId).multiselect(\"dataprovider\", newOptions);\n // $(featureListId).multiselect(\"disable\");\n }\n });\n }\n}" ]
[ "0.6543959", "0.61009336", "0.590788", "0.5869675", "0.5767293", "0.5726963", "0.571669", "0.5531802", "0.54262996", "0.5398379", "0.53473455", "0.52430815", "0.5231676", "0.5218503", "0.5158587", "0.5131139", "0.5100868", "0.5091692", "0.50904274", "0.50904274", "0.5066121", "0.5030894", "0.50205815", "0.50121015", "0.4995787", "0.49709815", "0.4954698", "0.4903145", "0.4888073", "0.4870576", "0.48394224", "0.48369497", "0.47862184", "0.47640306", "0.47605303", "0.47550443", "0.47379023", "0.4725368", "0.47064677", "0.4700897", "0.4699966", "0.4689712", "0.4684454", "0.46830428", "0.46706071", "0.46680006", "0.4654902", "0.46513668", "0.4646964", "0.4645155", "0.46227476", "0.46191597", "0.45884728", "0.45834622", "0.45825723", "0.45802325", "0.45789054", "0.45763195", "0.45749685", "0.45742044", "0.45735636", "0.45717853", "0.4564178", "0.45568419", "0.45554277", "0.45536968", "0.45415452", "0.45397845", "0.4538857", "0.453596", "0.45329422", "0.45301467", "0.45219454", "0.4506677", "0.45028457", "0.44986036", "0.44982794", "0.44976354", "0.44851112", "0.4478376", "0.44738004", "0.44733146", "0.44722688", "0.44722688", "0.44712955", "0.44680148", "0.44593385", "0.44573885", "0.44570327", "0.4456358", "0.4450548", "0.44487303", "0.44476095", "0.44476095", "0.44476095", "0.44476095", "0.4447106", "0.44455063", "0.4443717", "0.4435947" ]
0.6294286
1
Return a Promise for the async loaded index
async loadIndex() { const indexURL = this.config.indexURL return loadIndex(indexURL, this.config, this.genome) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async getCurentIndex() {\n\n this.check()\n return await this.storage.loadIndex()\n }", "async loadIndex() {\n const indexURL = this.config.indexURL;\n let indexFilename;\n if (isFilePath(indexURL)) {\n indexFilename = indexURL.name;\n } else {\n const uriParts = parseUri(indexURL);\n indexFilename = uriParts.file;\n }\n const isTabix = indexFilename.endsWith(\".tbi\") || this.filename.endsWith('.gz') || this.filename.endsWith('.bgz')\n let index;\n if (isTabix) {\n index = await loadBamIndex(indexURL, this.config, true, this.genome);\n } else {\n index = await loadTribbleIndex(indexURL, this.config, this.genome);\n }\n return index;\n }", "async function getIndexes() {\n return await fetch('https://api.coingecko.com/api/v3/indexes').then(res => res.json());\n }", "static loadProjectIndex(projectId) {\n return Promise( (resolve, reject) => {\n const url = ProjectIndex.APIUrlForProject(projectId);\n fetch(url).then( (response) => {\n if (response.status !== 200) reject(response.status);\n try {\n const json = response.json();\n const index = new ProjectIndex(\"/\", json.project);\n resolve(index);\n } catch (error) {\n reject(error);\n }\n })\n }\n\n static APIUrlForProject(projectId) {\n return `/API/getProjectIndex/${projectId}`;\n }", "function load() {\n return Promise.all([storage.getTree(), storage.getTokenIndex(), storage.getEntries()])\n .then(function(result) {\n console.log('load results')\n tree = result[0];\n dbIndex = new Index(result[1]);\n entries = result[2];\n });\n}", "async function loadData() {\n // Get the health of the connection\n let health = await connection.checkConnection();\n\n // Check the status of the connection\n if (health.statusCode === 200) {\n // Delete index\n await connection.deleteIndex().catch((err) => {\n console.log(err);\n });\n // Create Index\n await connection.createIndex().catch((err) => {\n console.log(err);\n });\n // If index exists\n if (await connection.indexExists()) {\n const parents = await rest.getRequest(rest.FlaskUrl + \"/N\");\n // If parents has the property containing the files\n if (parents.hasOwnProperty(\"data\")) {\n //Retrieve the parent list\n let parrentArray = parents.data;\n\n // Get amount of parents\n NumberOfParents = parrentArray.length;\n console.log(\"Number of parents to upload: \" + NumberOfParents);\n // Each function call to upload a JSON object to the index\n // delayed by 50ms\n parrentArray.forEach(delayedFunctionLoop(uploadParentToES, 50));\n }\n }\n } else {\n console.log(\"The connection failed\");\n }\n}", "function getIndexId() {\n return new Promise((resolve, reject) => {\n fs.readFile(INDEX_FILE, (err, data) => {\n if (err || data === undefined) {\n reject(err);\n } else {\n const json = JSON.parse(data);\n resolve(json.id);\n }\n });\n });\n}", "prepareIndiceForUpdate(indexData) {\n return Promise.resolve();\n }", "getActIndex() {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this._handleApiCall(`${this.gameBaseUrlPath}/act`, 'Error fetching the act index.');\n });\n }", "async fetchExistingRecords () {\n const client = getAlgoliaClient()\n\n // return an empty array if the index does not exist yet\n const { items: indices } = await client.listIndices()\n\n if (!indices.find(index => index.name === this.name)) {\n console.log(`index '${this.name}' does not exist!`)\n return []\n }\n\n const index = client.initIndex(this.name)\n let records = []\n\n await index.browseObjects({\n batch: batch => (records = records.concat(batch))\n })\n\n return records\n }", "async do(headers = {}) {\n\t\tlet res = await this.c.get(\"/v2/assets/\" + this.index, {}, headers);\n\t\treturn res.body;\n\t}", "function index() {\n\n return resource.fetch()\n .then(function(data){ return data; });\n }", "getByIndex(storeName, indexName, key) {\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 index = objectStore.index(indexName);\n const request = index.get(key);\n request.onsuccess = (event) => {\n resolve(event.target.result);\n };\n })\n .catch((reason) => reject(reason));\n }));\n }", "async init() {\n var that = this;\n\n var promise = new Promise(function(resolve, reject) {\n\n var req = indexedDB.open(that.db_name, that.version);\n\n req.onupgradeneeded = function(event) {\n that.database = event.target.result;\n //run callback method in createTable to add a new object table\n that.upgrade();\n };\n\n req.onsuccess = function (event) {\n that.database = event.target.result;\n resolve();\n };\n\n req.onerror = function (error) {\n if (req.error.name === \"VersionError\") {\n //we can never be sure what version of the database the client is on\n //therefore in the event that we request an older version of the db than the client is on, we will need to update the js version request on runtime\n that.version++;\n\n //we need to initiate a steady increment of promise connections that either resolve or reject\n that.init()\n .then(function() {\n //bubble the result\n resolve();\n })\n .catch(function() {\n //bubble the result: DOESNT WORK?\n reject();\n });\n } else {\n console.error(error);\n }\n };\n });\n return promise;\n }", "async function getIndex() {\n const contents = fs.readdirSync(`./${ipfs.host}/`);\n iLog('Trying to load indices from local files ...');\n for (i in contents) {\n if (contents[i][0] === 'i' && !fs.statSync(`./${ipfs.host}/${contents[i]}`).isDirectory()) {\n const indexFile = fs.readFileSync(`./${ipfs.host}/${contents[i]}`);\n const indexDump = JSON.parse(indexFile);\n global.indices[contents[i].substr(5,contents[i].length-10)] = elasticlunr.Index.load(indexDump);\n }\n }\n try {\n await fs.statSync(`./${ipfs.host}/hostedFiles.json`);\n global.ipfsearch.hostedFiles = JSON.parse(await fs.readFileSync(`./${ipfs.host}/hostedFiles.json`));\n } catch (e) { }\n if (Object.keys(global.indices).length === 0) {\n // file does not exist, create fresh index\n iLog('No local indices exist, generating new index files ...');\n const contents = fs.readdirSync(`./${ipfs.host}/`);\n for (i in contents) {\n if (fs.statSync(`./${ipfs.host}/${contents[i]}`).isDirectory()) {\n global.indices[contents[i]] = createIndex();\n await readFilesIntoObjects(contents[i], `./${ipfs.host}/${contents[i]}`);\n // save the index\n await saveIndex(global.indices[contents[i]], `./${ipfs.host}/index${contents[i]}.json`);\n }\n }\n }\n}", "function readIndexJson() {\n return new Promise((resolve, reject) => {\n fs.readFile(INDEX_FILE, (err, data) => {\n if (err) reject(err);\n const json = JSON.parse(data);\n const promises = [];\n Object.keys(json).forEach((lang) => {\n if (LANG_SUPPORTED.includes(lang)) {\n promises.push(getJson(json[lang].raw.DestinyStatDefinition, `${STAT_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].raw.DestinyClassDefinition, `${CLASS_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].items.Mod, `${MOD_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].raw.DestinyInventoryBucketDefinition, `${BUCKET_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].items.Armor, `${ARMOR_DIR}/${lang}.json`));\n promises.push(getJson(json[lang].items.Weapon, `${WEAPON_DIR}/${lang}.json`));\n }\n });\n Promise.all(promises)\n .then(() => {\n resolve();\n })\n .catch((pErr) => {\n console.log(pErr);\n reject(pErr);\n });\n });\n });\n}", "function loadIndex() {\n\tvar indexRequest = new XMLHttpRequest();\n\tindexRequest.open(\"GET\", \"https://mustang-index.azurewebsites.net/index.json\");\n\tindexRequest.onload = function() {\n\t\tconsole.log(\"Index JSON file:\" + indexRequest.responseText);\n\t\tcontactIndex = JSON.parse(indexRequest.responseText);\n\t\tcontactURLArray.length = 0;\n\t\tfor(i = 0; i < contactIndex.length; i++) {\n\t\t\tcontactURLArray.push(contactIndex[i].ContactURL);\n\t\t}\n\t\tconsole.log(\"ContactURLArray: \" + JSON.stringify(contactURLArray));\n\t\trenderIndex(contactIndex);\n\t\tshowSnackbar(\"Index loaded\");\n\t}\n\tindexRequest.send();\n}", "async load(indexRootUrl, searchHint) {\n const enumValueIds = searchHint;\n const promises = enumValueIds.map(async (valueId) => {\n const value = this.values[valueId];\n if (value.dataRowIds)\n return Promise.resolve();\n const promise = loadCsv(joinUrl(indexRootUrl, value.url), {\n dynamicTyping: true,\n header: true\n }).then(rows => rows.map(({ dataRowId }) => dataRowId));\n value.dataRowIds = promise;\n return promise;\n });\n await Promise.all(promises);\n }", "async createIndexJson(url) {\n \treturn this.rs.readFolder(url).then(folder => {\n \t\tvar promises = [];\n \t\tthis.index = {};\n \t\tif (folder.files.length == 0) {\n \t\t\tpromises.push(this.index)\n \t\t} else {\n\t\t\t\tlet i\n\t\t\t\t\tfor ( i = 0; i < folder.files.length ; i ++) {\n\t\t\t\t\t\tlet file = folder.files[i].name.split(\".\");\n\t\t\t\t\t\tif (file.pop() == \"ttl\") {\n\t\t\t\t\t\t\tvar title = file.join(\".\")\n\t\t\t\t\t\t\tpromises.push(\n\t\t\t\t\t\t\tthis.rs.rdf.query(url+title+\".ttl\")\n\t\t\t\t\t\t\t.then(queryRes => {\n\t\t\t\t\t\t\t\tthis.jsonTiddler(queryRes)\n\t\t\t\t\t\t\t\tdelete this.tiddlerJson[\"text\"]\n\t\t\t\t\t\t\t\tthis.index[this.tiddlerJson[\"title\"]] = this.tiddlerJson;\n\t\t\t\t\t\t\t},err => {alert(\"title \"+err)})\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\treturn Promise.all(promises).then( success => {\n\t\t\t\t\treturn this.index\n\t\t\t},err => {alert(\"Are some .ttl files not tiddlers ??? \\n\"+err)})\n \t})\n }", "function load(index) {\n return loadInternal(index, viewData);\n}", "indexPage(req) {\n return __awaiter(this, void 0, void 0, function* () {\n });\n }", "prepareIndiceForInstall(indexData) {\n return Promise.resolve();\n }", "getCachedDataByIndex(storename, index, key) {\n return this.cache.then((db) => {\n return db.transaction(storename).objectStore(storename).index(index).getAll(key);\n });\n }", "_updateIndex() {\n return __awaiter(this, void 0, void 0, function* () {\n //creates index file if it doesn't already exist\n let inCouch = yield this._isInCouch(\"index\", \"index\");\n if (!inCouch) {\n yield this.couchdb.createDatabase(\"index\");\n yield this.couchdb.createDocument(\"index\", {}, \"index\");\n }\n let data = yield readFile(path.join(this.localRepoPath, \"/EventIndex.json\"), \"utf8\");\n let json = JSON.parse(data.replace(/&quot;/g, '\\\\\"'));\n let events = json[\"Events\"];\n events.sort(function (a, b) {\n return Date.parse(b.StartDate) - Date.parse(a.StartDate);\n });\n let couchDocument = yield this.couchdb.getDocument(\"index\", \"index\");\n yield this.couchdb.createDocument(\"index\", { Events: events, \"_rev\": couchDocument.data[\"_rev\"] }, \"index\");\n });\n }", "async getLoadOperation() {}", "function loadIndex() {\n var idxFile = this.indexURL;\n\n if (this.filename.endsWith(\".gz\")) {\n if (!idxFile) idxFile = this.url + \".tbi\";\n return igv.loadBamIndex(idxFile, this.config, true);\n } else {\n if (!idxFile) idxFile = this.url + \".idx\";\n return igv.loadTribbleIndex(idxFile, this.config);\n }\n }", "loadIndexPage () {\n return Promise.resolve(Request.httpGet(this.SiteUrl + this.DefaultPrefix, this.CharSet).then(res => {\n let $ = cheerio.load(res.text);\n let Navis = $('#sliderNav > li');\n let Uid = new Date().getTime();\n Navis.each((i, elem) => {\n let _this = $(elem);\n let _ChildNodes = _this.find('> ul >li');\n let _SiteUrl = _this.find('>a').attr('href');\n if (_SiteUrl === './') {\n _SiteUrl = '../ssxx/'\n }\n\n let _SiteReg = /^javascript:/ig;\n this.ListNavis.push({\n Uid: `${Uid}${i}`,\n Section: _this.find('> a >span:first-child').text(),\n SiteUrl: _SiteReg.test(_SiteUrl) ? '' : _SiteUrl,\n HasChild: _ChildNodes && _ChildNodes.length > 0,\n ChildNodes: _ChildNodes && _ChildNodes.toArray().map((item, index) => {\n let _node = $(item).find('a');\n let _group = _node.text();\n let _uid = this.GroupDefine.has(_group) && this.GroupDefine.get(_group) || this.GroupDefine.set(_group, `${new Date().getTime()}${i}`).get(_group);\n return {\n Uid: _uid,\n Group: _node.text(),\n SiteUrl: _node.attr('href')\n };\n })\n });\n });\n\n /*保存首页数据*/\n Request.saveJsonToFile(this.ListNavis, 'index.json', this.Group, [...this.GroupDefine]);\n }).catch(err => {\n console.error(err);\n }));\n }", "fetchIndex(){\n return this.http.fetch('data/index.json?t=' + new Date().getTime())\n .then(response=>{\n //convert text to json\n return response.json()\n })\n .then(json=>{\n let infos = json;\n return infos;\n });\n }", "function wrappedFetch() {\n var wrappedPromise = {};\n\n var promise = new index_es(function (resolve, reject) {\n wrappedPromise.resolve = resolve;\n wrappedPromise.reject = reject;\n });\n\n var args = new Array(arguments.length);\n\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n\n wrappedPromise.promise = promise;\n\n index_es.resolve().then(function () {\n return fetch.apply(null, args);\n }).then(function (response) {\n wrappedPromise.resolve(response);\n }).catch(function (error) {\n wrappedPromise.reject(error);\n });\n\n return wrappedPromise;\n}", "function page(index) {\n var item = internal.loader.info(index),\n res;\n if (item) {\n res = {\n index: item.index,\n data: item.cached,\n loading: item.queued || item.loading || item.waiting,\n cancel: item.cancel\n };\n } else {\n res = null;\n }\n return res;\n }", "getAddressIndex() {\n return __awaiter(this, void 0, void 0, function* () {\n return yield this.request(\"get_address_index\");\n });\n }", "async beginIndexRequest() {\n const keyString = this.idsToIndex.shift();\n const provider = this;\n\n this.pendingRequests += 1;\n const identifier = await this.openmct.objects.parseKeyString(keyString);\n const domainObject = await this.openmct.objects.get(identifier.key);\n delete provider.pendingIndex[keyString];\n try {\n if (domainObject) {\n await provider.index(identifier, domainObject);\n }\n } catch (error) {\n console.warn('Failed to index domain object ' + keyString, error);\n }\n\n setTimeout(function () {\n provider.pendingRequests -= 1;\n provider.keepIndexing();\n }, 0);\n }", "indexCountry() {\n return new Promise(function (resolve, reject) {\n logger.info('indexCountry() Initiated')\n let sql = sqlObj.dashboardStatus.indexCountry;\n dbInstance.doRead(sql)\n .then(result => {\n logger.info('indexCountry() Exited Successfully')\n resolve(result);\n })\n .catch(err => {\n logger.error('indexCountry() Error')\n reject(err);\n })\n })\n }", "async getBlockByIndex() {\r\n this.server.route({\r\n method: 'GET',\r\n path: '/api/block/{index}',\r\n handler: async (request, h) => {\r\n let block = await this.blockChain.getBlock(request.params.index);\r\n if(!block){\r\n throw Boom.notFound(\"Block not found.\");\r\n }else{\r\n return block;\r\n }\r\n }\r\n });\r\n }", "function load(index) {\n return loadInternal(getLView(), index);\n}", "function load(index) {\n return loadInternal(getLView(), index);\n}", "async load () {}", "function asyncGet() {\n return new Promise(function (success, fail) {\n let xhr = new XMLHttpRequest();\n xhr.open(\"GET\", rootURL + \"list\", true);\n xhr.onload = () => {\n if (xhr.status === 200)\n success(JSON.parse(xhr.responseText));\n else fail(alert(xhr.statusText));\n };\n xhr.onerror = () => fail(alert(xhr.statusText));\n xhr.send();\n });\n}", "async index () {\n const transactions = await Transaction.all();\n return transactions;\n }", "async index () {\n const abastecimento = await Abastecimento.all();\n\n return abastecimento;\n }", "initDB(tables) {\n let self = this;\n return new Promise(function (resolve, reject) {\n let req = self.indexDbApi.open(self.dbName, self.dbV);\n let db;\n let tableNames = Object.keys(tables);\n let tableIndexes = Object.values(tables);\n\n req.onerror = function (e) {\n console.log('DB init Error');\n reject(e);\n };\n req.onsuccess = function (e) {\n db = e.target.result;\n console.log('DB init Success');\n setTimeout(function () {\n resolve(db);\n }, 100);\n };\n req.onupgradeneeded = function (e) {\n db = e.target.result;\n let store;\n for (let i = 0; i < tableNames.length; i++) {\n if (!db.objectStoreNames.contains(tableNames[i])) {\n store = db.createObjectStore(tableNames[i], {keyPath: self.keyPath, autoIncrement: false});\n console.log('TABLE ' + tableNames[i] + ' created Success');\n }\n for (let j = 0; j < tableIndexes[i].length; j++) {\n store.createIndex(tableIndexes[i][j][0], tableIndexes[i][j][0], {unique: tableIndexes[i][j][1]});\n }\n }\n console.log(\"onupgradeneeded\");\n };\n });\n\n }", "function syncIt() {\n return getIndexedDB()\n .then(sendToServer)\n .catch(function(err) {\n return err;\n })\n}", "_nextLoadHandler(handlers, index=0) {\n return utils.promise.result(this._executeLoadHandler(handlers[index]))\n .then(() => ++index === handlers.length ? Promise.resolve() : this._nextLoadHandler(handlers, index));\n }", "function syncDatabaseIndexDB() {\n\n //initialises the indexedDB database\n initDatabase();\n\n fetch('/index/events')\n .then(response => {\n return response.json();\n })\n .then(events => {\n clearEvent();\n addEvents(events);\n })\n .catch(err => {\n\n });\n fetch('/index/stories')\n .then(response => {\n return response.json();\n })\n .then(stories => {\n clearStory();\n addStories(stories)\n //console.log(events);\n })\n .catch(err => {\n\n });\n}", "function getIndex(){\n var xhr = new XMLHttpRequest();\n xhr.open(\"GET\", '/getIndex', true);\n xhr.onreadystatechange= function() {\n if (this.readyState!==4) return; // not ready yet\n if (this.status===200) { // HTTP 200 OK\n index =this.response;\n getRetrieve();\n } else {\n alert(\"not working!\");\n }\n };\n xhr.send(null);\n}", "checkIndex(indexName) {\n return this.indexExists(indexName)\n .then(found => found ? Promise.resolve() : Promise.reject(new errors.InternalServerError('Index not created.')));\n }", "function dbIndexQuery(index, indexName){\n var tx = dbRequest.result.transaction('task')\n var store = tx.objectStore('task');\n const statusIndex= store.index(index);\n const getStatus=statusIndex.getAll(indexName);\n\n getStatus.onsuccess=(e)=>{\n\n let web= e.target.result\n let webKey=getStatus.key\n web.map((pend)=>{\n createLi(pend.time,pend.task,pend.status,activityDisplay)\n console.log(web)\n\n })\n }\n }", "getPairsIndex() {\n return tslib_1.__awaiter(this, void 0, void 0, function* () {\n return yield this.getRestData('/pairs');\n });\n }", "function testFunc(index) {\n return new Promise(function (resolve) {\n setTimeout(() => resolve(index), Math.random() * 11);\n });\n}", "indexExists(indexName) {\n return new Promise((resolve, reject) => {\n this.client.indices.exists({index: indexName}, (err, found) => {\n if (err) reject(err);\n resolve(found);\n });\n });\n }", "function DISABLEDsetup_database_objects_table_async(indexedDbName, objectStoreName, keyId_json_path,table_id, node, table_conf, header_conf,column_conf) {\n\n\t/*\n\t * indexedDbName\n\t * objectStore\n\t * \n\t * \n\t */\n\ttry {\n\t return new Promise(\n\t\t function (resolve, reject) {\n\n\t\n//var table_conf = JSON.parse(JSON.stringify(t));\n//var header_conf = JSON.parse(JSON.stringify(h));\n//var column_conf = JSON.parse(JSON.stringify(c));\n\n\nconsole.debug(\"# setup_database_objects_table\" );\n //console.debug(\"objectStore: \" + objectStoreName);\n//console.debug(\"indexedDbName: \" + indexedDbName);\n // console.debug(\"node: \" + JSON.stringify(node));\n\t\n //console.debug(\"table_conf: \" + JSON.stringify(table_conf));\n //console.debug(\"header_conf: \" + JSON.stringify(header_conf));\n //console.debug(\"column_conf: \" + JSON.stringify(column_conf));\n\n \n // ##########\n // list all objects in db\n // ##########\n\n\n // var table_obj = createTable(table_conf, key);\n\n var div_table_obj = document.createElement(\"div\");\n div_table_obj.setAttribute(\"class\", \"tableContainer\");\n var table_obj = document.createElement(\"table\");\n\n table_obj.setAttribute(\"class\", \"scrollTable\");\n table_obj.setAttribute(\"width\", \"100%\");\n table_obj.setAttribute(\"id\", table_id);\n table_obj.setAttribute(\"indexedDbName\", indexedDbName);\n table_obj.setAttribute(\"objectStoreName\", objectStoreName);\n \n\n div_table_obj.appendChild(table_obj);\n\n var thead = document.createElement(\"thead\");\n thead.setAttribute(\"class\", \"fixedHeader\");\n thead.appendChild(writeTableHeaderRow(header_conf));\n\n table_obj.appendChild(thead);\n\n node.appendChild(table_obj);\n\n var tbody = document.createElement(\"tbody\");\n tbody.setAttribute(\"class\", \"scrollContent\");\n \n node.appendChild(tbody);\n\n var dbRequest = indexedDB.open(indexedDbName);\n dbRequest.onerror = function (event) {\n reject(Error(\"Error text\"));\n };\n\n dbRequest.onupgradeneeded = function (event) {\n // Objectstore does not exist. Nothing to load\n event.target.transaction.abort();\n reject(Error('Not found'));\n };\n\n \n dbRequest.onsuccess = function (event) {\n var database = event.target.result;\n var transaction = database.transaction(objectStoreName, 'readonly');\n var objectStore = transaction.objectStore(objectStoreName);\n\n if ('getAll' in objectStore) {\n // IDBObjectStore.getAll() will return the full set of items\n // in our store.\n objectStore.getAll().onsuccess = function (event) {\n const res = event.target.result;\n // console.debug(res);\n for (const url of res) {\n\n const tr = writeTableRow(url, column_conf, keyId_json_path);\n\n // create add row to table\n\n tbody.appendChild(tr);\n\n }\n\n };\n // add a line where information on a new key can be added to\n // the database.\n // document.querySelector(\"button.onAddDecryptionKey\").onclick\n // = this.onAddDecryptionKey;\n\n } else {\n // Fallback to the traditional cursor approach if getAll\n // isn't supported.\n \n var timestamps = [];\n objectStore.openCursor().onsuccess = function (event) {\n var cursor = event.target.result;\n if (cursor) {\n console.debug(cursor.value);\n // timestamps.push(cursor.value);\n cursor.continue();\n } else {\n // logTimestamps(timestamps);\n }\n };\n\n \n }\n\n };\n table_obj.appendChild(tbody);\n node.appendChild(table_obj);\n resolve (div_table_obj);\n\n \n});\n} catch (e) {\n console.debug(e)\n}\n\n\n}", "static LoadFromMemoryAsync() {}", "async loadData() {\n if (!this.load_data) throw new Error('no load data callback provided');\n\n return await Q.nfcall(this.load_data);\n }", "getFullList() {\n return new Promise((resolve) => {\n // get first page to refresh total page count\n this.getPageData(1).then((firstPage) => {\n const pages = { 1: firstPage };\n // save totalPages as a constant to avoid race condition with pages added during this\n // process\n const { totalPages } = this;\n\n if (totalPages <= 1) {\n resolve(firstPage);\n } else {\n // now fetch all the missing pages\n Array.from(new Array(totalPages - 1), (x, i) => i + 2).forEach((pageNum) => {\n this.getPageData(pageNum).then((newPage) => {\n pages[pageNum] = newPage;\n // look if all pages were collected\n const missingPages = Array.from(new Array(totalPages), (x, i) => i + 1)\n .filter((i) => !(i in pages));\n if (missingPages.length === 0) {\n // collect all the so-far loaded pages in order (sorted keys)\n // and flatten them into 1 array\n resolve([].concat(...Object.keys(pages).sort().map((key) => pages[key])));\n }\n });\n });\n }\n });\n });\n }", "static LoadFromFileAsync() {}", "function load(index){return loadInternal(getLView(),index);}", "load() {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_0__[\"__awaiter\"])(this, void 0, void 0, function* () { });\n }", "getFullList() {\n return new Promise((resolve) => {\n // get first page to refresh total page count\n this.getPageData(1).then((firstPage) => {\n const pages = { 1: firstPage };\n // save totalPages as a constant to avoid race condition with pages added during this\n // process\n const { totalPages } = this;\n\n if (totalPages === 1) {\n resolve(firstPage);\n }\n\n // now fetch all the missing pages\n Array.from(new Array(totalPages - 1), (x, i) => i + 2).forEach((pageNum) => {\n this.getPageData(pageNum).then((newPage) => {\n pages[pageNum] = newPage;\n // look if all pages were collected\n const missingPages = Array.from(new Array(totalPages), (x, i) => i + 1).filter(\n i => !(i in pages),\n );\n // eslint-disable-next-line no-console\n console.log('missingPages', missingPages);\n if (missingPages.length === 0) {\n // collect all the so-far loaded pages in order (sorted keys)\n // and flatten them into 1 array\n resolve([].concat(...Object.keys(pages).sort().map(key => pages[key])));\n }\n });\n });\n });\n });\n }", "async loadSearch() {\n let fs = this;\n return fetchJSONFile(fs.index, function(data) {\n //data = data.filter(function(page) {\n // return page.lang == document.documentElement.lang;\n //})\n fs.fuse = new Fuse(data, fs.fuseConfig);\n fs.isInit = true;\n console.log(\"hugo-fuse-search: Fuse.js was succesfuly instantiated.\");\n }, function(status, statusText) {\n console.log(\"hugo-fuse-search: retrieval of index file was unsuccesful (\\\"\" + fs.index + \"\\\": \" + status + \" - \" + statusText + \")\")\n });\n }", "function gvpLoadPromise () {\n if (context.uriAddressableDefsEnabled) {\n return Promise[\"resolve\"]();\n } else {\n return context.globalValueProviders.loadFromStorage();\n }\n }", "async function index(req, res) {}", "async index () {\n const status = await VisitaStatus.all();\n return status;\n }", "resolveWhenListIsPopulated(fn, orderedList, index, ctx) {\n\t\tconst _promise = new Promise(function(resolve) {\n\t\t\tconst _resolve = resolve;\n\t\t\tfn(orderedList, index, ctx, _resolve);\n\t\t});\n\t\treturn _promise;\n\t}", "loadState() {\n return Promise.resolve();\n }", "async index({ request, response, view }) {\n return await Bebida.all();\n }", "function LoadPaneDataAsync(pane_index, callback) {\n if (pane_index < 0 && pane_index > pane_count - 1) return;\n if (paneStatuses[\"p\" + pane_index]) return;\n\n $.ajax({\n url: options.url,\n data: { pn: pane_index + 1, cid: options.currSort },\n dataType: \"json\",\n error: function (jqXHR, textStatus, errorThrown) { },\n //complete: function (jqXHR, textStatus) { loading = false; },\n success: function (data, status) {\n if (data.code > 0) {\n paneDatas[\"_\" + pane_index] = data.dataItem;\n _loadPaneDataHandler(pane_index, data.dataItem);\n callback && callback();\n }\n }\n });\n }", "getBlockByIndex() {\n this.server.route({\n method: 'GET',\n path: '/block/{index}',\n handler: (request, h) => {\n return new Promise ((resolve,reject) => {\n const blockIndex = request.params.index ?\n encodeURIComponent(request.params.index) : -1;\n if (isNaN(blockIndex)) { \n reject(Boom.badRequest());\n } else {\n this.blockChain.getBlockHeight().then((chainHeight)=>{\n if (blockIndex <=chainHeight && blockIndex >-1)\n {\n this.blockChain.getBlock(blockIndex).then ((block)=>{\n resolve(block);\n });\n } else {\n reject(Boom.badRequest());\n }\n });\n }\n });\n }\n });\n }", "async fetchQueue( endpoint ){\n\t\treturn await axios.get( endpoint )\n\t}", "async index () {\n const properties = Property.all() \n return properties\n }", "function _getIndexedDB(callback) {\n var transaction = _newIDBTransaction();\n var objStore = transaction.objectStore('offlineItems');\n var keyRange = IDBKeyRange.lowerBound(0);\n var cursorRequest = objStore.index('byDate').openCursor(keyRange);\n var returnableItems = [];\n transaction.oncomplete = function(e) { callback(returnableItems); };\n cursorRequest.onsuccess = function(e) {\n var result = e.target.result;\n if (!!result == false) { return; }\n returnableItems.push(result.value);\n result.continue();\n };\n cursorRequest.onerror = function() { console.error(\"error\"); };\n }", "load() {\n return Promise.resolve(false /* identified */);\n }", "list() {\n return this.ready.then(db => {\n const transaction = db.transaction([STORE_NAME], 'readonly');\n const store = transaction.objectStore(STORE_NAME);\n const request = store.index('store').getAll(IDBKeyRange.only(this.name));\n return waitForRequest(request);\n }).then(files => {\n const result = {};\n files.forEach(file => {\n result[file.fileID] = file.data;\n });\n return result;\n });\n }", "getBlockByIndex() {\n this.server.route({\n method: 'GET',\n path: '/block/{index}',\n handler: (request, h) => {\n return new Promise ((resolve,reject) => {\n const blockIndex = request.params.index ?\n encodeURIComponent(request.params.index) : -1;\n if (isNaN(blockIndex)) { \n reject(Boom.badRequest());\n } else {\n this.blockChain.getBlockHeight().then((chainHeight)=>{\n if (blockIndex <=chainHeight && blockIndex >-1)\n {\n this.blockChain.getBlock(blockIndex).then ((newBlock)=>{\n resolve(JSON.stringify(newBlock));\n });\n } else {\n reject(Boom.badRequest());\n }\n });\n }\n });\n }\n });\n }", "function loadIndexes() {\n // Get search indexes.\n dataService.fetch('get', '/api/admin/indexes').then(\n function (data) {\n $scope.activeIndexes = data;\n // Get mappings configuration.\n dataService.fetch('get', '/api/admin/mappings').then(\n function (mappings) {\n // Reset the scopes variables for mappings.\n $scope.activeMappings = {};\n $scope.inActiveMappings = {};\n\n // Filter out active indexes.\n for (var index in mappings) {\n if (!$scope.activeIndexes.hasOwnProperty(index)) {\n $scope.inActiveMappings[index] = mappings[index];\n }\n else {\n $scope.activeMappings[index] = mappings[index];\n }\n }\n },\n function (reason) {\n $scope.message = reason.message;\n $scope.messageClass = 'alert-danger';\n }\n );\n },\n function (reason) {\n $scope.message = reason.message;\n $scope.messageClass = 'alert-danger';\n }\n );\n }", "function reference(index) {\n return loadInternal(index, contextViewData);\n}", "async getBlock(index) {\r\n // return Block as a JSON object\r\n return JSON.parse(await getDBData(index))\r\n }", "function createNewPromise(callback, id, index) {\n return new Promise((resolve, reject) => {\n callback(resolve, reject, id, index);\n });\n}", "static getFromIndexedDB(name, version, objStore, callback){\n\t\tDBHelper.openIndexedDB(name, version).then(function(db) {\n\t\t\tlet tx = db.transaction(objStore);\n\t\t\tlet store = tx.objectStore(objStore);\n\n\t\t\treturn store.getAll().then((response) => {\n\t\t\t\tif(response.length) {\n\t\t\t\t\tcallback(null, response);\n\t\t\t\t} else {\n\t\t\t\t\tcallback('There is no records in IndexedDB', null);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}", "function ɵɵload(index) {\n return loadInternal(getLView(), index);\n}", "fetch() {\r\n return new Promise((resolve, reject) => {\r\n const t = time.measure.start()\r\n this.docClient.scan({ TableName: this.table }, (err, data) => {\r\n time.measure.end(t, `Fetch (scan) from table ${this.table}`)\r\n if (err) {\r\n reject(err)\r\n } else {\r\n resolve(data.Items)\r\n }\r\n })\r\n })\r\n }", "getBlockByIndex() {\n this.server.route({\n method: 'GET',\n path: '/block/{index}',\n handler: async (request, h) => {\n let blockIndex = parseInt(request.params.index);\n const result = await this.blockchain.getBlock(blockIndex);\n return result.statusCode !== undefined ? result : await this.blockchain.addDecodedStoryToReturnObj(JSON.stringify(result).toString());\n }\n });\n }", "getInitialIndexes() {\n this.setState({\n initialLoading: true,\n initialLoadText: 'índices...',\n loadError: false\n });\n this.subscribe(\n TimeseriesService.list({template_category: 'emac-index', max_events: 1}),\n data => {\n this.setState(state => ({\n indexes: data,\n tableData: generateTableData(Object.values(state.targets), data, state.tickets, availability),\n initialLoading: false,\n lastUpdate: moment().format(config.DATETIME_FORMAT)\n }));\n this.setDataUpdate();\n },\n (err) => this.setState({loadError: true, initialLoading: false})\n );\n }", "async index () {\n return await Operator.all()\n }", "function loadFromIndex(storeName, indexName, innerFunction, callback) {\n var cursor = db.transaction([storeName], 'readonly').objectStore(storeName).index(indexName).openCursor();\n \n cursor.onsuccess = function(event) {\n var result = this.result;\n if (result) {\n innerFunction(result);\n result.continue();\n }\n else {\n callback();\n }\n };\n \n }", "loadPage(rawPath) {\n const pagePath = (0,_find_path__WEBPACK_IMPORTED_MODULE_2__.findPath)(rawPath);\n\n if (this.pageDb.has(pagePath)) {\n const page = this.pageDb.get(pagePath);\n\n if (true) {\n return Promise.resolve(page.payload);\n }\n }\n\n if (this.inFlightDb.has(pagePath)) {\n return this.inFlightDb.get(pagePath);\n }\n\n const inFlightPromise = Promise.all([this.loadAppData(), this.loadPageDataJson(pagePath)]).then(allData => {\n const result = allData[1];\n\n if (result.status === PageResourceStatus.Error) {\n return {\n status: PageResourceStatus.Error\n };\n }\n\n let pageData = result.payload;\n const {\n componentChunkName,\n staticQueryHashes = []\n } = pageData;\n const finalResult = {};\n const componentChunkPromise = this.loadComponent(componentChunkName).then(component => {\n finalResult.createdAt = new Date();\n let pageResources;\n\n if (!component) {\n finalResult.status = PageResourceStatus.Error;\n } else {\n finalResult.status = PageResourceStatus.Success;\n\n if (result.notFound === true) {\n finalResult.notFound = true;\n }\n\n pageData = Object.assign(pageData, {\n webpackCompilationHash: allData[0] ? allData[0].webpackCompilationHash : ``\n });\n pageResources = toPageResources(pageData, component);\n } // undefined if final result is an error\n\n\n return pageResources;\n });\n const staticQueryBatchPromise = Promise.all(staticQueryHashes.map(staticQueryHash => {\n // Check for cache in case this static query result has already been loaded\n if (this.staticQueryDb[staticQueryHash]) {\n const jsonPayload = this.staticQueryDb[staticQueryHash];\n return {\n staticQueryHash,\n jsonPayload\n };\n }\n\n return this.memoizedGet(`${\"\"}/page-data/sq/d/${staticQueryHash}.json`).then(req => {\n const jsonPayload = JSON.parse(req.responseText);\n return {\n staticQueryHash,\n jsonPayload\n };\n });\n })).then(staticQueryResults => {\n const staticQueryResultsMap = {};\n staticQueryResults.forEach(({\n staticQueryHash,\n jsonPayload\n }) => {\n staticQueryResultsMap[staticQueryHash] = jsonPayload;\n this.staticQueryDb[staticQueryHash] = jsonPayload;\n });\n return staticQueryResultsMap;\n });\n return Promise.all([componentChunkPromise, staticQueryBatchPromise]).then(([pageResources, staticQueryResults]) => {\n let payload;\n\n if (pageResources) {\n payload = { ...pageResources,\n staticQueryResults\n };\n finalResult.payload = payload;\n _emitter__WEBPACK_IMPORTED_MODULE_1__.default.emit(`onPostLoadPageResources`, {\n page: payload,\n pageResources: payload\n });\n }\n\n this.pageDb.set(pagePath, finalResult);\n return payload;\n });\n });\n inFlightPromise.then(response => {\n this.inFlightDb.delete(pagePath);\n }).catch(error => {\n this.inFlightDb.delete(pagePath);\n throw error;\n });\n this.inFlightDb.set(pagePath, inFlightPromise);\n return inFlightPromise;\n }", "loadPage(rawPath) {\n const pagePath = (0,_find_path__WEBPACK_IMPORTED_MODULE_2__.findPath)(rawPath);\n\n if (this.pageDb.has(pagePath)) {\n const page = this.pageDb.get(pagePath);\n\n if (true) {\n return Promise.resolve(page.payload);\n }\n }\n\n if (this.inFlightDb.has(pagePath)) {\n return this.inFlightDb.get(pagePath);\n }\n\n const inFlightPromise = Promise.all([this.loadAppData(), this.loadPageDataJson(pagePath)]).then(allData => {\n const result = allData[1];\n\n if (result.status === PageResourceStatus.Error) {\n return {\n status: PageResourceStatus.Error\n };\n }\n\n let pageData = result.payload;\n const {\n componentChunkName,\n staticQueryHashes = []\n } = pageData;\n const finalResult = {};\n const componentChunkPromise = this.loadComponent(componentChunkName).then(component => {\n finalResult.createdAt = new Date();\n let pageResources;\n\n if (!component) {\n finalResult.status = PageResourceStatus.Error;\n } else {\n finalResult.status = PageResourceStatus.Success;\n\n if (result.notFound === true) {\n finalResult.notFound = true;\n }\n\n pageData = Object.assign(pageData, {\n webpackCompilationHash: allData[0] ? allData[0].webpackCompilationHash : ``\n });\n pageResources = toPageResources(pageData, component);\n } // undefined if final result is an error\n\n\n return pageResources;\n });\n const staticQueryBatchPromise = Promise.all(staticQueryHashes.map(staticQueryHash => {\n // Check for cache in case this static query result has already been loaded\n if (this.staticQueryDb[staticQueryHash]) {\n const jsonPayload = this.staticQueryDb[staticQueryHash];\n return {\n staticQueryHash,\n jsonPayload\n };\n }\n\n return this.memoizedGet(`${\"\"}/page-data/sq/d/${staticQueryHash}.json`).then(req => {\n const jsonPayload = JSON.parse(req.responseText);\n return {\n staticQueryHash,\n jsonPayload\n };\n });\n })).then(staticQueryResults => {\n const staticQueryResultsMap = {};\n staticQueryResults.forEach(({\n staticQueryHash,\n jsonPayload\n }) => {\n staticQueryResultsMap[staticQueryHash] = jsonPayload;\n this.staticQueryDb[staticQueryHash] = jsonPayload;\n });\n return staticQueryResultsMap;\n });\n return Promise.all([componentChunkPromise, staticQueryBatchPromise]).then(([pageResources, staticQueryResults]) => {\n let payload;\n\n if (pageResources) {\n payload = { ...pageResources,\n staticQueryResults\n };\n finalResult.payload = payload;\n _emitter__WEBPACK_IMPORTED_MODULE_1__.default.emit(`onPostLoadPageResources`, {\n page: payload,\n pageResources: payload\n });\n }\n\n this.pageDb.set(pagePath, finalResult);\n return payload;\n });\n });\n inFlightPromise.then(response => {\n this.inFlightDb.delete(pagePath);\n }).catch(error => {\n this.inFlightDb.delete(pagePath);\n throw error;\n });\n this.inFlightDb.set(pagePath, inFlightPromise);\n return inFlightPromise;\n }", "async index () {\n const deposito = await Deposito.all();\n return deposito;\n }", "loadPage(rawPath) {\n const pagePath = Object(_find_path__WEBPACK_IMPORTED_MODULE_3__[\"findPath\"])(rawPath);\n\n if (this.pageDb.has(pagePath)) {\n const page = this.pageDb.get(pagePath);\n\n if (true) {\n return Promise.resolve(page.payload);\n }\n }\n\n if (this.inFlightDb.has(pagePath)) {\n return this.inFlightDb.get(pagePath);\n }\n\n const inFlightPromise = Promise.all([this.loadAppData(), this.loadPageDataJson(pagePath)]).then(allData => {\n const result = allData[1];\n\n if (result.status === PageResourceStatus.Error) {\n return {\n status: PageResourceStatus.Error\n };\n }\n\n let pageData = result.payload;\n const {\n componentChunkName,\n staticQueryHashes = []\n } = pageData;\n const finalResult = {};\n const componentChunkPromise = this.loadComponent(componentChunkName).then(component => {\n finalResult.createdAt = new Date();\n let pageResources;\n\n if (!component) {\n finalResult.status = PageResourceStatus.Error;\n } else {\n finalResult.status = PageResourceStatus.Success;\n\n if (result.notFound === true) {\n finalResult.notFound = true;\n }\n\n pageData = Object.assign(pageData, {\n webpackCompilationHash: allData[0] ? allData[0].webpackCompilationHash : ``\n });\n pageResources = toPageResources(pageData, component);\n } // undefined if final result is an error\n\n\n return pageResources;\n });\n const staticQueryBatchPromise = Promise.all(staticQueryHashes.map(staticQueryHash => {\n // Check for cache in case this static query result has already been loaded\n if (this.staticQueryDb[staticQueryHash]) {\n const jsonPayload = this.staticQueryDb[staticQueryHash];\n return {\n staticQueryHash,\n jsonPayload\n };\n }\n\n return this.memoizedGet(`${\"\"}/page-data/sq/d/${staticQueryHash}.json`).then(req => {\n const jsonPayload = JSON.parse(req.responseText);\n return {\n staticQueryHash,\n jsonPayload\n };\n });\n })).then(staticQueryResults => {\n const staticQueryResultsMap = {};\n staticQueryResults.forEach(({\n staticQueryHash,\n jsonPayload\n }) => {\n staticQueryResultsMap[staticQueryHash] = jsonPayload;\n this.staticQueryDb[staticQueryHash] = jsonPayload;\n });\n return staticQueryResultsMap;\n });\n return Promise.all([componentChunkPromise, staticQueryBatchPromise]).then(([pageResources, staticQueryResults]) => {\n let payload;\n\n if (pageResources) {\n payload = _objectSpread(_objectSpread({}, pageResources), {}, {\n staticQueryResults\n });\n finalResult.payload = payload;\n _emitter__WEBPACK_IMPORTED_MODULE_2__[\"default\"].emit(`onPostLoadPageResources`, {\n page: payload,\n pageResources: payload\n });\n }\n\n this.pageDb.set(pagePath, finalResult);\n return payload;\n });\n });\n inFlightPromise.then(response => {\n this.inFlightDb.delete(pagePath);\n }).catch(error => {\n this.inFlightDb.delete(pagePath);\n throw error;\n });\n this.inFlightDb.set(pagePath, inFlightPromise);\n return inFlightPromise;\n }", "async function initIndex() {\n await initThemes()\n fetchAlbumsImgur()\n M.updateTextFields();\n}", "async index () {\n const atividade = await AtividadeDoDia.all();\n return atividade;\n }", "async function run () {\n const escenicArticles = await getEscenicArticles(client, elascticsearchSourceIndexParams).catch(console.log)\n const transformedArticles = transformEscenicArticle(escenicArticles)\n transformedArticles\n .map(article => createUrlNavIdMapping(article))\n // await bulkIndex(transformedArticles)\n}", "function fetchDocAsynchronously(metadata, row, winningRev$$1) {\n var key = metadata.id + \"::\" + winningRev$$1;\n docIdRevIndex.get(key).onsuccess = function onGetDoc(e) {\n row.doc = decodeDoc(e.target.result);\n if (opts.conflicts) {\n var conflicts = collectConflicts(metadata);\n if (conflicts.length) {\n row.doc._conflicts = conflicts;\n }\n }\n fetchAttachmentsIfNecessary(row.doc, opts, txn);\n };\n }", "function fetchDocAsynchronously(metadata, row, winningRev$$1) {\n var key = metadata.id + \"::\" + winningRev$$1;\n docIdRevIndex.get(key).onsuccess = function onGetDoc(e) {\n row.doc = decodeDoc(e.target.result);\n if (opts.conflicts) {\n var conflicts = collectConflicts(metadata);\n if (conflicts.length) {\n row.doc._conflicts = conflicts;\n }\n }\n fetchAttachmentsIfNecessary(row.doc, opts, txn);\n };\n }", "function fetchDocAsynchronously(metadata, row, winningRev$$1) {\n var key = metadata.id + \"::\" + winningRev$$1;\n docIdRevIndex.get(key).onsuccess = function onGetDoc(e) {\n row.doc = decodeDoc(e.target.result);\n if (opts.conflicts) {\n var conflicts = collectConflicts(metadata);\n if (conflicts.length) {\n row.doc._conflicts = conflicts;\n }\n }\n fetchAttachmentsIfNecessary(row.doc, opts, txn);\n };\n }", "function fetchDocAsynchronously(metadata, row, winningRev$$1) {\n var key = metadata.id + \"::\" + winningRev$$1;\n docIdRevIndex.get(key).onsuccess = function onGetDoc(e) {\n row.doc = decodeDoc(e.target.result);\n if (opts.conflicts) {\n var conflicts = collectConflicts(metadata);\n if (conflicts.length) {\n row.doc._conflicts = conflicts;\n }\n }\n fetchAttachmentsIfNecessary(row.doc, opts, txn);\n };\n }", "getAllByIndex(storeName, indexName, keyRange) {\n const data = [];\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 index = objectStore.index(indexName);\n const request = index.openCursor(keyRange);\n request.onsuccess = (event) => {\n const cursor = event.target.result;\n if (cursor) {\n data.push(cursor.value);\n cursor.continue();\n }\n else {\n resolve(data);\n }\n };\n })\n .catch((reason) => reject(reason));\n }));\n }", "function index_esm_async(fn, onError) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n Promise.resolve(true).then(function () {\n fn.apply(void 0, args);\n }).catch(function (error) {\n if (onError) {\n onError(error);\n }\n });\n };\n}", "function fetchDocAsynchronously(metadata, row, winningRev$$1) {\n var key = metadata.id + \"::\" + winningRev$$1;\n docIdRevIndex.get(key).onsuccess = function onGetDoc(e) {\n row.doc = decodeDoc(e.target.result) || {};\n if (opts.conflicts) {\n var conflicts = collectConflicts(metadata);\n if (conflicts.length) {\n row.doc._conflicts = conflicts;\n }\n }\n fetchAttachmentsIfNecessary(row.doc, opts, txn);\n };\n }", "constructor(core, baseURL = \"/ext/index/X/tx\") {\n super(core, baseURL);\n /**\n * Get last accepted tx, vtx or block\n *\n * @param encoding\n * @param baseURL\n *\n * @returns Returns a Promise<GetLastAcceptedResponse>.\n */\n this.getLastAccepted = (encoding = \"cb58\", baseURL = this.getBaseURL()) => __awaiter(this, void 0, void 0, function* () {\n this.setBaseURL(baseURL);\n const params = {\n encoding\n };\n try {\n const response = yield this.callMethod(\"index.getLastAccepted\", params);\n return response.data.result;\n }\n catch (error) {\n console.log(error);\n }\n });\n /**\n * Get container by index\n *\n * @param index\n * @param encoding\n * @param baseURL\n *\n * @returns Returns a Promise<GetContainerByIndexResponse>.\n */\n this.getContainerByIndex = (index = \"0\", encoding = \"cb58\", baseURL = this.getBaseURL()) => __awaiter(this, void 0, void 0, function* () {\n this.setBaseURL(baseURL);\n const params = {\n index,\n encoding\n };\n try {\n const response = yield this.callMethod(\"index.getContainerByIndex\", params);\n return response.data.result;\n }\n catch (error) {\n console.log(error);\n }\n });\n /**\n * Get contrainer by ID\n *\n * @param containerID\n * @param encoding\n * @param baseURL\n *\n * @returns Returns a Promise<GetContainerByIDResponse>.\n */\n this.getContainerByID = (containerID = \"0\", encoding = \"cb58\", baseURL = this.getBaseURL()) => __awaiter(this, void 0, void 0, function* () {\n this.setBaseURL(baseURL);\n const params = {\n containerID,\n encoding\n };\n try {\n const response = yield this.callMethod(\"index.getContainerByID\", params);\n return response.data.result;\n }\n catch (error) {\n console.log(error);\n }\n });\n /**\n * Get container range\n *\n * @param startIndex\n * @param numToFetch\n * @param encoding\n * @param baseURL\n *\n * @returns Returns a Promise<GetContainerRangeResponse>.\n */\n this.getContainerRange = (startIndex = 0, numToFetch = 100, encoding = \"cb58\", baseURL = this.getBaseURL()) => __awaiter(this, void 0, void 0, function* () {\n this.setBaseURL(baseURL);\n const params = {\n startIndex,\n numToFetch,\n encoding\n };\n try {\n const response = yield this.callMethod(\"index.getContainerRange\", params);\n return response.data.result;\n }\n catch (error) {\n console.log(error);\n }\n });\n /**\n * Get index by containerID\n *\n * @param containerID\n * @param encoding\n * @param baseURL\n *\n * @returns Returns a Promise<GetIndexResponse>.\n */\n this.getIndex = (containerID = \"\", encoding = \"cb58\", baseURL = this.getBaseURL()) => __awaiter(this, void 0, void 0, function* () {\n this.setBaseURL(baseURL);\n const params = {\n containerID,\n encoding\n };\n try {\n const response = yield this.callMethod(\"index.getIndex\", params);\n return response.data.result.index;\n }\n catch (error) {\n console.log(error);\n }\n });\n /**\n * Check if container is accepted\n *\n * @param containerID\n * @param encoding\n * @param baseURL\n *\n * @returns Returns a Promise<GetIsAcceptedResponse>.\n */\n this.isAccepted = (containerID = \"\", encoding = \"cb58\", baseURL = this.getBaseURL()) => __awaiter(this, void 0, void 0, function* () {\n this.setBaseURL(baseURL);\n const params = {\n containerID,\n encoding\n };\n try {\n const response = yield this.callMethod(\"index.isAccepted\", params);\n return response.data.result;\n }\n catch (error) {\n console.log(error);\n }\n });\n }", "function load_model(index){\n if(index >= self.models.length){\n loaded.resolve();\n }else{\n var model = self.models[index];\n self.pos_widget.loading_message(_t('Loading')+' '+(model.label || model.model || ''), progress);\n var fields = typeof model.fields === 'function' ? model.fields(self,tmp) : model.fields;\n var domain = typeof model.domain === 'function' ? model.domain(self,tmp) : model.domain;\n var context = typeof model.context === 'function' ? model.context(self,tmp) : model.context;\n var ids = typeof model.ids === 'function' ? model.ids(self,tmp) : model.ids;\n progress += progress_step;\n\n if( model.model ){\n if (model.ids) {\n var records = new instance.web.Model(model.model).call('read',[ids,fields],context);\n } else {\n var records = new instance.web.Model(model.model).query(fields).filter(domain).context(context).all()\n }\n records.then(function(result){\n try{ // catching exceptions in model.loaded(...)\n\n result_filtered = []\n if(model.model == \"product.product\")\n {\n for(var i = 0; i < result.length; i++)\n {\n //Filtrando los productos que tengan stock >0, que no tengan una compañia\n //o que tengan una compañia asignada y coincida con la que tiene configurada el\n //punto de venta\n if(result[i].stock_qty > 0 && (result[i].company_id == false || (result[i].company_id != false && result[i].company_id[0] == self.config.company_id[0])))\n {\n result_filtered.push(result[i]);\n }\n }\n result = result_filtered;\n }\n\n $.when(model.loaded(self,result,tmp))\n .then(function(){ load_model(index + 1); },\n function(err){ loaded.reject(err); });\n }catch(err){\n loaded.reject(err);\n }\n },function(err){\n loaded.reject(err);\n });\n }else if( model.loaded ){\n try{ // catching exceptions in model.loaded(...)\n $.when(model.loaded(self,tmp))\n .then( function(){ load_model(index +1); },\n function(err){ loaded.reject(err); });\n }catch(err){\n loaded.reject(err);\n }\n }else{\n load_model(index + 1);\n }\n }\n }" ]
[ "0.70689124", "0.6799907", "0.6459076", "0.64186", "0.6398918", "0.6349781", "0.62687784", "0.62290114", "0.6192579", "0.6090689", "0.60649323", "0.60526985", "0.6047419", "0.60411704", "0.6028308", "0.6021699", "0.60055244", "0.5975181", "0.59711975", "0.5960433", "0.59251773", "0.5924601", "0.5914405", "0.589476", "0.58265656", "0.5819227", "0.5814982", "0.58119315", "0.57929933", "0.5787757", "0.5718783", "0.5714132", "0.5705826", "0.57014626", "0.56750166", "0.56750166", "0.5671128", "0.56681", "0.5637177", "0.5609277", "0.56085664", "0.55957437", "0.5586686", "0.55646867", "0.55642456", "0.5556605", "0.555313", "0.5540329", "0.55356765", "0.55341953", "0.55123407", "0.5510772", "0.5500237", "0.5496024", "0.54837537", "0.54831994", "0.54769605", "0.5453688", "0.5441287", "0.5438654", "0.54350406", "0.54262793", "0.542575", "0.5413852", "0.54063386", "0.5392346", "0.5387349", "0.53838104", "0.53789485", "0.537301", "0.53658503", "0.53520155", "0.53439146", "0.5334698", "0.53222424", "0.5315072", "0.530383", "0.53028625", "0.52970886", "0.5294206", "0.5285951", "0.52737993", "0.527296", "0.52698225", "0.52550966", "0.52550966", "0.52510047", "0.5249351", "0.5245122", "0.5237378", "0.5235755", "0.523273", "0.523273", "0.523273", "0.523273", "0.52324253", "0.52306527", "0.5224917", "0.52231497", "0.5220224" ]
0.7352213
0
A class to define how a fighter behaves. Gun constructor Sets the properties with the provided arguments
function Gun(x, y, size) { this.x = x; this.y = y; this.size = size; this.angle; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Gun(descr) {\n\n // Common inherited setup logic from Entity\n this.setup(descr);\n\n this.rememberResets();\n\t\n\tthis.tower = g_sprites.tower;\n this.diamond = g_sprites.diamond;\n\t\n\tthis.towerHeight = this.tower.height;\n\tthis.towerWidth = this.tower.width;\n\t\n // Set normal drawing scale, and warp state off\n this._scale = 0;\n\n this.cooldown = this.getCooldown();\n}", "function Gun() {\n ( function init( self )\n {\n self.bulletCountMax = 30;\n self.timeBetweenBullet = 100;\n self.timeReload = 2500;\n\n // State: 0: Can fire, 1: cooldown between bullets, 2: reloading\n self.state = 0;\n self.bulletCount = self.bulletCountMax;\n self.timeSinceLastBullet = 0;\n self.timeSinceReload = 0;\n\n self.animationTime = 0;\n } ) ( this );\n}", "function Gun(name, type, range, auto, db, magSize, maxMagSize, ammoType, bullet, melee) {\r\n // Properties\r\n // Basic properties\r\n this.name = name;\r\n this.type = type;\r\n this.range = range;\r\n this.isFullAuto = auto;\r\n this.noise = db;\r\n this.magSize = magSize;\r\n\tthis.maxMagSize = maxMagSize;\r\n this.ammoType = ammoType;\r\n this.bulletDamage = bullet;\r\n this.meleeValue = melee;\r\n\r\n // Secondary fire mode properties\r\n this.secondaryFire = false;\r\n this.secondaryFireAmmo = null;\r\n\tthis.secondaryFiremaxMag = null;\r\n\tthis.secondaryDamage = null;\r\n\tthis.ammoSecondaryType = null;\r\n\r\n // Modifiers\r\n this.rangeModifier = 0;\r\n this.scopeAttached = false;\r\n\tthis.magAttached = false;\r\n\tthis.silencerAttached = false;\r\n\tthis.bayonetAttached = false;\r\n this.noiseModifier = 0;\r\n this.magModifier = null;\r\n this.damageModifier = 0;\r\n this.accuracyModifier = 0;\r\n this.meleeValueModifier = 0;\r\n\r\n // Methods\r\n /*\r\n\tNOTES:\r\n\tMoved the methods to here instead of gun.prototype because we do not want to modify the object that the gun extends... which is the Object object.\r\n\tMeaning that, before, *all* objects had a SprayAndPray method.\r\n\tHowever, if you make a new object that derives from gun, you can use myObject.prototype.myMethod to add myMethod to the gun object.\r\n */\r\n\r\n /*\r\n\tAdds an attachment to the gun\r\n\tattachment - string - name of attachment to apply\r\n */\r\n this.addAttachment = function(attachment) {\r\n\tvar output = \"\";\r\n\r\n\tswitch(attachment) {\r\n\t case \"GP-30 grenade launcher\":\r\n\t\tif (this.type === \"russian assault rifle\") {\r\n\t\t this.secondaryFire = true;\r\n\t\t this.secondaryFireAmmo = 1;\r\n\t\t\tthis.secondaryFiremaxMag = 1;\r\n\t\t\tthis.secondaryDamage = 300;\r\n\t\t\tthis.ammoSecondaryType = \"grenades\";\r\n\t\t\tdocument.getElementById(\"grenadeLauncherAttachment\").innerHTML = \"<img src=\\\"images/interface/grenadeLauncherAttached.png\\\">\";\r\n\t\t output = \"<p> <img src=\\\"images/interface/grenadeLauncherAttached.png\\\"> The GP-30 grenade launcher slides onto the rails under your \"+ this.name +\". The smell of gun grease and sweat wafts up from the heat that radiates off of the ground and into your nostrils as a sickly sweet aroma. You grin slightly, cocking the weapon to the side to admire your handiwork and slide a grenade into your newly attached piece of hardware. It is now ready to fire. <span class=\\\"update\\\">Click the grenade icon in the secondary fire pane, and then on the target you wish to attack!</span> </p>\";\r\n\t\t} else {\r\n\t\t output = \"<p>You can only use this attachment with a russian-made assault rifle. </p>\";\r\n\t\t}\r\n\t break;\r\n\r\n\t case \"Red dot sight\":\r\n\t\tthis.rangeModifier = 20;\r\n\t\tthis.scopeAttached = true;\r\n\t\tdocument.getElementById(\"scopeAttachment\").innerHTML = \"<img src=\\\"images/interface/scopeAttached.png\\\">\";\r\n\t\toutput = \"<p> <img src=\\\"images/interface/scopeAttached.png\\\"> Your red dot sight slides into position with a slight *click*. You check your sights and make the necessary adjustments. Good to go. You now have a \" + this.rangeModifier + \" point accuracy bonus. </p>\";\r\n\t break;\r\n\r\n\t case \"Reflex sight\":\r\n\t\tthis.rangeModifier = 10;\r\n\t\tthis.scopeAttached = true;\r\n\t\tdocument.getElementById(\"scopeAttachment\").innerHTML = \"<img src=\\\"images/interface/scopeAttached.png\\\">\";\r\n\t\toutput = \"<p> <img src=\\\"images/interface/scopeAttached.png\\\"> Your reflex sight attaches with no issue. You tweak the settings until you are happy with them and begin staring down the sights intently for the kill. </p>\";\r\n\t break;\r\n\r\n\t case \"6H5 type bayonet\":\r\n\t\tthis.bayonetAttached = true;\r\n\t\tthis.meleeValueModifier = 20;\r\n\t\tdocument.getElementById(\"bayonetAttachment\").innerHTML = \"<img src=\\\"images/interface/bayonetAttached.png\\\">\";\r\n\t\toutput = \"<p> <img src=\\\"images/interface/bayonetAttached.png\\\"> You affix the 6H5 type bayonet to the end of your weapon and let loose a maniacal guffaw! You now have a [20] point damage bonus for melee attacks.</p>\";\r\n\t break;\r\n\r\n\t case \"Silencer\":\r\n\t\tthis.silencerAttached = true;\r\n\t\tthis.noiseModifier = 40;\r\n\t\tdocument.getElementById(\"silencerAttachment\").innerHTML = \"<img src=\\\"images/interface/silencerAttached.png\\\">\";\r\n\t\toutput = \"<p><img src=\\\"images/interface/silencerAttached.png\\\"> You screw the silencer onto the end of your weapon with no problems. </p>\";\r\n\t break;\r\n\r\n\t case \"Extended Magazine\":\r\n\t this.magModifier = 54;\r\n\t\tthis.magAttached = true;\r\n\t this.magSize = (this.magModifier + this.magSize);\r\n\t\tthis.maxMagSize = (this.magModifier + this.magSize);\r\n\t\tdocument.getElementById(\"magAttachment\").innerHTML = \"<img src=\\\"images/interface/magAttached.png\\\">\";\r\n\t\toutput = \"<p> <img src=\\\"images/interface/magAttached.png\\\"> You slide in a fresh drum magazine for your \" + this.name + \". It pops into place with a satisfying clicking noise. A wicked grin pulls at the corners of your lips and you begin checking your sights. \" + \"Your total magazine capacity for this gun has been upgraded to \" + this.magSize + \" shots of \" + this.ammoType + \". </p>\";\r\n break;\r\n\r\n\t case \"Standard magazine (AK)\":\r\n\t\tthis.magModifier = 0;\r\n\t\tthis.magSize = 15;\r\n\t\tthis.maxMagSize = 15;\r\n\t\tthis.magAttached = false;\r\n\t\tdocument.getElementById(\"magAttachment\").innerHTML = \"<img src=\\\"images/interface/magAttachedno.png\\\">\";\r\n\t\toutput = \"<p> <img src=\\\"images/interface/magAttachedno.png\\\"> You slide in a standard 15 round magazine for your \" + this.type + \". </p>\";\r\n\t break;\r\n\r\n\t\t\r\n\t\tcase \"Standard iron sights\":\r\n\t\tthis.rangeModifier = 0;\r\n\t\tthis.scopeAttached = false;\r\n\t\tdocument.getElementById(\"scopeAttachment\").innerHTML = \"<img src=\\\"images/interface/scopeAttachedno.png\\\">\";\r\n\t\toutput = \"<p> <img src=\\\"images/interface/scopeAttachedno.png\\\"> You remove the scope from your weapon and go back to using your standard iron sights.</p>\";\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase \"no bayonet\":\r\n\t\tthis.meleeValueModifier = 0;\r\n\t\tthis.bayonetAttached = false;\r\n\t\tdocument.getElementById(\"bayonetAttachment\").innerHTML = \"<img src=\\\"images/interface/bayonetAttachedno.png\\\">\";\r\n\t output = \"<p> <img src=\\\"images/interface/bayonetAttachedno.png\\\"> You remove the bayonet from your weapon.</p>\";\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase \"no grenades\":\r\n\t\tthis.secondaryFire = false;\r\n\t\tthis.secondaryFireAmmo = null;\r\n\t\tthis.secondaryFiremaxMag = null;\r\n\t\tthis.secondaryDamage = null;\r\n\t\tthis.ammoSecondaryType = null;\r\n\t\tdocument.getElementById(\"grenadeLauncherAttachment\").innerHTML = \"<img src=\\\"images/interface/grenadeLauncherAttachedno.png\\\">\";\r\n\t\toutput = \"<p> <img src=\\\"images/interface/grenadeLauncherAttachedno.png\\\"> You detach the grenade launcher from your weapon.</p>\";\r\n\t\tbreak;\r\n\t\t\r\n\t\tcase \"no silencer\":\r\n\t\tthis.silencerAttached = false;\r\n\t\tthis.noiseModifier = 0;\r\n\t\tdocument.getElementById(\"silencerAttachment\").innerHTML = \"<img src=\\\"images/interface/silencerAttachedno.png\\\">\";\r\n\t\toutput = \"<p><img src=\\\"images/interface/silencerAttachedno.png\\\"> You unscrew the silencer from the end of your weapon. </p>\";\r\n\t break;\r\n\t\t\r\n\t\tdefault:\r\n\t\toutput = \"<p>This attachment is nowhere to be found in your pack! Most unfortunate. </p>\";\r\n\t break;\r\n\t}\r\n\t\r\n\t\r\n\r\n\tLogInfo(output);\r\n } // addAttachment\r\n\r\n /*\r\n\tBust a cap. Or many of them, as the case may be.\r\n\ttarget - object - the thing that you want to make dead\r\n */\r\n this.sprayAndPray = function(target){\r\n\tvar output = \"\",\r\n\t randomSeed = Math.floor(Math.random() * 10 + 3),\r\n\t newMagSize = 0,\r\n\t damageDealt = 0;\r\n\r\n\tif (!target.dead && target.isAlive) {\r\n\t if (this.isFullAuto) {\r\n\t\t\r\n\t\t// Checks to see if we have enough ammo and fires if we do!\r\n\t\tif (this.magSize >= 3) {\r\n\t\t newMagSize = this.magSize - randomSeed;\r\n\t\t damageDealt = this.bulletDamage * randomSeed;\r\n\t\t output = \"<p><span class =\\\"update\\\">You switch your \" + this.type +\" over to full-auto and throw some hot lead downrange with your \"+ this.name +\"!</span><span class =\\\"alert\\\"> *BRRRRAPP!*</span> You fired \" + randomSeed + \" shots for a combined total damage score of \"+ damageDealt + \" (\"+ this.bulletDamage + \" per round).</p>\";\r\n\t\t} else {\r\n\t\t output = \"<p>Please reload your weapon.</p>\";\r\n\t\t}\r\n\t } else {\r\n\t\toutput = \"<p>You cannot spray and pray with a non-automatic weapon. Try taking an aimed shot instead.</p>\";\r\n\t }\r\n\r\n\t if (damageDealt > target.health && target.isAlive && target.isLiving) {\r\n\t\ttarget.dead = true;\r\n\t\toutput += \"<p><span class =\\\"alert\\\">[CRITICAL HIT]</span> <span class =\\\"update\\\">Your attack installed a new moonroof in the back of \" + target.name + \"'s head courtesy of your \" + this.type +\", Effectively killing the *shit* out of it! </span><span class =\\\"alert\\\">\" + target.deathKnell + \"</span> You have \" + newMagSize + \" rounds of \" + this.ammoType + \" left!</p>\";\r\n\t } else if (damageDealt === target.health && target.isAlive && target.isLiving) {\r\n\t\ttarget.dead = true;\r\n\t\toutput += \"<p><span class =\\\"update\\\">You scored a direct hit on \" + target.name + \"! \" + \" blood spurts from an artery, and they drop to the floor still twitching.</span> <span class =\\\"alert\\\">\" + target.deathKnell + \"</span> You have \" + newMagSize + \" rounds of \" + this.ammoType +\" left!</p>\";\r\n\t } else if (damageDealt >= target.health && target.isAlive && !target.isLiving) {\r\n\t\ttarget.dead = true;\r\n\t\tdocument.getElementById(\"questWindow\").innerHTML = \"<img class=\\\"target\\\" src=\\\"images/targets/\"+ target.deathAnim +\"\\\">\";\r\n\t\toutput += \"<p><span class =\\\"update\\\">You destroyed the \" + target.name + \"! </span><span class =\\\"alert\\\">\" + target.deathKnell + \"</span> You have \" + newMagSize + \" shots of \" + this.ammoType + \" left!</p>\";\r\n\t } else {\r\n\t\ttarget.health = target.health - damageDealt;\r\n\t\tthis.magSize = newMagSize;\r\n\t output += \"<p><span class=\\\"update\\\"> Your volley of shots strikes \"+ target.name + \". They now have \" + target.health + \" health left.\"+ \"</span><span class=\\\"alert\\\"> \" + target.hitSound + \"</span> You now have \" + newMagSize +\" Rounds of \"+ this.ammoType +\" left.</p>\";\r\n\t }\r\n\t} else {\r\n\t output = \"<p><span class =\\\"alert\\\">[ATTACK FAILED - TARGET ALREADY NEUTRALIZED]</span> HE'S DEAD, JIM. LET IT GO!</p>\";\r\n\t}\r\n\r\n\tLogInfo(output);\r\n } // sprayAndPray\r\n\t\r\n\t\r\n\r\n\t// Bust *a* cap. in the singular case this time! Arriba!\r\n\tthis.aimedShot = function(target){\r\n\r\n\tvar output = \"\";\r\n\r\n\t// is it dead?\r\n if (!target.dead) {\t\r\n\t\r\n\t\t newMagSize = 0;\r\n\t damageDealt = 0;\r\n\t\t\r\n\t// do we have enough ammo? if so let's rock!\r\n\tif (this.magSize >= 1) {\t\r\n\t\tnewMagSize = this.magSize - 1;\r\n\t damageDealt = this.bulletDamage;\t\t\r\n\tif (damageDealt > target.health && target.isLiving === true) {\r\n\t target.dead = true;\r\n\t\tthis.magSize = newMagSize;\r\n\t output += \"<p><span class=\\\"alert\\\">[CRITICAL HIT]</span> <span class=\\\"update\\\">Your attack installed a new moonroof in the back of \" + target.name + \"'s head courtesy of your \" + this.type +\", Effectively killing the *shit* out of it! \" + target.deathKnell + \"</span> You now have \" + newMagSize +\" Rounds of \"+ this.ammoType +\" left.</p>\";\r\n\t} else if (damageDealt === target.health && target.isLiving === true) {\r\n\t target.dead = true;\r\n\t\tthis.magSize = newMagSize;\r\n\t\tdocument.getElementById(\"questWindow\").innerHTML = \"<img class=\\\"target\\\" src=\\\"images/targets/\"+ target.deathAnim +\"\\\">\";\r\n\t output += \"<p><span class=\\\"update\\\">You scored a fatal hit on \" + target.name + \"! \" + \" blood spurts from an artery in a glorious crimson fountain in front of them, and they drop to the floor still twitching.</span><span class=\\\"alert\\\"> \" + target.deathKnell + \"</span> You now have \" + newMagSize +\" Rounds of \"+ this.ammoType +\" left.</p>\";\r\n\t} else if (damageDealt >= target.health && !target.isLiving) {\r\n\t target.dead = true;\r\n\t\tthis.magSize = newMagSize;\r\n\t\tdocument.getElementById(\"questWindow\").innerHTML = \"<img class=\\\"target\\\" src=\\\"images/targets/\"+ target.deathAnim +\"\\\">\";\r\n\t output += \"<p><span class=\\\"update\\\">You destroyed the \" + target.name + \"! \" + target.deathKnell + \"</span></p>\";\r\n\t} else {\r\n\t target.health = target.health - damageDealt;\r\n\t\tthis.magSize = newMagSize;\r\n\t output += \"<p><span class=\\\"update\\\"> Steadying your weapon, you level a well-placed shot into \"+ target.name + \" For [\" + this.bulletDamage + \"] points of damage. They now have \" + target.health + \" health left.\"+ \"</span><span class=\\\"alert\\\"> \" + target.hitSound + \"</span> You now have \" + newMagSize +\" Rounds of \"+ this.ammoType +\" left.</p>\";\r\n\t}\t\r\n\t}else{\r\n\toutput += \"<p><span class=\\\"alert\\\">Please reload your weapon</span></p>\";\r\n\t}\t\t\r\n\t}else{\r\n\toutput = \"<p><span class=\\\"alert\\\">[ATTACK FAILED - TARGET ALREADY NEUTRALIZED]</span> HE'S DEAD, JIM. LET IT GO!</p>\";\r\n\t}\r\n\tLogInfo(output);\r\n\t} // Aimed shot\r\n\t\r\n\t\r\n\r\n\t// Gettin' stabby with it (melee)!\r\n\r\n\tthis.attackMelee = function(target){\r\n\r\n\tvar output = \"\";\r\n\r\n\t// is it dead?\r\n if (!target.dead) {\t\r\n\t\r\n\t damageDealt = this.meleeValueModifier + this.meleeValue;\r\n\t\t\t\t\r\n\tif (damageDealt > target.health && target.isLiving === true) {\r\n\t target.dead = true;\r\n\t output += \"<p><span class=\\\"alert\\\">[CRITICAL HIT]</span> <span class=\\\"update\\\">You completely decapitated \" + target.name + \" with your insane melee skills, Effectively killing the *shit* out of it! \" + target.deathKnell + \"</span></p>\";\r\n\t} else if (damageDealt === target.health && target.isLiving === true) {\r\n\t target.dead = true;\r\n\t\tdocument.getElementById(\"questWindow\").innerHTML = \"<img class=\\\"target\\\" src=\\\"images/targets/\"+ target.deathAnim +\"\\\">\";\r\n\t output += \"<p><span class=\\\"update\\\">You land a devastating blow on \" + target.name + \"! \" + \" blood pours from a wound you have left in their throat, and they drop to the floor still twitching.</span><span class=\\\"alert\\\"> \" + target.deathKnell + \"</span></p>\";\r\n\t} else if (damageDealt >= target.health && !target.isLiving) {\r\n\t target.dead = true;\r\n\t\tdocument.getElementById(\"questWindow\").innerHTML = \"<img class=\\\"target\\\" src=\\\"images/targets/\"+ target.deathAnim +\"\\\">\";\r\n\t output += \"<p><span class=\\\"update\\\">You destroyed the \" + target.name + \"! \" + target.deathKnell + \"</span></p>\";\r\n\t} else {\r\n\t target.health = target.health - damageDealt;\r\n\t output += \"<p><span class=\\\"update\\\"> You swing frantically at \"+ target.name + \" For [\" + damageDealt + \"] points of damage. They now have \" + target.health + \" health left.\"+ \"</span><span class=\\\"alert\\\"> \" + target.hitSound + \"</span></p>\";\r\n\t}\t\r\n\t}else{\r\n\toutput = \"<p><span class=\\\"alert\\\">[ATTACK FAILED - TARGET ALREADY NEUTRALIZED]</span> HE'S DEAD, JIM. LET IT GO!</p>\";\r\n\t}\r\n\tLogInfo(output);\r\n\t} // attackMelee\r\n\t\r\n\t\r\n\t// Lob a grenade!\r\n\tthis.grenade = function(target){\r\n\tvar output = \"\";\r\n\r\n\t// is it dead?\r\n if (!target.dead) {\t\r\n\t\r\n\t\t newSecondaryMagSize = 0;\r\n\t damageDealt = 0;\r\n\t\t\r\n\t// do we have enough ammo? if so let's rock!\r\n\tif (this.secondaryFireAmmo >= 1) {\t\r\n\t\tnewSecondaryMagSize = this.secondaryFireAmmo - 1;\r\n\t damageDealt = this.secondaryDamage;\t\t\r\n\tif (damageDealt > target.health && target.isLiving === true) {\r\n\t target.dead = true;\r\n\t\tthis.secondaryFireAmmo = newSecondaryMagSize;\r\n\t\tdocument.getElementById(\"secondaryAmmo\").innerHTML = \"<img class=\\\"secondaryfired\\\" src=\\\"images/interface/SecondaryEmpty.png\\\">\" + \" x \" + newSecondaryMagSize + \"<img class=\\\"secondaryreload\\\" onclick=\\\"onSecReloadClick()\\\" src=\\\"images/interface/reloadSecondary.png\\\">\";\r\n\t\tdocument.getElementById(\"questWindow\").innerHTML = \"<img class=\\\"target\\\" src=\\\"images/targets/\"+ target.deathAnim +\"\\\">\";\r\n\t output += \"<p><span class=\\\"alert\\\">[CRITICAL HIT]</span> <span class=\\\"update\\\">Your attack obliterated \" + target.name + \". \" + target.deathKnell + \"</span> You now have \" + newSecondaryMagSize +\" Rounds of \"+ this.ammoSecondaryType +\" left.<span class=\\\"update\\\"> Please press reload in the secondary fire panel to insert a new grenade and fire another shot.</span></p>\";\r\n\t} else if (damageDealt === target.health && target.isLiving === true) {\r\n\t target.dead = true;\r\n\t\tthis.secondaryFireAmmo = newSecondaryMagSize;\r\n\t\tdocument.getElementById(\"secondaryAmmo\").innerHTML = \"<img class=\\\"secondaryfired\\\" src=\\\"images/interface/SecondaryEmpty.png\\\">\" + \" x \" + newSecondaryMagSize + \"<img class=\\\"secondaryreload\\\" onclick=\\\"onSecReloadClick()\\\" src=\\\"images/interface/reloadSecondary.png\\\">\";\r\n\t\tdocument.getElementById(\"questWindow\").innerHTML = \"<img class=\\\"target\\\" src=\\\"images/targets/\"+ target.deathAnim +\"\\\">\";\r\n\t output += \"<p><span class=\\\"update\\\">The explosion splatters \" + target.name + \" all over the room! </span><span class=\\\"alert\\\"> \" + target.deathKnell + \"</span> You now have \" + newSecondaryMagSize +\" Rounds of \"+ this.ammoSecondaryType +\" left.<span class=\\\"update\\\"> Please press reload in the secondary fire panel to insert a new grenade and fire another shot.</span></p>\";\r\n\t} else if (damageDealt >= target.health && !target.isLiving) {\r\n\t target.dead = true;\r\n\t\tthis.secondaryFireAmmo = newSecondaryMagSize;\r\n\t\tdocument.getElementById(\"secondaryAmmo\").innerHTML = \"<img class=\\\"secondaryfired\\\" src=\\\"images/interface/SecondaryEmpty.png\\\">\" + \" x \" + newSecondaryMagSize + \"<img class=\\\"secondaryreload\\\" onclick=\\\"onSecReloadClick()\\\" src=\\\"images/interface/reloadSecondary.png\\\">\";\r\n\t\tdocument.getElementById(\"questWindow\").innerHTML = \"<img class=\\\"target\\\" src=\\\"images/targets/\"+ target.deathAnim +\"\\\">\";\r\n\t output += \"<p><span class=\\\"update\\\">You exploded the \" + target.name + \"! \" + target.deathKnell + \"</span></p>\";\r\n\t} else {\r\n\t target.health = target.health - damageDealt;\r\n\t\tthis.secondaryFireAmmo = newSecondaryMagSize;\t\r\n\t\tdocument.getElementById(\"secondaryAmmo\").innerHTML = \"<img class=\\\"secondaryfired\\\" src=\\\"images/interface/SecondaryEmpty.png\\\">\" + \" x \" + newSecondaryMagSize + \"<img class=\\\"secondaryreload\\\" onclick=\\\"onSecReloadClick()\\\" src=\\\"images/interface/reloadSecondary.png\\\">\";\r\n\t output += \"<p><span class=\\\"update\\\"> You launch a well-placed shot with one of your \" + this.ammoSecondaryType + \". \"+ target.name + \" was hit For a whopping [\" + this.secondaryDamage + \"] points of damage. They now have \" + target.health + \" health left.\"+ \"</span><span class=\\\"alert\\\"> \" + target.hitSound + \"</span> You now have \" + newSecondaryMagSize +\" Rounds of \"+ this.ammoSecondaryType +\" left in your launcher.<span class=\\\"update\\\"> Please press reload in the secondary fire panel to insert a new grenade and fire another shot.</span></p>\";\r\n\t}\t\r\n\t}else{\r\n\toutput += \"<p><span class=\\\"alert\\\">Please reload your grenade launcher</span></p>\";\r\n\t}\t\t\r\n\t}else{\r\n\toutput = \"<p><span class=\\\"alert\\\">[ATTACK FAILED - TARGET ALREADY NEUTRALIZED]</span> HE'S DEAD, JIM. LET IT GO!</p>\";\r\n\t}\r\n\tLogInfo(output);\r\n\t} // Grenade\r\n\t\r\n\t\r\n\t\r\n\t//reload function\r\n\tthis.reload = function(){\r\n\t\r\n\t\tcurrentRounds = this.magSize + this.magModifier;\r\n\t\r\n\t\tif( currentRounds === this.maxMagSize){\r\n\t\t\r\n\t\toutput = \"You do not need to reload this weapon.\";\r\n\t\t\r\n\t\t}else{\r\n\t\t\r\n\t\tamountToReload = this.maxMagSize - currentRounds;\r\n\t\tthis.magSize = this.magSize + amountToReload;\r\n\t\toutput = \"You reload your weapon. You now have \" + this.magSize + \" rounds of \" + this.ammoType + \".\";\r\n\t\tLogInfo(output);\r\n\t\t\r\n\t\t}\r\n\t}// reload\r\n\t\r\n\t\r\n\t\r\n\t//secondary reload function (used for alt. fire weapons)\r\n\tthis.secondaryReload = function(){\r\n\t\r\n\t\tAKS74u.secondaryFireAmmo = 1;\r\n\t\tdocument.getElementById(\"secondaryAmmo\").innerHTML = \"<img ID=\\\"fireSecondary\\\" onclick=\\\"onClickFireSecondary()\\\" src=\\\"images/interface/Secondary.png\\\">\" + \" x \" + AKS74u.secondaryFireAmmo;\r\n\t\toutput = \"You reload another grenade\";\r\n\t\tLogInfo(output);\r\n\t}// secondary reload\r\n\t\r\n\t\r\n\t}", "function Person(name, stance, perception, taunt){\r\n this.name = name;\r\n this.stance = stance;\r\n this.perception = perception;\r\n this.taunt = taunt;\r\n this.weapon = null;\r\n\t\r\n\t/* \r\n\tcurrent attack mode property for players (starts as single shot)\r\n\t*/\r\n\tthis.currentAttackMode = \"single\";\r\n\r\n /*\r\n\tGo ahead, give them a gun, see if I care.\r\n\tgun - object - the gun to equip them with\r\n */\r\n this.arm = function(gun) {\r\n\tthis.weapon = gun;\r\n }\r\n\r\n /*\r\n\tAttacks with the current weapon\r\n\ttarget - object - the thing you want to attack\r\n */\r\n this.attack = function(target) {\r\n\tthis.weapon.sprayAndPray(target);\r\n }\r\n\t\r\n\t/*\r\n\tAttacks with single shot\r\n\t*/\r\n\tthis.attackSingle = function(target) {\r\n\tthis.weapon.aimedShot(target);\r\n }\r\n\t\r\n\t/*\r\n\tAttacks with melee\r\n\t*/\r\n\tthis.attackMelee = function(target) {\r\n\tthis.weapon.attackMelee(target);\r\n }\r\n\t\r\n\t/*\r\n\tAttacks with grenade\r\n\t*/\r\n\tthis.attackGrenade = function(target) {\r\n\tthis.weapon.grenade(target);\r\n }\r\n\t\r\n}", "function DoggoFighter(name,specialAbility){\n this.name = name;\n this.specialAbility = specialAbility;\n}", "constructor(name, legs, isDanger){\n super(name, legs)//properties inherited from the parent class\n this.isDanger = isDanger\n }", "function Gun( ownerImage, projectileImage, shoot ) {\n this.ownerImage = ownerImage;\n this.image = projectileImage;\n this.shoot = shoot;\n if (this.shoot === undefined) {\n // Do nothing\n this.shoot = function() {\n \n }\n }\n}", "youngGun(args) {\n return this.createGameObject(\"YoungGun\", young_gun_1.YoungGun, args);\n }", "function Dog(hungry) {\n\n this.status = \"normal\";\n this.color = \"black\";\n this.hungry = \"hungry\";\n}", "function Penguin(name){\n this.name = name;\n this.numLegs = 2;\n}", "function Penguin(name){\n this.name = name;\n this.numLegs = 2;\n}", "function Penguin(name){\n this.name = name;\n this.numLegs = 2;\n}", "function Warrior(heroName=\"Cloud\", heroLevel=99, heroWeapon=\"the Brotherhood\") {\n // In order to effectively call 'super' in JS, we use \n Hero.call(this, heroName, heroLevel);\n this.heroWeapon = heroWeapon;\n}", "constructor(name, health, speed, strength, wisdom){\n super(name);\n this.health = 200;\n this.speed = 10;\n this.strength = 10;\n this.wisdom = 10;\n }", "function Fighter(name, health, damagePerAttack) {\n this.name = name\n this.health = health;\n this.damagePerAttack = damagePerAttack;\n this.toString = function() { return this.name; }\n}", "function Penguin(name) {\n this.name = name;\n this.numLegs = 2;\n}", "function Penguin(name) {\n this.name = name;\n this.numLegs = 2;\n}", "constructor(...args) {\n super(...args);\n\n this.addClasses('character');\n this.directionX = 0;\n this.directionY = 0;\n }", "function Ninja(name, health=100) {\n // create a private variable that stores a reference to the new object we create\n var self = this;\n var strength =3;\n var speed =3;\n this.nameT = name;\n this.healthT =health;\n\n this.sayName = function(){\n console.log(`My ninja name is ${this.nameT}`)\n } \n this.showStats = function() {\n console.log(`Name: ${this.nameT} , Health is ${this.healthT} , Speed: ${speed} , Strength${strength}` )\n }\n \n this.drinkSake = function() {\n this.healthT +=10;\n }\n\n\n // this.method = function() {\n // console.log( \"I am a method\");\n\n // var privateMethod = function() {\n // console.log(\"this is a private method for \" + self.name);\n // console.log(self);\n // }\n // this.age = age;\n // this.greet = function() {\n // console.log(\"Hello my name is \" + this.name + \" and I am \" + this.age + \" years old!\");\n // // we can access our attributes within the constructor!\n // console.log(\"Also my privateVariable says: \" + privateVariable)\n // // we can access our methods within the constructor!\n // privateMethod();\n // }\n}", "function Fighter(name, health, damagePerAttack, special, avatar) {\n this.name = name;\n this.health = health;\n this.maxHealth = health;\n this.damagePerAttack = damagePerAttack;\n this.special = special;\n this.avatar = avatar;\n this.toString = function() {\n return this.name;\n };\n}", "function Penguin(name) { // All penguins have 2 legs, so we only need the function parameter name\n this.name = name;\n this.numLegs = 2;\n}", "constructor(...args) {\n super(...args);\n\n\n // The following values should get overridden when delta states are merged, but we set them here as a reference for you to see what variables this class has.\n\n // default values for private member values\n this.corpses = 0;\n this.isCastle = false;\n this.isGoldMine = false;\n this.isGrass = false;\n this.isIslandGoldMine = false;\n this.isPath = false;\n this.isRiver = false;\n this.isTower = false;\n this.isUnitSpawn = false;\n this.isWall = false;\n this.isWorkerSpawn = false;\n this.numGhouls = 0;\n this.numHounds = 0;\n this.numZombies = 0;\n this.owner = null;\n this.tileEast = null;\n this.tileNorth = null;\n this.tileSouth = null;\n this.tileWest = null;\n this.tower = null;\n this.unit = null;\n this.x = 0;\n this.y = 0;\n\n //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.\n // any additional init logic you want can go here\n //<<-- /Creer-Merge: init -->>\n }", "function AllianceFaction(Character, Class, Gender, Profession){\n this.Character = Character;\n this.Class = Class;\n this.Gender = Gender;\n this.Profession = Profession;\n this.profile = function(){\n return `My race is ${this.Character}, I am a ${this.Gender} ${this.Class}, I specialize in ${this.Profession}`;\n // console.log(this);\n }\n}", "function Weapon(name, target) {\n this.name = name;\n this.target = target;\n}", "function Gun(x, y, size)\n{\n\tthis.x = x;\n\tthis.y = y;\n\tthis.size = size;\n}", "constructor()\n\t{\n\t\tthis.HP = 100;\n\t\tthis.dmg = 30;\n\t\tthis.evasion = 15;\n\n\t\t//boolean for special move\n\t\tthis.fly = 0;\n\t\tthis.invi = 0;\n\t\tthis.slammed = 0;\n\n\t\tthis.alive = true;\n\t}", "constructor(...args) {\n super(...args);\n\n\n // The following values should get overridden when delta states are merged, but we set them here as a reference for you to see what variables this class has.\n\n // default values for private member values\n this.canMove = false;\n this.drunkDirection = '';\n this.focus = 0;\n this.health = 0;\n this.isDead = false;\n this.isDrunk = false;\n this.job = '';\n this.owner = null;\n this.tile = null;\n this.tolerance = 0;\n this.turnsBusy = 0;\n\n //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.\n // any additional init logic you want can go here\n //<<-- /Creer-Merge: init -->>\n }", "function Warrior(name, health, anger) {\n Hero.call(this, name, health);\n this.anger = anger;\n}", "function Ninja() {\r\n this.swung = true;\r\n}", "function Penguin(name, numLegs){\n this.name = name;\n this.numLegs = numLegs;\n}", "initialize() {\n // prepare characters for fighting\n this.c1.prepareForFight();\n this.c2.prepareForFight();\n\n // show characters stats\n console.log('Players are ready to fight!');\n this.c1.printStats();\n this.c2.printStats();\n\n // who starts the fight?\n if (\n // character 1 is faster?\n this.c1.speed > this.c2.speed ||\n (\n // same speed...\n this.c1.speed === this.c2.speed &&\n // ...but character 1 is luckier\n this.c1.luck > this.c2.luck\n )\n ) {\n // character 1 starts the fight\n this.attacker = this.c1;\n this.defender = this.c2;\n } else {\n // character 2 starts the fight\n this.attacker = this.c2;\n this.defender = this.c1;\n }\n }", "function Greetr()\r\n{\r\n this.greeting = 'Hola mundo!';\r\n}", "function dragonConstructor(name, age){\n\tthis.species = \"Dragon\";\n\tthis.size = \"Enormous\";\n\tthis.isDead = false;\n\tthis.name = name;\n\tthis.age = age;\n\n\tthis.getDefeated = () => this.isDead = true;\n}", "function Dog() {\nthis.name = \"Rupert\";\nthis.color = \"brown\";\nthis.numLegs = 4;\n}", "function fighterStats(name, hp, atk, def) {\n this.name = name;\n this.hp = hp;\n this.hp2 = hp;\n this.atk = atk;\n this.def = def;\n\n /** Takes damage from an enemy@param{int} damage The damage taken*/\n this.takeDamage = function(damage) {\n var damageTaken = Math.abs(damage - this.def);\n if(damage <= this.def) {\n damageTaken = 1;\n }\n this.hp2 = this.hp2 - damageTaken;\n this.hp2 = this.hp2 < 0 ? 0 : this.hp2;\n console.log(damageTaken);\n // console.log('You have taken ' + damage + 'damage!');\n }\n}", "function Ninja(name, health=100, speed=3, strength=3){\n this.name=name;\n this.health=health;\n this.speed=speed;\n this.strength = strength;\n this.sayName = function(){\n console.log(\"My ninja name is \"+name);\n };\n}", "constructor(...args) {\n super(...args);\n\n\n // The following values should get overridden when delta states are merged, but we set them here as a reference for you to see what variables this class has.\n\n /**\n * The name of the game.\n */\n this.name = 'Chess';\n\n // default values for private member values\n this.currentPlayer = null;\n this.currentTurn = 0;\n this.fen = '';\n this.gameObjects = {};\n this.maxTurns = 0;\n this.moves = [];\n this.pieces = [];\n this.players = [];\n this.session = '';\n this.turnsToDraw = 0;\n }", "constructor(){\n console.log(\"Creating a new alien\")\n this.health = 100;\n this.damage = 50;\n\n }", "function Dog() {\n this.name = \"Rex\";\n this.color = \"Black\";\n this.numLegs = 4;\n}", "function Dog() {\n this.name = \"Rusty\";\n this.color = \"Golden\";\n this.numLegs = 4;\n}", "function turtle(name,color,weapon,favoritePizzaType){\n this.name=name;\n this.color=color;\n this.weapon=weapon;\n this.favoritePizzaType=favoritePizzaType;\n}", "constructor(name, age, breed, color) {\n // Set those equal to the instance\n this.name = name;\n this.age = age;\n this.breed = breed;\n this.color = color;\n this.energyLevel = 0;\n this.barkLevel = 10;\n }", "function Ninja(name) {\n this.name = name;\n this.health = 100;\n const speed = 3;\n const strength = 3;\n \n // Add methods to the Ninja prototype\n // Log the Ninja's name to the console\n Ninja.prototype.sayName = function() {\n console.log(\"My ninja name is \" + this.name + \"!\");\n return this;\n };\n\n // Shows the Ninja's Strength and Speed, and their Health\n Ninja.prototype.showStats = function() {\n console.log(\"Name: \" + this.name + \", \" + \"Health: \" + this.health + \", \" + \"Speed: \" + speed + \", \" + \"Strength: \" + strength);\n return this;\n };\n\n // Adds +10 Health to the Ninja\n Ninja.prototype.drinkSake = function() {\n this.health += 10;\n return this;\n };\n\n // Takes another Ninja instance and subtracts 5 Health from the Ninja passed in\n Ninja.prototype.punch = function(punchReceiver) {\n // Validation to only accept instances of the Ninja class\n if (punchReceiver instanceof Ninja) {\n punchReceiver.health -= 5;\n console.log(punchReceiver.name + \" was punched by \" + this.name + \" and lost 5 Health!\");\n } else {\n console.log(\"Not a Ninja\")\n };\n return this;\n };\n\n // Subtracts 15 Health for each point of Strength the calling Ninja has, and like .punch() will take another Ninja instance\n Ninja.prototype.kick = function(kickReceiver) {\n // Validation to only accept instances of the Ninja class\n if (kickReceiver instanceof Ninja) {\n const kickDamage = 15 * strength;\n kickReceiver.health -= kickDamage;\n console.log(kickReceiver.name + \" was kicked by \" + this.name + \" and lost \" + kickDamage + \" Health!\");\n } else {\n console.log(\"Not a Ninja\")\n };\n return this;\n };\n}", "constructor(name, hull, firePower, accuracy) { // constructors are info about class (this. belongs to constructor)\n this.name = name;\n this.hull = hull;\n this.firePower = firePower;\n this.accuracy = accuracy;\n }", "function Person(name, weapon) {\n this.name = name;\n this.weapon = weapon;\n}", "function Game_Troop() {\n this.initialize.apply(this, arguments);\n}", "constructor(name){\n console.log(\"Creating a new alien\")\n this.health = 100;\n this.damage = 50;\n //assigned to the object being created\n this.name = name; \n\n }", "function Penguin(name, numLegs) {\n this.name = name;\n this.numLegs = numLegs;\n}", "function Game_Unit() {\n this.initialize.apply(this, arguments);\n}", "function Ninja(name){\n\n\tlet speed = 3;\n\tlet strength = 3;\n\tthis.name = name;\n\tthis.health = 100;\n\n\tthis.sayName = function(){\n\t\tconsole.log(this.name);\n\t}\n\n\tthis.showStats = function(){\n\t\tconsole.log(`Name: ${this.name}, Health: ${this.health}, Strength: ${strength}, Speed: ${speed}`);\n\t}\n\n\tthis.drinkSake = function(){\n\t\tthis.health += 10;\n\t\treturn this;\n\t}\n\n\tthis.punch = function(target){\n\t\tif(target instanceof Ninja){\n\t\t\ttarget.health -= 5;\n\t\t\tconsole.log(`${target.name} was punched by ${this.name} and health is down to ${target.health}`);\n\t\t}\n\t\telse{\n\t\t\tconsole.log(`You can't punch a ${target.constructor.name}`);\n\t\t}\n\t}\n\n\tthis.kick = function(target){\n\t\tif(target instanceof Ninja){\n\t\t\ttarget.health -= 15;\n\t\t\tconsole.log(`${target.name} was kicked by ${this.name} and health is down to ${target.health}`);\n\t\t}\n\t\telse{\n\t\t\tconsole.log(`You can't kick a ${target.constructor.name}`);\n\t\t}\n\t}\n\n}", "function Player () {\n\t this.x = 450; \n\t this.y = 850;\n\t this.w = 20;\n\t this.h = 20;\n\t this.deltaX = 0;\n\t this.deltaY = 0;\n\t this.xTarget = 0;\n\t this.yTarget = 0;\n\t this.tired = false;\n\t this.speed = 0;\n\t this.topSpeed = 5;\n\t this.energy = 150;\n\t this.maxEnergy = 150;\n\t this.maxHealth = 150;\n\t this.health = 150;\n\t this.recovery = 0\n\t this.xcenter = 400;\n\t this.ycenter = 300;\n\t this.fill = '#000000';\n\t this.xdirection = 1;\n\t this.ydirection = 0;\n\t this.acceleration = 0.4;\n\t this.radius = 0;\n\t this.angle = 1.7;\n\t this.mot = 0;\n\t this.closestVehicle = 0;\n\t this.distanceFromVehicle = 0;\n\t this.gettingInVehicle = 0;\n\t this.inBuilding = 0;\n\t this.walkTimer = 0;\n\t this.xVector = 0;\n\t this.yVector = 0;\n\t this.standImage = playerStand;\n\t this.walkAnimations = [\"\", playerWalk1, playerWalk2, playerWalk3, playerWalk4];\n\t this.activeWeapon = -1;\n\t this.weaponsPossessed = [\n\t\t{name: \"Pistol\", img: \"\", possess: false, ammo: 0, notHaveColor: '#783a3a', haveColor: 'red'},\n\t\t{name: \"Machine Gun\", img: \"\", possess: false, ammo: 0, notHaveColor: '#595c38', haveColor: '#fffb00'},\n\t\t{name: \"Plasma Gun\", img: \"\", possess: false, ammo: 0, notHaveColor: '#388994', haveColor: '#05e2ff'},\n\t\t{name: \"Rocket Launcher\", img: \"\", possess: false, ammo: 0, notHaveColor: '#661b61', haveColor: '#ff00ee'}\n\t ];\n\t this.weaponCount = 0;\n\t this.nearDoor = false;\n\t this.nearBuilding = false;\n\t this.ammo = [1000, 1500, 2000, 50, 30]\n\t this.kills = 0;\n\t this.points = 100;\n\t this.maxPoints = 10000;\n\t this.onTile = {x: 0, y: 0};\n\t this.inBounds = {\n\n\t }\n\t this.fBuffer = 0\n\t this.onWeaponIcon = -1;\n\t this.onPerkIcon = -1;\n\t this.interactTimer = 0;\n\t this.interactDebounceTime = 50;\n\t this.walkedOn = {\n\t\tsand: false,\n\t\twater: false,\n\t\tgrass: false, \n\t }\n}", "function OogaahBattlefield() {\n\tOogaahPile.apply(this, null); // construct the base class\n}", "function Weapon() {\r\n this.name;\r\n this.type;\r\n}", "function User() {\r\n //\"this\" refers back to the object that calls it and is assigned the users name later on in the code\r\n this.name = \"\";\r\n //this starts each user with 100 health\r\n this.life = 100;\r\n /*this is a function that takes the parameter \"targetPlayer\" (which is the player that would lose health) and\r\n adds 1 to the target players health while at the same time decreasing the user who is giving health by 1\r\n */\r\n this.givelife = function givelife(targetPlayer) {\r\n targetPlayer.life += 1;\r\n this.life -= 1;\r\n console.log(this.name, 'gave one life to', targetPlayer.name)\r\n };\r\n}", "constructor(name, weapon, type){ // Constructor is something only for subclass\n // console.log(this) - js wont allow us to run this in subclass untill we use the super() keyword\n super(name, weapon); // Super calls the super class of elf (Character). It goes up and calls the constructor\n console.log('this from subclass', this)\n this.type = type\n }", "function Dog() {\n this.name = \"Fluffers\";\n this.color = \"yellow\";\n this.numLegs = 4;\n}", "function GObject(h, s, tileimg){\n\tthis.health = 100; \n\tthis.strength = 5;\t//can think of this as resistance for objects\n\tthis.timg = tileimg;\n}", "function Dog() {\n this.name = \"Rupert\";\n this.color = \"brown\";\n this.numLegs = 4;\n}", "function Dog() {\n this.name = \"Rupert\";\n this.color = \"brown\";\n this.numLegs = 4;\n}", "function Dragon(life, name, level, color, spell){\n //Keyword this references the newly created Dragon object\n //So we pass that to our previous constructor as a reference\n Enemy.call(this, life, name, level); //Remeber this is an object itself\n //And set the rest of the properties\n this.color = color;\n this.spell = spell;\n }", "TakeWeapon() {\n this._on_cooldown = true\n this._PaintSpawn()\n this._last_use = Date.now()\n }", "function Greeter(phase) {\n this.phase = phase;\n}", "function Dog(){//Constructors are functions that create new objects.\n this.name = 'Charlie';//They define properties and behaviors that will belong to the new object.\n this.color = 'Red-brown';//'this.attribute' etc.\n this.numLegs = 4;\n}", "constructor(name, legs) {\n this.name = name;\n this.legs = legs;\n }", "function Dog() {\n this.name = \"Rupert\";\n this.color = \"brown\";\n this.numLegs = 4;\n }", "function Dog() {\n this.name = \"Rupert\";\n this.color = \"brown\";\n this.numLegs = 4;\n }", "function WalkingCreature(oxygen, legs) {\n Walker.call(this, legs, oxygen);\n}", "function Penguin(name, numLegs) {\n this.name = name;\n this.numLegs = 2;\n }", "function Penguin(name, numLegs) {\n this.name = name;\n this.numLegs = 2;\n }", "constructor(hull, firepower,accuracy){\n this.hull=hull;\n this.firepower=firepower;\n this.accuracy=accuracy;\n }", "constructor(...args) {\n super(...args);\n\n\n // The following values should get overridden when delta states are merged, but we set them here as a reference for you to see what variables this class has.\n\n // default values for private member values\n this.fireExtinguished = 0;\n\n //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.\n // any additional init logic you want can go here\n //<<-- /Creer-Merge: init -->>\n }", "constructor(name, favoriteFood, hoursOfSleep) {\n // you can set any your custom properties\n this.legs = 2;\n this.hands = 2;\n this.head = 1;\n this.name = name;\n this.favoriteFood = favoriteFood;\n this.hoursOfSleep = hoursOfSleep;\n }", "function Dog(){\n this.name = \"Bob\";\n this.color = \"red\";\n this.numLegs = 4;\n}", "function Character() {\r\n // customization attributes\r\n isMale = false;\r\n\r\n // battle attributes\r\n money = -1;\r\n lifePoints = -1;\r\n weaponUpgrade = -1;\r\n shieldUpgrade = -1;\r\n clockNumber = -1;\r\n brainNumber = -1;\r\n \r\n // customization attributes\r\n this.setGender = function(gender) {\r\n if(gender===\"male\")\r\n isMale = true;\r\n else // is not male -> female\r\n isMale = false;\r\n };// end mutator\r\n this.getGender = function() {\r\n if(isMale)\r\n return \"male\";\r\n else // is not male -> female\r\n return \"female\";\r\n };// end accessor\r\n this.setImage = function() { \r\n if(isMale)\r\n $(\"#girlSprite\").css(\"visibility\", \"hidden\");// hide girl for boy, and vice versa\r\n else// is female\r\n $(\"#boySprite\").css(\"visibility\", \"hidden\");\r\n changeCharacterLives();\r\n };// end setImage \r\n \r\n // battle-related functions\r\n this.setMoney = function(m) {\r\n money = m;\r\n };// end mutator\r\n this.getMoney = function() {\r\n return money;\r\n };// end accessor\r\n this.setLifePoints = function(lp) {\r\n lifePoints = lp;\r\n changeCharacterLives();\r\n };// end mutator\r\n this.getLifePoints = function() {\r\n return lifePoints;\r\n };// end accessor \r\n this.setWeaponUpgrade = function(level) {\r\n weaponUpgrade = level;\r\n };// end mutator\r\n this.getWeaponUpgrade = function() {\r\n return weaponUpgrade;\r\n };// end accessor \r\n this.setShieldUpgrade = function(level) {\r\n shieldUpgrade = level;\r\n };// end mutator\r\n this.getShieldUpgrade = function() {\r\n return shieldUpgrade;\r\n };// end accessor \r\n this.setClockNumber = function(amount) {\r\n clockNumber = amount;\r\n };// end mutator\r\n this.getClockNumber = function() {\r\n return clockNumber;\r\n };// end accessor\r\n this.setBrainNumber = function(amount) {\r\n brainNumber = amount;\r\n };// end mutator\r\n this.getBrainNumber = function() {\r\n return brainNumber;\r\n };// end accessor \r\n \r\n this.loseLife = function() {\r\n lifePoints --;\r\n changeCharacterLives();\r\n };// end loseLife\r\n function changeCharacterLives() {\r\n var canvas = document.getElementById(\"characterLives\");\r\n var context = canvas.getContext('2d');\r\n var imageObj = new Image();\r\n context.clearRect(0,0,canvas.width,canvas.height);\r\n imageObj.src = \"images/heart.png\";\r\n imageObj.onload = function() {\r\n for(var i=0; i<lifePoints; i++)\r\n context.drawImage(imageObj, 20*i, 0);\r\n };\r\n }// end changeCharacterLives\r\n this.clearCharacterLPCanvas = function() {\r\n var canvas = document.getElementById(\"characterLives\");\r\n var context = canvas.getContext('2d');\r\n context.clearRect(0,0,canvas.width,canvas.height); \r\n };// end clearMonsterLPCanvas\r\n \r\n this.death = function() {\r\n // when character is dead\r\n $(\".ASDF\").css(\"visibility\", \"hidden\");\r\n $(\".battle\").css(\"visibility\", \"hidden\");\r\n $(\".gameOver\").css(\"visibility\", \"visible\");\r\n document.getElementById(\"loseSound\").load();\r\n document.getElementById(\"loseSound\").play();\r\n $(\"#loseToMenu\").click(function(){\r\n\t $(\".gameOver\").css(\"visibility\", \"hidden\");\r\n\t $(\".menu\").css(\"visibility\", \"visible\");\r\n\t $(\"#lock2, #lock3, #lock4\").addClass(\"stageSelection\");\r\n\t $(\"#girlSprite\").css(\"left\", 700);\r\n });\r\n character.clearCharacterLPCanvas();\r\n monster.clearMonsterLPCanvas();\r\n };// end death\r\n}// end Constructor", "function Dog() {\n this.name = \"Tarzan\";\n this.color = \"brown\";\n this.numLegs = 4;\n}", "function Dog() {\n this.name = \"Albert\";\n this.color = \"Brown\";\n this.numLegs = 4;\n}", "function Superhero(firstName, lastName, powers) {\n // super call\n\n // Invoke the superclass constructor on the new object then use .call() to invoke the \n // constructor as a method of the object to be initialized.\n Person.call(this, firstName, lastName);\n\n // Finally, store their powers, a new array of traits not found in a normal 'Person'\n this.powers = powers;\n}", "function Unit(game, x = 0, y = 0, unitcode, side) {\n Entity.call(this, game, x, y, side);\n this.data = unitData[unitcode];\n this.width = this.data.groundWidth;\n this.height = this.data.groundHeight;\n\n //var range = this.data.range;\n this.rangeBox = this.data.range; \n this.baseSpeedPercent = 1;\n this.speedPercent = this.baseSpeedPercent;\n this.flying = this.data.flying;\n \n //Stats\n this.health = this.data.health;\n this.movementspeed = this.data.movementspeed;\n this.att = this.data.att;\n this.def = this.data.def;\n this.pushResist = Math.min(this.data.pushResist, 1);\n\n this.actions = {}; //contains all actions this unit can perform (walk, stand, attack)\n this.defaultAction;\n this.collisionReacts = {}; //Not used yet\n this.currentAction;\n this.lockedTarget; //The enemy that the unit targetting.\n this.takingDamage = 0;\n this.healing = 0;\n this.push = 0;\n this.takingEffect = [];\n this.passiveEffectInit();\n this.getHit = function(that, damage) { //default get hit action: lose hp\n that.loseHealth(Math.max(damage - (that.def * damage), 1));\n that.takingEffect.map(function(effect) {\n effect(that);\n });\n // if (this.takingEffect) this.takingEffect(this);\n };\n this.actionHandler = function() {};\n}", "function runGame() {\n var player = new Player(\"Joan\", 500, 30, 70);\n var zombie = new Zombie(40, 50, 20);\n var charger = new FastZombie(175, 25, 60);\n var tank = new StrongZombie(250, 100, 15);\n var spitter = new RangedZombie(150, 20, 20);\n var boomer = new ExplodingZombie(50, 15, 10);\n\n var shovel = new Weapon(\"shovel\", 15);\n var sandwich = new Food(\"sandwich\", 30);\n var chainsaw = new Weapon(\"chainsaw\", 25);\n\n player.takeItem(shovel);\n player.takeItem(sandwich);\n player.takeItem(chainsaw);\n player.discardItem(new Weapon(\"scythe\", 21));\n player.discardItem(shovel);\n player.checkPack();\n player.takeItem(shovel);\n player.checkPack();\n\n player.equippedWith();\n player.useItem(chainsaw);\n player.equippedWith();\n player.checkPack();\n\n player.useItem(shovel);\n player.equippedWith();\n player.checkPack();\n\n player.health = 487;\n console.log(\"Before health: \" + player.health);\n player.useItem(sandwich);\n console.log(\"After health: \" + player.health);\n player.checkPack();\n}", "function Dog() {\n this.name = \"Albert\";\n this.color = \"blue\";\n this.numLegs = 4;\n }", "constructor(name, favoriteFood, hoursOfSleep) {\n this.legs = 2;\n this.hands = 2;\n this.head = 1;\n this.name = name;\n this.favoriteFood = favoriteFood;\n this.hoursOfSleep = hoursOfSleep;\n }", "function Shooter() {}", "constructor(enemy){\n this.height = 10;\n this.width = 10;\n this.dead = false;\n this.x = enemy.x + Math.floor(enemy.width/2) - Math.floor(this.width/2);\n this.y = enemy.y + enemy.abdomen - Math.floor(this.height/2);\n this.dx = Math.floor((bearer.x + Math.floor(bearer.width/2) - (this.x + Math.floor(this.width/2)))/100);\n this.dy = Math.floor((bearer.y + Math.floor(bearer.height/2) - (this.y + Math.floor(this.height/2)))/100);\n this.dmgPlayer = 5;\n }", "constructor(args) {\n super();\n args = args || {}\n this.CONSTRUCTOR_ID = 0xfdb19008;\n this.SUBCLASS_OF_ID = 0x476cbe32;\n\n this.game = args.game;\n }", "constructor(x,y) {\n this.deleteme = false // if true, Unit won't be drawn and may be replaced in A_Unites\n this.x = x;\n this.y = y;\n this.hp = 1;\n this.atk = 1;\n this.spd = 1;\n this.width = 32;\n this.heigth = 32;\n this.texAtlas = unitTexture\n }", "function Dog() {\n this.name = \"Albert\";\n this.color = \"brown\";\n this.numLegs = 4;\n }", "function Dog1(name, color, numLegs) {\n this.name = name;\n this.color = color;\n this.numLegs = 4;\n}", "constructor() {\n this.position_x = 32;\n this.position_y = 410;\n this.speed = 3;\n this.width = 36;\n this.height = 18;\n this.life = 2;\n this.IsPlayerDie = false;\n this.time = 0;\n this.count = 0;\n this.diesound = false;\n }", "function Game_Battler() {\n this.initialize.apply(this, arguments);\n}", "function Monster(rank) {\n this.rank = rank;\n this.health = 100;\n}", "constructor(...args) {\n super(...args);\n\n\n // The following values should get overridden when delta states are merged, but we set them here as a reference for you to see what variables this class has.\n\n // default values for private member values\n this.bombs = [];\n this.dirt = 0;\n this.isBase = false;\n this.isFalling = false;\n this.isHopper = false;\n this.isLadder = false;\n this.isSupport = false;\n this.miners = [];\n this.ore = 0;\n this.owner = null;\n this.shielding = 0;\n this.tileEast = null;\n this.tileNorth = null;\n this.tileSouth = null;\n this.tileWest = null;\n this.x = 0;\n this.y = 0;\n\n //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs.\n // any additional init logic you want can go here\n //<<-- /Creer-Merge: init -->>\n }", "constructor(){\n this.hull=20;\n this.firepower=5;\n this.accuracy=0.7;\n }", "function Character(name, profession, gender, age, strength, hitPoints) {\n this.name = name;\n this.profession = profession;\n this.gender = gender;\n this.age = age;\n this.strength = strength;\n this.hitPoints = hitPoints;\n this.PrintStatus = function() {\n // console.log(this.name, this.profession, this.gender, this.age, this.strength, this.hitPoints);\n console.log(JSON.stringify(this));\n // console.log(this);\n }\n this.IsAlive = function() {\n if (hitPoints > 0) {\n console.log(this.name + ' is alive. For now...')\n } else {\n console.log(this.name + ' is dead. Such a shame. Welp...')\n }\n }\n this.Attack = function(target) {\n target.hitPoints -= this.strength;\n console.log(target.name + ' took some damage! They have ' + target.hitPoints + ' hit points left. In your face ' + target.name + '!')\n }\n this.levelUp = function() {\n this.age += 1;\n this.strength += 5;\n this.hitPoints += 25;\n console.log(`${this.name} leveled up yo! That's kinda rad. They are now ${this.age} years old, have ${this.strength} strength and have ${this.hitPoints} hit points.`)\n }\n}", "function Ninja(name){\n\tthis.name = name;\n\tthis.health = 100;\n\t// speed and strength need to be private\n\tthis.speed = 3;\n\tthis.strength =3;\n}", "function ShadowRunner() {\n Archer.apply(this, arguments);\n this.class = 'ShadowRunner';\n this.health = 21;\n this.armor = 17;\n this.dex = 13;\n this.str = 5;\n }", "constructor() {\n super(\"MainScene\");\n // Monster variables\n this.monsterImage = null;\n this.hp = 5;\n this.hpText = null;\n this.soulsText = null;\n // Levels in upgrades\n this.levels = {\n bolt: 0\n }\n // Status of monster\n this.alive = false;\n }", "function Animal() {\n // arguments\n this.spaces = \"Animal\";\n this.growup = function () {\n console.log(\"Stronger\");\n }\n}", "function SuperHuman(name,age,power){\n this.power = power;\n Human.call(this,name,age);\n}", "function fight() {\n // Update interface with fighters' name and hp's\n refreshDomElement($outputDiv, playersArray[0].name + ' and ' + playersArray[1].name + ' are going to fight !');\n\n // Choose first attacker and add new property on chosen player\n var first = randomIntFromInterval(1, 2);\n player1 = playersArray[0];\n player2 = playersArray[1];\n\n if (first === 1) {\n player1.start = 1;\n } else {\n player2.start = 1;\n }\n\n // Round function\n round();\n}", "function Dog (color, status, hungry) {\n this.color = color\n this.status = status\n this.hungry = false\n this.owner = undefined\n}" ]
[ "0.67743284", "0.6739134", "0.66912013", "0.66515183", "0.6590362", "0.6360284", "0.6355191", "0.6214117", "0.61946684", "0.6174791", "0.6174791", "0.6172805", "0.6158926", "0.6143233", "0.6126082", "0.6047762", "0.6047762", "0.6028191", "0.6028043", "0.6022599", "0.6015924", "0.6014758", "0.6014676", "0.5976162", "0.5973028", "0.59453994", "0.5943851", "0.5929283", "0.5922839", "0.5907319", "0.58972603", "0.5889763", "0.586973", "0.58695763", "0.58653176", "0.58640385", "0.5860563", "0.58498573", "0.5838948", "0.58373356", "0.58350635", "0.5830752", "0.5830646", "0.5822728", "0.58213615", "0.5821193", "0.5819181", "0.5817385", "0.5811216", "0.5810946", "0.58070016", "0.5803088", "0.58004165", "0.57872415", "0.57857674", "0.5781385", "0.5780304", "0.57791364", "0.57791364", "0.5769981", "0.57605475", "0.5760482", "0.57447815", "0.5741004", "0.57384795", "0.57384795", "0.57340246", "0.57323605", "0.57323605", "0.5724932", "0.57210404", "0.571987", "0.57102376", "0.5708682", "0.5706589", "0.5700068", "0.5687746", "0.5680388", "0.5674733", "0.5648329", "0.564763", "0.56468", "0.5629625", "0.5629416", "0.5629279", "0.56286854", "0.5620858", "0.56198674", "0.5612431", "0.56081796", "0.56077737", "0.56049144", "0.5597199", "0.559528", "0.55828327", "0.5576765", "0.5573424", "0.55732703", "0.557199", "0.5567445" ]
0.5953281
25
return the two oldest/oldest ages within the array of ages passed in.
function twoOldestAges(ages){ ages.sort((a,b) => b-a) ages = ages.slice(0,2) ages.sort((a,b) => a-b); return ages; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function twoOldestAges(ages){\n let sorted = ages.sort((a, b) => { return b - a; });\n return [sorted[1], sorted[0]];\n }", "function twoOldestAges(ages){\nlet oldestAges = ages.sort((a, b) => b-a).splice(0,2).reverse();\n return oldestAges;\n}", "function twoOldestAges(ages){\n var sortArr = ages.map(Number).sort(function (a, b) { return a - b; });\n var scoreTab = [sortArr[sortArr.length - 2], sortArr[sortArr.length - 1]];\n return scoreTab;\n}", "function older(array){\n\tvar max = 0;\n\tvar olderst = {};\n\tfor (var i=0; i<array.length; i++){\n\t\tif(array[i][\"age\"] > max){\n\t\t\tmax= array[i][\"age\"];\n\t\t\toldest = array[i];\n\t\t}\n\t}\n\treturn oldest;\t\t\n}", "function byAge(arr){\n const youngToOld = arr.sort((a, b) => {\n return a.age - b.age\n })\n return youngToOld\n}", "function older(a, b) {\n\treturn max(a, b, ageCompare);\n }", "function findOlder(arr)\n{\n\tvar oldest = arr[0].age;\n\tvar oldClassmate = {};\n\n\tfor(var i=1; i<arr.length; i++)\n\t{\n\t\tif(arr[i].age > oldest)\n\t\t{\n\t\t\toldest = arr[i].age;\n\t\t\toldClassmate = arr[i];\n\t\t}\n\t}\n\n\treturn oldClassmate;\n}", "function older(people,age){\n\tnew newArray =[];\n\tfor ( var i =0; i < array.length-1;i++){\n\t\tif(Arr[i].age > age){\n\t\t\tnewArray.push(Arr[i].age);\n\t\t}\t\n\t}\n\treturn newArray;\n}", "function younger(a, b) {\n\treturn min(a, b, ageCompare);\n }", "function checkYoungest(array) {\n var arrIndex = 0;\n var minAge = array[0].age;\n for (var i = 1; i < array.length; i++) {\n if (array[i].age < minAge) {\n minAge = array[i];\n arrIndex = i;\n }\n }\n return array[arrIndex].firstname + ' ' + array[arrIndex].lastname;\n}", "function differenceInAges (ages) {\n\n let max = Math.max(...ages),\n min = Math.min(...ages)\n diff = max - min\n \n return [min, max, diff]\n}", "function older3ars(array){\n\t\tvar older=array[0].age\n\t\tfor (var i = 0; i < array.length; i++) {\n\t\t\tif(array[i].age>older){\n\t\t\t\tolder=array[i].age\n\t\t\t}\n\n\t\t}\n\t\treturn older;\n\t}", "function findOldestPerson(people) {\n var oldest = people[0];\n for (var i = 1; i < people.length; i++) {\n if (people[i].age > oldest.age) {\n oldest = people[i];\n }\n }\n return oldest;\n}", "function getMinAge(data) {\n\tconst ages = data.map(passenger => {\n\t\treturn passenger.fields.age;\n\t}).filter( p => p !== undefined)\n\treturn Math.min(...ages)\n}", "function olderPeople(peopleArr, age) {\n return peopleArr.filter(function (person) {\n return person.age > age;\n });\n}", "function olderPeople(peopleArr, age) {\n // initialize a new empty array\n let newArray = [];\n // loop through each persons\n peopleArr.forEach(element => {\n // check if person is older\n if (element.age > age) {\n // add to array\n newArray.push(element);\n }\n })\n return newArray\n}", "function sortedByAge(arr) {\n return arr.sort((a, b) => (a - b) ? -1 : 1 )\n}", "function above(person, age){\n let aboveAge = [];\n person.forEach(element => {\n if(element.age > age)\n {aboveAge.push(element)}\n });\n return aboveAge;\n }", "function byAge(arr){\n return arr.sort(function(a, b){\n return a.age - b.age;\n });\n}", "static older(person1, person2){\n return (person1.age >= person2.age)?person1:person2;\n }", "function findYoungest(arr) {\n arr.sort(function(a, b) {\n return a.age - b.age;\n });\n\n return arr[0].firstname + ' ' + arr[0].lastname;\n}", "function findOldestMale(people) {\n var oldest = people[0];\n for (var i = 1; i < people.length; i++) {\n if (people[i].gender == \"Male\") {\n if (people[i].age > oldest.age) {\n oldest = people[i];\n }\n }\n }\n return oldest;\n}", "function getMinAge(data) {\n\tconst ages = data.filter(passenger => passenger.fields.age != null).map(passenger => passenger.fields.age)\n\tconst minAge = Math.min(...ages)\n\tconsole.log('MINIMUM AGE:', minAge)\n\treturn minAge\n}", "function sortByAge(arr) {\n return arr.sort((a,b) => a.age - b.age); // increment\n}", "function familyReport(ages) {\n // sort the ages into ascending order\n ages.sort(compareNumeric)\n // get the smallest age (first index)\n const smallest = ages[0];\n // get the largest age (last index)\n const largest = ages[ages.length - 1];\n // difference between largest and smallest age\n const difference = largest - smallest;\n\n return [smallest, largest, difference]\n}", "function SortByNamexOlderThan(age) {\n var pl = [];\n let k = 0;\n for (let i of players) {\n if (i.age >= age) {\n i.awards.name.sort().reverse();\n pl[c++] = i;\n }\n }\n\n return pl.age.sort();\n}", "function findOldestByGender(people, gender) {\n var oldest = people[0];\n for (var i = 1; i < people.length; i++) {\n if (people[i].gender == gender && people[i].age > oldest.age) {\n oldest = people[i];\n }\n }\n return oldest;\n}", "function findOlder() {\n //let arr = [];\n //console.log(val);\n for (i = 0; i < devs.length; i++) {\n //let val = devs[i].age;\n //arr.push(val);\n if (devs[i].age > 24) {\n console.log(devs[i]);\n }\n }\n //console.log(arr);\n }", "function secondOldest() {\n var firstMaxSoFar = ages[0]; \n var secondMax = undefined; \n \n document.getElementById(\"secondoldest\").innerHTML = outPutText; \n}", "function getMinandMaxAge() {\n let ages = [];\n let leagueSelected = $(\"#division\").val();\n\n if (leagueSelected == \"Tee Ball\") {\n ages = [4, 6];\n }\n else if (leagueSelected == \"Minors\") {\n ages = [7, 9];\n }\n else if (leagueSelected == \"Majors\") {\n ages = [10, 12];\n }\n else {\n ages = [12, 14];\n }\n return ages;\n}", "function AgeCroissant(a, b) {\n if (a.age < b.age) return -1;\n if (a.age > b.age) return 1;\n return 0;\n }", "function compareAge(b1,b2){\n return b1<=b2\n }", "function getMaxAge(data) {\n\tconst ages = data.map(passenger => {\n\t\treturn passenger.fields.age;}).filter( p => p !== undefined)\n\t\treturn Math.max(...ages)\n}", "function returnMinors(arr)\r\n {\r\n \tminors=[]\r\n \tfor(var i of arr)\r\n \t{\r\n \t\tif(i['age']>=20)\r\n \t\t{\r\n \t\t\tminors.push(i)\r\n \t\t}\r\n \t}\r\n \treturn minors\r\n }", "function sortAge(data){\n\n \n\n data.sort(function(a,b){\n if(a.dob.age < b.dob.age){\n return -1;\n }else{\n return 1;\n }\n });\n console.log(data)\n return [...data]\n \n }", "function getAverageAge (arr) {\n return arr.reduce((acc, cur) => acc+cur.age, 0);\n}", "function getAge(people) {\n let dayToday = new Date().getDate();\n let monthToday = new Date().getMonth();\n let yearToday = new Date().getFullYear();\n for (let i = 0; i < people.length; i++) {\n let birthDate = people[i].dob;\n let birthDateSplit = people[i].dob.split(\"/\");\n birthDateSplit[0] -= 1;\n let splitDiff = [];\n splitDiff[0] = monthToday - birthDateSplit[0];\n splitDiff[1] = dayToday - birthDateSplit[1];\n splitDiff[2] = yearToday - birthDateSplit[2];\n if (splitDiff[0] < 0 || (splitDiff[0] == 0 && splitDiff[1] < 0)) {\n splitDiff[2]--;\n }\n people[i].age = splitDiff[2];\n }\n}", "function compareByAge(personA, personB) {\n if (personA.age < personB.age) {\n return -1;\n } else if (personA.age > personB.age) {\n return 1;\n } else {\n return 0;\n }\n }", "function addAges(born) {\n //find all the films, this in includes things like producer and writer\n var links = document.evaluate(\n \"//div[contains(@class,'filmo')]/ol/li\",\n document,\n null,\n XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,\n null);\n\n //loop round each film\n for (var i = 0; i < links.snapshotLength; i++) {\n\t\t\tvar link = links.snapshotItem(i);\n\t\t\t//extract the year of the film\n\t\t\tyearindex = link.innerHTML.search(\"\\\\([0-9]{4}\\\\)\")\n\t\t\tif(yearindex>0) {\n\t\t\t\tvar filmborn = link.innerHTML.substring(yearindex + 1,\n\t\t\t\t\tyearindex + 5);\n\t\t\t\t//calculate ages\n\t\t\t\tvar filmage = new Date().getFullYear() - filmborn;\n\t\t\t\tvar age = filmborn - born;\n\t\t\t\tage = new String(age +\n\t\t\t\t\t\" year\" + (age == 1 ? '' : 's') + \" old\");\n\n\t\t\t\t//get them in a nice format\n\t\t\t\tif (filmage < 0) {\n\t\t\t\t\tvar agetxt = new String(\n\t\t\t\t\t\t\"in \" +\n\t\t\t\t\t\tMath.abs(filmage) + \" year\" +\n\t\t\t\t\t\t(Math.abs(filmage) == 1 ? '' : 's') +\n\t\t\t\t\t\t\" will be \" + age);\n\t\t\t\t}\n\t\t\t\tif (filmage == 0) {\n\t\t\t\t\t\tvar agetxt = new String(\n\t\t\t\t\t\t\t\t\"this year while \" + age);\n\t\t\t\t}\n\t\t\t\tif (filmage > 0) {\n\t\t\t\t\tvar agetxt = new String(\n\t\t\t\t\t\tMath.abs(filmage) + \" year\" +\n\t\t\t\t\t\t(Math.abs(filmage) == 1 ? '' : 's') +\n\t\t\t\t\t\t\" ago while \" + age);\n\t\t\t\t}\n\n\t\t\t\tlink.innerHTML =\n\t\t\t\t\tlink.innerHTML.substring(0, yearindex + 5)\n\t\t\t\t\t+ \", \" + agetxt\n\t\t\t\t\t+ link.innerHTML.substring(yearindex + 5);\n\t\t\t}\n }\n}", "function sortedOfAge(arr){\n var over18 = []\n arr.filter((person) => {\n if (person.age > 18){\n over18.push(person)\n }\n })\n var inOrder = over18.sort((a, b) => {\n var nameA = a.lastName\n var nameB = b.lastName\n if (nameA < nameB) {\n return -1;\n }\n if (nameA > nameB) {\n return 1;\n }\n return 0\n })\n var finalArr = []\n inOrder.map((person) => {\n finalArr.push(\"<li>\" + person.firstName + \" \" + person.lastName + \" is \" + person.age + \"</li>\")\n })\n return finalArr\n }", "function SecondGreatLow(arr) { \n\tif (arr.length === 2){\n\t\tif(arr[0] > arr[1]) {\n\t\t\treturn arr[0] + \" \" + arr[1];\n\t\t} else {\n\t\t\treturn arr[1] + \" \" + arr[0];\n\t\t}\n\t} else {\n\t\tvar greatest = Math.max.apply(Math, arr);\n\t\tvar lowest = Math.min.apply(Math, arr);\n\t\tvar newArr = [];\n\t\tfor (var i = 0; i<arr.length; i++) {\n\t\t\tif (arr[i] !== greatest && arr[i] !== lowest){\n\t\t\t\tnewArr.push(arr[i]);\n\t\t\t}\n\t\t}\t\t\n\t\tconsole.log(newArr);\n\t\tif (newArr.length === 1){\n\t\t\treturn newArr + \" \" + newArr;\n\t\t} else {\n\t\t\tvar secondGreatest = Math.max.apply(Math, newArr);\n\t\t\tvar secondLowest = Math.min.apply(Math, newArr);\n\t\t\treturn secondLowest + \" \" + secondGreatest;\n\t\t}\n\t} \n}", "function age(){\n return devs.filter(item => \n item.gender === 'm' || item.gender === 'M')\n .sort((a, b) => a.age - b.age )\n }", "function ageSort(){\n return function(people){\n people.sort(function(a,b){\n return a.age - b.age;\n });\n console.log(people);\n };\n }", "function getAges(array, value) {\n let output = [];\n for (let i = 0; i < array.length; ++i) {\n output.push(array[i][value]);\n }\n return output;\n}", "function SortByAge() {\n var pl = [];\n pl = Object.age(players).sort()\n return pl.reverse();\n}", "static ageCompareHigh(user1, user2) {\n // TODO: check that age exists\n return user2.age - user1.age;\n }", "function AgeSort() {\n employees.sort(function (a, b) {\n return (a.dob.age - b.dob.age)\n })\n visibleEmployees([...employees])\n }", "function SecondGreatLow(arr) {\n //if length is 2 edge case\n if (arr.length === 2){\n sortedArr = arr.sort();\n return sortedArr[1]+\" \"+sortedArr[0];\n }\n\n var min, max, min2, max2;\n sortedArr = arr.sort();\n min = sortedArr[0];\n max = sortedArr[sortedArr.length];\n min2 = max;\n max2 = min;\n for (var i = 0; i < sortedArr.length; i++) {\n //set min2\n if (sortedArr[i] !== min){\n if(sortedArr[i] < min2){\n min2 = sortedArr[i];\n }\n }\n //set max2\n if (sortedArr[i] !== max){\n if(sortedArr[i] > max2){\n max2 = sortedArr[i];\n }\n }\n }//end loop\n return min2+\" \"+max2;\n}//end function", "function getLeaveDatesInAscendinOrder(leaveDatesArray){\t\r\n\t\t var datesArray;\r\n\t\t var sortedArray=[];\r\n\t\t var stringDate;\r\n\t\t datesArray=new Array(leaveDatesArray.length);\r\n\t for(var j=0;j< leaveDatesArray.length;j++){\r\n\t \t //console.log(\"type of leave date : \"+ typeof leaveDatesArray[j].leaveDate)\r\n\t \t datesArray.push(new Date(leaveDatesArray[j].leaveDate));\r\n\t\t }\r\n\t datesArray.sort(function (a,b){ return (a > b) ? 1 : -1;});\r\n\t \r\n\t for(var j=0;j< leaveDatesArray.length;j++){\r\n\t \t stringDate=datesArray[j].getDate()+\"/\"+(datesArray[j].getMonth()+1)+\"/\"+datesArray[j].getFullYear(); new Date().g\r\n\t \t //leaveDetails [i][4][j]=(datesArray[j]+\"\").substring(0,15);\r\n\t \t sortedArray.push(stringDate);\r\n\t }\r\n\t \r\n\t return sortedArray;\r\n\t \r\n\t }", "function findAverage(array) {\n const sumElementsAgesArray = (accumulator, currentValue) => accumulator + currentValue;\n const averageAge = array.reduce(sumElementsAgesArray, 0) / array.length;\n return averageAge;\n}", "function sortByAge(){\n employees.sort(function(a,b){\n return (a.dob.age - b.dob.age)\n })\n setDisplayedEmployees([...employees])\n }", "function lowhigh(arr) {\n max = arr[0];\n min = arr[0];\n for (var i = 0; i < arr.length; i++) {\n if (arr[i] > max) {\n max = arr[i];\n }\n if (arr[i] < min) {\n min = arr[i];\n }\n }\n return min, max;\n}", "function olderThanTwentyFour(arr) {\n return arr.filter(n => n.age >= 24)\n}", "function getAverageAge(arr) {\n return arr.reduce((acc, item) => acc + item.age, 0) / arr.length;\n}", "howOld(birthday){\n \n //calculate the month difference from the current month\n //calculate the day difference from the current date\n //calculate year difference from the current year\n //put calculation in date format\n //calculate the age person\n //return the age of the person\n\n return -1;\n }", "handleAllAges(ages) {\n const allAges = ages.filter( age => { return age.name == 'All Ages' } )\n if ( allAges.length < 1 ) {\n ages.push({\n id: \"58e4b35fdb252928067b4379\",\n name: \"All Ages\",\n displayOrder: 0\n })\n }\n return ages.sort(this.handleDisplayOrder)\n }", "function bornBeforeYear(dataArr, year) {\n const result = [];\n dataArr.forEach(person => {\n const birthYear = new Date(person.birthday).getFullYear();\n (birthYear < year) && result.push(person);\n \n });\n return result; \n}", "function averageAge(arr) {\n\n const currentAge = arr.map(cur => new Date().getFullYear() - cur.buildYear);\n\n function add(a, b) {\n return a + b;\n }\n\n const totalAge = currentAge.reduce(add, 0);\n const average = totalAge / arr.length;\n\n console.log(`Our ${arr.length} parks have an average age of ${average} years.`);\n}", "function getMaxAge(data) {\n\tconst ageList = data.filter(passenger => passenger.fields.age != null).map(passenger => passenger.fields.age)\n\tconst maxAge = Math.max(...ageList)\n\tconsole.log('MAXIMUM AGE:', maxAge)\n\treturn maxAge\n}", "function twoTeams(sailors) {\n const team1 = []; // holds sailors younger than 20 and older than 40\n const team2 = []; // holds sailors between the ages 20 and 40\n const sailorNames = Object.keys(sailors);\n\n sailorNames.forEach(sailor => {\n sailors[sailor] < 20 || sailors[sailor] > 40\n ? team1.push(sailor)\n : team2.push(sailor);\n });\n\n const sorted = [team1.sort(), team2.sort()];\n return sorted;\n}", "function bestYearAvg (array){\n //puedo calcular el avg con el método de arriba, para ello, tengo que conseguir tener un array con todas las \n //peliculas de un año \n var ordenado = array.sort(function(a,b) {\n return a.parseInt(year) - b.parseInt(year);\n } );\n}", "get oldestObject() {\n\t\n\t\tif(this.#_augmentaScene.objectCount == 0) {\n\t\t\tconsole.log('No object in scene')\n\t\t} else {\n\n\t\t\tlet maxAge = -1;\n\t\t\tlet maxId;\n\n\t\t\tfor(var id in this.#_augmentaObjects) {\n\t\t\t\tif(this.#_augmentaObjects[id].age > maxAge) {\n\t\t\t\t\tmaxAge = this.#_augmentaObjects[id].age;\n\t\t\t\t\tmaxId = id;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this.#_augmentaObjects[maxId]\n\t\t}\n\n\t}", "function byAge(person1, person2) {\n var age1 = person1.age;\n var age2 = person2.age;\n return age2 - age1;\n}", "function computeAge(i) \n {\n var todaysDate = new Date();\n var birthD = $(\"#booking_tickets_\"+ i +\"_birthdate_day\").val();\n var birthM = $(\"#booking_tickets_\"+ i +\"_birthdate_month\").val();\n var birthY = $(\"#booking_tickets_\"+ i +\"_birthdate_year\").val();\n\n if((birthM < todaysDate.getMonth()) || ((birthM == todaysDate.getMonth()) && (birthD <= todaysDate.getDate())))\n {\n var age = todaysDate.getFullYear() - birthY;\n }\n else\n {\n var age = todaysDate.getFullYear() - birthY - 1;\n } \n\n return age;\n }", "getYearRange(date) {\n let year = [], first, last;\n date.forEach(e => {\n year.push(parseInt(e))\n })\n first = year[0];\n last = year[year.length-1]\n year.forEach(e => {\n first = e < first ? e : first;\n last = e > last ? e : last;\n })\n return({first,last});\n }", "function CompareBirthdays(a, b)\r\n {\r\n return a[\"nextBirthday\"] - b[\"nextBirthday\"];\r\n }", "function howOld(age, year) {\n const currentDate = new Date();\n const currentYear = currentDate.getFullYear();\n\n if (year > currentYear) {\n var NewAge = year - currentYear + age;\n return `You will be ${NewAge} in the year ${year}`;\n } else if (year < currentYear - age) {\n var diference = currentYear - age - year;\n return `The year ${year} was ${diference} years before you were born`;\n } else if (year < currentYear && year > currentYear - age) {\n var NewAge = age - (currentYear - year);\n return `You were ${NewAge} in the year ${year}`;\n }\n}", "calculateAge() {\n let date_1 = new Date(age);\n let diff = Date.now() - date_1.getTime();\n var age_date = new Date(diff);\n return Math.abs(age_date.getUTCFullYear() - 1970); \n }", "function olderPerson(obj) {\n var ins = obj[0];\n var str = \"\";\n for (let i = 0; i < obj.length; i++) {\n if (obj[i].age > ins.age) {\n ins = obj[i];\n str = ins.name.first + \" \" + ins.name.last;\n }\n }\n return str;\n}", "function retire(year){\n\tconst age=new Date().getFullYear()-year;\n\treturn [age,65-age];\n}", "function getAge() {\n year = born.slice(0, born.indexOf(\"-\"));\n month = born.slice(5, 7);\n day = born.slice(8);\n var today = new Date();\n var age = today.getFullYear() - year;\n var m = today.getMonth() - month;\n if (m < 0 || (m === 0 && today.getDate() < day)) {\n age--;\n }\n return age;\n }", "function findOldestIndex(history){\n var index = null;// index of oldest element\n var sAge = null; // smallest age\n\n // Abort if there is no elements in history\n if(history.length<1){\n return -1;\n }\n\n index = 0;\n sAge = history[0].age;\n for (var i = 1; i < history.length; i++){\n if(history[i].age<sAge){\n sAge = history[i].age;\n index = i;\n }\n }\n return index;\n}", "function calcRetirement(year) {\n const age = new Date().getFullYear() - year;\n return [age, year];\n}", "function min () {\n\t var args = [].slice.call(arguments, 0);\n\t\n\t return pickBy('isBefore', args);\n\t}", "function min () {\n\t var args = [].slice.call(arguments, 0);\n\t\n\t return pickBy('isBefore', args);\n\t}", "function min () {\n\t var args = [].slice.call(arguments, 0);\n\t\n\t return pickBy('isBefore', args);\n\t}", "function min () {\n\t var args = [].slice.call(arguments, 0);\n\t\n\t return pickBy('isBefore', args);\n\t}", "function min () {\n\t var args = [].slice.call(arguments, 0);\n\t\n\t return pickBy('isBefore', args);\n\t}", "function filterByAge(minAge, nameA, ageA, nameB, ageB) {\n let personA = {name: nameA, age: ageA};\n let personB = {name: nameB, age: ageB};\n if (personA.age >= minAge) console.log(personA);\n if (personB.age >= minAge) console.log(personB);\n}", "howOld(birthday){\n \n // convert birthday into a numeric value\n\n // convert current date into a numeric value\n\n // subtract birthday numeric value from current date value to get the numeric value of time elapsed\n\n // convert the time elapsed value into years\n\n // round down the converted years value\n\n // return the rounded years value\n\n let date = new Date().getFullYear();\n let age = date-birthyear\n \n return age;\n return -1;\n }", "function maleAge(){\n for (i=0; i<devs.length; i++){\n if (devs[i].gender == 'm'){\n devs.sort((a, b) => a.age - b.age);\n }\n }\n console.log(devs);\n }", "function calculateAge(birthyear, currentyear) {\n\tvar lowage = currentyear - birthyear - 1;\n\tvar highage = currentyear - birthyear;\n\talert(\"You are either \" + lowage + \" or \" + highage)\n}", "function cmp(a, b) {\n let yearA = a[0].years[0]\n let yearB = b[0].years[0]\n return (yearB > yearA) ? 1 : ((yearB < yearA) ? -1 : 0)\n }", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}", "function min () {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n}" ]
[ "0.78486305", "0.7427882", "0.7326222", "0.7013265", "0.6738038", "0.6712644", "0.6627846", "0.65975624", "0.6574193", "0.65132743", "0.64635026", "0.6458466", "0.6167384", "0.61547387", "0.61451113", "0.6124622", "0.61235875", "0.6054878", "0.60398024", "0.5996854", "0.59744465", "0.5914014", "0.5867591", "0.5856671", "0.58202606", "0.57858205", "0.57242167", "0.568981", "0.56497484", "0.5565444", "0.55318314", "0.54632664", "0.5447516", "0.54131216", "0.5400243", "0.5387784", "0.5377324", "0.534785", "0.53326815", "0.5315936", "0.5313117", "0.53014606", "0.529978", "0.52995855", "0.52674514", "0.52511173", "0.5245469", "0.5165579", "0.51598126", "0.51314634", "0.5115528", "0.5113536", "0.5098518", "0.5091819", "0.5087076", "0.50869864", "0.5064244", "0.5062651", "0.5047704", "0.50385827", "0.503432", "0.5019996", "0.5009346", "0.49864846", "0.49831757", "0.49817878", "0.49811423", "0.4966967", "0.49572924", "0.49408603", "0.4938074", "0.49268717", "0.49176195", "0.49129707", "0.49129707", "0.49129707", "0.49129707", "0.49129707", "0.4912695", "0.49116746", "0.49035922", "0.4887394", "0.48794785", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706", "0.48705706" ]
0.74437
1
Simple route middleware to ensure user is authenticated.
function ensureAuthenticated(req, res, next) { if (req.isAuthenticated()) { return next(); } req.session.error = 'Please sign in!'; res.redirect('/signin'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ensureAuthenticated(req, res, next){\n if (req.isAuthenticated()){\n return next();\n }\n else {\n res.redirect('/');\n }\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/');\n}", "function ensureAuthenticated(req, res, next){\n if(req.isAuthenticated()) return next();\n res.redirect(\"/login\");\n}", "function isAuthenticated(){\n return function(req, res, next){\n if (req.isAuthenticated()){\n return next();\n }\n res.redirect('/signin');\n }\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { console.log(\"IS AUTH : \" + req); return next(); }\n res.redirect('/')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/');\n }", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n }\n res.redirect('/');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n }\n res.redirect('/');\n}", "function ensureAuthenticated(req, res, next) {\r\n if (req.isAuthenticated()) {\r\n return next();\r\n }\r\n res.redirect('/login');\r\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/')\n }", "function ensureAuthenticated (req, res, next) {\n if (req.isAuthenticated()) {\n return next()\n } else {\n res.redirect('/login')\n }\n}", "function ensureAuthenticated(req, res, next) {\r\n if (req.isAuthenticated()) { return next(); }\r\n res.redirect('/login')\r\n}", "function ensureAuthenticated(req, res, next) {\r\n if (req.isAuthenticated()) { return next(); }\r\n res.redirect('/login')\r\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n // check authentication\n if (req.isAuthenticated()) {\n // req.user is available for use here\n return next();\n }\n // denied. redirect to login\n res.redirect(\"/\");\n}", "function ensureAuthenticated(req, res, next) {\n \tif (req.isAuthenticated()) { return next(); }\n \tres.redirect('/login');\n }", "function isAuthenticated(req, res, next){\n \n // allow all /GET requests\n if(req.method == 'GET'){\n return next();\n } \n\n // allow any request where the user is authenticated\n if(req.isAuthenticated()){\n return next();\n } \n\n //for anything else, redirect to login page\n return res.redirect('/#login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { \n return next(); \n }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { \n return next(); \n }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n\tif (req.isAuthenticated()) { return next(); }\n\tres.redirect('/');\n}", "function ensureAuthenticated(req, res, next) {\n\tif (req.isAuthenticated()) { return next(); }\n\tres.redirect('/');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n } else {\n res.redirect('/users/login');\n }\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n } else {\n res.redirect('/login')\n }\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/')\n}", "function ensureAuthenticated(req, res, next) {\n\tif(req.isAuthenticated()) {\n\t\treturn next();\n\t} else {\n\t\tres.redirect('/user/login');\n\t}\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n }\n res.redirect(\"/login\");\n}", "function ensureAuthenticated (req, res, next) {\n if (req.isAuthenticated()) {\n return next()\n }\n res.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n if(req.isAuthenticated()) {\n return next();\n } else {\n res.redirect('/users/login');\n }\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n\tif (req.isAuthenticated()) { return next(); }\n\tres.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n\tif (req.isAuthenticated()) { return next(); }\n\tres.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n\tif (req.isAuthenticated()) { return next(); }\n\tres.redirect('/login')\n}", "function ensureAuthenticated(req, res, next) {\n\tif (req.isAuthenticated()) { return next(); }\n\tres.redirect('/')\n}", "function isAuthenticated(req, res, next)\n {\n if (req.user) return next();\n res.redirect('/');\n }", "function ensureAuthenticated(req, res, next) {\n // if user is authenticated in the session, carry on \n if (req.isAuthenticated())\n return next();\n\n // if they aren't redirect them to the home page\n res.redirect('/');\n}", "function ensureAuthenticated(req, res, next) {\n // if user is authenticated in the session, carry on \n if (req.isAuthenticated())\n return next();\n\n // if they aren't redirect them to the home page\n res.redirect('/');\n}", "function ensureAuthenticated (req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n };\n res.redirect('/login'); // <-- Attention: we don't have this page in the example.\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/login');\n return null;\n}", "function ensureAuthenticated(request, response, next) {\r\n \"use strict\";\r\n if (request.isAuthenticated()) { return next(); }\r\n response.redirect('/login');\r\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated())\n\t return next();\n res.redirect('/login');\n}", "function isAuthenticated() {\n return compose()\n .use(function(req, res, next) { // used to validate jwt of user session\n if(req.query && req.query.hasOwnProperty('access_token')) { // allows 'access_token' to be passed through 'req.query' if necessary\n req.headers.authorization = 'Bearer ' + req.query.access_token;\n }\n validateJwt(req, res, next);\n })\n .use(function(req, res, next) { //used to attach 'user' to 'req'\n User.findById(req.user._id, function (err, user) {\n if (err) return next(err);\n if (!user) return res.status(401).send('Unauthorized');\n\n req.user = user;\n console.log('user auth success');\n next();\n });\n });\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated() && validate_user(req.user)) {\n return next();\n }\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n // req.user is available for use here\n return next(); }\n\n // denied. redirect to login\n res.redirect('/')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n // req.user is available for use here\n return next(); }\n\n // denied. redirect to login\n res.redirect('/')\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/auth/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n }\n\n res.redirect('/login');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) next();\n else res.send(401);\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n next();\n } else {\n res.sendStatus(401);\n }\n}", "function ensureAuthenticated(req, res, next) {\n\t\tif (req.isAuthenticated()) { return next(); }\n\t\tres.redirect('/login');\n\t}", "function authenticate(req, res, next) {\n \n if (req.isAuthenticated()) {\n return next();\n } \n \n res.redirect('/');\n}", "function checkAuthenticated(req, res, next) {\r\n \r\n if (req.isAuthenticated()) {\r\n return next()\r\n }\r\n res.redirect(\"/\");\r\n \r\n}", "function ensureAuthenticated(req, res, next){\n req.user=req.user||(typeof req.body.user=='string'?JSON.parse(req.body.user):req.body.user);\nif(req.isAuthenticated()){\n return next();\n\t} else {\n\t\tres.json({status:\"no user\"});\n\t}\n\n}", "function ensureAuthenticated (request, response, next) {\n console.log('inside ensure Authenticated');\n if (request.isAuthenticated()) {\n return next();\n }\n response.redirect('/login');\n}", "function isAuthenticated() {\n return compose()\n // Validate jwt\n .use(function(req, res, next) {\n req.headers.authorization = req.get(\"authorization\");\n validateJwt(req, res, next);\n })\n // Attach user to request\n .use(function(req, res, next) {\n User.findByIdAsync(req.user._id)\n .then(function(user) {\n if (!user) {\n return res.status(401).end();\n } return req.user = user; })\n .catch(function(err) {\n return next(err);\n });\n next()\n });\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n }\n res.redirect('/log');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { \n next();\n } else {\n req.flash(\"info\", \"Hey, you've got to be logged in to do that!\");\n res.redirect(\"/login\");\n }\n}", "function ensureAuthenticated(req, res, next) {\n console.log('\\n\\nensureAuthenticated\\n\\n');\n // console.log(req);\n if (req.isAuthenticated()) {\n console.log('\\n\\nisAuthenticated');\n return next();\n }\n console.log('\\n\\nnot isAuthenticated');\n res.redirect('/login');\n}", "function isUserAuthenticated(req, res, next) {\n if (req.user) next();\n else res.send(\"No autenticado\");\n}", "function hasAccess(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n } \n else\n {\n return res.redirect('/'); \n }\n}", "function ensureAuthenticated(req, res, next) {\n if (!req.isAuthenticated()) {\n res.json({\n message: 'Authentication check failed.',\n });\n }\n\n return next();\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/admin');\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) { return next(); }\n res.redirect('/') // changed from '/login' to '/index'\n}", "function isAuthenticated(req, res, next) {\n if (req.user) return next(); //there is an authenticated user\n res.redirect('/users/signin'); //send them to the login page\n}", "function ensureAuthenticated(req, res, next) {\n req.session.redirect_url = req.route.path;\n if (req.isAuthenticated()) {\n console.log(\"authorized\");\n next();\n }\n else {\n console.log(\"not authorized\");\n res.redirect('/login');\n }\n}", "function ensureAuthenticated(req, res, next) {\n\tif(req.isAuthenticated()){\n\t\treturn next();\n\t}\n\tconsole.log(\"redirected\");\n\tres.redirect('/');\n}", "function authenticatedUser(req, res, next){\n if(req.isAuthenticated()){\n return next();\n }\n res.redirect('/');\n}", "function isAuthenticated(req, res, next) {\n if(req.user) return next();\n return res.status(401).json({ msg: 'Not Authorized'})\n}", "function checkAuthenticated(req, res, next) {\n // Check if the User is authenticated\n if (req.isAuthenticated()) {\n return next();\n }\n\n // If return false\n res.redirect(\"/\");\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n } else {\n req.flash('error_msg', 'Du er ikke logget ind');\n res.redirect('/login');\n }\n}", "function ensureAuthenticate(req, res, next) {\n\tif (req.isAuthenticated()) { return next();}\n\tres.redirect('/login')\n}", "function verifyAuthentication(){\n return (req, res, next) => {\n if (req.isAuthenticated()){\n return next();\n }else{\n res.redirect('/login');\n }\n }\n}", "function ensureAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next();\n } else {\n req.flash('error', '');\n req.flash('error', 'You don\\'t have permission to access this page!');\n res.redirect('/login')\n }\n}", "function isAuthenticated() {\n return compose()\n // Validate jwt\n .use(function(req, res, next) {\n // allow jwt to be placed on query string too\n if (req.query && req.query.hasOwnProperty('access_token')) {\n req.headers.authorization = 'Bearer ' + req.query.access_token;\n }\n validateJwt(req, res, next);\n })\n // attach user to the request\n .use(function(req, res, next) {\n User.findById(req.user._id, function(err, user) {\n if (err) {\n return next(err);\n }\n\n if (!user || _.isEmpty(user)) {\n return res.send(401);\n }\n\n req.user = user;\n next();\n });\n });\n}", "function checkAuthenticated(req, res, next) {\n if (req.isAuthenticated()) {\n return next()\n }\n\n res.redirect('/login')\n}", "function secureRoute(req, res, next) {\n if(!req.headers.authorization) return res.status(401).json({ message: \"You are not allowed in because you're not cool enough.\"});\n\n var token = req.headers.authorization.replace(\"Bearer \", \"\")\n\n jwt.verify(token, secret, function(err, payload){\n if(err || !payload) return res.status(401).json({ message: \"You are not allowed in because you're not cool enough.\"});\n\n req.user = payload;\n next();\n });\n}" ]
[ "0.77062464", "0.76014584", "0.7570125", "0.7560704", "0.7558127", "0.7558127", "0.7558127", "0.7551246", "0.7539155", "0.75295085", "0.75295085", "0.7519517", "0.75158256", "0.75106835", "0.7509376", "0.7509376", "0.7509193", "0.7509193", "0.7509193", "0.75080097", "0.75054514", "0.75034195", "0.749991", "0.749991", "0.7496916", "0.7496916", "0.7495844", "0.749249", "0.7486191", "0.7486191", "0.74855965", "0.7469043", "0.7468823", "0.7464914", "0.7464914", "0.7464914", "0.7464914", "0.7464914", "0.7458528", "0.7451176", "0.7451176", "0.7451176", "0.7451176", "0.74407077", "0.74407077", "0.74407077", "0.74407077", "0.74407077", "0.74407077", "0.74407077", "0.74407077", "0.74407077", "0.74407077", "0.74407077", "0.74407077", "0.7432074", "0.7432074", "0.7432074", "0.7430772", "0.7430497", "0.74252594", "0.74252594", "0.74242", "0.7406079", "0.74012804", "0.73913044", "0.73905575", "0.73861957", "0.7382927", "0.7382927", "0.73820174", "0.7381697", "0.73723996", "0.73561263", "0.7351603", "0.73496175", "0.7335079", "0.73260283", "0.732043", "0.72997856", "0.72989535", "0.7296191", "0.7287464", "0.72852117", "0.728441", "0.7284316", "0.7282366", "0.7274232", "0.72711754", "0.72704893", "0.7269503", "0.7265945", "0.72615933", "0.72517943", "0.7250392", "0.7250325", "0.7244367", "0.7242365", "0.7239723", "0.7234922", "0.7228577" ]
0.0
-1
append the created div to the divmodal
componentDidMount() { modalRoot.appendChild(this.element); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addModal() {\n let div = $('<div/>');\n\tdiv.attr({\n\t\tid: 'modal-point',\n\t\tclass: 'modal fade'\n\t});\n div.attr(\"data-backdrop\", \"static\").attr(\"data-keyboard\", \"false\").attr(\"tabindex\", \"-1\").attr(\"role\", \"dialog\").attr(\"aria-hidden\", \"true\");\n $('body').append(div);\n\t$('#modal-point').on('hidden.bs.modal');\n}", "function createModalDivHtml(options) {\n //If an element already exists with that ID, then dont recreate it.\n if ($(\"#\" + options.modalContainerId).length) {\n return;\n }\n\n var html = '';\n //Warning, do not put tabindex=\"-1\" in the element below. Doing so breaks search functionality in a select 2 drop down\n html += '<div id=\"' + options.modalContainerId + '\" class=\"modal\" data-keyboard=\"true\" role=\"dialog\" data-callback=\"' + options.callback + '\">';\n html += ' <div class=\"modal-content\"></div>';\n html += '</div>';\n $('body').prepend(html);\n }", "function genModCon() {\n const genModalDiv = `<div class=modal-container></div>`;\n gallery.insertAdjacentHTML(\"afterEnd\", genModalDiv);\n const modalDiv = document.querySelector(\".modal-container\");\n modalDiv.style.display = \"none\";\n}", "function modalWindow() {\r\n $('#gallery').append(\r\n `<div class=\"modal-container\">\r\n <div class=\"modal\">\r\n <button type=\"button\" id=\"modal-close-btn\" class=\"modal-close-btn\"><strong>X</strong></button>\r\n <div class=\"modal-info-container\">\r\n </div>\r\n </div>\r\n </div>`);\r\n $('.modal-container').hide();\r\n }", "function modalInject(){\n\t\t//inject modal holder into page\n\t\tif (!document.getElementById(\"g_block_modals\")) {\n\t\t\t$(\"body\").append(tdc.Grd.Templates.getByID('modalInject'));\n\t\t}\n\t}", "function addModalToDom() {\n // create an instance of the overlay\n var $overlay = $('<div class=\"modal-overlay\"></div>');\n $('body').prepend($overlay);\n $overlay.addClass('-active');\n $('body').css('overflow','hidden');\n // load the modal content\n $.get('business/includes/request-demo.html?cache=bust', function(data) {\n $overlay.html(data);\n doFormStuff($overlay);\n });\n }", "function addModalToDom() {\n // create an instance of the overlay\n var $overlay = $('<div class=\"modal-overlay\"></div>');\n $('body').prepend($overlay);\n $overlay.addClass('-active');\n $('body').css('overflow','hidden');\n // load the modal content\n $.get('includes/request-demo.html?cache=bust1', function(data) {\n $overlay.html(data);\n setTimeout(function() {\n $('.modal-contents', $overlay).addClass('-active');\n },50)\n doFormStuff($overlay);\n });\n }", "function modal(){\n\t\t//creating necessary elements to structure modal\n\t\tvar iDiv = document.createElement('div');\n\t\tvar i2Div = document.createElement('div');\n\t\tvar h4 = document.createElement('h4');\n\t\tvar p = document.createElement('p');\n\t\tvar a = document.createElement('a');\n\n\t\t//modalItems array's element are being added to specific tags \n\t\th4.innerHTML = modalItems[1];\n\t\tp.innerHTML = modalItems[2];\n\t\ta.innerHTML = modalItems[0];\n\n\t\t//adding link and classes(materialize) to tags\n\t\tiDiv.setAttribute(\"class\", \"modal-content\");\n\t\ti2Div.setAttribute(\"class\", \"modal-footer\");\n\t\ta.setAttribute(\"class\", \"modal-action modal-close waves-effect waves-green btn-flat\");\n\t\ta.setAttribute(\"href\", \"sign_in.html\");\n\n\t\t//adding elements to tags as a child element\n\t\tiDiv.appendChild(h4);\n\t\tiDiv.appendChild(p);\n\n\t\ti2Div.appendChild(a);\n\n\t\tmodal1.appendChild(iDiv);\n\t\tmodal1.appendChild(i2Div);\n\t}", "function appendModal(){\n\t\tvar panelSeklly = '<div class=\"modal fade\">\\n' + \n '\t<div class=\"modal-dialog\">\\n' + \n '\t\t<div class=\"modal-content\">\\n' +\n '\t\t\t<div class=\"modal-header\">\\n' + \n '\t\t\t\t<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>\\n' + \n '\t\t\t\t<h4 class=\"modal-title\">Modal title</h4>\\n' + \n '\t\t\t</div>\\n' + \n '\t\t\t<div class=\"modal-body\">\\n' + \n '\t\t\t\t<p>One fine body&hellip;</p>\\n' + \n '\t\t\t</div>\\n' + \n '\t\t\t<div class=\"modal-footer\">\\n' + \n '\t\t\t\t<button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>\\n' + \n '\t\t\t\t<button type=\"button\" class=\"btn btn-primary\">Save changes</button>\\n' + \n '\t\t\t</div>\\n' + \n '\t\t</div>\\n' + \n '\t</div>\\n' + \n'</div>';\n\t\t//\t\t\twindow.alert(\"Hello\");\n\t\tvar editor = edManager.getCurrentFullEditor();\n\t\tif(editor){\n\t\t\tvar insertionPos = editor.getCursorPos();\n\t\t\teditor.document.replaceRange(panelSeklly, insertionPos);\n\t\t}\t\n\t}", "function addModal() {\n modal = document.createElement( 'div' );\n modalClose = document.createElement( 'span' );\n modalImg = document.createElement( 'img' );\n modalAlt = document.createElement( 'div' );\n modal.id = 'modal';\n modalClose.id = 'close';\n modalClose.onclick = function() {\n modal.style.display = 'none';\n };\n modalClose.innerHTML = '&times;';\n modalImg.id = 'modalImg';\n modalAlt.id = 'alt';\n modal.appendChild( modalClose );\n modal.appendChild( modalImg );\n modal.appendChild( modalAlt );\n document.body.appendChild( modal );\n}", "function addModalWindow(){\n gallery.insertAdjacentHTML('afterend', `\n <div class=\"modal-container\">\n <div class=\"modal\">\n <button type=\"button\" id=\"modal-close-btn\" class=\"modal-close-btn\"><strong>X</strong></button>\n <div class=\"modal-info-container\">\n </div>\n </div>\n </div>`);\n let modalWindow = document.querySelector('.modal-container');\n modalWindow.style.display = 'none';\n}", "function showModal () {\n $modal = $('<div class=\"modal-test\"><h1>Your result:</h1></div>');\n $overlay = $('<div class=\"modal-overlay\" title=\"Close results!\"></div>');\n $body.append($overlay);\n $body.append($modal);\n $modal.animate({ top: \"50%\" }, 800);\n }", "function appendWindow(header, body, action, targetDiv, mainButtonClass, mainButtonIconStyle, mainButtonText, closeButtonText) {\n var window = getHtmlWindow(header, body, mainButtonClass, mainButtonIconStyle, mainButtonText, closeButtonText);\n window.css({\n \"display\": \"block\",\n });\n\n $(targetDiv).html(window);\n \n $(\"#deleteModalButton\").click(action);\n\n toggleWindow();\n \n }", "function addModal(){\n body.insertAdjacentHTML('beforeend', `\n <div class=\"modal-container\">\n <div class=\"modal\">\n <button type=\"button\" id=\"modal-close-btn\" class=\"modal-close-btn\"><strong>X</strong></button>\n <div class=\"modal-info-container\">\n </div>\n </div>\n </div>\n `)\n const modal = document.querySelector('.modal-container').style.display = 'none';\n const close = document.getElementById('modal-close-btn');\n close.addEventListener('click', (e) => {\n const modal = document.querySelector('.modal-container');\n modal.style.display = 'none';\n })\n}", "onAdd() {\n this.createPopupHtml();\n this.getPanes().floatPane.appendChild(this.containerDiv);\n }", "function addBaseModal() {\n\tvar modal = $(\"#vulcano-modal\");\n\n\tif (!modal.exists()) {\n\t\tvar htmlModal = getModalHtml();\n\t\t$(\"body\").append(htmlModal);\n\t}\n}", "function showInformationModal(message) {\n $('.container').append('<div class=\"modal-overlay confirm-modal\" style=\"z-index: 2000\"><div class=\"modal-dialog\"><div class=\"content\">' + message + '</div><div class=\"actions\"><button class=\"btn btn-secondary close\">Sulje</button></div></div></div></div>');\n $('.confirm-modal .close').on('click', function() {\n $('.confirm-modal').remove();\n });\n }", "function addModal(containerID,modalID,bodyOnly){\n\tif(bodyOnly === null || bodyOnly === undefined){bodyOnly = false};\n\tif(containerID === null || containerID === undefined){containerID = 'main-container'};\n\tif(modalID === null || modalID === undefined){modalID = 'modal-id'};\n\t$('#'+modalID).remove();\n\tif(bodyOnly){\n\t$('#'+ containerID).append(`<div id = \"${modalID}\" class=\"modal fade \" role=\"dialog\">\n \t<div class=\"modal-dialog modal-md \">\n \t\t<div class=\"modal-content bg-white\">\n \t\t\t\n\t \t\t<div style = ' border-bottom: 0 none;'class=\"modal-header pb-0\" id =\"${modalID}-header\">\n\t \t\t\t<button style = 'float:right;' id = 'close-modal-button' type=\"button\" class=\"close text-dark\" data-dismiss=\"modal\">&times;</button>\n\t \t\t</div>\n\t \t\t\t\t<div id =\"${modalID}-body\" class=\"modal-body bg-white \" ></div>\n\t\t\t \t\n \t\t\t</div>\n \t\t</div> \n \t</div>`\n \t)\n\t}else{\n\t$('#'+ containerID).append(`\n <div id = \"${modalID}\" class=\"modal fade \" role=\"dialog\">\n \t<div class=\"modal-dialog modal-lg \">\n \t\t<div class=\"modal-content bg-black\">\n \t\t<button type=\"button\" class=\"close p-2 ml-auto\" data-dismiss=\"modal\">&times;</button>\n\t \t\t<div class=\"modal-header py-0\" id =\"${modalID}-header\"></div>\n\t \t\t\t\t<div id =\"${modalID}-body\" class=\"modal-body \" style = 'background:#DDD;' ></div>\n\t\t\t \t<div class=\"modal-footer\" id =\"${modalID}-footer\"></div>\n \t\t\t</div>\n \t\t</div> \n \t</div>`\n \t)\n\t}\n}", "function create_modal_fac_staff(elem,json_data) {\n\n var put_in = $('#modal_div');\n\n $div_people_modal = $(\"<div class='div_people_modal_div'></div>\");\n\n $div_people_modal.append(\"<h1 class = 'div_people_modal_name'>\"+json_data.name+ \"<h3\" +\n \" class='div_people_modal_title'></h3>\"+json_data.title+\"</h1><hr class='div_people_modal_hr'>\");\n\n $div_people_modal_im = $(\"<div class='div_people_modal_image'></div>\");\n $('<img src=\"'+ json_data.imagePath +'\">').load(function() {\n $(this).width(130).height(150).appendTo($div_people_modal_im);\n });\n\n $div_people_modal.append($div_people_modal_im);\n\n $div_people_modal_cont = $(\"<div class='div_people_modal_contact'></div>\");\n\n // adding contact info\n if(json_data.office != \"\" && json_data.office != null){\n $div_people_modal_cont.append(\"<p><i class='fas fa-map-marker fa-1x'></i><h3\" +\n \" class='div_people_modal_contact_details'>\"+json_data.office+\"</h3></p>\");\n }\n if(json_data.phone != \"\" && json_data.phone != null){\n $div_people_modal_cont.append(\"<p><i class='fas fa-phone fa-1x'></i><h3\" +\n \" class='div_people_modal_contact_details'>\"+json_data.phone+\"</h3></p>\");\n }\n if(json_data.email != \"\" && json_data.email != null){\n $div_people_modal_cont.append(\"<p><i class='fas fa-envelope fa-1x'></i><h3\" +\n \" class='div_people_modal_contact_details'>\"+json_data.email+\"</h3></p>\");\n }\n if(json_data.website != \"\" && json_data.website != null){\n $div_people_modal_cont.append(\"<p><i class='fas fa-globe fa-1x'></i><h3\" +\n \" class='div_people_modal_contact_details'><a href =\"+json_data.website+\" target = _blank>\"+json_data.website+\"</a></h3></p>\");\n }\n if(json_data.twitter != \"\" && json_data.twitter != null){\n $div_people_modal_cont.append(\"<p><i class='fab fa-twitter fa-1x'></i><h3\" +\n \" class='div_people_modal_contact_details'>\"+json_data.twitter+\"</h3></p>\");\n }\n if(json_data.facebook != \"\" && json_data.facebook != null){\n $div_people_modal_cont.append(\"<p><i class='fab fa-facebook-square fa-1x'></i><h3\" +\n \" class='div_people_modal_contact_details'>\"+json_data.facebook+\"</h3></p>\");\n }\n\n $div_people_modal.append($div_people_modal_cont);\n\n\n put_in.append($div_people_modal);\n\n\n put_in.dialog({\n modal: true,\n beforeClose: function () {put_in.empty();},\n minHeight:300,\n minWidth:500,\n closeOnEscape: true\n });\n}", "function wgm_show() {\n\t$('body').append(modal_html);\n\tdiv = '.wg_modal';\n\t$(div).modal('show');\n\t$(div).on('hidden', function () {\n\t\t$(div).remove();\n });\n\treturn $(div);\n}", "function getModal(modalid) {\n return '<div id=\"' + modalid + '\" class=\"modal large hide fade new-experiment\" tabindex=\"-1\" role=\"dialog\">' +\n '<div class=\"modal-header\">' +\n '<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>' +\n '<h3 id=\"myModalLabel\">Select Environmental Data for This Subset</h3>' +\n '</div>' +\n '<div id=\"modal-body\" class=\"modal-body\"></div>' +\n '<div class=\"modal-footer\">' +\n '<button class=\"btn btn-primary\">Select Layers</button>' +\n '</div>' +\n '</div>'\n }", "function insertProfiles(results) { //passes results and appends them to the page\r\n $.each(results, function(index, user) {\r\n $('#gallery').append(\r\n `<div class=\"card\" id=${index}>\r\n <div class=\"card-img-container\">\r\n <img class=\"card-img\" src=\"${user.picture.large}\" alt=\"profile picture\">\r\n </div>\r\n <div class=\"card-info-container\">\r\n <h2 id=${index} class=\"card-name cap\">${user.name.first} ${user.name.last}</h2>\r\n <p class=\"card-text\">${user.email}</p>\r\n <p class=\"card-text cap\">${user.location.city}, ${user.location.state}</p>\r\n </div>\r\n </div>`);\r\n });\r\n\r\n//The modal div is being appended to the html\r\n function modalWindow() {\r\n $('#gallery').append(\r\n `<div class=\"modal-container\">\r\n <div class=\"modal\">\r\n <button type=\"button\" id=\"modal-close-btn\" class=\"modal-close-btn\"><strong>X</strong></button>\r\n <div class=\"modal-info-container\">\r\n </div>\r\n </div>\r\n </div>`);\r\n $('.modal-container').hide();\r\n }\r\n// I am formating the information I want the modal window to portray\r\n function modalAddon(user) {\r\n\r\n $(\".modal-info-container\").html( `\r\n <img class=\"modal-img\" src=\"${user.picture.large}\" alt=\"profile picture\">\r\n <h2 id=\"name\" class=\"modal-name cap\">${user.name.first} ${user.name.last}</h2>\r\n <p class=\"modal-text\">${user.email}</p>\r\n <p class=\"modal-text cap\">${user.location.city}</p>\r\n <br>_________________________________</br>\r\n <p class=\"modal-text\">${user.cell}</p>\r\n <p class=\"modal-text\">Postcode: ${user.location.postcode}</p>\r\n <p class=\"modal-text\">Birthday: ${user.dob.date}</p>\r\n </div>\r\n`);\r\n$(\".modal-container\").show();\r\n\r\n //This hide's the modal window when the \"X\" button is clicked\r\n $('#modal-close-btn').on(\"click\", function() {\r\n $(\".modal-container\").hide();\r\n });\r\n}\r\n\r\n\r\nmodalWindow(); //This opens the modal window when the card is clicked\r\n $('.card').on(\"click\", function() {\r\n let user = $('.card').index(this);\r\n modalAddon(results[user]);\r\n\r\n });\r\n\r\n}", "function kmModalWindow($message){\n jQuery('<div/>', {\"class\": \"g-dialog-container d-block justify-content-center align-items-center visible\"})\n .append(jQuery('<div/>', {\"class\": \"g-dialog p-0\"})\n .append(jQuery('<div/>', {\"class\": \"g-dialog-header p-27\"}))\n .append(jQuery('<div/>', {\"class\": \"g-dialog-content gray-border-top-bottom\"})\n .append(jQuery('<div/>', {\"class\": \"d-grid\"})\n .append(jQuery('<span/>', {\"class\": \"d-block p-15\", \"html\": $message}))\n )\n )\n .append(jQuery('<div/>', {\"class\": \"g-dialog-footer text-right p-2\"})\n .append(jQuery('<a/>', {'class': 'close-modal btn btn-cancel mr-2', 'href': 'javascript:void(0);', text: 'Cancel'}))\n .append(jQuery('<a/>', {'class': 'close-modal btn btn-primary font-fjalla', 'href': 'javascript:void(0);', text: 'Ok'}))\n )\n ).appendTo('#page');\n}", "function create_modal_research(elem,json_data,interest_or_fac) {\n\n var put_in = $('#modal_div');\n\n $div_research_modal = $(\"<div class='div_research_modal_div'></div>\");\n\n if(interest_or_fac == 0){\n $div_research_modal.append(\"<h1 class = 'div_research_modal_name'>\"+json_data.areaName+\"</h1><hr\" +\n \" class='div_research_modal_hr'>\");\n\n\n }\n else{\n $div_research_modal.append(\"<h1 class = 'div_research_modal_name'>\"+json_data.facultyName+\"</h1><hr\" +\n \" class='div_research_modal_hr'>\");\n }\n\n $div_research_modal.append(\"<ul>\");\n for(var i = 0; i < json_data.citations.length;i++){\n $div_research_modal.append(\"<li class='div_research_modal_li'>\"+json_data.citations[i]+\"</li>\");\n }\n $div_research_modal.append(\"</ul>\");\n\n put_in.append($div_research_modal);\n\n\n put_in.dialog({\n modal: true,\n beforeClose: function () {put_in.empty();},\n maxHeight:500,\n minWidth:700,\n closeOnEscape: true\n });\n}", "modal() {\n const modal = new Modal({\n style: this.options.style,\n title: 'Test',\n });\n this.container = modal.body;\n document.body.appendChild(modal.modal);\n this.insertForm();\n modal.onHide(this.builder.clearForm.bind(this.builder));\n return modal;\n }", "function appendFeedbackModal(activity) {\n $('.' + feedbackAreaDiv).append('<div class=\"modal fade\" id=\"' + feedbackModalDiv + '\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"feedbackLabel\">' +\n '<div class=\"modal-dialog\" role=\"document\">' +\n '<div class=\"modal-content\">' +\n '<div class=\"modal-header sr-only\">' + //modal title only visible to screenreaders for accessibility\n '<h2 class=\"modal-title\" id=\"feedbackLabel\">Feedback</h2>' +\n '</div>' +\n '<div class=\"modal-body\">' +\n '<h2 class=\"' + feedbackTextDiv + ' clearfix\"></h2>' +\n '<br> <br>' +\n '<button type=\"button\" class=\"btn ' + nextDiv + '\">Click to continue</button>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '</div>');\n //because the combined static image and text answers takes up lots more space in these activities, drop the feedback modals lower\n if (activity.questionType === \"c2\" || activity.questionType === \"c4\") {\n //this has to be appended to the head of the document as a rule\n //instead of using the .css() function, because the classes are dynamic\n $(\"<style type='text/css'> .modal.in .modal-dialog{ transform: translate(0px, 500px); } </style>\").appendTo(\"head\");\n }\n}", "function myPopupFunction(data,idtodelete) {\n // var popupid=\"myPopup\"+idtodelete;\n // var popup = document.getElementById(popupid);\n //popup.innerHTML = data;\n // $(document.getElementById(\"myModal2text\")).= \"fAILURE sORRY\";\n\n // $(\"myModal2text\").append$(\"Very Bad\");\n\n //$(document.getElementById(\"myModal2\")).click(function () { });\n //$(document.getElementById(\"myModal2text\")).html=\n var x = document.getElementById(\"myModal2text\");\n var displaytext = data.Status + \"!<br>\" + data.ExceptionDetails+\"\";\n x.innerHTML =displaytext;\n $('#myModal2').modal();\n}", "function modal_display(data) {\n console.log(data);\n var apDiv = document.getElementById('apartmentModalBody');\n apDiv.innerHTML=\"\";\n apDiv.classList.add('mx-0');\n if(data != \"\")\n apDiv.appendChild(createModal(data));\n var modalDiv = document.getElementById('apartmentDetailsModal');\n modalDiv.style.display = 'block';\n modalDiv.style.overflowY =\"scroll\";\n modalDiv.style.maxHeight = '90%';\n var body = document.getElementById('mainBody');\n body.style.overflow = \"hidden\";\n}", "function abrirModal(html, obj) {\n $(\"#newOrderModal\").modal();\n console.log(html);\n console.log(obj);\n //carga los datos \n $(\"#div_producto\").html(html);\n Item = obj;\n $('#btn_modal_prod').html(\n '<button onclick=\"agregar_acarrito()\" type=\"button\" data-dismiss=\"modal\" class=\"btn btn-danger\">Agregar a Carrito</button>' +\n '<button type=\"button\" onclick=\"clearItem()\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>');\n\n\n }", "function fnMostrarRequisicionModal(){\n //console.log(\"fnAgregarCatalogoModal\");\n\n var titulo = '<h3><span class=\"glyphicon glyphicon-info-sign\"></span> Anéxo Técnico</h3>';\n $('#ModalCR_Titulo').empty();\n $('#ModalCR_Titulo').append(titulo);\n $('#ModalCR').modal('show');\n}", "function createModal() {\n RequestNewCardModal().then((json) => {\n const modal = document.querySelector('body').prepend(getChild(json));\n document.querySelector('.modal-container #close').addEventListener('click', closeModal);\n document.querySelector('.modal-container').addEventListener('click', closeModal);\n document.querySelector('.modal-container .button').addEventListener('click', requestNewCard);\n });\n}", "_addModalHTML() {\n let modalEl = document.createElement(\"div\");\n modalEl.setAttribute(\"id\", \"enlightenModal\");\n modalEl.setAttribute(\"class\", \"modal\");\n modalEl.innerHTML = `\n <div class=\"modal-content\">\n <span class=\"close\">&times;</span>\n <h3>Title</h3>\n <p>Content</p>\n </div>f`;\n\n let bodyEl = document.getElementsByTagName('body')[0];\n bodyEl.appendChild(modalEl);\n let span = document.getElementsByClassName(\"close\")[0];\n\n // When the user clicks on <span> (x), close the modal\n span.onclick = function () {\n modalEl.style.display = \"none\";\n };\n\n // When the user clicks anywhere outside of the modal, close it\n window.onclick = function (event) {\n if (event.target.id === \"enlightenModal\") {\n modalEl.style.display = \"none\";\n }\n };\n return modalEl;\n }", "function buildModalSimple() {\n let id = makeid();\n let html = `<div id='${id}' class='modal' tabindex='-1' role='dialog' data-bs-backdrop=\"static\" data-bs-keyboard=\"false\"> \n <div class='modal-dialog modal-dialog-centered' role='document'> \n <div class='modal-content'> \n <div class='modal-header'> \n <div id=\"${id}Header\"></div>\n \n <button type='button' class='close modal-close btn-close' aria-label='Cancel'><!--<span aria-hidden='true'>&times;</span>--></button>\n </div>\n <div id=\"form_alert\"></div>\n <div class='modal-body' id=\"${id}Body\">\n </div>\n </div>\n </div>\t\n </div>`;\n $('body').append(html);\n //let modal = $(`#${id}`);\n /*modal.modal({\n backdrop: 'static',\n keyboard: false,\n //show: true\n });*/\n\n //NEW MODAL FORMAT\n let modal = new bootstrap.Modal(document.getElementById(id), {\n keyboard: false,\n backdrop: 'static'\n });\n\n modal.show();\n\n $(document).on('click', `#${id} .modal-close`, function() {\n forceCloseModal(id);\n });\n\n return id;\n}", "function AddElectionPOP(result){\n // ELEMENTS TO POPULATE THE MODAL\n let h3 = document.createElement('h3');\n let p = document.createElement('p');\n let a = document.createElement('a');\n\n if(result['status'] === '1'){\n h3.innerHTML = result['message'];\n p.innerHTML = 'Your Election Has Been Added Successfully';\n a.innerHTML = 'Continue';\n a.setAttribute('id', 'continue');\n a.setAttribute('href', '');\n inner.appendChild(h3);\n inner.appendChild(p);\n inner.appendChild(a);\n a.addEventListener('click', () => {\n removeModal();\n });\n }else{\n h3.innerHTML = result['message'];\n p.innerHTML = 'Something went wrong';\n a.innerHTML = 'Retry';\n a.setAttribute('id', 'retry');\n a.setAttribute('href', '');\n inner.appendChild(h3);\n inner.appendChild(p);\n inner.appendChild(a);\n a.addEventListener('click', () => {\n removeModal();\n });\n }\n\n}", "function creaSubDialogos() {\n content = '<div id=\"ModalSeleccionaProducto\" class=\"displaynone content-prods\" >' + //seleccion de productos\n '<div class=\"panel panel-default\">' +\n ' <div class=\"panel-content\">' +\n '<div class=\"panel-header div-title\">' +\n '<h3 class=\"tituloSeleccionaProducto txt-primary\" ></h3>' +\n '</div>' +\n ' <div class=\"panel-body\">' +\n ' <div class=\"row\">' +\n ' <div class=\"col-md-12 contenidoSeleccionaProducto\">' +\n ' </div>' +\n '</div>' +\n '</div>' +\n '<div class=\"panel-footer label-primary\">' +\n '<button type=\"button\" class=\"btn btn-default pull-right closeSeleccionProducto\"><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i> Cerrar</button>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '<div id=\"ModalPreferencias\" class=\"displaynone content-prods\" >' + //preferencias\n '<div class=\"panel panel-default\">' +\n '<!-- Modal content-->' +\n '<div class=\"panel-content\">' +\n '<div class=\"div-title\">' +\n '<h3 class=\" tituloModalPreferencias txt-primary\" ></h3>' +\n '</div>' +\n '<div class=\"panel-body contentModalPreferencias\">' +\n '</div>' +\n '<div class=\"panel-footer label-primary\" style=\"text-align: right;\">' +\n '<button type=\"button\" class=\"btn btn-default closePreferencias\" data-dismiss=\"modal\"><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i> Cerrar</button>' +\n '<button type=\"button\" class=\"btn btn-primary btnguardapropiedades\" style=\"border: 1px solid;\"><i class=\"fa fa-plus-circle\" aria-hidden=\"true\"></i> Añadir al pedido</button>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '<div id=\"ModalConfirmacion\" class=\"displaynone content-prods\" >' + //confirmaciones\n '<div class=\"panel panel-default\">' +\n '<div class=\"panel-content\">' +\n '<div class=\"panel-body contenidoModalConfirmacion\">' +\n '</div>' +\n '<div class=\"panel-footer label-primary\">' +\n '<button type=\"button\" class=\"btn btn-default closeConfirmacion\" data-dismiss=\"modal\">Cerrar</button>' +\n '<button type=\"button\" class=\"btn btn-primary btnEnviaPedido\" style=\"border: 1px solid;display: none;\"><i class=\"fas fa-utensils\" aria-hidden=\"true\"></i> Enviar pedido a cocina</button>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '<div id=\"ModalSeleccionPizza\" class=\"displaynone content-prods\">' + // seleccion de pizzas\n '<div class=\"panel panel-default\">' +\n '<div class=\"panel-content\">' +\n '<div class=\"panel-header div-title\">' +\n '<h3 class=\"tituloSeleccionPizza txt-primary\" ></h3>' +\n '</div>' +\n '<div class=\"panel-body contenidoSeleccionPizza\">' +\n '</div>' +\n '<div class=\"panel-body contentIngredientes displaynone\" >' +\n '</div>' +\n '<div class=\"panel-footer label-primary\">' +\n '<input id=\"pizza_value\" type=\"hidden\" value=\"1\" />' +\n '<button type=\"button\" class=\"btn btn-primary pull-right btnEnviaSeleccion\" style=\"border: 1px solid;\"><i class=\"fa fa-plus-circle\" aria-hidden=\"true\"></i> Añadir al pedido</button>' +\n '<button type=\"button\" class=\"btn btn-default pull-right closepizzas\"><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i> Cerrar</button>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '<div id=\"ModalSeleccionaIngredientes\" class=\"displaynone content-prods\" >' + //seleccion de ingredientes\n ' <div class=\"panel panel-default\">' +\n '<div class=\"panel-content\">' +\n '<div class=\"panel-header div-title\">' +\n '<h3 class=\"tituloSeleccionaIngredientes txt-primary\" ></h3>' +\n '</div>' +\n '<div class=\"panel-body\">' +\n '<div class=\"row\">' +\n '<div class=\"col-md-12 contenidoSeleccionaIngredientes\">' +\n ' </div>' +\n '</div>' +\n '</div>' +\n '<div class=\"panel-footer\">' +\n '<button type=\"button\" class=\"btn btn-primary btnEnviaProducto pull-right\" style=\"border: 1px solid;\"><i class=\"fa fa-plus-circle\" aria-hidden=\"true\"></i> Añadir al pedido</button>' +\n '<button type=\"button\" class=\"btn btn-default pull-right closeingredientes\" ><i class=\"fa fa-times-circle\" aria-hidden=\"true\"></i> Cerrar</button>' +\n '</div>' +\n '</div>' +\n '</div>' +\n '</div>';\n $('#menucontent').append(content);\n}", "function showNewInfo(data) {\n modalBody.html('')\n modalBody.append(`\n <form class=\" bg-mute\"> \n <div class=\"mb-2\">\n <label for=\"name\" class=\"form-label\">name : </label>\n <input type=\"text\" class=\"form-control \" name=\"name\" required>\n </div>\n <div class=\"mb-2\">\n <label for=\"cin\" class=\"form-label text-uppercase\">cin: </label>\n <input type=\"text\" class=\"form-control\" name=\"cin\" required>\n </div>\n <div class=\"mb-2\">\n <label for=\"city\" class=\"form-label\">city: </label>\n <input type=\"text\" class=\"form-control\" name=\"city\" required>\n </div>\n <div class=\"mb-2\">\n <label for=\"province\" class=\"form-label\">province: </label>\n <input type=\"text\" class=\"form-control\" name=\"province\" required>\n </div>\n <div class=\"mb-2\">\n <label for=\"register-date\" class=\"form-label\">register date: </label>\n <input type=\"date\" class=\"form-control\" name=\"register-date\" required>\n </div>\n <div class=\"\">\n <label for=\"telephone\" class=\"form-label\">telephone: </label>\n <input type=\"text\" class=\"form-control\" name=\"telephone\" required>\n </div>\n </form>\n `)\n\n modalFooter.html(`\n <button id=\"create-button\" class=\"text-white btn btn-outline-success offset-left\"> Create </button>\n `)\n}", "function add_extra_option_modal() {\n\tvar data = '<div class=\"row mb-2\">';\n\tdata += '<div class=\"col-lg-5\">';\n\tdata += '<input id=\"model_extra_option\" type=\"text\" placeholder=\"Ex: 1 Egg\" name=\"modal_extra_option[]\" value=\"\" class=\"form-control h-100\">';\n\tdata += '</div>';\n\tdata += '<div class=\"col-lg-5\">';\n\tdata += '<input id=\"extra_price\" type=\"number\" placeholder=\"Ex: $5\" name=\"modal_extra_price[]\" value=\"\" class=\"form-control h-100\">';\n\tdata += '</div>';\n\tdata += '<div class=\"col-lg-2\">';\n\tdata += '<span class=\"btn btn-lg btn-danger\" onclick=\"del_extra_option_modal(this)\"><i class=\"fa fa-trash mr-0\"></i></span>';\n\tdata += '</div>';\n\tdata += '</div>';\n\t$('.js-extra-add-options_modal').append(data);\n}", "appendDivToOverlay() {\n const panes = this.getPanes();\n panes.overlayLayer.appendChild(this.div);\n panes.overlayMouseTarget.appendChild(this.div);\n }", "createModal() {\n this.overlayRef = this.overlay.create();\n this.modalRef = this.overlayRef.attach(new ComponentPortal(McModalComponent));\n }", "function modals(titulo,mensaje){\n\n\tvar modal='<!-- Modal -->';\n\t\t\tmodal+='<div id=\"myModal2\" class=\"modal hide fade\" style=\"margin-top: 10%; background-color: rgb(41, 76, 139); color: #fff; z-index: 900000; behavior: url(../../css/PIE.htc);width: 30%; left:55%;\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\" data-backdrop=\"true\">';\n\t\t\tmodal+='<div class=\"modal-header\" style=\"border-bottom: 0px !important;\">';\n\t\t\tmodal+='<button type=\"button\" class=\"close\" style=\"color:#fff !important;\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>';\n\t\t\tmodal+='<h4 id=\"myModalLabel\">'+titulo+'</h4>';\n\t\t\tmodal+='</div>';\n\t\t\tmodal+='<div class=\"modal-body\" style=\"max-width: 88% !important; background-color:#fff; margin: 0 auto; margin-bottom: 1%; border-radius: 8px; behavior: url(../../css/PIE.htc);\">';\n\t\t\tmodal+='<p>'+mensaje+'</p>';\n\t\t\tmodal+='</div>';\n\t\t\tmodal+='</div>';\n\t\t\t\n\t$(\"#main\").append(modal);\n\t\n\t$('#myModal2').modal({\n\t\tkeyboard: false,\n\t\tbackdrop: \"static\" \n\t});\n\t\n\t$('#myModal2').on('hidden', function () {\n\t\t$(this).remove();\n\t});\n\t\n}", "function newPopup(options) {\n var html = [];\n html.push('<div class=\"modal hide fade\" tabindex=\"-1\"');\n html.push('role=\"dialog\" aria-hidden=\"true\">');\n html.push('<div class=\"modal-header\">');\n html.push('<button type=\"button\" class=\"close\" ');\n html.push('data-dismiss=\"modal\" aria-hidden=\"true\">×</button>');\n html.push('<h3 class=\"title\">Modal header</h3>');\n html.push('</div>');\n html.push('<div class=\"modal-body\">');\n html.push('<p>One fine body…</p>');\n html.push('</div>');\n html.push('</div>');\n var popup = $(html.join(\"\"));\n var title = options.title;\n var content = options.content;\n if (!title || \"\" == title) {\n title = $(content).find(\"h1\").remove();\n }\n if (options.noFade) {\n popup.removeClass(\"fade\");\n }\n popup.find(\".modal-body\").html(\"\").append(content);\n popup.find(\".title\").html(\"\").append(title);\n return popup.modal(options)\n }", "function openNewModal(items){\n var count = 0;\n for(var obj of items){\n var tag = obj.type || \"div\";\n var classes = \"\";for(var c of obj.classes){classes+=c+\" \"};\n var inner = obj.content || \"\";\n var html = \"<\"+tag+\" class='\"+classes+\"'\";\n if(tag == 'textarea')\n html+=\"placeholder='\"+inner+\"'></\"+tag+\">\";\n else if(tag != \"input\")\n html+=\">\"+inner+\"</\"+tag+\">\";\n else\n html+=\"placeholder='\"+inner+\"'>\";\n $(\"#mmc-wrapper\").append(html);\n count++;\n }\n if(count > 4){\n $('#main-modal-content').css({'margin': '2% auto'});\n }\n else\n $('#main-modal-content').css({'margin': '15% auto'});\n $('#main-modal').fadeIn(500);\n}", "generateOverlay() {\n for (let i = 0; i < this.results.length; i++) {\n let modalContainer = `<div class=\"modal-container\" hidden>\n <div class=\"modal\">\n <button type=\"button\" id=\"modal-close-btn\" class=\"modal-close-btn\"><strong>X</strong></button>\n <div class=\"modal-info-container\">\n <img class=\"modal-img\" src=\"${\n this.pictures[i]\n }\" alt=\"profile picture\">\n <h3 id=\"name\" class=\"modal-name cap\">${\n this.names[i]\n }</h3>\n <p class=\"modal-text\">${this.emails[i]}</p>\n <p class=\"modal-text cap\">${\n this.city[i]\n }</p>\n <hr>\n <p class=\"modal-text\">${this.numbers[i]}</p>\n <p class=\"modal-text\">${\n this.addresses[i]\n }</p>\n <p class=\"modal-text\">Birthday: ${\n this.birthdays[i]\n }</p>\n </div>\n </div>`;\n\n this.$body.append(modalContainer);\n }\n\n const $modalContainer = $(\".modal-container\");\n const modalButtons = `<div class=\"modal-btn-container\">\n <button type=\"button\" id=\"modal-prev\" class=\"modal-prev btn\">Prev</button>\n <button type=\"button\" id=\"modal-next\" class=\"modal-next btn\">Next</button>\n </div>`;\n\n $modalContainer.each((i, val) => $(val).append(modalButtons));\n }", "function ouvrir() {\n creationModal();\n }", "function handleAddNewStockButton() {\n $('#stockIdDiv').addClass('d-none')\n $('.modal-title').text(\"Добавить новую акцию\")\n stockModalClearFields()\n}", "function createModal() {\n return $(\"<div id=\\\"modal\\\" class=\\\"modal fade\\\" tabindex=\\\"-1\\\" aria-hidden=\\\"true\\\">\\\n <div class=\\\"modal-dialog\\\">\\\n <div class=\\\"modal-content\\\">\\\n <div class=\\\"modal-header\\\">\\\n <h5 class=\\\"modal-title\\\"></h5>\\\n <button type=\\\"button\\\" class=\\\"close invisible\\\" data-dismiss=\\\"modal\\\" aria-label=\\\"Close\\\" >\\\n <span aria-hidden=\\\"true\\\">&times;</span>\\\n </button>\\\n </div>\\\n <div class=\\\"modal-body\\\">\\\n </div>\\\n <div class=\\\"modal-footer\\\">\\\n <button type=\\\"button\\\" class=\\\"btn btn-secondary invisible\\\"></button>\\\n <button type=\\\"button\\\" class=\\\"btn btn-primary \\\"></button>\\\n </div>\\\n </div>\\\n </div>\\\n </div>\");\n}", "function insertModalMovies(div) {\n for (let i = 0; i < movies.length; i++) {\n const modalMoviesSection = `\n <img\n src=\"${movies[i].imageSource}\"\n alt=\"${movies[i].alt}\">\n <div class=\"carousel-caption d-md-block\">\n <p>${moviesCaption[i].caption}</p>\n </div>\n `;\n\n div[i].insertAdjacentHTML('beforeend', modalMoviesSection);\n\n\n }\n}", "function showServiceInfo() {\r\n $(\"#trasanoModalHeader\").empty();\r\n $(\"#trasanoModalBody\").empty();\r\n $(\"#trasanoModalFooter\").empty();\r\n\r\n $(\"#trasanoModalHeader\").append(\r\n \"<h4>Información del Servicio</h4>\"\r\n ); \r\n\r\n $(\"#trasanoModalBody\").append(\r\n \"<div class='alert alert-danger' role='alert'>\" + \r\n \"<p><span class='glyphicon glyphicon-warning-sign' aria-hidden='true'></span> \" + \r\n \"<strong>\" + localStorage.getItem(\"name\") + \"!</strong>\" + \r\n \" No dispone de servicio de ambulancia.</p>\" +\r\n \"</div>\" + \r\n \"<div class='alert alert-info' role='alert'>\" + \r\n \"<p><span class='glyphicon glyphicon-info-sign' aria-hidden='true'></span> Consulte en el mostrador para más información.</p>\" + \r\n \"</div>\"\r\n );\r\n\r\n $(\"#trasanoModalFooter\").append(\"<button type='button' class='btn btn-primary' data-dismiss='modal'>CERRAR</button>\"); \r\n\r\n $('#trasanoMODAL').modal('show');\r\n}", "function addFotkiPanel() {\n div_new = document.createElement('div');\n div_new.id = \"dialog-insert-asset-conduit-fotki\";\n div_new.className = \"dialog-insert-asset-conduit-fotki dialog-insert-asset-conduit hidden\";\n\n // TODO: throw away as much of the HTML below as possible\n div_new.innerHTML = \n \" <div class=\\\"pkg dialog-content\\\">\" + \n \" <div class=\\\"tab-header\\\">\" + \n \" <a href=\\\"http://www.fotki.com/\\\" class=\\\"right command-open-window\\\">Fotki.com</a>\" + \n \" <div class=\\\"search\\\">\" + \n \" <div class=\\\"header2\\\">Choose the folder:</div>\" + \n \" </div> \" + \n \" </div>\" + \n \" <div class=\\\"scrollbox chunk list-empty\\\" id=\\\"conduit-results-fotki\\\">\" + \n \" <dl class=\\\"list-empty-message\\\">\" + \n \" </dl>\" + \n \" \" + \n \" <dl class=\\\"list-no-results-message\\\">\" + \n \" </dl>\" + \n \" <div class=\\\"conduit-setup-message\\\">\" + \n \" \" + \n \" </div>\" + \n \" </div>\" + \n \" <div class=\\\"clr\\\"></div>\" + \n \" <div class=\\\"content-footer-spacing\\\">&nbsp;</div>\" + \n \" <div id=\\\"insert-asset-conduit-footer\\\" class=\\\"dialog-insert-asset-conduit-footer content-footer\\\">\" + \n \" <div class=\\\"pagination pkg\\\" id=\\\"insert-asset-conduit-fotki-pager\\\">&nbsp;</div>\" + \n \"\" + \n \" <div id=\\\"privacy-settings-conduit\\\" class=\\\"privacy-settings left\\\">\" + \n \"\" + \n \"<div style=\\\"display:none\\\" class=\\\"viewer\\\">\" + \n \" <label for=\\\"asset-privacy-conduit-fotki\\\">Viewable by:</label>\" + \n \" <select tabindex=\\\"3\\\" id=\\\"asset-privacy-conduit-fotki\\\" class=\\\"asset-privacy-conduit-fotki asset-privacy\\\" name=\\\"post-default-privacy\\\">\" + \n \" \" + \n \" <option value=\\\"1\\\" selected=\\\"selected\\\">anyone</option>\" + \n \" \" + \n \" <option value=\\\"10\\\">neighborhood</option>\" + \n \" \" + \n \" <option value=\\\"21\\\">friends and family</option>\" + \n \" \" + \n \" <option value=\\\"11\\\">friends</option>\" + \n \" \" + \n \" <option value=\\\"12\\\">family</option>\" + \n \" \" + \n \" <option value=\\\"0\\\">you (hidden)</option>\" + \n \" \" + \n \" </select>\" + \n \"</div>\" + \n \"<div style=\\\"display:none\\\" class=\\\"commenter\\\">\" + \n \" <label for=\\\"asset-privacy-conduit-fotki\\\">Allow comments from:</label>\" + \n \" <select tabindex=\\\"3\\\" id=\\\"asset-commenters-conduit-fotki\\\" class=\\\"asset-commenters-conduit-fotki asset-commenters\\\" name=\\\"post-default-commenters\\\">\" + \n \" <option value=\\\"1\\\" selected=\\\"selected\\\">anyone</option>\" + \n \" <option value=\\\"10\\\">neighborhood</option>\" + \n \" <option value=\\\"21\\\">friends and family</option>\" + \n \" <option value=\\\"11\\\">friends</option>\" + \n \" <option value=\\\"12\\\">family</option>\" + \n \" <option value=\\\"0\\\">nobody</option>\" + \n \"\" + \n \"\" + \n \" </select>\" + \n \"</div>\" + \n \"\" + \n \" </div>\" + \n \" <div class=\\\"clr\\\"></div>\" + \n \" <div style=\\\"display:none\\\" class=\\\"left\\\">\" + \n \"<input id=\\\"exclude-offensive-conduit-fotki\\\" class=\\\"exclude-offensive-conduit exclude-offensive-conduit-fotki checkbox\\\" name=\\\"exclude-offensive\\\" type=\\\"checkbox\\\"><span class=\\\"offensive-text\\\">This may be offensive or otherwise not for the public. Exclude from public explore pages.</span>\" + \n \"\" + \n \" </div>\" + \n \" <div class=\\\"clr\\\"></div>\" + \n \" <a class=\\\"command-insert-from-conduit right default button\\\"><b>OK</b><s></s></a>\" + \n \"\" + \n \" <a class=\\\"command-cancel right button\\\"><b>Cancel</b><s></s></a>\" + \n \"\" + \n \" </div>\" + \n \" </div>\";\n\n vh1EyeCandyDiv2 = document.getElementById(\"dialog-insert-asset-conduit-eyecandy\");\n vh1EyeCandyDiv2.parentNode.insertBefore(div_new, vh1EyeCandyDiv2.nextSibling);\n\n var scrollBox = document.getElementById('conduit-results-fotki');\n\n // Add a div for the photo thumbnails\n photosList = document.createElement('div');\n photosList.id = 'fotki-photos-list';\n scrollBox.appendChild(photosList);\n\n // And another one for the folder list\n folderList = document.createElement('div');\n folderList.id = 'fotki-folder-list';\n scrollBox.appendChild(folderList);\n\n}", "function buildModalSimpleBig() {\n let id = makeid();\n let html = `<div id='${id}' class='modal big-modal' tabindex='-1' role='dialog' data-bs-backdrop=\"static\" data-bs-keyboard=\"false\"> \n <div class='modal-dialog' role='document'> \n <div class='modal-content'> \n <div class='modal-header'> \n <button type='button' class='close modal-close btn-close' aria-label='Cancel'><!--<span aria-hidden='true'>&times;</span>--></button>\n </div>\n <div class='modal-body' id=\"${id}Body\">\n \n </div>\n </div>\n </div>\t\n </div>`;\n $('body').append(html);\n //let modal = $(`#${id}`);\n /*modal.modal({\n backdrop: 'static',\n keyboard: false,\n //show: true\n });*/\n\n //NEW MODAL FORMAT\n let modal = new bootstrap.Modal(document.getElementById(id), {\n keyboard: false,\n backdrop: 'static'\n });\n\n modal.show();\n \n\n $(document).on('click', `#${id} .modal-close`, function() {\n forceCloseModal(id);\n });\n\n return id;\n}", "function modals_correo_admin(titulo,mensaje){\n\n\tvar modal='<!-- Modal -->';\n modal+='<div id=\"myModal3\" class=\"modal2 hide fade\" style=\"margin-top: 5%; background-color: rgb(41, 76, 139); color: #fff; z-index: 900000; behavior: url(../../css/PIE.htc);width: 80%; left: 40%;\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\" data-backdrop=\"true\">';\n modal+='<div class=\"modal-header\" style=\"border-bottom: 0px !important;\">';\n modal+='<button type=\"button\" class=\"close\" style=\"color:#fff !important;\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>';\n modal+='<h4 id=\"myModalLabel\">'+titulo+'</h4>';\n modal+='</div>';\n modal+='<div class=\"modal-body\" style=\"max-width: 92% !important; background-color:#fff; margin: 0 auto; margin-bottom: 1%; border-radius: 8px; behavior: url(../../css/PIE.htc);\">';\n modal+='<p>'+mensaje+'</p>';\n modal+='</div>';\n \n modal+='</div>';\n $(\"#main\").append(modal);\n \n $('#myModal3').modal({\n keyboard: false,\n backdrop: \"static\" \n });\n \n $('#myModal3').on('hidden', function () {\n $(this).remove();\n });\n \n}", "function group_add(){\n\t$.get(\n base_url + 'index.php/adm/groups_get_form',\n {nohtml:'nohtml'},\n function(data){\n $(\"#modal-global-body\").html('<div class=\"well\">'+data+'</div>');\n } \n );\n $('#modal-global-label').html('<i class=\"fa fa-group\"></i>&nbsp;&nbsp;Nouveau groupe');\n $('#modal-global').modal('show');\n}", "function mediaInfo(data) {\n //console.log(data);\n let result = document.getElementById(\"result\");\n result.innerHTML = \"\";\n let getImg = data.items;\n for (let i = 0; i < getImg.length; i++) {\n let listData = new myList(\n getImg[i].title,\n getImg[i].description,\n getImg[i].media,\n getImg[i].link,\n getImg[i].date_taken);\n myflickrdata.push(listData);\n //console.log(listData);\n }\n\n for (let i = 0; i < myflickrdata.length; i++) {\n\n let newDiv = document.createElement(\"div\");\n newDiv.className = (\"one two three\");\n result.appendChild(newDiv);\n let image = document.createElement(\"img\");\n image.src = myflickrdata[i].media.m;\n newDiv.appendChild(image);\n\n // Modal button and adding attributes\n\n let modalButton = document.createElement('a');\n modalButton.innerHTML = 'Click for Details';\n\n // modalButton.setAttribute('type', 'button');\n modalButton.setAttribute('class', 'modalButton');\n modalButton.setAttribute('data-toggle', 'modal');\n modalButton.setAttribute('href', '#newModal');\n modalButton.setAttribute('data-src', myflickrdata[i].media.m);\n modalButton.setAttribute('data-title', myflickrdata[i].title);\n modalButton.setAttribute('data-description', myflickrdata[i].description);\n newDiv.appendChild(modalButton);\n\n }\n\n modalB();\n}", "create(){\n const modal = d3.select(this.parentNode)\n .append('div')\n .classed('modal', true)\n .attr('id', this.DOM_ID);\n\n const content = modal.append('div')\n .classed('content', true)\n .classed('modal-content', true);\n\n const header = content.append('div')\n .classed('header', true)\n .classed('modal-header', true);\n\n this.header = header.append('div')\n .classed('header-content', true);\n\n const exitButton = header.append('div').classed('header-exit', true);\n exitButton.on('click',(e) => {\n this.getSelection().style('display', 'none');\n })\n\n exitButton.append('h1').html('<i class=\"fas fa-times\"></i>');\n\n\n this.body = content.append('div')\n .classed('body', true)\n .classed('modal-body', true);\n\n this.footer = content.append('div')\n .classed('footer', true)\n .classed('modal-footer', true);\n\n this.element = modal;\n }", "function notification_modal_confirm_add() {\n\n header_style = 'style=\"background-color: #1DB198; color: #ffffff;\"';\n\n var modal = '<div class=\"modal fade\" id=\"modal_div\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\">';\n modal += '<div class=\"modal-dialog\">';\n modal += '<div class=\"modal-content\">';\n\n modal += '<div class=\"modal-header\" ' + header_style + '>';\n modal += '<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>';\n modal += '<h4 class=\"modal-title\" id=\"myModalLabel\">' + \"Confirmation\" + '</h4>';\n modal += '</div>';\n\n modal += '<div class=\"modal-body\"><br />';\n modal += \"Are you sure you want to add this machine type?\";\n modal += '</div>';\n\n modal += '<div class=\"modal-footer\" style=\"text-align:center;\">';\n modal += '<button type=\"button\" class=\"btn btn-success\" onclick=\"insertRecord();\">OK</button>';\n modal += '<button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</button>';\n\n modal += '</div>';\n\n modal += '</div>';\n modal += '</div>';\n modal += '</div>';\n\n $(\"#notification_modal\").html(modal);\n $(\"#modal_div\").modal(\"show\");\n $(\"#modal_div\").css('z-index', '1000002');\n\n $(\"#form_modal_div\").modal(\"hide\");\n\n $(\"body\").css(\"margin\", \"0px\");\n $(\"body\").css(\"padding\", \"0px\");\n\n $(\"#modal_div\").on(\"hidden.bs.modal\", function () {\n\n if (modal_checker == 0) {\n $(\"#form_modal_div\").modal(\"show\");\n }\n else {\n $(\"#form_modal_div\").modal(\"hide\");\n }\n\n $(\"body\").css(\"margin\", \"0px\");\n $(\"body\").css(\"padding\", \"0px\");\n\n modal_checker = 0;\n });\n}", "createDialog(title, content, actionBtns)\n {\n let modal = document.createElement(\"div\");\n modal.innerHTML =\n '<div id=\"' + this.id + '\" style=\"display: none;\">'\n + '<div class=\"ui-widget-overlay container middle-xs center-xs\" style=\"text-align: left; display: flex; position: fixed; z-index: 11; left: 84px; top: 0; width: 100%; height: 100%;\">'\n + '<div id=\"' + this.id + '-dialog\" class=\"ui-dialog ui-widget ui-widget-content ui-corner-all box-shadow\" style=\"position: absolute; width: 100vw; max-width: 600px;\">'\n + '<div class=\"ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix\">'\n + '<span class=\"ui-dialog-title\" role=\"heading\" aria-level=\"2\">' + title + '</span>'\n + '<button class=\"ui-dialog-titlebar-close ui-corner-all element_toggler\" aria-controls=\"' + this.id + '\" aria-label=\"Toggle ' + this.id + ' modal\">'\n + '<span class=\"ui-icon ui-icon-closethick\">close</span>'\n + '</button>'\n + '</div>'\n + '<div id=\"' + this.id + '-form-dialog\" class=\"ui-dialog-content form-dialog\">'\n + '<div>'\n + content\n + '<p id=\"' + this.id + '-alert\" class=\"alert alert-info\" style=\"display:none\"></p>'\n + '</div>'\n + '<div class=\"form-controls text-right\">'\n + '<a id=\"' + this.id + '-close\" class=\"element_toggler btn ui-corner-all\" role=\"button\" aria-controls=\"' + this.id + '\" aria-label=\"Toggle ' + this.id + ' modal\"> <span class=\"ui-button-text\">Close</span></a>'\n + actionBtns\n + '</div>'\n + '</div>'\n + '</div>'\n + '</div>'\n + '</div>';\n\n //append dialog to document\n document.body.appendChild(modal);\n //add a spinner\n this.addSpinner(this.id + '-spinner');\n //set listeners to close the dialog\n this.setCloseListeners();\n }", "function onAddButtonClick() {\n addModelModal.style.display = \"block\";\n}", "function fnAgregarCatalogoModal(){\n\t$('#divMensajeOperacion').addClass('hide');\n\n\tproceso = \"Agregar\";\n\n\t//$(\"#selectFuenteRecurso\").multiselect('rebuild');\n\t$(\"#txtClave\").prop(\"readonly\", false);\n\t$('#txtClave').val(\"\");\n\t$('#txtDescripcion').val(\"\");\n\t$('#selectFuenteRecurso').multiselect('enable');\n\n\tvar titulo = '<h3><span class=\"glyphicon glyphicon-info-sign\"></span> Agregar Fuente de Recurso</h3>';\n\t$('#ModalUR_Titulo').empty();\n $('#ModalUR_Titulo').append(titulo);\n\t$('#ModalUR').modal('show');\n}", "function myLocationCurtain(){\n locationCurtainDiv = $('<div id=\"intCurtain\"><div class=\"loader\"></div></div>');\n console.log(\"modal fire is working\");\n $(\"#intContainer\").html(locationCurtainDiv);\n $(\"#intCurtain\").show();\n setTimeout(function(){\n $(\"#intCurtain\").hide();\n }, 3000);\n }", "function createModal(data){\n let outerDiv = document.createElement('div');\n outerDiv.classList.add(\"modal-body\", \"mx-0\");\n\n let titleDiv = document.createElement('div');\n let titleH = document.createElement('h6');\n titleH.innerText = 'Title';\n\n let titleP = document.createElement('p');\n titleP.innerText = data['title'];\n\n let cityDiv = document.createElement('div');\n let cityH = document.createElement('h6');\n cityH.innerText = 'City';\n\n let cityP = document.createElement('p');\n cityP.innerText = data['city'];\n\n let priceDiv = document.createElement('div');\n let priceH = document.createElement('h6');\n priceH.innerText = 'Price Range';\n\n let priceP = document.createElement('p');\n priceP.innerText = data['price_range'];\n\n let bedroomDiv = document.createElement('div');\n let bedroomH = document.createElement('h6');\n bedroomH.innerText = 'Number of Bedrooms';\n\n let bedroomP = document.createElement('p');\n bedroomP.innerText = data['bedrooms'];\n\n let furnishedDiv = document.createElement('div');\n let furnishedH = document.createElement('h6');\n furnishedH.innerText = 'Furnished';\n\n let furnishedP = document.createElement('p');\n furnishedP.innerText = (data['furnished'] == true) ? 'Yes' : 'No';\n\n let img = document.createElement('img');\n img.src = data['image_url'];\n\n titleDiv.appendChild(titleH);\n titleDiv.appendChild((titleP));\n\n cityDiv.appendChild(cityH);\n cityDiv.appendChild(cityP);\n\n priceDiv.appendChild(priceH);\n priceDiv.appendChild(priceP);\n\n bedroomDiv.appendChild(bedroomH);\n bedroomDiv.appendChild(bedroomP);\n\n furnishedDiv.appendChild(furnishedH);\n furnishedDiv.appendChild(furnishedP);\n\n outerDiv.appendChild(titleDiv);\n outerDiv.appendChild(cityDiv);\n outerDiv.appendChild(priceDiv);\n outerDiv.appendChild(bedroomDiv);\n outerDiv.appendChild(furnishedDiv);\n outerDiv.appendChild(img);\n\n return outerDiv;\n}", "function cargarModalChef1(){\n\tvar txt='<!-- Modal --><div class=\"modal fade\" id=\"myModal\" role=\"dialog\">';\n\ttxt += '<div class=\"modal-dialog\">';\n\ttxt += '<!-- Modal content--><div class=\"modal-content\">';\n\ttxt += '<div class=\"modal-header\"><button type=\"button\" class=\"close\" data-dismiss=\"modal\">&times;</button>';\n\ttxt += '<div id=\"numeroPedido\"><h1>NUMERO PEDIDO</h1></div></div>';\n\ttxt += '<div class=\"modal-body\"><div id=\"detallePedidoCocina\"><div class=\"tbl_cocina\" id=\"tablaCocinaDetalle\">';\n\ttxt += '<table class=\"table table-bordered\"><thead><tr><th scope=\"col\">Productos</th><th scope=\"col\">Cantidad</th></tr>';\n\ttxt += '</thead><tbody><tr><td>arroz con huevo</td><td>5</td></tr><tr><td>arroz con huevo</td><td>5</td></tr><tr><td>arroz con huevo</td><td>5</td></tr><tr><td>arroz con huevo</td><td>5</td></tr><tr><td>arroz con huevo</td><td>5</td></tr><tr><td>arroz con huevo</td><td>5</td></tr></tbody></table></div></div></div>';\n\ttxt += '<div class=\"modal-footer\"><div id=\"pedidoCocinaSur\"><button type=\"button\" class=\"btn btn-warning\">PREPARAR</button>';\n\ttxt += '<button type=\"button\" class=\"btn btn-success\">ENTREGAR</button></div>';\n\ttxt += '</div></div></div></div>';\n\treturn txt;\n}", "function load_food_modal(){\n\t$(\".modal_add_food_container\").html(\"\");\n\tvar div = \"\";\n\tvar title = \"\";\n\tfor(const item in MY_FOOD_DATA){\n\t\tif(MY_FOOD_DATA[item][\"category\"] != title) { title = MY_FOOD_DATA[item][\"category\"]; div += \"<div class='m_title'>\" + title + \"</div>\"}\n\t\tdiv += get_item_html(MY_FOOD_DATA[item][\"icon\"] + \" \" + MY_FOOD_DATA[item][\"food\"], Math.round(MY_FOOD_DATA[item][\"calories\"]) + \" kcal\", \"add_food_modal_item\", item );\n\t}\n\t$(\"#modal_add_food_container\").html(div);\n}", "function buildModal(that, title, mClass) {\n //ensure there is a mid (modalID) in the class object passed to the function\n if(!that.mid || that.mid === undefined || that.mid === null) { that.mid = makeid(); }\n let id = that.mid;\n let html = `<div id='${id}' class='modal ${mClass}' tabindex='-1' role='dialog' data-bs-backdrop=\"static\" data-bs-keyboard=\"false\"> \n <div class='modal-dialog modal-dialog-centered' role='document'> \n <div class='modal-content'> \n <div class='modal-header'> \n <h4 class='modal-title'>${title}</h4>\n <button type='button' class='close modal-close btn-close' aria-label='Cancel'><!--<span aria-hidden='true'>&times;</span>--></button>\n </div>\n <div class='modal-body' id=\"${id}Body\">\n \n </div>\n </div>\n </div>\t\n </div>`;\n $('body').append(html);\n\n //NEW MODAL FORMAT\n let modal = new bootstrap.Modal(document.getElementById(id), {\n keyboard: false,\n backdrop: 'static'\n });\n\n modal.show();\n that.container = $(`#${id}Body`);\n $(document).on('click', `#${id} .modal-close`, function() {\n forceCloseModal(id);\n });\n\n return id;\n}", "function create_modal_minors(elem, json_obj) {\n\n var put_in = $('#modal_div');\n put_in.append(\"<p class = 'ugminors_modal_div_title'>Minor: \"+json_obj.title+ \"</p>\");\n\n var str_desc = json_obj.description.split(\".\");\n\n // for generating description again\n var desc = '';\n for(var i = 0; i < str_desc.length -2;i++){\n if(i == 0){\n desc = str_desc[i];\n }else{\n desc = desc + \". \"+ str_desc[i];\n }\n\n if(i == str_desc.length-3){\n desc = desc + \".\";\n }\n }\n\n put_in.append(\"<p class = 'ugminors_modal_div_description'>\"+desc+\"</p>\");\n\n put_in.append(\"<p class = 'ugminors_modal_div_fac'>\"+str_desc[str_desc.length-2]+\"</p>\");\n put_in.append(\"<p class = 'ugminors_modal_div_fac'>\"+str_desc[str_desc.length-1]+\"</p>\");\n put_in.append(\"<div class='ugminors_modal_div_div_span'><span class =\" +\n \" 'ugminors_modal_div_span'>Courses</span></div>\");\n\n $put_in_before = $(\"<div class = 'accordian_div'></divclass>\");\n\n // var json_obj_more_data = get_name_desc();\n //console.log(json_obj_more_data);\n\n // add courses\n $.each(json_obj.courses, function(i, item){\n $h3_add = $(\"<h3 class = 'ugminors_modal_div_course'>\"+item+\"</h3>\");\n\n\n $div_add_div = $(\"<div class='ugminors_modal_div_course_div'></div>\");\n\n get_name_desc($div_add_div,item);\n\n\n $put_in_before.append($h3_add);\n $put_in_before.append($div_add_div);\n\n });\n\n\n $put_in_before.accordion({\"refresh\":\"true\",\"heightStyle\": \"content\", \"collapsible\":\"true\"});\n\n put_in.append($put_in_before);\n put_in.append(\"<p class = 'ugminors_modal_div_note'>\"+json_obj.note+\"</p>\");\n\n put_in.dialog({\n modal: true,\n beforeClose: function () {put_in.empty();},\n height:500,\n width:850,\n // maxHeight:600,\n // maxWidth:800,\n closeOnEscape: true\n });\n }", "createViewModal() {\n const htmlstring = '<div class=\"modal-content\">' +\n '<div class=\"modal-header\">' +\n ' <span id=\"closeview\" class=\"closeview\">&times;</span>' +\n ' <h2>' + this.name + '</h2>' +\n '</div>' +\n '<div class=\"modal-body\">' +\n ' <h2>Description</h2>' +\n ' <p>' + this.description + '</p>' +\n ' <h2>Current Status : ' + this.status + '</h2>' +\n ' <h2>Assigned to ' + this.assignee + '</h2>' +\n ' <h2>Priority : ' + this.priority + '</h2>' +\n ' <h2>Created on : ' + this.date + '</h2>' +\n '</div>' +\n '</div>';\n\n return htmlstring;\n }", "function createModalHTML(data){ \n data.forEach(function(note){\n $(\".existing-note\").append(`\n <div class=\"panel panel-default\" id=\"${note._id}\">\n <div class=\"panel-body\">\n <div class=\"noteContent\">\n <p>${note.body}</p>\n <button class=\"btn btn-primary edit-note\" data-noteId=\"${note._id}\"\">Edit</button>\n <button class=\"btn btn-primary delete-note\" data-noteId=\"${note._id}\">Delete</button>\n </div>\n <div class=\"update-form\"></div>\n </div>\n </div>\n `)\n }); \n}", "function ShowModal(id) {\n const modal = document.createElement('div')\n modal.id = 'modalId'\n modal.classList.add('modal')\n\n\n modal.innerHTML = `\n <div class=\"modal-background\"></div>\n <div class=\"modal-card\">\n <header class=\"modal-card-head\">\n <p class=\"modal-card-title\">Vehiculo parqueado exitosamente !</p>\n <button class=\"delete\" aria-label=\"close\"></button>\n </header>\n <section class=\"modal-card-body\">\n <div class=\"content\">\n <h4> ID : ${id} </h4>\n </div>\n </section>\n <footer class=\"modal-card-foot\">\n <button onclick=\"cerrarModal()\" class=\"button\">Cerrar</button>\n </footer>\n </div>\n `\n document.body.appendChild(modal)\n modal.classList.add('is-active')\n\n}", "onAdd () {\r\n this.div = document.createElement('div');\r\n this.div.classList.add('marker');\r\n this.div.style.position = 'absolute';\r\n this.div.innerHTML = this.text;\r\n this.getPanes().overlayImage.appendChild(this.div);\r\n\r\n this.div.addEventListener('click', event => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n this.div.innerHTML = this.html;\r\n this.div.classList.add('is-poped');\r\n this.active();\r\n });\r\n }", "function MandaMessaggioInserimento(testo) {\n jQuery(\"#testo-modal\").html(testo);\n jQuery(\"#modal-accettazione\").modal(\"toggle\");\n}", "function addModalText(text) {\n $('.modal-content').append($('<p>').text(text));\n}", "function generateModalBox(filterObj, itemNo) {\n var eventsModal = document.getElementById('eventsModal');\n var modalBox = '';\n modalBox += '<div class=\"event-date-header\"><span>' + filterObj[itemNo].eventSpecDate + ' Events</span> <a href=\"#\" class=\"close-btn\">X</a></div>' +\n '<div class=\"event-time\">' + filterObj[itemNo].eventtimeZone + '</div>' +\n '<div class=\"event-title\">' + filterObj[itemNo].eventTitle + '</div>' +\n '<div class=\"event-description\">' + filterObj[itemNo].eventDescription + '</div><a href=\"' + filterObj[itemNo].learnMoreURL + '\" class=\"event-btn\" target=\"_blank\">Learn more</a>' +\n '<div class=\"events-prev-next\"><span class=\"events-prev glyphicon glyphicon-triangle-top\"></span><span class=\"events-next glyphicon glyphicon-triangle-bottom\"></span></div>';\n $(eventsModal).html(modalBox);\n eventsModal.style.display = 'block';\n }", "function modalCreate() {\n id = null\n // limpiamos el div q contiene la imagen\n $(\"#image\").empty();\n $(\"#imagen\").val('');\n document.getElementById('titulo').value = \"\"\n document.getElementById('categorias').value = \"\"\n document.getElementById('descripcion').value = \"\"\n document.getElementById('tags').value = \"\"\n document.getElementById('contenido').value = \"\"\n document.getElementById('fecha_publ').value = moment().format(\"YYYY-MM-DD\"),\n document.getElementById('fecha_fin').value = \"\"\n document.getElementById('imagen').value = \"\"\n document.getElementById('titleModal').innerText = 'Crear Post';\n document.getElementById('subtitle').innerText = ' En esta sección puedes crear nuevos Posts';\n $(\"#ModalCreateOrUpdate\").modal('show')\n}", "function showDiv() {\n // template\n var f = $('#booking-form').clone();\n \n // add to list\n $('#others').append(f.fadeIn());\n}", "function CreatePopup(header, html, popSize) {\n \n if (header == undefined) {\n header = \"\";\n }\n if (html == undefined) {\n html = \"\";\n }\n var size = \"\";\n if (popSize == \"small\") {\n size = \" modal-sm\";\n }\n if (popSize == \"medium\") {\n size = \" modal-md\";\n }\n if (popSize == \"large\") {\n size = \" modal-lg\";\n }\n else {\n size = \"\";\n }\n var stringHtml = \"<div class='modal fade' id='myModal'>\" +\n \"<div class='modal-dialog \" + size + \" '>\" +\n \"<div class='modal-content'>\" +\n \"<div class='modal-header'>\" +\n \"<button type='button' class='close' data-dismiss='modal'><span aria-hidden='true'>&times;</span><span class='sr-only'>Close</span></button>\" +\n \"<h4 class='modal-title'>\" + header + \"</h4>\" +\n \"</div>\" +\n \"<div class='modal-body'>\" +\n html +\n \"</div>\" +\n \"<div class='modal-footer'>\" +\n \"</div>\" +\n \"</div>\" +\n \"</div>\" +\n \"</div>\";\n $(\"body\").append(stringHtml);\n $('#myModal').modal('show');\n}", "function add_popup_box(){\n\t\t\t var pop_up = $('<div class=\"paulund_modal_box\"><span class=\"paulund_modal_close\" style=\"cursor:pointer;\"></span><div class=\"paulund_inner_modal_box\"><table width=\"200px\" height=\"30px\" style=\"position:absolute;\"><tr><td style=\"font-weight:bold;\">비밀번호&nbsp;<input type=\"password\" name=\"passwd\" id=\"passwd\" size=\"10\" maxlength=\"20\"></td><td><img src=\"/images/btn_confirm.gif\" onclick=\"pwConfirm();\" valign=\"absmiddle\" style=\"cursor:pointer;\"></td></tr></table></div></div>');\n\t\t\t $(pop_up).appendTo('.paulund_block_page');\n\t\t\t \t\t\t \n\t\t\t $('.paulund_modal_close').click(function(){\n\t\t\t\t$(this).parent().fadeOut().remove();\n\t\t\t\t$('.paulund_block_page').fadeOut().remove();\t\t\t\t \n\t\t\t });\n\t\t}", "function Modal(est_ved, nav, url){\n\n var modalDiv = document.createElement(\"div\");\n modalDiv.id = \"modalJanela\";\n modalDiv.setAttribute('title', est_ved+\" : \"+nav);\n\n var iframeModal = document.createElement(\"iframe\");\n iframeModal.setAttribute('frameBorder', \"0\");\n iframeModal.setAttribute('height', \"95%\");\n iframeModal.setAttribute('width', \"100%\");\n iframeModal.setAttribute('src', url);\n\n modalDiv.appendChild(iframeModal);\n \n document.getElementById('modalDiv').appendChild(modalDiv);\n\n $(function() {\n \n $(\"#modalJanela\" ).dialog({\n modal: true,\n width: 500,\n height: 425, \n closeText: \"Xis\",\n show: {\n effect: \"fade\",\n duration: 250\n },\n hide: {\n effect: \"fade\",\n duration: 250\n },\n open: function() {\n $('.ui-widget-overlay').addClass('custom-overlay');\n },\n close: function() {\n $('.ui-widget-overlay').removeClass('custom-overlay');\n modalDiv.remove();\n },\n\n });\n });\n}", "function paintPatternsInModal() {\n // Delete previous printed data\n $(\"#patternsModal > div > div > div.modal-body\").empty();\n\n for (let i = 0; i < NETWORK.trainingPatterns.length; i++) {\n let pattern = NETWORK.trainingPatterns[i];\n\n let columns = (new Array(parseInt($(\"#width\").val()))).fill(\"1fr\").join(\" \");\n let rows = (new Array(parseInt($(\"#height\").val()))).fill(\"1fr\").join(\" \");\n let elements = pattern.data[0].map(function(item, index) {\n return `<div id=\"modal${i}${index}\" style=\"background-color: ${item == 1 ? \"white\" : \"black\"};\"></div>`\n })\n\n\n $(\"#patternsModal > div > div > div.modal-body\").append(`<div class=\"grid\" style=\"grid-template-columns: ${columns}; grid-template-rows: ${rows}\">${elements.join(\"\")}</div>`);\n }\n}", "function new_div() {\n $(\"#new\").append(\"<div>Test</div>\");\n}", "function make_chat_dialog_box(to_user_id, to_user_name)\n{\n var modal_content = '<div id=\"user_dialog_'+to_user_id+'\" class=\"user_dialog\" title=\"You have a chat with '+to_user_name+'\">';\n modal_content += '<div style=\"height:400px; border:1px solid #ccc; overflow-y: scroll; margin-bottom:24px; padding:16px;\" class=\"chat_history\" data-touserid=\"'+to_user_id+'\" id=\"chat_history_'+to_user_id+'\">';\n modal_content += '</div>';\n modal_content += '<div class=\"form-group\">';\n modal_content += '<textarea name=\"chat_message_'+to_user_id+'\" id=\"chat_message_'+to_user_id+'\" class=\"form-control\"></textarea>';\n modal_content += '</div><div class=\"form-group\" align=\"right\">';\n modal_content+= '<button type=\"button\" name=\"send_chat\" id=\"send_chat\" class=\"btn btn-info send_chat\">Send</button></div></div>';\n $('#user_model_details').html(modal_content);\n}", "function showNewLightboxDiv() {\n $(CorbisUI.GlobalVars.AddToLightbox.createLightboxSection).removeClass('displayNone');\n ResizeModal('addToLightboxModalPopup');\n}", "function help_add() {\n\n $('#help_add').modal('show');\n}", "function buildTable(data) {\n $(\"#main\").empty();\n var bg = false;\n ajaxCall(\"Get\", \"api/employees/\", \"\")\n .done(function (data) {\n employees = data;\n div = $(\"<div id=\\\"employee\\\" data-toggle=\\\"modal\\\" data-target=\\\"#myModal\\\" class=\\\"row trWhite\\\">\");\n div.html(\"<div class=\\\"col-lg-12\\\" id=\\\"id0\\\">...Click Here to add<\\div>\");\n div.appendTo($(\"#main\"));\n $.each(data, function (index, emp) {\n var cls = \"rowWhite\";\n bg ? cls = \"rowWhite\" : cls = \"rowLightGray\";\n bg = !bg;\n div = $(\"<div id=\\\"\" + emp.EmployeeId + \"\\\" data-toggle=\\\"modal\\\" data-target=\\\"#myModal\\\" class=\\\"row col-lg-12 \" + cls + \"\\\">\");\n var empId = emp.EmployeeId;\n div.html(\n \"<div class=\\\"col-xs-4\\\" id=\\\"employeetitle\" + empId + \"\\\">\" + emp.Title + \"</div>\" +\n \"<div class=\\\"col-xs-4\\\" id=\\\"employeefname\" + empId + \"\\\">\" + emp.Firstname + \"</div>\" +\n \"<div class=\\\"col-xs-4\\\" id=\\\"emplastname\" + empId + \"\\\">\" + emp.Lastname + \"</div>\"\n );\n div.appendTo($(\"#main\"));\n });\n });\n}", "function showModal(pokemon) {\n modal = $('#modal-container').modal('show');\n let modalDialog = $('#modalDialog'); // modal box that appears on top of the background\n let modalContent = $('#modalContent'); // Wrap around the modal content\n \n\n let modalBody = $(\".modal-body\");\n let modalTitle = $(\".modal-title\");\n // let modalHeader = $(\".modal-header\");\n\n // clear contents \n modalTitle.empty();\n modalBody.empty();\n \n\n\n\n\n // creating and element for name in modal content\n let nameElement = $(\"<h1>\" + pokemon.name + \"</h1>\");\n //creating img in modal content\n let imageElementFront = $(\"<img>\");\n imageElementFront.attr(\"src\", pokemon.imageUrl);\n //creating an element for height in modal content\n let heightElement = $('<p>' + 'height: ' + pokemon.height + '</p>');\n // creating an elelent for weight in modal content\n let weightElement = $('<p>' + 'weight: ' + pokemon.weight + '</p>')\n //creating an element for types in modal content\n let typesElement = $('<p>' + 'type: ' + pokemon.types + '</p>');\n // creating \n // </p>document.createElement('div');\n // modal.classList.add('modal');\n\n // Add the new modal content\n // modalHeader.append(nameElement);\n modalTitle.append(nameElement);\n \n modalBody.append(imageElementFront);\n modalBody.append(heightElement);\n modalBody.append(weightElement);\n modalBody.append(typesElement);\n\n\n}", "function agregarCrear(_url) {\n $('#modalBody').load(_url, () => {\n $('#myModal').modal({\n keyboard: false,\n backdrop: 'static'\n });\n });\n}", "makeModalInfo() {\n const modalInfo = $('<div>').addClass('modal-info-container');\n const modalImage = $('<img>').addClass('modal-img')\n .attr('src', this.picture)\n .attr('alt', 'profile picture');\n const modalH3 = $('<h3>').addClass('modal-name cap')\n .attr('id', 'name')\n .text(this.name);\n modalInfo.append(modalImage, modalH3,\n this.makeModalPTag('modal-text', this.email),\n this.makeModalPTag('modal-text cap', this.location),\n this.makeModalPTag('modal-text', this.phoneNumber),\n this.makeModalPTag('modal-text', this.address),\n this.makeModalPTag('modal-text', \"Birthday: \" + this.birthday));\n return modalInfo;\n }", "function showModalComponent($titleText){\n\t// przezroczysty div na cały ekran\n\t$container=$('<div></div>');\n\t$container.prop('id','modalContainer');\n\t$container.css({\n\t\t'position':'fixed',\n\t\t'top':'0px',\n\t\t'left':'0px',\n\t\t'width':'100%',\n\t\t'height':'100%',\n\t\t'background':'rgba(255, 255, 255, 0.6)'\n\t});\t\n\n\t$('body').append($container);\n\n\t// div wyśrodkowany w pionie i poziomie na tytuł i treść\n\t$content = $('<div></div>');\n\t$content.prop('id','modalContent');\n\t$content.css({\n\t\t'position':'absolute',\n\t\t'top':'50%',\n\t\t'left':'50%',\n\t\t'width':'500px',\n\t\t'padding': '20px 50px',\n\t\t'background':'#ff850c',\n\t\t'margin-left':'-270px',\n\t\t'margin-top':'-220px',\n\t\t'border-radius': '5px',\n\t\t'box-shadow': '0px 0px 5px 0px rgba(0,0,0,0.75)'\n\t});\t\n\t$container.append($content).hide().fadeIn(100);\n\n\t// tytuł modala\n\t$title = $('<div></div>');\n\t$title.prop('id','modalTitle');\n\t$title.css({\n\t\t'width': '440px',\n\t\t'float': 'left',\n\t\t'padding': '10px 20px 20px 20px',\n\t\t'background':'#ff850c',\n\t\t'font-size':'1.3rem'\n\t});\n\t$title.html(\"<i class='fas fa-align-center' style='margin-right: 10px'></i>\" + $titleText);\n\t$content.append($title);\n\n\t// przycisk do zamykania modala\n\t$closeButton = $('<div></div>');\n\t$closeButton.prop('id','closeModal');\n\t$closeButton.css({\n\t\t'width': '20px',\n\t\t'float': 'left',\n\t\t'font-size': '1.6rem',\n\t\t'background':'#ff850c'\n\t});\n\t$closeButton.hover(function(){\n\t\t$(this).css(\n\t\t\t\"cursor\", \"pointer\"\n\t\t);\n\t});\n\t$closeButton.html(\"<i class='fas fa-window-close'></i>\");\n\t$content.append($closeButton);\n\n\t// div na wiadomosc do wyswietlenia\n\t$message = $('<div></div>');\n\t$message.prop('id','messageModal');\n\t$message.css({\n\t\t'width': '100%',\n\t\t'height': '100%',\n\t\t'font-size': '1.1rem'\n\t});\n\n $input = $(\"<input>\");\n $input.attr('type', 'password');\n $input.attr('id', 'changePassInput');\n $input.attr('placeholder', 'Wpisz nowe hasło');\n $input.css({\n\t\t'width': '97%',\n\t\t'padding': '10px',\n\t\t'font-size': '1.1rem'\n });\n \n $button = $(\"<button></button>\");\n $button.attr('id', 'acceptNewPassButton');\n $button.attr('class', 'btnEdit');\n $button.html('Zmień hasło');\n $button.css({\n\t\t'display': 'block',\n\t\t'margin': '0 auto',\n\t\t'margin-top': '10px'\n });\n\n $message.append($input);\n $message.append($button);\n $content.append($message);\n \n // po kliknięciu 'Zmień hasło'\n $button.on('click', function(){\n if($input.val().length < 5){\n $input.css('background',\"#ffa8a8\");\n $('#'+$input.attr('id')+\"Error\").remove();\n $error = $('<p></p>');\n $error.prop('class','edit-data-error');\n $error.attr('id', $input.attr('id')+\"Error\");\n $error.html('Nowe hasło musi mieć przynajmniej 5 znaków');\n \n $content.append($error);\n\n $input.on('keyup', function(){\n if($input.val().length < 5){\n $input.css('background',\"#ffa8a8\");\n $('#'+$input.attr('id')+\"Error\").remove();\n $error = $('<span></span>');\n $error.prop('class','edit-data-error');\n $error.attr('id', $input.attr('id')+\"Error\");\n $error.html('Nowe hasło musi mieć przynajmniej 5 znaków');\n \n $content.append($error);\n } else {\n $input.css('background',\"#f6f6f6\");\n $('#'+$input.attr('id')+\"Error\").remove();\n }\n })\n\n } else {\n $('#'+$input.attr('id')+\"Error\").remove();\n console.log($input.val());\n $.ajax({\n type:\"post\",\n url:\"editDoctorData.php\",\n dataType:\"json\",\n data: {\n password: $input.val()\n },\n beforeSend: function(){\n $('body').css('opacity','0.6');\n $('body').css('cursor','progress');\n },\n success: function(json){\n switch(json){\n case 0:\n localStorage.setItem('messageSuccess', 'Hasło zostało zmienione.');\n location.href=\"index.php\"\n break;\n default:\n console.log('Default success response');\n break;\n }\n $('body').css('opacity','1');\n $('body').css('cursor','default');\n },\n error: function(e){\n console.warn(e);\n $('body').css('opacity','1');\n $('body').css('cursor','default');\n }\n });\n }\n \n })\n\n\t// po kliknięciu gdziekolwiek poza content znika modal\n\t$container.on('click', function(){\n\t\t$container.fadeOut(100,function(){$container.remove();});\n\t}).children().click(function() {\n\t\treturn false;\n\t});\n\t\n\t$closeButton.on('click', function(){\n\t\t$container.fadeOut(100,function(){$container.remove();});\n\t})\n}", "newBlog(){\n\t fetch(`${this.url}Controllermodal/newblogmodal`)\n\t .then(dataModal=>{\n\t dataModal.json().then(modal=>{\n\t document.getElementById('parentmodalInsertBlog').style.display=\"block\";\n\t document.getElementById(\"modalNewBlog\").innerHTML=modal;\n\t })\n\t })\n\t}", "function storeModal() {\n $('.modal-child').html('<div id=\"popup-text\"><h2>Here is what is in your cart currently</h2><span id=\"wagon-food-remaining\"></span></div>' + wagon.money.toFixed(2) + '<span id=\"back-button\" class=\"btn btn-danger\">Back</span></div>')\n}", "openAddModal(){\n document.getElementById(\"add_modal\").style.display = \"block\";\n }", "function createModalToAddCBC(patient_id) {\n let modal_header = `\n <h5 class=\"modal-title\" id=\"add_cbc_modal_title\">Add CBC Analysis</h5>\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n `\n\n let modal_body = `\n <div id=\"add_cbc_error\" class='row'></div>\n\n <form id=\"add_cbc_form\" action=\"/patients/${patient_id}/analyzes/cbc/new\" method=\"POST\">\n <div class=\"form-group row\">\n <label class=\"offset-2 col-2 col-form-label\" for=\"WCB\">WCB</label>\n <div class=\"col-6\">\n <input class=\"form-control\" id=\"WCB\" name=\"WCB\" placeholder=\"White Blod Cells\" type=\"text\" >\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"offset-2 col-2 col-form-label\" for=\"HGB\">HGB</label>\n <div class=\"col-6\">\n <input class=\"form-control\" id=\"HGB\" name=\"HGB\" placeholder=\"Hemoglibin\" type=\"text\">\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"offset-2 col-2 col-form-label\" for=\"MCV\">MCV</label>\n <div class=\"col-6\">\n <input class=\"form-control\" id=\"MCV\" name=\"MCV\" placeholder=\"Mean Corpuscular Volume\" type=\"text\" >\n </div>\n </div>\n\n <div class=\"form-group row\">\n <label class=\"offset-2 col-2 col-form-label\" for=\"MCH\">MCH</label>\n <div class=\"col-6\">\n <input class=\"form-control\" id=\"MCH\" name=\"MCH\" placeholder=\"Mean Cell Hemoglubine\" type=\"text\" >\n </div>\n </div>\n\n </form>\n `\n\n let modal_footer = `\n <button id=\"add_cbc_button\" type=\"submit\" name=\"add\" class=\"btn btn-outline-primary btn-block\">Add</button>\n <button type=\"button\" name=\"cancel\" class=\"btn btn-outline-info btn-block\" data-dismiss=\"modal\">Cancel</button>\n `\n\n let add_cbc_modal = createModal(\"add_cbc_modal\", modal_header, modal_body, modal_footer);\n\n return add_cbc_modal\n }", "function getItemData(infos) {\n $.ajax ({\n url: \"http://www.omdbapi.com/?apikey=858501f8&i=\" + infos,\n dataType: \"json\",\n success: function(res) {\n\n //Affichage du modal\n modalContainer.style.display = \"block\";\n\n\n image2 = res.Poster\n synopsis = res.Plot\n runtime = res.Runtime\n genre = res.Genre\n real = res.Director\n scenario = res.Writer\n actors = res.Actors\n language = res.Language\n country = res.Country\n\n // Réinitialisation des données\n modalContainer.style.display = \"inline\" // Enleve le display none de fermeture\n\n\n var modal = document.createElement(\"div\")\n var boxImg2 = document.createElement(\"div\")\n var modalImg = document.createElement(\"img\")\n var modalInfos = document.createElement(\"div\")\n modalInfos.setAttribute('id', \"ID\")\n var modalSynopsis = document.createElement(\"span\")\n var modalRuntime = document.createElement(\"span\")\n var modalGenre = document.createElement(\"span\")\n var modalReal = document.createElement(\"span\")\n var modalScenar = document.createElement(\"span\")\n var modalAct = document.createElement(\"span\")\n var modalLanguage = document.createElement(\"span\")\n var modalCountry = document.createElement(\"span\")\n\n modalImg.src = image2\n modalSynopsis.appendChild(document.createTextNode(\"Synopsis : \" + synopsis))\n modalRuntime.appendChild(document.createTextNode(\"Durée : \" + runtime))\n modalGenre.appendChild(document.createTextNode(\"Genre : \" + genre))\n modalReal.appendChild(document.createTextNode(\"Réalisateur : \" + real))\n modalScenar.appendChild(document.createTextNode(\"Scénario : \" + scenario))\n modalAct.appendChild(document.createTextNode(\"Avec : \" + actors))\n modalLanguage.appendChild(document.createTextNode(\"Langues : \" + language))\n modalCountry.appendChild(document.createTextNode(\"Pays : \" + country))\n\n boxImg2.appendChild(modalImg)\n modalInfos.appendChild(boxImg2)\n modalInfos.appendChild(modalSynopsis)\n modalInfos.appendChild(modalRuntime)\n modalInfos.appendChild(modalGenre)\n modalInfos.appendChild(modalReal)\n modalInfos.appendChild(modalScenar)\n modalInfos.appendChild(modalAct)\n modalInfos.appendChild(modalLanguage)\n modalInfos.appendChild(modalCountry)\n modal.classList.add(\"modal\")\n boxImg2.classList.add(\"boxImg2\")\n modalImg.classList.add(\"modalImg\")\n modalInfos.classList.add(\"modalContent\")\n modalSynopsis.classList.add(\"modalSynopsis\")\n modalRuntime.classList.add(\"modalRuntime\")\n modalGenre.classList.add(\"modalGenre\")\n modalReal.classList.add(\"modalReal\")\n modalScenar.classList.add(\"modalScenar\")\n modalAct.classList.add(\"modalAct\")\n modalLanguage.classList.add(\"modalLanguage\")\n modalCountry.classList.add(\"modalCountry\")\n movieModal.appendChild(modalInfos)\n }\n });\n}", "async function createCWInvModal() {\n const modal = await modalController.create({\n component: \"inv-cw-modal\",\n cssClass: \"CWInvModal\",\n });\n\n var settings = {\n \"url\": `http://localhost:8080/api/caseworker/inventory/detail/${storedButtonID}`,\n \"method\": \"GET\",\n \"timeout\": 0,\n };\n \n $.ajax(settings).done(function (response) {\n var dataArray2 = JSON.parse(response);\n console.log(dataArray2);\n\n document.getElementById(\"cwInvDonorName\").innerHTML = dataArray2[0].donor_name + \" | \" + dataArray2[0].donor_id;\n document.getElementById(\"cwInvItemName\").innerHTML = dataArray2[0].item_name + \" | \" + dataArray2[0].item_id;\n document.getElementById(\"cwInvItemLocation\").innerHTML = dataArray2[0].item_location;\n document.getElementById(\"cwInvRepairFre\").innerHTML = dataArray2[0].repair_frequency;\n document.getElementById(\"cwInvRepairSta\").innerHTML = dataArray2[0].repair_status;\n document.getElementById(\"cwInvRepairType\").innerHTML = dataArray2[0].repair_type;\n document.getElementById(\"cwInvItemStatus\").innerHTML = dataArray2[0].item_status;\n\n for (var i = 0; i < dataArray2.length; i++){\n document.getElementById(\"cwInvStaHist\").append(dataArray2[i].item_status+\", \");\n document.getElementById(\"cwInvLocHist\").append(dataArray2[i].item_location+\", \");\n document.getElementById(\"cwInvDateHist\").append(dataArray2[i].item_date+\", \");\n \n }\n\n });\n\n await modal.present();\n currentModal = modal;\n}", "function createModal(elem, eventDate, eventName, eventDesc) {\n\t\telem.onclick = function () {\n\t\t\tvar modal = $(\"#modal\")[0];\n\t\t\tmodal.style.display = \"block\";\n\t\t\tmodal.onclick = function () {\n\t\t\t\tmodal.style.display = \"none\";\n\t\t\t}\n\t\t\tvar html = \"<div id='modal-content'>\";\n\t\t\thtml += \"<h3>\";\n\t\t\thtml += eventName;\n\t\t\thtml += \"</h3>\";\n\t\t\thtml += \"<p>\";\n\t\t\thtml += eventDesc;\n\t\t\thtml += \"</p>\";\n\t\t\thtml += \"<a href='tickets.php'>\";\n\t\t\thtml += \"Buy now!\";\n\t\t\thtml += \"</a>\";\n\t\t\thtml += \"</div>\";\n\t\t\tmodal.innerHTML = html;\n\t\t}\n\t}", "function fnCriarModalHtml(prmjsStatic,prmClasseTamanho) {\n prmjsStatic = ((prmjsStatic == 'S') ? 'data-backdrop=\"static\"' : '');\n prmClasseTamanho = ((prmClasseTamanho == '' || prmClasseTamanho == null) ? 'custom-size-modal_400x600' : prmClasseTamanho);\n var vhtml = \"\";\n vhtml += '<div class=\"modal fade\" ' + prmjsStatic + ' id=\"modalBootstrap\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"modalBootstrapLabel\">';\n vhtml += ' <div class=\"modal-dialog modal-sm\">';\n vhtml += ' <div class=\"modal-content ' + prmClasseTamanho + '\">';\n vhtml += ' <div class=\"modal-header\">';\n vhtml += ' <button type=\"button\" id=\"btn_closeModalBootstrap\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span aria-hidden=\"true\">&times;</span></button>';\n vhtml += ' <h4 class=\"modal-title\" id=\"modalBootstrapLabel\"></h4>';\n vhtml += ' </div>';\n vhtml += ' <div class=\"modal-body\">';\n vhtml += ' <div class=\"container-fluid\" >';\n vhtml += ' <div class=\"row\">';\n vhtml += ' <div class=\"col-md-12\">';\n vhtml += ' <h4 id=\"modal-container-title\"></h4>';\n vhtml += ' <div id=\"modalSubtitle\" class=\"modal-subtitle\"></div>';\n vhtml += ' <hr />';\n vhtml += ' <div id=\"modal_container\">';\n vhtml += ' <div id=\"modal_container_resp\"></div>';\n vhtml += ' <div id=\"modal_container_contents\" style=\"border:1px none #ff0000;\">';\n vhtml += ' </div>';//<!-- /.modal_container_contents -->\n vhtml += ' </div>';\n vhtml += ' </div>';\n vhtml += ' </div>';\n vhtml += ' </div>';\n vhtml += ' </div>';\n vhtml += ' <div class=\"modal-footer\">';\n vhtml += ' </div>';\n vhtml += ' </div>';//<!-- /.modal-content -->\n vhtml += ' </div>';//<!-- /.modal-dialog -->\n vhtml += '</div>';//<!-- /.modal -->\n $(\"#section_modal\").append(vhtml);\n fnReinicializaControlesModal();\n }", "function display_success_msg() {\n let modal_environment = document.getElementById(\"success_msg\");\n modal_environment.className = \"modal_environment\";\n let modal_box = document.createElement(\"div\");\n modal_box.className = \"headband modal_box\";\n let msg_div = document.createElement(\"div\");\n msg_div.append(\"Su formulario ha sido enviado correctamente.\")\n let continue_button = document.createElement(\"button\");\n continue_button.type = \"button\";\n continue_button.className = \"accept_button\";\n continue_button.append(\"Continuar\");\n continue_button.addEventListener('click', function () {\n modal_environment.innerHTML = \"\";\n modal_environment.className = \"\";\n location.href = \"index.py\";\n })\n modal_box.append(msg_div, continue_button);\n modal_environment.append(modal_box);\n}", "function showPleaseWait() {\n var modalLoading = '<div class=\"modal\" id=\"pleaseWaitDialog\" data-backdrop=\"static\" data-keyboard=\"false role=\"dialog\">\\\n <div class=\"modal-dialog\">\\\n <div class=\"modal-content\">\\\n <div class=\"modal-header\">\\\n <h4 class=\"modal-title\">잠시만 기대려 주세요.</h4>\\\n </div>\\\n <div class=\"modal-body\">\\\n <div class=\"progress\">\\\n <div class=\"progress-bar progress-bar-success progress-bar-striped active\" role=\"progressbar\"\\\n aria-valuenow=\"100\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width:100%; height: 40px\">\\\n </div>\\\n </div>\\\n </div>\\\n </div>\\\n </div>\\\n</div>';\n$(document.body).append(modalLoading);\n$(\"#pleaseWaitDialog\").modal(\"show\");\n}", "function createModal(employee){\n let modal =\n `<div class=\"modal-container\">\n <div class=\"modal\">\n <button type=\"button\" id=\"modal-close-btn\" class=\"modal-close-btn\"><strong>X</strong></button>\n <div class=\"modal-info-container\">\n <img class=\"modal-img\" src=\"${employee.picture.large}\" alt=\"profile picture\">\n <h3 id=\"name\" class=\"modal-name cap\">${employee.name.first} ${employee.name.last}</h3>\n <p class=\"modal-text\">${employee.email}</p>\n <p class=\"modal-text cap\">${employee.location.city}</p>\n <hr>\n <p class=\"modal-text\">${employee.phone}</p>\n <p class=\"modal-text\">${employee.location.street.number} ${employee.location.street.name}, ${employee.location.city}, ${employee.location.state} ${employee.location.postcode}</p>\n <p class=\"modal-text\">Birthday: ${employee.dob.date.slice(5,7)}/${employee.dob.date.slice(8,10)}/${employee.dob.date.slice(0,4)}</p>\n </div>\n </div>\n </div>`;\n \n gallery.insertAdjacentHTML('afterend', modal);\n\n const modalCont = document.querySelector('.modal-container');\n const closeButton = document.querySelector('.modal-close-btn');\n closeButton.addEventListener('click', (e) => {\n modalCont.remove();\n }) \n \n}", "async function createInvAdminModal() {\n const modal = await modalController.create({\n component: \"inv-admin-modal\",\n cssClass: \"invAdminModal\",\n });\n\n var settings = {\n \"url\": `http://localhost:8080/api/admin/inventory/detail/${storedButtonID}`,\n \"method\": \"GET\",\n \"timeout\": 0,\n };\n \n $.ajax(settings).done(function (response) {\n var dataArray2 = JSON.parse(response);\n console.log(dataArray2);\n\n document.getElementById(\"adminInvDonorName\").innerHTML = dataArray2[0].donor_name + \" | \" + dataArray2[0].donor_id;\n document.getElementById(\"adminInvItemName\").innerHTML = dataArray2[0].item_name + \" | \" + dataArray2[0].item_id;\n document.getElementById(\"adminInvLocation\").innerHTML = dataArray2[0].item_location;\n document.getElementById(\"adminInvRepairFre\").innerHTML = dataArray2[0].repair_frequency;\n document.getElementById(\"adminInvRepairSta\").innerHTML = dataArray2[0].repair_status;\n document.getElementById(\"adminInvRepairType\").innerHTML = dataArray2[0].repair_type;\n document.getElementById(\"adminInvStatus\").innerHTML = dataArray2[0].item_status;\n\n for (var i = 0; i < dataArray2.length; i++){\n document.getElementById(\"adminInvStaHist\").append(dataArray2[i].item_status+\", \");\n document.getElementById(\"adminInvLocHist\").append(dataArray2[i].item_location+\", \");\n document.getElementById(\"adminInvDateHist\").append(dataArray2[i].item_date+\", \");\n \n }\n\n });\n\n \n await modal.present();\n currentModal = modal;\n}", "function addUser(){\n $('.modal-header').find('span').html(\"New User\");\n $('.modal-body').load('addUser.html');\n $('.modal, .modal-backdrop').fadeIn('normal');\n $('.modal-footer').html('<button onclick=\"userModalSubmit()\">OK</button>');\n}", "function newElementProducts(producto){\n //CARD Y MODAL DE PRODUCTOS\n return `<div id=\"productsCard${producto.id}\" class=\"card col-lg-4 col-md-6 col-sm-6 col-12 card__style__products\">\n <img src=\"${producto.imagen}\" class=\"card-img-top img-fluid\">\n <div class=\"card-body\">\n <h3 class=\"card-title\">${producto.nombre}</h3>\n <p class=\"card-text\">Precio: $ ${producto.precio}</p>\n <button id=\"btnAdd${producto.id}\" type=\"button\" class=\"btn btn-secondary\">Seleccionar</button>\n <button id=\"btnDescription\" type=\"button\" class=\"btn btn-secondary\" data-toggle=\"modal\" data-target=\"#Modal${producto.id}\">Descripción</button>\n </div>\n </div>\n \n <div class=\"modal fade\" id=\"Modal${producto.id}\" tabindex=\"-1\" aria-labelledby=\"exampleModalLabel\" aria-hidden=\"true\">\n <div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <h3 class=\"modal-title\" id=\"modalLabel\">${producto.nombre}</h3>\n <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body\">\n <div class=\"container-fluid\">\n <div class=\"row\">\n <img src=\"${producto.imagen}\" width=\"300\" class=\"mx-auto img-fluid mb-4\">\n <p class=\"text-justify mx-4\">${producto.descripcion}</p>\n <p class=\"text-justify mx-4\"><strong>Precio: $ ${producto.precio}</strong></p>\n </div>\n </div>\n </div>\n <div class=\"modal-footer\">\n <button type=\"button\" class=\"btn btn-secondary\" data-dismiss=\"modal\">Cerrar</button>\n </div>\n </div>\n </div>\n </div>`;\n}", "function add(div,url)\r\n{ $('#btn_guardar').removeAttr('data-dismiss');\r\n\tif (validate_in())\r\n\t{\t$('#btn_guardar').attr('data-dismiss','modal');\r\n\t\tvar ruta_imagenes=document.getElementById('ruta_imagenes').value;\r\n\t\tdocument.getElementById( div ).innerHTML='<br><div align=\"center\" style=\"height:100%;\"><i style=\"font-size:large;color:darkred;\" class=\"fa fa-cog fa-spin\"></i></div>';\r\n\t\tvar data = new FormData();\r\n\t\tdata.append('event', 'set');\r\n\t\tdata.append('usua_codigo', document.getElementById('username_add').value);\r\n\t\tdata.append('usua_nombres', document.getElementById('nombres_add').value);\r\n\t\tdata.append('usua_apellidos', document.getElementById('apellidos_add').value);\r\n\t\tdata.append('usua_correo', document.getElementById('correo_add').value);\r\n\t\tdata.append('rol_codigo', document.getElementById('cmb_roles_add').value);\r\n\t\t\r\n\t\tvar xhr = new XMLHttpRequest();\r\n\t\txhr.open('POST', url , true);\r\n\t\txhr.onreadystatechange=function()\r\n\t\t{ if (xhr.readyState==4 && xhr.status==200)\r\n\t\t\t{ busca(\"\",div,url);\r\n\t\t\t} \r\n\t\t};\r\n\t\txhr.send(data);\r\n\t}\r\n}" ]
[ "0.74427956", "0.72275966", "0.710669", "0.7074965", "0.7026188", "0.69933385", "0.69156855", "0.6837551", "0.6785633", "0.6733064", "0.67140305", "0.66620874", "0.66341144", "0.659592", "0.65889287", "0.6588722", "0.6525796", "0.65159184", "0.64908737", "0.6489671", "0.6463164", "0.64227766", "0.64166695", "0.64096206", "0.64087313", "0.63920814", "0.63720804", "0.6367952", "0.63577324", "0.63546765", "0.63352835", "0.63228834", "0.6310857", "0.62899286", "0.6289195", "0.62798876", "0.6275048", "0.6272765", "0.62641853", "0.6259358", "0.62499803", "0.62498885", "0.62492114", "0.62425804", "0.6237429", "0.6215942", "0.61897504", "0.61738455", "0.61555904", "0.614281", "0.6129843", "0.61295027", "0.61162627", "0.6104459", "0.60945463", "0.60945034", "0.6086005", "0.6085613", "0.60850227", "0.60821265", "0.6078484", "0.6075853", "0.60743827", "0.6071566", "0.60707724", "0.6067056", "0.60646343", "0.60635245", "0.60630935", "0.60626626", "0.60454", "0.6040407", "0.6033474", "0.6021604", "0.6015772", "0.60155904", "0.6001722", "0.5986213", "0.59847337", "0.5984453", "0.59787333", "0.5967775", "0.5965143", "0.5960137", "0.59566015", "0.5953874", "0.59533566", "0.5940818", "0.59278154", "0.59230304", "0.59191823", "0.59128493", "0.59083545", "0.59034085", "0.59033126", "0.58955896", "0.5894927", "0.5883881", "0.5879186", "0.5879148", "0.58773434" ]
0.0
-1
remove the created div when this Modal Component is unmounted Used to clean up the memory to avoid memory leak
componentWillUnmount() { modalRoot.removeChild(this.element); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "destroy() {\n $.removeData(this.element[0], COMPONENT_NAME);\n }", "destroy() {\n this.teardown();\n $.removeData(this.element[0], COMPONENT_NAME);\n }", "destroy() {\n this._componentRef.destroy();\n }", "destroy() {\n if (!this.isDestroyed) {\n this.uiWrapper.parentNode.removeChild(this.uiWrapper);\n this.emitEvent('destroyed', this.id);\n this.isDestroyed = true;\n }\n }", "onRemove() {\n if (this.div_) {\n this.div_.parentNode.removeChild(this.div_);\n this.div_ = null;\n }\n }", "destroy() {\n this.modalPanel.destroy();\n this.fields = null;\n this.classes = null;\n }", "componentWillUnmount() {\n // Cleans up Blaze view\n Blaze.remove(this.view);\n }", "destroy()\n {\n this.div = null;\n\n for (let i = 0; i < this.children.length; i++)\n {\n this.children[i].div = null;\n }\n\n window.document.removeEventListener('mousemove', this._onMouseMove);\n window.removeEventListener('keydown', this._onKeyDown);\n\n this.pool = null;\n this.children = null;\n this.renderer = null;\n }", "destroy () {\n this.getElement().remove()\n }", "_destroy() {\n this._root.unmount();\n this._container.off('open', this._render, this);\n this._container.off('destroy', this._destroy, this);\n }", "destroy() {\n delete this.root.dataset.componentId;\n }", "destroy() {\n this.disconnect()\n this.element.remove();\n }", "function doDestroy()\n {\n $(\"#\" + _containerId).remove();\n }", "remove() {\n ReactDOM.unmountComponentAtNode(this.container);\n super.remove();\n }", "function onunmount () {\n removeNativeElement()\n currentElement = null\n }", "destroy() {\n // this.group = null;\n this.$el = null;\n }", "destroy() {\n\t\tthis._container.removeEventListener('mousewheel',this._mouseWheelListener);\n\t\twindow.removeEventListener('resize',this._resizeListener);\n\t\tthis._mc.destroy();\n\t\tthis._container = null;\n\t}", "unmounted(el, binding) {\n const masonryId = binding.value || defaultId\n emitter.emit(`${EVENT_DESTROY}__${masonryId}`)\n }", "destroy () {\n // unbind event handlers and clear elements created\n }", "destroy() {\n this.element.remove();\n // this.subscriptions.dispose();\n }", "componentWillUnmount() {\n var element = ReactDOM.findDOMNode(this);\n this.getChartState().d3component.destroy(element);\n }", "destroy()\n\t{\n\t\tthis.element.remove();\n\t\tthis.modalPanel.destroy();\n\t}", "destroy(){\n\t\tthis._wrapper.innerHTML = '';\n\t\tthis._wrapper.classList.remove('mvc-wrapper', 'mvc-stylised');\n\t}", "unmount() {\n let me = this;\n\n Neo.currentWorker.promiseMessage('main', {\n action : 'updateDom',\n appName: me.appName,\n deltas : [{\n action: 'removeNode',\n id : me.vdom.id\n }]\n }).then(() => {\n me.mounted = false;\n }).catch(err => {\n console.log('Error attempting to unmount component', err, me);\n });\n }", "destroy() {\n if (!this.destroyed) {\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n this.destroyed = true;\n this.dispose();\n }\n }", "destroy() {\n this.element.remove();\n this.subscriptions.dispose();\n this.editorSubs.dispose();\n }", "destroy () {\n\t\tthis.options.element.removeEventListener('click', this.onClickToElement);\n\t\tthis.options.element.removeChild(this.options.element.querySelector('.pollsr'));\n\t}", "function onunmount () {\n\t removeNativeElement()\n\t currentElement = null\n\t }", "unMount() {\n this.removeListeners();\n SimpleBar.instances.delete(this.el);\n }", "unMount() {\n this.removeListeners();\n SimpleBar.instances.delete(this.el);\n }", "destroy() {\n this.element.remove();\n this.subscriptions.dispose();\n }", "destroy() {\n this.element.remove();\n this.subscriptions.dispose();\n }", "destroy() {\n this.element.remove();\n this.subscriptions.dispose();\n }", "destroy() {\n this.element.remove();\n this.subscriptions.dispose();\n }", "async destroy(props) {}", "async destroy(props) {}", "destroy () {\n this.element.remove();\n }", "componentWillUnmount() {\n navRoot.removeChild(this.el);\n }", "dispose() {\n\n if (this.popover) {\n this.popover.dispose()\n }\n\n this.$viewport.get(0).remove()\n\n // Null out all properties -- this should not be neccessary, but just in case there is a\n // reference to self somewhere we want to free memory.\n for (let key of Object.keys(this)) {\n this[key] = undefined\n }\n }", "destroy() {\n if (!this.initialised) {\n return;\n }\n\n // Remove all event listeners\n this._removeEventListeners();\n this.passedElement.reveal();\n this.containerOuter.revert(this.passedElement.element);\n\n // Clear data store\n this.clearStore();\n\n // Nullify instance-specific data\n this.config.templates = null;\n\n // Uninitialise\n this.initialised = false;\n }", "destroy() {\n\t\tthis.element.remove();\n\t}", "unmount() {\n if (this._iFrameEl) {\n this._iFrameEl.parentNode.removeChild(this._iFrameEl);\n this._iFrameEl = null;\n this._iFrameOrigin = null;\n this._containerEl = null;\n this._debugMode = false;\n this.removeMessageListener()\n }\n BlueInkEmbed._mounted = false;\n }", "destroy() {\n const self = this;\n const canDestroy = this.element.trigger('beforedestroy');\n\n if (!canDestroy) {\n return;\n }\n\n function destroyCallback() {\n if (self.modalButtons) {\n self.element.find('button').off('click.modal');\n }\n\n if (self.element.find('.detailed-message').length === 1) {\n $('body').off(`resize.modal-${this.id}`);\n }\n\n if (self.settings.trigger === 'click') {\n self.trigger.off('click.modal');\n }\n\n self.element.closest('.modal-page-container').remove();\n $.removeData(self.element[0], 'modal');\n\n $(window).off('popstate.modal');\n }\n\n if (!this.isOpen()) {\n destroyCallback();\n return;\n }\n\n this.element.one('afterclose.modal', () => {\n destroyCallback();\n });\n\n this.close(true);\n }", "destroy() {\n this.panel.remove();\n }", "destroy() {\n this.modalPanel.destroy();\n this.subscriptions.dispose();\n this.selectList.destroy();\n }", "_dispose() {\n\n delete window.FlowUI['_loaders'][this.id];\n\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.destroyTouchHook();\n this.div = null;\n for (var i = 0; i < this.children.length; i++) {\n this.children[i].div = null;\n }\n window.document.removeEventListener('mousemove', this._onMouseMove, true);\n window.removeEventListener('keydown', this._onKeyDown);\n this.pool = null;\n this.children = null;\n this.renderer = null;\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "destroy() {\n this.element.remove();\n }", "unload() {\n this.element.unmount();\n }", "componentWillUnmount(){\n const { closesidePanelBox } = this.props\n closesidePanelBox()\n // clear refresh payment list regularly\n }", "__destroy() {\n this.__removeChildren();\n this.__remove();\n }", "unmounted(el, binding) {\n const masonryId = binding.value || defaultId\n emitter.emit(`${EVENT_REMOVE}__${masonryId}`, {\n 'element': el\n })\n }", "componentWillUnmount() {\n this.hotInstance.destroy();\n }", "destroy() {\n window.removeEventListener('resize', this._boundResizeHandler);\n\n if(this._watcher && this._watcher.type === 'event') {\n document.body.removeEventListener('DOMNodeInserted', this._watcher.handler);\n document.body.removeEventListener('DOMNodeRemoved', this._watcher.handler);\n } else if(this._watcher && this._watcher.type === 'observer') {\n this._watcher.handler.disconnect();\n }\n\n this.rows = [];\n\n [...this.element.children].forEach((child) => {\n child.style.top = '';\n child.style[this.options.direction] = '';\n });\n\n this.options = null;\n this.element.style.height = '';\n this.element = null;\n }", "destroy() {\n document.querySelector('[data-uuid=\"' + this.uuid + '\"]').remove();\n }", "onUnload() {\n\t\tthis.$container.off(this.namespace);\n\t}", "willDestroy() {\n super.willDestroy(...arguments);\n if (!this.args.isInline) {\n this.modal.removeDialog(this.dialogRegistry);\n }\n }", "onRemove() {\n if (this.div_ && this.div_.parentNode) {\n this.hide();\n this.div_.parentNode.removeChild(this.div_);\n this.div_ = null;\n }\n }", "destroy() {\n this.element.remove()\n }", "unmount() {\n this.jquery(\"#\" + this.id).remove();\n this.jquery(window).off(\"click\");\n }", "$_elementQueryMixin_destroy() {\n if (this.$data.$_elementQueryMixin_resizeObserver) {\n this.$data.$_elementQueryMixin_resizeObserver.disconnect();\n }\n }", "detach() {\n delete this._component;\n }", "componentWillUnmount(){\n this.effectControllerGUI.destroy();\n }", "onremove() {\n // Slider and binder\n if(this.binder)\n this.binder.destroy();\n if(this.slider)\n this.slider.destroy();\n\n // Destroy classes & objects\n this.binder = this.slider = this.publication = this.series = this.ui = this.config = null;\n }", "function destroy() {\n document.body.removeChild(_this.background);\n document.body.removeChild(_this.player);\n document.body.classList.remove('modal-open');\n\n delete _this.background;\n delete _this.player;\n delete _this.iframe;\n delete _this.close;\n }", "destroy() {\r\n this.off();\r\n }", "componentWillUnmount() {\n clearTimeout(this._removeTimer);\n }", "destroy() {\n window.removeEventListener('resize', this._updateBoundingRect);\n this.$el.removeEventListener('touchstart', this._handleTouchStart);\n this.$el.removeEventListener('touchmove', this._handleTouchMove);\n this.$el.removeEventListener('touchend', this._handleTouchEnd);\n this.$el.removeEventListener('touchcancel', this._handleTouchEnd);\n // delete pointers\n this.$el = null;\n this.listeners = null;\n }", "onRemove() {\n if (this.containerDiv.parentElement) {\n this.containerDiv.parentElement.removeChild(this.containerDiv);\n }\n }", "onRemove() {\n if (this.containerDiv.parentElement) {\n this.containerDiv.parentElement.removeChild(this.containerDiv);\n }\n }", "destroy() {\n this.subscriptions.dispose();\n this.eventEmitter.dispose();\n this.panel.destroy();\n this.element.remove();\n }", "destroy() {\n this.domElementProvider.destroyCreatedElements();\n }" ]
[ "0.72245914", "0.71879286", "0.70123136", "0.6941995", "0.6914517", "0.691231", "0.6912048", "0.6909787", "0.6885292", "0.6876775", "0.6874604", "0.6846686", "0.6827205", "0.6821308", "0.6811845", "0.67996776", "0.67801577", "0.6775338", "0.67741215", "0.67691034", "0.67415154", "0.6737373", "0.67300946", "0.67147166", "0.66979116", "0.6697667", "0.66965824", "0.6694532", "0.669025", "0.66902214", "0.66847414", "0.66847414", "0.66847414", "0.66847414", "0.6670757", "0.6670757", "0.66673666", "0.665732", "0.66543734", "0.66444135", "0.6641517", "0.6640008", "0.6637295", "0.66335213", "0.66328764", "0.6630916", "0.66242254", "0.66242254", "0.66242254", "0.66242254", "0.66143346", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66084385", "0.66073567", "0.65985423", "0.65955657", "0.6586299", "0.6559793", "0.6559171", "0.65560013", "0.65539885", "0.6553953", "0.65487546", "0.6547531", "0.6538009", "0.65195966", "0.65115535", "0.6506763", "0.64959866", "0.64839655", "0.64836824", "0.64773846", "0.6476196", "0.64731264", "0.64731264", "0.6465279", "0.64631397" ]
0.7750632
0
Navigate to Submit an Ad Page
function gotoSubmitAd() { if (localStorage.getItem('user_id')) { window.location.href = "../dashboard/dashboard.html"; } else { window.location.href = "../login/login.html"; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitPost(post) {\n $.post(\"/api/posts\", post, function() {\n window.location.href = \"/addexercise\";\n });\n }", "function goToSubmit() {\n var element = document.getElementById('car_submit');\n element.scrollIntoView({ behavior: \"smooth\", block: \"end\" });\n }", "function pageOneSubmitPressed() {\r\n window.location.href = \"2nd.html\";\r\n}", "function postDetails(){\n\twindow.location.href = \"../html/post.html\";\n\t\n}", "function postRedirect(){\n\tdocument.getElementById(\"redirect\").submit();\n}", "function goto_next_form() {\n context.current++;\n if (context.current >= context.workflow.length) {\n return finish_survey(); //todo: verify that when going Back and clicking Next this doesn't break the flow\n }\n //Store the incremented value of 'current'\n Survana.Storage.Set('current', context.current, function () {\n //load the next form\n window.location.href = context.workflow[context.current];\n }, on_storage_error);\n }", "function paypalRedirect(){\n\t\t\n\t\tsetTimeout(function() { \t\n\t\t\tdocument.forms['paypal_auto_form'].submit();\n\t\t}, 300);\t\n\t}", "function resultsRedirect(){\n\tresultsForm.submit();\n}", "function submitFormLanding() {\n var TriggeredAction = request.triggeredFormAction;\n if (TriggeredAction !== null) {\n if (TriggeredAction.formId === 'search') {\n search();\n return;\n }\n }\n\n}", "function navSubmitClick (evt) {\n\tconsole.debug('navSubmitClick', evt);\n\thidePageComponents();\n\t$storyAddingForm.show();\n}", "function tf_askSearch(url) {\n\tvar adv = tf_linkObjects[tf_flash_adNum - 1].getAd();\n\ttf_submitClick(tf_flash_adNum, url, adv.trackURL);\n}", "function navSubmitClick(evt) {\n evt.preventDefault();\n console.debug(\"navSubmitClick\", evt);\n navAllStories();\n $newStoryForm.show();\n}", "function submitSearch() {\n hitSelected = document.getElementsByClassName('aa-cursor')[0];\n\n if (hitSelected && searchQuery) {\n const articleUrl = hitSelected.querySelector('a').href;\n window.location.assign(articleUrl);\n } else if (!hitSelected && searchQuery && hits) {\n window.location.assign(`{{ site.url }}/search?query=${searchQuery}`);\n }\n }", "function postPage() {\n window.location = \"../createPost.html\";\n}", "function navSubmitClick(evt) {\n console.debug('navSubmitClick', evt)\n hidePageComponents()\n putStoriesOnPage()\n $submitForm.show()\n $allStoriesList.prepend($submitForm)\n}", "function onClickSubmit() {\n location.href = \"./student-submit-quest.html?questid=\" + questID + \"&userid=\" + userID;\n}", "function gotoViewAd(ID){\r\n window.location.href = \"/view_ads.html?ad_id=\" + String(ID);\r\n}", "function submitRecord() {\n var url_string = window.location.href\n var url = new URL(url_string);\n var contract_id = Number(url.searchParams.get(\"contract_id\"));\n addPoSubmit(contract_id)\n}", "function gotoViewAd(ID) {\r\n window.location.href=\"/view_ads.html?ad_id=\" + String(ID);\r\n}", "function gotoViewAd(ID) {\r\n window.location.href=\"/view_ads.html?ad_id=\" + String(ID);\r\n}", "function goBack()\n{\n if (document.forms[0].calledFrom.value==\"onGoingProjects\")\n {\n document.forms[0].action=\"/ICMR/allocatorAbstract.do?hmode=ongoingDetails\";\n }\n else if (document.forms[0].calledFrom.value==\"fullPaper\")\n {\n document.forms[0].action=\"/ICMR/saveSemiModified.do\"; //name of action which takes to allocator full paper\n }\n \n document.forms[0].submit();\n}", "function approvedPost() {\n\tdocument.getElementById(\"form-approved-post\").submit();\n}", "function submitClicked () {\n retrieveInput();\n changePage();\n}", "function submit(){\n\t/* MAKE URL */\n\tvar selectedStr = selected.toString();\n\twindow.location.href = makeQueryString()+\"&submit=\";\n}", "function auto_next_course_action(form) {\n var element_text = $('#auto_next_course_button').html();\n if (element_text == 'AUTO FILL COURSES') {\n autoCourse();\n return false;\n } else if (element_text == 'NEXT STEP') {\n submitCourse(form);\n return true;\n }\n}", "function goToTaskForm() {\n window.location.href = TASK_CREATOR + '?id=' + projectID;\n}", "function setUpSurvey(ob) {\r\n\tif (ob.value != '') {\r\n\t\twindow.location.href = app_path_webroot+\"Surveys/create_survey.php?pid=\"+pid+\"&view=showform&page=\"+ob.value;\r\n\t}\r\n}", "function submitCustomerInfo(Post){\n $.post(\"/api/customerposts/\", Post, function(){\n window.location.href = \"/customer\"\n \n })\n }", "function submitPost(Post) {\n $.post(\"/event\", Post, function() {\n window.location.href = \"/event\";\n });\n }", "function newLocation() {\r\n\tdocument.location.href = \"http://www.\" + adURL[thisAd];\r\n\treturn false;\r\n}", "function toDoTaskForm(url, businessType) {\n\twindow.location.href = contextPath + \"/\" + url + '&businessType='\n\t\t\t+ businessType;\n}", "function submitMessage() {\r\n\t$(\"#contact form input, #contact form textarea\").hide();\r\n\t$(\"#contact form\").append(\"<strong>Thank you, we'll be in touch shortly!</strong>\");\r\n _gaq.push(['_trackPageview', '/thankyou']);\r\n\tdocument.getElementById(\"google-adwords-fake-target\").src = \"thank-you.html\";\r\n}", "function postMatches(form){\n var xhttp = new XMLHttpRequest()\n xhttp.onreadystatechange = function(){\n if(this.readyState == 4 && this.status == 200){\n window.location.href = '/ThankYou'\n }\n }\n xhttp.open(form.method, form.action, true)\n xhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')\n xhttp.send(makeUrlEncoded(form))\n return false\n}", "function goToPage($this){\n if($this.val() !== null){document.location.href = $this.val()}\n }", "function goToPage($this){\n if($this.val() !== null){document.location.href = $this.val()}\n }", "function showPage(link)\n{\n mainlink = link.substring(1,(link.length-1))\n splitlinks = mainlink.split(\"&\");\n for(i=0;i<(splitlinks.length-1);i++)\n {\n splitvalues = splitlinks[i].split(\"=\");\n if(!storePageDetails(splitvalues[0],splitvalues[1]))\n {\n return;\n }\n }\n document.pagexform.submit(); \n}", "function goToForm() {\n history.push('/form');\n }", "function handleSubmit(e){\r\n //stopping the page from refreshin after submitting\r\n e.preventDefault();\r\n if(cartButton.innerHTML===\"Add to Cart\")\r\n //redirecting the user to \"modal1\"\r\n window.location.replace(\"#modal1\");\r\n\r\n else if (cartButton.innerHTML===\"Checkout Now\")\r\n //redirecting the user to \"checkoutModal\"\r\n window.location.replace(\"#checkoutModal\");\r\n\r\n else\r\n //redirecting the user to \"modal1\"\r\n window.location.replace(\"#modal1\");\r\n }", "function UPay_Pay()\n{\n\t$('a.UPay_Pay').click(function() {\n\t\tvar self = this;\n\t\t$(self).parents('span:first').children('#upay_div').children('form:first').submit();\n\t});\n}", "function next_step() {\n\t//just to prevent submission\n\tevent.preventDefault();\n\t//true means it comes as next step\n\tpopup(true);\n}", "function submit(e) {\n if (Searcher.validate()) {\n $('#hSearch').value(\"\");\n $('#hScrollPosition').value(0);\n doPostBack(Searcher.generateUrl());\n }\n }", "function goToGetAnswers() {\n window.location.href = \"getAnswers.php\";\n}", "function submitEdit() {\n\treadEditorFields(editingPage)\n\tme.postPage(editingPage, function(e, resp) {\n\t\tif (e) {\n\t\t\talert(\"ERROR\")\n\t\t} else {\n\t\t\twindow.location.hash = \"#pages/\"+resp.id\n\t\t\tcleanUpEditor()\n\t\t}\n\t})\n}", "function nextPage(targetPage){\n\n switch(targetPage) {\n case \"things\":\n window.location = \"thingsToDoPage.html?parkCode=\" + parkCode + \"&parkName=\" + parkName;\n break;\n case \"learn\":\n window.location = \"learnMorePage.html?parkCode=\" + parkCode + \"&parkName=\" + parkName;\n break;\n }\n}", "function submit_OnClick(){\n\n // var bill_no = document.getElementById(\"bill\").value;\n // var expense = document.getElementById(\"expense\").value;\n // var individual_expense = expense/(billsData.length);\n\n \n // window.location.href = \"../../../Documents/Study/Flipkart_task/List.html?var1=\"+card_no;\n window.location.href = \"../../../Documents/Study/Cleartrip/List.html\";\n }", "'.save click'() {\n this.saveContact();\n Navigator.openParentPage();\n\n // Prevent the default submit behavior\n return false;\n }", "function redirectToHome(){\n\t\t\t\tvar form; // dynamic form that will call controller\t\n\t\t\t form = $('<form />', {\n\t\t\t action: \"dashboard.html\",\n\t\t\t method: 'get',\n\t\t\t style: 'display: none;'\n\t\t\t });\n\t\t\t //Form parameter insightId\n\t\t\t $(\"<input>\").attr(\"type\", \"hidden\").attr(\"name\", \"googleSession\").val(googleStatus).appendTo(form);\n\t\t\t //Form submit\n\t\t\t form.appendTo('body').submit();\n\t\t\t}", "function nextSearch(){\r\n\t\t//var url = showTimeUrl+'?q='+document.getElementById('q').value;\r\n\t\t\r\n\t\tvar url = showTimeUrl;\r\n\t\tdocument.getElementById('txtHidden').value = param;\r\n\t\tdocument.getElementById('featureList').value = featureListString ;\r\n\r\n\t\tdocument.searchform.action =url ;\r\n\t\tdocument.searchform.submit();\r\n\t\ttextNew = 'true';\r\n}", "function forwardPageAfterSignUp(){\n setTimeout(\"window.location ='/goals'\",1000);\n}", "function navShowSubmitForm(evt) {\n // console.debug(\"navShowSubmitForm\", evt);\n evt.preventDefault();\n // on click, show() the hidden stories form\n $submitForm.show();\n}", "function redirect(value, page) {\n var form = document.getElementById(\"operation\");\n var input = document.getElementsByName(\"action\");\n \n input[0].value = value;\n form.action = page;\n form.submit();\n}", "function submitGet(mixFormElement, strUrlBase)\n{\n var mixUrl = getUrlForm(mixFormElement, strUrlBase);\n if (mixUrl === false)\n return mixUrl;\n window.location.href = mixUrl;\n return true;\n}", "function navSubmitClick(evt) {\n console.debug('navSubmitClick')\n hidePageComponents()\n $allStoriesList.show()\n addStoryForm.classList.remove('hidden')\n}", "function footerStoreLocatorFormSubmit() {\n if (!window.location.origin) {\n \twindow.location.origin = window.location.protocol + \"//\" + window.location.hostname + (window.location.port ? ':' + window.location.port: '');\n }\n var newLocation = window.location.origin + \"/\" + LOCALE + \"/help/store_locator.jsp#!/search/\" + jQuery(\"#footer-findAStore-query\").val();\n\n window.location = newLocation;\n\n return false;\n\n}", "function go(id, param, jsp) {\r\n\t\tvar url ='';\r\n\t\tif(id==\"nadmuRtVUZ\") {\r\n\t\t\turl = getUrl('nadmuRtVUZ',false);\r\n\t\t} else {\r\n\t\t\turl = getUrl(jsp,false);\r\n\t\t}\r\n\t\tif(id!=\"null\") {url=url+\"?id=\"+id}\r\n\t\tdocument.gotopage.action = url;\r\n\t\tdocument.gotopage.param.value=param;\r\n\t\tdocument.gotopage.jspName.value=jsp;\r\n\t\tdocument.gotopage.submit();\r\n\t}", "function redirectPageLoadByURL (myform,redirectURL) {\r\n\tif (myform) {\r\n\t setInnerHTMLbyID (\"redirectInstructions\",autoRedirectText,false);\r\n\t\tmyform.sendDataSubmit.style.visibility=\"hidden\"\r\n\t\twindow.setTimeout (\"window.location.replace('\" + encodeURI(redirectURL) + \"');\",750);\r\n\t\twindow.setTimeout (\"myform.sendDataSubmit.style.visibility = 'visible';\",4500);\r\n\t}\r\n}", "function next(){\n\twindow.location.href = nexturl;\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n }", "function submitCustomer(customer) {\n $.post(\"/api/customers\", customer, function() {\n window.location.href = \"/blog\";\n });\n }", "submit(e) {\n e.preventDefault();\n this.currentStep++;\n this.updateForm();\n document.getElementById('form_donation').submit();\n }", "function submit() {\r\n location.reload(true);\r\n}", "function nav() {\n\t\t var w = document.reflinkform.reflinklist.selectedIndex;\n\t\t var url_add = document.reflinkform.reflinklist.options[w].value;\n\t\t window.location.href = url_add;\n\t\t}", "function goToController(controller) {\r\n\tvar frm = document.forms[0];\r\n\tfrm.action = controller;\r\n\tfrm.submit();\r\n}", "function visitPayPage() {\n localStorage.clear();\n var dirPath = dirname(location.href);\n var fullPath = dirPath + \"/pay.html\";\n window.location = fullPath;\n}", "function ResubmitForm(){\n window.location = \"/signup\";\n}", "function submitReport(report) {\n $.post(\"/api/reports\", report, function() {\n window.location.href = \"/blog\";\n });\n }", "function submitAutoSuggestForm()\n{\n\t// Submit the form.\n\tif (document.getElementById('autoSuggestForm') != null)\n\t{\n\t\tquery = document.getElementById('targetedQuery');\n\t\tif (query != null)\n\t\t{\n\t\t\tif (validateQuery(query.value))\n\t\t\t{\n\t\t\t\tdocument.getElementById('autoSuggestForm').submit();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tquery = document.getElementById('autoSuggestForm:targetedQuery');\n\t\t\tif(query!=null)\n\t\t\t{\n\t\t\t\tif(validateQuery(query.value))\n\t\t\t\t{\n\t\t\t\t\tcategory = document.getElementById('autoSuggestForm:targetedCategory').value;\n\t\t\t\t\turl=jsCBDgetContextRoot()+\"JSP/UtilityBar/Search/SearchGlobalContent.jsf\"; \n\t\t\t\t\turl=jsCBDaddQueryStringParam(url, \"targetedQuery\", encodeURIComponent(query.value)); \n\t\t\t\t\turl=jsCBDaddQueryStringParam(url, \"targetedCategory\", category);\n\t\t\t\t\tjsCBDgoToUrl(url, null, true);\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "goToSignupPage() {\n Linking.openURL('https://signup.sbaustralia.com');\n //Actions.signup();\n }", "async submitBillSearchForm() {\n\t\tthis.checkIfLoggedIn();\n\t\tthis.checkBillSearchForm();\n\t\tconst body = 'vfw_form=szamla_search_submit&vfw_coll=szamla_search_params&regszolgid=&szlaszolgid=&datumtol=&datumig=';\n\t\tawait this.browser.submit('/control/szamla_search_submit', body);\n\t}", "function continueClick(){\n window.location = nextRoom;\n}", "function gotoForm() {\n toggleForm();\n }", "function OnSubmit()\r\n{\r\n\t//pageInAction = true;\r\n\t//window.setTimeout('DisableEnableLinks(true);disableElements();ShowLoader();',1);\r\n\twindow.setTimeout('ShowLoader();',1);\r\n}", "function doSubmit(pOptions){\n apex.submit(pOptions);\n}", "function submitClothing(Clothing) {\n $.post(\"/api/top/\", Clothing, function() {\n window.location.href = \"/blog\";\n });\n }", "function onSubmitted(){\n\t\t\t\t\t\t\t\t\t\t\tlocation.hash = \"/tool/list\";\n\t\t\t\t\t\t\t\t\t\t}", "function gotoURL(location) {document.location=location;}", "function goPage(url) {\n //alert(\"goPage(\" + url + \")\");\n if (url != null) window.location = url;\n}", "function service_entry(complaint_id)\n{\n window.location = \"/customer/service_form/\"+complaint_id;\n}", "onFormSubmit(evt) {\n\t\tevt.preventDefault()\n\t\t//send an axios request to post it to the databse\n\t\taxios({method: 'post',url:`/api/posts/${this.state.fields.location}`, data:{\n\t\t\t...this.state.fields\n\t\t}})\n\t\t//then redirect them to their new post!\n\t\t.then((post)=>{\n\t\t\tif (post.data.success){\n\t\t\t\tthis.props.history.push(`/posts/${post.data.post.location}/${post.data.post._id}`)\n\t\t\t}\n\t\t\telse{\n\t\t\t\talert('Whoops! Something went wrong!')\n\t\t\t}\n\t\t})\n\t}", "function goUpload() {\n window.location.href = \"uploadPage.html\";\n }", "function doFormSubmission(returnUrl) {\n\t\t/*kenyaui.openLoadingDialog({ message: 'Submitting form...' });*/\n\n\t\tvar form = $('#htmlform');\n\n\t\tjQuery.post(form.attr('action'), form.serialize(), function(result) {\n\t\t\tif (result.success) {\n\t\t\t\tui.disableConfirmBeforeNavigating();\n\n\t\t\t\tif (returnUrl) {\n\t\t\t\t\tui.navigate(returnUrl);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tui.reloadPage();\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// Show errors on form\n\t\t\t\tfor (key in result.errors) {\n\t\t\t\t\tshowError(key, result.errors[key]);\n\t\t\t\t}\n\n\t\t\t\t// Keep user on form page to fix errors\n\t\t\t\t/*kenyaui.notifyError('Please fix all errors and resubmit');\n\t\t\t\tkenyaui.closeDialog();*/\n\t\t\t\tsubmitting = false;\n\t\t\t}\n\t\t}, 'json')\n\t\t.error(function(jqXHR, textStatus, errorThrown) {\n\t\t\twindow.alert('Unexpected error, please contact your System Administrator: ' + textStatus);\n\t\t\tconsole.log(errorThrown);\n\t\t});\n\t}", "function fixSubmit1() {\n \n document.results.submit();\n \n}", "function afterSubmit(data) {\r\n\t var form = data.form;\r\n\t var wrap = form.closest('div.w-form');\r\n\t var redirect = data.redirect;\r\n\t var success = data.success;\r\n\r\n\t // Redirect to a success url if defined\r\n\t if (success && redirect) {\r\n\t Webflow.location(redirect);\r\n\t return;\r\n\t }\r\n\r\n\t // Show or hide status divs\r\n\t data.done.toggle(success);\r\n\t data.fail.toggle(!success);\r\n\r\n\t // Hide form on success\r\n\t form.toggle(!success);\r\n\r\n\t // Reset data and enable submit button\r\n\t reset(data);\r\n\t }", "function goToFormPage(formType, formIndex) {\n document.getElementById(\"next-button\").innerText = \"Next\";\n switch (formType) {\n case \"SelectAnomalyTypes\":\n if (formIndex < elementSeedForms.length && elementSeedForms[formIndex].selected) {\n elementSeedIndex = formIndex;\n terrainModificationIndex = -1;\n anomalyIndex = -1;\n loadElementSeedForm();\n }\n break;\n case \"terrain-modification\":\n if (formIndex < terrainModificationForms.length && terrainModificationForms[formIndex].selected) {\n elementSeedIndex = elementSeedForms.length;\n terrainModificationIndex = formIndex;\n anomalyIndex = -1;\n loadTerrainModificationForm();\n }\n break;\n case \"anomaly\":\n if (formIndex < anomalyForms.length && anomalyForms[formIndex].selected) {\n elementSeedIndex = elementSeedForms.length;\n terrainModificationIndex = terrainModificationForms.length;\n anomalyIndex = formIndex;\n loadAnomalyForm();\n }\n break;\n }\n}", "async function onFormSubmit(e) {\n try {\n e.preventDefault();\n await fetch(`${process.env.REACT_APP_BACKEND_URL}/bookings`, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${localStorage.getItem(\"token\")}`,\n },\n // new booking is taking the information from create session and automatically entering it in a form\n body: JSON.stringify({\n time: location.state.time,\n name: location.state.name,\n date: location.state.date,\n day: location.state.day,\n }),\n });\n console.log(e);\n //fetch stripe payments page using local host\n const stripe = await stripePromise;\n const response = await fetch(\n `${process.env.REACT_APP_BACKEND_URL}/charges`,\n {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${localStorage.getItem(\"token\")}`,\n },\n }\n );\n\n const stripeId = await response.json();\n // //When client clicks \"pay\" redirect to checkout\n const result = await stripe.redirectToCheckout({\n sessionId: stripeId.id,\n });\n\n history.push(\"/bookings\");\n } catch (err) {}\n }", "function redirectToGoogleLogIn(pageType,insightId){\n\t\t\t\tvar form; // dynamic form that will call controller\n\t\t\t form = $('<form />', {\n\t\t\t action: \"googleLogin.html\",\n\t\t\t method: 'post',\n\t\t\t style: 'display: none;'\n\t\t\t });\n\t\t\t //Form parameter pageType\n\t\t\t $(\"<input>\").attr(\"type\", \"hidden\").attr(\"name\", \"pageType\").val(pageType).appendTo(form);\n\t\t\t $(\"<input>\").attr(\"type\", \"hidden\").attr(\"name\", \"insightId\").val(insightId).appendTo(form);\n\t\t\t //Form submit\n\t\t\t form.appendTo('body').submit();\n\n\t\t\t}", "function handleSubmitAnswerButtonClicked() {\n $('.page').on('submit', 'form', function (event) {\n\n event.preventDefault();\n console.log('submit answer button was clicked');\n\n if (STORE.currentQuestion === STORE.quizLength - 1) {\n STORE.button = { class: 'view-results', label: 'View Results' };\n } else {\n STORE.button = { class: 'next-question', label: 'Next Question' };\n console.log(STORE);\n }\n STORE.view = 'feedback';\n //we don't change the STORE.currentQuestion b/c we want it to stay \n STORE.showFeedback = true;\n\n renderPage();\n });\n}", "function referringPage() {\n window.location = quizLink;\n}", "function submitPost(Post) {\n console.log(\"ajax\");\n $.post(\"/new/item\", Post, function() {\n window.location.href = \"/browse/styles/all\";\n});\n}", "async function nextPost (driver){\r\n let nextPostArrow = await driver.findElement(By.css('body > div._2dDPU.CkGkG > div.EfHg9 > div > div > a._65Bje.coreSpriteRightPaginationArrow'))\r\n await driver.sleep(2500)\r\n nextPostArrow.click();\r\n console.log(chalk.red(':::::GOING TO NEXT POST::::::'))\r\n }", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}", "function submit() {\n var name = this.search.value.trim();\n location.hash = name ? encodeURIComponent(name) : \"!\";\n this.search.value = \"\";\n d3.event.preventDefault();\n}" ]
[ "0.6617835", "0.6567393", "0.6372224", "0.6305512", "0.62939143", "0.6288367", "0.62680435", "0.6235656", "0.6207745", "0.6203159", "0.6171488", "0.611962", "0.61175114", "0.6093927", "0.6084791", "0.6063685", "0.60440403", "0.5987568", "0.59585685", "0.59585685", "0.59500283", "0.59278214", "0.5897213", "0.5890079", "0.585619", "0.5844964", "0.58324367", "0.58303446", "0.58267426", "0.58157766", "0.5791221", "0.5788747", "0.57764405", "0.5768552", "0.5768552", "0.5764958", "0.575594", "0.57536525", "0.57333374", "0.57194203", "0.5698294", "0.56874394", "0.5670593", "0.5669744", "0.5663343", "0.5657002", "0.56514883", "0.5649016", "0.5644952", "0.56384903", "0.5629269", "0.562242", "0.5614942", "0.561362", "0.5609713", "0.5608497", "0.5594931", "0.55907077", "0.558368", "0.55745316", "0.55738527", "0.55731714", "0.5569443", "0.5565018", "0.5549439", "0.5544148", "0.5542231", "0.55405176", "0.5536972", "0.55357605", "0.55190104", "0.5512037", "0.55029887", "0.55016977", "0.5474724", "0.54719657", "0.54718935", "0.5463767", "0.54591835", "0.54537886", "0.5444669", "0.54317963", "0.54284835", "0.5428341", "0.54252136", "0.54247457", "0.5424486", "0.54184574", "0.54169375", "0.54158324", "0.5400258", "0.5400258", "0.5400258", "0.5400258", "0.5400258", "0.5400258", "0.5400258", "0.5400258", "0.5400258", "0.5400258" ]
0.6731556
0
region boilerplate / intialization Define a function for initiating a conversation on installation With custom integrations, we don't have a way to find out who installed us, so we can't message them :(
function onInstallation(bot, installer) { if (installer) { bot.startPrivateConversation({user: installer}, function (err, convo) { if (err) { console.log(err); } else { convo.say('I am a bot that has just joined your team'); convo.say('You must now /invite me to a channel so that I can be of use!'); } }); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say(\"Hi there, I'm Taylor. I'm a bot that has just joined your team.\");\n convo.say('You can now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}", "function firstInstallInitiateConversation(bot, team) {\n\n\tvar config = {\n\t\tSlackUserId: team.createdBy\n\t};\n\n\tvar botToken = bot.config.token;\n\tbot = _controllers.bots[botToken];\n\n\tbot.startPrivateConversation({ user: team.createdBy }, function (err, convo) {\n\n\t\t/**\n * \t\tINITIATE CONVERSATION WITH INSTALLER\n */\n\n\t\tconvo.say('Hey! I\\'m Toki!');\n\t\tconvo.say('Thanks for inviting me to your team. I\\'m excited to work together :grin:');\n\n\t\tconvo.on('end', function (convo) {\n\t\t\t// let's save team info to DB\n\t\t\tconsole.log(\"\\n\\nteam info:\\n\\n\");\n\t\t\tconsole.log(team);\n\t\t});\n\t});\n}", "function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.error(err)\n } else {\n convo.say('I am a bot that has just joined your team')\n convo.say('You must now /invite me to a channel so that I can be of use!')\n }\n })\n }\n}", "setupIntegrations() {\n if (this._isEnabled() && !this._integrationsInitialized) {\n this._integrations = integration.setupIntegrations(this._options.integrations);\n this._integrationsInitialized = true;\n }\n }", "function initChat() {\n setConfigurations();\n greet();\n}", "async initializeChat(conversationData, userInfo, botTranscript) {\n var buttonOverrides = new Array(process.env.BUTTON_ID);\n var preChatDetails = this.initializePrechatDetails(userInfo, botTranscript);\n var chasitorInit = this.initializeSalesForceChatObject(preChatDetails, userInfo, conversationData.sessionId, buttonOverrides);\n return await this.salesForceRepo.requestChat(chasitorInit, conversationData.affinityToken,conversationData.sessionKey);\n }", "onFirstInstalled() {\n\n }", "setupIntegrations() {\n if (this._isEnabled() && !this._integrationsInitialized) {\n this._integrations = setupIntegrations(this._options.integrations);\n this._integrationsInitialized = true;\n }\n }", "setupIntegrations() {\n\t if (this._isEnabled() && !this._integrationsInitialized) {\n\t this._integrations = setupIntegrations(this._options.integrations);\n\t this._integrationsInitialized = true;\n\t }\n\t }", "function onInstall() {\n onOpen();\n}", "function onInstall() {\n onOpen();\n}", "function onInstall() {\n onOpen();\n}", "function install() {}", "function install() {}", "function install() {}", "function install() {}", "async function init() {\n inquirer.prompt(questions).then(async function (answers) {\n try {\n logStatus = answers.status;\n configureAccount(answers.account, answers.key);\n if (answers.existingTopicId != undefined) {\n configureExistingTopic(answers.existingTopicId);\n } else {\n await configureNewTopic();\n }\n /* run & serve the express app */\n runChat();\n } catch (error) {\n log(\"ERROR: init() failed\", error, logStatus);\n process.exit(1);\n }\n });\n}", "function onInstall() {\n onOpen();\n}", "constructor() { \n IntegrationUpdateBase.initialize(this);WhatsAppUpdateAllOf.initialize(this);\n WhatsAppUpdate.initialize(this);\n }", "function setupChatChannel(){\n return controller.createChannel()\n .then(data => {\n // Subscribe to incoming chat conversations\n return controller.addSubscription(\n `v2.users.${userId}.conversations.chats`,\n subscribeChatConversation(currentConversationId));\n });\n}", "constructor() { \n \n IntegrationType.initialize(this);\n }", "handleInstall(msg, ports) {\n var thisId = msg.actorId;\n var mainId = msg.mainId;\n var behaviourObject = serialisation_1.reconstructBehaviour({}, msg.vars, msg.methods, msg.methAnnots, this.environment);\n var actorMirror = serialisation_1.reconstructBehaviour({}, msg.mirrorVars, msg.mirrorMethods, msg.mirrorMethAnnots, this.environment);\n actorMirror.bindBase(this.environment, serialisation_1.serialise);\n this.environment.actorMirror = actorMirror;\n serialisation_1.reconstructStatic(behaviourObject, msg.staticProperties, this.environment);\n this.environment.initialise(thisId, mainId, behaviourObject);\n var otherActorIds = msg.otherActorIds;\n var parentRef = new FarRef_1.ClientFarReference(ObjectPool_1.ObjectPool._BEH_OBJ_ID, msg.senderRef[FarRef_1.FarReference.farRefAccessorKey].objectFields, msg.senderRef[FarRef_1.FarReference.farRefAccessorKey].objectMethods, mainId, mainId, this.environment);\n let channelManag = this.environment.commMedium;\n var mainPort = ports[0];\n channelManag.newConnection(mainId, mainPort);\n otherActorIds.forEach((id, index) => {\n //Ports at position 0 contains main channel (i.e. channel used to communicate with application actor)\n channelManag.newConnection(id, ports[index + 1]);\n });\n let stdLib = new ActorSTDLib_1.ActorSTDLib(this.environment);\n this.environment.actorMirror.initialise(stdLib, false, parentRef);\n }", "getOrStartConversation(withUserObj, options) {\n return global.window.Talk.ready.then(\n this.getOrStartConversationOnReady.bind(this, withUserObj, options)\n );\n }", "function install() {\n}", "function initializeConversationSettings() {\n //set welcome message and the persistent menu\n callProfileAPI({\n get_started: {\n payload: responseOperations.START_CONVERSATION,\n },\n });\n\n // Known Facebook bug: limit 3 https://developers.facebook.com/support/bugs/843911579346069/\n callProfileAPI({\n persistent_menu: [\n {\n locale: \"default\",\n composer_input_disabled: false,\n call_to_actions: [\n {\n type: \"postback\",\n title: \"🛍 Shop\",\n payload: responseOperations.SHOP,\n },\n {\n type: \"postback\",\n title: \"💰 Browse deals\",\n payload: responseOperations.DEALS,\n },\n {\n type: \"postback\",\n title: \"📦 Order updates\",\n payload: responseOperations.ORDER_STATUS,\n },\n ],\n },\n ],\n });\n}", "function onInstall(event) {\n Plugins.init();\n \n onOpen(event);\n}", "install() {\n\n }", "function startExtension() {\n\t\tboolean receiverConfirmed = false;\n\n\t\tif (!receiverConfirmed) {\n\t\t\t//sends auto message to see if other person has extension.\n\t\t\tinsertToTextField(firstString);\n\n\t\t\t//sends Key\n\t\t\tinsertToTextField(publicKeyString);\n\n\n\n\t\t}\n\n\t\telse \n\t\t\tinsertToTextField(publicKeyString);\n\t}", "function chatUpdateSetup() {\n var currentRequestPayloadSetter = Api.setRequestPayload;\n Api.setRequestPayload = function(newPayloadStr) {\n currentRequestPayloadSetter.call(Api, newPayloadStr);\n displayMessage(newPayloadStr, settings.authorTypes.user);\n };\n\n var currentResponsePayloadSetter = Api.setResponsePayload;\n Api.setResponsePayload = function(newPayloadStr) {\n currentResponsePayloadSetter.call(Api, newPayloadStr);\n displayMessage(newPayloadStr, settings.authorTypes.watson);\n };\n}", "function init() {\n\n ExtensionUtils.initTranslations();\n\n log(`initializing ${Me.metadata.name} version ${Me.metadata.version}`);\n}", "function chatUpdateSetup() {\n var currentRequestPayloadSetter = Api.setRequestPayload;\n Api.setRequestPayload = function(newPayloadStr) {\n currentRequestPayloadSetter.call(Api, newPayloadStr);\n displayMessage(JSON.parse(newPayloadStr), settings.authorTypes.user);\n };\n\n var currentResponsePayloadSetter = Api.setResponsePayload;\n Api.setResponsePayload = function(newPayloadStr) {\n currentResponsePayloadSetter.call(Api, newPayloadStr);\n displayMessage(JSON.parse(newPayloadStr), settings.authorTypes.watson);\n };\n }", "function Conversation() {}", "function chatUpdateSetup() {\n const currentRequestPayloadSetter = Api.setRequestPayload;\n Api.setRequestPayload = function (newPayloadStr) {\n currentRequestPayloadSetter.call(Api, newPayloadStr);\n displayMessage(JSON.parse(newPayloadStr), settings.authorTypes.user);\n };\n\n const currentResponsePayloadSetter = Api.setResponsePayload;\n Api.setResponsePayload = function (newPayloadStr) {\n currentResponsePayloadSetter.call(Api, newPayloadStr);\n displayMessage(JSON.parse(newPayloadStr), settings.authorTypes.watson);\n };\n }", "async introStep(stepContext) {\n if (!this.luisRecognizer.isConfigured) {\n const messageText = 'NOTE: LUIS is not configured. To enable all capabilities, add `LuisAppId`, `LuisAPIKey` and `LuisAPIHostName` to the .env file.';\n await stepContext.context.sendActivity(messageText, null, InputHints.IgnoringInput);\n return await stepContext.next();\n }\n\n // const weekLaterDate = moment().add(7, 'days').format('MMMM D, YYYY');\n\n const mymessage = await this.sendSuggestedActions(stepContext);\n return await stepContext.prompt('TextPrompt', { prompt: mymessage });\n // eslint-disable-next-line quotes\n // const messageText = stepContext.options.restartMsg ? stepContext.options.restartMsg : `What can I help you with today?\\nYou can check your account and previous transactions, make a transaction, or ask general questions!`;\n // const promptMessage = MessageFactory.text(messageText, messageText, InputHints.ExpectingInput);\n // return await stepContext.prompt('TextPrompt', { prompt: promptMessage });\n\n // return await stepContext.next();\n }", "function loginInitiateConversation(bot, identity) {\n\n\tvar SlackUserId = identity.user_id;\n\tvar botToken = bot.config.token;\n\tbot = _controllers.bots[botToken];\n\n\t_models2.default.User.find({\n\t\twhere: { SlackUserId: SlackUserId }\n\t}).then(function (user) {\n\t\tvar scopes = user.scopes;\n\t\tvar accessToken = user.accessToken;\n\n\n\t\tbot.startPrivateConversation({ user: SlackUserId }, function (err, convo) {\n\n\t\t\t/**\n * \t\tINITIATE CONVERSATION WITH LOGIN\n */\n\t\t\tconvo.say('Awesome!');\n\t\t\tconvo.say('Let\\'s win this day now. Let me know when you want to `/focus`');\n\t\t});\n\t});\n}", "installPromptManager() {\n // Checks if should display install popup notification for iOS\n if (this.isIos()) {\n if (!this.isInStandaloneMode() && this.isA2HSpromptDelayExpired()) {\n const shareImgHtml = '<img class=\"img-icon\" src=\"./pwaicons/ios-share-icon.png\">';\n const addHomeScreenImgHtml = '<img class=\"img-icon\" src=\"./pwaicons/ios-add-new-icon.png\">';\n const buttons = `<div class=\"btn-container\"><button class=\"btn-install\" id=\"install-btn\">Ok</button>\n <button class=\"btn-install--cancel\" id=\"cancel-btn\">${this._config.laterBtnText}</button>`;\n\n const msgContent =\n this._config.msgIosA2HSPrompt\n .replace('<shareImgHtml>', shareImgHtml)\n .replace('<addHomeScreenImgHtml>', addHomeScreenImgHtml) + buttons;\n\n this.showMsg(\n msgContent,\n null,\n false,\n (function (_this) {\n return function () {\n document.getElementById('install-btn').addEventListener('click', _this.hideMsg.bind(_this));\n _this.cancelA2HSprompt(_this);\n }\n })(this)\n );\n }\n } else {\n this.listenToInstallPrompt();\n }\n }", "async function activate(context) {\n const twitcherConfig = workspace.getConfiguration('twitcher')\n\n if (!twitcherConfig.enabled) return\n //#region config\n const twitchConfig = await startupConfig()\n\n if (!twitchConfig.oauth) {\n const askForOAuth = await window.showErrorMessage(\n 'Please Enter a Oauth token for twitch',\n { title: 'Enter Oauth' }\n )\n\n if (askForOAuth) {\n const twitchOAuth = await inputCommands.twitchChatOAuth()\n if (twitchOAuth) {\n localConfig.set(TWITCH_CHAT_OAUTH, twitchOAuth)\n twitchConfig.oauth = twitchOAuth\n }\n }\n }\n\n const twitchChatConfig = {\n options: {\n debug: twitcherConfig.debug\n },\n connection: {\n reconnect: true\n },\n identity: {\n username: twitcherConfig.username,\n password: twitchConfig.oauth\n },\n channels: [`#${twitcherConfig.channel}`]\n }\n //#endregion\n\n /**\n * Initalize\n */\n const bot = new Tmi.client(twitchChatConfig)\n const twitchStatusBar = new TwitchStatusBar(twitcherConfig)\n const twitchApi = new TwitchApi(twitchConfig.clientID)\n\n let soundFile = false\n if (typeof twitcherConfig.notificationSound !== 'boolean') {\n soundFile = resolve(twitcherConfig.notificationSound)\n } else if (twitcherConfig.notificationSound) {\n soundFile = resolve(\n __dirname,\n '..',\n 'resources',\n 'audio',\n 'new_message.wav'\n )\n }\n const notification = new Notification(soundFile)\n bot.connect()\n\n /**\n * Register Data provider\n */\n const twitcherExplorerProvider = new TwticherExplorerProvider()\n window.registerTreeDataProvider('twitcher', twitcherExplorerProvider)\n if (twitcherConfig.counterUpdateInterval) {\n viewerCountUpdater = setInterval(() => {},\n ms(twitcherConfig.counterUpdateInterval))\n }\n\n //#region Register Commands\n const clearConfig = commands.registerCommand('twitcher.clearConfig', () => {\n localConfig.clear()\n })\n context.subscriptions.push(clearConfig)\n\n const switchToChatCommand = commands.registerCommand(\n 'twitcher.switchToChat',\n () => {\n twitcherExplorerProvider.enableChat()\n }\n )\n context.subscriptions.push(switchToChatCommand)\n const oAuthCommand = commands.registerCommand(\n 'twitcher.setOAuth',\n async () => {\n const oAuthToken = await inputCommands.twitchChatOAuth()\n if (oAuthToken) {\n localConfig.set(TWITCH_CHAT_OAUTH, oAuthToken)\n window.showInformationMessage('Twitch OAuth updated')\n }\n }\n )\n context.subscriptions.push(oAuthCommand)\n const clientIDCommand = commands.registerCommand(\n 'twitcher.setClientID',\n async () => {\n const twitchClientID = await inputCommands.twitchClientID()\n if (twitchClientID) {\n localConfig.set(TWITCH_CLIENT_ID, twitchClientID)\n window.showInformationMessage('Twitch Client-ID updated')\n }\n }\n )\n context.subscriptions.push(clientIDCommand)\n\n const explorerReplyCommand = commands.registerCommand(\n 'twitcher.explorerReply',\n async context => {\n const userName = `@${context.label.split(':')[0]}`\n const reply = await window.showInputBox({\n prompt: userName\n })\n\n if (!reply) return\n bot.say(twitcherConfig.channel, `${userName} ${reply}`)\n }\n )\n context.subscriptions.push(explorerReplyCommand)\n\n if (twitchConfig.clientID) {\n const refreshCommand = commands.registerCommand(\n 'twitcher.refreshViewerCount',\n async () => {\n const viewerCount = await twitchApi.getViewerCount()\n twitchStatusBar.setNewCounter(viewerCount)\n }\n )\n context.subscriptions.push(refreshCommand)\n }\n\n const switchToUserListCommand = commands.registerCommand(\n 'twitcher.switchToUserList',\n async () => {\n twitcherExplorerProvider.showLoading('Loading User list')\n const userlist = await twitchApi.getViewerList()\n twitcherExplorerProvider.hideLoading()\n twitcherExplorerProvider.loadUserList(userlist)\n twitchStatusBar.setNewCounter(userlist.length)\n }\n )\n context.subscriptions.push(switchToUserListCommand)\n const sendCommand = commands.registerCommand(\n 'twitcher.sendMessage',\n async () => {\n try {\n const message = await window.showInputBox({\n placeHolder: 'Message to send'\n })\n\n if (message) {\n bot.say(twitcherConfig.channel, message)\n }\n } catch (error) {\n console.error('Failed to send Message', error)\n window.showErrorMessage('Failed to Send Message')\n }\n }\n )\n\n context.subscriptions.push(sendCommand)\n //#endregion\n bot.on('connected', () => {\n commands.executeCommand('twitcher.refreshViewerCount')\n window.showInformationMessage(`Connected to: ${twitcherConfig.channel}`)\n })\n\n bot.on('message', async (channel, userstate, message, self) => {\n //Todo: Add Filter\n switch (userstate['message-type']) {\n case 'chat':\n twitcherExplorerProvider.addChatItem(userstate.username, message)\n\n if (!self) {\n const replyText = await notification.showNotifcation(\n userstate.username,\n message\n )\n if (!replyText) return\n bot.say(\n twitcherConfig.channel,\n `@${userstate.username}: ${replyText}`\n )\n }\n break\n }\n })\n}", "function init() {\n\n inquirer.prompt([\n {\n type: \"list\",\n name: \"teamRole\",\n message: \"What what member would you like to add?\",\n choices: [\"Manager\", \"Engineer\", \"Intern\", \"I am done building my team.\"]\n\n },\n\n ]).then(function (response) {\n switch (response.teamRole) {\n case \"Manager\":\n createManager()\n break;\n case \"Engineer\":\n createEngineer()\n break;\n case \"Intern\":\n createIntern()\n break;\n case \"I am done building my team.\":\n buildMyTeam()\n break;\n default:\n break;\n }\n\n\n\n \n \n })\n}", "function initializeApp() {\n inquire.prompt([{\n type: \"confirm\",\n message: \"Would you like to place an order ?\",\n name: \"confirm\",\n default: true\n }\n ]).then(function (inquirerResponse) {\n // console.log(inquirerResponse);\n // If customer confirms to placing an order as for input\n if (inquirerResponse.confirm) {\n askUserForOder();\n }\n else {\n console.log(\"\\nThat's okay, come again when you are more sure.\\n\");\n connection.end();\n }\n });\n}", "function initiateConversation(adminID){\n rainbowSDK.contacts.searchById(adminID).then((contact)=>{\n console.log(\"[DEMO] :: \" + contact);\n if(mocClicked == \"Chat\"){\n rainbowSDK.conversations.openConversationForContact(contact).then(function(conversation) {\n console.log(\"[DEMO] :: Conversation\", conversation);\n conversation1 = conversation;\n rainbowSDK.im.getMessagesFromConversation(conversation, 30).then(function() {\n console.log(\"[DEMO] :: Messages\", conversation);\n chat();\n }).catch(function(err) {\n console.error(\"[DEMO] :: Error Messages 1\", err);\n });\n }).catch(function(err) {\n console.error(\"[DEMO] :: Error conversation\", err);\n });\n }else{\n //check browser compatibility\n if(rainbowSDK.webRTC.canMakeAudioVideoCall()) {\n console.log(\"[DEMO] :: Audio supported\");\n if(rainbowSDK.webRTC.hasAMicrophone()) {\n /* A microphone is available, you can make at least audio call */\n console.log(\"[DEMO] :: microphone supported\");\n var res = rainbowSDK.webRTC.callInAudio(contact);\n if(res.label === \"OK\") {\n call();\n /* Your call has been correctly initiated. Waiting for the other peer to answer */\n console.log(\"[DEMO] :: Contact Successful\");\n let paragraph = document.getElementById(\"p1\");\n paragraph.innerHTML(\"Waiting for Admin to pick up.\");\n }\n else{console.log(\"[DEMO] :: Call not initialised successfully.\");}\n }else {\n alert(\"DEMO :: no microphone found\");\n }\n }else{\n alert(\"DEMO :: browser does not support audio\")\n }\n }\n }).catch((err)=>{\n console.log(err);\n });\n}", "function init() {\n console.log(\"****************************************************************************\")\n console.log(\"*******************Application Start: Team Profile Generator****************\")\n console.log(\"****************************************************************************\")\n inquirer.prompt(managerQuestions)\n .then(createManager)\n}", "function init() {\n promptUser()\n .then(installTrigger)\n .then(promptUsage)\n .then(promptCredits)\n .then(promptThirdParty)\n .then(promptTutorial)\n .then(promptFeatures)\n .then(promptTests)\n .then(readmeData => {\n return generateReadme(readmeData);\n })\n .then(pageMarkdown => {\n return writeToFile(pageMarkdown);\n })\n .catch(err => {\n console.log(err);\n });\n}", "function initialize(next) {\n return async agent => {\n console.log('initialize');\n const { body } = agent.request_;\n const { uid, code } = body.queryResult.parameters;\n const { data } = body.originalDetectIntentRequest.payload;\n let rejectMessage = undefined;\n let isVerify = true;\n try {\n const userRes = await db.findUser(uid);\n if (!userRes) throw new Error(`uid: {${uid}} not found`);\n if (code != userRes.initCode)\n throw new Error(`incorrect init code for uid {${uid}}`);\n\n await db.updateUser(userRes._id, data.source.userId);\n agent.add('Account created successfully');\n } catch (err) {\n //Check if error come from axios, if it does, convert it\n err = err.response ? err.response.data.error : err;\n isVerify = false;\n if (err.code === 400) {\n const profile = await client.getProfile(data.source.userId);\n rejectMessage = profile.displayName + ' account is already initialize';\n } else {\n rejectMessage = err.message;\n }\n agent.add(`Error: ${rejectMessage}`);\n next(err);\n } finally {\n await saveHistory(\n _createMomentDate(),\n {\n isVerify: isVerify,\n rejectMessage: rejectMessage,\n lid: data.source.userId,\n message: body.queryResult.queryText,\n messageIntent: 'initializeIntent'\n },\n agent,\n next\n );\n }\n };\n}", "function funcCallback() {\n if ( typeof objDetails === 'object' && objDetails.reason === 'install' ) {\n Global.openOptionsPage( 'install' );\n }\n\n if ( typeof funcSuccessCallback === 'function' ) {\n funcSuccessCallback();\n }\n }", "function setupChannel() {\n // Join the general channel\n // generalChannel.getMembers().then(members => {\n // if (members.)\n // })\n\n generalChannel.join().then(function(channel) {\n print('Joined channel as ' + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n generalChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n });\n\n generalChannel.on('typingStarted', function(member) {\n console.log('typingStarted', member);\n typingIndicator.text(`${member.identity} is typing...`);\n typingIndicator.show();\n });\n\n generalChannel.on('typingEnded', function(member) {\n console.log('typingEnded', member);\n typingIndicator.hide();\n });\n }", "function install_plugin(){\n if ( ! $('.et_plugin-nonce').length ) {\n return;\n }\n var data = {\n action : 'envato_setup_plugins',\n slug : 'et-core-plugin',\n wpnonce : $(document).find( '.et_plugin-nonce' ).attr( 'data-plugin-nonce' ),\n },\n current_item_hash = '',\n installing = $('.et_installing-base-plugin'),\n installed = $('.et_installed-base-plugin');\n\n $.ajax({\n method: \"POST\",\n url: ajaxurl,\n data: data,\n success: function(response){\n if ( response.hash != current_item_hash ) {\n $.ajax({\n method: \"POST\",\n url: response.url,\n data :response,\n success: function(response){\n installing.addClass('et_installed hidden');\n installed.removeClass('hidden');\n $('.mtips').removeClass( 'inactive' );\n $('.mt-mes').remove();\n },\n error : function(){\n installing.addClass('et_error');\n }, \n complete : function(){\n }\n });\n } else {\n installing.addClass('et_error');\n }\n },\n error: function(response){\n installing.addClass('et_error');\n },\n complete: function(response){\n }\n });\n }", "install() {\n installed = true;\n }", "function init() {\n\tvar token = config.get('slack:chat:token');\n\tif (!token) {\n\t\tlog.info('Slack integration not configured (no token)');\n\t\treturn;\n\t}\n\tvar logger = getSlackLogger();\n\tlog.debug('connecting to Slack');\n\tslack = new SlackRTM(token, {\n\t\tautoReconnect: true,\n\t\tlogger: logger,\n\t});\n\tslack.on('ready', onSlackOpen);\n\tslack.on('message', onSlackMessage);\n\tslack.on('error', onSlackError);\n\tslack.start();\n}", "function init() {\n inquirer.prompt([\n {\n type: 'input',\n name: 'title',\n message: 'What is the title of your application?'\n },\n {\n type: 'input',\n name: 'email',\n message: 'Please enter your email address'\n },\n {\n type: 'input',\n name: 'github',\n message: 'Please enter your github user name.'\n },\n {\n type: 'input',\n name: 'description',\n message: 'Please enter a description of your application.'\n\n },\n {\n type: 'list',\n name: 'license',\n choices: ['MIT', 'Apache', 'OSC'],\n message: 'Pick your license:'\n }\n ])\n .then(answers => {\n \n \n })\n\n}", "function setupChannel() {\n\n // Join the control channel\n controlChannel.join().then(function(channel) {\n print('Joined controlchannel as '\n + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n controlChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n console.log('lenis')\n test();\n //printcontrol()\n if (message.body.search(\"@anon\")>=0)\n {\n $.get( \"alch/\"+message.body, function( data ) {\n\n console.log(data);\n });\n }\n else if (message.body.search(\"@time\")>=0)\n {\n\n test();\n // var date=new Date().toLocaleString();\n // controlChannel.sendMessage(date);\n\n }\n else if (message.body.search(\"@junk\")>=0)\n {\n console.log(\"penis\");\n// test();\n }\n\n\n });\n }", "async function init() {\n debug('[init] setup facebook messenger bots with accounts');\n let defined = new Set();\n\n for (let x of config.accounts) {\n if (!x.pages) continue;\n for (let p of x.pages) {\n // facebook messenger 设置 get start button\n if (defined.has(p.pageId)) continue;\n let me = facebookFactory(p.pageId, x);\n try {\n await me.setGetStartedButton(DV_GET_START_TEXT);\n } catch (error) {\n console.error('setGetStartedButton', error);\n }\n\n // facebook messenger 设置 greeting text\n let defaultLocale = _.get(x, 'localeDefault');\n let greeting = [\n {\n locale: 'default',\n text:\n defaultLocale && x?.chatopera[defaultLocale]?.custom\n ? x['chatopera'][defaultLocale]['custom']?.GREETING_TEXT ||\n DV_GREETING_TEXT\n : DV_GREETING_TEXT,\n },\n ];\n\n if (x.chatopera && typeof x.chatopera === 'object') {\n let locales = Object.keys(x.chatopera);\n for (let y of locales) {\n let g = {\n locale: y,\n text: x.chatopera[y].custom?.GREETING_TEXT,\n };\n if (g.text) greeting.push(g);\n }\n }\n\n try {\n await me.setGreetingText(greeting);\n } catch (error) {\n console.error('setGreetingText', error);\n }\n }\n }\n}", "function startConversation(param) {\r\n\tvar sender = param.userName;\r\n\tvar extension = param.extension;\r\n\tvar msg = getLocalizationValue('application.javascript.messagingWindow.startConversationWithMsg') + \" \" + sender;\r\n\tif ((extension != undefined) && (extension != \"\")) {\r\n\t\tmsg = msg + \", \" + getLocalizationValue('application.javascript.messagingWindow.extension') + \" \" + extension;\r\n\t}\r\n\tonStartConversation(sender, msg);\r\n}", "async onInitialized(settings, userData) {}", "function init () {\n // Disconnect on page unload\n window.addEventListener('beforeunload', function () {\n post('disconnect', {}, function () { console.log('DISCONNECTED'); });\n });\n\n // Setup send on enter\n $('#message-text').on('keyup', function sendOnEnter(event) {\n if (event.which == 13) {\n if (event.shiftKey === false) {\n event.preventDefault();\n sendMessage();\n }\n }\n });\n \n // load conversations\n loadConversations(function () {\n locusta.timer = window.setInterval(loop, locusta.waitTimeFocus);\n locusta.initialized = true;\n Notification.requestPermission();\n });\n\n getUi('notification-enabled').toggle();\n}", "function init(msg) {\n header(\"Welcome to Unizik Department\", msg)\n inquirer\n .prompt([\n {\n type: \"input\",\n name: \"clientName\",\n message: \"Please enter your name\",\n validate: function(input){\n if(/^\\w+\\s?\\w+/.test(input)){\n return true;\n }else{\n return \"Input a valid name please\";\n }\n }\n }\n ])\n .then(answer => {\n welcome(answer.clientName, \"Feel free to solve your problem in our website\");\n })\n}", "function setupChannel() {\n // Join the general channel\n generalChannel.join().then(function(channel) {\n print('Joined channel as '\n + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n generalChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n });\n }", "function init() {\n inquirer.prompt(questions).then(answers => {\n let appTitle = answers.appTitle.trim();\n let appDescription = answers.appDescription ? answers.appDescription.trim() : \"\";\n let packageName = answers.packageName.trim();\n let openui5 = answers.openui5.trim();\n let appType = answers.type.trim();\n let splitApp = appType === \"split\";\n let routing = answers.routing || splitApp;\n\n ui5init.createFolders();\n ui5init.createComponent(packageName, routing);\n ui5init.createManifest(packageName, appType, routing);\n ui5init.createIndex(packageName, appTitle);\n ui5init.createI18n(appTitle, appDescription);\n jsGenerator.generateFile(\"App\", packageName, jsGenerator.types.controller);\n viewGenerator.generateAppView(packageName, splitApp, routing);\n if (routing || splitApp) {\n jsGenerator.generateFile(\"Master\", packageName, jsGenerator.types.controller);\n viewGenerator.generateView(\"Master\", packageName);\n }\n if (splitApp) {\n jsGenerator.generateFile(\"Detail\", packageName, jsGenerator.types.controller);\n viewGenerator.generateView(\"Detail\", packageName);\n }\n\n runtime.createPackage(appTitle, appDescription);\n runtime.createServer(openui5);\n runtime.createGruntEnvironment();\n\n console.log(`Application \"${appTitle}\" initialized.`);\n console.log(`Run npm install && npm start to install and start the app.`);\n });\n}", "function startify(){\n\n //find a partner! Look for someone with compatible languages who is listening for a call.\n partner = users.filter(function(x){\n return x.profile.status === 'listening' && x.profile.language.toLowerCase() === client.profile.learning.toLowerCase() && x.profile.learning.toLowerCase() === client.profile.language.toLowerCase();\n })[0];\n\n //call handler: does partner exist? If so, call them! If not, start listening.\n if (partner) {\n Meteor.users.update({_id: clientID},{$set: {'profile.callStatus': ('calling ' + partner._id)}});\n var outgoingCall = peer.call(partner.profile.peerId, stream);\n middleify(outgoingCall);\n } else {\n Meteor.users.update({_id: clientID}, {$set: {'profile.status': 'listening'}});\n }\n }", "function setupChannel() {\n // Join the general channel\n chatChannel.join().then(function(channel) {\n print('Joined channel as <span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n chatChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n });\n }", "getInitiateConversationUI() {\n if (this.props.newSelectedUser !== null) {\n return (\n <div className=\"message-thread start-chatting-banner\">\n <p className=\"heading\">\n You haven't chatted with {this.props.newSelectedUser.username} in a while,\n <span className=\"sub-heading\"> Say Hi.</span>\n </p>\t\t\t\n </div>\n )\n } \n }", "function init() {\n /**\n * Init Function to add event handlers\n */\n\n $('#nts1Proceed').click(handleNTS1Proceed);\n $('#oneTimeSubscription').click(handleNoteTypeSelect);\n $('#weeklySubscription').click(handleNoteTypeSelect);\n $('#monthlySubscription').click(handleNoteTypeSelect);\n $('#annualSubscription').click(handleNoteTypeSelect);\n}", "get initializing() {\n // if `task` is not available\n const installTask = this.spawnCommandSync('task', ['--help'], {\n stdio: false\n }).status\n\n this.installTask = !installTask\n\n return {}\n }", "function init() {\n console.log('\\n');\n\n inquirer\n .prompt([\n {\n type: 'list',\n message: 'What would you like to do?',\n choices: options,\n name: 'init',\n },\n ])\n .then((response) => {\n //switch statement used to route function calls based on response selected\n switch (response.init) {\n case 'Add a new department':\n newDept();\n break;\n case 'Add a new role':\n newRole();\n break;\n case 'Add a new Employee':\n newEmp();\n break;\n case 'View Current Departments':\n viewDept();\n break;\n case 'View Current Roles':\n viewRole();\n break;\n case 'View Current Employees':\n viewEmployees();\n break;\n case 'Change Employee role':\n changeRole();\n break;\n default:\n connection.end();\n break;\n };\n });\n}", "function init() {\n self.process = TucPackMigrationProcess.getMigrationProcess();\n self.choosedAdditionalOptions = TucPackMigrationProcess.getOptionsSelected();\n }", "async initSubscriptions() {\n\n }", "function startUp() {\n separator(chalk.cyan, 60)\n inquirer.prompt([{\n message: chalk.yellow(\"What would you like to do?\"),\n name: \"selection\",\n type: \"list\",\n choices: [\"View Products For Sale\",\n \"View Low Inventory\",\n \"Add To Inventory\",\n \"Add New Product\",\n \"Quit...\"]\n }]).then(manager => {\n separator(chalk.yellow, 60)\n // switch which calls a function depending on which selection is made from inquirer\n switch (manager.selection) {\n case 'View Products For Sale':\n listProducts();\n break;\n case 'View Low Inventory':\n lowInventory(5);\n break;\n case 'Add To Inventory':\n addInventory();\n break;\n case 'Add New Product':\n addProduct();\n break;\n case 'Quit...':\n return con.end();\n default:\n break;\n }\n })\n}", "async initTwilio() {\n const { token } = await twilioToken();\n const TwilioDevice = await Twilio.Device.setup(token);\n return TwilioDevice;\n }", "function init () {\t\t\n\t\t// Subscribe to ourself to fire a metric event when the user data is ready to use for the metrics.\n\t\tIBM.common.util.user.subscribe(\"ready\", \"User self-subscription\", function(){\n\t\t\tfireEvent();\n\t\t});\n\n\t\t// Some wackyness with pub/sub, sometimes requires a subscription to make it subscribable. Weird.\n\t\tIBM.common.util.user.subscribe(\"userstateReady\", \"User self-subscription\", function(){});\n\n\t\tIBM.common.meta.subscribe(\"dataReady\", \"userstaterequest\", function () {\n\t\t\tIBM.common.util.coreservices.makeRequest(\"777\", \"IBMCore.common.util.user.setUserSigninState\", {});\n\t\t}).runAsap(function () {\n\t\t\tIBM.common.util.coreservices.makeRequest(\"777\", \"IBMCore.common.util.user.setUserSigninState\", {});\n\t\t});\n\n\t\tsetUserdataObject();\n\t}", "function initMessageSystem() \n{\n\treceiveSystemMessagesText(true); //initiates the first data query\n}", "install() {\n let logMsg = `To install your dependencies manually, run: ${chalk.yellow.bold(`${this.clientPackageManager} install`)}`;\n\n if (this.clientFramework === 'angular1') {\n logMsg = `To install your dependencies manually, run: ${chalk.yellow.bold(`${this.clientPackageManager} install & bower install`)}`;\n }\n\n const injectDependenciesAndConstants = (err) => {\n if (err) {\n this.log('Install of dependencies failed!');\n this.log(logMsg);\n } else if (this.clientFramework === 'angular1') {\n this.spawnCommand('gulp', ['install']);\n }\n };\n\n const installConfig = {\n bower: this.clientFramework === 'angular1',\n npm: this.clientPackageManager !== 'yarn',\n yarn: this.clientPackageManager === 'yarn',\n callback: injectDependenciesAndConstants\n };\n\n this.installDependencies(installConfig);\n }", "function registerWithCommMgr() {\n commMgrClient.send({\n type: 'register-msg-handler',\n mskey: msKey,\n mstype: 'msg',\n mshelp: [\n { cmd: '/wallet_set_trustline', txt: 'setup EVER trustline' },\n { cmd: '/wallet_save_keys', txt: 'save/export wallet keys' },\n ],\n }, (err) => {\n if(err) u.showErr(err)\n })\n}", "function setup_message(){\n message.channel.send(`Please set-up this server with ${eprefix}guild-setup`);\n}", "async Init(stub) {\n console.info('=========== Instantiated userchain chaincode ===========');\n return shim.success();\n }", "function connectionInitialzation(opts, connection, attributes){\n\n var connID = connection.id;\n\n debug(\"Initializing IPC Subscription!!!\", core.uuid, opts.groups, connID);\n\n attributes.force(\"ipc\");\n\n connection.symbolicOwners = {};\n redisClient.incr(\"totalCurrentCount\");\n addRoute(\"ntvMsg\"+connID, \"NTV:\"+connID+\":MSG\", handleMessageToNativeConnection);\n\n redisClient.hset(\"samsaara:connectionOwners\", connID, core.uuid, function (err, reply){\n attributes.initialized(null, \"ipc\");\n }); \n}", "function install(data, reason) {}", "function install(data, reason) {}", "function init() {\n wndConversations = Cc['@mozilla.org/appshell/window-mediator;1']\n .getService(Ci.nsIWindowMediator)\n .getMostRecentWindow('SamePlace:Conversations');\n\n if(!wndConversations) {\n wndConversations = window.open(\n 'chrome://sameplace/content/conversations/conversations.xul',\n 'SamePlace:Conversations', 'chrome');\n\n wndConversations.addEventListener('load', function(event) {\n setTimeout(function() { wndConversations.hide(); });\n }, false);\n }\n\n window.addEventListener('contact/select', selectedContact, false);\n}", "__init2() {this._integrationsInitialized = false;}", "__init2() {this._integrationsInitialized = false;}", "__init2() {this._integrationsInitialized = false;}", "function workerSetupFunction() {\n var remoteWorker = self;\n remoteWorker.onmessage = function (evt) {\n if (evt.data.action !== \"setup\") {\n throw new Error(\"expected setup to be first message but got \" + JSON.stringify(evt.data));\n }\n var options = evt.data.options || {};\n initBrowserGlobals(options);\n loadDependenciesBrowser(options);\n initOnMessageHandler(options);\n initWorkerInterface(options);\n initWorkerMessenger(options);\n postMessage({ workerReady: true });\n };\n __FUNCTIONDECLARATIONS__;\n }", "function _testSuiteInit() {\n return ImptTestHelper.runCommand(`impt product create -n ${PRODUCT_EXIST_NAME} -s \"${PRODUCT_EXIST_DESCR}\"`, ImptTestHelper.emptyCheck).\n then(() => ImptTestHelper.getAccountAttrs(username)).\n then((account) => { email = account.email; userid = account.id; });\n }", "function setupIntegrations(integrations) {\n const integrationIndex = {};\n\n integrations.forEach(integration => {\n integrationIndex[integration.name] = integration;\n\n if (installedIntegrations.indexOf(integration.name) === -1) {\n integration.setupOnce(scope.addGlobalEventProcessor, hub.getCurrentHub);\n installedIntegrations.push(integration.name);\n (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.log(`Integration installed: ${integration.name}`);\n }\n });\n\n return integrationIndex;\n}", "function setupIntegrations(integrations) {\n\t const integrationIndex = {};\n\n\t integrations.forEach(integration => {\n\t integrationIndex[integration.name] = integration;\n\n\t if (installedIntegrations.indexOf(integration.name) === -1) {\n\t integration.setupOnce(addGlobalEventProcessor, getCurrentHub);\n\t installedIntegrations.push(integration.name);\n\t (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log(`Integration installed: ${integration.name}`);\n\t }\n\t });\n\n\t return integrationIndex;\n\t}", "function setupChannel() {\r\n\r\n\t\t// Join the general channel\r\n\t\tgeneralChannel.join().then(function(channel) {\r\n\t\t\tconsole.log('Enter Chat room');\r\n\r\n\t\t\t// Listen for new messages sent to the channel\r\n\t\t\tgeneralChannel.on('messageAdded', function(message) {\r\n\t\t\t\tremoveTyping();\r\n\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(message.index);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// 招待先プルダウンの描画\r\n\t\t\tvar storedInviteTo = storage.getItem('twInviteTo');\r\n\t\t\tgenerateInviteToList(storedInviteTo);\r\n\r\n\t\t\t// 招待先プルダウンの再描画\r\n\t\t\tgeneralChannel.on('memberJoined', function(member) {\r\n\t\t\t\tconsole.log('memberJoined');\r\n\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t});\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('memberLeft', function(member) {\r\n\t\t\t\tconsole.log('memberLeft');\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\r\n\t\t\t// Typing Started / Ended\r\n\t\t\tgeneralChannel.on('typingStarted', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing started');\r\n\t\t\t\tshowTyping();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('typingEnded', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing ended');\r\n\t\t\t\tclearTimeout(typingTimer);\r\n\t\t\t});\r\n\r\n\t\t\t// 最終既読メッセージindex取得\r\n\t\t\tgeneralChannel.getMembers().then(function(members) {\r\n\t\t\t\tfor (i = 0; i < members.length; i++) {\r\n\t\t\t\t\tvar member = members[i];\r\n\t\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tif (identity != member.identity && inviteToNames.indexOf(member.identity) != -1) {\r\n\t\t\t\t\t\treadStatusObj[identity] = member.lastConsumedMessageIndex;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Get Messages for a previously created channel\r\n\t\t\t\tgeneralChannel.getMessages().then(function(messages) {\r\n\t\t\t\t\t$chatWindow.empty();\r\n\t\t\t\t\tvar lastIndex = null;\r\n\t\t\t\t\tfor (i = 0; i < messages.length; i++) {\r\n\t\t\t\t\t\tvar message = messages[i];\r\n\t\t\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\t\t\tlastIndex = message.index;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (lastIndex && lastIndex >= 0) {\r\n\t\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(lastIndex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\thideSpinner();\r\n\t\t\t\t\t$('#chat-input').prop('disabled', false);\r\n\t\t\t\t});\r\n\r\n\t\t\t});\r\n\r\n\t\t});\r\n\r\n\t}", "function installPrompt()\n{\n closeWindow();\n if (app.pluginInstalled() && // plugin already installed but needs upgrade\n (Callcast.pluginUpdateRequired() || Callcast.pluginUpdateAvailable()) )\n {\n // chrome can't load an upgraded plugin so prompt user to restart\n if (app.browser.name === 'Chrome')\n {\n openWindow('#chromeRestart');\n }\n else\n {\n openWindow('#pageReload');\n }\n }\n else if (app.browser.name === 'Firefox') // firefox seems to have a problem polling navigator.plugins\n // so prompt user to reload instead of polling plugins\n {\n openWindow('#pageReload');\n }\n else // no plugin installed, wait for plugin\n {\n openWindow('#winWait');\n checkForPlugin();\n //openWindow('#pageReload');\n }\n}", "choiceRecognitionInitChallenge(challenge) {\n var self = this;\n\n this._session.call('nl.itslanguage.choice.init_challenge',\n [self._recognitionId, challenge.organisationId, challenge.id]).then(\n // RPC success callback\n function(recognitionId) {\n console.log('Challenge initialised for recognitionId: ' + self._recognitionId);\n },\n // RPC error callback\n function(res) {\n console.error('RPC error returned:', res.error);\n }\n );\n }", "function setupChannel() {\n // Join the general channel\n generalChannel.join().then(function(channel) {\n print('Joined channel as '\n + '<span class=\"is-owner\">' + username + '</span>.', true);\n });\n\n setTimeout(() => $chatOverlay.slideUp(), 1000);\n\n // Listen for new messages sent to the channel\n generalChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n });\n }", "inhibitor(msg, params, utils) {\n return true\n }", "async function init() {\n try {\n await broker.start();\n const response = await broker.call('hello.sayHello')\n log(`Service Response ${response}`)\n }\n catch (e) {\n log(e);\n }\n}", "function init() {\n\t\t// Loads a script\n\t\tvar loadScript = function(path) {\n\t\t var headID = document.getElementsByTagName('head')[0];\n\t\t var newScript = document.createElement('script');\n\t\t newScript.type = 'text/javascript';\n\t\t newScript.src = path;\n\t\t headID.appendChild(newScript);\n\t\t};\n\n\n\t\tMessenger.storeData('originalLocation', location.hash);\n\t Messenger.storeData('server', server);\n\t Messenger.storeData('extVersion', extVersion);\n\t Messenger.storeData('combinedPath', combinedPath);\n\t if (typeof devRealtimeServer !== 'undefined') {\n\t \tMessenger.storeData('devRealtimeServer', devRealtimeServer);\n\t }\n\n\n\t // Load the initialization script\n\t loadScript(server + combinedPath + 'combined-' + extVersion + '.js');\n\t }", "_applyIntegrationsMetadata(event) {\n const integrationsArray = Object.keys(this._integrations);\n if (integrationsArray.length > 0) {\n event.sdk = event.sdk || {};\n event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationsArray];\n }\n }", "async initialize() {\n const { faceTecLicenseKey, faceTecLicenseText, faceTecEncryptionKey } = Config\n\n if (!this.faceTecSDKInitializing) {\n // if not initializing - calling initialize sdk\n this.faceTecSDKInitializing = FaceTecSDK.initialize(\n faceTecLicenseKey,\n faceTecEncryptionKey,\n faceTecLicenseText,\n ).finally(() => (this.faceTecSDKInitializing = null))\n }\n\n // awaiting previous or current initialize call\n await this.faceTecSDKInitializing\n }", "async introStep(stepContext) {\n if (!this.luisRecognizer.isConfigured) {\n const messageText = 'NOTE: LUIS is not configured. To enable all capabilities, add `LuisAppId`, `LuisAPIKey` and `LuisAPIHostName` to the .env file.';\n await stepContext.context.sendActivity(messageText, null, InputHints.IgnoringInput);\n return await stepContext.next();\n }\n\n const weekLaterDate = moment().add(7, 'days').format('MMMM D, YYYY');\n const messageText = stepContext.options.restartMsg ? stepContext.options.restartMsg : `What can I help you with today?`;\n const promptMessage = MessageFactory.text(messageText, messageText, InputHints.ExpectingInput);\n return await stepContext.prompt('TextPrompt', { prompt: promptMessage });\n }", "function init() {\r\n\r\n // then make the function\r\n inquirer.prompt(qSection)\r\n .then((answers) => {\r\n console.log(\"Success!! Generating README...\");\r\n writeToFile(\"README.md\", generateMarkdown({\r\n ...answers\r\n }))\r\n });\r\n}", "init() {\n moduleUtils.patchModule(\n 'cos-nodejs-sdk-v5/sdk/task.js',\n 'init',\n tencentCOSWrapper\n );\n }" ]
[ "0.7064618", "0.70323336", "0.6839463", "0.60243225", "0.59829617", "0.58580023", "0.5844213", "0.5825384", "0.58016616", "0.56972075", "0.56972075", "0.56972075", "0.5686682", "0.5686682", "0.5686682", "0.5686682", "0.5683251", "0.56718254", "0.5652333", "0.5609291", "0.5585332", "0.5561975", "0.555503", "0.55336154", "0.5525794", "0.55087405", "0.5465714", "0.54472476", "0.5445427", "0.5437377", "0.5434751", "0.5394197", "0.53859234", "0.53826046", "0.53817147", "0.5365824", "0.5360982", "0.53575665", "0.53466195", "0.53396726", "0.53378665", "0.5306416", "0.5306289", "0.53061485", "0.5287625", "0.5283359", "0.5271143", "0.5261649", "0.52519333", "0.52355736", "0.52308506", "0.52243644", "0.52206314", "0.5194837", "0.5189392", "0.51874846", "0.5173978", "0.51728517", "0.51711535", "0.51664984", "0.5158477", "0.51550376", "0.51532996", "0.51514184", "0.51294523", "0.51215637", "0.5118886", "0.5116091", "0.5114223", "0.5110628", "0.5107276", "0.5106505", "0.5105733", "0.5102135", "0.50964296", "0.50964296", "0.50963074", "0.5092509", "0.5092509", "0.5092509", "0.50922555", "0.5088124", "0.5085754", "0.5085382", "0.5084881", "0.5082603", "0.50816905", "0.5080409", "0.5080352", "0.5073963", "0.50737137", "0.5068059", "0.5066315", "0.50629514", "0.50547", "0.5042256" ]
0.6913098
6
endregion Core bot logic goes here! region getters / setters of times and reports sets the time that the standup report will be generated for a channel
function setStandupTime(channel, standupTimeToSet) { controller.storage.teams.get('standupTimes', function(err, standupTimes) { if (!standupTimes) { standupTimes = {}; standupTimes.id = 'standupTimes'; } standupTimes[channel] = standupTimeToSet; controller.storage.teams.save(standupTimes); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_setTime() {\n switch(this.difficultyLevel) {\n case 1:\n // this.gameTime uses ms\n this.gameTime = 45000;\n break;\n case 2:\n this.gameTime = 100000;\n break;\n case 3:\n this.gameTime = 160000;\n break;\n case 4:\n this.gameTime = 220000;\n break;\n default:\n throw new Error('there is no time');\n }\n }", "function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}", "getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n }", "liveTime() {\n\t\tthis.updateTime();\n\t\tthis.writeLog();\n\t}", "get time() {}", "get time() {\n return this._time;\n }", "get time () {\n\t\treturn this._time;\n\t}", "get time () { throw \"Game system not supported\"; }", "function respondWithTime(){\n sendMessage(buildBotMessage(new Date().toUTCString()));\n}", "getTime(){return this.time;}", "function getStandupTime(channel, cb) {\n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n if (!standupTimes || !standupTimes[channel]) {\n cb(null, null);\n } else {\n cb(null, standupTimes[channel]);\n }\n });\n}", "getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n\n this.lifeTime = this.time - this.startTime;\n \n \n }", "getReadableTime() {\n // Debugging line.\n Helper.printDebugLine(this.getReadableTime, __filename, __line);\n\n // Stop the time please. How long was the crawling process?\n let ms = new Date() - this.startTime,\n time = Parser.parseTime(ms),\n timeString = `${time.d} days, ${time.h}:${time.m}:${time.s}`;\n\n this.output.write(timeString, true, 'success');\n this.output.writeLine(`Stopped at: ${new Date()}`, true, 'success');\n }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "_onTimeupdate () {\n this.emit('timeupdate', this.getCurrentTime())\n }", "function getInitialTime() {\n changeTime();\n}", "setupTimes(){\n\n\n this.fixation_time_1 = 4;\n this.fixation_time_2 = 1;\n\n this.learn_time = 0.4 * this.stimpair.learn.getDifficulty();\n this.test_time = this.learn_time;\n\n this.total_loop_time = this.learn_time+this.fixation_time_1+this.test_time+this.fixation_time_2;\n\n this.t_learn = SchedulerUtils.getStartEndTimes(0,this.learn_time);\n\n this.t_test = SchedulerUtils.getStartEndTimes(this.t_learn.end+this.fixation_time_1,this.test_time);\n\n console.log(\"times: \",\"fixation: \",this.initial_fixation,\" learn: \",this.learn_time,\" total: \",this.total_loop_time);\n\n }", "getGameTime() {\n return this.time / 1200;\n }", "getPlayTime() {\n return this.time;\n }", "goHomeAndSleep() {\n console.log(this.firstName + \" went home to sleep\");\n this.timesheet = this.originalTime;\n }", "updateRemainingTime() {\n\n this.callsCounter++;\n //cada 25 llamadas, quito un segundo\n if (this.callsCounter % 25 == 0) {\n if (this.time.seconds == 0) {\n this.time.minutes -= 1;\n this.time.seconds = 60;\n }\n this.time.seconds -= 1;\n }\n //Se activa el hurryUp\n if (this.callsCounter == this.hurryUpStartTime) {\n this.hurryUpTime = true;\n }\n //Se llama al metodo cada 5 llamadas \n if (this.callsCounter >= this.hurryUpStartTime\n && this.callsCounter % 5 == 0) {\n this.hurryUp();\n }\n\n }", "get() {\n let date = new Date();\n\n Object.assign(this.currentTime, {\n hours : date.getHours(),\n minutes : date.getMinutes(),\n seconds : date.getSeconds()\n })\n }", "function updateTime() {\n\n}", "function tickTime() {\n // the magic object with all the time data\n // the present passing current moment\n let pc = {\n thisMoment: {},\n current: {},\n msInA: {},\n utt: {},\n passage: {},\n display: {}\n };\n\n // get the current time\n pc.thisMoment = {};\n pc.thisMoment = new Date();\n\n // slice current time into units\n pc.current = {\n ms: pc.thisMoment.getMilliseconds(),\n second: pc.thisMoment.getSeconds(),\n minute: pc.thisMoment.getMinutes(),\n hour: pc.thisMoment.getHours(),\n day: pc.thisMoment.getDay(),\n date: pc.thisMoment.getDate(),\n week: weekOfYear(pc.thisMoment),\n month: pc.thisMoment.getMonth(),\n year: pc.thisMoment.getFullYear()\n };\n\n // TODO: display day of week and month name\n let dayOfWeek = DAYS[pc.current.day];\n let monthName = MONTHS[pc.current.month];\n\n // returns the week no. out of the year\n function weekOfYear(d) {\n d.setHours(0, 0, 0);\n d.setDate(d.getDate() + 4 - (d.getDay() || 7));\n return Math.ceil(((d - new Date(d.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);\n }\n\n // set the slice conversions based on pc.thisMoment\n pc.msInA.ms = 1;\n pc.msInA.second = 1000;\n pc.msInA.minute = pc.msInA.second * 60;\n pc.msInA.hour = pc.msInA.minute * 60;\n pc.msInA.day = pc.msInA.hour * 24;\n pc.msInA.week = pc.msInA.day * 7;\n pc.msInA.month = pc.msInA.day * MONTH_DAYS[pc.current.month - 1];\n pc.msInA.year = pc.msInA.day * daysThisYear(pc.current.year);\n\n // handle leap years\n function daysThisYear(year) {\n if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {\n MONTH_DAYS[1] = 29;\n return 366;\n } else {\n return 365;\n }\n }\n\n // utt means UpToThis\n // calculates the count in ms of each unit that has passed\n pc.utt.ms = pc.current.ms;\n pc.utt.second = pc.current.second * pc.msInA.second + pc.utt.ms;\n pc.utt.minute = pc.current.minute * pc.msInA.minute + pc.utt.second;\n pc.utt.hour = pc.current.hour * pc.msInA.hour + pc.utt.minute;\n pc.utt.day = pc.current.day * pc.msInA.day + pc.utt.hour;\n pc.utt.week = pc.current.week * pc.msInA.week + pc.utt.day;\n pc.utt.date = pc.current.date * pc.msInA.day + pc.utt.hour;\n pc.utt.month = pc.current.month + 1 * pc.msInA.month + pc.utt.date;\n pc.utt.year = pc.current.year * pc.msInA.year + pc.utt.month;\n\n // calculates the proportion/ratio of each unit that has passed\n // used to display percentages\n pc.passage = {\n ms: pc.current.ms / 100,\n second: pc.current.ms / pc.msInA.second,\n minute: pc.utt.second / pc.msInA.minute,\n hour: pc.utt.minute / pc.msInA.hour,\n day: pc.utt.hour / pc.msInA.day,\n week: pc.utt.day / pc.msInA.week,\n month: pc.utt.date / pc.msInA.month,\n year: pc.utt.month / pc.msInA.year\n };\n\n // tidies up the current clock readouts for display\n pc.display = {\n ms: pc.utt.ms,\n second: pc.current.second,\n minute: pc.current.minute.toString().padStart(2, \"0\"),\n hour: pc.current.hour.toString().padStart(2, \"0\"),\n day: pc.current.date,\n week: pc.current.week,\n month: pc.current.month.toString().padStart(2, \"0\"),\n year: pc.current.year\n };\n\n if (debug) {\n console.dir(pc);\n }\n\n // returns the ratios and the clock readouts\n return { psg: pc.passage, dsp: pc.display };\n}", "function mainTime(time, id) {\r\n\tlet session = \"work\";\r\n\tlet timeInterval;\r\n\t//let startingTime = sessionTime\r\n\tthis.id = id;\r\n\tlet breakTime = 5;\r\n\tlet workTime = 25;\r\n\tlet startingTime = workTime;\r\n\r\n\tthis.time = startingTime;\r\n\t//allows to set a new time\r\n\tthis.setTime = (objWork, objBreak) => { \r\n\t\t//startingTime = objectTime;\r\n\t\tworkTime = objWork.time;\r\n\t\tbreakTime = objBreak.time\r\n\tconsole.log(startingTime);\r\n\t };\r\n\t\r\n\tthis.count = () => {\r\n\r\n\t\tthis.display(this.id);\r\n\t\tconsole.log(this.getSession(), this.time);\r\n\t\tconsole.log(workTime, breakTime);\r\n\r\n\t\tif(this.time === 0 && this.getSession() === \"work\") {\r\n\t\t\tthis.time = this.getBreakTime();\r\n\t\t\tthis.setSession(\"break\");\r\n\r\n\t\t}\r\n\r\n\t\telse if(this.time === 0 && this.getSession() === \"break\") {\r\n\t\t\tthis.setSession(\"work\");\r\n\t\t\tthis.time = this.getWorkTime();\r\n\t\t}\r\n\t\tthis.time--; //decrease the time\r\n\r\n\t}\r\n\r\n\t//start countdown\r\n\tthis.startCount = (objWork, objBreak) => {\r\n\t\tobjWork.setSession(true);\r\n\t\tobjBreak.setSession(true);\r\n\t\tthis.setBreakTime(objBreak);\r\n\t\tthis.setWorkTime(objWork);\r\n\t\tif (this.getSession() === \"work\" && this.time === 0) {\r\n\t\t\tthis.time = this.getWorkTime();\r\n\t\t}\r\n\t\telse if (this.getSession() === \"work\" && this.time !== 0) {\r\n\t\t\tthis.time = this.getWorkTime();\r\n\t\t}\r\n\t\telse if(this.time === 0) {\r\n\t\t\tthis.time = this.getBreakTime();\r\n\t\t}\r\n\t\t//timerRunning = true;\r\n\t\ttimeInterval = setInterval(this.count, 1000);\r\n\t}\r\n\t//stop/pause the time\r\n\tthis.stopCount = (objWork, objBreak) => {\r\n\t\tobjWork.setSession(false);\r\n\t\tobjBreak.setSession(false);\r\n\t\tclearInterval(timeInterval)\r\n\t\t };\r\n\t//reset the time\r\n\tthis.reset = (objWork, objBreak, id) => { \r\n\t\tobjWork.setSession(false);\r\n\t\tobjBreak.setSession(false);\r\n\t\tthis.stopCount(objWork, objBreak);\r\n\t\tthis.time = startingTime;\r\n\t\tthis.display(id);\r\n\t\t }\r\n\t//displayon DOM\r\n\tthis.display = (id) => {\r\n\t\tdocument.getElementById(id).textContent = this.time;\r\n\t}\r\n\r\n\tthis.getSession = () => session;\r\n\r\n\tthis.setSession = (status) => { session = status};\r\n\r\n\tthis.setBreakTime = (obj) => {\r\n\t\tbreakTime = obj.time;\r\n\t};\r\n\r\n\tthis.setWorkTime = (obj) => {\r\n\t\tworkTime = obj.time;\r\n\t};\r\n\r\n\tthis.getBreakTime = () => breakTime;\r\n\r\n\tthis.getWorkTime = () => workTime;\r\n\r\n\t//takes the session and break\r\n\r\n\r\n}", "function setTime( t ){\n\n this.time = t;\n\n }", "function sendTime() {\n\t\n\tconsole.log('this is clients array : ' + util.inspect(clients));\n\t//console.log('this is commands array : ' + util.inspect(commands));\n io.sockets.emit('time', { time: new Date().toJSON() } );\n}", "get total_time() { return this._total_time; }", "constructor (){\n\t\tsuper();\n\n\t\tthis.getTheTime = this.getTheTime.bind(this);\n\n\t\t/**\n\t\t * Setup the time variable to update every second\n\t\t */\n\t\t\n\t\tthis.state = {\n\t\t\ttime: null\n\t\t}\n\n\t\tthis.getTheTime();\n\t}", "get remainingTime() {\r\n return Math.ceil((this.maxTime - this.timeTicker) / 60);\r\n }", "setUpHours() {\n this._.each(this.vendor.hours, (day) => {\n //handle no open or close times\n if(!day || !day.opening_time || !day.closing_time) {\n day.open = new Date();\n day.close = new Date();\n day.closed = true;\n return;\n }\n // create js time object from string\n let openPeriod = day && day.opening_time && day.opening_time.split(':')[1].slice(2, 4),\n closePeriod = day.closing_time.split(':')[1].slice(2, 4),\n openHour = (openPeriod.toLowerCase() === 'pm') ? Number(day.opening_time.split(':')[0]) + 12 : day.opening_time.split(':')[0],\n openMinutes = day.opening_time.split(':')[1].slice(0, 2),\n closeHour = (closePeriod.toLowerCase() === 'pm') ? Number(day.closing_time.split(':')[0]) + 12 : day.closing_time.split(':')[0],\n closeMinutes = day.closing_time.split(':')[1].slice(0, 2),\n open = new Date(),\n close = new Date();\n //set time\n open.setHours(openHour);\n close.setHours(closeHour);\n\n open.setMinutes(openMinutes);\n close.setMinutes(closeMinutes);\n //set open close times for ui\n day.open = open;\n day.close = close;\n\n }, this);\n return this.vendor.hours;\n }", "function timeTracker() {\n //use moment.js to set current hour value\n var rightNow = moment().hour();\n console.log(rightNow)\n //loop over the timeblocks use if/else to set the appropiate css class\n $(\".time-block\").each(function () {\n var blockhour = parseInt($(this).attr(\"id\").split(\"hour\")[1]);\n console.log(blockhour)\n\n if (blockhour === rightNow) {\n $(this).addClass(\"present\");\n $(this).removeClass(\"future\", \"past\");\n }\n\n else if (blockhour < rightNow) {\n $(this).addClass(\"past\");\n $(this).removeClass(\"present\", \"future\");\n }\n\n else {\n $(this).addClass(\"future\");\n $(this).removeClass(\"past\", \"present\");\n }\n });\n }", "async run(message) {\n let days = 0;\n let week = 0;\n\n\n let uptime = ``;\n let totalSeconds = (this.client.uptime / 1000);\n let hours = Math.floor(totalSeconds / 3600);\n totalSeconds %= 3600;\n let minutes = Math.floor(totalSeconds / 60);\n let seconds = Math.floor(totalSeconds % 60);\n\n if(hours > 23){\n days = hours / 24;\n days = Math.floor(days);\n hours = hours - (days * 24);\n }\n\n if(minutes > 60){\n minutes = 0;\n }\n\n uptime += `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;\n\n let serverembed = new MessageEmbed()\n .setColor(0x00FF00)\n .addField('Uptime', uptime)\n .setFooter(`Hypixel Stats made by Slice#1007 | https://discord.gg/RGD8fkD`, 'https://i.imgur.com/WdvE9QUg.jpg');\n\n message.say(serverembed);\n }", "function getTime(){\n \n hr = hour();\n mn = minute();\n sc = second();\n}", "get attackTime()\n {\n return this._attackTime;\n }", "setFinalTime() {\n /*\n if user selected the UNTIL functionality, use arithmetic to transform option into seconds.\n */\n if (this.state.until) {\n console.log('hello');\n var secondsRequested = 0;\n var hours;\n\n if (this.state.hourList[this.state.selectedItem1] == '12') {\n hours = 0;\n } else {\n hours =\n Number.parseInt(this.state.hourList[this.state.selectedItem1], 10) *\n 3600;\n }\n\n var minutes =\n Number.parseInt(this.state.minuteList[this.state.selectedItem2], 10) *\n 60;\n var am_or_pm = this.state.morningOrNight[this.state.selectedItem3];\n\n if (am_or_pm == 'PM') {\n secondsRequested += 12 * 3600; //this accounts for the first 12 hours of the day\n }\n\n //adds on requested hours and minutes\n secondsRequested += hours + minutes;\n\n /* if user requests time within the next day, do additional arithmetic */\n if (secondsRequested - this.getCurrentTime() < 0) {\n return secondsRequested + (24 * 3600 - this.getCurrentTime());\n } else {\n return secondsRequested - this.getCurrentTime();\n }\n } else {\n //end conditions for until option\n\n // if user selects the \"FOR\" option, return (hours * 3600) + (minutes * 60) to get second count.\n return (\n Number.parseInt(this.state.forMinutes[this.state.selectedItem2], 10) *\n 60 +\n Number.parseInt(this.state.forHours[this.state.selectedItem1], 10) *\n 3600\n );\n }\n }", "constructor() {\n\n this.timedEntities = []; // Will hold list of entities being tracked\n this.activeEntity = null; // This is the entity we are currently timing\n this.intervalTimer = null; // Will hold reference after we start setInterval\n this.chartTimer = null; // Will hold referenec to the setInterval for updating the charts\n this.timingActive = false; // Are we currently running the timer?\n this.totalTicksActive = 0; // seconds that the timer has been running\n // Store the timestamp in ms of the last time a tick happened in case the\n // app gets backgrounded and JS execution stops. Can then add in the right\n // number of secconds after\n this.lastTickTime = -1;\n this.turnList = []; // Will hold a set of dictionaries defining each time the speaker changed.\n this.minTurnLength = 10; // seconds; the time before a turn is shown on the timeline\n\n this.meetingName = \"\";\n this.attributeNameGender = \"Gender\";\n this.attributeNameSecondary = \"Secondary Attribute\";\n this.attributeNameTertiary = \"Tertiary Attribute\";\n }", "countDownTimer(){\n this.timeTillStart = TIME_TILL_START - (new Date().getTime() -this.gameStartTime);\n this.gameSocket.emit('updateTime',{time:this.timeTillStart});\n }", "timing() {\n const newTimeDisplayed = this.switchSession();\n\n if (newTimeDisplayed.sec === 0) {\n newTimeDisplayed.sec = 60;\n newTimeDisplayed.min -= 1;\n }\n\n newTimeDisplayed.sec -= 1;\n this.setState({ timeDisplayed: newTimeDisplayed, countdown: true });\n }", "night() {\n this.time.setHours(21);\n }", "calcUptime() {\n lumServer.healthcheck.serverUptime = utils.milliSecsToString(utils.now());\n }", "_updateTime() {\r\n // Determine what to append to time text content, and update time if required\r\n let append = \"\";\r\n if (this.levelNum <= MAX_LEVEL && !this.paused) {\r\n this.accumulatedTime += Date.now() - this.lastDate;\r\n }\r\n this.lastDate = Date.now();\r\n\r\n // Update the time value in the div\r\n let nowDate = new Date(this.accumulatedTime);\r\n let twoDigitFormat = new Intl.NumberFormat('en-US', {minimumIntegerDigits: 2});\r\n if (nowDate.getHours() - this.startHours > 0) {\r\n this.timerDisplay.textContent = `Time: ${nowDate.getHours() - this.startHours}:`+\r\n `${twoDigitFormat.format(nowDate.getMinutes())}:` +\r\n `${twoDigitFormat.format(nowDate.getSeconds())}${append}`;\r\n }\r\n else {\r\n this.timerDisplay.textContent = `Time: ${twoDigitFormat.format(nowDate.getMinutes())}:` +\r\n `${twoDigitFormat.format(nowDate.getSeconds())}${append}`;\r\n }\r\n }", "function setTime() {\n\t\tseconds += 500;\n\t}", "updateTime() {\n\t\tthis.setState({\n\t\t\ttime: hrOfDay(),\n\t\t\tday: timeOfDay()\n\t\t});\n\t}", "constructor() {\n this.securities = {};\n this.global_timestamps = {};\n this.current_time = -1;\n this.max_time = -1;\n this.min_time = -1;\n }", "function setTime(dif) {\n let timeTracker = getterDOM(\"tracker\");\n timeTracker.innerHTML = translateTime(dif).minString + \":\" + translateTime(dif).secString;\n return timeTracker.innerHTML;\n}", "function setTimer() {\n // get the shortRest\n // get the largeRest\n }", "function setUpTime() {\n if ($scope.event) {\n $scope.time = {\n value: new Date($scope.event.time * 1000)\n };\n }\n else {\n $scope.time = {\n value: new Date()\n }\n }\n\n timeChanged();\n }", "get clockDiff() {\n return this._clockDiff;\n }", "constructor(){\n this.balance = -100000\n //count down or up from 8 minutes\n this.timer = 0;\n }", "parseStatsTime() {\r\n this._time_played = this.convertTime(this._datas_str[\"lifeTimeStats\"][13][\"value\"]);\r\n this._time_avg = this.convertTime(this._datas_str[\"lifeTimeStats\"][14][\"value\"]); \r\n }", "setClockTime() {\n const [min, hr] = getCurrentMinutesHrs();\n const finalTime = [];\n for (const elem of minMappings[min]) {\n finalTime.push(elem);\n }\n finalTime.push(hrMappings[hr]);\n this.setState({time: finalTime});\n }", "statusUpdates(world, time) {}", "calculateTime() {\n // Number of ingredients\n const numberOfIngredients = this.ingredients.length;\n // Number of periods (1 period = 3 ingredients)\n const periods = Math.ceil(numberOfIngredients / 3);\n\n // Time needed to cook (1 period takes 15 minutes)\n this.time = periods * 15;\n }", "onSleepingTime() {\n throw new NotImplementedException();\n }", "calcTime() {\n const numberOfIngredients = this.ingredients.length;\n const periods = Math.ceil(numberOfIngredients / 3);\n this.time = periods * 15;\n }", "function getBotMsgTime(session){\n\tconsole.log(\"getBotMsgTime() executing\");\n\tvar botTime = new Date(session.userData.lastMessageSent);\n\tconsole.log(\"Bot time unformatted is:\");\n\tconsole.log(botTime);\n\n\tvar botTimeFormatted = dateFormat(botTime, \"yyyy-mm-dd HH:MM:ss\");\n\n\tconsole.log(\"Bot messaged at: \" + botTimeFormatted);\n\treturn botTimeFormatted;\n}", "function Time() {\n this._clock = void 0;\n this._timeScale = void 0;\n this._deltaTime = void 0;\n this._startTime = void 0;\n this._lastTickTime = void 0;\n this._clock = wechatAdapter.performance ? wechatAdapter.performance : Date;\n this._timeScale = 1.0;\n this._deltaTime = 0.0001;\n\n var now = this._clock.now();\n\n this._startTime = now;\n this._lastTickTime = now;\n }", "function setTime() {\n // Create date instance\n var date = new Date();\n // Get hours and minutes and store in variables\n var hours = date.getHours(),\n minutes = date.getMinutes();\n // If number of minutes < 10, the time looks like this: 6:6. We want 6:06 instead, so add a 0\n if (minutes < 10) {\n minutes = '0' + minutes;\n }\n // Define elements where to put hours and minutes\n var $hoursElement = $('#time .time-hours'),\n $minutesElement = $('#time .time-minutes');\n // Put hours and minutes in the elements\n $hoursElement.text(hours);\n $minutesElement.text(minutes);\n }", "function UpdateTimeMessage()\n{\n //An integer indicating the amount by which a client must adjust their clock, according to the server, in milliseconds.\n this.drift = null;\n\n //The list of attributes that this message has\n this.attributes = [\"clientId\", \"drift\"];\n\n //Getter for clientId\n this.getClientId = function() {\n return this.clientId;\n };\n\n //Setter for clientId\n this.setClientId = function(clientId) {\n this.clientId = clientId;\n };\n\n //Getter for drift\n this.getDrift = function() {\n return this.drift;\n };\n\n //Setter for drift\n this.setDrift = function(drift) {\n if(!drift.toString().match(/-?\\d+/))\n {\n return new Error(\"Drift must be an integer\");\n }\n this.drift = drift;\n };\n}", "set time(value) {}", "function checkTimesAndAskStandup(bot) {\n getAskingTimes(function (err, askMeTimes) {\n \n if (!askMeTimes) {\n return;\n }\n\n for (var channelId in askMeTimes) {\n\n for (var userId in askMeTimes[channelId]) {\n\n var askMeTime = askMeTimes[channelId][userId];\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n if (compareHoursAndMinutes(currentHoursAndMinutes, askMeTime)) {\n\n hasStandup({user: userId, channel: channelId}, function(err, hasStandup) {\n\n // if the user has not set an 'ask me time' or has already reported a standup, don't ask again\n if (hasStandup == null || hasStandup == true) {\n var x = \"\";\n } else {\n doStandup(bot, userId, channelId);\n }\n });\n }\n }\n }\n });\n}", "get valueTime () {\r\n\t\treturn this.__valueTime;\r\n\t}", "noon() {\n this.time.setHours(12);\n }", "_update() {\n // Get time now\n const time = zbTime.getNow();\n\n // If there is a current time\n if (this._currentTime) {\n // If nothing has changed then stop here\n if (this._currentTime.hour === time.hour && this._currentTime.minute === time.minute) return;\n }\n\n // Update current time\n this._currentTime = time;\n\n // Set show 24 hour clock\n let show24HourClock = false;\n\n // If there is a show 24 hour clock attribute\n if (this.hasAttribute('show24hour') === true) {\n // Set to show 24 hour clock\n show24HourClock = true;\n }\n\n // Set hour\n let hour = time.hour;\n\n // If showing 12 hour clock and over 12 hours\n if (show24HourClock === false && hour > 12) {\n // Minus 12 hours\n hour -= 12;\n }\n\n // Set digit numbers\n let digit1Number = Math.floor(hour / 10);\n const digit2Number = hour % 10;\n const digit3Number = Math.floor(time.minute / 10);\n const digit4Number = time.minute % 10;\n\n // If showing 12 hour clock and digit 1 number is zero\n if (show24HourClock === false && digit1Number === 0) {\n // Set the digit 1 number so that it hides the number\n digit1Number = -1;\n }\n\n // Set the digit lines\n this._setDigitLines(this._digit[0], digit1Number);\n this._setDigitLines(this._digit[1], digit2Number);\n this._setDigitLines(this._digit[2], digit3Number);\n this._setDigitLines(this._digit[3], digit4Number);\n\n // If 12 hour clock shown\n if (show24HourClock === false) {\n // If AM\n if (this._currentTime.hour < 12) {\n // Show AM\n this._amChildDomElement.className = 'ampm-child ampm-on';\n this._pmChildDomElement.className = 'ampm-child ampm-off';\n } else {\n // Show PM\n this._amChildDomElement.className = 'ampm-child ampm-off';\n this._pmChildDomElement.className = 'ampm-child ampm-on';\n }\n }\n }", "function setTime() {\n //increments timer\n ++totalSeconds;\n //temporarily stops timer at 5 seconds for my sanity\n if (totalSeconds === 59) {\n totalMinutes += 1;\n totalSeconds = 0;\n }\n\n //stops timer when game is won\n if (gameWon === true) {\n return;\n }\n //calls function to display timer in DOM\n domTimer();\n }", "function setDate() {\n d = new Date()\n if (m != d.getMinutes()) {\n m = d.getMinutes();\n $('<div class=\"timestamp\">' + d.getHours() + ':' + m + '</div>').appendTo($('.message:last'));\n }\n}", "constructor() {\n\t\tthis.deltaTime = 0;\n\t\tthis.mult = 1;\n\t\tthis.time = Time.getTime(); // this.time = current time (last update)\n\t}", "function handleTime() {\r\n // times\r\n const minutes = parseInt(this.dataset.time) * 60;\r\n const today = Date.now();\r\n console.log(minutes);\r\n // converting\r\n const ms = minutes * 1000;\r\n // calculation\r\n const together = today + ms;\r\n const newTime = new Date(together);\r\n //displaying\r\n const displayUno = newTime.getHours();\r\n const displayTwo = newTime.getMinutes();\r\n endTime.textContent = `U should be back at ${displayUno < 10 ? '0': ''}${displayUno}:${displayTwo < 10 ? '0':''}${displayTwo}`\r\n}", "constructor(){\n this.time = 0;\n this.intervalID = 0;\n }", "async updateTimebar() {\n this.timeText = await this.time.getCurrentTime();\n this.tag('Time').patch({ text: { text: this.timeText } });\n }", "getStartTime() {\n return this.startTime;\n }", "initChronometer() {\n let self = this;\n\n setInterval(() => {\n self.allDuration();\n }, 1000);\n\n }", "function setMessage()\n{\n var date=new Date();\n time=date.getHours();\n console.log(time);\n var message='';\n if (time < 10)\n {\n message='Good Morning !! ';\n }\n else if (time > 11 && time <15){\n message='Good AfterNoon !! ';\n }\n else if (time>15)\n {\n message ='Good Evening !! ';\n }\n else if (time >20)\n {\n message='Good Night !!';\n }\n return message;\n \n}", "function timeTracker (){\n const currentTime = dayjs().hour();\n\n // Function to loop over each timeblock\n $('.time-block').each(function(){\n const blockTime = parseInt($(this).attr('id').split('hour')[1]);\n\n // Calculate current time and add past class for grey timeblock colour\n if (blockTime < currentTime){\n $(this).removeClass('future');\n $(this).removeClass('present');\n $(this).addClass('past');\n }\n\n // Calculate current time and add current class for red timeblock colour\n else if (blockTime === currentTime){\n $(this).removeClass('past');\n $(this).removeClass('future');\n $(this).addClass('present');\n }\n\n // Calculate current time and add future class for green timeblock colour\n else {\n $(this).removeClass('present');\n $(this).removeClass('past');\n $(this).addClass('future');\n }\n })\n }", "function setTimeBlock() {\n timeBlock.each(function () {\n $thisBlock = $(this);\n var currentHour = d.getHours();\n var dataHour = parseInt($thisBlock.attr(\"dataHour\"));\n\n if (dataHour < currentHour) {\n $thisBlock.children(\"textarea\").addClass(\"past\").removeClass(\"present\", \"future\");\n }\n if (dataHour == currentHour) {\n $thisBlock.children(\"textarea\").addClass(\"present\").removeClass(\"past\", \"future\");\n }\n if (dataHour > currentHour) {\n $thisBlock.children(\"textarea\").addClass(\"future\").removeClass(\"past\", \"present\");\n }\n })\n\n }", "refreshTime() {\n if (this._game.isRun()) {\n this._view.setValue(\"time\", this._game.timeElapsed);\n }\n }", "update_() {\n var current = this.tlc_.getCurrent();\n this.scope_['time'] = current;\n var t = new Date(current);\n\n var coord = this.coord_ || MapContainer.getInstance().getMap().getView().getCenter();\n\n if (coord) {\n coord = olProj.toLonLat(coord, osMap.PROJECTION);\n\n this.scope_['coord'] = coord;\n var sets = [];\n\n // sun times\n var suntimes = SunCalc.getTimes(t, coord[1], coord[0]);\n var sunpos = SunCalc.getPosition(t, coord[1], coord[0]);\n\n // Determine dawn/dusk based on user preference\n var calcTitle;\n var dawnTime;\n var duskTime;\n\n switch (settings.getInstance().get(SettingKey.DUSK_MODE)) {\n case 'nautical':\n calcTitle = 'Nautical calculation';\n dawnTime = suntimes.nauticalDawn.getTime();\n duskTime = suntimes.nauticalDusk.getTime();\n break;\n case 'civilian':\n calcTitle = 'Civilian calculation';\n dawnTime = suntimes.dawn.getTime();\n duskTime = suntimes.dusk.getTime();\n break;\n case 'astronomical':\n default:\n calcTitle = 'Astronomical calculation';\n dawnTime = suntimes.nightEnd.getTime();\n duskTime = suntimes.night.getTime();\n break;\n }\n\n var times = [{\n 'label': 'Dawn',\n 'time': dawnTime,\n 'title': calcTitle,\n 'color': '#87CEFA'\n }, {\n 'label': 'Sunrise',\n 'time': suntimes.sunrise.getTime(),\n 'color': '#FFA500'\n }, {\n 'label': 'Solar Noon',\n 'time': suntimes.solarNoon.getTime(),\n 'color': '#FFD700'\n }, {\n 'label': 'Sunset',\n 'time': suntimes.sunset.getTime(),\n 'color': '#FFA500'\n }, {\n 'label': 'Dusk',\n 'time': duskTime,\n 'title': calcTitle,\n 'color': '#87CEFA'\n }, {\n 'label': 'Night',\n 'time': suntimes.night.getTime(),\n 'color': '#000080'\n }];\n\n this.scope_['sun'] = {\n 'altitude': sunpos.altitude * geo.R2D,\n 'azimuth': (geo.R2D * (sunpos.azimuth + Math.PI)) % 360\n };\n\n // moon times\n var moontimes = SunCalc.getMoonTimes(t, coord[1], coord[0]);\n var moonpos = SunCalc.getMoonPosition(t, coord[1], coord[0]);\n var moonlight = SunCalc.getMoonIllumination(t);\n\n this.scope_['moonAlwaysDown'] = moontimes.alwaysDown;\n this.scope_['moonAlwaysUp'] = moontimes.alwaysUp;\n\n if (moontimes.rise) {\n times.push({\n 'label': 'Moonrise',\n 'time': moontimes.rise.getTime(),\n 'color': '#ddd'\n });\n }\n\n if (moontimes.set) {\n times.push({\n 'label': 'Moonset',\n 'time': moontimes.set.getTime(),\n 'color': '#2F4F4F'\n });\n }\n\n var phase = '';\n for (var i = 0, n = PHASES.length; i < n; i++) {\n if (moonlight.phase >= PHASES[i].min && moonlight.phase < PHASES[i].max) {\n phase = PHASES[i].label;\n break;\n }\n }\n\n this.scope_['moon'] = {\n 'alwaysUp': moontimes.alwaysUp,\n 'alwaysDown': moontimes.alwaysDown,\n 'azimuth': (geo.R2D * (moonpos.azimuth + Math.PI)) % 360,\n 'altitude': moonpos.altitude * geo.R2D,\n 'brightness': Math.ceil(moonlight.fraction * 100) + '%',\n 'phase': phase\n };\n\n times = times.filter(filter);\n times.forEach(addTextColor);\n googArray.sortObjectsByKey(times, 'time');\n sets.push(times);\n\n this.scope_['times'] = times;\n ui.apply(this.scope_);\n }\n }", "@computed get bpmTime() { return 60 / this.tempo * 1000 / this.grid}", "function updateTime() {\n var strHours = document.getElementById(\"str-hours\"),\n strConsole = document.getElementById(\"str-console\"),\n strMinutes = document.getElementById(\"str-minutes\"),\n datetime = tizen.time.getCurrentDateTime(),\n hour = datetime.getHours(),\n minute = datetime.getMinutes();\n\n strHours.innerHTML = hour;\n strMinutes.innerHTML = minute;\n\n if (minute < 10) {\n strMinutes.innerHTML = \"0\" + minute;\n }\n if (hour < 10) {\n \t\tstrHours.innerHTML = \"0\" + hour;\n }\n\n if (flagDigital) {\n strConsole.style.visibility = flagConsole ? \"visible\" : \"hidden\";\n flagConsole = !flagConsole;\n } else {\n strConsole.style.visibility = \"visible\";\n flagConsole = false;\n }\n }", "now () {\n return this.t;\n }", "overTime(){\n\t\t//\n\t}", "get valueTime () {\r\n\t\treturn this._valueTime;\r\n\t}", "chronoStart(){\n this.start = new Date();\n this.chrono();\n }", "getTotalTime(){\n return this.totalTime;\n }", "calcTime() {\n const numIng = this.ingredients.length;\n const periods = Math.ceil(numIng / 3);\n this.time = periods * 15;\n }", "constructor() {\n /** Indicates if the clock is endend. */\n this.endedLocal = false;\n /** The duration between start and end of the clock. */\n this.diff = null;\n this.startTimeLocal = new Date();\n this.hrtimeLocal = process.hrtime();\n }", "updateTime() {\r\n if (this.state == STATES.play) {\r\n if (this.remain === 0) {\r\n return this.winner();\r\n }\r\n this.time += 0.1; \r\n this.htmlScore.innerHTML = (this.mines-this.flags) +\r\n \" / \" + this.mines + \" \" + this.time.toFixed(1);\r\n }\r\n }", "update() {\n /**\n * here we need to add the resting\n * similar to working. resting should also get a timer\n */\n if (this.playerWorking) {\n this.playerTimer++;\n $('#timer').html(this.playerTimer);\n this.setInfo();\n }\n\n if (this.resting) {\n this.restingTimer -= timeUpdate();\n this.setInfo();\n if (this.restingTimer <= 0) {\n this.resting = false;\n // when the agent has rested he also is less stressed\n this.stress /= 1.5;\n this.setInfo();\n }\n }\n\n if (this.working && !this.isPlayer) {\n\n // console.log((1 / frameRate()) * TIME_SCALE);\n this.workingTimer -= timeUpdate();\n this.setInfo();\n if (this.workingTimer <= 0) {\n this.hasTraded = false;// reset to false, very IMPORTANT otherwise the agent will always be called to do a traded task\n this.tradeTask = '';\n this.working = false;\n this.currentTask = '';\n this.setInfo();\n }\n }\n }", "get time() {\n return (process.hrtime()[0] * 1e9 + process.hrtime()[1]) / 1e6;\n }", "get startTime() { return this._startTime; }", "get itemTime(){ return this._itemTime; }", "initialize() {\n this.setDisplayDateTime();\n \n\n setInterval(() => {\n this.setDisplayDateTime();\n }, 1000);\n\n }", "function minuteTick(now) {\n var m = Switch.dateToMinutes(now);\n if (!switchStates || switchStates.length != config.switches.length) {\n switchStates = config.switches.map((d) => null);\n }\n var log = \"minuteTick \" + moment(new Date(now)).format(\"HH:mm\") + \" \" + m;\n config.switches.forEach((d, i) => {\n var s = new Switch(d.name, d.house, d.group, d.wakeUp, d.goToBed, d.weekendWakeUp, d.weekendGoToBed, config.latitude, config.longitude);\n var { sunrise, sunset } = s.getSun(now);\n if (sunset < sunrise) {\n sunset += 24 * 60;\n }\n if (i == 0) {\n log += \" \" + (m > sunrise && m < sunset ? \"day\" : \"night\");\n }\n var state = s.getState(now);\n log += \", \" + i + \": \" + switchStates[i] + \" => \" + state;\n if (switchStates[i] === null || switchStates[i] !== state) {\n switchStates[i] = state;\n log += \" command \" + d.house + \" \" + d.group + \" \" + state;\n comm.sendCommand(d.house, d.group, state);\n }\n });\n console.log(log);\n}", "function reportTime(){\n const date = new Date();\n const {time, mode} = getTime();\n const reportTime = `${time} ${mode} ${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()}`;\n return reportTime ;\n}", "function tick() {\n setTime(howOld(createdOn));\n }", "set_time( t ){ this.current_time = t; this.draw_fg(); return this; }", "function writingHour() {\n var d = new Date();\n\n if (d.getUTCHours() == (WH_TIME === 0 ? 23 : WH_TIME - 1) && d.getUTCMinutes() == 50 && WHSwitch === 0) {\n postMessage(\"[b][Alert][/b] 10 minutes until WH!\");\n WHSwitch++;\n } else if (d.getUTCHours() == (WH_TIME === 0 ? 23 : WH_TIME - 1) && d.getUTCMinutes() == 55 && WHSwitch == 1) {\n postMessage(\"[b][Alert][/b] 5 minutes until WH!\");\n WHSwitch++;\n } else if (d.getUTCHours() == WH_TIME && d.getUTCMinutes() === 0 && WHSwitch == 2) {\n postMessage(\"[b]Writing Hour begins![/b] Time to write, good luck!\");\n setTimeout(function(){closeChat();}, 1000);\n WHSwitch++;\n } else if (d.getUTCHours() == (WH_TIME == 23 ? 0 : WH_TIME + 1) && d.getUTCMinutes() === 0 && WHSwitch == 3) {\n setTimeout(function() {postMessage(\"[b]Writing Hour is over.[/b]\");}, 500);\n setTimeout(function(){openChat();}, 1000);\n WHSwitch = 0;\n }\n}", "passTime () {\n let time = this.player.castTimeRemaining\n if (time == 0 || (this.player.gcdRemaining > 0 && this.player.gcdRemaining < time)) time = this.player.gcdRemaining\n\n // Look for the shortest time until an action needs to be done\n if (this.player.pet) {\n\n // Pet's attacks/abilities and such\n if (this.player.pet.mode == PetMode.AGGRESSIVE) {\n if (this.player.pet.spells.melee && this.player.pet.spells.melee.cooldownRemaining < time) time = this.player.pet.spells.melee.cooldownRemaining\n else if (this.player.pet.type == PetType.RANGED && this.player.pet.castTimeRemaining > 0 && this.player.pet.castTimeRemaining < time) time = this.player.pet.castTimeRemaining\n\n if (this.player.pet.pet == PetName.SUCCUBUS) {\n if (this.player.pet.spells.lashOfPain.cooldownRemaining > 0 && this.player.pet.spells.lashOfPain.cooldownRemaining < time) time = this.player.pet.spells.lashOfPain.cooldownRemaining\n } else if (this.player.pet.pet == PetName.FELGUARD) {\n if (this.player.pet.spells.cleave.cooldownRemaining > 0 && this.player.pet.spells.cleave.cooldownRemaining < time) time = this.player.pet.spells.cleave.cooldownRemaining\n }\n }\n }\n\n if (this.player.auras.corruption && this.player.auras.corruption.active && this.player.auras.corruption.tickTimerRemaining < time) time = this.player.auras.corruption.tickTimerRemaining\n if (this.player.auras.siphonLife && this.player.auras.siphonLife.active && this.player.auras.siphonLife.tickTimerRemaining < time) time = this.player.auras.siphonLife.tickTimerRemaining\n if (this.player.auras.flameshock && this.player.auras.flameshock.active && this.player.auras.flameshock.tickTimerRemaining < time) time = this.player.auras.flameshock.tickTimerRemaining\n if (this.player.auras.curseOfAgony && this.player.auras.curseOfAgony.active && this.player.auras.curseOfAgony.tickTimerRemaining < time) time = this.player.auras.curseOfAgony.tickTimerRemaining\n if (this.player.auras.curseOfTheElements && this.player.auras.curseOfTheElements.active && this.player.auras.curseOfTheElements.durationRemaining < time) time = this.player.auras.curseOfTheElements.durationRemaining\n if (this.player.auras.curseOfRecklessness && this.player.auras.curseOfRecklessness.active && this.player.auras.curseOfRecklessness.durationRemaining < time) time = this.player.auras.curseOfRecklessness.durationRemaining\n if (this.player.auras.destructionPotion) {\n if (this.player.spells.destructionPotion.cooldownRemaining > 0 && this.player.spells.destructionPotion.cooldownRemaining < time) time = this.player.spells.destructionPotion.cooldownRemaining\n if (this.player.auras.destructionPotion.active && this.player.auras.destructionPotion.durationRemaining < time) time = this.player.auras.destructionPotion.durationRemaining\n }\n if (this.player.spells.flameCap) {\n if (this.player.spells.flameCap.cooldownRemaining > 0 && this.player.spells.flameCap.cooldownRemaining < time) time = this.player.spells.flameCap.cooldownRemaining\n if (this.player.auras.flameCap.active && this.player.auras.flameCap.durationRemaining < time) time = this.player.auras.flameCap.durationRemaining\n }\n if (this.player.spells.bloodFury) {\n if (this.player.spells.bloodFury.cooldownRemaining > 0 && this.player.spells.bloodFury.cooldownRemaining < time) time = this.player.spells.bloodFury.cooldownRemaining\n if (this.player.auras.bloodFury.active && this.player.auras.bloodFury.durationRemaining < time) time = this.player.auras.bloodFury.durationRemaining\n }\n if (this.player.spells.demonicRune && this.player.spells.demonicRune.cooldownRemaining > 0 && this.player.spells.demonicRune.cooldownRemaining < time) time = this.player.spells.demonicRune.cooldownRemaining\n if (this.player.spells.superManaPotion && this.player.spells.superManaPotion.cooldownRemaining > 0 && this.player.spells.superManaPotion.cooldownRemaining < time) time = this.player.spells.superManaPotion.cooldownRemaining\n if (this.player.spells.powerInfusion) {\n for (let i = 0; i < this.player.spells.powerInfusion.length; i++) {\n if (this.player.spells.powerInfusion[i].cooldownRemaining > 0 && this.player.spells.powerInfusion[i].cooldownRemaining < time) time = this.player.spells.powerInfusion[i].cooldownRemaining\n }\n }\n if (this.player.spells.bloodlust) {\n for (let i = 0; i < this.player.spells.bloodlust.length; i++) {\n if (this.player.spells.bloodlust[i].cooldownRemaining > 0 && this.player.spells.bloodlust[i].cooldownRemaining < time) time = this.player.spells.bloodlust[i].cooldownRemaining\n }\n if (this.player.auras.bloodlust.active && this.player.auras.bloodlust.durationRemaining < time) time = this.player.auras.bloodlust.durationRemaining\n }\n if (this.player.spells.innervate) {\n for (let i = 0; i < this.player.spells.innervate.length; i++) {\n if (this.player.spells.innervate[i].cooldownRemaining > 0 && this.player.spells.innervate[i].cooldownRemaining < time) time = this.player.spells.innervate[i].cooldownRemaining\n }\n if (this.player.auras.innervate.active && this.player.auras.innervate.durationRemaining < time) time = this.player.auras.innervate.durationRemaining\n }\n if (this.player.spells.mysticalSkyfireDiamond) {\n if (this.player.spells.mysticalSkyfireDiamond.cooldownRemaining > 0 && this.player.spells.mysticalSkyfireDiamond.cooldownRemaining < time) time = this.player.spells.mysticalSkyfireDiamond.cooldownRemaining\n if (this.player.auras.mysticalSkyfireDiamond.active && this.player.spells.mysticalSkyfireDiamond.durationRemaining < time) time = this.player.auras.mysticalSkyfireDiamond.durationRemaining\n }\n if (this.player.spells.insightfulEarthstormDiamond && this.player.spells.insightfulEarthstormDiamond.cooldownRemaining > 0 && this.player.spells.insightfulEarthstormDiamond.cooldownRemaining < time) time = this.player.spells.insightfulEarthstormDiamond.cooldownRemaining\n if (this.player.spells.timbalsFocusingCrystal && this.player.spells.timbalsFocusingCrystal.cooldownRemaining > 0 && this.player.spells.timbalsFocusingCrystal.cooldownRemaining < time) time = this.player.spells.timbalsFocusingCrystal.cooldownRemaining\n if (this.player.spells.markOfDefiance && this.player.spells.markOfDefiance.cooldownRemaining > 0 && this.player.spells.markOfDefiance.cooldownRemaining < time) time = this.player.spells.markOfDefiance.cooldownRemaining\n if (this.player.spells.lightningOverload && this.player.spells.lightningOverload.cooldownRemaining > 0 && this.player.spells.lightningOverload.cooldownRemaining < time) time = this.player.spells.lightningOverload.cooldownRemaining\n if (this.player.spells.drumsOfBattle && this.player.spells.drumsOfBattle.cooldownRemaining > 0 && this.player.spells.drumsOfBattle.cooldownRemaining < time) time = this.player.spells.drumsOfBattle.cooldownRemaining\n if (this.player.spells.drumsOfWar && this.player.spells.drumsOfWar.cooldownRemaining > 0 && this.player.spells.drumsOfWar.cooldownRemaining < time) time = this.player.spells.drumsOfWar.cooldownRemaining\n if (this.player.spells.drumsOfRestoration && this.player.spells.drumsOfRestoration.cooldownRemaining > 0 && this.player.spells.drumsOfRestoration.cooldownRemaining < time) time = this.player.spells.drumsOfRestoration.cooldownRemaining\n if (this.player.auras.drumsOfBattle && this.player.auras.drumsOfBattle.active && this.player.auras.drumsOfBattle.durationRemaining < time) time = this.player.auras.drumsOfBattle.durationRemaining\n if (this.player.auras.drumsOfWar && this.player.auras.drumsOfWar.active && this.player.auras.drumsOfWar.durationRemaining < time) time = this.player.auras.drumsOfWar.durationRemaining\n if (this.player.auras.drumsOfRestoration && this.player.auras.drumsOfRestoration.active && this.player.auras.drumsOfRestoration.tickTimerRemaining < time) time = this.player.auras.drumsOfRestoration.tickTimerRemaining\n if (this.player.auras.wrathOfCenarius && this.player.auras.wrathOfCenarius.active && this.player.auras.wrathOfCenarius.durationRemaining < time) time = this.player.auras.wrathOfCenarius.durationRemaining\n if (this.player.auras.spellstrikeProc && this.player.auras.spellstrikeProc.active && this.player.auras.spellstrikeProc.durationRemaining < time) time = this.player.auras.spellstrikeProc.durationRemaining\n if (this.player.auras.powerInfusion && this.player.auras.powerInfusion.active && this.player.auras.powerInfusion.durationRemaining < time) time = this.player.auras.powerInfusion.durationRemaining\n if (this.player.auras.eyeOfMagtheridon && this.player.auras.eyeOfMagtheridon.active && this.player.auras.eyeOfMagtheridon.durationRemaining < time) time = this.player.auras.eyeOfMagtheridon.durationRemaining\n if (this.player.auras.sextantOfUnstableCurrents) {\n if (this.player.auras.sextantOfUnstableCurrents.active && this.player.auras.sextantOfUnstableCurrents.durationRemaining < time) time = this.player.auras.sextantOfUnstableCurrents.durationRemaining\n if (this.player.spells.sextantOfUnstableCurrents.cooldownRemaining > 0 && this.player.spells.sextantOfUnstableCurrents.cooldownRemaining < time) time = this.player.spells.sextantOfUnstableCurrents.cooldownRemaining\n }\n if (this.player.auras.quagmirransEye) {\n if (this.player.auras.quagmirransEye.active && this.player.auras.quagmirransEye.durationRemaining < time) time = this.player.auras.quagmirransEye.durationRemaining\n if (this.player.spells.quagmirransEye.cooldownRemaining > 0 && this.player.spells.quagmirransEye.cooldownRemaining < time) time = this.player.spells.quagmirransEye.cooldownRemaining\n }\n if (this.player.auras.shiffarsNexusHorn) {\n if (this.player.auras.shiffarsNexusHorn.active && this.player.auras.shiffarsNexusHorn.durationRemaining < time) time = this.player.auras.shiffarsNexusHorn.durationRemaining\n if (this.player.spells.shiffarsNexusHorn.cooldownRemaining > 0 && this.player.spells.shiffarsNexusHorn.cooldownRemaining < time) time = this.player.spells.shiffarsNexusHorn.cooldownRemaining\n }\n if (this.player.spells.bladeOfWizardry) {\n if (this.player.spells.bladeOfWizardry.cooldownRemaining > 0 && this.player.spells.bladeOfWizardry.cooldownRemaining < time) time = this.player.spells.bladeOfWizardry.cooldownRemaining\n if (this.player.auras.bladeOfWizardry.active && this.player.auras.bladeOfWizardry.durationRemaining < time) time = this.player.auras.bladeOfWizardry.durationRemaining\n }\n if (this.player.spells.robeOfTheElderScribes) {\n if (this.player.spells.robeOfTheElderScribes.cooldownRemaining > 0 && this.player.spells.robeOfTheElderScribes.cooldownRemaining < time) time = this.player.spells.robeOfTheElderScribes.cooldownRemaining\n if (this.player.auras.robeOfTheElderScribes.active && this.player.auras.robeOfTheElderScribes.durationRemaining < time) time = this.player.auras.robeOfTheElderScribes.durationRemaining\n }\n if (this.player.auras.ashtongueTalismanOfShadows && this.player.auras.ashtongueTalismanOfShadows.active && this.player.auras.ashtongueTalismanOfShadows.durationRemaining < time) time = this.player.auras.ashtongueTalismanOfShadows.durationRemaining\n if (this.player.auras.darkmoonCardCrusade && this.player.auras.darkmoonCardCrusade.active && this.player.auras.darkmoonCardCrusade.durationRemaining < time) time = this.player.auras.darkmoonCardCrusade.durationRemaining\n if (this.player.auras.manaEtched4Set && this.player.auras.manaEtched4Set.active && this.player.auras.manaEtched4Set.durationRemaining < time) time = this.player.auras.manaEtched4Set.durationRemaining\n if (this.player.spells.theLightningCapacitor && this.player.spells.theLightningCapacitor.cooldownRemaining > 0 && this.player.spells.theLightningCapacitor.cooldownRemaining < time) time = this.player.spells.theLightningCapacitor.cooldownRemaining\n if (this.player.spells.elementalMastery && this.player.spells.elementalMastery.cooldownRemaining > 0 && this.player.spells.elementalMastery.cooldownRemaining < time) time = this.player.spells.elementalMastery.cooldownRemaining\n if (this.player.auras.bandOfTheEternalSage) {\n if (this.player.auras.bandOfTheEternalSage.active && this.player.auras.bandOfTheEternalSage.durationRemaining < time) time = this.player.auras.bandOfTheEternalSage.durationRemaining\n if (this.player.spells.bandOfTheEternalSage.cooldownRemaining > 0 && this.player.spells.bandOfTheEternalSage.cooldownRemaining < time) time = this.player.spells.bandOfTheEternalSage.cooldownRemaining\n }\n if (this.player.spells.shatteredSunPendantOfAcumen) {\n if (this.player.spells.shatteredSunPendantOfAcumen.cooldownRemaining > 0 && this.player.spells.shatteredSunPendantOfAcumen.cooldownRemaining < time) time = this.player.spells.shatteredSunPendantOfAcumen.cooldownRemaining\n if (this.player.auras.shatteredSunPendantOfAcumen && this.player.auras.shatteredSunPendantOfAcumen.active && this.player.auras.shatteredSunPendantOfAcumen.durationRemaining < time) time = this.player.auras.shatteredSunPendantOfAcumen.durationRemaining\n }\n if (this.player.mp5Timer < time) time = this.player.mp5Timer\n for (let i = 0; i < 2; i++) {\n if (this.player.trinkets[i]) {\n if (this.player.trinkets[i].active && this.player.trinkets[i].durationRemaining < time) time = this.player.trinkets[i].durationRemaining\n if (this.player.trinkets[i].cooldownRemaining > 0 && this.player.trinkets[i].cooldownRemaining < time) time = this.player.trinkets[i].cooldownRemaining\n }\n }\n if (this.player.pet) {\n if (this.player.pet.auras.blackBook && this.player.pet.auras.blackBook.active && this.player.pet.auras.blackBook.durationRemaining < time) time = this.player.pet.auras.blackBook.durationRemaining\n }\n\n // Pass time\n // This needs to be the first modified value since the time in combat needs to be updated before spells start dealing damage/auras expiring etc. for the combat logging.\n this.player.fightTime += time\n this.player.castTimeRemaining = Math.max(0, this.player.castTimeRemaining - time)\n\n // Pet\n if (this.player.pet) this.player.pet.tick(time)\n\n // Auras need to tick before Spells because otherwise you'll, for example, finish casting Corruption and then immediately afterwards, in the same millisecond, immediately tick down the aura\n // This was also causing buffs like the t4 4pc buffs to expire sooner than they should.\n\n // Auras\n if (this.player.auras.powerInfusion && this.player.auras.powerInfusion.active) this.player.auras.powerInfusion.tick(time)\n if (this.player.auras.corruption && this.player.auras.corruption.active) this.player.auras.corruption.tick(time)\n if (this.player.auras.siphonLife && this.player.auras.siphonLife.active) this.player.auras.siphonLife.tick(time)\n if (this.player.auras.flameshock && this.player.auras.flameshock.active) this.player.auras.flameshock.tick(time)\n if (this.player.auras.curseOfAgony && this.player.auras.curseOfAgony.active) this.player.auras.curseOfAgony.tick(time)\n if (this.player.auras.curseOfTheElements && this.player.auras.curseOfTheElements.active) this.player.auras.curseOfTheElements.tick(time)\n if (this.player.auras.curseOfRecklessness && this.player.auras.curseOfRecklessness.active) this.player.auras.curseOfRecklessness.tick(time)\n if (this.player.auras.destructionPotion && this.player.auras.destructionPotion.active) this.player.auras.destructionPotion.tick(time)\n if (this.player.auras.elementalMastery && this.player.auras.elementalMastery.active) this.player.auras.elementalMastery.tick(time)\n if (this.player.auras.flameCap && this.player.auras.flameCap.active) this.player.auras.flameCap.tick(time)\n if (this.player.auras.spellstrikeProc && this.player.auras.spellstrikeProc.active) this.player.auras.spellstrikeProc.tick(time)\n if (this.player.auras.eyeOfMagtheridon && this.player.auras.eyeOfMagtheridon.active) this.player.auras.eyeOfMagtheridon.tick(time)\n if (this.player.auras.sextantOfUnstableCurrents && (this.player.auras.sextantOfUnstableCurrents.active || this.player.auras.sextantOfUnstableCurrents.hiddenCooldownRemaining > 0)) this.player.auras.sextantOfUnstableCurrents.tick(time)\n if (this.player.auras.quagmirransEye && (this.player.auras.quagmirransEye.active || this.player.auras.quagmirransEye.hiddenCooldownRemaining > 0)) this.player.auras.quagmirransEye.tick(time)\n if (this.player.auras.shiffarsNexusHorn && this.player.auras.shiffarsNexusHorn.active) this.player.auras.shiffarsNexusHorn.tick(time)\n if (this.player.auras.manaEtched4Set && this.player.auras.manaEtched4Set.active) this.player.auras.manaEtched4Set.tick(time)\n if (this.player.auras.bloodFury && this.player.auras.bloodFury.active) this.player.auras.bloodFury.tick(time)\n if (this.player.auras.bloodlust && this.player.auras.bloodlust.active) this.player.auras.bloodlust.tick(time)\n if (this.player.auras.drumsOfBattle && this.player.auras.drumsOfBattle.active) this.player.auras.drumsOfBattle.tick(time)\n if (this.player.auras.drumsOfWar && this.player.auras.drumsOfWar.active) this.player.auras.drumsOfWar.tick(time)\n if (this.player.auras.drumsOfRestoration && this.player.auras.drumsOfRestoration.active) this.player.auras.drumsOfRestoration.tick(time)\n if (this.player.auras.ashtongueTalismanOfShadows && this.player.auras.ashtongueTalismanOfShadows.active) this.player.auras.ashtongueTalismanOfShadows.tick(time)\n if (this.player.auras.darkmoonCardCrusade && this.player.auras.darkmoonCardCrusade.active) this.player.auras.darkmoonCardCrusade.tick(time)\n if (this.player.auras.bladeOfWizardry && this.player.auras.bladeOfWizardry.active) this.player.auras.bladeOfWizardry.tick(time)\n if (this.player.auras.shatteredSunPendantOfAcumen && this.player.auras.shatteredSunPendantOfAcumen.active) this.player.auras.shatteredSunPendantOfAcumen.tick(time)\n if (this.player.auras.robeOfTheElderScribes && this.player.auras.robeOfTheElderScribes.active) this.player.auras.robeOfTheElderScribes.tick(time)\n if (this.player.auras.bandOfTheEternalSage && this.player.auras.bandOfTheEternalSage.active) this.player.auras.bandOfTheEternalSage.tick(time)\n if (this.player.auras.mysticalSkyfireDiamond && this.player.auras.mysticalSkyfireDiamond.active) this.player.auras.mysticalSkyfireDiamond.tick(time)\n if (this.player.auras.wrathOfCenarius && this.player.auras.wrathOfCenarius.active) this.player.auras.wrathOfCenarius.tick(time)\n if (this.player.auras.innervate && this.player.auras.innervate.active) this.player.auras.innervate.tick(time)\n\n // Spells\n if (this.player.spells.lightningBolt && this.player.spells.lightningBolt.casting) this.player.spells.lightningBolt.tick(time)\n if (this.player.spells.flameshock && this.player.spells.flameshock.casting) this.player.spells.flameshock.tick(time)\n if (this.player.spells.corruption && this.player.spells.corruption.casting) this.player.spells.corruption.tick(time)\n if (this.player.spells.destructionPotion && this.player.spells.destructionPotion.cooldownRemaining > 0) this.player.spells.destructionPotion.tick(time)\n if (this.player.spells.elementalMastery && this.player.spells.elementalMastery.cooldownRemaining > 0) this.player.spells.elementalMastery.tick(time)\n if (this.player.spells.superManaPotion && this.player.spells.superManaPotion.cooldownRemaining > 0) this.player.spells.superManaPotion.tick(time)\n if (this.player.spells.demonicRune && this.player.spells.demonicRune.cooldownRemaining > 0) this.player.spells.demonicRune.tick(time)\n if (this.player.spells.flameCap && this.player.spells.flameCap.cooldownRemaining > 0) this.player.spells.flameCap.tick(time)\n if (this.player.spells.bloodFury && this.player.spells.bloodFury.cooldownRemaining > 0) this.player.spells.bloodFury.tick(time)\n if (this.player.spells.mysticalSkyfireDiamond && this.player.spells.mysticalSkyfireDiamond.cooldownRemaining > 0) this.player.spells.mysticalSkyfireDiamond.tick(time)\n if (this.player.spells.drumsOfBattle && this.player.spells.drumsOfBattle.cooldownRemaining > 0) this.player.spells.drumsOfBattle.tick(time)\n if (this.player.spells.drumsOfWar && this.player.spells.drumsOfWar.cooldownRemaining > 0) this.player.spells.drumsOfWar.tick(time)\n if (this.player.spells.drumsOfRestoration && this.player.spells.drumsOfRestoration.cooldownRemaining > 0) this.player.spells.drumsOfRestoration.tick(time)\n if (this.player.spells.timbalsFocusingCrystal && this.player.spells.timbalsFocusingCrystal.cooldownRemaining > 0) this.player.spells.timbalsFocusingCrystal.tick(time)\n if (this.player.spells.markOfDefiance && this.player.spells.markOfDefiance.cooldownRemaining > 0) this.player.spells.markOfDefiance.tick(time)\n if (this.player.spells.lightningOverload && this.player.spells.lightningOverload.cooldownRemaining > 0) this.player.spells.lightningOverload.tick(time)\n if (this.player.spells.theLightningCapacitor && this.player.spells.theLightningCapacitor.cooldownRemaining > 0) this.player.spells.theLightningCapacitor.tick(time)\n if (this.player.spells.bladeOfWizardry && this.player.spells.bladeOfWizardry.cooldownRemaining > 0) this.player.spells.bladeOfWizardry.tick(time)\n if (this.player.spells.shatteredSunPendantOfAcumen && this.player.spells.shatteredSunPendantOfAcumen.cooldownRemaining > 0) this.player.spells.shatteredSunPendantOfAcumen.tick(time)\n if (this.player.spells.robeOfTheElderScribes && this.player.spells.robeOfTheElderScribes.cooldownRemaining > 0) this.player.spells.robeOfTheElderScribes.tick(time)\n if (this.player.spells.quagmirransEye && this.player.spells.quagmirransEye.cooldownRemaining > 0) this.player.spells.quagmirransEye.tick(time)\n if (this.player.spells.shiffarsNexusHorn && this.player.spells.shiffarsNexusHorn.cooldownRemaining > 0) this.player.spells.shiffarsNexusHorn.tick(time)\n if (this.player.spells.sextantOfUnstableCurrents && this.player.spells.sextantOfUnstableCurrents.cooldownRemaining > 0) this.player.spells.sextantOfUnstableCurrents.tick(time)\n if (this.player.spells.bandOfTheEternalSage && this.player.spells.bandOfTheEternalSage.cooldownRemaining > 0) this.player.spells.bandOfTheEternalSage.tick(time)\n if (this.player.spells.insightfulEarthstormDiamond && this.player.spells.insightfulEarthstormDiamond.cooldownRemaining > 0) this.player.spells.insightfulEarthstormDiamond.tick(time)\n if (this.player.spells.powerInfusion) {\n for (let i = 0; i < this.player.spells.powerInfusion.length; i++) {\n if (this.player.spells.powerInfusion[i].cooldownRemaining > 0) this.player.spells.powerInfusion[i].tick(time)\n }\n }\n if (this.player.spells.bloodlust) {\n for (let i = 0; i < this.player.spells.bloodlust.length; i++) {\n if (this.player.spells.bloodlust[i].cooldownRemaining > 0) this.player.spells.bloodlust[i].tick(time)\n }\n }\n if (this.player.spells.innervate) {\n for (let i = 0; i < this.player.spells.innervate.length; i++) {\n if (this.player.spells.innervate[i].cooldownRemaining > 0) this.player.spells.innervate[i].tick(time)\n }\n }\n\n // Trinkets\n if (this.player.trinkets[0]) this.player.trinkets[0].tick(time)\n if (this.player.trinkets[1]) this.player.trinkets[1].tick(time)\n\n this.player.gcdRemaining = Math.max(0, this.player.gcdRemaining - time)\n this.player.mp5Timer = Math.max(0, this.player.mp5Timer - time)\n this.player.fiveSecondRuleTimer = Math.max(0, this.player.fiveSecondRuleTimer - time)\n if (this.player.mp5Timer == 0) {\n this.player.mp5Timer = 5\n if (this.player.stats.mp5 > 0 || this.player.fiveSecondRuleTimer <= 0 || (this.player.auras.innervate && this.player.auras.innervate.active)) {\n const currentPlayerMana = this.player.mana\n // MP5\n if (this.player.stats.mp5 > 0) {\n this.player.mana = Math.min(this.player.stats.maxMana, this.player.mana + this.player.stats.mp5)\n }\n // Spirit mana regen\n if (this.player.fiveSecondRuleTimer <= 0 || (this.player.auras.innervate && this.player.auras.innervate.active)) {\n // Formula from https://wowwiki-archive.fandom.com/wiki/Spirit?oldid=1572910\n let mp5FromSpirit = 5 * (0.001 + Math.sqrt(this.player.stats.intellect * this.player.stats.intellectModifier) * (this.player.stats.spirit * this.player.stats.spiritModifier) * 0.009327)\n if (this.player.auras.innervate && this.player.auras.innervate.active) {\n mp5FromSpirit *= 4\n }\n this.player.mana = Math.min(this.player.stats.maxMana, this.player.mana + mp5FromSpirit)\n }\n const manaGained = this.player.mana - currentPlayerMana\n this.player.totalManaRegenerated += manaGained\n this.player.manaGainBreakdown.mp5.casts = this.player.manaGainBreakdown.mp5.casts + 1 || 1\n this.player.manaGainBreakdown.mp5.manaGain = this.player.manaGainBreakdown.mp5.manaGain + manaGained || manaGained\n this.player.combatLog('Player gains ' + Math.round(manaGained) + ' mana from MP5 (' + Math.round(currentPlayerMana) + ' -> ' + Math.round(this.player.mana) + ')')\n }\n }\n\n return time\n }", "setTime () {\n this.clock.time = moment()\n .local()\n .format(\"dddd, MMMM Do YYYY, h:mm:ss A\")\n }" ]
[ "0.6415461", "0.6378349", "0.62627757", "0.6210528", "0.61560214", "0.6148118", "0.61439914", "0.6081126", "0.6080375", "0.6006004", "0.60012776", "0.5998794", "0.59911495", "0.5936987", "0.5936987", "0.589188", "0.5864137", "0.5824479", "0.5819341", "0.57981336", "0.5797444", "0.57780075", "0.5769602", "0.57674086", "0.5740556", "0.5719127", "0.56997514", "0.56974053", "0.56953824", "0.56860846", "0.5661927", "0.5652108", "0.56457496", "0.5636986", "0.56192625", "0.56129616", "0.56080574", "0.5607213", "0.5598989", "0.5581608", "0.555556", "0.55545837", "0.5553312", "0.5551244", "0.5542744", "0.55225945", "0.55165046", "0.5512978", "0.5508994", "0.5503182", "0.5496243", "0.549567", "0.5493089", "0.549031", "0.5487054", "0.547198", "0.5466817", "0.5466674", "0.54623234", "0.5455759", "0.5455137", "0.54389", "0.5434233", "0.5428819", "0.542838", "0.5425653", "0.5415215", "0.54121965", "0.540992", "0.5408399", "0.5407973", "0.54059356", "0.5396595", "0.5392932", "0.53892064", "0.53891575", "0.53888535", "0.5385868", "0.53787833", "0.5378054", "0.5376721", "0.5375527", "0.53722787", "0.53721917", "0.537117", "0.5369941", "0.53639525", "0.5361236", "0.5356671", "0.53563327", "0.53555876", "0.5350976", "0.53492", "0.5345616", "0.5343042", "0.53424126", "0.5339255", "0.5337588", "0.5329413", "0.5327425" ]
0.62667125
2
gets the time that the standup report will be generated for a channel
function getStandupTime(channel, cb) { controller.storage.teams.get('standupTimes', function(err, standupTimes) { if (!standupTimes || !standupTimes[channel]) { cb(null, null); } else { cb(null, standupTimes[channel]); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getBotMsgTime(session){\n\tconsole.log(\"getBotMsgTime() executing\");\n\tvar botTime = new Date(session.userData.lastMessageSent);\n\tconsole.log(\"Bot time unformatted is:\");\n\tconsole.log(botTime);\n\n\tvar botTimeFormatted = dateFormat(botTime, \"yyyy-mm-dd HH:MM:ss\");\n\n\tconsole.log(\"Bot messaged at: \" + botTimeFormatted);\n\treturn botTimeFormatted;\n}", "function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}", "get time() {}", "function reportTime(){\n const date = new Date();\n const {time, mode} = getTime();\n const reportTime = `${time} ${mode} ${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()}`;\n return reportTime ;\n}", "getReadableTime() {\n // Debugging line.\n Helper.printDebugLine(this.getReadableTime, __filename, __line);\n\n // Stop the time please. How long was the crawling process?\n let ms = new Date() - this.startTime,\n time = Parser.parseTime(ms),\n timeString = `${time.d} days, ${time.h}:${time.m}:${time.s}`;\n\n this.output.write(timeString, true, 'success');\n this.output.writeLine(`Stopped at: ${new Date()}`, true, 'success');\n }", "get time() {\n return (process.hrtime()[0] * 1e9 + process.hrtime()[1]) / 1e6;\n }", "function pii_next_report_time() {\n var curr_time = new Date();\n\n curr_time.setSeconds(0);\n // Set next send time after 3 days\n curr_time.setMinutes( curr_time.getMinutes() + 4320);\n curr_time.setMinutes(0);\n curr_time.setHours(0);\n curr_time.setMinutes( curr_time.getMinutes() + pii_vault.config.reporting_hour);\n return new Date(curr_time.toString());\n}", "function getInitialTime() {\n changeTime();\n}", "function get_time() {\n let d = new Date();\n if (start_time != 0) {\n d.setTime(Date.now() - start_time);\n } else {\n d.setTime(0);\n }\n return d.getMinutes().toString().padStart(2,\"0\") + \":\" + d.getSeconds().toString().padStart(2,\"0\");\n }", "function getStats() {\n let timestamp = new Date(Date.now());\n let dateTime = timestamp.toDateString() + \" \" + timestamp.toLocaleTimeString()\n return dateTime;\n}", "get uptime() {\n if (this._state === exports.ClientState.ACTIVE\n && this._currentConnectionStartTime) {\n return Date.now() - this._currentConnectionStartTime;\n }\n else {\n return 0;\n }\n }", "liveTime() {\n\t\tthis.updateTime();\n\t\tthis.writeLog();\n\t}", "function get_time() {\n return Date.now();\n}", "function setStandupTime(channel, standupTimeToSet) {\n \n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n\n if (!standupTimes) {\n standupTimes = {};\n standupTimes.id = 'standupTimes';\n }\n\n standupTimes[channel] = standupTimeToSet;\n controller.storage.teams.save(standupTimes);\n });\n}", "_clock(subscription) {\n return new Promise((resolve, reject) => {\n let watcherInfo = this._getWatcherInfo(subscription);\n\n this._client.command(['clock', watcherInfo.root], (error, resp) => {\n if (error) {\n reject(error);\n } else {\n watcherInfo.since = resp.clock;\n resolve(resp);\n }\n });\n });\n }", "function getNoon(){\n\treturn time;\n}", "function getTimeLapse(session){\n\tconsole.log(\"getTimeLapse() executing\");\n\tvar botTime = new Date(session.userData.lastMessageSent);\n\tvar userTime = new Date(session.message.localTimestamp);\n\tvar userTimeManual = new Date(session.userData.lastMessageReceived);\n\tconsole.log(\"Time Lapse Info:\");\n\tvar timeLapseMs = userTimeManual - botTime;\n\tconsole.log(\"Time lapse in ms is: \" + timeLapseMs);\n\tvar timeLapseHMS = convertMsToHMS(timeLapseMs);\n\tconsole.log(\"Time lapse in HH:MM:SS: \" + timeLapseHMS);\n\treturn timeLapseHMS;\n}", "function getTime(){\n \n hr = hour();\n mn = minute();\n sc = second();\n}", "function o2ws_get_time() { return o2ws_get_float(); }", "function getAskingTime(user, channel, cb) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {\n cb(null,null);\n } else {\n cb(null, askingTimes[channel][user]); \n }\n }); \n}", "getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n }", "get remainingTime() {\r\n return Math.ceil((this.maxTime - this.timeTicker) / 60);\r\n }", "getTimePassed() {\n let createdAt = new Date(parseInt(this.props._id.slice(0,8), 16)*1000);\n let now = new Date();\n let diffMs = (now - createdAt); // milliseconds between now & createdAt\n let diffMins = Math.floor(diffMs / 60000); // minutes\n if(diffMins < 1)\n return \"just now\";\n if(diffMins == 1)\n return \"1 min\";\n let diffHrs = Math.floor(diffMins / 60); // hours\n if(diffHrs < 1)\n return `${diffMins} mins`;\n if(diffHrs == 1)\n return `1 hr`;\n let diffDays = Math.floor(diffHrs / 24); // days\n if(diffDays < 1)\n return `${diffHrs} hrs`;\n if(diffDays == 1)\n return `1 day`;\n let diffWeeks = Math.floor(diffDays / 7);\n if(diffWeeks < 1)\n return `${diffDays} days`;\n if(diffWeeks == 1)\n return `1 week`;\n return `${diffWeeks} weeks`;\n }", "function updateclock() {\n var date = new Date();\n var hours = date.getHours() < 10 ? \"0\" + date.getHours() : date.getHours();\n var minutes = date.getMinutes() < 10 ? \"0\" + date.getMinutes() : date.getMinutes();\n var seconds = date.getSeconds() < 10 ? \"0\" + date.getSeconds() : date.getSeconds();\n time = hours + \"\" + minutes + \"\" + seconds;\n return time;\n }", "function latestTime() {\n return web3.eth.getBlock('latest').timestamp;\n}", "function currTime(){\n let timeout = new Date();\n return timeout.toString();\n}", "function latestTime () {\n return web3.eth.getBlock('latest').timestamp\n}", "function respondWithTime(){\n sendMessage(buildBotMessage(new Date().toUTCString()));\n}", "function time() {\n return (Date.now() / 1000);\n }", "async run(message) {\n let days = 0;\n let week = 0;\n\n\n let uptime = ``;\n let totalSeconds = (this.client.uptime / 1000);\n let hours = Math.floor(totalSeconds / 3600);\n totalSeconds %= 3600;\n let minutes = Math.floor(totalSeconds / 60);\n let seconds = Math.floor(totalSeconds % 60);\n\n if(hours > 23){\n days = hours / 24;\n days = Math.floor(days);\n hours = hours - (days * 24);\n }\n\n if(minutes > 60){\n minutes = 0;\n }\n\n uptime += `${days} days, ${hours} hours, ${minutes} minutes and ${seconds} seconds`;\n\n let serverembed = new MessageEmbed()\n .setColor(0x00FF00)\n .addField('Uptime', uptime)\n .setFooter(`Hypixel Stats made by Slice#1007 | https://discord.gg/RGD8fkD`, 'https://i.imgur.com/WdvE9QUg.jpg');\n\n message.say(serverembed);\n }", "function time() {\n\treturn Date.now() / 1000.0;\n}", "function logStart() {\n return (new Date(Date.now())).toLocaleTimeString() + \" MMM-Nightscout: \";\n}", "function interval(){\n const date = new Date()\n return date.toLocaleTimeString()\n }", "getReport()\r\n\t{\r\n\t\tlet report = '';\r\n\r\n\t\tmembers.forEach( (member, duration) => s += member.username + '\\t\\t' + duration + ' seconds\\n' );\r\n\t\treturn report;\r\n\t}", "function getTime() {\n const date = new Date();\n const minutes = date.getMinutes();\n const hours = date.getHours();\n\n clockTitle.innerText = `${hours < 10 ? `0${hours}` : hours} : ${\n minutes < 10 ? `0${minutes}` : minutes\n }`;\n}", "async scoutPlayer(channel, target) {\n\t\tlet now = new Date().getTime();\n\t\tlet player = await sql.getPlayer(channel, target);\n\t\tif(!player) {\n\t\t\tconsole.log('Player not found');\n\t\t\treturn null;\n\t\t}\n\t\tlet embed = new Discord.RichEmbed();\n\t\tembed.setTitle(`SCANNING ${player.name.toUpperCase()}...`)\n\t\t\t.setColor(0x00AE86);\n\n\t\tif(player.isNemesis) {\n\t\t\tembed.setDescription('NEMESIS');\n\t\t} else if(this.isFusion(player)) {\n\t\t\tembed.setDescription(`Fusion between ${player.fusionNames[0]} and ${player.fusionNames[1]}`);\n\t\t}\n\t\t\n\t\tstats = 'Power Level: '\n\t\tlet training = player.status.find(s => s.type == enums.StatusTypes.Training);\n\t\tlet trainingTime = now - (training ? training.startTime : 0);\n\t\tif(player.status.find(s => s.type == enums.StatusTypes.Fern)) {\n\t\t\tstats += 'Unknown';\n\t\t} else {\n\t\t\tlet seenLevel = this.getPowerLevel(player);\n\t\t\tif(training) {\n\t\t\t\t// Estimate post-training power level\n\t\t\t\tlet world = await sql.getWorld(player.channel);\n\t\t\t\tconst hours = trainingTime / hour;\n\t\t\t\tif (hours > 72) {\n\t\t\t\t\thours = 72;\n\t\t\t\t}\n\t\t\t\tconst newPowerLevel = Math.pow(100, 1 + (world.heat + hours) / 1200);\n\t\t\t\tif (this.isFusion(player)) {\n\t\t\t\t\tnewPowerLevel *= 1.3;\n\t\t\t\t}\n\t\t\t\tif (player.status.find(s => s.type == enums.StatusTypes.PowerWish)) {\n\t\t\t\t\tnewPowerLevel *= 1.5;\n\t\t\t\t}\n\t\t\t\tif (hours <= 16) {\n\t\t\t\t\tseenLevel += newPowerLevel * (hours / 16);\n\t\t\t\t} else {\n\t\t\t\t\tseenLevel += newPowerLevel * (1 + 0.01 * (hours / 16));\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet level = numeral(seenLevel.toPrecision(2));\n\t\t\tstats += level.format('0,0');\n\t\t}\n\t\tif(training) {\n\t\t\tstats += `\\nTraining for ${this.getTimeString(trainingTime)}`;\n\t\t}\n\t\tembed.addField('Stats', stats);\n\n\t\treturn embed;\n }", "calcUptime() {\n lumServer.healthcheck.serverUptime = utils.milliSecsToString(utils.now());\n }", "function getUserMsgTime(session){\n\tconsole.log(\"getUserMsgTime() executing\");\n\tvar userTime = new Date(session.userData.lastMessageReceived);\n\tconsole.log(\"User unformatted is:\");\n\tconsole.log(userTime);\n\n\tvar userTimeFormatted = dateFormat(userTime, \"yyyy-mm-dd HH:MM:ss\");\n\tconsole.log(\"User time formatted:\" + userTimeFormatted);\n\n\treturn userTimeFormatted;\n}", "getPolltime() {\n if (this.adapter.config.polltime == 0) return 0;\n let deviceid = this.getDeviceId();\n let polltime = undefined;\n if (deviceid) {\n polltime = datapoints.getPolltime(deviceid);\n if (polltime === undefined) polltime = this.adapter.config.polltime || 0;\n if (this.adapter.config.polltime > polltime) polltime = this.adapter.config.polltime;\n return polltime;\n }\n return this.adapter.config.polltime;\n }", "getTime() {\n return this.startTime ? Math.floor((Date.now() - this.startTime) / 1000) : 0;\n }", "function returnTime(){\n let d = new Date();\n // Get the time settings\n let min = d.getMinutes();\n let hour = d.getHours();\n let time = hour + \":\" + min;\n return time;\n}", "get uptime() {\n return new Date().getTime() - this._startTime.getTime();\n }", "function getExperimentTime(){\n var curTime = new Date();\n return ((curTime.getTime() - experimentData.startTime.getTime())/1000);\n}", "function timeRun() {\n return ((new Date()).getTime() - START_TIME)/1000;\n}", "get time () {\n\t\treturn this._time;\n\t}", "getTime(){return this.time;}", "_getTime () {\r\n return (Date.now() - this._startTime) / 1000\r\n }", "function statistics() {\n\t/*var time = Date.now() - startTime - pauseTime;\n\t\tvar seconds = (time / 1000 % 60).toFixed(2);\n\t\tvar minutes = ~~(time / 60000);\n\t\tstatsTime.innerHTML = (minutes < 10 ? '0' : '') + minutes +\n\t(seconds < 10 ? ':0' : ':') + seconds;*/\n}", "getCurrentTime(){\n //Declaring & initialising variables\n\t\tlet crnt = new Date();\n\t\tlet hr = \"\";\n\t\tlet min = \"\";\n\n\t\t//checking if the hours are sub 10 if so concatenate a 0 before the single digit\n\t\tif (crnt.getHours() < 10){\n\t\t\thr = \"0\" + crnt.getHours();\n\t\t}\n\t\telse{\n\t\t\thr = crnt.getHours();\n\t\t}\n\n\t\t//checking if mins are sub 10 if so concatenate a 0 before the single digit\n\t\tif (crnt.getMinutes() < 10){\n\t\t\tmin = \"0\" + crnt.getMinutes()\n\t\t\treturn hr + \":\" + min\n\t\t}\n\t\telse{\n\t\t\tmin = crnt.getMinutes();\n\t\t\treturn hr + \":\" + min\n\t\t}\n\t}", "timeTillNextPossibleActivation() {\n return to(Date.now(), this.lastfire + this.cooldown);\n }", "timing() {\n const newTimeDisplayed = this.switchSession();\n\n if (newTimeDisplayed.sec === 0) {\n newTimeDisplayed.sec = 60;\n newTimeDisplayed.min -= 1;\n }\n\n newTimeDisplayed.sec -= 1;\n this.setState({ timeDisplayed: newTimeDisplayed, countdown: true });\n }", "function get_time() {\n return new Date().getTime();\n}", "function get_time() {\n return new Date().getTime();\n}", "function getRefresh() {\n var dt = new Date();\n return \"\" + dt.getTime();\n }", "calculateShutdownTime() {\n const failureThreshold = config.health.probeFailureThreshold || 3;\n const periodSeconds = config.health.probePeriodSeconds || 10;\n\n return failureThreshold * (periodSeconds * 1000) - 1000;\n }", "function get_Clock() {\n\t\tvar date = new Date();\n\t\tvar hours = date.getHours();\n\t\tvar min = date.getMinutes();\n\t\tvar sec = date.getSeconds();\n\t\tvar amPm = (hours < 12) ? \"am\" : \"pm\";\n\t\t\n\t\thours = (hours < 10) ? \"0\" + hours : hours;\n\t\tmin = (min < 10) ? \"0\" + min : min;\n\t\tsec = (sec < 10) ? \"0\" + sec : sec;\n\n\t\t// return hours + \":\" + min + \":\" + sec + \" \" + amPm;\n\t\treturn hours + \":\" + min + \" \" + amPm\n\t}", "function getTime() {\n\tOutput('<span>It\\'s the 21st century man! Get a SmartWatch</span></br>');\n}", "function getTime() {\r\n var currentTime = new Date();\r\n var hours = currentTime.getHours();\r\n var minutes = currentTime.getMinutes();\r\n if (minutes < 10) {\r\n minutes = \"0\" + minutes;\r\n }\r\n return hours + \":\" + minutes;\r\n}", "getTime(){\n var date = new Date();\n return [('00'+date.getHours()).slice(-2), ('00'+date.getMinutes()).slice(-2), ('00'+date.getSeconds()).slice(-2)].join(':');\n }", "function getTime(index) {\n\treturn buildings[index].time * timeMultiplier[index] * totalTimeMultiplier;\n}", "function setTime(dif) {\n let timeTracker = getterDOM(\"tracker\");\n timeTracker.innerHTML = translateTime(dif).minString + \":\" + translateTime(dif).secString;\n return timeTracker.innerHTML;\n}", "get time () { throw \"Game system not supported\"; }", "function producedPastHour() {\n let currentTime = new Date();\n let hourago = new Date(currentTime.getTime() - (60 * 60 * 1000));\n let producedKWH = 0;\n //Get the production readings from the past hour on phase 1\n request('http://raspberrypi.local:1080/api/chart/1/energy_pos/from/' + hourago.toISOString() + '/to/' + currentTime.toISOString(), (error, response, body) => {\n let resultJson = JSON.parse(body);\n let values = resultJson[0].values;\n //Accumulate the total amount fed during the past hour\n values.forEach((measurment) => {\n producedKWH += measurment.value;\n });\n\n //Unlock the account for 15000 milliseconds\n Web3Service.unlockAccount(meterAccount, \"1234\", 15000);\n //Execute the produce smart contract\n SmartGridContract.produce(producedKWH, meterAccount);\n });\n}", "function timeStart()\n{\n var ds = new Date();\n var hs = addZero(ds.getHours());\n var ms = addZero(ds.getMinutes());\n var ss = addZero(ds.getSeconds());\n return hs + \":\" + ms + \":\" + ss;\n}", "function getTime() {\n let hours = Math.floor(clock.getTime().time / 3600);\n let minutes = Math.floor((clock.getTime().time % 3600) / 60);\n let seconds = Math.floor((clock.getTime().time % 3600) % 60);\n\n if (hours === 0 && minutes === 0) {\n return `${seconds} Seconds`;\n } else if (hours === 0) {\n return `${minutes} ${(minutes === 1) ? \"Minute\" : \"Minutes\"}, ${seconds} ${(seconds === 1 || seconds === 0) ? \"Second\" : \"Seconds\"}`;\n } else {\n return `${hours}:${minutes}:${seconds}`;\n }\n\n}", "function gettime() {\n //return Math.round(new Date().getTime() / 1000);\n return Math.round(Date.now() / 1000);\n}", "function time() {\n\t\t\treturn (new Date()).getTime();\n\t\t}", "getCountdown() {\n return this.frameRate * (11 - this.level);\n }", "getTime(){\n this.time = millis();\n this.timeFromLast = this.time - this.timeUntilLast;\n\n this.lifeTime = this.time - this.startTime;\n \n \n }", "getGameTime() {\n return this.time / 1200;\n }", "function GetCurrentTime() {\n var sentTime = new Date();\n var dateTime = sentTime.toLocaleString();\n return dateTime;\n}", "static get_time() {\n return (new Date()).toISOString();\n }", "function pushTime() {\r\n var now = new Date();\r\n socket.broadcast(now.toString());\r\n\r\n setTimeout(pushTime, 1000);\r\n}", "get remainTime(){ \n let remainTime =''\n if (this.scheduler) {\n if (this.isPaused) {\n remainTime = 'pause';\n } else {\n let breakType = this.nextBreakType()\n if (breakType) {\n console.log(this.scheduler.timeLeft);\n remainTime = `${Utils.formatTillBreak(this.scheduler.timeLeft)}`\n }\n }\n }\n return remainTime\n }", "function getClock() {\n const date = new Date();\n const hours = String(date.getHours()).padStart(2, \"0\");\n // <- 2:min chracter(String), if chracter is less than 2, function will fill \"0\"\n const minutes = String(date.getMinutes()).padStart(2, \"0\");\n const seconds = String(date.getSeconds()).padStart(2, \"0\");\n clock.innerText = `${hours}:${minutes}:${seconds}`;\n}", "function send_client_info_timer() {\n if (fatal_error) {\n return;\n }\n\n /* send timer after channel starts playing */\n if (startup_delay_ms !== null) {\n that.send_client_info('timer');\n }\n\n /* periodically update vbuf and abuf in case 'updateend' is not fired */\n if (av_source) {\n av_source.vbuf_update();\n av_source.abuf_update();\n }\n }", "function getServerLocalDiffTime(){\n var startRequest = new Date().getTime();\n var config = getHdcontrolObject();\n var endRequest = new Date().getTime();\n var requestTime = parseInt((endRequest -startRequest)/1000);\n\n var diffTime = parseInt(parseInt(buyingTime/1000) - config.stime - requestTime);\n return diffTime;\n }", "get collectedDateTime() {\n\t\treturn this.__collectedDateTime;\n\t}", "function getCurrentTIME() {\n\t\t\tvar player_time = Processing.getInstanceById('raced');\n\t\t\t\t$('#jquery_jplayer_1').bind($.jPlayer.event.timeupdate, function(event) { // Adding a listener to report the time play began\n\t\t\t\t\tvar jstime = event.jPlayer.status.currentTime;\n\t\t\t\t\tvar percentduration = event.jPlayer.status.currentPercentAbsolute;\t\n\t\t\t\t\t\t\tplayer_time.timecurrent(jstime);\n\t\t\t\t\t\t\tplayer_time.timepercent(percentduration);\n\t\t\t\t});\n\t\t\t}", "function now() {\n\treturn 21;\n}", "static get lastReport() {}", "function print_time() {\n //console.clear();\n console.log(\"local_time : \", Date.now());\n console.log(\"server_time : \", api.get_time());\n console.log(\"delta_time : \", Date.now() - api.get_time());\n console.log(\"\");\n }", "getRealTime() {\n return Math.floor(this.time / 1000);\n }", "function timeCycle() {\r\n var time2 = Date.now();\r\n var msTimeDiff = time2 - gTime1;\r\n var timeDiffStr = new Date(msTimeDiff).toISOString().slice(17, -1);\r\n document.querySelector('.timer').innerHTML = timeDiffStr;\r\n}", "get displayTime() {\n return this._timeEl.innerHTML;\n }", "function getdisplaytime(secs){\n\t\t\t\tvar mins = Math.floor(secs/60);\n\t\t\t\tsecs = (secs-(mins*60));\n\t\t\t\tif(secs<10){ secs = '0'+secs; }\n\t\t\t\treturn mins+':'+secs;\n\t\t\t}", "function getRealSelectedTimeString() {\n return models[\"ChesapeakeBay_ADCIRCSWAN\"][\"lastForecast\"].clone().add(currentHourSetting, \"hours\").format(\"YYYY-MM-DD HH:MM:SS\")\n}", "function getTime() {\n let start = Date.now();\n totalTime = setInterval(function() {\n let difference = Date.now() - start;\n formatTime(difference);\n })\n}", "function time() {\r\n return Math.round((new Date()).getTime() / 1000); \r\n}", "function log() {\n var logElem = document.querySelector(\".tracker\");\n\n var time = new Date();\n console.log(time);\n logElem.innerHTML += time;\n}", "get time ()\n\t{\n\t\tlet speed = parseInt (this.token.actor.data.data.attributes.movement.walk, 10);\n\t\t\n\t\tif (! speed)\n\t\t\tspeed = 30;\n\n\t\treturn speed / this.gridDistance;\n\t}", "get_presenceMinTime()\n {\n return this.liveFunc._presenceMinTime;\n }", "function statistics() {\n var time = Date.now() - startTime - pauseTime;\n var seconds = (time / 1000 % 60).toFixed(2);\n var minutes = ~~(time / 60000);\n statsTime.innerHTML = (minutes < 10 ? '0' : '') + minutes +\n (seconds < 10 ? ':0' : ':') + seconds;\n}", "function shot(v, ch) {\n var d = new Date(ch.startTime);\n var h = d.getHours() - 1;\n var m = d.getMinutes();\n var s = d.getSeconds();\n return v.shots + \"/h/\" + h + \"/m/\" + m + \"/sec\" + s + \".jpg\";\n }", "function getCurTime(){\n var curTime = new Date();\n return ((curTime.getTime() - experimentData.startTime.getTime())/1000)/60;\n}", "function tellTime() {\n var now = new Date(); \n document.write(\"Current time: \"+ now);\n }", "function startChannelStats() {\n stats = setInterval(() => {\n ApiHandle.getStats().then(data => {\n if (data == null) { // They are not live or the channel doesn't exist.\n console.log(\"The user is not live or there was an error getting stats.\")\n } else { // Sets the info from the request next to the icons on the chat page.\n if (data.channel.stream.countViewers !== undefined && data.channel.stream.countViewers !== null) {\n document.getElementById(\"fasUsers\").innerHTML = `<span><i class=\"fas fa-users\"></i></span> ${data.channel.stream.countViewers}`\n }\n if (data.followers.length !== undefined && data.followers.length !== null) {\n document.getElementById(\"fasHeart\").innerHTML = `<span><i class=\"fas fa-heart\"></i></span> ${data.followers.length}`\n }\n if (data.channel.stream.newSubscribers !== undefined && data.channel.stream.newSubscribers !== null) {\n document.getElementById(\"fasStar\").innerHTML = `<span><i class=\"fas fa-star\"></i></span> ${data.channel.stream.newSubscribers}`\n }\n }\n })\n }, 900000);\n}", "function time() {\n var date = new Date();\n var hours = date.getHours();\n var minutes = date.getMinutes();\n if (minutes < 10) {\n minutes = \"0\" + minutes;\n }\n var time = hours + \":\" + minutes\n return time;\n}", "getPlayTime() {\n return this.time;\n }", "function cobaCollect() {\n var now = new Date();\n var anHourAgo = new Date(now.getTime() - (1 * 1000 * 60 * 60));\n var from = anHourAgo.getFullYear() + '-' + (anHourAgo.getMonth() + 1) + '-' + anHourAgo.getDate();\n from += ' ' + anHourAgo.getHours() + ':' + anHourAgo.getMinutes() + ':' + anHourAgo.getSeconds();\n var to = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate();\n to += ' ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();\n console.log('1 hour ago :', from, to);\n collectDataByDate(from, to);\n}" ]
[ "0.6040518", "0.60359293", "0.6010521", "0.6001613", "0.5957078", "0.5952818", "0.590619", "0.58774245", "0.5787974", "0.5776971", "0.56780404", "0.56668615", "0.5617398", "0.56120676", "0.5591071", "0.55838776", "0.55686265", "0.5552662", "0.55173296", "0.55053", "0.55017895", "0.54842645", "0.5483245", "0.5472952", "0.5462436", "0.54581654", "0.5450036", "0.543837", "0.54375696", "0.5427483", "0.5424656", "0.54229516", "0.54139835", "0.54108566", "0.54069537", "0.5404222", "0.53967345", "0.5390292", "0.5379326", "0.5376381", "0.53708553", "0.5369407", "0.53671765", "0.53612703", "0.5359138", "0.5357453", "0.5347936", "0.5341537", "0.5337984", "0.53314126", "0.53201926", "0.53188396", "0.53188396", "0.5317679", "0.53172165", "0.5315941", "0.5312314", "0.5302666", "0.5302379", "0.52970195", "0.5294404", "0.52910316", "0.5290279", "0.5289635", "0.52872735", "0.5283272", "0.52781713", "0.52780354", "0.5270376", "0.5268329", "0.5263056", "0.5249514", "0.5249491", "0.52484006", "0.52475625", "0.5245225", "0.52447164", "0.5242992", "0.52409315", "0.52362174", "0.5220509", "0.5214996", "0.52113026", "0.52082396", "0.5194736", "0.5191065", "0.5185641", "0.51844305", "0.51841235", "0.5173622", "0.51731706", "0.5171305", "0.5170382", "0.5168139", "0.5165581", "0.5162573", "0.51606566", "0.51571286", "0.5152822", "0.5152816" ]
0.7024009
0
gets all the times that standup reports will be generated for all channels
function getStandupTimes(cb) { controller.storage.teams.get('standupTimes', function(err, standupTimes) { if (!standupTimes) { cb(null, null); } else { cb(null, standupTimes); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}", "function getStandupTime(channel, cb) {\n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n if (!standupTimes || !standupTimes[channel]) {\n cb(null, null);\n } else {\n cb(null, standupTimes[channel]);\n }\n });\n}", "async function getTimeAwayPeriods() {\n\tlog( await api.getResourceJSON( 'time-away-periods' ) );\n}", "function getTimes() {\n\t\tvar ttimes = $(\"#ranging-time-wrap\").intervalWialon('get');\n\n\t\t// remove <br>\n\t\tvar tf = en_format_time.replace('<br>', ' ');\n\n\t\t// use timeZone:\n\t\tvar deltaTime = wialon.util.DateTime.getTimezoneOffset() + (new Date()).getTimezoneOffset() * 60;\n\t\tvar tfrom = ttimes[0] - deltaTime - wialon.util.DateTime.getDSTOffset(ttimes[0]);\n\t\tvar tto = ttimes[1] - deltaTime - wialon.util.DateTime.getDSTOffset(ttimes[1]);\n\t\tvar tnow = wialon.core.Session.getInstance().getServerTime() - deltaTime;\n\n\t\tvar df = $('#ranging-time-wrap').intervalWialon('__getData');\n\t\tdf = df.dateFormat || 'dd MMM yyyy';\n\n\t\tif (tto - tfrom < 86.4e3) {\n\t\t\ttto = tfrom;\n\t\t}\n\n\t\treturn [getTimeStr(tfrom, df), getTimeStr(tto, df), tnow, df];\n\t}", "getReport()\r\n\t{\r\n\t\tlet report = '';\r\n\r\n\t\tmembers.forEach( (member, duration) => s += member.username + '\\t\\t' + duration + ' seconds\\n' );\r\n\t\treturn report;\r\n\t}", "allTimeHighs() {\n return this.getAllTimeHighsV1()\n .catch((err) => {\n console.error(\"Error in 'allTimeHigh' method of nomics module\\n\" + err);\n throw new Error(err);\n });\n }", "generateAvailableTimes(datestamp, show_past, step = 15) {\n const now = dayjs__WEBPACK_IMPORTED_MODULE_4__();\n let date = dayjs__WEBPACK_IMPORTED_MODULE_4__(datestamp);\n const blocks = [];\n if (show_past || date.isAfter(now, 'd')) {\n date = date.startOf('d');\n }\n else if (date.isAfter(now, 'm')) {\n date = now;\n }\n date = date.minute(Math.ceil(date.minute() / step) * step);\n const end = date.endOf('d');\n // Add options for the rest of the day\n while (date.isBefore(end, 'm')) {\n blocks.push({\n name: `${date.format(Object(_user_interfaces_common__WEBPACK_IMPORTED_MODULE_3__[\"timeFormatString\"])())}`,\n id: date.format('HH:mm'),\n });\n date = date.add(step, 'm');\n }\n return blocks;\n }", "getFullSchedule(){\n let schedule = this._accountManager.viewSignedUpEvents(this._username);\n this._numCurrent = 1;\n this._numExpired = 1;\n\n let current = Object.keys(schedule[0]);\n let expired = Object.keys(schedule[1]);\n\n for (let i = 0; i < current.length; i++){\n current[i] = this._eventManager.getEvent(current[i]);\n }\n for (let i = 0; i < expired.length; i++){\n expired[i] = this._eventManager.getEvent(expired[i]);\n }\n this._schedule = [current, expired];\n }", "function getUpcomingTimes() {\n var now = moment().utc();\n var upcomingTimes = [];\n var count = 0;\n return new Promise(function(resolve, reject) {\n for (var i = 0; i < 5; i++) {\n aux(i, 'global', function() {\n if (count === 5)\n resolve(upcomingTimes);\n });\n }\n\n\n });\n\n function aux(digit, version, cb) {\n var options = {\n url: 'http://localhost:3000/api/turtle',\n qs: {\n digit: digit,\n version: 'global',\n },\n json: true,\n };\n\n return rp(options).then(function(dates) {\n var i = 0;\n upcomingTimes[digit] = moment.utc(dates[i]);\n while (now.isAfter(upcomingTimes[digit])) {\n upcomingTimes[digit] = moment.utc(dates[++i]);\n }\n count++;\n cb();\n }).catch(function(err) {\n console.log('Error retrieving date');\n count++;\n cb();\n });\n }\n}", "numbersToEvents() {\n for (let [key, value] of this.unoccupied) {\n let z = {summary: 'Zzzzz', start: {}, end: {}}\n z.start.dateTime = moment().set('hour', key).format()\n z.end.dateTime = moment()\n .set('hour', key + value)\n .format()\n this.sleepOptions.push(z)\n }\n\n return this.sleepOptions.slice(0, 3)\n }", "async getResponseTime() {\n\n const user = this.ctx.params.userId;\n let time = this.ctx.params.day;\n\n // set the duration time\n switch(time.toLowerCase()) {\n case 'week':\n time = 7;\n break;\n case 'month':\n time = 30;\n break;\n case '3month':\n time = 90;\n break;\n default:\n time = 180;\n break;\n }\n\n try {\n let str = `select checkerId, checkerName, count(id)\n from eventTAT\n where now() - interval '$1 d' < to_timestamp(createAt / 1000)\n and type = 2 and duration < 1000 * 60 * $2\n and shopId in (\n select shopId from shopUser\n where userId = $3)\n group by checkerId, checkerName\n order by checkerId`;\n const count1 = await this.app.db.query(str, [time, this.app.config.time.checkerResponseTime[0], user]);\n\n str = `select checkerId, checkerName, count(id)\n from eventTAT\n where now() - interval '$1 d' < to_timestamp(createAt / 1000)\n and type = 2 and duration > 1000 * 60 * $2 and duration < 1000 * 60 * $3\n and shopId in (\n select shopId from shopUser\n where userId = $4)\n group by checkerId, checkerName\n order by checkerId`;\n const count2 = await this.app.db.query(str, [time, this.app.config.time.checkerResponseTime[0], this.app.config.time.checkerResponseTime[1], user]);\n\n str = `select checkerId, checkerName, count(id)\n from eventTAT\n where now() - interval '$1 d' < to_timestamp(createAt / 1000)\n and type = 2 and duration > 1000 * 60 * $2\n and shopId in (\n select shopId from shopUser\n where userId = $3)\n group by checkerId, checkerName\n order by checkerId`;\n const count3 = await this.app.db.query(str, [time, this.app.config.time.checkerResponseTime[2], user]);\n\n const temp = {};\n count1.map(obj => {\n if (!temp[obj.checkerid]) {\n temp[obj.checkerid] = {\n checkerId: obj.checkerid,\n checkerName: obj.checkername,\n count1: +obj.count,\n count2: 0,\n count3: 0,\n }\n }\n });\n\n count2.map(obj => {\n if (!temp[obj.checkerid]) {\n temp[obj.checkerid] = {\n checkerId: obj.checkerid,\n checkerName: obj.checkername,\n count1: 0,\n count2: +obj.count,\n count3: 0\n }\n } else {\n temp[obj.checkerid].count2 = +obj.count;\n }\n });\n\n\n count3.map(obj => {\n if (!temp[obj.checkerid]) {\n temp[obj.checkerid] = {\n checkerId: obj.checkerid,\n checkerName: obj.checkername,\n count1: 0,\n count2: 0,\n count3: +obj.count,\n }\n } else {\n temp[obj[checkerid]].count3 = +obj.count;\n }\n });\n\n this.response(200, Object.values(temp));\n } catch (err) {\n this.response(400, 'get checker response time failed');\n }\n }", "get handlerTimings() {\n const handlerTimings = {};\n\n for (const key of Object.keys(this.transports)) {\n if (this.transports[key]) {\n Object.assign(handlerTimings, this.transports[key].timings);\n }\n }\n\n return handlerTimings;\n }", "function listOfEvents() {\n times = new Array(); \n gapi.client.calendar.events.list({\n 'calendarId': 'primary',\n 'timeMin': (new Date()).toISOString(),\n 'showDeleted': false,\n 'singleEvents': true,\n 'maxResults': 15,\n 'orderBy': 'startTime'\n }).then(function(response) {\n var events = response.result.items;\n //appendPre('Upcoming events:');\n\n if (events.length > 0) {\n var duration = 0;\n var possible_time = {\n \"hour\": [],\n 'duration': []\n };\n for (i = 0; i < events.length; i++) {\n var event = events[i];\n var when = event.start.dateTime;\n if (!when) { /* if the event is all day long */\n when = event.start.date;\n duration = 24;\n }\n var end = event.end.dateTime;\n if (!end) {\n end = event.end.date;\n }\n\n var endMin = stringToMinutes(end);\n var whenMin = stringToMinutes(when);\n\n if(duration < 24) duration = endMin - whenMin; /* sets duration */\n possible_time.hour = whenMin;\n possible_time.duration = duration;\n times.push(possible_time);\n\n /* reinitlizing variables */\n duration = 0;\n possible_time = {\n \"hour\":[],\n \"duration\":[]\n };\n\n console.log(\"before i will add event\");\n //addEvent(events);\n }\n } else {\n times = NULL; /* there are no upcoming events */\n }\n console.log(\"DONE GETTING CALENDAR TIMES\");\n console.log(times);\n return times; \n });\n}", "function multiDayReport(flower) {\n //var e = new Date(2014, 07, 01);\n var f = new Date(2014, 07, 07);\n //var start = e.getDate();\n var end = f.getDate();\n\n\n for (start = 01; start <= end; start++) {\n getReport(flower, start, function() {\n var j = stored_values.firstBloom;\n var k = parseInt(j);\n stored_values.day = k;\n if (k = undefined || k == 0) {\n $(n).prepend(\"<div class='well well-sm info'><p>'sup'</p></div>\");\n $(n).closest(\".caption\").find(\".well\").text(\"No blooms during this time.\");\n } else {\n var l = new Date(stored_values.day);\n var firstBloom = l.customFormat(\"#DDD# #h#:#mm# #ampm#\");\n console.log(firstBloom);\n var n = stored_values.bloomRange;\n var o = parseInt(n);\n var p = new Date(o);\n var bloomRange = p.customFormat(\"#mm#:#ss#\");\n console.log(bloomRange);\n var n = '#' + flower + 'Drop';\n var q = \"id='\" + flower + \"-well-\" + start + \"' \";\n var r = \"#\" + flower + \"-well-\" + start;\n $(n).prepend(\"<div class='well well-sm info \" + flower +\"-well' \" + q + \"<p align='center'>sup</p></div>\");\n $(r).text(\"Season Start: \" + firstBloom + \", Length: \" + bloomRange);\n $(\".well\").css(\"background-color\", \"#96A3CE\").css(\"color\", \"#fff\");\n };\n });\n };\n}", "function getTimeEntries() {\n\t\t\t\ttime.getTime().then(function(results) {\n\t\t\t\t\tvm.timeentries = results;\n\t\t\t\t\tconsole.log(vm.timeentries);\n\t\t\t\t}, function(error) {\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t});\n\t\t\t}", "function sGwDevTimerCount( params ){\n\treturn {\n\t\t\"devId\": params.gwId,\n\t\t\"count\": 0,\n\t\t\"lastFetchTime\": timestamp() - 15\n\t}\n}", "function getAllChannelDataTS(){\n getDataField1();\n getDataField2();\n getDataField3();\n getDataField4();\n getDataField5();\n getDataField6();\n getDataField7();\n getDataField8();\n }", "function generate_all_reports()\n{\n report_ToAnswer_emails();\n report_FollowUp_emails();\n report_Work_FollowUp_emails();\n}", "function checkTimesAndAskStandup(bot) {\n getAskingTimes(function (err, askMeTimes) {\n \n if (!askMeTimes) {\n return;\n }\n\n for (var channelId in askMeTimes) {\n\n for (var userId in askMeTimes[channelId]) {\n\n var askMeTime = askMeTimes[channelId][userId];\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n if (compareHoursAndMinutes(currentHoursAndMinutes, askMeTime)) {\n\n hasStandup({user: userId, channel: channelId}, function(err, hasStandup) {\n\n // if the user has not set an 'ask me time' or has already reported a standup, don't ask again\n if (hasStandup == null || hasStandup == true) {\n var x = \"\";\n } else {\n doStandup(bot, userId, channelId);\n }\n });\n }\n }\n }\n });\n}", "getGames () {\n let schedule = this.year + `${View.SPACE()}` + this.title + ` Draw ${View.NEWLINE()}`\n for (let aWeek of this.allGames) {\n schedule += 'Week:' + aWeek[0].week + `${View.NEWLINE()}`\n for (let aGame of aWeek) {\n// to get the date type, e.g. Mon, Jul 16 2018\n let newDate = new Date(aGame.dateTime).toDateString()\n// adding that date\n schedule += newDate + `${View.SPACE()}`\n// getting time like 7:35PM\n// was gonna use navigator.language instead of en-US but it comes up with korean\n// even thought default language is ENG\n let newTime = new Date(aGame.dateTime).toLocaleTimeString('en-US', {hour: 'numeric', minute: 'numeric'})\n schedule += newTime + `${View.SPACE()}`\n\n// getting name for home team from rank\n schedule += 'Team: ' + this.allTeams[aGame.homeTeamRank - 1].name + `${View.SPACE()}` + 'vs' + `${View.SPACE()}` + this.allTeams[aGame.awayTeamRank - 1].name + `${View.SPACE()}` + 'At: ' + this.allTeams[aGame.homeTeamRank - 1].venue + ', ' + this.allTeams[aGame.homeTeamRank - 1].city + `${View.NEWLINE()}`\n }\n }\n return schedule\n }", "function UsedTimeslots() {\n let result = [];\n\n for (let i = 0; i < $activityCheckboxes.length; i++ ) {\n let $checkbox = $($activityCheckboxes[i]);\n let checkboxIsChecked = $checkbox.prop(\"checked\");\n let timeslot = $checkbox.data(\"timeslot\");\n \n if ( checkboxIsChecked ) {\n result.push(timeslot);\n }\n }\n\n return result;\n }", "function allPossibleTime(){\n const result = [];\n for (let i = 10.00 ; i < 18.30 ; i = i + 0.30) {\n result.push(`${i}-${i + 0.30}`);\n }\n return result;\n }", "function getTimes() {\n const now = new Date;\n let helper = now.getDate() - 7;\n let oneWeekAgo = new Date;\n oneWeekAgo.setDate(helper);\n\n return [now, oneWeekAgo];\n}", "function channelHandler(agent) {\n console.log('in channel handler');\n var jsonResponse = `{\"ID\":10,\"Listings\":[{\"Title\":\"Catfish Marathon\",\"Date\":\"2018-07-13\",\"Time\":\"11:00:00\"},{\"Title\":\"Videoclips\",\"Date\":\"2018-07-13\",\"Time\":\"12:00:00\"},{\"Title\":\"Pimp my ride\",\"Date\":\"2018-07-13\",\"Time\":\"12:30:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:30:00\"},{\"Title\":\"Daria\",\"Date\":\"2018-07-13\",\"Time\":\"13:45:00\"},{\"Title\":\"The Real World\",\"Date\":\"2018-07-13\",\"Time\":\"14:00:00\"},{\"Title\":\"The Osbournes\",\"Date\":\"2018-07-13\",\"Time\":\"15:00:00\"},{\"Title\":\"Teenwolf\",\"Date\":\"2018-07-13\",\"Time\":\"16:00:00\"},{\"Title\":\"MTV Unplugged\",\"Date\":\"2018-07-13\",\"Time\":\"16:30:00\"},{\"Title\":\"Rupauls Drag Race\",\"Date\":\"2018-07-13\",\"Time\":\"17:30:00\"},{\"Title\":\"Ridiculousness\",\"Date\":\"2018-07-13\",\"Time\":\"18:00:00\"},{\"Title\":\"Punk'd\",\"Date\":\"2018-07-13\",\"Time\":\"19:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"20:00:00\"},{\"Title\":\"MTV Awards\",\"Date\":\"2018-07-13\",\"Time\":\"20:30:00\"},{\"Title\":\"Beavis & Butthead\",\"Date\":\"2018-07-13\",\"Time\":\"22:00:00\"}],\"Name\":\"MTV\"}`;\n var results = JSON.parse(jsonResponse);\n var listItems = {};\n textResults = getListings(results);\n\n for (var i = 0; i < results['Listings'].length; i++) {\n listItems[`SELECT_${i}`] = {\n title: `${getShowTime(results['Listings'][i]['Time'])} - ${results['Listings'][i]['Title']}`,\n description: `Channel: ${results['Name']}`\n }\n }\n\n if (agent.requestSource === 'hangouts') {\n const cardJSON = getHangoutsCard(results);\n const payload = new Payload(\n 'hangouts',\n cardJSON,\n {rawPayload: true, sendAsMessage: true},\n );\n agent.add(payload);\n } else {\n agent.add(textResults);\n }\n}", "function genReport(data){\n var byweek = {};\n function groupweek(value, index, array){\n if(value.Owner === window.myName){\n var d = new Date(value['Datetime']);\n d = Math.floor(d.getTime()/weekfactor);\n byweek[d] = byweek[d] || [];\n byweek[d].push(value);\n }\n\n }\n data.map(groupweek);\n return byweek;\n}", "function reportTime(){\n const date = new Date();\n const {time, mode} = getTime();\n const reportTime = `${time} ${mode} ${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()}`;\n return reportTime ;\n}", "function getNowUnits(now){\n //$log.debug('getNowUnits',now.toISOString(), 'calc for unit ',$scope.units[$scope.indexDefaultUnit].key);\n var initStart = {hour:0,minute:0,second:0,millisecond:0};\n var initEnd = {hour:23,minute:59,second:59,millisecond:999};\n var phases = ['NIGHT','MORNING','AFTERNOON','EVENING'];\n // considero l'unita' correte (es. settimana, mese, anno)\n switch($scope.units[$scope.indexDefaultUnit].key){\n // fasi della giornata\n case 'hour':\n // 0: notte, 1: mattina, 2: pomeriggio, 3: sera\n // intervalli di 6 ore\n var duration = parseInt(24/phases.length);\n var n = angular.copy(now);\n n.set(initStart);\n var array = [];\n for (var i = 0; i < phases.length; i++){\n var start = angular.copy(n)\n start.add(i*duration,'hour');\n var end = angular.copy(n)\n end.add((i+1)*duration,'hour').subtract(1,'millisecond');\n var interval = moment.interval(start,end);\n var obj = {label:phases[i],interval:interval,upLabel:interval.start().format('HH:mm'),class:'noclick'};\n if(!$scope.isMobile){\n obj.class='six';\n }\n array.push(obj);\n //$log.debug('check interval phases ',interval.start(),interval.end());\n }\n //$log.debug('check interval phases ',array);\n return array;\n break;\n // giorni della settimana\n case 'day':\n // 0: lunedi, 1: martedi, 2: mercoledi\n // 3: giovedi, 4: venerdi, 5: sabato,6: domenica,\n var labels = moment.weekdays();\n var format = $scope.isMobile ? 'ddd' : 'dddd';\n //var format = $scope.isMobile ? '' : '';//moment.weekdays();\n var days = [];\n for(var i = 0; i < 7; i++){\n // genero l'intervallo giornaliero\n\n var start = angular.copy(now).weekday(i).set(initStart);\n var end = angular.copy(now).weekday(i).set(initEnd);\n var interval = moment.interval(start,end);\n var weekday = $scope.isMobile ? localeData.weekdaysShort(start):localeData.weekdays(start);\n var obj = {label:weekday,//start.format(format),\n interval:interval,\n upLabel:interval.start().format('DD')};\n if(!$scope.isMobile){\n obj.class='four';\n }\n //$log.debug('is sunday?',interval.start().format('dddd'),interval.start().format('dddd') === 'Sunday')\n if(interval.start().format('dddd') === 'Sunday' || interval.start().format('dddd') === 'Domenica')\n obj.class = obj.class+' red';\n days.push(obj);\n // $log.debug('check interval weekdays ',interval.start(),interval.end());\n }\n // $log.debug('check interval weekdays ',days);\n return days;\n break;\n // settimane del mese\n case 'date':\n var weeks = [];\n // calcolo quante settimane ci sono nel mese corrente\n // creo un array con i giorni del mese\n var current = angular.copy(now);\n var daysInMonth = current.daysInMonth()+current.day();\n var week = 1;\n // $log.debug('numero di giorni del mese pesati con current day ',daysInMonth,current.day(),7-current.day());\n for(var j = 1; j <= daysInMonth+6 ; j += 7){\n // prendo un giorno ogni sette, in modo da caricare nelle settimane\n current.date(j);\n // $log.debug(j,' current ',current.format('DD/MM/YYYY'));\n // calcolo l'intervallo della settimana (puo' uscire dal mese)\n var startIndex = 0,\n endIndex = 6;\n // if($translate.use() === 'en'){\n // startIndex = 1;\n // endIndex = 7;\n // }\n var start = angular.copy(current).weekday(startIndex);\n var end = angular.copy(current).weekday(endIndex);\n var interval = angular.copy(moment.interval(start,end));\n // creo l'etichetta per la settimana\n var label = \"\";\n // costruzione della label\n if(start.month() < now.month() ){\n label = label.concat(start.format('DD'),\"-\",end.format('DD'))\n }else if( end.month() > now.month()){\n label = label.concat(start.format('DD'),\"-\",end.format('DD/MM'))\n }else{\n label = label.concat(start.format('DD'),\"-\",end.format('DD'))\n }\n // scorro\n if(now.month() == start.month()){\n // label = label.concat(week++).concat(\"a \").concat('Settimana');\n }else if(start.month() < now.month() || start.year() < now.year()){\n // caso: ultima settimana del mese precedente\n // ultimo lunedi del mese precedente - 1 /7 ti da il numero di settimane \n var prevMonth = angular.copy(now).endOf('month').subtract(1,'month').day('Monday').date()-1;\n // label = label.concat(parseInt((prevMonth)/7)+1).concat(\"a \").concat('Settimana');\n }else{\n break;\n }\n\n var monthLabel = $scope.isMobile ? localeData.monthsShort(interval.start()) : localeData.months(interval.start());\n var obj = {\n interval:interval,\n upLabel:interval.start().format('DD').concat(\" \",monthLabel)};\n if(!$scope.isMobile){\n obj.class='seven';\n }\n weeks.push(obj);\n// weeks.push({label:label,interval:interval,upLabel:interval.start().format('DD MMMM')}); \n // $log.debug('check interval date ',interval.start().format('DD/MM/YYYY'),interval.end().format('DD/MM/YYYY'));\n }\n // $log.debug('check interval date ',weeks);\n return weeks;\n break;\n // giorni del mese\n case 'month':\n var days = [];\n // creo un array con i giorni del mese\n for(var j = 1; j <= now.daysInMonth(); j++){\n var start = angular.copy(now).date(j).set(initStart);\n var end = angular.copy(now).date(j).set(initEnd);\n var interval = moment.interval(start,end);\n days.push({label:j,interval:interval,upLabel:interval.start().format('')}); \n //$log.debug('check interval month ',interval.start(),interval.end());\n }\n // $log.debug('check interval month ',days);\n return days;\n break;\n // mesi dell'anno\n case 'year':\n // 0: gennaio, 1: febbraio, 2: marzo, 3: aprile, 4: maggio\n // 5: giugno, 6: luglio, 7: agosto, 8: settembre, 9: ottobre\n // 10: novembre, 11: dicembre\n var months = [];\n var month = angular.copy(now);\n for(var i = 0 ; i < 12; i ++){\n month.month(i);\n var start = angular.copy(month).date(1).set(initStart);\n var end = angular.copy(month).date(month.daysInMonth()).set(initEnd);\n var interval = moment.interval(start,end);\n var e = {label:start.format('M'),interval:interval}\n\n var monthLabel = $scope.isMobile ? localeData.monthsShort(interval.start()) : localeData.months(interval.start());\n e.upLabel = monthLabel;//interval.start().format('MMMM');\n months.push(e);\n //$log.debug('check interval year ',interval.start(),interval.end());\n }\n // $log.debug('check interval year ',months);\n return months;\n break;\n // altrimenti array vuoto\n default:\n return [];\n }\n\n }", "function dailyCheck(){\n // set later to use local time\n later.date.localTime();\n // this is 8 PM on July 23rd\n var elevenAM = later.parse.recur().every(1).dayOfMonth().on(11).hour();\n var tenAM = later.parse.recur().every(1).dayOfMonth().on(10).hour();\n\n var timer2 = later.setInterval(remindPresentingGroups, elevenAM);\n var timer3 = later.setInterval(otherReminders, tenAM);\n}", "timesheets() {\n var from = FlowRouter.getParam(\"from\");\n var to = FlowRouter.getParam(\"to\");\n var projectId = FlowRouter.getParam(\"projectId\");\n var timesheets = [];\n var result = null;\n\n //if it's date range, making sure query reflects the range\n if (from == null || to == null) {\n result = Timesheets.find();\n } else {\n result = Timesheets.find({\n $and:[\n {'date': {$gte: from}}, \n {'date': {$lte: to}}\n ]});\n }//end of date range if-else statement\n \n \n var fectchResult = result.fetch();\n var dateString = '';\n \n //consolidatedArray.push.apply(fectchResult);\n fectchResult.forEach(function (entry) {\n var timechunks = Timechunks.find({$and:[{'timesheet': entry._id}, {'project': projectId}]}).fetch();\n if(FlowRouter.getParam(\"reportType\") == \"daily\") {\n dateString = getStringDate(entry.date, 'dddd, MMMM Do YYYY');\n\n } else if (FlowRouter.getParam(\"reportType\") == \"weekly\" || FlowRouter.getParam(\"reportType\") == \"date_range\") {\n var curr = new Date(entry.date);\n var first = curr.getDate() - curr.getDay(); // First day is the day of the month - the day of the week\n var last = first + 6; // last day is the first day + 6\n var dateString = getStringDate(new Date(curr.setDate(first)), 'MMMM Do YYYY') + \" - \" + getStringDate(new Date(curr.setDate(last)), 'MMMM Do YYYY');\n\n } else if(FlowRouter.getParam(\"reportType\") == \"monthly\") {//Check if monthly\n var dateString = getStringDate(entry.date, 'MMMM YYYY');\n }\n \n timechunks.forEach(function (timechunck) {\n var key = dateString;\n var userId = timechunck.userInfo[\"userId\"];\n console.log(\"Printng userId----*****\", userId);\n if(timeChunkObject[key] == null) {\n \n var timeChunkData = {};\n timeChunkData[\"name\"] = (timechunck.userInfo.firstName + \" \" + timechunck.userInfo.lastName);\n timeChunkData[\"totalHours\"] = getTotalHoursForTimeChunk(timechunck);\n timeChunkData[\"date\"] = dateString;\n\n var userObj = {};\n userObj[userId] = timeChunkData;\n\n /*\n monday: {\n userId: {}\n userId2: {}\n userId3 : {}\n }\n\n */\n timeChunkObject[key] = userObj;\n timeChunkKeyArray.push(key);\n //console.log(\"Adding to array key\", timeChunkObject);\n \n } else {\n /*\n we have a json that looks like this. \n {\n \"userId\": {\n \"name\": nameOfUserInTimeChunk,\n \"totalHours\": total hours for a user in time chunk\n }\n }\n */\n \n if(timeChunkObject[dateString][userId] == null) {\n \n console.log(\"printing else oj\",timeChunkObject[dateString]);\n \n\n console.log(\"tcObj before\", timeChunkObject);\n var timeChunkData = {};\n timeChunkData[\"name\"] = (timechunck.userInfo.firstName + \" \" + timechunck.userInfo.lastName);\n timeChunkData[\"totalHours\"] = getTotalHoursForTimeChunk(timechunck);\n timeChunkData[\"date\"] = dateString;\n\n var data = timeChunkObject[dateString];\n data[userId] = timeChunkData;\n timeChunkObject[dateString] = data;\n \n\n } else {\n console.log(\"tcObj\", timeChunkObject);\n\n //get the value from timeChunkObject\n var data = timeChunkObject[key][userId]; \n \n // if(data[\"userId\"] === userId) {\n\n // } else {\n\n // }\n //get the totalhour from the value(data)\n var totalHours = data[\"totalHours\"];\n \n //aggregate the existing hour with the new time chunk hour\n var concatHours = totalHours + getTotalHoursForTimeChunk(timechunck);\n \n // update the value object totalhours with aggreagated value\n data[\"totalHours\"] = concatHours;\n\n //Set the upated value object back to timechunkObject\n timeChunkObject[key][userId] = data;\n }\n\n console.log(\"PRINTING DATA\", timeChunkObject);\n \n }\n });\n\n });//end of fetchResult forEach loop\n \n var showNodataValue = timeChunkKeyArray.length === 0;\n Session.set(\"showNoData\", showNodataValue);\n\n\n return timeChunkKeyArray;\n\n }", "async function getAllPastGames(){\n let data ={games:\"\",eventLogs:\"\"};\n const currentDate = new Date();\n const timestamp = currentDate.getTime(); \n const past_games = await DButils.execQuery(\n `SELECT * FROM dbo.Games WHERE game_timestamp < '${timestamp}' `\n );\n past_games.sort(function(first, second) {\n return first.game_timestamp - second.game_timestamp;\n });\n let logs = [];\n past_games.forEach(async (g)=> {\n const log = await getEventLog(g.game_id);\n if(log.length>0){\n logs.push(log);\n }\n })\n data.games = past_games;\n data.eventLogs = logs;\n return data;\n}", "function getTimeEntries() {\n time.getTime().then(function (results) {\n vm.timeentries = results;\n updateTotalTime(vm.timeentries);\n console.log(vm.timeentries);\n }, function (error) {\n console.log(error);\n });\n }", "static async listSleepData() {\n\t\tconst results = await db.query(\n\t\t\t`\n\t\t\t\tSELECT s.id,\n\t\t\t\t\t\ts.user_id,\n\t\t\t\t\t\ts.bed_time,\n\t\t\t\t\t\ts.wake_up_time\n\t\t\t\tFROM single_sleep_tracker as s\n\t\t\t\tORDER BY s.id DESC\n\t\t\t`\n\t\t);\n\n\t\treturn results.rows;\n\t}", "function cobaCollect() {\n var now = new Date();\n var anHourAgo = new Date(now.getTime() - (1 * 1000 * 60 * 60));\n var from = anHourAgo.getFullYear() + '-' + (anHourAgo.getMonth() + 1) + '-' + anHourAgo.getDate();\n from += ' ' + anHourAgo.getHours() + ':' + anHourAgo.getMinutes() + ':' + anHourAgo.getSeconds();\n var to = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate();\n to += ' ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();\n console.log('1 hour ago :', from, to);\n collectDataByDate(from, to);\n}", "function getStats() {\n let timestamp = new Date(Date.now());\n let dateTime = timestamp.toDateString() + \" \" + timestamp.toLocaleTimeString()\n return dateTime;\n}", "getPingsForNow(bot) {\n\t\tvar dt = dateTime.create();\n\t\tvar today = new Date(dt.now());\n\t\tvar today_datestring = ''+(today.getUTCMonth()+1)+'/'+today.getUTCDate()+'/'+today.getUTCFullYear();\n\t\t//var query = \"select * from users where ping_time = '\"+new Date(dt.now()).getHours()+\":00:00' and ( ping_day = 'EVERYDAY' or ping_day = '\"+today_datestring+\"')\";\n\t\tvar query = \"select u.username from team t inner join users u on (t.t_id = u.t_id) where ((u.ping_day = '\"+today_datestring+\"' or u.ping_day = 'EVERYDAY') and u.ping_time = '\" + new Date(dt.now()).getHours() + \":00:00')\"\n\t\t\t+ \" OR u.ping_day != '\"+today_datestring+\"' and u.ping_day != 'EVERYDAY' and t.ping_time = '\" + new Date(dt.now()).getHours() + \":00:00'\";\n\t\tvar users = [];\n\t\tvar getUsers = function (err, data) {\n\t\t\tif (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (var i in data.rows) {\n\t\t\t\tbot.bot.startPrivateConversation({ user: data.rows[i]['username'] }, function (err, convo) {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconvo.say(\"Hello there! <@\" + data.rows[i]['username'] + \">\");\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//users.addRow(data[i]);\n\t\t\t}\n\t\t}\n\t\tDataAccess.select(query, getUsers);\n\t\treturn users;\n\t}", "setupTimes(){\n\n\n this.fixation_time_1 = 4;\n this.fixation_time_2 = 1;\n\n this.learn_time = 0.4 * this.stimpair.learn.getDifficulty();\n this.test_time = this.learn_time;\n\n this.total_loop_time = this.learn_time+this.fixation_time_1+this.test_time+this.fixation_time_2;\n\n this.t_learn = SchedulerUtils.getStartEndTimes(0,this.learn_time);\n\n this.t_test = SchedulerUtils.getStartEndTimes(this.t_learn.end+this.fixation_time_1,this.test_time);\n\n console.log(\"times: \",\"fixation: \",this.initial_fixation,\" learn: \",this.learn_time,\" total: \",this.total_loop_time);\n\n }", "async generateReportLoop() {\n while ( true ) { // eslint-disable-line no-constant-condition\n try {\n winston.info( 'Generating Report' );\n const testNameMap = {};\n this.snapshots.forEach( snapshot => snapshot.tests.forEach( test => {\n testNameMap[ test.nameString ] = test.names;\n } ) );\n const testNameStrings = _.sortBy( Object.keys( testNameMap ) );\n const testNames = testNameStrings.map( nameString => testNameMap[ nameString ] );\n\n const elapsedTimes = testNames.map( () => 0 );\n const numElapsedTimes = testNames.map( () => 0 );\n\n const snapshotSummaries = [];\n for ( const snapshot of this.snapshots.slice( 0, MAX_SNAPSHOTS ) ) {\n snapshotSummaries.push( {\n timestamp: snapshot.timestamp,\n shas: snapshot.shas,\n tests: testNames.map( ( names, i ) => {\n const test = snapshot.findTest( names );\n if ( test ) {\n const passedTestResults = test.results.filter( testResult => testResult.passed );\n const failedTestResults = test.results.filter( testResult => !testResult.passed );\n const failMessages = _.uniq( failedTestResults.map( testResult => testResult.message ).filter( _.identity ) );\n test.results.forEach( testResult => {\n if ( testResult.milliseconds ) {\n elapsedTimes[ i ] += testResult.milliseconds;\n numElapsedTimes[ i ]++;\n }\n } );\n\n const result = {\n y: passedTestResults.length,\n n: failedTestResults.length\n };\n if ( failMessages.length ) {\n result.m = failMessages;\n }\n return result;\n }\n else {\n return {};\n }\n } )\n } );\n await sleep( 0 ); // allow other async stuff to happen\n }\n\n const testAverageTimes = elapsedTimes.map( ( time, i ) => {\n if ( time === 0 ) {\n return time;\n }\n else {\n return time / numElapsedTimes[ i ];\n }\n } );\n const testWeights = [];\n for ( const names of testNames ) {\n const test = this.snapshots[ 0 ] && this.snapshots[ 0 ].findTest( names );\n if ( test ) {\n testWeights.push( Math.ceil( test.weight * 100 ) / 100 );\n }\n else {\n testWeights.push( 0 );\n }\n await sleep( 0 ); // allow other async stuff to happen\n }\n\n const report = {\n snapshots: snapshotSummaries,\n testNames: testNames,\n testAverageTimes: testAverageTimes,\n testWeights: testWeights\n };\n\n await sleep( 0 ); // allow other async stuff to happen\n\n this.reportJSON = JSON.stringify( report );\n }\n catch( e ) {\n this.setError( `report error: ${e}` );\n }\n\n await sleep( 5000 );\n }\n }", "function getTickers(){\n tickers();\n // set interval\n setInterval(tickers, 60000);\n}", "static get reports() {}", "getSunHoursHistory(){\n if(this.hardware !== \"-\"){\n let ref = firebase.database().ref('Plants/HardwareID' + this.hardware);\n let child = ref.child('LightLevel');\n let arr = [];\n\n child.on('value', snap => {\n Object.keys(snap.val()).map(function (key){\n arr.push(snap.val()[key]);\n\n })\n });\n //Make sure that chart still shows values even if method is fetching data from DB\n //Also act as a buffer\n //clears listeners after 3 seconds (gives enough time to use listeners once but not more)\n ////////////////Buffer///////////////////////\n if(arr.flat().length > 0){\n this.nextSunArr = arr.flat();\n child.off('value');\n }else{\n this.sunArr = this.nextSunArr;\n this.intervalIDSun = setTimeout(() => {\n child.off('value');\n }, 4000)\n }\n /////////////////////////////////////////////\n\n return this.sunArr;\n }\n }", "function getActualSleepHours() {\n let result =\n getSleepHours('Monday') +\n getSleepHours('Tuesday') +\n getSleepHours('Wednesday') +\n getSleepHours('Thursday') +\n getSleepHours('Friday') +\n getSleepHours('Saturday') +\n getSleepHours('Sunday');\n return result;\n}", "async function weeklyReports(){\n // github.fetchData();\n var orgList = await db.listAllOrgId();\n for (var org_id of orgList) {\n var reportLinks = await report.generateReportLinks(org_id);\n // console.log(reportLinks);\n // Send report links\n for (var user in reportLinks) {\n await mattermost.postReports(config.incoming_webhook_url, '@' + user, reportLinks[user]);\n }\n }\n // schedule.scheduleJob('0 56 0 * * 5', async function() {\n // console.log('scheduleCronstyle:' + new Date());\n // // // fetch data from github and store into db\n // await github.fetchData();\n // });\n //\n // schedule.scheduleJob('0 56 0 * * 5', async function() {\n // // generate all weekly reports\n // var orgList = db.listAllOrgId();\n // for (var org_id of orgList) {\n // var reportLinks = report.generateReportLinks(org_id);\n // // console.log(reportLinks);\n // // Send report links\n // for (var user in reportLinks) {\n // mattermost.postReports(config.incoming_webhook_url, '@' + user, reportLinks[user]);\n // }\n // }\n // });\n }", "async function getTemperaturesIntensity() {\n // get temp upper safe level\n let upperArr = [];\n let upperData = await fetch('https://api.thingspeak.com/channels/866214/fields/5',\n {\n method: 'GET',\n })\n upperData = await upperData.json();\n let upperFeed = upperData.feeds.reverse().filter(e => e.field5 !== null && e.field5 !== undefined)\n let upper\n if (upperFeed.length === 0) upper = 50\n else upper = Number.parseInt(upperFeed[0].field5)\n for (let i = 0; i < 12; i++) upperArr.push(upper)\n // get temp below safe level\n let belowArr = [];\n let belowData = await fetch('https://api.thingspeak.com/channels/866214/fields/6',\n {\n method: 'GET',\n })\n belowData = await belowData.json()\n let belowFeed = belowData.feeds.reverse().filter(e => e.field6 !== null && e.field6 !== undefined)\n let below;\n if (belowFeed.length === 0) below = 10\n else below = Number.parseInt(belowFeed[0].field6)\n for (let i = 0; i < 12; i++) belowArr.push(below)\n const response = await fetch('https://api.thingspeak.com/channels/866214/fields/1',\n {\n method: 'GET',\n })\n let feeds = await response.json()\n let feedArr = feeds.feeds.reverse()\n feedArr = feedArr.filter(e => e.field1 !== null && e.field1 !== undefined).slice(0, 12);\n const minuteArr = feedArr.map(e => new Date(e.created_at).getHours() + 'h '\n + (new Date(e.created_at).getMinutes() < 10 ? ('0' + new Date(e.created_at).getMinutes())\n : new Date(e.created_at).getMinutes()));\n const tempsArr = feedArr.map(e => Number.parseFloat(e.field1));\n const lastDate = new Date(feedArr[0].created_at)\n const dateStr = lastDate.getDate() + \"/\" + (lastDate.getMonth() + 1) + \"/\" + lastDate.getFullYear()\n Highcharts.chart('tempChart', {\n chart: {\n type: 'line'\n },\n title: {\n text: 'My smart garden Temperature'\n },\n subtitle: {\n text: 'Date: ' + dateStr\n },\n xAxis: {\n categories: minuteArr.reverse()\n },\n yAxis: {\n title: {\n text: 'Temperature (°C)'\n }\n },\n plotOptions: {\n line: {\n dataLabels: {\n enabled: true\n },\n enableMouseTracking: false\n }\n },\n series: [{\n name: 'Nhiệt độ',\n color: \"#F08F00\",\n data: tempsArr.reverse()\n }, {\n name: 'Ngưỡng an toàn trên',\n color: \"#E94340\",\n data: upperArr\n },\n {\n name: 'Ngưỡng an toàn dưới',\n color: \"#51AD55\",\n data: belowArr\n }\n ]\n });\n}", "async function getAllEventsChart() {\n var currentTime = new Date();\n var calculateFromTime = new Date(new Date().setTime(currentTime.getTime()- (1000 * config.graph.intervalTimeSeconds * config.graph.graphTimeScale)));\n var graphStartTime = new Date(calculateFromTime.getTime() + (1000 * config.graph.intervalTimeSeconds));\n\n var graphTimeList = calculateEventGraphInterval(calculateFromTime);\n try {\n var notifications = await getCollectionFunction(\"notifications\");\n\n var graphEvents = await filterToGetGraphEvents(notifications, graphStartTime);\n\n var eventFrequencyAtEachTimeMap = findEventsFrequencyInGraphInterval(graphTimeList, graphEvents);\n\n return {\n eventFrequencyAtEachTimeMap: eventFrequencyAtEachTimeMap,\n graphStartTime: graphTimeList[1],\n intervalTimeSeconds: config.graph.intervalTimeSeconds\n };\n }catch(err) {\n console.error(\"Error happened in getting graphEvents \", err);\n return {};\n }\n}", "async function channelsOnline() {\n try {\n\n // console.log('Running Online Check');\n let db = global.db;\n let joinedChannels = await db.channel_settings.find({ joined: true });\n let channelList = [];\n let channelReturn;\n let currentTimers = TIMERS.showTimers();\n let onlineChannels = [];\n \n\n for (let channel in joinedChannels) {\n channelList.push(joinedChannels[channel].broadcaster);\n }\n \n channelReturn = await channelCheck(channelList);\n channelReturn = channelReturn['streams'];\n\n for (let channel in channelReturn) {\n let pushThis = channelReturn[channel]['channel']['name'];\n pushThis = '#' + pushThis;\n onlineChannels.push(pushThis);\n }\n \n for (let channel in currentTimers) {\n if (currentTimers.hasOwnProperty(channel)) {\n let lastShownOnline = currentTimers[channel].online;\n let currentlyOnline = onlineChannels.includes(channel);\n\n // If channel is now online\n if (!lastShownOnline && currentlyOnline) {\n console.log(`${channel} is now online.`);\n TIMERS.changeOnlineStatus(channel);\n } \n // If channel has gone offline\n else if (lastShownOnline && !currentlyOnline) {\n console.log(`${channel} is now offline.`);\n TIMERS.changeOnlineStatus(channel);\n }\n }\n }\n } catch (err) {\n console.log('channelsOnline Error:');\n if (err.statusCode === 500) {\n console.log('Twitch Returned a 500 service error.');\n } else {\n console.log(err);\n }\n }\n}", "getValues(deviceId, sensorId, channelId, dateFrom, dateTo) {\n return this.getDeviceByName(deviceId).then(deviceObj => {\n var device;\n try {\n device = deviceObj[0].objid;\n } catch (e) {\n return [];\n } \n return this.getSensorByName(sensorId, device).then(sensorObj => {\n var sensor = sensorObj[0].objid;\n var hours = ((dateTo-dateFrom) / 3600);\n var avg = 0;\n if (hours > 12 && hours < 36) {\n avg = \"300\";\n } else if (hours > 36 && hours < 745) {\n avg = \"3600\";\n } else if (hours > 745) {\n avg = \"86400\";\n }\n \n var method = \"historicdata.xml\";\n var params = \"id=\" + sensor + \"&sdate=\" + this.getPRTGDate(dateFrom) + \"&edate=\" + this.getPRTGDate(dateTo) + \"&avg=\" + avg + \"&pctshow=false&pctmode=false\";\n \n if (channelId == '!') {\n params = \"&id=\" + sensor;\n return this.performPRTGAPIRequest('getsensordetails.json', params).then(results => {\n var message = results.lastmessage;\n var timestamp = results.lastcheck.replace(/(\\s\\[[\\d\\smsago\\]]+)/g,'');\n var dt = Math.round((timestamp - 25569) * 86400,0) * 1000;\n return [message, dt];\n });\n } else {\n return this.performPRTGAPIRequest(method, params).then(results => {\n var result = [];\n if (!results.histdata) {\n return results;\n }\n var rCnt = results.histdata.item.length;\n \n for (var i=0;i<rCnt;i++)\n {\n var v;\n var dt = Math.round((results.histdata.item[i].datetime_raw - 25569) * 86400,0) * 1000;\n if (results.histdata.item[i].value_raw && (results.histdata.item[i].value_raw.length > 0))\n {\n //FIXME: better way of dealing with multiple channels of same name\n //IE you select \"Traffic In\" but PRTG provides Volume AND Speed channels.\n for (var j = 0; j < results.histdata.item[i].value_raw.length; j++) {\n //workaround for SNMP Bandwidth Issue #3. Check for presence of (speed) suffix, and use that.\n if (results.histdata.item[i].value_raw[j].channel.match(channelId + ' [(]speed[)]') || results.histdata.item[i].value_raw[j].channel == channelId) {\n v = Number(results.histdata.item[i].value_raw[j].text);\n }\n }\n } else if (results.histdata.item[i].value_raw) {\n v = Number(results.histdata.item[i].value_raw.text);\n }\n result.push([v, dt]);\n }\n return result;\n });\n }\n });\n });\n }", "report() {\n const measureKeys = Object.keys(this.measures)\n\n measureKeys.forEach(key => {\n const m = this.measures[key]\n\n this.logMeasure(key, m)\n })\n }", "function getTimes(data) {\n let results = [];\n\n for (let i = 0; i < data.hourly.length; i++) {\n\n results.push(convertTime(data.hourly[i].dt));\n }\n\n return results;\n}", "function dashboardUpdateAll() {\n\t\tdashboardSet('stars', whiteStar + whiteStar + whiteStar);\n\t\tdashboardSet('tally', 0);\n\t\tdashboardSet('reset', semicircleArrow);\n\t\tdocument.getElementsByClassName('current-timer')[0].innerHTML = \"00:00\";\n}", "async function watchCheck(botChannel, bot) {\n console.log(`\\nwatchCheck at: ${new Date(Date.now())}\\nlast Check at: ${new Date(bot.lastWatch)}\\n`);\n\n const subscribers = await getSubs();\n const wfState = await commons.getWfStatInfo(config.WFStatApiURL);\n\n subscribers.forEach((sub) => {\n console.log(`User: ${sub.userID}`);\n\n sub.subData.forEach((entry) => {\n const notifyStr = checkNotificationsForEntry(entry, wfState, bot);\n\n console.log(`return string:${notifyStr}`);\n\n if (notifyStr) {\n bot.users.fetch(sub.userID).then((user) => {\n try {\n user.send(`Notification for you operator:\\n${notifyStr}`);\n } catch (error) {\n botChannel.send(`Failed to send a DM to ${user}. Have you enabled DMs?`);\n }\n });\n }\n });\n });\n\n return Date.parse(wfState.timestamp);\n}", "function fillTimes() {\n let now = new Date();\n startTime.value = now.toLocaleDateString(\"en-US\") +\" \"+ now.toTimeString().slice(0,8);\n endTime.value = now.toLocaleDateString(\"en-US\") +\" \"+ now.toTimeString().slice(0,8);\n}", "function report(){\n\n\tconsole.log(\"Summary of Current Session: \")\n\tfor(var url in urlDict){\n\t\tconsole.log(\"\\tURL: \" + url + \"\\tElapsed Time: \" + urlDict[url] + \"s\");\n\t}\n}", "function coffeeConsumptionTime() {\n for (var i = 0; i < entries.length; i++) {\n if (entries[i].q1_3 === 0) {\n coffeeTimes.none += 1;\n } else if (entries[i].q1_3 === 1) {\n coffeeTimes.min += 1;\n } else if (entries[i].q1_3 === 2) {\n coffeeTimes.mid += 1;\n } else if (entries[i].q1_3 === 3) {\n coffeeTimes.max += 1;\n }\n }\n }", "setClockTime() {\n const [min, hr] = getCurrentMinutesHrs();\n const finalTime = [];\n for (const elem of minMappings[min]) {\n finalTime.push(elem);\n }\n finalTime.push(hrMappings[hr]);\n this.setState({time: finalTime});\n }", "function get_scheduled_rms() {\n var rms_scheduled = [];\n var i=0\n while (i<num_rooms) {\n if (flow_mat[0][roomsInd+i] > 0) {\n rms_scheduled.push(i);\n }\n i++;\n }\n return rms_scheduled;\n }", "async function getHumidityIntensity() {\n // get hum upper safe level\n let upperArr = [];\n let upperData = await fetch('https://api.thingspeak.com/channels/866214/fields/7',\n {\n method: 'GET',\n })\n upperData = await upperData.json();\n let upperFeed = upperData.feeds.reverse().filter(e => e.field7 !== null && e.field7 !== undefined)\n let upper\n if (upperFeed.length === 0) upper = 100\n else upper = Number.parseInt(upperFeed[0].field7)\n for (let i = 0; i < 12; i++) upperArr.push(upper)\n // get hum below safe level\n let belowArr = [];\n let belowData = await fetch('https://api.thingspeak.com/channels/866214/fields/8',\n {\n method: 'GET',\n })\n belowData = await belowData.json()\n let belowFeed = belowData.feeds.reverse().filter(e => e.field8 !== null && e.field8 !== undefined)\n let below\n if (belowFeed.length === 0) below = 50\n else below = Number.parseInt(belowFeed[0].field8)\n for (let i = 0; i < 12; i++) belowArr.push(below)\n const response = await fetch('https://api.thingspeak.com/channels/866214/fields/2',\n {\n method: 'GET',\n })\n let feeds = await response.json()\n let feedArr = feeds.feeds.reverse()\n feedArr = feedArr.filter(e => e.field2 !== null && e.field2 !== undefined).slice(0, 12);\n const minuteArr = feedArr.map(e => new Date(e.created_at).getHours() + ':'\n + (new Date(e.created_at).getMinutes() < 10 ? ('0' + new Date(e.created_at).getMinutes())\n : new Date(e.created_at).getMinutes()));\n const humsArr = feedArr.map(e => Number.parseFloat(e.field2))\n const lastDate = new Date(feedArr[0].created_at)\n const dateStr = lastDate.getDate() + \"/\" + (lastDate.getMonth() + 1) + \"/\" + lastDate.getFullYear()\n Highcharts.chart('humChart', {\n chart: {\n type: 'line'\n },\n title: {\n text: 'My smart garden Humidity'\n },\n subtitle: {\n text: 'Date: ' + dateStr\n },\n xAxis: {\n categories: minuteArr.reverse()\n },\n yAxis: {\n title: {\n text: 'Humidity'\n }\n },\n plotOptions: {\n line: {\n dataLabels: {\n enabled: true\n },\n enableMouseTracking: false\n }\n },\n series: [{\n name: 'Độ ẩm',\n color: \"#09B2C7\",\n data: humsArr.reverse()\n }, {\n name: 'Ngưỡng an toàn trên',\n color: \"#E94340\",\n data: upperArr\n },\n {\n name: 'Ngưỡng an toàn dưới',\n color: \"#51AD55\",\n data: belowArr\n }\n ]\n });\n}", "tick() {\n\t\tlet now = new Date().getTime();\n\t\tfor (let i = 0; i < this.storage.sqrs.length;i++) {\n\t\t\tthis.displayTime(this.storage.sqrs[i], now);\n\t\t}\n\t}", "function perHour(store){\n for(var i = 1; i <= store.hoursOpen.length; i++){\n store.cookiePerHour.push(randomCust(store.custMin, store.custMax) * Math.floor(store.avgCookie));\n };\n console.log(store.cookiePerHour);\n // return store.cookiePerHour;\n}", "function reportGame() {\n // Only 1v1 games are rated (and Gaia is part of g_Players)\n if (\n !Engine.HasXmppClient() ||\n !Engine.IsRankedGame() ||\n g_Players.length != 3 ||\n Engine.GetPlayerID() == -1\n )\n return;\n\n let extendedSimState = Engine.GuiInterfaceCall(\"GetExtendedSimulationState\");\n\n let unitsClasses = [\n \"total\",\n \"Infantry\",\n \"Worker\",\n \"FemaleCitizen\",\n \"Cavalry\",\n \"Champion\",\n \"Hero\",\n \"Siege\",\n \"Ship\",\n \"Trader\"\n ];\n\n let unitsCountersTypes = [\"unitsTrained\", \"unitsLost\", \"enemyUnitsKilled\"];\n\n let buildingsClasses = [\n \"total\",\n \"CivCentre\",\n \"House\",\n \"Economic\",\n \"Outpost\",\n \"Military\",\n \"Fortress\",\n \"Wonder\"\n ];\n\n let buildingsCountersTypes = [\n \"buildingsConstructed\",\n \"buildingsLost\",\n \"enemyBuildingsDestroyed\"\n ];\n\n let resourcesTypes = [\"wood\", \"food\", \"stone\", \"metal\"];\n\n let resourcesCounterTypes = [\n \"resourcesGathered\",\n \"resourcesUsed\",\n \"resourcesSold\",\n \"resourcesBought\"\n ];\n\n let misc = [\n \"tradeIncome\",\n \"tributesSent\",\n \"tributesReceived\",\n \"treasuresCollected\",\n \"lootCollected\",\n \"percentMapExplored\"\n ];\n\n let playerStatistics = {};\n\n // Unit Stats\n for (let unitCounterType of unitsCountersTypes) {\n if (!playerStatistics[unitCounterType])\n playerStatistics[unitCounterType] = {};\n for (let unitsClass of unitsClasses)\n playerStatistics[unitCounterType][unitsClass] = \"\";\n }\n\n playerStatistics.unitsLostValue = \"\";\n playerStatistics.unitsKilledValue = \"\";\n // Building stats\n for (let buildingCounterType of buildingsCountersTypes) {\n if (!playerStatistics[buildingCounterType])\n playerStatistics[buildingCounterType] = {};\n for (let buildingsClass of buildingsClasses)\n playerStatistics[buildingCounterType][buildingsClass] = \"\";\n }\n\n playerStatistics.buildingsLostValue = \"\";\n playerStatistics.enemyBuildingsDestroyedValue = \"\";\n // Resources\n for (let resourcesCounterType of resourcesCounterTypes) {\n if (!playerStatistics[resourcesCounterType])\n playerStatistics[resourcesCounterType] = {};\n for (let resourcesType of resourcesTypes)\n playerStatistics[resourcesCounterType][resourcesType] = \"\";\n }\n playerStatistics.resourcesGathered.vegetarianFood = \"\";\n\n for (let type of misc) playerStatistics[type] = \"\";\n\n // Total\n playerStatistics.economyScore = \"\";\n playerStatistics.militaryScore = \"\";\n playerStatistics.totalScore = \"\";\n\n let mapName = g_GameAttributes.settings.Name;\n let playerStates = \"\";\n let playerCivs = \"\";\n let teams = \"\";\n let teamsLocked = true;\n\n // Serialize the statistics for each player into a comma-separated list.\n // Ignore gaia\n for (let i = 1; i < extendedSimState.players.length; ++i) {\n let player = extendedSimState.players[i];\n let maxIndex = player.sequences.time.length - 1;\n\n playerStates += player.state + \",\";\n playerCivs += player.civ + \",\";\n teams += player.team + \",\";\n teamsLocked = teamsLocked && player.teamsLocked;\n for (let resourcesCounterType of resourcesCounterTypes)\n for (let resourcesType of resourcesTypes)\n playerStatistics[resourcesCounterType][resourcesType] +=\n player.sequences[resourcesCounterType][resourcesType][maxIndex] + \",\";\n playerStatistics.resourcesGathered.vegetarianFood +=\n player.sequences.resourcesGathered.vegetarianFood[maxIndex] + \",\";\n\n for (let unitCounterType of unitsCountersTypes)\n for (let unitsClass of unitsClasses)\n playerStatistics[unitCounterType][unitsClass] +=\n player.sequences[unitCounterType][unitsClass][maxIndex] + \",\";\n\n for (let buildingCounterType of buildingsCountersTypes)\n for (let buildingsClass of buildingsClasses)\n playerStatistics[buildingCounterType][buildingsClass] +=\n player.sequences[buildingCounterType][buildingsClass][maxIndex] + \",\";\n let total = 0;\n for (let type in player.sequences.resourcesGathered)\n total += player.sequences.resourcesGathered[type][maxIndex];\n\n playerStatistics.economyScore += total + \",\";\n playerStatistics.militaryScore +=\n Math.round(\n (player.sequences.enemyUnitsKilledValue[maxIndex] +\n player.sequences.enemyBuildingsDestroyedValue[maxIndex]) /\n 10\n ) + \",\";\n playerStatistics.totalScore +=\n total +\n Math.round(\n (player.sequences.enemyUnitsKilledValue[maxIndex] +\n player.sequences.enemyBuildingsDestroyedValue[maxIndex]) /\n 10\n ) +\n \",\";\n\n for (let type of misc)\n playerStatistics[type] += player.sequences[type][maxIndex] + \",\";\n }\n\n // Send the report with serialized data\n let reportObject = {};\n reportObject.timeElapsed = extendedSimState.timeElapsed;\n reportObject.playerStates = playerStates;\n reportObject.playerID = Engine.GetPlayerID();\n reportObject.matchID = g_GameAttributes.matchID;\n reportObject.civs = playerCivs;\n reportObject.teams = teams;\n reportObject.teamsLocked = String(teamsLocked);\n reportObject.ceasefireActive = String(extendedSimState.ceasefireActive);\n reportObject.ceasefireTimeRemaining = String(\n extendedSimState.ceasefireTimeRemaining\n );\n reportObject.mapName = mapName;\n reportObject.economyScore = playerStatistics.economyScore;\n reportObject.militaryScore = playerStatistics.militaryScore;\n reportObject.totalScore = playerStatistics.totalScore;\n for (let rct of resourcesCounterTypes)\n for (let rt of resourcesTypes)\n reportObject[rt + rct.substr(9)] = playerStatistics[rct][rt];\n // eg. rt = food rct.substr = Gathered rct = resourcesGathered\n\n reportObject.vegetarianFoodGathered =\n playerStatistics.resourcesGathered.vegetarianFood;\n for (let type of unitsClasses) {\n // eg. type = Infantry (type.substr(0,1)).toLowerCase()+type.substr(1) = infantry\n reportObject[\n type.substr(0, 1).toLowerCase() + type.substr(1) + \"UnitsTrained\"\n ] =\n playerStatistics.unitsTrained[type];\n reportObject[\n type.substr(0, 1).toLowerCase() + type.substr(1) + \"UnitsLost\"\n ] =\n playerStatistics.unitsLost[type];\n reportObject[\"enemy\" + type + \"UnitsKilled\"] =\n playerStatistics.enemyUnitsKilled[type];\n }\n for (let type of buildingsClasses) {\n reportObject[\n type.substr(0, 1).toLowerCase() + type.substr(1) + \"BuildingsConstructed\"\n ] =\n playerStatistics.buildingsConstructed[type];\n reportObject[\n type.substr(0, 1).toLowerCase() + type.substr(1) + \"BuildingsLost\"\n ] =\n playerStatistics.buildingsLost[type];\n reportObject[\"enemy\" + type + \"BuildingsDestroyed\"] =\n playerStatistics.enemyBuildingsDestroyed[type];\n }\n for (let type of misc) reportObject[type] = playerStatistics[type];\n\n Engine.SendGameReport(reportObject);\n}", "function getTime() {\r\n\tvar fullTime = new Date();\r\n\tvar temp = [];\r\n\ttemp.push(fullTime.getHours(), fullTime.getMinutes(),fullTime.getDay());\r\n\treturn temp;\r\n}", "async getAggregatedTimeline() {\n let info = {\n timeline: [],\n from: null,\n };\n if (!this.accessToken) {\n console.error(\"No access token\");\n return info;\n }\n const filterJson = JSON.stringify({\n room: {\n timeline: {\n limit: 100,\n },\n },\n });\n let syncData = await this.fetchJson(\n `${this.serverUrl}/r0/sync?filter=${filterJson}`,\n {\n headers: { Authorization: `Bearer ${this.accessToken}` },\n }\n );\n // filter only @# rooms then add in all timeline events\n const roomIds = Object.keys(syncData.rooms.join).filter((roomId) => {\n // try to find an #@ alias\n let foundAlias = false;\n for (let ev of syncData.rooms.join[roomId].state.events) {\n if (ev.type === \"m.room.aliases\" && ev.content.aliases) {\n for (let alias of ev.content.aliases) {\n if (alias.startsWith(\"#@\")) {\n foundAlias = true;\n break;\n }\n }\n }\n if (foundAlias) {\n break;\n }\n }\n return foundAlias;\n });\n let events = [];\n for (let roomId of roomIds) {\n for (let ev of syncData.rooms.join[roomId].timeline.events) {\n ev.room_id = roomId;\n events.push(ev);\n }\n }\n // sort by origin_server_ts\n info.timeline = events.sort((a, b) => {\n if (a.origin_server_ts === b.origin_server_ts) {\n return 0;\n }\n if (a.origin_server_ts < b.origin_server_ts) {\n return 1;\n }\n return -1;\n });\n info.from = syncData.next_batch;\n return info;\n }", "function getActualSleepHours() {\n const totalSleep = getSleepHours(\"monday\") + getSleepHours(\"tuesday\") + getSleepHours(\"wednesday\") + getSleepHours(\"thursday\") + getSleepHours(\"friday\") + getSleepHours(\"saturday\") + getSleepHours(\"sunday\");\n return totalSleep;\n}", "function getAskingTime(user, channel, cb) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {\n cb(null,null);\n } else {\n cb(null, askingTimes[channel][user]); \n }\n }); \n}", "async getCleanSummary() {\n let data = await this.sendCommand(\"get_clean_summary\", [], {});\n return {\n cleanTime: data[0] / 60 / 60, // convert to hours\n cleanArea: data[1] / 1000000, // convert to m²\n cleanCount: data[2],\n lastRuns: data[3] // array containing up to 20 runs from the past\n };\n }", "function getTimes(rt,st,day){\n\n //buses is for ref to get string route+dir+depFromFirstStopTime which will act as a bus id\n let buses = routes[rt][day][0][1].map(depFromStopOneTime=>{\n return `${routes[rt].routeNo}${routes[rt].direction}${depFromStopOneTime.replace(':','')}`\n })\n\n let times = routes[rt][day][st][1]\n let timesPlus = times.map((time,i)=>{\n return {bus:buses[i],time:time}\n })\n return timesPlus;\n}", "function data_ready() {\n // latest two weeks of data... subtract 13 instead of 14 because dtaes\n // are inclusive and -14 gives fencepost error\n var edate = telemetry.midnight(telemetry.maxDate);\n var sdate = telemetry.midnight(add_days(edate, -13));\n draw_dashboard(sdate, edate);\n}", "async function getTimeAwayPolicies() {\n\tlog( await api.getResourceJSON( 'time-away-policies' ) );\n}", "liveTime() {\n\t\tthis.updateTime();\n\t\tthis.writeLog();\n\t}", "function clock() {\n clockdata = globaldata.slice(s, xrange)\n\n clockdata.forEach(zz => {\n\n if (zz['minute'] < 10) {\n minute.push(`:0${zz['minute']}`)\n }\n else {\n minute.push(`:${zz['minute']}`)\n }\n \n });\n\n drawline()\n}", "static get lastReport() {}", "function getAxisTimes() {\n var endUTC = 0;\n var startUTC = 0;\n $('div#charts > div').each(function() {\n\t var s_id = $(this).attr('data-sensorid');\n\t var chartIndex = $(\"#\"+s_id+\"-chart\").data('highchartsChart');\n\t //\t console.log('chartindex is' + chartIndex);\n\t if (typeof chartIndex === 'number') {\n\t\t// This is a real chart\n\t\tvar thisChart = Highcharts.charts[chartIndex];\n\t\tvar thisXAxis = thisChart.xAxis[0].getExtremes();\n\t\tstartUTC = thisXAxis.min;\n\t\tendUTC = thisXAxis.max;\n\t\t// We found one, quit out of the loop\n\t\treturn false;\n\t }\n\t});\n // console.log('endUTC = ' + endUTC);\n\n // If this is still 0, there were no charts to get data from.\n // Use the time range button selection on the graphs web page\n if (endUTC < 1) {\n\tvar graph_limits = getDataTimes();\n\tstartUTC = makeDate(graph_limits.starttime).getTime();\n\tendUTC = makeDate(graph_limits.endtime).getTime();\n }\n return {starttime: startUTC, endtime: endUTC};\n}", "function get_status() {\n var runningTotal = {},\n allPnames = [],\n color = \"\",\n list = \"\",\n tz = window.controller.options.tz-48;\n\n tz = ((tz>=0)?\"+\":\"-\")+pad((Math.abs(tz)/4>>0))+\":\"+((Math.abs(tz)%4)*15/10>>0)+((Math.abs(tz)%4)*15%10);\n \n var header = \"<span id='clock-s' class='nobr'>\"+(new Date(window.controller.settings.devt*1000).toUTCString().slice(0,-4))+\"</span> GMT \"+tz;\n\n runningTotal.c = window.controller.settings.devt;\n\n var master = window.controller.options.mas,\n ptotal = 0;\n\n var open = {};\n $.each(window.controller.status, function (i, stn) {\n if (stn) open[i] = stn;\n });\n open = Object.keys(open).length;\n\n if (master && window.controller.status[master-1]) open--;\n\n $.each(window.controller.stations.snames,function(i, station) {\n var info = \"\";\n if (master == i+1) {\n station += \" (\"+_(\"Master\")+\")\";\n } else if (window.controller.settings.ps[i][0]) {\n var rem=window.controller.settings.ps[i][1];\n if (open > 1) {\n if (rem > ptotal) ptotal = rem;\n } else {\n ptotal+=rem;\n }\n var remm=rem/60>>0,\n rems=rem%60,\n pid = window.controller.settings.ps[i][0],\n pname = pidname(pid);\n if (window.controller.status[i] && (pid!=255&&pid!=99)) runningTotal[i] = rem;\n allPnames[i] = pname;\n info = \"<p class='rem'>\"+((window.controller.status[i]) ? _(\"Running\") : _(\"Scheduled\"))+\" \"+pname;\n if (pid!=255&&pid!=99) info += \" <span id='countdown-\"+i+\"' class='nobr'>(\"+(remm/10>>0)+(remm%10)+\":\"+(rems/10>>0)+(rems%10)+\" \"+_(\"remaining\")+\")</span>\";\n info += \"</p>\";\n }\n if (window.controller.status[i]) {\n color = \"green\";\n } else {\n color = \"red\";\n }\n list += \"<li class='\"+color+\"'><p class='sname'>\"+station+\"</p>\"+info+\"</li>\";\n i++;\n });\n\n var footer = \"\";\n var lrdur = window.controller.settings.lrun[2];\n\n if (lrdur !== 0) {\n var lrpid = window.controller.settings.lrun[1];\n var pname= pidname(lrpid);\n\n footer = '<p>'+pname+' '+_('last ran station')+' '+window.controller.stations.snames[window.controller.settings.lrun[0]]+' '+_('for')+' '+(lrdur/60>>0)+'m '+(lrdur%60)+'s on '+(new Date(window.controller.settings.lrun[3]*1000).toUTCString().slice(0,-4))+'</p>';\n }\n\n if (ptotal) {\n var scheduled = allPnames.length;\n if (!open && scheduled) runningTotal.d = window.controller.options.sdt;\n if (open == 1) ptotal += (scheduled-1)*window.controller.options.sdt;\n allPnames = allPnames.getUnique();\n var numProg = allPnames.length;\n allPnames = allPnames.join(\" \"+_(\"and\")+\" \");\n var pinfo = allPnames+\" \"+((numProg > 1) ? _(\"are\") : _(\"is\"))+\" \"+_(\"running\")+\" \";\n pinfo += \"<br><span id='countdown-p' class='nobr'>(\"+sec2hms(ptotal)+\" remaining)</span>\";\n runningTotal.p = ptotal;\n header += \"<br>\"+pinfo;\n }\n\n var status = $(\"#status_list\");\n status.html(list);\n $(\"#status_header\").html(header);\n $(\"#status_footer\").html(footer);\n if (status.hasClass(\"ui-listview\")) status.listview(\"refresh\");\n window.totals = runningTotal;\n if (window.interval_id !== undefined) clearInterval(window.interval_id);\n if (window.timeout_id !== undefined) clearTimeout(window.timeout_id);\n\n changePage(\"#status\");\n if (window.totals.d !== undefined) {\n delete window.totals.p;\n setTimeout(get_status,window.totals.d*1000);\n }\n update_timers(window.controller.options.sdt);\n}", "function createThreadLevelTimeStats(numThreads) {\n var tidToTime = {};\n for (var tid = 0; tid < numThreads; tid++) {\n tidToTime[tid] = new Time(0, 0);\n }\n\n return tidToTime;\n}", "function setAlarms(alarmInfos){\n var AlarmTimes = [];\n var alarmTime;\n var timeDifference;\n\n var i;\n for(i=0; i<alarmInfos.length;i++){\n // Check if alarm was set\n if(alarmInfos[i][0] === true){\n // check if alarm is in the past\n alarmTime = getAlarmTime(alarmInfos[i]);\n console.log(alarmInfos[i])\n timeDifference = alarmTime.getTime() - (new Date()).getTime();\n\n if(timeDifference > 0) {\n // Append Time until counter goes of and event name\n AlarmTimes.push([timeDifference, alarmInfos[i][3]]);\n }\n }\n }\n console.log(AlarmTimes);\n setInterval(countDown, 1000);\n\n function countDown(){\n for(i = 0; i<AlarmTimes.length; i++){\n //Count down one second\n AlarmTimes[i][0] = AlarmTimes[i][0] - 1000;\n if(AlarmTimes[i][0]<0){\n setOffAlarm(AlarmTimes[i][1]);\n AlarmTimes.splice(i, 1);\n }\n }\n }\n}", "function initStats(){\n stats = [];\n statsinfo = { /* will hold today, weekstart, total */\n total : 0,\n todayTotal : 0,\n weekTotal : 0,\n num : 1\n };\n /* create object for todays date */\n createToday();\n /* create object for start of week date */\n createWeekStart();\n}", "calculateSchedule(scheduledDevices) {\n const schedule = {};\n\n for (let hour = 0; hour <= 23; hour++) {\n const runningDevices = scheduledDevices.filter(each => each.includes(hour));\n\n schedule[hour] = runningDevices.map(each => each.device.id);\n }\n\n return schedule;\n }", "function statistics() {\n\t/*var time = Date.now() - startTime - pauseTime;\n\t\tvar seconds = (time / 1000 % 60).toFixed(2);\n\t\tvar minutes = ~~(time / 60000);\n\t\tstatsTime.innerHTML = (minutes < 10 ? '0' : '') + minutes +\n\t(seconds < 10 ? ':0' : ':') + seconds;*/\n}", "compareTimes(time, date) {\n var shortened = time.split(\":\");\n shortened = shortened[0] + \":\" + shortened[1];\n\n var mobile = window.matchMedia(\"only screen and (max-width: 768px)\").matches;\n if(!mobile && this.times.includes(shortened)) {\n for(var i = 0; i < this.props.reminders.length; i++) {\n if(this.props.reminders[i].time === shortened) {\n this.createNotification(shortened + \" \" + this.props.reminders[i].title, this.props.reminders[i].text);\n }\n }\n \n this.times = this.times.filter((time) => time !== shortened);\n }\n }", "function getTimes() {\n\t\t\tmoment.tz.add([\n\t\t\t\t'Eire|GMT IST|0 -10|01010101010101010101010|1BWp0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00',\n\t\t\t\t'Asia/Tokyo|JST|-90|0|',\n\t\t\t\t'Europe/Prague|LMT PMT CET CEST GMT|-V.I -V.I -10 -20 0|0123232323232323232423232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-4QbAV.I 1FDc0 XPaV.I 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 1cM0 1qM0 11c0 mp0 xA0 mn0 17c0 1io0 17c0 1fc0 1ao0 1bNc0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00|13e5',\n\t\t\t\t'America/New_York|EST EDT|50 40|0101|1Lz50 1zb0 Op0',\n\t\t\t\t'America/Los_Angeles|LMT PST PDT PWT PPT|7Q.W 80 70 70 70|0121213412121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-3tFE0 1nEe0 1nX0 11B0 1nX0 SgN0 8x10 iy0 5Wp1 1VaX 3dA0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1a00 1fA0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|15e6'\n\t\t\t]);\n\t\t\tvar now = new Date();\n\t\t\t// Set the time manually for each of the clock types we're using\n\t\t\tvar times = [{\n\t\t\t\t\tjsclass: 'js-tokyo',\n\t\t\t\t\tjstime: moment.tz(now, \"Asia/Tokyo\"),\n\t\t\t\t\tjszone: \"Asia/Tokyo\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tjsclass: 'js-london',\n\t\t\t\t\tjstime: moment.tz(now, \"Eire\"),\n\t\t\t\t\tjszone: \"Eire\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tjsclass: 'js-new-york',\n\t\t\t\t\tjstime: moment.tz(now, \"America/New_York\"),\n\t\t\t\t\tjszone: \"America/New_York\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tjsclass: 'js-prague',\n\t\t\t\t\tjstime: moment.tz(now, \"Europe/Prague\"),\n\t\t\t\t\tjszone: \"Europe/Prague\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tjsclass: 'js-los-angeles',\n\t\t\t\t\tjstime: moment.tz(now, \"America/Los_Angeles\"),\n\t\t\t\t\tjszone: \"America/Los_Angeles\"\n\t\t\t\t}\n\t\t\t];\n\t\t\treturn times;\n\t\t}", "static getUsers() {\n return PersonalStats.dates;\n }", "function evaluateNewScreens(projectId) {\n // get the date difference\n var diff = that.getDateDifference(obj.oldValue, obj.newValue);\n if (obj.type === 'dt_start') {\n //console.log('ProjectSVC::evaluateNewScreens | start | diff: ', diff);\n // if the difference is -ve we need to add that number to the beginning\n // if the difference is +ve we need to remove that number from the beginning\n if (diff < 0) {\n obj.unshift = diff; // add to the beginning of the list\n } else if (diff > 0) {\n obj.shift = diff; // remove from the beginning of the list\n }\n } else if (obj.type === 'dt_end') {\n // console.log('ProjectSVC::evaluateNewScreens | end | diff: ', diff);\n // if the difference is -ve we need to remove that number from the end\n // if the difference is +ve we need to add that number to the end\n if (diff < 0) {\n obj.pop = diff; // add to the beginning of the list\n } else if (diff > 0) {\n obj.push = diff; // remove from the beginning of the list\n }\n }\n // the reference for the configurations\n var ref = new Firebase(globalFuncs.getFirebaseUrl() + '/projects/' + projectId + '/configurations'),\n\n // the `sync` for the configurations\n sync = $firebase(ref),\n configurations,\n daysRef,\n dayPath,\n daysSync;\n\n fbutil.syncArray(ref.path.toString()).$loaded().then(function(data) {\n configurations = data;\n _.forEach(configurations, function(configuration, configId) {\n _.forEach(configuration.screens, function(screen, screenIndex) {\n // path for the days object\n dayPath = ref.path.toString() + '/' + configId + '/screens/' + screenIndex + '/days/',\n // the ref for the days object\n daysRef = fbutil.ref(dayPath),\n // the sync for the days object\n daysSync = fbutil.syncObjectReference(daysRef);\n\n // the collection as a $firebase array\n var list = daysSync.$asArray(),\n items = [],\n number;\n\n list.$loaded(\n function(data) {\n // $log.info('list loaded');\n // evaluate task\n //obj.unshift = diff; // add to the beginning of the list\n //obj.shift = diff; // remove from the beginning of the list\n //obj.pop = diff; // remove from the end of the list\n //obj.push = diff; // add to the end of the list\n\n // add to the beginning of the list\n if (obj.hasOwnProperty('unshift')) {\n //console.log('unshift', obj.unshift);\n number = obj.unshift * -1; // we have to reverse the sign\n items = [];\n for (var l = 0; l < number; l++) {\n items.push(list[l]);\n }\n // copy the original list\n var originalList = angular.copy(list);\n // remove all the items in the current list\n _.forEach(list, function(value, key) {\n var item = list[key];\n list.$remove(item).then(function(ref) {\n var id = ref.key();\n // $log.info('unshift removed record with id ' + id);\n });\n });\n // add the new items\n _.forEach(items, function(value, key) {\n list.$add(getDayParts()).then(function(ref) {\n var id = ref.key();\n // $log.info('unshift added record with id ' + id);\n });\n });\n //\n // add back the items from the original list\n _.forEach(originalList, function(value, key) {\n list.$add(value).then(function(ref) {\n var id = ref.key();\n // $log.info('unshift added record with id ' + id);\n });\n });\n } else if (obj.hasOwnProperty('shift')) {\n // shift - remove from the beginning of the list\n console.log('10:13 shift', obj.shift);\n items = [];\n for (var i = 0; i < obj.shift; i++) {\n items.push(list[i]);\n }\n _.forEach(items, function(value, key) {\n var item = list[key];\n list.$remove(item).then(function(ref) {\n var id = ref.key();\n // $log.info('shift removed record with id ' + id);\n });\n });\n } else if (obj.hasOwnProperty('pop')) {\n // pop - remove from the end of the list\n console.log('10:49 - pop', obj.pop);\n number = obj.pop * -1; // we have to reverse the sign\n items = [];\n var len = list.length;\n for (var j = 0; j < number; j++) {\n items.push(list[j]);\n }\n console.log('10:49 - pop len: ', items.length);\n _.forEach(items, function(value, key) {\n var item = list[len - (key + 1)];\n list.$remove(item).then(function(ref) {\n var id = ref.key();\n // $log.info('pop removed record with id ' + id);\n });\n });\n } else if (obj.hasOwnProperty('push')) {\n console.log('11:05 push', obj.push);\n items = [];\n for (var k = 0; k < obj.push; k++) {\n items.push(list[k]);\n }\n _.forEach(items, function(value, key) {\n list.$add(getDayParts()).then(function(ref) {\n var id = ref.key();\n // $log.info('push added record with id ' + id);\n });\n });\n }\n }, function(error) {\n $log.error('Error: ', error);\n });\n });\n });\n });\n }", "get dates() {\n const { from, to, query, timeRegistrations } = this.store;\n let dates = [];\n if (query) {\n dates = [...new Set(timeRegistrations.map(r => r.date))].sort((a, b) => a < b);\n } else {\n let days = differenceInDays(to, from) + 1;\n for (let i = 0; i < days; i++) {\n let date = new Date(from);\n date.setDate(date.getDate() + i);\n dates.push(date);\n }\n }\n return dates;\n }", "sendAnalytics() {\n const rtts = {};\n\n for (const region in this.pcMonitors) {\n if (this.pcMonitors.hasOwnProperty(region)) {\n const rtt = this.pcMonitors[region].rtt;\n\n if (!isNaN(rtt) && rtt !== Infinity) {\n rtts[region.replace('-', '_')] = rtt;\n }\n }\n }\n\n if (rtts) {\n _statistics_statistics__WEBPACK_IMPORTED_MODULE_4__[\"default\"].sendAnalytics(Object(_service_statistics_AnalyticsEvents__WEBPACK_IMPORTED_MODULE_1__[\"createRttByRegionEvent\"])(rtts));\n }\n }", "function twcheese_BattleReport()\n\t{\n\t\tthis.attacker;\n\t\tthis.attackerLosses;\n\t\tthis.attackerQuantity;\n\t\tthis.attackerVillage;\n\t\tthis.buildingLevels;\n\t\tthis.defender;\n\t\tthis.defenderLosses;\n\t\tthis.defenderQuantity;\n\t\tthis.defenderVillage;\n\t\tthis.dot;\n\t\tthis.espionageLevel;\n\t\tthis.haul;\n\t\tthis.loyalty;\n\t\tthis.luck;\n\t\tthis.morale;\n\t\tthis.reportID;\n\t\tthis.resources;\n\t\tthis.sent;\n\t\tthis.unitsInTransit;\n\t\tthis.unitsOutside;\n\t}", "function getComingTimeslots(callback) {\n const query = `SELECT CoachProfiles.name, CoachProfiles.email, MeetingDays.date, Timeslots.time, Timeslots.duration\n FROM Users\n LEFT OUTER JOIN CoachProfiles ON Users.id = CoachProfiles.user_id\n LEFT OUTER JOIN MeetingDays\n LEFT OUTER JOIN Timeslots ON MeetingDays.date = Timeslots.date AND Timeslots.user_id = Users.id\n WHERE MeetingDays.date >= date(\"now\") AND Users.active = 1 AND Users.type = 1`;\n db.all(query, [], (err, result) => {\n if (err) return callback(err);\n return callback(err, result);\n });\n}", "function calculateWeatherTimes(minStart, maxEnd) {\r\n\tvar WeatherStartHour = minStart + Math.round(Math.random() * (maxEnd - minStart));\r\n\tvar WeatherEndHour = WeatherStartHour - 1;\r\n\twhile ( WeatherEndHour < WeatherStartHour ) {\r\n\t\tWeatherEndHour = maxEnd - Math.round(Math.random() * (maxEnd - minStart));\r\n\t}\r\n\tvar WeatherStartMinute = Math.round(Math.random() * 20);\r\n\tvar WeatherEndMinute = WeatherStartMinute - 1;\r\n\tif ( WeatherStartHour == WeatherEndHour ) {\r\n\t\twhile ( WeatherEndMinute < WeatherStartMinute ) {\r\n\t\t\tWeatherEndMinute = Math.round(Math.random() * 59);\r\n\t\t}\r\n\t} else {\r\n\t\tWeatherEndMinute = Math.round(Math.random() * 59);\r\n\t}\r\n\tvar results = [];\r\n\tresults[0] = zeroPad(WeatherStartHour, 2) + \":\" + zeroPad(WeatherStartMinute, 2);\r\n\tresults[1] = zeroPad(WeatherEndHour, 2) + \":\" + zeroPad(WeatherEndMinute, 2);\r\n\treturn results;\r\n} //End Weather Time Calculations", "_scheduleEvents() {\n let now = clock.now();\n // number of events to schedule variaes based on the day of the week\n let dow = now.getDay();\n let numberOfEvents = (dow === 0 || dow === 7) ? this.weekendFrequency : this.weekDayFrequency;\n for (let i = 0; i < numberOfEvents; i++) {\n this.events.push(now.getTime() + Math.random() * MILLISECONDS_IN_DAY);\n }\n // sort ascending so we can quickly figure out the next time to run\n // after running, we'll remove it from the queue\n this.events.sort((a, b) => a - b);\n }", "async function getPossibleTimeslots() {\n const timeslotDetails = await db.any(`select * from ${Tables.timeslot} ;`);\n return _.map(timeslotDetails, timeslot => new Timeslot(timeslot));\n}", "getReport() {\n let list = [];\n for (let index = 0; index < this.objectGenerators.length; index++) {\n const objectGenerator = this.objectGenerators[index];\n list.push(objectGenerator.toString());\n }\n return list;\n }", "function getCounts(array, now) {\n\t\tvar msInDay = 86400000;\n\t\tvar msInWeek = 604800000;\n\t\tvar counts = {\n\t\t\tlastDay: 0,\n\t\t\tlastWeek: 0\n\t\t};\n\n\t\tfor (var i = 0; i < array.length; i++) {\n\t\t\tvar diff = now - array[i].opened;\n\n\t\t\tif (diff <= msInDay) {\n\t\t\t\tcounts.lastDay++;\n\t\t\t} else if (diff > msInDay && diff <= msInWeek) {\n\t\t\t\tcounts.lastWeek++;\n\t\t\t}\n\t\t}\n\n\t\treturn counts;\n\t}", "function fillTimeReport(times) {\n\tvar tableBody = $('#time-pane tbody');\n\n\ttableBody.empty();\n\n\tvar categories = Object.keys(times);\n\tif(categories.length > 0) {\n\t\t$('#time-pane #no-categories').hide();\n\t\t$('#time-pane #categories').show();\n\n\t\tvar oneMinute = 60,\n\t\t\toneHour = oneMinute*60,\n\t\t\toneDay = oneHour*24;\n\n\t\tcategories.forEach(function (category) {\n\t\t\tvar line = $('<tr>');\n\t\t\tvar categoryCell = $('<td>', {'text': category.replace('_', ' ')});\n\n\t\t\tvar timeSpent = times[category].duration;\n\n\t\t\tvar days = Math.floor(timeSpent/oneDay),\n\t\t\t\thours = Math.floor((timeSpent%oneDay)/oneHour),\n\t\t\t\tminutes = Math.floor((timeSpent%oneDay)%oneHour/oneMinute),\n\t\t\t\tseconds = Math.floor(((timeSpent%oneDay)%oneHour)%oneMinute);\n\n\t\t\tvar daysString = days>0 ? days + ' day' + (days>1 ? 's ' : ' ') : '',\n\t\t\t\thoursString = hours>0 ? hours + ' hour' + (hours>1 ? 's ' : ' ') : '',\n\t\t\t\tminutesString = minutes>0 ? minutes + ' minute' + (minutes>1 ? 's ' : ' ') : '',\n\t\t\t\tsecondsString = seconds>0 ? seconds + ' second' + (seconds>1 ? 's' : '') : '';\n\n\t\t\tvar timeString = daysString + hoursString + minutesString + secondsString;\n\t\t\tif(timeString === '') {\n\t\t\t\ttimeString = self.options.no_time_spent;\n\t\t\t}\n\n\t\t\tvar timeSpentCell = $('<td>', {'text': timeString});\n\n\t\t\tline.append(categoryCell).append(timeSpentCell);\n\t\t\ttableBody.append(line);\n\t\t});\n\t} else {\n\t\t$('#time-pane #categories').hide();\n\t\t$('#time-pane #no-categories').show();\n\t}\n}", "function initialChartData() {\n var datetimeHash = {};\n for (var date = getStartDate(); date <= getEndDate(); date.setDate(date.getDate() + 1)) {\n for (var hour = 0; hour <= 23; hour += 1) {\n datetimeHash[dateToString(date) + '--' + hour] = 0;\n }\n }\n return datetimeHash;\n }", "function howOften(jsonFeed){\r\n\tvar when = new Array(7);\r\n\twhen[0] = \"weekly\";\r\n\twhen[1] = 1; //code for when[0] (hardcoded to 'weekly' currently)\r\n\twhen[2] = \"thursdays\";\r\n\tvar today = new Date();\r\n\twhen[3] = today; //for setting up a regular transaction from today\r\n\twhen[4] = today.getDate();\r\n\twhen[5] = today.getMonth()+1;\r\n\twhen[6] = today.getFullYear();\r\n\t\r\n\treturn when;\r\n}", "getTimeSliceForDay() {\n if (this.classType === 'virtual')\n return\n\n let args = {\n classRoomId: this.classRoom.value,\n currentClass: ''\n }\n\n // alert('before send')\n ipcRenderer.send('getAllFreeTimeSlice', args)\n ipcRenderer.on('responseGetAllFreeTimeSlice', (e, args) => {\n this.availableTimeSlices = args\n })\n\n }", "async getWeeksData(level_ids, team_ids) {\n try {\n this.debuglog('getWeeksData')\n\n // use 5 AM UTC time as the threshold to advance 1 day\n let utcHours = 5\n\n let cache_data\n let cache_name = 'week'\n\n if ( level_ids != LEVELS['All'] ) {\n cache_name += '.' + level_ids\n }\n if ( team_ids != '' ) {\n cache_name += '.' + team_ids\n }\n\n let cache_file = path.join(this.CACHE_DIRECTORY, cache_name + '.json')\n let currentDate = new Date()\n if ( !fs.existsSync(cache_file) || !this.cache || !this.cache.weeks || !this.cache.weeks[cache_name] || !this.cache.weeks[cache_name].weekCacheExpiry || (currentDate > new Date(this.cache.weeks[cache_name].weekCacheExpiry)) ) {\n let startDate = this.liveDate(utcHours)\n let endDate = new Date(startDate)\n endDate.setDate(endDate.getDate()+20)\n endDate = endDate.toISOString().substring(0,10)\n let data_url = 'http://statsapi.mlb.com/api/v1/schedule?sportId=' + level_ids\n if ( team_ids != '' ) {\n data_url += '&teamId=' + team_ids\n }\n data_url += '&startDate=' + startDate + '&endDate=' + endDate + '&hydrate=broadcasts(all),game(content(media(epg))),probablePitcher,linescore,team'\n let reqObj = {\n //url: 'https://bdfed.stitch.mlbinfra.com/bdfed/transform-mlb-scoreboard?stitch_env=prod&sortTemplate=2&sportId=1&sportId=17&startDate=' + startDate + '&endDate=' + endDate + '&gameType=E&&gameType=S&&gameType=R&&gameType=F&&gameType=D&&gameType=L&&gameType=W&&gameType=A&language=en&leagueId=104&leagueId=103&leagueId=131&contextTeamId=',\n url: data_url,\n headers: {\n 'User-agent': USER_AGENT,\n 'Origin': 'https://www.mlb.com',\n 'Accept-Encoding': 'gzip, deflate, br',\n 'Content-type': 'application/json'\n },\n gzip: true\n }\n var response = await this.httpGet(reqObj, false)\n if ( response && this.isValidJson(response) ) {\n //this.debuglog(response)\n cache_data = JSON.parse(response)\n this.save_json_cache_file(cache_name, cache_data)\n\n this.debuglog('setting channels cache expiry to next day')\n let cacheExpiry = new Date(startDate)\n cacheExpiry.setDate(cacheExpiry.getDate()+1)\n cacheExpiry.setHours(cacheExpiry.getHours()+utcHours)\n // finally save the setting\n this.setWeekCacheExpiry(cache_name, cacheExpiry)\n } else {\n this.log('error : invalid json from url ' + reqObj.url)\n }\n } else {\n this.debuglog('using cached week data')\n cache_data = this.readFileToJson(cache_file)\n }\n if (cache_data) {\n return cache_data\n }\n } catch(e) {\n this.log('getWeeksData error : ' + e.message)\n }\n }", "constructor() {\n this.monday = [\n {'00:00': []},\n {'01:00': []},\n {'02:00': []},\n {'03:00': []},\n {'04:00': []},\n {'05:00': []},\n {'06:00': []},\n {'07:00': []},\n {'08:00': []},\n {'09:00': []},\n {'10:00': []},\n {'11:00': []},\n {'12:00': []},\n {'13:00': []},\n {'14:00': []},\n {'15:00': []},\n {'16:00': []},\n {'17:00': []},\n {'18:00': []},\n {'19:00': []},\n {'20:00': []},\n {'21:00': []},\n {'22:00': []},\n {'23:00': []},\n ];\n this.tuesday = [\n {'00:00': []},\n {'01:00': []},\n {'02:00': []},\n {'03:00': []},\n {'04:00': []},\n {'05:00': []},\n {'06:00': []},\n {'07:00': []},\n {'08:00': []},\n {'09:00': []},\n {'10:00': []},\n {'11:00': []},\n {'12:00': []},\n {'13:00': []},\n {'14:00': []},\n {'15:00': []},\n {'16:00': []},\n {'17:00': []},\n {'18:00': []},\n {'19:00': []},\n {'20:00': []},\n {'21:00': []},\n {'22:00': []},\n {'23:00': []},\n ];\n this.wednesday = [\n {'00:00': []},\n {'01:00': []},\n {'02:00': []},\n {'03:00': []},\n {'04:00': []},\n {'05:00': []},\n {'06:00': []},\n {'07:00': []},\n {'08:00': []},\n {'09:00': []},\n {'10:00': []},\n {'11:00': []},\n {'12:00': []},\n {'13:00': []},\n {'14:00': []},\n {'15:00': []},\n {'16:00': []},\n {'17:00': []},\n {'18:00': []},\n {'19:00': []},\n {'20:00': []},\n {'21:00': []},\n {'22:00': []},\n {'23:00': []},\n ];\n this.thursday = [\n {'00:00': []},\n {'01:00': []},\n {'02:00': []},\n {'03:00': []},\n {'04:00': []},\n {'05:00': []},\n {'06:00': []},\n {'07:00': []},\n {'08:00': []},\n {'09:00': []},\n {'10:00': []},\n {'11:00': []},\n {'12:00': []},\n {'13:00': []},\n {'14:00': []},\n {'15:00': []},\n {'16:00': []},\n {'17:00': []},\n {'18:00': []},\n {'19:00': []},\n {'20:00': []},\n {'21:00': []},\n {'22:00': []},\n {'23:00': []},\n ];\n this.friday = [\n {'00:00': []},\n {'01:00': []},\n {'02:00': []},\n {'03:00': []},\n {'04:00': []},\n {'05:00': []},\n {'06:00': []},\n {'07:00': []},\n {'08:00': []},\n {'09:00': []},\n {'10:00': []},\n {'11:00': []},\n {'12:00': []},\n {'13:00': []},\n {'14:00': []},\n {'15:00': []},\n {'16:00': []},\n {'17:00': []},\n {'18:00': []},\n {'19:00': []},\n {'20:00': []},\n {'21:00': []},\n {'22:00': []},\n {'23:00': []},\n ];\n this.saturday = [\n {'00:00': []},\n {'01:00': []},\n {'02:00': []},\n {'03:00': []},\n {'04:00': []},\n {'05:00': []},\n {'06:00': []},\n {'07:00': []},\n {'08:00': []},\n {'09:00': []},\n {'10:00': []},\n {'11:00': []},\n {'12:00': []},\n {'13:00': []},\n {'14:00': []},\n {'15:00': []},\n {'16:00': []},\n {'17:00': []},\n {'18:00': []},\n {'19:00': []},\n {'20:00': []},\n {'21:00': []},\n {'22:00': []},\n {'23:00': []},\n ];\n this.sunday = [\n {'00:00': []},\n {'01:00': []},\n {'02:00': []},\n {'03:00': []},\n {'04:00': []},\n {'05:00': []},\n {'06:00': []},\n {'07:00': []},\n {'08:00': []},\n {'09:00': []},\n {'10:00': []},\n {'11:00': []},\n {'12:00': []},\n {'13:00': []},\n {'14:00': []},\n {'15:00': []},\n {'16:00': []},\n {'17:00': []},\n {'18:00': []},\n {'19:00': []},\n {'20:00': []},\n {'21:00': []},\n {'22:00': []},\n {'23:00': []},\n ]\n this.hours = [\n '00:00',\n '01:00',\n '02:00',\n '03:00',\n '04:00',\n '05:00',\n '06:00',\n '07:00',\n '08:00',\n '09:00',\n '10:00',\n '11:00',\n '12:00',\n '13:00',\n '14:00',\n '15:00',\n '16:00',\n '17:00',\n '18:00',\n '19:00',\n '20:00',\n '21:00',\n '22:00',\n '23:00',\n ];\n this.days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];\n this.getEmployeeTotalHours = this.getEmployeeTotalHours.bind(this);\n this.removeEmployee = this.removeEmployee.bind(this);\n this.clearAllEmployees = this.clearAllEmployees.bind(this);\n this.clearEmployee = this.clearEmployee.bind(this);\n this.addEmployee = this.addEmployee.bind(this);\n this.clearHiddenHours = this.clearHiddenHours.bind(this);\n this.addBulkEmployees = this.addBulkEmployees.bind(this);\n\n }", "weekMeetings(course, exceptions) {\n const weekEnd = endOfWeek(toDate(course.timeline_end));\n let weekStart = startOfWeek(toDate(course.timeline_start));\n const firstWeekStart = getDay(toDate(course.timeline_start));\n const courseWeeks = differenceInWeeks(weekEnd, weekStart, { roundingMethod: 'round' });\n const meetings = [];\n\n // eslint-disable-next-line no-restricted-syntax\n for (const week of range(0, (courseWeeks - 1), true)) {\n weekStart = addWeeks(startOfWeek(toDate(course.timeline_start)), week);\n\n // Account for the first partial week, which may not have 7 days.\n let firstDayOfWeek;\n if (week === 0) {\n firstDayOfWeek = firstWeekStart;\n } else {\n firstDayOfWeek = 0;\n }\n\n const ms = [];\n // eslint-disable-next-line no-restricted-syntax\n for (const i of range(firstDayOfWeek, 6, true)) {\n const day = addDays(weekStart, i);\n if (course && this.courseMeets(course.weekdays, i, format(day, 'yyyyMMdd'), exceptions)) {\n ms.push(format(day, 'EEEE (MM/dd)'));\n }\n }\n meetings.push(ms);\n }\n return meetings;\n }", "function _daily_report_(ListName,Destination)\n{\n var listId = _list_by_name_(ListName);\n if (!listId) {\n Logger.log(\"No such list\");\n return;\n }\n var now = new Date();\n var lookBack2 = (now.getDay() == 1) ? -4 : -2;\n var later = _days_away_(1);\n var before = _days_away_(-1);\n var before2 = _days_away_(lookBack2);\n var i, n, c, t, tasks, items;\n var message = {\n to: Destination,\n subject: \"Daily Task Status: \"+ListName,\n name: \"Happy Tasks Robot\",\n htmlBody: \"<div STYLE=\\\"background-color:rgba(1,.9,.4,.9);\\\"><table>\\n\",\n body: \"Task report for \"+now+\":\\n\"\n };\n //Logger.log(before.toISOString());\n // past week\n tasks = Tasks.Tasks.list(listId, {'showCompleted':true, 'dueMin':before.toISOString(), 'dueMax': now.toISOString()});\n items = tasks.getItems();\n message = _add_to_message_(message,items,\"Today's Scheduled Tasks\");\n tasks = Tasks.Tasks.list(listId, {'showCompleted':true, 'dueMin':before2.toISOString(), 'dueMax': before.toISOString()});\n items = tasks.getItems();\n message = _add_to_message_(message,items,\"Yesterday's Schedule\");\n message['htmlBody'] += _footer_text_();\n message['htmlBody'] += \"</table>\\n\";\n message['htmlBody'] += \"</div>\";\n //\n MailApp.sendEmail(message);\n Logger.log('Sent email:\\n'+message['body']);\n Logger.log('Sent email:\\n'+message['htmlBody']);\n}", "function updateClocks(worldClocks) {\n\n worldClocks.forEach(element => {\n var homedt = luxon.DateTime.local();\n var localdt = luxon.DateTime.local().setZone(element.tzData.timezone);\n\n var localDate = luxon.DateTime.fromISO(localdt.toISODate());\n var homeDate = luxon.DateTime.fromISO(homedt.toISODate());\n\n localdt.setLocale(element.localeData.code);\n\n var clockId = \"#clock-\" + element.id;\n var clockTitleId = \"#clock-title-\" + element.id;\n var dateId = \"#clock-date-\" + element.id;\n var timeId = \"#clock-time-\" + element.id;\n\n var title = getTitleFormat(element);\n var time = getTimeFormat(localdt, element);\n var date = getDateFormat(localdt, element);\n\n time = time.split(\":\");\n if (time.length == 2) {\n time = time[0] + '<span class=\"minute-separator separator\">:</span>' + time[1];\n }\n else{\n time = time[0] + '<span class=\"minute-separator separator\">:</span>' + time[1] + '<span class=\"second-separator separator\">:</span><span class=\"seconds\">' + time[2] + '</span>';\n }\n\n //print title\n $(clockTitleId).text(title);\n\n //print time\n if (localdt.hour < 9) {\n $(timeId).addClass('time-before-9').html(time);\n } else if (localdt.hour > 18) {\n $(timeId).addClass('time-after-6').html(time);\n } else {\n $(timeId).html(time);\n }\n\n if (element.settings.showSeconds == \"blink\") {\n $(timeId + ' span.separator').addClass('blink');\n }\n else {\n $(timeId + ' span.separator').removeClass('blink');\n }\n\n //print date\n if (localDate < homeDate) {\n $(dateId).addClass('date-before-today').html(date);\n } else if (localDate > homeDate) {\n $(dateId).addClass('date-after-today').html(date);\n } else {\n $(dateId).html(date);\n }\n\n });\n}", "function generateMockEventsPm (n) {\n let eventsPm = [];\n let minutesInDay = 60 * 12;\n\n while (n > 0) {\n let start = Math.floor(Math.random() * minutesInDay)\n let end = start + Math.floor(Math.random() * (minutesInDay - start));\n events.push({start: start, end: end})\n n --;\n }\n return eventsPm;\n}" ]
[ "0.7166729", "0.6094642", "0.5958097", "0.59040844", "0.58943397", "0.58160514", "0.56860137", "0.5672652", "0.5641199", "0.5632324", "0.55998343", "0.5589384", "0.5563304", "0.5517262", "0.5500199", "0.5493791", "0.5482123", "0.54770815", "0.54730433", "0.5445748", "0.5425907", "0.54186046", "0.5406861", "0.5388727", "0.5388672", "0.53719926", "0.53718656", "0.5357668", "0.53549755", "0.5351227", "0.53400725", "0.5339121", "0.53374875", "0.53282195", "0.5309308", "0.53065205", "0.5304309", "0.52948546", "0.52838403", "0.52629715", "0.52620846", "0.52615404", "0.5255901", "0.5240632", "0.52356076", "0.5233656", "0.52256405", "0.5208924", "0.52069086", "0.5186431", "0.5185927", "0.51752687", "0.5166538", "0.5159002", "0.5155424", "0.51513433", "0.5147271", "0.5133961", "0.51325685", "0.5119676", "0.5115305", "0.51109415", "0.5108748", "0.5106123", "0.5105743", "0.50961965", "0.50959057", "0.509169", "0.50850034", "0.50632036", "0.505918", "0.5053591", "0.5050024", "0.5037955", "0.5035049", "0.5025816", "0.50239086", "0.50194174", "0.50059205", "0.49972627", "0.49941865", "0.4992819", "0.49893996", "0.4988331", "0.4988181", "0.49881065", "0.49823016", "0.49759647", "0.4966337", "0.49642286", "0.4963305", "0.49610916", "0.49595892", "0.495899", "0.49579185", "0.49508256", "0.49436915", "0.49407694", "0.49399754", "0.49365586" ]
0.55671674
12
gets all the times users would like to be asked to report for all channels
function getAskingTimes(cb) { controller.storage.teams.get('askingtimes', function(err, askingTimes) { if (!askingTimes) { cb(null, null); } else { cb(null, askingTimes); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}", "function getChatsForAUser() {\n\n // Send GET request to mongoDB to get all chats associated with a specific userId\n chatFactory.getChatsForAUser(vm.userId).then(\n\n function(response) {\n \n // Zero out the # of channels and direct messages\n $rootScope.numberOfChannels = 0;\n $rootScope.numberOfDirectMessages = 0;\n\n // Display chatgroup names on the view \n $rootScope.chatGroups = response;\n \n // Determine how many chat channels and direct messages the user is subscribed to\n for (var i = 0; i < response.length; i++) {\n if (response[i].groupType !== \"direct\") {\n $rootScope.numberOfChannels++;\n } else {\n $rootScope.numberOfDirectMessages++;\n }\n }\n\n // Send socket.io server the full list of chat rooms the user is subscribed to\n chatFactory.emit('add user', {chatGroups: $rootScope.chatGroups, userid: vm.userId});\n\n // Jump to calendar state\n $state.go('main.calendar');\n },\n\n function(error) {\n\n // Jump to calendar state\n $state.go('main.calendar'); \n\n });\n\n }", "function getAllChannelDataTS(){\n getDataField1();\n getDataField2();\n getDataField3();\n getDataField4();\n getDataField5();\n getDataField6();\n getDataField7();\n getDataField8();\n }", "function getAskingTime(user, channel, cb) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {\n cb(null,null);\n } else {\n cb(null, askingTimes[channel][user]); \n }\n }); \n}", "function getChats() {\n\t\tvar ref = new Firebase(\"https://rami-ttt.firebaseio.com/mariottt/chats/\" + $scope.matchID);\n\t\treturn $firebase(ref).$asArray();\n\t}", "async GetChannelViewers(channel_name) {\n let cfg = this.Config.GetConfig();\n if (this.isEnabled() !== true) return Promise.reject(new Error('TwitchAPI is disabled.'));\n if (cfg['disabled_api_endpoints'].find(elt => elt === 'Get Channel Viewers')) return Promise.reject(new Error('Endpoint is disabled.'));\n\n //ADD TO STATS\n this.STAT_API_CALLS++;\n this.STAT_API_CALLS_PER_10++;\n\n if (this.API_LOG && cfg['log_api_calls']) {\n this.API_LOG.insert({\n endpoint: 'Channel Badges',\n token: 'NONE',\n querry_params: { channel_name },\n time: Date.now()\n }).catch(err => this.Logger.warn(\"API Logging: \" + err.message));;\n }\n\n return new Promise(async (resolve, reject) => {\n let output = null;\n try {\n await this.request(\"http://tmi.twitch.tv/group/user/\" + channel_name + \"/chatters\", {}, json => {\n output = json;\n });\n resolve(output);\n } catch (err) {\n reject(err);\n }\n });\n }", "list_channels(user)\n {\n let result = []\n for (let guild of this.client.guilds.cache)\n {\n for (let channel of guild[1].channels.cache)\n {\n for (let member of channel[1].members)\n {\n if (member[1].id == user.id)\n {\n result.push(channel[1]);\n }\n }\n }\n }\n return result;\n }", "getReport()\r\n\t{\r\n\t\tlet report = '';\r\n\r\n\t\tmembers.forEach( (member, duration) => s += member.username + '\\t\\t' + duration + ' seconds\\n' );\r\n\t\treturn report;\r\n\t}", "function fetchChannels() {\n const top = async (total) => {\n const pages = Math.ceil(total / 100);\n results = [];\n channels = [];\n\n const args = \" -H 'query: username' -H 'history: default' -H 'clientid: \" + 'cli_f0d30ff74a331ee97e486558' +\n \"' -H 'token: \" + '7574a0b5ff5394fd628727f9d6d1da723a66736f3461930c79f4080073e09e349f5e8e366db4500f30c82335aa832b64b7023e0d8a6c7176c7fe9a3909fa43b7' +\n \"' -X GET https://matrix.sbapis.com/b/youtube/statistics\";\n\n for (let index = 0; index < pages; index++) {\n results.push(await client.youtube.top('subscribers', index + 1));\n }\n\n for (let page_index = 0; page_index < results.length; page_index++) {\n for (let index = 0; index < results[page_index].length; index++) {\n channel = results[page_index][index];\n channel['grade'] = \"N/A\";\n// channel_args = args;\n// exec('curl ' + channel_args.replace(\"username\",channel['id']['username']), function (error, stdout, stderr) {\n// console.log('stdout: ' + stdout)\n// if (stdout != null && stdout['data'] != undefined && stdout['data']['misc'] != undefined\n// && stdout['data']['misc']['grade'] != undefined && stdout['data']['misc']['grade']['grade'] != undefined) {\n// channel['grade'] = stdout['data']['misc']['grade']['grade'];\n// } else {\n// channel['grade'] = '';\n// }\n// console.log('stderr: ' + stderr);\n// if (error !== null) {\n// console.log('exec error: ' + error);\n// }\n// });\n channels.push(channel);\n }\n }\n\n var file = fs.createWriteStream('output.csv');\n file.write(\"id, username, display_name, created_at, channel_type, country, uploads, subscribers, views\" + \"\\n\");\n file.on('error', function(err) { /* error handling */ });\n channels.forEach(function(channel) {\n file.write(channel['id']['id'] + \", \" + channel['id']['username'] + \", \" + channel['id']['display_name'] + \", \"\n + channel['general']['created_at'] + \", \" + channel['general']['channel_type'] + \", \" + channel['general']['geo']['country'] + \", \"\n + channel['statistics']['total']['uploads'] + \", \" + channel['statistics']['total']['subscribers'] + \", \" + channel['statistics']['total']['views'] + \"\\n\");\n });\n\n file.end();\n\n return results;\n};\n\n top(500).then(\"done\").catch(console.error);\n}", "getPingsForNow(bot) {\n\t\tvar dt = dateTime.create();\n\t\tvar today = new Date(dt.now());\n\t\tvar today_datestring = ''+(today.getUTCMonth()+1)+'/'+today.getUTCDate()+'/'+today.getUTCFullYear();\n\t\t//var query = \"select * from users where ping_time = '\"+new Date(dt.now()).getHours()+\":00:00' and ( ping_day = 'EVERYDAY' or ping_day = '\"+today_datestring+\"')\";\n\t\tvar query = \"select u.username from team t inner join users u on (t.t_id = u.t_id) where ((u.ping_day = '\"+today_datestring+\"' or u.ping_day = 'EVERYDAY') and u.ping_time = '\" + new Date(dt.now()).getHours() + \":00:00')\"\n\t\t\t+ \" OR u.ping_day != '\"+today_datestring+\"' and u.ping_day != 'EVERYDAY' and t.ping_time = '\" + new Date(dt.now()).getHours() + \":00:00'\";\n\t\tvar users = [];\n\t\tvar getUsers = function (err, data) {\n\t\t\tif (err) {\n\t\t\t\tconsole.log(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor (var i in data.rows) {\n\t\t\t\tbot.bot.startPrivateConversation({ user: data.rows[i]['username'] }, function (err, convo) {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconvo.say(\"Hello there! <@\" + data.rows[i]['username'] + \">\");\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//users.addRow(data[i]);\n\t\t\t}\n\t\t}\n\t\tDataAccess.select(query, getUsers);\n\t\treturn users;\n\t}", "async getChannelsInWorkspace(workspace){\n\n //TODO: change this to a single query\n\n let workspaceChannels = await workspace.getChannels();\n\n // boolean array of the same length as workspaceChannels\n // element i is true if the workspaceChannels[i] hasUser user\n let appartenanceArray = await Promise.all(\n workspaceChannels.map(channel => channel.hasUser(this))\n );\n\n let channels = workspaceChannels.filter((channel, index) => {\n return appartenanceArray[index]\n });\n\n return channels\n }", "function getChannelList() {\n // Gets a list of channels from database based on user\n // ...\n\n // For development purposes, just return a predefined list of Twitch channels...\n return [\"ESL_SC2\", \"OgamingSC2\", \"cretetion\", \"freecodecamp\",\n \"storbeck\", \"habathcx\", \"RobotCaleb\", \"noobs2ninjas\", \"brunofin\",\n \"comster404\", \"clwnbaby\", \"MOONMOON_OW\", \"12TimeWeCCG\", \"puncayshun\",\n \"1twoQ\", \"MajinPhil\", \"bunniemuffin\", \"EEvisu\", \"DrDisRespectLIVE\",\n \"Venis_Gaming\", \"Elajjaz\", \"imapi\", \"xXScreamKiwiXx\", \"catonmarz\", \"dunkstream\"];\n}", "function get_reports() {\n var dataObj = {\n \"content\" : [\n { \"session_id\" : get_cookie() }\n ]\n };\n call_server('get_reports', dataObj);\n}", "async function getAllEventsChart() {\n var currentTime = new Date();\n var calculateFromTime = new Date(new Date().setTime(currentTime.getTime()- (1000 * config.graph.intervalTimeSeconds * config.graph.graphTimeScale)));\n var graphStartTime = new Date(calculateFromTime.getTime() + (1000 * config.graph.intervalTimeSeconds));\n\n var graphTimeList = calculateEventGraphInterval(calculateFromTime);\n try {\n var notifications = await getCollectionFunction(\"notifications\");\n\n var graphEvents = await filterToGetGraphEvents(notifications, graphStartTime);\n\n var eventFrequencyAtEachTimeMap = findEventsFrequencyInGraphInterval(graphTimeList, graphEvents);\n\n return {\n eventFrequencyAtEachTimeMap: eventFrequencyAtEachTimeMap,\n graphStartTime: graphTimeList[1],\n intervalTimeSeconds: config.graph.intervalTimeSeconds\n };\n }catch(err) {\n console.error(\"Error happened in getting graphEvents \", err);\n return {};\n }\n}", "getChannelUsers(channelId, options) {\n let that = this;\n return new Promise(function (resolve, reject) {\n let filterToApply = \"format=full\";\n if (options.format) {\n filterToApply = \"format=\" + options.format;\n }\n if (options.page > 0) {\n filterToApply += \"&offset=\";\n if (options.page > 1) {\n filterToApply += (options.limit * (options.page - 1));\n }\n else {\n filterToApply += 0;\n }\n }\n filterToApply += \"&limit=\" + Math.min(options.limit, 1000);\n if (options.type) {\n filterToApply += \"&types=\" + options.type;\n }\n that.http.get(\"/api/rainbow/channels/v1.0/channels/\" + channelId + \"/users?\" + filterToApply, that.getRequestHeader(), undefined).then(function (json) {\n that.logger.log(\"debug\", LOG_ID + \"(getUsersChannel) successfull\");\n that.logger.log(\"internal\", LOG_ID + \"(getUsersChannel) received \", json.total, \" users in channel\");\n resolve(json.data);\n }).catch(function (err) {\n that.logger.log(\"error\", LOG_ID, \"(getUsersChannel) error\");\n that.logger.log(\"internalerror\", LOG_ID, \"(getUsersChannel) error : \", err);\n return reject(err);\n });\n });\n }", "function getUsers() {\n\n DashboardFactory.getUsers().then(\n\n function(response) {\n\n vm.users = response;\n console.log(response);\n \n // Get all the chats that the user is subscribed to\n getChatsForAUser();\n },\n\n function(error) {\n\n console.log(error);\n });\n }", "function getChannelList () {\n //Set the URL path\n var _url = WEBSERVICE_CONFIG.SERVER_URL + '/epg/channels?user=rovi';\n\n // $http returns a promise for the url data\n return $http({method: 'GET', url: _url});\n }", "function getComingTimeslots(callback) {\n const query = `SELECT CoachProfiles.name, CoachProfiles.email, MeetingDays.date, Timeslots.time, Timeslots.duration\n FROM Users\n LEFT OUTER JOIN CoachProfiles ON Users.id = CoachProfiles.user_id\n LEFT OUTER JOIN MeetingDays\n LEFT OUTER JOIN Timeslots ON MeetingDays.date = Timeslots.date AND Timeslots.user_id = Users.id\n WHERE MeetingDays.date >= date(\"now\") AND Users.active = 1 AND Users.type = 1`;\n db.all(query, [], (err, result) => {\n if (err) return callback(err);\n return callback(err, result);\n });\n}", "getUserChats(DB, request, response) {\n\t\tDB.get_user_chats(request.params.auth_id).then((userChats) => {\n\t\t\tresponse.status(200).send(userChats);\n\t\t});\n\t}", "getMeteorData() {\n let query = {};\n\n return {\n chat: Chats.find(query, {sort: {createdAt: -1}}).fetch(),\n incompleteCount: Chats.find({checked: {$ne: true}}).count(),\n currentUser: Meteor.user()\n };\n }", "get availableChannels() {\n return this.db.groups.filteredSortedList(Application.filterRooms);\n }", "_extractMostActiveHours(messages, dayFilter = null){\n var mostActiveHours = []\n\n // mapping if needed\n if(dayFilter){\n\n var weekDay = new Array(7);\n weekDay[0] = \"Sunday\";\n weekDay[1] = \"Monday\";\n weekDay[2] = \"Tuesday\";\n weekDay[3] = \"Wednesday\";\n weekDay[4] = \"Thursday\";\n weekDay[5] = \"Friday\";\n weekDay[6] = \"Saturday\";\n\n }\n\n // all users object\n mostActiveHours.push({all_users: true, total: 0})\n\n messages.map(m => { \n\n if(m.isUserMessage){\n\n // Date object if needed\n if(dayFilter){\n\n var parts = m.date.split('/')\n var year = parseInt(parts[2], 10) + 2000\n var month = parseInt(parts[0], 10) - 1 // month is zero-based\n var day = parseInt(parts[1], 10)\n var messageDate = new Date(year, month, day);\n\n }\n\n // if there's no day filter or the filter matches the message's day\n if(!dayFilter || [weekDay[messageDate.getDay()]] == dayFilter){\n\n var hour = m.time.substr(0, m.time.indexOf(':'));\n\n // checks for the hour attribute in the specified index, creates it if it doesn't exist, adds to the count if it does\n function countHours(index){\n if(mostActiveHours[index].hasOwnProperty([hour])){\n mostActiveHours[index][hour]++\n } else {\n mostActiveHours[index][hour] = 1\n }\n mostActiveHours[index].total++\n }\n\n countHours(0)\n\n // tries to find the user through the index, if it doesn't it returns -1\n var user_index = mostActiveHours.findIndex(u => u.user == m.user)\n\n // creates a new user object with the initial count if it doesn't exist already in the array, otherwise just adds to the count\n if(user_index == -1){\n const userDays = {user: m.user, total: 1, [hour]: 1}\n mostActiveHours.push(userDays)\n } else {\n countHours(user_index)\n }\n\n }\n\n }\n\n });\n\n mostActiveHours = mostActiveHours.sort((a, b) => {\n return b.total - a.total;\n })\n\n return mostActiveHours;\n }", "function readChannelsList() {\n // DEFINE LOCAL VARIABLES\n\n // NOTIFY PROGRESS\n console.log('reading channels');\n\n // HIT METHOD\n asdb.read.channelsList().then(function success(s) {\n console.log('Channels collection:');\n \n var i = 1;\n Object.keys(s).forEach(function(key) {\n console.log(i + \". \" + s[key].title + \" (\" + key + \")\");\n i++;\n });\n\n }).catch(function error(e) {\n\t\tconsole.log(\"error\", e);\n\t});\n\n}", "async function getTwitchChannels() {\n\n try {\n \n let dbResponse, twitchNameArray;\n\n dbResponse = await db.announcerGetUniqueTwitchNames();\n twitchNameArray = dbResponse.map(element => {\n return element.twitch_channel_name;\n });\n \n return TWITCH.getStreamersFromArray(twitchNameArray);\n\n } catch (error) {\n \n console.log('Error in getUniqueTwitchNames()', error);\n return null;\n\n }\n\n}", "function enumerateChannels() {\n ably.request('get', '/channels', { limit: 100, by: 'id' }, null, null, function(err,res){\n res.items.forEach(chan => {\n ably.request('get', '/channels/'+chan, { limit: 100, by: 'id' }, null, null, function(err,res2){\n chans.names[chans.names.length] = chan;\n chans.conns[chans.names.length] = res2.items[0].status.occupancy.metrics.connections;\n count++;\n });\n });\n }); \n}", "function generate_all_reports()\n{\n report_ToAnswer_emails();\n report_FollowUp_emails();\n report_Work_FollowUp_emails();\n}", "function byTime(req, res, next) {\n\n\tvar timeFrom = new Date(req.params.timefrom);\n\tvar timeTo = new Date(req.params.timeto);\n\tvar user = req.user;\n\n\tvar shortList;\n\n\tif (req.body && req.body.length && req.body.length > 0) {\n\t\tshortList = req.body;\n\t}\n\n\tuser.allAuthorized(shortList, function (err, followingIds) {\n\t\tif (err) {\n\t\t\treturn next(err);\n\t\t}\n\n\t\tReport.find({\n\t\t\t'userid': {\n\t\t\t\t$in: followingIds\n\t\t\t},\n\t\t\t'date': {\n\t\t\t\t$gte: timeFrom,\n\t\t\t\t$lt: timeTo\n\t\t\t}\n\t\t})\n\t\t.select('-__v -_id -updated')\n\t\t.sort('-date')\n\t\t.limit(5000)\t// put a sensible big upper limit - don't want to stress things\n\t\t.exec(function (err, docs) {\n\t\t\tif (err) {\n\t\t\t\treturn next(err);\n\t\t\t}\n\n\t\t\treturn res.status(httpStatus.OK).json(docs);\n\t\t});\n\t});\n}", "function getUsers() {\r\n var message = \"type=allUser\";\r\n sendFriendData(message, 'showUser');\r\n return 0;\r\n}", "function getChannel(channel){\n gapi.client.youtube.channels.list({\n part: 'snippet,contentDetails,statistics',\n forUsername: channel\n\n })\n .then(respone => {\n console.log(response);\n const channel = response.result.items[0];\n\n const output = `\n <ul class=\"collection\">\n <li class=\"collection-item\">Title : ${channel.snippet.title}</li>\n <li class=\"collection-item\">ID: ${channel.id}</li>\n <li class=\"collection-item\">Subscribers: ${channel.statistics.subscriberCount}</li>\n <li class=\"collection-item\">Views: ${ numberWithCommas(channel.statistics.viewCount)}</li>\n <li class=\"collection-item\">Videos: ${numberWithCommas(channel.statistics.videoCount)}</li>\n </ul>\n <p>${channel.snippet.description}</p>\n <hr>\n <a class=\"btn grey darken-2\" target=\"_blank\" href=\"https://youtube.com/${channel.snippet.customURL}\">Visit Channel</a>\n\n `;\n\n showChannelData(output);\n\n const playlistID = channel.contentDetails.relatedPlaylists.uploads;\n requestVideoPlaylist(playlistID);\n })\n .catch(err => alert('No Channel By That Name'));\n}", "static getUsers() {\n return PersonalStats.dates;\n }", "function channelsMine(req, res) {\n res.json(req.user.myChannels);\n}", "async getUsersWorklogs(userIds) {\n log('get all users worklogs ....');\n const { fromDate, toDate } = dateRange(this.companyTimezone, this.options['date-range']);\n return this.api.get('/api/1.0/activity/worklog', {\n params: {\n company: this.companyId,\n user: userIds,\n 'task-project-names': true,\n from: fromDate,\n to: toDate,\n token: this.token,\n },\n }).then((response) => response.data.data).catch((error) => {\n log(error.response.data.message, true);\n });\n }", "getChannels() {\n const slack_channels = this.bot.getChannels()._value.channels;\n\n for (let item = 0; item < slack_channels.length; item++) {\n this.channels[slack_channels[item].id] = slack_channels[item].name;\n }\n }", "function channelHandler(agent) {\n console.log('in channel handler');\n var jsonResponse = `{\"ID\":10,\"Listings\":[{\"Title\":\"Catfish Marathon\",\"Date\":\"2018-07-13\",\"Time\":\"11:00:00\"},{\"Title\":\"Videoclips\",\"Date\":\"2018-07-13\",\"Time\":\"12:00:00\"},{\"Title\":\"Pimp my ride\",\"Date\":\"2018-07-13\",\"Time\":\"12:30:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:30:00\"},{\"Title\":\"Daria\",\"Date\":\"2018-07-13\",\"Time\":\"13:45:00\"},{\"Title\":\"The Real World\",\"Date\":\"2018-07-13\",\"Time\":\"14:00:00\"},{\"Title\":\"The Osbournes\",\"Date\":\"2018-07-13\",\"Time\":\"15:00:00\"},{\"Title\":\"Teenwolf\",\"Date\":\"2018-07-13\",\"Time\":\"16:00:00\"},{\"Title\":\"MTV Unplugged\",\"Date\":\"2018-07-13\",\"Time\":\"16:30:00\"},{\"Title\":\"Rupauls Drag Race\",\"Date\":\"2018-07-13\",\"Time\":\"17:30:00\"},{\"Title\":\"Ridiculousness\",\"Date\":\"2018-07-13\",\"Time\":\"18:00:00\"},{\"Title\":\"Punk'd\",\"Date\":\"2018-07-13\",\"Time\":\"19:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"20:00:00\"},{\"Title\":\"MTV Awards\",\"Date\":\"2018-07-13\",\"Time\":\"20:30:00\"},{\"Title\":\"Beavis & Butthead\",\"Date\":\"2018-07-13\",\"Time\":\"22:00:00\"}],\"Name\":\"MTV\"}`;\n var results = JSON.parse(jsonResponse);\n var listItems = {};\n textResults = getListings(results);\n\n for (var i = 0; i < results['Listings'].length; i++) {\n listItems[`SELECT_${i}`] = {\n title: `${getShowTime(results['Listings'][i]['Time'])} - ${results['Listings'][i]['Title']}`,\n description: `Channel: ${results['Name']}`\n }\n }\n\n if (agent.requestSource === 'hangouts') {\n const cardJSON = getHangoutsCard(results);\n const payload = new Payload(\n 'hangouts',\n cardJSON,\n {rawPayload: true, sendAsMessage: true},\n );\n agent.add(payload);\n } else {\n agent.add(textResults);\n }\n}", "function getallusers() {\n\n\t}", "outputStatistics(bot, guild, channel) {\n healthyUsers = roles.playerNamesByRole(guild, roles.HEALTHY);\n infectedUsers = roles.playerNamesByRole(guild, roles.INFECTED);\n deadUsers = roles.playerNamesByRole(guild, roles.DEAD);\n recoveredUsers = roles.playerNamesByRole(guild, roles.RECOVERED);\n \n var statistics = new Discord.MessageEmbed()\n .setTitle('Users per role')\n .addFields(\n {name: 'Healthy', value: checkUsers(healthyUsers)},\n {name: 'Infected', value: checkUsers(infectedUsers)},\n {name: 'Dead', value: checkUsers(deadUsers)},\n {name: 'Recovered', value: checkUsers(recoveredUsers)}\n )\n .setColor('#f5336e');\n channel.send(statistics);\n }", "get channels() {\n return this.getAllElements('channel');\n }", "async getAllReports() {\n return await axios.get(endpoint + \"reports\");\n }", "function getChannelSubscriptions(channel, pageToken, resultArr) {\n\n youtube.subscriptions.list({\n part: 'snippet',\n channelId: channel,\n key: key,\n maxResults: 50,\n pageToken: pageToken\n }).then((res) => putChannelSubscriptionsInArray(channel, res, resultArr))\n .catch((err) => {\n console.log('unable to get subscriptions for channel ' + channel);\n getChannelPlaylists(channel, null, []);\n });\n\n}", "async getChats(userId) {\n const query =\n \"SELECT DISTINCT BIN_TO_UUID(chatId) chatId, createdAt, BIN_TO_UUID(senderId) senderId,BIN_TO_UUID(receiverId) receiverId, cs.status, GROUP_CONCAT(CASE WHEN u.userId != UUID_TO_BIN(?) THEN u.name END ) AS callee, (SELECT DISTINCT (SELECT text FROM message WHERE sentDate = (SELECT (MAX(sentDate))FROM message WHERE chatId = c.chatId))FROM message) AS lastMessage FROM chat c JOIN chatStatus cs USING (chatId) JOIN user u ON c.receiverId = u.userId OR c.senderId = u.userId WHERE cs.userId = UUID_TO_BIN(?) AND cs.status='visible' GROUP BY chatId, createdAt, senderId, receiverId, c.chatId ORDER BY createdAt DESC; \";\n\n return new Promise((resolve, reject) => {\n sql.query(query, [userId, userId], (err, result, field) => {\n if (err) throw err;\n\n resolve(result);\n });\n });\n }", "async function channelsOnline() {\n try {\n\n // console.log('Running Online Check');\n let db = global.db;\n let joinedChannels = await db.channel_settings.find({ joined: true });\n let channelList = [];\n let channelReturn;\n let currentTimers = TIMERS.showTimers();\n let onlineChannels = [];\n \n\n for (let channel in joinedChannels) {\n channelList.push(joinedChannels[channel].broadcaster);\n }\n \n channelReturn = await channelCheck(channelList);\n channelReturn = channelReturn['streams'];\n\n for (let channel in channelReturn) {\n let pushThis = channelReturn[channel]['channel']['name'];\n pushThis = '#' + pushThis;\n onlineChannels.push(pushThis);\n }\n \n for (let channel in currentTimers) {\n if (currentTimers.hasOwnProperty(channel)) {\n let lastShownOnline = currentTimers[channel].online;\n let currentlyOnline = onlineChannels.includes(channel);\n\n // If channel is now online\n if (!lastShownOnline && currentlyOnline) {\n console.log(`${channel} is now online.`);\n TIMERS.changeOnlineStatus(channel);\n } \n // If channel has gone offline\n else if (lastShownOnline && !currentlyOnline) {\n console.log(`${channel} is now offline.`);\n TIMERS.changeOnlineStatus(channel);\n }\n }\n }\n } catch (err) {\n console.log('channelsOnline Error:');\n if (err.statusCode === 500) {\n console.log('Twitch Returned a 500 service error.');\n } else {\n console.log(err);\n }\n }\n}", "static get reports() {}", "async function retrieveChatHistory(userID){\n let msgs = await Chat.find({$or:[{sender: userID, recipient:\"admin\"},{sender:\"admin\", recipient:userID}]}).sort({'timeStamp': -1});\n let msgArray = []; let msgObj;\n if(msgs.length > 0){\n let account = await Account.find({_id:mongoose.Types.ObjectId(userID)});\n let customerName = account[0].firstname + \" \" + account[0].lastname;\n for(let i=0;i<msgs.length;i++) {\n let timestamp = moment(msgs[i].timeStamp).utc().format('DD-MM-YYYY h:mm a');\n if(msgs[i].sender === \"admin\"){\n msgObj = new ChatClass(msgs[i].sender, customerName, msgs[i].message, timestamp);\n }else{\n msgObj = new ChatClass(customerName, msgs[i].recipient, msgs[i].message, timestamp);\n }\n msgArray.push(msgObj);\n }\n }\n return msgArray;\n}", "function genereateList() {\n channels.forEach(function(channel) {\n twitchAPI(channel);\n });\n}", "function queryReports() {\n\t\tgapi.client.request({\n\t\t\tpath : '/v4/reports:batchGet',\n\t\t\troot : 'https://analyticsreporting.googleapis.com/',\n\t\t\tmethod : 'POST',\n\t\t\tbody : {\n\t\t\t\treportRequests : [ {\n\t\t\t\t\tviewId : VIEW_ID,\n\t\t\t\t\tdateRanges : [ {\n\t\t\t\t\t\tstartDate : '7daysAgo',\n\t\t\t\t\t\tendDate : 'today'\n\t\t\t\t\t} ],\n\t\t\t\t\tdimensions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tname: 'ga:eventLabel'\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tmetrics: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\texpression: 'ga:totalEvents',\n\t\t\t\t\t\t}\n\t\t\t\t\t],\n\t\t\t\t\tfiltersExpression: 'ga:eventCategory==formsubmit,ga:eventAction==submit',\n\t\t\t\t} ]\n\t\t\t}\n\t\t}).then(displayResults, console.error.bind(console));\n\t}", "async usersByTech () {\n\n let usersTech = [];\n\n // consulta todas as tecnologias cadastradas\n const allTechs = await TechService.all();\n\n // consulta todos os checkins\n const allCheckins = await this.all();\n\n usersTech = allTechs.map(tech => {\n\n let IdTech = tech.id;\n let CounterCheck = [];\n\n // filtra os checkin para cada tecnologia\n CounterCheck = allCheckins.filter(\n checkin => checkin.tecnologia == IdTech\n );\n \n return {\n\n idTech : IdTech,\n techName: tech.techname,\n numberOfCheck: CounterCheck.length\n\n }\n \n });\n\n\n return usersTech;\n }", "async channels(sender) {\n let channels = await slack.getAllChannels()\n channels = _.orderBy(channels, ['name'], ['asc'])\n const bundle = channels.map((c) => {\n if (c.is_archived || c.is_im || c.is_mpim) {\n return\n }\n let type = 'public'\n if (c.is_private || c.is_group) {\n type = 'private'\n }\n if (c.is_general) {\n type = 'general'\n }\n return `${c.name} | ${c.id} | ${type} | ${c.num_members || 0}`\n })\n bundle.unshift(`Name | ChannelId | Type | Members`)\n await slack.postEphemeral(sender, bundle.join('\\n'))\n }", "function listChannels(){\n $http.get(baseUrl+\"/mobilegateway/masterdata/channels\")\n .then(function(response) {\n $scope.getChannelType = response.data.channelList;\n });\n }", "function getAllUserDashInfo() {\n // Query announcements\n axios\n .all([\n axios.get(\"/api/v1/announcements\", { withCredentials: true }),\n axios.get(\"/api/v1/tasks\", { withCredentials: true }),\n axios.get(\"/api/v1/comments\", { withCredentials: true }),\n axios.get(\"/api/v1/users\", { withCredentials: true }),\n ])\n .then(\n axios.spread((announcements, tasks, comments, userData) => {\n setUserAnnouncementList(\n announcements.data.filter((ann) => !isCompletedClass(ann))\n );\n setUserTaskList(tasks.data.incompletedTasks.filter(\n (task) => !isCompletedClass(task)\n ));\n setUserSubtaskList(tasks.data.incompletedSubtasks.filter(\n (task) => !isCompletedClass(task)\n ));\n setUserCommentList(comments.data); \n setUsername(userData.data.attributes.username);\n })\n )\n .catch((err) => console.log(err))\n .finally(() => setIsRetrieving(false));\n }", "function listOfEvents() {\n times = new Array(); \n gapi.client.calendar.events.list({\n 'calendarId': 'primary',\n 'timeMin': (new Date()).toISOString(),\n 'showDeleted': false,\n 'singleEvents': true,\n 'maxResults': 15,\n 'orderBy': 'startTime'\n }).then(function(response) {\n var events = response.result.items;\n //appendPre('Upcoming events:');\n\n if (events.length > 0) {\n var duration = 0;\n var possible_time = {\n \"hour\": [],\n 'duration': []\n };\n for (i = 0; i < events.length; i++) {\n var event = events[i];\n var when = event.start.dateTime;\n if (!when) { /* if the event is all day long */\n when = event.start.date;\n duration = 24;\n }\n var end = event.end.dateTime;\n if (!end) {\n end = event.end.date;\n }\n\n var endMin = stringToMinutes(end);\n var whenMin = stringToMinutes(when);\n\n if(duration < 24) duration = endMin - whenMin; /* sets duration */\n possible_time.hour = whenMin;\n possible_time.duration = duration;\n times.push(possible_time);\n\n /* reinitlizing variables */\n duration = 0;\n possible_time = {\n \"hour\":[],\n \"duration\":[]\n };\n\n console.log(\"before i will add event\");\n //addEvent(events);\n }\n } else {\n times = NULL; /* there are no upcoming events */\n }\n console.log(\"DONE GETTING CALENDAR TIMES\");\n console.log(times);\n return times; \n });\n}", "static getChatsAsync(){\n return new Promise((resolve, reject) => {\n ConnectyCubeHandler.getInstance().chat.dialog.list({}, function(error, dialogs) {\n if (error!==null) reject(error)\n resolve(dialogs.items)\n })\n })\n }", "function getAndDisplayUserReport() {\n getUserInfo(displayUserReport);\n}", "async getAggregatedTimeline() {\n let info = {\n timeline: [],\n from: null,\n };\n if (!this.accessToken) {\n console.error(\"No access token\");\n return info;\n }\n const filterJson = JSON.stringify({\n room: {\n timeline: {\n limit: 100,\n },\n },\n });\n let syncData = await this.fetchJson(\n `${this.serverUrl}/r0/sync?filter=${filterJson}`,\n {\n headers: { Authorization: `Bearer ${this.accessToken}` },\n }\n );\n // filter only @# rooms then add in all timeline events\n const roomIds = Object.keys(syncData.rooms.join).filter((roomId) => {\n // try to find an #@ alias\n let foundAlias = false;\n for (let ev of syncData.rooms.join[roomId].state.events) {\n if (ev.type === \"m.room.aliases\" && ev.content.aliases) {\n for (let alias of ev.content.aliases) {\n if (alias.startsWith(\"#@\")) {\n foundAlias = true;\n break;\n }\n }\n }\n if (foundAlias) {\n break;\n }\n }\n return foundAlias;\n });\n let events = [];\n for (let roomId of roomIds) {\n for (let ev of syncData.rooms.join[roomId].timeline.events) {\n ev.room_id = roomId;\n events.push(ev);\n }\n }\n // sort by origin_server_ts\n info.timeline = events.sort((a, b) => {\n if (a.origin_server_ts === b.origin_server_ts) {\n return 0;\n }\n if (a.origin_server_ts < b.origin_server_ts) {\n return 1;\n }\n return -1;\n });\n info.from = syncData.next_batch;\n return info;\n }", "async getDO() {\n let response = await this.get('/api/slot/0/io/relay');\n let channels = [];\n response.io.relay.forEach(i => {\n channels[i.relayIndex] = i.relayMode ? i.relayPulseStatus\n : i.relayStatus;\n });\n return channels;\n }", "function get_channelInfo(APIKey , channel_id , callBackFunction ){\n $.getJSON( \"https://www.googleapis.com/youtube/v3/channels?part=statistics,snippet&id=\" + channel_id + \"&key=\" + APIKey , function(data) {\n /*On success callback*/\n var channel = new ChannelObj( data.items[0].snippet.title , data.items[0].snippet.description , data.items[0].snippet.thumbnails.default.url , new Date(data.items[0].snippet.publishedAt) );\n channel.id = channel_id;\n channel.stats.push( { key: \"views\", value: Number(data.items[0].statistics.viewCount) });\n channel.stats.push( { key: \"subscribers\", value: Number(data.items[0].statistics.subscriberCount) });\n channel.stats.push( { key: \"videoCount\", value: Number(data.items[0].statistics.videoCount) });\n callBackFunction(channel);\n });\n}", "function GetCounterChats(ultime_msg, cback) {\n\n\t// Buscando amigo usuario implicado\n\tChatsList.findOne({'chat_content_id': ultime_msg.chat_room_id}, function (err, ChatItem) {\n\t\tif(err) {\n\t\t\treturn console.log('Error al encontrar chat Item: ' + err)\n\t\t}\n\n\t\tvar user_friend_id = ''\n\n\t\t// Obteniendo el id del amigo\n\t\tfor(var v = 0; v <= ChatItem.users.length - 1; v++) {\n\t\t\tvar el_chat_user = ChatItem.users[v]\n\t\t\t\n\t\t\tif(el_chat_user.user_id === ultime_msg.user_id) {\n\n\t\t\t\t// obteniendo el counter del otro\n\t\t\t\tif(v === 0) {\n\t\t\t\t\tuser_friend_id = ChatItem.users[v + 1].user_id\n\n\t\t\t\t} else {\n\t\t\t\t\t// v = 1\n\t\t\t\t\tuser_friend_id = ChatItem.users[v - 1].user_id\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\n\t\t}\n\n\t\t// Buscando entre todos los elementos de chat Items\n\t\tChatsList.find(function (err, chatItem) {\n\t\t\tif(err) {\n\t\t\t\treturn cback(err)\n\t\t\t}\n\t\t\t\n\t\t\tvar counterMax = 0\n\n\t\t\t// Filtrando chat, donde el usuario esta incluido\n\t\t\tfor(var u = 0; u <= chatItem.length - 1; u++) {\n\t\t\t\tvar el_chatItem = chatItem[u]\n\n\t\t\t\t// Buscando entre los usuarios incluidos en el chat\n\t\t\t\tfor(var j = 0; j <= el_chatItem.users.length - 1; j++) {\n\t\t\t\t\tvar el_chat_user = el_chatItem.users[j]\n\t\t\t\t\t\n\t\t\t\t\tif(el_chat_user.user_id === user_friend_id) {\n\n\t\t\t\t\t\t// obteniendo el counter del otro\n\t\t\t\t\t\tif(j === 0) {\n\t\t\t\t\t\t\tcounterMax += el_chatItem.users[j + 1].counter\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// j = 1\n\t\t\t\t\t\t\tcounterMax += el_chatItem.users[j - 1].counter\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcback(err, counterMax, user_friend_id)\n\n\t\t})\n\n\t})\n\n}", "getUsers(filters) {\n this.helper.publish(JSON.stringify(filters), Constants.USERS, Constants.GET_USERS,(err, users) => {\n this.sockets.forEach((socket) => {\n if (err) socket.emit(Constants.ERROR);\n else socket.emit(Constants.USERS_RETURNED, users);\n });\n });\n }", "async getResponseTime() {\n\n const user = this.ctx.params.userId;\n let time = this.ctx.params.day;\n\n // set the duration time\n switch(time.toLowerCase()) {\n case 'week':\n time = 7;\n break;\n case 'month':\n time = 30;\n break;\n case '3month':\n time = 90;\n break;\n default:\n time = 180;\n break;\n }\n\n try {\n let str = `select checkerId, checkerName, count(id)\n from eventTAT\n where now() - interval '$1 d' < to_timestamp(createAt / 1000)\n and type = 2 and duration < 1000 * 60 * $2\n and shopId in (\n select shopId from shopUser\n where userId = $3)\n group by checkerId, checkerName\n order by checkerId`;\n const count1 = await this.app.db.query(str, [time, this.app.config.time.checkerResponseTime[0], user]);\n\n str = `select checkerId, checkerName, count(id)\n from eventTAT\n where now() - interval '$1 d' < to_timestamp(createAt / 1000)\n and type = 2 and duration > 1000 * 60 * $2 and duration < 1000 * 60 * $3\n and shopId in (\n select shopId from shopUser\n where userId = $4)\n group by checkerId, checkerName\n order by checkerId`;\n const count2 = await this.app.db.query(str, [time, this.app.config.time.checkerResponseTime[0], this.app.config.time.checkerResponseTime[1], user]);\n\n str = `select checkerId, checkerName, count(id)\n from eventTAT\n where now() - interval '$1 d' < to_timestamp(createAt / 1000)\n and type = 2 and duration > 1000 * 60 * $2\n and shopId in (\n select shopId from shopUser\n where userId = $3)\n group by checkerId, checkerName\n order by checkerId`;\n const count3 = await this.app.db.query(str, [time, this.app.config.time.checkerResponseTime[2], user]);\n\n const temp = {};\n count1.map(obj => {\n if (!temp[obj.checkerid]) {\n temp[obj.checkerid] = {\n checkerId: obj.checkerid,\n checkerName: obj.checkername,\n count1: +obj.count,\n count2: 0,\n count3: 0,\n }\n }\n });\n\n count2.map(obj => {\n if (!temp[obj.checkerid]) {\n temp[obj.checkerid] = {\n checkerId: obj.checkerid,\n checkerName: obj.checkername,\n count1: 0,\n count2: +obj.count,\n count3: 0\n }\n } else {\n temp[obj.checkerid].count2 = +obj.count;\n }\n });\n\n\n count3.map(obj => {\n if (!temp[obj.checkerid]) {\n temp[obj.checkerid] = {\n checkerId: obj.checkerid,\n checkerName: obj.checkername,\n count1: 0,\n count2: 0,\n count3: +obj.count,\n }\n } else {\n temp[obj[checkerid]].count3 = +obj.count;\n }\n });\n\n this.response(200, Object.values(temp));\n } catch (err) {\n this.response(400, 'get checker response time failed');\n }\n }", "function requestHistory() {\n pubnub.history(\n {\n channel: CHANNEL_NAME_COLOR,\n count: 1, // how many items to fetch. For this demo, we only need the last item.\n },\n function (status, response) {\n if (status.error === false) {\n let lastColorMessage = response.messages[0].entry[CHANNEL_KEY_COLOR];\n let lastDuckName = response.messages[0].entry[CHANNEL_KEY_DUCKNAME];\n let timet = response.messages[0].timetoken;\n updateDuckColor(lastColorMessage, lastDuckName, timet);\n logReceivedMessage(response.messages, \"color history\");\n } else {\n console.log(\"Error recieving \" + CHANNEL_NAME_COLOR + \" channel history:\");\n console.log(status);\n }\n }\n );\n pubnub.history(\n {\n channel: CHANNEL_NAME_TALK,\n count: 1, // how many items to fetch. For this demo, we only need the last item.\n },\n function (status, response) {\n // Response returns messages in an array (even if request.count == 1)\n if (status.error === false) {\n let lastTalkMessage = response.messages[0].entry[CHANNEL_KEY_TEXT];\n let lastDuckName = response.messages[0].entry[CHANNEL_KEY_DUCKNAME];\n let timet = response.messages[0].timetoken;\n updateDuckTalk(lastTalkMessage, lastDuckName, timet);\n logReceivedMessage(response.messages, \"talk history\");\n } else {\n console.log(\"Error recieving \" + CHANNEL_NAME_TALK + \" channel history:\");\n console.log(status);\n }\n }\n );\n}", "function getUpcomingTimes() {\n var now = moment().utc();\n var upcomingTimes = [];\n var count = 0;\n return new Promise(function(resolve, reject) {\n for (var i = 0; i < 5; i++) {\n aux(i, 'global', function() {\n if (count === 5)\n resolve(upcomingTimes);\n });\n }\n\n\n });\n\n function aux(digit, version, cb) {\n var options = {\n url: 'http://localhost:3000/api/turtle',\n qs: {\n digit: digit,\n version: 'global',\n },\n json: true,\n };\n\n return rp(options).then(function(dates) {\n var i = 0;\n upcomingTimes[digit] = moment.utc(dates[i]);\n while (now.isAfter(upcomingTimes[digit])) {\n upcomingTimes[digit] = moment.utc(dates[++i]);\n }\n count++;\n cb();\n }).catch(function(err) {\n console.log('Error retrieving date');\n count++;\n cb();\n });\n }\n}", "function update_stats() {\n\n\n // retrieve stats from YT API\n var url = \"https://www.googleapis.com/youtube/v3/channels?part=statistics&id=\" + channel_id + \"&key=\" + API_key;\n $.getJSON(url, function (x) {\n if (x.pageInfo.totalResults > 0) {\n // Channel found!\n update_all_stats(\n x.items[0].statistics.subscriberCount,\n x.items[0].statistics.videoCount,\n x.items[0].statistics.commentCount,\n x.items[0].statistics.viewCount,\n x.items[0].statistics.hiddenSubscriberCount\n );\n\n } else {\n // Something odd...not supposed to reach this point but start a new search for the channel\n search_for_channel(channel_id);\n }\n });\n\n}", "function get_active_chats() \n{\n\t$.ajax({\n\t\t\turl: global_base_url + \"chat/get_active_chats\",\n\t\t\ttype: \"get\",\n\t\t\tdata: {\n\t\t\t},\n\t\t\tdataType: 'JSON',\n\t\t\tsuccess: function(msg) {\n\t\t\t\t$('#active_chats').html(msg.view);\n\n\t\t\t\t// Get active chat list\n\t\t\t\tfor(var i=0; i<msg.active_chats.length; i++) {\n\t\t\t\t\tactive_chats.push(msg.active_chats[i]);\n\t\t\t\t}\n\n\t\t\t\t// Unique it\n\t\t\t\tactive_chats = jQuery.unique(active_chats);\n\t\t\t\t\n\t\t\t}\n\t\t});\n}", "function getInfo(channel, option) {\n $.ajax({\n type: \"GET\",\n url: \"https://wind-bow.glitch.me/twitch-api/\" + option + \"/\" + channel,\n datatype: \"json\",\n success: function(val) {\n if (!(\"stream\" in val)) {\n streamNull(val, channel);\n } else if (val.stream === null) {\n getInfo(channel, \"users\");\n } else {\n streamOn(val);\n }\n }\n });\n }", "async function watchCheck(botChannel, bot) {\n console.log(`\\nwatchCheck at: ${new Date(Date.now())}\\nlast Check at: ${new Date(bot.lastWatch)}\\n`);\n\n const subscribers = await getSubs();\n const wfState = await commons.getWfStatInfo(config.WFStatApiURL);\n\n subscribers.forEach((sub) => {\n console.log(`User: ${sub.userID}`);\n\n sub.subData.forEach((entry) => {\n const notifyStr = checkNotificationsForEntry(entry, wfState, bot);\n\n console.log(`return string:${notifyStr}`);\n\n if (notifyStr) {\n bot.users.fetch(sub.userID).then((user) => {\n try {\n user.send(`Notification for you operator:\\n${notifyStr}`);\n } catch (error) {\n botChannel.send(`Failed to send a DM to ${user}. Have you enabled DMs?`);\n }\n });\n }\n });\n });\n\n return Date.parse(wfState.timestamp);\n}", "function getInfo() {\n list.forEach(function(channel) {\n function makeURL(type, name) {\n return 'https://wind-bow.gomix.me/twitch-api/' + type + '/' + name + '?callback=?';\n };\n\n //Get logo, name, and display name from \"users\" URL\n $.getJSON(makeURL(\"users\", channel), function(data) {\n var logo = data.logo;\n var displayName = data.display_name;\n var name = data.name;\n\n //Get status and game from \"streams\" URL\n $.getJSON(makeURL(\"streams\", channel), function(data2) {\n if (data2.stream === null) {\n status = \"OFFLINE\";\n game = \"\";\n }\n\n if (data2.stream) {\n status = \"ONLINE\";\n game = data2.stream.game;\n }\n\n html = '<div class=\"box\"><div><img src=\"' + logo + '\" class=\"logoSize\" alt=\"Logo\"></div><div class=\"nameSize\"><a href=\"' + \"https://go.twitch.tv/\" + name + '\" target=\"_blank\">' + displayName + '</a></div>' + '<a href=\"' + \"https://go.twitch.tv/\" + name + '\" target=\"_blank\"><div class=\"statusSize\">' + status + '</div><div class=\"gameSize\">' + game + '</div></a></div>';\n\n $(\"#display\").prepend(html);\n\n //Add online users to \"onlines\" variable\n if (data2.stream) {\n onlines.push(html);\n }\n\n //Add offline users to \"offlines\" variable\n if (data2.stream === null) {\n offlines.push(html);\n }\n\n $(\"#all\").click(function() {\n $(\"#display\").empty();\n $(\"#display\").prepend(onlines);\n $(\"#display\").prepend(offlines);\n $(\"#offline\").removeClass(\"active\");\n $(\"#online\").removeClass(\"active\");\n $(\"#all\").addClass(\"active\");\n });\n\n $(\"#online\").click(function() {\n $(\"#display\").empty();\n $(\"#display\").prepend(onlines);\n $(\"#offline\").removeClass(\"active\");\n $(\"#all\").removeClass(\"active\");\n $(\"#online\").addClass(\"active\");\n });\n\n $(\"#offline\").click(function() {\n $(\"#display\").empty();\n $(\"#display\").prepend(offlines);\n $(\"#all\").removeClass(\"active\");\n $(\"#online\").removeClass(\"active\");\n $(\"#offline\").addClass(\"active\");\n });\n }); //End second getJSON\n }); //End first getJSON\n }); //End list.forEach(function(channel))\n}", "function getChannelInfo(channelKey, k) {\n\n var url = \"https://www.googleapis.com/youtube/v3/channels?part=snippet,statistics&id=\" + channelKey + \"&key=\" + apiKey;\n\n var xhttp = new XMLHttpRequest();\n xhttp.onreadystatechange = function () {\n if (this.readyState == 4 && this.status == 200) {\n var channelsModel = JSON.parse(this.responseText).items;\n channelsModel.forEach(function (element) {\n var code = channelCodes[element.id];\n var points = channelPoints[element.id];\n var isPartner = channelPartner[element.id];\n var isPick = channelPick[element.id];\n renderChannelInfo(element, code, points, isPartner, isPick, k);\n });\n }\n };\n\n xhttp.open(\"GET\", url, true);\n xhttp.send();\n}", "function getDataForAllChannels() {\n channels.forEach(function(channel) {\n // Data from the Channels API\n $.getJSON(\"https://wind-bow.gomix.me/twitch-api/channels/\" + channel + \"?callback=?\", function(data) {\n var status, url, name, logo;\n if (data.error === \"Not Found\") {\n status = false;\n url = '';\n name = '<div class=\"col-md-2\">' + channel + '</div>';\n logo = \"https://dummyimage.com/50x50/ecf0e7/5c5457.jpg&text=0x3F\";\n } else {\n status = true;\n url = '<a href=\"' + data.url + '\" target=\"_blank\">';\n name = '<div class=\"col-md-2\">' + data.name + '</div></a>';\n logo = data.logo;\n };\n // Data from the Streams API\n $.getJSON(\"https://wind-bow.gomix.me/twitch-api/streams/\" + channel + \"?callback=?\", function(streamdata) {\n if (status === false) {\n status = \"Not on twitch\";\n } else if (streamdata.stream === null) {\n status = \"Offline\";\n } else {\n url = '<a href=\"' + streamdata.stream.channel.url + '\" target=\"_blank\">';\n status = '<a href=\"' + streamdata.stream.channel.url + '\">' + streamdata.stream.channel.status + '</a>';\n }\n // Build the page from the pulled data\n var html = '<div class=\"row text-center\" id=\"datarow\">' +\n url + '<div class=\"col-xs-2 col-sm-1\"><img src=\"' +\n logo + '\"></div><div class=\"col-xs-10 col-sm-3\">' +\n name + '</div><div class=\"col-xs-10 col-sm-8\"\">' +\n status + '</div></div>';\n document.getElementById(\"rows\").innerHTML += html;\n });\n });\n });\n}", "function serverChannels(type) {\n if(!type || type.toLowerCase() === \"name\" || type.toLowerCase() === \"names\") {\n var channels = new Array();\n for (var x = 0; x < ServerChannels.length; x++) {\n channels.push(ServerChannels[x].Name);\n }\n return channels;\n } else if (type.toLowerCase() === \"id\" || type.toLowerCase() === \"ids\") {\n var channels = new Array();\n for (var x = 0; x < ServerChannels.length; x++) {\n channels.push(ServerChannels[x].ID);\n }\n return channels;\n } else {\n return send(\"Sorry! You can only have `Name` or `ID` for the type to collect!\");\n }\n}", "function cobaCollect() {\n var now = new Date();\n var anHourAgo = new Date(now.getTime() - (1 * 1000 * 60 * 60));\n var from = anHourAgo.getFullYear() + '-' + (anHourAgo.getMonth() + 1) + '-' + anHourAgo.getDate();\n from += ' ' + anHourAgo.getHours() + ':' + anHourAgo.getMinutes() + ':' + anHourAgo.getSeconds();\n var to = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate();\n to += ' ' + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();\n console.log('1 hour ago :', from, to);\n collectDataByDate(from, to);\n}", "function display_channels(){\n //clear the local storage current channel\n localStorage.setItem('channel', null);\n localStorage.setItem('id', null);\n //clear the current channel's list of users\n document.querySelector('.users').innerHTML = '';\n //get channels from the server\n const request = new XMLHttpRequest();\n request.open('GET', '/channels');\n request.onload = ()=>{\n const data = JSON.parse(request.responseText);\n if (data.length === 0) {\n var empty = false;\n channels(empty);\n } else {\n channels(data);\n }\n };\n data = new FormData;\n request.send(data)\n }", "function getAllData(msgs,temp) {\n var sync = true;\n var arr = [];\n var temppulldata;\n var xx;\n for (var i = 0; i<msgs.length; i++) {\n console.log(JSON.stringify(msgs[i]));\n temppulldata = JSON.parse(fs.readFileSync('./mock/'+msgs[i].id+'.json'));\n var service = nock(\"https://www.googleapis.com/gmail/v1/users\")\n .get('/' + temp.gmailid + '/messages/' + msgs[i].id)\n .reply(200, temppulldata);\n xx = getData(temp.user, temp.gmailid, temp.gmailtoken, msgs[i].id);\n arr.push(xx);\n if(i==msgs.length -1)\n sync = false;\n }\n while(sync) {require('deasync').sleep(100);}\n nock.cleanAll()\n return arr;\n}", "function getGroupChannels(callback) {\n var channelListQuery = sb.GroupChannel.createMyGroupChannelListQuery();\n channelListQuery.includeEmpty = true;\n channelListQuery.order = 'latest_last_message';\n channelListQuery.limit = 100;\n\n // THIS WILL FILTER GROUP CHANNELS BY CUSTOM TYPE\n channelListQuery.customTypesFilter = ['VISIBLE'];\n\n if (channelListQuery.hasNext) {\n channelListQuery.next((groupChannels, error) => {\n console.dir(groupChannels);\n if (error) {\n return;\n } else {\n clearLeftColumen();\n for (const item of groupChannels) {\n drawGroupChannel(item);\n }\n callback();\n }\n });\n }\n}", "function startChannelStats() {\n stats = setInterval(() => {\n ApiHandle.getStats().then(data => {\n if (data == null) { // They are not live or the channel doesn't exist.\n console.log(\"The user is not live or there was an error getting stats.\")\n } else { // Sets the info from the request next to the icons on the chat page.\n if (data.channel.stream.countViewers !== undefined && data.channel.stream.countViewers !== null) {\n document.getElementById(\"fasUsers\").innerHTML = `<span><i class=\"fas fa-users\"></i></span> ${data.channel.stream.countViewers}`\n }\n if (data.followers.length !== undefined && data.followers.length !== null) {\n document.getElementById(\"fasHeart\").innerHTML = `<span><i class=\"fas fa-heart\"></i></span> ${data.followers.length}`\n }\n if (data.channel.stream.newSubscribers !== undefined && data.channel.stream.newSubscribers !== null) {\n document.getElementById(\"fasStar\").innerHTML = `<span><i class=\"fas fa-star\"></i></span> ${data.channel.stream.newSubscribers}`\n }\n }\n })\n }, 900000);\n}", "async function nowusers()\n{\n var users = await Viewers.SelectUser()\n return users\n}", "function genReport(data){\n var byweek = {};\n function groupweek(value, index, array){\n if(value.Owner === window.myName){\n var d = new Date(value['Datetime']);\n d = Math.floor(d.getTime()/weekfactor);\n byweek[d] = byweek[d] || [];\n byweek[d].push(value);\n }\n\n }\n data.map(groupweek);\n return byweek;\n}", "function UsedTimeslots() {\n let result = [];\n\n for (let i = 0; i < $activityCheckboxes.length; i++ ) {\n let $checkbox = $($activityCheckboxes[i]);\n let checkboxIsChecked = $checkbox.prop(\"checked\");\n let timeslot = $checkbox.data(\"timeslot\");\n \n if ( checkboxIsChecked ) {\n result.push(timeslot);\n }\n }\n\n return result;\n }", "async getChannels() {\n const response = await fetch(`https://slack.com/api/conversations.list?token=${SLACK_TOKEN}`,\n );\n const responseJson = await response.json();\n this.setState({ channels: responseJson.channels });\n }", "get allChatters() {\n return shared_utils_1.flatten(Object.values(this._data.chatters));\n }", "function getMails(auth) {\n const gmail = google.gmail({version: 'v1', auth});\n var list = gmail.users.messages.list({\n includeSpamTrash: false,\n maxResults: max,\n q: \"\",\n userId: \"me\"\n }, function (err, res) {\n if (err) return console.log('The API returned an error: ' + err);\n const mails = res.data.messages;\n if (mails.length) \n {\n //console.log(mails);\n mails.forEach((mail) => {\n gmail.users.messages.get({\n id: mail.threadId,\n userId: \"me\"\n }, function (err, results) {\n if (err != null) return true; //console.log(err);\n\n //console.log(mail.threadId);\n results.data.threadId = mail.threadId;\n arrmails.push(results.data);\n });\n });\n } \n else \n {\n console.log('No mails found.');\n }\n });\n setTimeout(printResult,4000);\n}", "function getTimes() {\n\t\tvar ttimes = $(\"#ranging-time-wrap\").intervalWialon('get');\n\n\t\t// remove <br>\n\t\tvar tf = en_format_time.replace('<br>', ' ');\n\n\t\t// use timeZone:\n\t\tvar deltaTime = wialon.util.DateTime.getTimezoneOffset() + (new Date()).getTimezoneOffset() * 60;\n\t\tvar tfrom = ttimes[0] - deltaTime - wialon.util.DateTime.getDSTOffset(ttimes[0]);\n\t\tvar tto = ttimes[1] - deltaTime - wialon.util.DateTime.getDSTOffset(ttimes[1]);\n\t\tvar tnow = wialon.core.Session.getInstance().getServerTime() - deltaTime;\n\n\t\tvar df = $('#ranging-time-wrap').intervalWialon('__getData');\n\t\tdf = df.dateFormat || 'dd MMM yyyy';\n\n\t\tif (tto - tfrom < 86.4e3) {\n\t\t\ttto = tfrom;\n\t\t}\n\n\t\treturn [getTimeStr(tfrom, df), getTimeStr(tto, df), tnow, df];\n\t}", "getValues(deviceId, sensorId, channelId, dateFrom, dateTo) {\n return this.getDeviceByName(deviceId).then(deviceObj => {\n var device;\n try {\n device = deviceObj[0].objid;\n } catch (e) {\n return [];\n } \n return this.getSensorByName(sensorId, device).then(sensorObj => {\n var sensor = sensorObj[0].objid;\n var hours = ((dateTo-dateFrom) / 3600);\n var avg = 0;\n if (hours > 12 && hours < 36) {\n avg = \"300\";\n } else if (hours > 36 && hours < 745) {\n avg = \"3600\";\n } else if (hours > 745) {\n avg = \"86400\";\n }\n \n var method = \"historicdata.xml\";\n var params = \"id=\" + sensor + \"&sdate=\" + this.getPRTGDate(dateFrom) + \"&edate=\" + this.getPRTGDate(dateTo) + \"&avg=\" + avg + \"&pctshow=false&pctmode=false\";\n \n if (channelId == '!') {\n params = \"&id=\" + sensor;\n return this.performPRTGAPIRequest('getsensordetails.json', params).then(results => {\n var message = results.lastmessage;\n var timestamp = results.lastcheck.replace(/(\\s\\[[\\d\\smsago\\]]+)/g,'');\n var dt = Math.round((timestamp - 25569) * 86400,0) * 1000;\n return [message, dt];\n });\n } else {\n return this.performPRTGAPIRequest(method, params).then(results => {\n var result = [];\n if (!results.histdata) {\n return results;\n }\n var rCnt = results.histdata.item.length;\n \n for (var i=0;i<rCnt;i++)\n {\n var v;\n var dt = Math.round((results.histdata.item[i].datetime_raw - 25569) * 86400,0) * 1000;\n if (results.histdata.item[i].value_raw && (results.histdata.item[i].value_raw.length > 0))\n {\n //FIXME: better way of dealing with multiple channels of same name\n //IE you select \"Traffic In\" but PRTG provides Volume AND Speed channels.\n for (var j = 0; j < results.histdata.item[i].value_raw.length; j++) {\n //workaround for SNMP Bandwidth Issue #3. Check for presence of (speed) suffix, and use that.\n if (results.histdata.item[i].value_raw[j].channel.match(channelId + ' [(]speed[)]') || results.histdata.item[i].value_raw[j].channel == channelId) {\n v = Number(results.histdata.item[i].value_raw[j].text);\n }\n }\n } else if (results.histdata.item[i].value_raw) {\n v = Number(results.histdata.item[i].value_raw.text);\n }\n result.push([v, dt]);\n }\n return result;\n });\n }\n });\n });\n }", "function getChannel(results, callback) {\n async.concatSeries(results.get_profile, getEachChannel, callback);\n }", "async getChannels(){\n try {\n const response = await fetch(`/api/channels/${this.props.uid}`)\n const body = await response.json()\n if (response.status !== 200) throw Error(body.message)\n return body\n } catch(e) {\n console.log(e)\n }\n }", "function getTimeEntries() {\n\t\t\t\ttime.getTime().then(function(results) {\n\t\t\t\t\tvm.timeentries = results;\n\t\t\t\t\tconsole.log(vm.timeentries);\n\t\t\t\t}, function(error) {\n\t\t\t\t\tconsole.log(error);\n\t\t\t\t});\n\t\t\t}", "getMessages(from, to, sensorId) {\n var method = \"table.json\";\n var params = \"&content=messages&columns=objid,datetime,parent,type,name,status,message&id=\" + sensorId;\n return this.performPRTGAPIRequest(method, params).then(function(messages) {\n var events = [];\n var time = 0;\n _.each(messages, function(message) {\n time = Math.round((message.datetime_raw - 25569) * 86400,0);\n if (time > from && time < to) {\n events.push({\n time: time * 1000,\n title: message.status,\n text: '<p>' + message.parent + '(' + message.type + ') Message:<br>'+ message.message +'</p>'\n });\n }\n });\n return events;\n });\n }", "function requestChatHistory () {\n showChatHistoryOverlay();\n pubnub.history(\n {\n channel: CHANNEL_NAME_TALK,\n count: 20, // how many items to fetch.\n },\n function (status, response) {\n if (status.error === false) {\n updateChatHistory(response.messages);\n } else {\n console.log(\"Error recieving \" + CHANNEL_NAME_TALK + \" channel history:\");\n console.log(status);\n }\n }\n );\n\n}", "static async listSleepData() {\n\t\tconst results = await db.query(\n\t\t\t`\n\t\t\t\tSELECT s.id,\n\t\t\t\t\t\ts.user_id,\n\t\t\t\t\t\ts.bed_time,\n\t\t\t\t\t\ts.wake_up_time\n\t\t\t\tFROM single_sleep_tracker as s\n\t\t\t\tORDER BY s.id DESC\n\t\t\t`\n\t\t);\n\n\t\treturn results.rows;\n\t}", "function execute() {\r\n\t\t\t return gapi.client.youtube.channels.list({})\r\n\t\t\t .then(function(response) {\r\n\t\t\t // Handle the results here (response.result has the parsed body).\r\n\t\t\t console.log(\"Response\", response);\r\n\t\t\t },\r\n\t\t\t function(err) { console.error(\"Execute error\", err); });\r\n\t\t\t }", "function getHistorical(){\n pubsub.publish('callInfo','notesInHistory') \n }", "function generate_channel_list(channels, nopresence) {\n var list = [];\n each( channels, function( channel, status ) {\n if (nopresence) {\n if(channel.search('-pnpres') < 0) {\n if (status.subscribed) list.push(channel);\n }\n } else {\n if (status.subscribed) list.push(channel);\n }\n });\n return list.sort();\n}", "async function getAllCategories(){\n\n var categories = [];\n\n await meetupObject.Events.find({}, {topic: 1}, (err, data) => {\n //console.log('events data :' + data);\n data.forEach(x => {\n categories.push(x.topic);\n //console.log('categories individual is:' + categories);\n });\n return categories;\n \n });\n return Array.from(new Set(categories));\n}", "function getReports() {\n const endpoint = BASE_URL + \"/report/readAll\";\n return fetch(endpoint).then((res) => res.json());\n}", "function generate_channel_list(channels, nopresence) {\n\t var list = [];\n\t utils.each(channels, function (channel, status) {\n\t if (nopresence) {\n\t if (channel.search('-pnpres') < 0) {\n\t if (status.subscribed) list.push(channel);\n\t }\n\t } else {\n\t if (status.subscribed) list.push(channel);\n\t }\n\t });\n\t return list.sort();\n\t}", "function getAllSubscriptions() {\n var subscriptions = []\n for (var client in getConnectedClients()) {\n subscriptions.push(getSubscriptions(client))\n }\n return subscriptions\n}", "async getPlayers(channel) {\r\n\t\tconst rows = await sql.all(`SELECT ID, Name FROM Players WHERE Channel = $channel ORDER BY UPPER(Name)`, {$channel: channel});\r\n\t\tlet players = [];\r\n\t\tfor(const row of rows) {\r\n\t\t\tconst player = await this.getPlayerById(row.ID);\r\n\t\t\tplayers.push(player);\r\n\t\t}\r\n\t\treturn players;\r\n\t}", "async function getUsers () {\n const {\n C8Y_BOOTSTRAP_TENANT: tenant,\n C8Y_BOOTSTRAP_USER: user,\n C8Y_BOOTSTRAP_PASSWORD: password\n } = process.env;\n\n const client = new FetchClient(new BasicAuth({ tenant, user, password }), baseUrl);\n const res = await client.fetch(\"/application/currentApplication/subscriptions\");\n\n return res.json();\n }", "ListAll() {\r\n return this.db.query(\"SELECT C.* FROM \" + this.db.DatabaseName + \"._WSMK_Calendario AS C \" +\r\n \" LEFT JOIN \" + this.db.DatabaseName + \"._User as U on U.id = C.createdBy WHERE C.active=1;\");\r\n }", "async getDI() {\n let response = await this.get('/api/slot/0/io/di');\n let channels = [];\n response.io.di.forEach(i => { channels[i.diIndex] = i.diStatus; });\n return channels;\n }", "getLateSubmitters() {\n return AppBootstrap.userStandupRepo\n .getUsersWhoSubmitedByDate(today)\n .then(res => {\n let earlySubmitters = []\n if (res.length > 0) {\n res.forEach((user) => {\n earlySubmitters.push(user.username)\n })\n }\n return Promise.resolve(earlySubmitters);\n })\n .then(submitters => {\n return this.getChannelMembers()\n .then(res => {\n let allChannelUsers = res.members;\n allChannelUsers = allChannelUsers.filter(\n item => !submitters.includes(item)\n );\n return Promise.resolve(allChannelUsers);\n })\n })\n .catch(error => {\n if (error.code === ErrorCode.PlatformError) {\n console.log(\"error message\", error.message);\n console.log(\"error message\", error.data);\n } else {\n console.error;\n }\n return Promise.reject(error);\n })\n }", "get dates() {\n const { from, to, query, timeRegistrations } = this.store;\n let dates = [];\n if (query) {\n dates = [...new Set(timeRegistrations.map(r => r.date))].sort((a, b) => a < b);\n } else {\n let days = differenceInDays(to, from) + 1;\n for (let i = 0; i < days; i++) {\n let date = new Date(from);\n date.setDate(date.getDate() + i);\n dates.push(date);\n }\n }\n return dates;\n }", "function getLastThingSpeakData3(){\n console.log(\"aaaaaaaaaaaaaaaaaaa\")\n var channel_id = 196384; //id do canal\n var field_number1 = 1; //numero do field\n var field_number2 = 2; //numero do field\n var field_number3 = 3 //3\n var field_number4 = 4 //4\n var num_results = 500; //numero de resultados requisitados\n\n\n}" ]
[ "0.63503927", "0.6317712", "0.62979084", "0.62357336", "0.6132495", "0.61065966", "0.60647625", "0.6019824", "0.60135365", "0.5945615", "0.58777934", "0.5843234", "0.5824663", "0.57908154", "0.57801193", "0.5777819", "0.5754453", "0.5743466", "0.5729201", "0.57270294", "0.57259184", "0.5712942", "0.56936055", "0.5649815", "0.5648314", "0.56263566", "0.56204873", "0.56114507", "0.56026274", "0.55969787", "0.5574239", "0.5565769", "0.5563678", "0.55236423", "0.550245", "0.549811", "0.54951954", "0.5493272", "0.54895395", "0.5480023", "0.5473204", "0.5468452", "0.54676795", "0.5465501", "0.5459689", "0.5453614", "0.544167", "0.5437795", "0.543709", "0.5432792", "0.542586", "0.54146624", "0.54002494", "0.5380228", "0.53795063", "0.5377785", "0.53736347", "0.5373107", "0.5371119", "0.5367374", "0.53616935", "0.53559774", "0.5351107", "0.5347535", "0.53318465", "0.5324847", "0.5324073", "0.532087", "0.53205496", "0.53075945", "0.5306229", "0.5304515", "0.52973354", "0.52972573", "0.5288225", "0.52864903", "0.5285811", "0.52734613", "0.5273286", "0.52732605", "0.52610093", "0.52577317", "0.5257077", "0.5251751", "0.5250107", "0.5246296", "0.52447534", "0.5243604", "0.5238931", "0.52287114", "0.52277416", "0.52258945", "0.5225019", "0.5218233", "0.5216732", "0.5197116", "0.5196613", "0.51953006", "0.51930976", "0.519048", "0.51894057" ]
0.0
-1
gets the time a user has asked to report for a given channel
function getAskingTime(user, channel, cb) { controller.storage.teams.get('askingtimes', function(err, askingTimes) { if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) { cb(null,null); } else { cb(null, askingTimes[channel][user]); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getStandupTime(channel, cb) {\n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n if (!standupTimes || !standupTimes[channel]) {\n cb(null, null);\n } else {\n cb(null, standupTimes[channel]);\n }\n });\n}", "function getBotMsgTime(session){\n\tconsole.log(\"getBotMsgTime() executing\");\n\tvar botTime = new Date(session.userData.lastMessageSent);\n\tconsole.log(\"Bot time unformatted is:\");\n\tconsole.log(botTime);\n\n\tvar botTimeFormatted = dateFormat(botTime, \"yyyy-mm-dd HH:MM:ss\");\n\n\tconsole.log(\"Bot messaged at: \" + botTimeFormatted);\n\treturn botTimeFormatted;\n}", "function pii_next_report_time() {\n var curr_time = new Date();\n\n curr_time.setSeconds(0);\n // Set next send time after 3 days\n curr_time.setMinutes( curr_time.getMinutes() + 4320);\n curr_time.setMinutes(0);\n curr_time.setHours(0);\n curr_time.setMinutes( curr_time.getMinutes() + pii_vault.config.reporting_hour);\n return new Date(curr_time.toString());\n}", "getTimePassed() {\n let createdAt = new Date(parseInt(this.props._id.slice(0,8), 16)*1000);\n let now = new Date();\n let diffMs = (now - createdAt); // milliseconds between now & createdAt\n let diffMins = Math.floor(diffMs / 60000); // minutes\n if(diffMins < 1)\n return \"just now\";\n if(diffMins == 1)\n return \"1 min\";\n let diffHrs = Math.floor(diffMins / 60); // hours\n if(diffHrs < 1)\n return `${diffMins} mins`;\n if(diffHrs == 1)\n return `1 hr`;\n let diffDays = Math.floor(diffHrs / 24); // days\n if(diffDays < 1)\n return `${diffHrs} hrs`;\n if(diffDays == 1)\n return `1 day`;\n let diffWeeks = Math.floor(diffDays / 7);\n if(diffWeeks < 1)\n return `${diffDays} days`;\n if(diffWeeks == 1)\n return `1 week`;\n return `${diffWeeks} weeks`;\n }", "function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}", "_clock(subscription) {\n return new Promise((resolve, reject) => {\n let watcherInfo = this._getWatcherInfo(subscription);\n\n this._client.command(['clock', watcherInfo.root], (error, resp) => {\n if (error) {\n reject(error);\n } else {\n watcherInfo.since = resp.clock;\n resolve(resp);\n }\n });\n });\n }", "async function watchCheck(botChannel, bot) {\n console.log(`\\nwatchCheck at: ${new Date(Date.now())}\\nlast Check at: ${new Date(bot.lastWatch)}\\n`);\n\n const subscribers = await getSubs();\n const wfState = await commons.getWfStatInfo(config.WFStatApiURL);\n\n subscribers.forEach((sub) => {\n console.log(`User: ${sub.userID}`);\n\n sub.subData.forEach((entry) => {\n const notifyStr = checkNotificationsForEntry(entry, wfState, bot);\n\n console.log(`return string:${notifyStr}`);\n\n if (notifyStr) {\n bot.users.fetch(sub.userID).then((user) => {\n try {\n user.send(`Notification for you operator:\\n${notifyStr}`);\n } catch (error) {\n botChannel.send(`Failed to send a DM to ${user}. Have you enabled DMs?`);\n }\n });\n }\n });\n });\n\n return Date.parse(wfState.timestamp);\n}", "static get lastReport() {}", "function respondWithTime(){\n sendMessage(buildBotMessage(new Date().toUTCString()));\n}", "function reportTime(){\n const date = new Date();\n const {time, mode} = getTime();\n const reportTime = `${time} ${mode} ${date.getDate()}/${date.getMonth()+1}/${date.getFullYear()}`;\n return reportTime ;\n}", "function getChannel(channel){\n gapi.client.youtube.channels.list({\n part: 'snippet,contentDetails,statistics',\n forUsername: channel\n\n })\n .then(respone => {\n console.log(response);\n const channel = response.result.items[0];\n\n const output = `\n <ul class=\"collection\">\n <li class=\"collection-item\">Title : ${channel.snippet.title}</li>\n <li class=\"collection-item\">ID: ${channel.id}</li>\n <li class=\"collection-item\">Subscribers: ${channel.statistics.subscriberCount}</li>\n <li class=\"collection-item\">Views: ${ numberWithCommas(channel.statistics.viewCount)}</li>\n <li class=\"collection-item\">Videos: ${numberWithCommas(channel.statistics.videoCount)}</li>\n </ul>\n <p>${channel.snippet.description}</p>\n <hr>\n <a class=\"btn grey darken-2\" target=\"_blank\" href=\"https://youtube.com/${channel.snippet.customURL}\">Visit Channel</a>\n\n `;\n\n showChannelData(output);\n\n const playlistID = channel.contentDetails.relatedPlaylists.uploads;\n requestVideoPlaylist(playlistID);\n })\n .catch(err => alert('No Channel By That Name'));\n}", "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 }", "function getChannel(channel) {\n gapi.client.youtube.channels\n .list({\n part: 'snippet,contentDetails,statistics',\n id: channel\n })\n .then(response => {\n console.log(response);\n const channel = response.result.items[0];\n\n const playlistId = channel.contentDetails.relatedPlaylists.uploads;\n requestVideoPlaylist(playlistId);\n })\n .catch(err => alert('No Channel By That Name'));\n}", "function getUserMsgTime(session){\n\tconsole.log(\"getUserMsgTime() executing\");\n\tvar userTime = new Date(session.userData.lastMessageReceived);\n\tconsole.log(\"User unformatted is:\");\n\tconsole.log(userTime);\n\n\tvar userTimeFormatted = dateFormat(userTime, \"yyyy-mm-dd HH:MM:ss\");\n\tconsole.log(\"User time formatted:\" + userTimeFormatted);\n\n\treturn userTimeFormatted;\n}", "get(channelId) {\n\t\tif(CHANNEL_CACHE[channelId] != null) {\n\t\t\t//channel in cache\n\t\t\treturn Promise.resolve(CHANNEL_CACHE[channelId]);\n\t\t} else if(GET_CHANNEL_CALL_IN_PROGRESS[channelId]) {\n\t\t\t//channel call in progress\n\t\t\treturn GET_CHANNEL_CALL_IN_PROGRESS[channelId];\n\t\t} else {\n\t\t\t//Calling API to fetch channel info\n\t\t\tconst options = {\n\t\t\t\turl: 'https://slack.com/api/channels.info',\n\t\t\t\tqs: {\n\t\t\t\t\ttoken: process.env.apiToken,\n\t\t\t\t\tchannel: channelId\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst newPromise = new Promise((resolve, reject) => {\n\t\t\t\tthis._callRest(options).then((response) => {\n\t\t\t\t\tconst output = JSON.parse(response);\n\t\t\t\t\tif(this.logger.isSillyEnabled()) {\n\t\t\t\t\t\tthis.logger.silly('Output of channels.info api:-' + JSON.stringify(output));\n\t\t\t\t\t}\n\t\t\t\t\tif(output.ok) {\n\t\t\t\t\t\tCHANNEL_CACHE[channelId] = output.channel;\n\t\t\t\t\t\tresolve(CHANNEL_CACHE[channelId]);\n\n\t\t\t\t\t\t//remove promise from cache as now channel object is cached\n\t\t\t\t\t\tdelete GET_CHANNEL_CALL_IN_PROGRESS[channelId];\n\t\t\t\t\t} else {\n\t\t\t\t\t\treject(output.error);\n\t\t\t\t\t}\n\t\t\t\t}).catch((error) => {\n\t\t\t\t\treject(error);\n\t\t\t\t});\n\t\t\t});\n\t\t\t//put promise in cache so there wont be a duplicate call to API when first call is in progress\n\t\t\tGET_CHANNEL_CALL_IN_PROGRESS[channelId] = newPromise;\n\t\t\treturn newPromise;\n\t\t}\n\t}", "function getLastThingSpeakData3(){\n console.log(\"aaaaaaaaaaaaaaaaaaa\")\n var channel_id = 196384; //id do canal\n var field_number1 = 1; //numero do field\n var field_number2 = 2; //numero do field\n var field_number3 = 3 //3\n var field_number4 = 4 //4\n var num_results = 500; //numero de resultados requisitados\n\n\n}", "function currTime(){\n let timeout = new Date();\n return timeout.toString();\n}", "function getEventMeta (channel) {\n\t\treturn {\n\t\t\tviewers: getNumberOfViewers(channel)\n\t\t};\n\t}", "function cancelAskingTime(user, channel) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {\n return;\n } else {\n delete askingTimes[channel][user];\n controller.storage.teams.save(askingTimes); \n }\n }); \n}", "function get_channelInfo(APIKey , channel_id , callBackFunction ){\n $.getJSON( \"https://www.googleapis.com/youtube/v3/channels?part=statistics,snippet&id=\" + channel_id + \"&key=\" + APIKey , function(data) {\n /*On success callback*/\n var channel = new ChannelObj( data.items[0].snippet.title , data.items[0].snippet.description , data.items[0].snippet.thumbnails.default.url , new Date(data.items[0].snippet.publishedAt) );\n channel.id = channel_id;\n channel.stats.push( { key: \"views\", value: Number(data.items[0].statistics.viewCount) });\n channel.stats.push( { key: \"subscribers\", value: Number(data.items[0].statistics.subscriberCount) });\n channel.stats.push( { key: \"videoCount\", value: Number(data.items[0].statistics.videoCount) });\n callBackFunction(channel);\n });\n}", "function getRemainingTime() {\n return new Date().getTime() - startTimeMS;\n}", "function askingTime(msg){\n return msg.text.toLowerCase().match(/time/i);\n}", "function getStats() {\n let timestamp = new Date(Date.now());\n let dateTime = timestamp.toDateString() + \" \" + timestamp.toLocaleTimeString()\n return dateTime;\n}", "function coffeeConsumptionTime() {\n for (var i = 0; i < entries.length; i++) {\n if (entries[i].q1_3 === 0) {\n coffeeTimes.none += 1;\n } else if (entries[i].q1_3 === 1) {\n coffeeTimes.min += 1;\n } else if (entries[i].q1_3 === 2) {\n coffeeTimes.mid += 1;\n } else if (entries[i].q1_3 === 3) {\n coffeeTimes.max += 1;\n }\n }\n }", "function addAskingTime(user, channel, timeToSet) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes) {\n askingTimes = {};\n askingTimes.id = 'askingtimes';\n }\n\n if (!askingTimes[channel]) {\n askingTimes[channel] = {};\n }\n\n askingTimes[channel][user] = timeToSet;\n controller.storage.teams.save(askingTimes);\n });\n}", "function send_client_info_timer() {\n if (fatal_error) {\n return;\n }\n\n /* send timer after channel starts playing */\n if (startup_delay_ms !== null) {\n that.send_client_info('timer');\n }\n\n /* periodically update vbuf and abuf in case 'updateend' is not fired */\n if (av_source) {\n av_source.vbuf_update();\n av_source.abuf_update();\n }\n }", "getCountdownTimeRemaining() {\n var timeleft = CookieManager.get(this.options.popupID + '-timer');\n if (!timeleft) {\n timeleft = this.options.popupDelaySeconds;\n }\n timeleft = Number(timeleft);\n if (timeleft < 0)\n timeleft = 0;\n return timeleft;\n }", "getReport()\r\n\t{\r\n\t\tlet report = '';\r\n\r\n\t\tmembers.forEach( (member, duration) => s += member.username + '\\t\\t' + duration + ' seconds\\n' );\r\n\t\treturn report;\r\n\t}", "get time() {}", "getCurrentChannel() {\n return BdApi.findModuleByProps(\"getChannelId\").getChannelId();\n }", "get time() {\n return (process.hrtime()[0] * 1e9 + process.hrtime()[1]) / 1e6;\n }", "function timer() {\n time = 10;\n broadcastChannel.publish('timeUpdate', {\n 'time': time,\n 'timeout': 0\n });\n clock = setInterval(countdown, 1000);\n function countdown() {\n if (time > 1) {\n broadcastChannel.publish('timeUpdate', {\n 'time': time,\n 'timeout': 0\n });\n time--;\n } else {\n clearInterval(clock);\n broadcastChannel.publish('timeUpdate', {\n 'time': time,\n 'timeout': 1\n });\n publishCorrectAnswer(index)\n };\n };\n}", "function channelInfo(query) {\n return __awaiter(this, void 0, void 0, function* () {\n return api_1.get('channels.info', query, true);\n });\n}", "getTimePeriod() {\n var param = FlowRouter.getParam(\"reportType\");\n\n if(param == \"daily\") {\n return \"Daily Timesheet Report\";\n } else if (param == \"weekly\") {\n return \"Weekly Timesheet Report\";\n } else if (param == \"monthly\") {\n return \"Monthly Timesheet Report\";\n } else if (param == \"date_range\") {\n return \"Timesheet Report\";\n }\n }", "function getRealSelectedTimeString() {\n return models[\"ChesapeakeBay_ADCIRCSWAN\"][\"lastForecast\"].clone().add(currentHourSetting, \"hours\").format(\"YYYY-MM-DD HH:MM:SS\")\n}", "function time_passed(date) {\n\t\t\tvar date_now = new Date();\n\t\t\treturn date_now.getTime() - date.getTime();\n\t\t}", "function getRemaining() {\n\tvar millLeft = timeDone - (new Date).getTime();\n\n\tif (millLeft < 0) {\n\t\tmillLeft = 0;\n\t}\n\n\treturn {\n\t\t\"hours\": Math.floor(millLeft / 1000.0 / 60 / 60),\n\t\t\"minutes\": Math.floor(millLeft / 1000.0 / 60 % 60),\n\t\t\"seconds\": Math.floor(millLeft / 1000.0 % 60),\n\t\t\"milli\": Math.floor(millLeft % 1000.0)\n\t};\n}", "function recipeTime (agent) {\n const dialogflowAgentDoc = db.collection('recipes').doc(recipe);\n\n return dialogflowAgentDoc.get()\n .then(doc => {\n if (!doc.exists) {\n agent.add('No data for recipe found. Please try another recipe.');\n } else {\n agent.add('This recipe takes: ' + doc.data().time);\n agent.add('Would you like to hear the servings, ingredients, or instructions for this recipe?');\n }\n return Promise.resolve('Read complete');\n }).catch(() => {\n agent.add('No data for recipe found. Please try another recipe.');\n });\n }", "function getNoon(){\n\treturn time;\n}", "async function getStep(sender_psid) {\n var d = new Date();\n var step;\n\n //trys to get the last report from the userwith th sender_psid\n try {\n var report = await getReport(sender_psid);\n console.log(\"tiempo pasado \" + (d.getTime() - report[0].date));\n\n //if get report dont get any results means the user has none created so we will have to create one. \n //We indicate this returning -1 \n if (report == []) {\n console.log(\"report is empty\");\n step = -1;\n\n //if tomarcontrol from the report is truereturns a -1\n } else if (report[0].tomarControl) {\n console.log(\"Control tomado\");\n step = -2;\n\n //in case the step is 9 or 10, the location stepwe set when reciving an image, we return the step\n //so the bot asks forthe location automatically\n if (report[0].step == 9 || report[0].step == 10) {\n step = report[0].step;\n }\n\n //if the step is greater than the greatest step posible of the conversation (19), orthe actual time is 15mins\n //greater than the time the report was created, returns a -1, indicating\n //that we will have to create a new one\n } else if ((report[0].step > 19) || (d.getTime() - report[0].date > 900000)) {\n console.log(\"Reports recibió el paso\" + report[0].step);\n console.log();\n\n step = -1;\n\n //in any other case just return the step contained in this field from the report\n } else {\n step = report[0].step;\n console.log(\"steeeeeeeeeeep \" + step);\n }\n\n //returns the stepand the report object\n return [step, report];\n\n //in casetherewere any error getting the report object returns a -1\n } catch (e) {\n return [-1, {}];\n }\n}", "getPolltime() {\n if (this.adapter.config.polltime == 0) return 0;\n let deviceid = this.getDeviceId();\n let polltime = undefined;\n if (deviceid) {\n polltime = datapoints.getPolltime(deviceid);\n if (polltime === undefined) polltime = this.adapter.config.polltime || 0;\n if (this.adapter.config.polltime > polltime) polltime = this.adapter.config.polltime;\n return polltime;\n }\n return this.adapter.config.polltime;\n }", "static getTimerClockFaceText() {\n if (!this.timerState.started) {\n return \"\";\n }\n\n // Calculate current unix ts with server offset correction\n let nowUnix = Date.now() / 1000;\n nowUnix += this.timeOffset;\n\n // Calculate diff (total run time)\n let thenUnix = this.timerState.started_at;\n let totalSecondsActive = Math.round(nowUnix - thenUnix);\n\n // Format nicely\n let totalMinutes = Math.floor(totalSecondsActive / 60);\n let totalHours = Math.floor(totalMinutes / 60);\n\n let displayHours = totalHours;\n let displayMinutes = (totalMinutes - (totalHours * 60));\n let displaySeconds = Math.round(totalSecondsActive - (((totalHours * 60) + displayMinutes) * 60));\n\n displayHours = displayHours.toString();\n displayMinutes = displayMinutes.toString();\n displaySeconds = displaySeconds.toString();\n\n if (displayMinutes.length === 1) { displayMinutes = `0${displayMinutes}`; }\n if (displaySeconds.length === 1) { displaySeconds = `0${displaySeconds}`; }\n\n let strHoursMins = `${displayHours}:${displayMinutes}`;\n let strHoursMinsSecs = `${strHoursMins}:${displaySeconds}`;\n\n return {\n \"short\": strHoursMins,\n \"full\": strHoursMinsSecs\n };\n }", "get remainingTime() {\r\n return Math.ceil((this.maxTime - this.timeTicker) / 60);\r\n }", "function get_Clock() {\n\t\tvar date = new Date();\n\t\tvar hours = date.getHours();\n\t\tvar min = date.getMinutes();\n\t\tvar sec = date.getSeconds();\n\t\tvar amPm = (hours < 12) ? \"am\" : \"pm\";\n\t\t\n\t\thours = (hours < 10) ? \"0\" + hours : hours;\n\t\tmin = (min < 10) ? \"0\" + min : min;\n\t\tsec = (sec < 10) ? \"0\" + sec : sec;\n\n\t\t// return hours + \":\" + min + \":\" + sec + \" \" + amPm;\n\t\treturn hours + \":\" + min + \" \" + amPm\n\t}", "function refreshBadge() {\n curTime--; //first we decrement the time given bc we've waited a sec\n //console.log('leak testing', interval, 'interval ', curTime)\n\n //gotta assess how much time is remaining for our user's period\n if (curTime > 86400) {\n let tempTime = Math.floor(curTime / 86400);\n badgeText = `>${tempTime}d`\n } else if (curTime > 3600) {\n let tempTime = Math.floor(curTime / 3600);\n badgeText = `>${tempTime}h`;\n } else if (curTime > 120) {\n let tempTime = Math.floor(curTime / 60);\n badgeText = `>${tempTime}m`\n } else if (curTime === 2) {\n chrome.action.setBadgeText({ text: '' });\n intervalStorage.clearAll();\n } else if (curTime === 1) {\n chrome.action.setBadgeText({ text: '' });\n intervalStorage.clearAll();\n } else if (curTime <= 0) {\n intervalStorage.clearAll();\n } else {\n badgeText = `${curTime}s`;\n }\n\n //then update the badge with how much time they have left if there's time remaining\n if (curTime > 2) chrome.action.setBadgeText({ text: badgeText });\n //console.log('counting down time, ', curTime);\n }", "function countdown() {\n now = luxon.DateTime.local();\n d = event_date.diff(now, ['weeks', 'days', 'hours', 'minutes']);\n eventHTML = `<strong><span>${d.weeks}</span> ${d.weeks == 1 ? \"week\" : \"weeks\"}, `;\n eventHTML += `<span>${d.days}</span> ${d.days == 1 ? \"day\" : \"days\"}, `;\n eventHTML += `<span>${d.hours}</span> ${d.hours == 1 ? \"hour\" : \"hours\"}, `;\n eventHTML += `<span>${Math.floor(d.minutes)}</span> ${Math.floor(d.minutes) == 1 ? \"minute\" : \"minutes\"}</strong><br>`;\n eventHTML += `at ${record.title}`;\n $(\"#event-countdown-time\").html(eventHTML);\n }", "function changetime(value) {\n var secondTime = parseInt(value);// Second\n var minuteTime = 0;// Minute\n var hourTime = 0;// Hour\n if(secondTime > 60) {\n //If the number of seconds is greater than 60, convert the number of seconds to an integer\n minuteTime = parseInt(secondTime / 60); \n secondTime = parseInt(secondTime % 60);\n \n if(minuteTime > 60) {\n hourTime = parseInt(minuteTime / 60);\n minuteTime = parseInt(minuteTime % 60);\n }\n }\n\n var time = \"\" + parseInt(secondTime);\n\n if(minuteTime > 0) {\n time = \"\" + parseInt(minuteTime) + \":\" + time;\n }\n if(hourTime > 0) {\n time = \"\" + parseInt(hourTime) + \":\" + time;\n }\n return time;\n}", "function chat_timercall()\r\n{\r\n\tvar cct = $(\"chatntf\").getAttribute('data-ccount');\r\n\t\r\n\tif(cct == 0)\r\n\t\tchat_switchicon(1);\r\n\telse\r\n\t\tchat_switchicon(0);\r\n}", "function getTime(){\n \n hr = hour();\n mn = minute();\n sc = second();\n}", "function get_time_since(ms) {\n\tif (ms == undefined || !ms || ms < 2)\n\t\treturn \"never\";\n\tvar diff = new Date().getTime();\n\tdiff -= ms;\n\tdiff /= 1000;\n\tdiff = Math.round(diff);\n\tif (diff < 3) {\n\t\treturn \"just now\";\n\t}\n\telse if (diff < 60) {\n\t\treturn Math.round(diff) + \" seconds ago\";\n\t}\n\telse if (diff < 600) {\n\t\treturn Math.round(diff / 60) + \" minutes ago\";\n\t}\n\telse if (diff < 7200) {\n\t\treturn Math.round(diff / 7200) + \" hours ago\";\n\t}\n\treturn Math.round(diff / 86400) + \" days ago\";\n}", "function getTime() {\r\n var currentTime = new Date();\r\n var hours = currentTime.getHours();\r\n var minutes = currentTime.getMinutes();\r\n if (minutes < 10) {\r\n minutes = \"0\" + minutes;\r\n }\r\n return hours + \":\" + minutes;\r\n}", "function getTimeSinceLastRead() {\n if (lastSync == null) {\n return \"\";\n } else {\n var date = Date.now();\n return timeDifference(date, lastSync);\n }\n}", "function get_time() {\n return Date.now();\n}", "getCurrentTime(){\n //Declaring & initialising variables\n\t\tlet crnt = new Date();\n\t\tlet hr = \"\";\n\t\tlet min = \"\";\n\n\t\t//checking if the hours are sub 10 if so concatenate a 0 before the single digit\n\t\tif (crnt.getHours() < 10){\n\t\t\thr = \"0\" + crnt.getHours();\n\t\t}\n\t\telse{\n\t\t\thr = crnt.getHours();\n\t\t}\n\n\t\t//checking if mins are sub 10 if so concatenate a 0 before the single digit\n\t\tif (crnt.getMinutes() < 10){\n\t\t\tmin = \"0\" + crnt.getMinutes()\n\t\t\treturn hr + \":\" + min\n\t\t}\n\t\telse{\n\t\t\tmin = crnt.getMinutes();\n\t\t\treturn hr + \":\" + min\n\t\t}\n\t}", "function findChannel(server, channelName) {\n\t//find the muddy points channel\n\tlet category = server.channels.cache.find(\n\t\tc => c.name == channelName && c.type == \"text\");\n\t\t\n\tconsole.log(\"Channel found in cache: \"+channelName);\n\t\n\treturn category;\n}", "async function getPointsName(channel) {\n\n let name = await db.channel_settings.find({ channel: channel });\n return name[0].points_name;\n\n}", "function getReminder(){\r\nvar secondsleft = timeInSecs+1;\r\nalert(secondsleft);\r\n}", "function getCountSince(thread, newestGreenPost) {\n\t\tGM.xmlHttpRequest({\n\t\tmethod:\"get\",\n\t\turl:serverurl+\"watch.php?thread=\"+thread+\"&newestGreenPost=\"+newestGreenPost,\n\t\tonload:response=>{\n\t\t\tif(response.status==200){\n\t\t\t\tonPageLoad(_=>{\n\t\t\t\t\tvar count=response.responseText\n if(count > 0) {\n\t\t\t\t\t\tupdateWatchListItem(thread,count)\n }\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\tonerror:response=>{\n return 0;\n\t\t}\n\t})\n}", "function determineMessageUnderClock(name) {\n let message = \"\";\n let hours = getCurrentTime(false)[0];\n\n if (hours > 24) {\n message = \"Have a good day\";\n } else if (hours >= 18) {\n message = \"Good evening\";\n } else if (hours < 6) {\n message = \"Have a good night\";\n } else if (hours >= 12) {\n message = \"Good afternoon\";\n } else if (hours >= 6) {\n message = \"Good morning\";\n }\n\n message += \", \" + name + \".\";\n\n return message;\n}", "timeTillNextPossibleActivation() {\n return to(Date.now(), this.lastfire + this.cooldown);\n }", "function getRemainingTime(time, type) {\n var now = moment(new Date());\n var end = moment(new Date(time));\n var diff = moment.duration(end.diff(now));\n var remainingTime = Math.ceil(diff.asMinutes());\n \n return {\n message: `You have reached the max number of attempts for sending your verification code. Please try again in ${remainingTime} minutes.`,\n type: `failed-${type}-attempt`,\n };\n}", "function GetCount(ddate,iid)\n{\n\tdateNow = new Date();\t//grab current date\n\tamount = ddate.getTime() - dateNow.getTime();\t//calc milliseconds between dates\n\tdelete dateNow;\n\n\t// if time is already past\n\tif(amount < 0)\n\t{\n//\t\tdocument.getElementById(\"countbox0\").innerHTML=\"The future is now the past.\";\n//\t\tdocument.getElementById(iid).innerHTML=\"<i>Back to the Future</i> Day\";\n\t}\n\t// else date is still good\n\telse\n\t{\n\t\tyears=0;days=0;hours=0;mins=0;out=\"\";\n\n\t\tamount = Math.floor(amount/1000);//kill the \"milliseconds\" so just secs\n\n\t\tyears=Math.floor(amount/31536000);//years (no leapyear support)\n\t\tamount=amount%31536000;\n\n\t\tdays=Math.floor(amount/86400);//days\n\t\tamount=amount%86400;\n\n\t\thours=Math.floor(amount/3600);//hours\n\t\tamount=amount%3600;\n\n\t\tmins=Math.floor(amount/60);//minutes\n\t\tamount=amount%60;\n\n\t\tout += years +\" \"+((years==1)?\"year\":\"years\")+\", \";\n\t\tout += days +\" \"+((days==1)?\"day\":\"days\")+\", \";\n\t\tout += hours +\" \"+((hours==1)?\"hour\":\"hours\")+\", \";\n\t\tout += mins +\" \"+((mins==1)?\"minute\":\"minutes\")+\", \";\n\t\tout = out.substr(0,out.length-2);\n\t\tdocument.getElementById(iid).innerHTML=out + \" away.\";\n\n\t\tsetTimeout(function(){GetCount(ddate,iid)}, 1000);\n\t}\n}", "get lastDataSubmissionRequestedDate() {\n return CommonUtils.getDatePref(this._healthReportPrefs,\n \"lastDataSubmissionRequestedTime\", 0,\n this._log, OLDEST_ALLOWED_YEAR);\n }", "function getClockTime(){\n var now = new Date();\n var hour = now.getHours();\n var minute = now.getMinutes();\n var second = now.getSeconds();\n var ap = \"AM\";\n if (hour > 11) { ap = \"PM\"; }\n if (hour > 12) { hour = hour - 12; }\n if (hour == 0) { hour = 12; }\n if (hour < 10) { hour = \"0\" + hour; }\n if (minute < 10) { minute = \"0\" + minute; }\n if (second < 10) { second = \"0\" + second; }\n var timeString = hour + ':' + minute + ':' + second + \" \" + ap;\n return timeString;\n}", "function getTimeNow () {\n\tvar x = new Date();\n\tvar h = x.getHours();\n\tvar m = x.getMinutes()/60;\n\tselectedTime = h + m;\n\treturn (h + m);\n}", "function getHoursTime(timer) {\r\n var seconds = timeLeftGM(timer);\r\n if (seconds == 0)\r\n return 0;\r\n if (isNaN(seconds))\r\n return undefined;\r\n var num = parseInt(seconds);\r\n var strTime = '';\r\n if (num) {\r\n num /= 60;\r\n if (num >= 60) {\r\n num /= 60;\r\n strTime = parseInt(num) + 'h ';\r\n num -= parseInt(num); num *= 60;\r\n }\r\n strTime += parseInt(num) + 'm ';\r\n num -= parseInt(num); num *= 60;\r\n strTime += parseInt(num) + 's';\r\n }\r\n return strTime;\r\n}", "function get_time() {\n return new Date().getTime();\n}", "function get_time() {\n return new Date().getTime();\n}", "function GetCurrentTime() {\n var sentTime = new Date();\n var dateTime = sentTime.toLocaleString();\n return dateTime;\n}", "function tellTime() {\n var now = new Date(); \n document.write(\"Current time: \"+ now);\n }", "function getInitialTime() {\n changeTime();\n}", "function updateClock() {\n\n fetchedOriginalDate = new Date(); // Extract date.\n\n timeAsString = fetchedOriginalDate.toLocaleTimeString( // Set time to 24h.\n 'it-IT', {hour12: false});\n\n currentTime = timeAsString; // Move in time into variable currentTime.\n setTimeout (updateClock, 1000);\n\n\n/**\n * Verify time printout to console.\n * console.clear();\n * console.log(currentTime);\n */\n\n\n var x = document.getElementById(\"clock-box\"); // Sends current time to HTML page.\n x.innerHTML = currentTime;\n\n checkIfStartAlarm(); // Starts alarm if alarm time has passed currentTime.\n}", "get collectedDateTime() {\n\t\treturn this.__collectedDateTime;\n\t}", "function getExperimentTime(){\n var curTime = new Date();\n return ((curTime.getTime() - experimentData.startTime.getTime())/1000);\n}", "function startChannelStats() {\n stats = setInterval(() => {\n ApiHandle.getStats().then(data => {\n if (data == null) { // They are not live or the channel doesn't exist.\n console.log(\"The user is not live or there was an error getting stats.\")\n } else { // Sets the info from the request next to the icons on the chat page.\n if (data.channel.stream.countViewers !== undefined && data.channel.stream.countViewers !== null) {\n document.getElementById(\"fasUsers\").innerHTML = `<span><i class=\"fas fa-users\"></i></span> ${data.channel.stream.countViewers}`\n }\n if (data.followers.length !== undefined && data.followers.length !== null) {\n document.getElementById(\"fasHeart\").innerHTML = `<span><i class=\"fas fa-heart\"></i></span> ${data.followers.length}`\n }\n if (data.channel.stream.newSubscribers !== undefined && data.channel.stream.newSubscribers !== null) {\n document.getElementById(\"fasStar\").innerHTML = `<span><i class=\"fas fa-star\"></i></span> ${data.channel.stream.newSubscribers}`\n }\n }\n })\n }, 900000);\n}", "getReadableTime() {\n // Debugging line.\n Helper.printDebugLine(this.getReadableTime, __filename, __line);\n\n // Stop the time please. How long was the crawling process?\n let ms = new Date() - this.startTime,\n time = Parser.parseTime(ms),\n timeString = `${time.d} days, ${time.h}:${time.m}:${time.s}`;\n\n this.output.write(timeString, true, 'success');\n this.output.writeLine(`Stopped at: ${new Date()}`, true, 'success');\n }", "function update_stats() {\n\n\n // retrieve stats from YT API\n var url = \"https://www.googleapis.com/youtube/v3/channels?part=statistics&id=\" + channel_id + \"&key=\" + API_key;\n $.getJSON(url, function (x) {\n if (x.pageInfo.totalResults > 0) {\n // Channel found!\n update_all_stats(\n x.items[0].statistics.subscriberCount,\n x.items[0].statistics.videoCount,\n x.items[0].statistics.commentCount,\n x.items[0].statistics.viewCount,\n x.items[0].statistics.hiddenSubscriberCount\n );\n\n } else {\n // Something odd...not supposed to reach this point but start a new search for the channel\n search_for_channel(channel_id);\n }\n });\n\n}", "function counter() {\n\ttimerNow = Math.floor(Date.now() / 1000);\n\tcurrentTimer = timerNow - timerThen;\n\treturn currentTimer;\n}", "function update_last_read(channel_id) {\n const data = {'channel_id' : String(channel_id)};\n const searchParams = new URLSearchParams(data);\n // update and hide unread badge if it exists\n $.ajax(Flask.url_for('message.update_last_read') + '?' + searchParams).done(\n function() {\n var badge = document.getElementById('badge-' + String(channel_id));\n badge.style.display = 'none';\n }\n );\n}", "function getDateTime() {\n /**\n * @ngdoc method\n * @methodOf Qplus Firebase Listener\n *@name getDateTime\n *@description Gets the current time and date from the system. This function can be used as a part of all of the dataHandler functions to timestamp user's timestamp sub-field in firebase ,\n *keeping a record of the time of the most recent request of any type. This will help make sure that the most recent request has gone through.\n * If the timestamp doesn't update it means the request has failed and needs to be re-submitted. ( Not used in the code yet).\n *@returns {string} - Current date-time as a string.\n **/\n var date = new Date();\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n var sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec;\n var year = date.getFullYear();\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n return year + \":\" + month + \":\" + day + \":\" + hour + \":\" + min + \":\" + sec;\n}", "function timedCount() {\r\n // context.fillText(c,60,30);\r\n if(c>0 && patient_saved<10 && health>0){\r\n\tc = c - 1;\r\n\t t = setTimeout(function(){ timedCount() }, 1000);\r\n\t }\r\n\telse{\r\n\t\tstopCount();\r\n // t = setTimeout(function(){ timedCount() }, 1000);\r\n\t\t\r\n\t}\r\n}", "function calculateExpire() {\n var expiresIn = Math.round((((messageObject.expiresOn-new Date(Date.now())) % 86400000) % 3600000) / 60000); // minutes\n console.log(expiresIn);\n return expiresIn\n}", "function find_time(time) {\n // Saving Private Input\n var event = moment(time, 'H,m,s').unix(), // In Unix so you can do some operations\n // Getting the current time in unix time\n current = moment().unix(),\n // Computer is calculating the difference of the two\n diffTime = moment.duration((event - current) * 1000, 'milliseconds')\n // Are you kidding me, I'm still gonna send it\n return(diffTime)\n }", "timeRemaining(reqTimeStamp) {\n let endTime= reqTimeStamp + this.validationWindow;\n let now = parseInt(new Date().getTime()/1000);\n return (endTime - now)\n }", "function timePassed (dateString) {\n let now = Date.now()\n let time = Date.now() - dateString;\n if (time < 60000 ) {\n return `Moments ago`;\n } else if (time >= 60000 && time < 3600000) {\n return `${Math.floor(time / 60000)} minutes ago`;\n } else if (time >= 3600000 && time < 86400000) {\n return `${Math.floor(time / 3600000)} hours ago`;\n } else if (time >= 86400000 && time < 31540000000) {\n return `${Math.floor(time / 86400000)} days ago`;\n } else if (time >= 31540000000) {\n return `${Math.floor(time / 31540000000)} years ago`;\n }\n\n}", "function getJiraMetric(queryType, message, type) {\n return new Promise(function (resolve, reject) {\n\n request(_getOptions(queryType), function (error, response, body) {\n if (!error && response.statusCode === 200) {\n\n var parsedJson = JSON.parse(body);\n var count = parsedJson['total'];\n \n if (count === 0) {\n console.log(\"No \" + message + \" in \" + sprint)\n }\n if (type === 'Reviewed') {\n\n if (!parsedJson.issues[0]) {\n console.log(\"No Code Review sub-tasks created in the sprint!\")\n resolve(0);\n } else if (parsedJson.issues[0].fields.parent) {\n for (i = 0; i < count; i++) {\n ids.push(parsedJson.issues[i].fields.parent.key);\n }\n var unique = ids.filter(uniqueArray);\n resolve(unique.length);\n }\n\n } else {\n var story_points = 0\n for (i = 0; i < count; i++) {\n tickets.push(parsedJson.issues[i].key);\n if (parsedJson.issues[i].fields.customfield_10013 != null){\n story_points += parsedJson.issues[i].fields.customfield_10013\n }\n }\n exports.ticketsInSprint = tickets;\n resolve([count,story_points]);\n }\n } else {\n console.log('Some error occurred inside JIRA!');\n }\n\n });\n })\n}", "function getRefresh() {\n var dt = new Date();\n return \"\" + dt.getTime();\n }", "function getTime() {\n let hours = Math.floor(clock.getTime().time / 3600);\n let minutes = Math.floor((clock.getTime().time % 3600) / 60);\n let seconds = Math.floor((clock.getTime().time % 3600) % 60);\n\n if (hours === 0 && minutes === 0) {\n return `${seconds} Seconds`;\n } else if (hours === 0) {\n return `${minutes} ${(minutes === 1) ? \"Minute\" : \"Minutes\"}, ${seconds} ${(seconds === 1 || seconds === 0) ? \"Second\" : \"Seconds\"}`;\n } else {\n return `${hours}:${minutes}:${seconds}`;\n }\n\n}", "function daysSinceLastIncident() {\n // Get the most recently filed discrepancy log\n $.getJSON( \"http://10.0.1.10/log/api/v1.0/discrepancies\", {\n n: 1,\n desc: true\n }, function( data ) {\n // Construct a moment from the discrepancy log's timestamp\n var mom_discrepancy = moment( data.discrepancies[0].timestamp );\n\n // Calculate the number of days elapsed since the log was filed\n var days = moment().diff( mom_discrepancy, \"days\" );\n\n // Update the appropriate element on the page with the new value\n $( \"#dayssince\" ).text( days );\n } );\n}", "function countdown(t) {\r\n display_element.querySelector('#rpm-feedback').innerHTML = '<p>'+t+'</p>';\r\n }", "function getWebcamTimeCreated(time) {\n\tvar now = new Date();\n\tvar seconds = Math.ceil(((now.getTime() / 1000) - time));\n\tvar response = \"\";\n\tif (seconds < 60) {\n\t\tresponse = seconds + \" second(s) ago\";\n\t} else if (seconds >= 60 && seconds < 3600) {\n\t\tresponse = Math.round(seconds / 60) + \" minute(s) ago\";\n\t} else if (seconds >= 3600 && seconds < 86400) {\n\t\tresponse = Math.round(seconds / 3600) + \" hour(s) ago\";\n\t} else {\n\t\tresponse = Math.round(seconds / 86400) + \" day(s) ago\";\n\t}\n\treturn response;\n}", "candleTime( candle, count, add ) {\n count = Math.max( 1, parseInt( count ) || 1 );\n add = parseInt( add ) || 0;\n let numb = parseInt( candle ) || 1;\n let letter = String( candle ).replace( /[^a-zA-Z]+/g, '' );\n let map = { 'm': 60, 'h': 3600, 'd': 86400, 'w': 604800, 'M': 2419200 };\n let seconds = ( Number( map[ letter ] || 0 ) * numb ) * count + add;\n return this.elapsed( seconds );\n }", "function updateChannel() {\n try { \n /* Selecting the discord server */\n const guild = client.guilds.cache.get(config.server_id);\n /* Selecting the channels */\n const memberCountChannel = guild.channels.cache.get(config.member_channel);\n const mpCountChannel = guild.channels.cache.get(config.mp_channel);\n /* Counting the members */\n let totalMembers = guild.members.cache.filter(member => member.roles.cache.has(config.party_member_role)).size;\n let mpMembers = guild.members.cache.filter(member => member.roles.cache.has(config.parliament_member_role)).size;\n /* Giving a heartbeat (still-alive-signal) to logfile (used as debug here) */\n console.log(`[HEARTBEAT] [${dateFormat(new Date(), \"yyyy-mm-dd h:MM:ss\")}] <Total ${totalMembers}> <MP ${mpMembers}>`);\n /* Trying to update channelnames */ \n memberCountChannel.setName('Total Members: ' + totalMembers); \n mpCountChannel.setName('In Parliament: ' + mpMembers);\n } catch (e) {\n console.error(`[ERROR] [${dateFormat(new Date(), \"yyyy-mm-dd h:MM:ss\")}] ${e}`);\n } \n}", "function countDown(){\n if(clock){\n $('.clock').show();\n questionTime--;\n if(questionTime > 0){\n setTimeout(countDown,1000);\n }\n questionTime = questionTime.toString();\n if(questionTime < 10){\n $('.clock').text(\"00:0\"+questionTime);\n $('.clock').css(\"color\", \"rgb(88, 22, 22)\");\n } else {\n $('.clock').text(\"00:\"+questionTime); \n $('.clock').css(\"color\", \"black\");\n }\n } else {\n return;\n }\n }", "async function getNewFrequency() {\n return config.changeFrequency;\n}", "function count() {\n time--;\n displayCurrentTime();\n\n if (time < 1) {\n console.log('Out of time, I guess...');\n prependNewMessage('alert-danger', 'OUT OF TIME!!!!');\n stopTimer();\n setTimeout(nextQuestion, 1.2 * 1000);\n }\n }", "function time() {\n\t\t\treturn (new Date()).getTime();\n\t\t}", "get timeDetails() {\n let now = new Date().getTime();\n return {\n quizTime: this._time,\n start: this._startTime,\n end: this._endTime,\n elapsedTime: ((this._endTime || now) - this._startTime) / 1000, // ms to sec\n remainingTime: secToTimeStr(this._remainingTime),\n timeOver: this[TIME_OVER_SYM]\n }\n }", "function updateclock() {\n var date = new Date();\n var hours = date.getHours() < 10 ? \"0\" + date.getHours() : date.getHours();\n var minutes = date.getMinutes() < 10 ? \"0\" + date.getMinutes() : date.getMinutes();\n var seconds = date.getSeconds() < 10 ? \"0\" + date.getSeconds() : date.getSeconds();\n time = hours + \"\" + minutes + \"\" + seconds;\n return time;\n }", "function customergetChannel(chname)\n\n{\t\t\tif(activechannel)\n\t\t\t{ \n\t\t\tclient.removeListener('channelUpdated', updateChannels);\n\t\t\t generalChannel.removeListener('typingStarted', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingStarted success\")\n\t\t\t\t\t\ttypingMembers.push(member.identity);\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(erro){\n\t\t\t\tconsole.log(\"typingStarted error\",erro)\n\t\t\t\t});\n\t\t\t\tgeneralChannel.removeListener('typingEnded', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingEnded success\")\n\t\t\t\t\t\ttypingMembers.splice(typingMembers.indexOf(member.identity), 1 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(error){\n\t\t\t\t\n\t\t\t\t\t\tconsole.log(\"typingEnded eror\",error)\n\t\t\t\t});\n\t\t\t}\n\n \n \n\t setTimeout(function() {\n\t\n\t\t\t\t$(\"#\"+chname+\" b\").text(\"\");\n\t\t\t\t$(\"#\"+chname+\" b\").removeClass(\"m-widget4__number\");\n\t\t\t\t$(\"#\"+chname+\" input\").val(0);\n\t\t\t\t$(\".m-widget4__item\").removeClass(\"active\");\n\t\t\t\t$(\"#\"+chname).addClass(\"active\");\n\t\t\t\t\n\t\t\t\t\t$(\"#chatmessage\").html(\"\");\n\t\t\t\t$(\".loader\").show();\n\t\t\t\t client.getChannelByUniqueName(chname).then(function(channel) {\n\t\t\t\t\t\t\tconsole.log(\"channel\",channel)\n\t\t\t\t\t\t\tgeneralChannel = channel;\n\t\t\t\t\t\t \n\t\t\t\t\t$(\"#channel-title\").text(channel.state.friendlyName);\t\n\t\t\t\t\t\t\t\tsetupChannel(generalChannel);\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t},function (error){\n\t\t\t\t\n\t\t\t\t\t\t console.log(\"error\",error)\n\t\t\t\t\t\t});\n\t\n\t }, 10);\n \n \n}" ]
[ "0.6046183", "0.5564972", "0.5558473", "0.55167425", "0.54932386", "0.5406893", "0.5406754", "0.5369679", "0.5338762", "0.5330139", "0.52722967", "0.5264473", "0.51975965", "0.5191128", "0.5190129", "0.51743525", "0.5171066", "0.5164562", "0.5160631", "0.5139034", "0.5132241", "0.51214993", "0.5116543", "0.5112763", "0.5096299", "0.50929505", "0.5092364", "0.5079716", "0.5058528", "0.5058042", "0.50567985", "0.5055971", "0.5038599", "0.5019914", "0.5018552", "0.50149566", "0.5003191", "0.49827626", "0.4979901", "0.49796385", "0.49796152", "0.49793702", "0.4976751", "0.49727276", "0.49720016", "0.49432522", "0.49309242", "0.49290478", "0.49258554", "0.49245465", "0.49229804", "0.49174252", "0.49162185", "0.49158585", "0.4911183", "0.49000803", "0.48914716", "0.4885291", "0.4881556", "0.48720402", "0.48713252", "0.48701283", "0.48609737", "0.48543862", "0.48537543", "0.48529193", "0.48493508", "0.48493508", "0.4848657", "0.48442158", "0.48417547", "0.4841288", "0.4838631", "0.48327205", "0.4830412", "0.4823794", "0.4821531", "0.48204407", "0.48202205", "0.48177773", "0.48176587", "0.48158354", "0.48137605", "0.48137096", "0.48118192", "0.48059368", "0.4805081", "0.47928086", "0.4791032", "0.4788056", "0.47880393", "0.4781894", "0.47777748", "0.4774412", "0.4764172", "0.47637337", "0.47594866", "0.47509488", "0.4750291", "0.474254" ]
0.6806506
0
records when a user would like to be asked to report for a channel
function addAskingTime(user, channel, timeToSet) { controller.storage.teams.get('askingtimes', function(err, askingTimes) { if (!askingTimes) { askingTimes = {}; askingTimes.id = 'askingtimes'; } if (!askingTimes[channel]) { askingTimes[channel] = {}; } askingTimes[channel][user] = timeToSet; controller.storage.teams.save(askingTimes); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reportClicked() {\n chrome.runtime.sendMessage({ \"button\": \"report\", \"id\": data[currentIndex]._id });\n}", "@track((undefined, state) => {\n return {action: `enter-attempt-to-channel: ${state.channel.name}`};\n })\n enterChannel(channel){\n\n let addNewMessage = this.props.addNewMessage;\n let updateMessage = this.props.updateMessage;\n\n sb.OpenChannel.getChannel(channel.url, (channel, error) => {\n if(error) return console.error(error);\n\n channel.enter((response, error) => {\n if(error) return console.error(error);\n\n //set app store to entered channel\n this.props.setEnteredChannel(channel);\n //fetch the current participantList to append\n this.fetchParticipantList(channel);\n //fetch 30 previous messages from channel\n this.fetchPreviousMessageList(channel);\n });\n });\n }", "function setupChannel() {\n\n // Join the control channel\n controlChannel.join().then(function(channel) {\n print('Joined controlchannel as '\n + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n controlChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n console.log('lenis')\n test();\n //printcontrol()\n if (message.body.search(\"@anon\")>=0)\n {\n $.get( \"alch/\"+message.body, function( data ) {\n\n console.log(data);\n });\n }\n else if (message.body.search(\"@time\")>=0)\n {\n\n test();\n // var date=new Date().toLocaleString();\n // controlChannel.sendMessage(date);\n\n }\n else if (message.body.search(\"@junk\")>=0)\n {\n console.log(\"penis\");\n// test();\n }\n\n\n });\n }", "allowOnChannelChange(eventObject) {\n let allowedOnChannel = eventObject.target.checked;\n let channelId = document.querySelector(\"meta[itemprop='channelId']\").getAttribute(\"content\");\n let channelDisplayActions = RoKA.Preferences.getObject(\"channelDisplayActions\");\n channelDisplayActions[channelId] = allowedOnChannel ? \"RoKA\" : \"gplus\";\n RoKA.Preferences.set(\"channelDisplayActions\", channelDisplayActions);\n }", "function requestReport(message, str) {\r\n message.reply(str + ' Please report this at www.github.com/TheMalle/fixer');\r\n}", "function showReportDialog(options) {\n if (options === void 0) { options = {}; }\n if (!options.eventId) {\n options.eventId = hub_getCurrentHub().lastEventId();\n }\n var client = hub_getCurrentHub().getClient();\n if (client) {\n client.showReportDialog(options);\n }\n}", "function reportIncident(member, info, channel) {\n // if the channel is null, immediately exit\n if (!channel) {\n console.log('No output channel specified for output');\n return;\n }\n\n // pick a phrase (any phrase)\n const phrase = getPhrase(member);\n const embed = new Discord.RichEmbed()\n .setColor('#FF0000')\n .setTitle('Incident Report')\n .setThumbnail(\n 'https://cdn.discordapp.com/emojis/601119389093462027.png?v=1'\n )\n .setDescription(phrase)\n .addField('Incident Type', 'Misclick', true)\n .addField('Channel', info.incident.channel, true)\n .addField('Infraction', moment.localeData().ordinal(info.user.count), true)\n .setTimestamp(info.incident.date);\n\n channel.send(`${member} was caught by Officer Snag!`);\n channel.send(embed);\n}", "function addChannel() {\n dispatch({type: 'ADD_CHANNEL'});\n }", "function dataChannelWasOpened(channel){\n\t\tif(isInitializing === true){\n\t\t\tdocument.getElementById('chat_form').style.display = \"block\";\n\t\t\tisInitializing = false;\n\t\t}\n\n\t\tif(myUserName){\n\t\t\tvar nameMsg = JSON.stringify({\"username\": myUserName});\n\t\t\tchannel.send(nameMsg);\n\t\t}\n\t}", "function callPendingSurvey()\n {\n var userInfo = getUserInfo(false);\n userInfo.initial_flag = 1;\n userInfo.channel = 'ui';\n userInfo.uid = userInfo.emp_id;\n userInfo.context_type = 'all';\n socket.emit('getsurveylist',userInfo);\n }", "function LogChannelInfo(aSubject) {\n var httpChannel = aSubject.QueryInterface(Components.interfaces.nsIHttpChannel);\n if (httpChannel) {\n var responseStatus = 0;\n var responseStatusText = \"\";\n var requestMethod = \"unknown\";\n try {\n responseStatus = httpChannel.responseStatus;\n responseStatusText = httpChannel.responseStatusText;\n requestMethod = httpChannel.requestMethod;\n } catch (e) {}\n Logger.debug(\"[ Request details ------------------------------------------- ]\");\n Logger.debug(\" Request:\", requestMethod, \"status:\", responseStatus, responseStatusText);\n Logger.debug(\" URL:\", httpChannel.URI.spec);\n\n // At this point the headers and content-type may not be valid, for example if\n // the document is coming from the cache; they'll become available from the\n // listener's onStartRequest callback. See gecko bug 489317.\n var newListener = new DocumentContentListener(httpChannel);\n aSubject.QueryInterface(Ci.nsITraceableChannel);\n newListener.originalListener = aSubject.setNewListener(newListener);\n }\n}", "function customergetChannel(chname)\n\n{\t\t\tif(activechannel)\n\t\t\t{ \n\t\t\tclient.removeListener('channelUpdated', updateChannels);\n\t\t\t generalChannel.removeListener('typingStarted', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingStarted success\")\n\t\t\t\t\t\ttypingMembers.push(member.identity);\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(erro){\n\t\t\t\tconsole.log(\"typingStarted error\",erro)\n\t\t\t\t});\n\t\t\t\tgeneralChannel.removeListener('typingEnded', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingEnded success\")\n\t\t\t\t\t\ttypingMembers.splice(typingMembers.indexOf(member.identity), 1 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(error){\n\t\t\t\t\n\t\t\t\t\t\tconsole.log(\"typingEnded eror\",error)\n\t\t\t\t});\n\t\t\t}\n\n \n \n\t setTimeout(function() {\n\t\n\t\t\t\t$(\"#\"+chname+\" b\").text(\"\");\n\t\t\t\t$(\"#\"+chname+\" b\").removeClass(\"m-widget4__number\");\n\t\t\t\t$(\"#\"+chname+\" input\").val(0);\n\t\t\t\t$(\".m-widget4__item\").removeClass(\"active\");\n\t\t\t\t$(\"#\"+chname).addClass(\"active\");\n\t\t\t\t\n\t\t\t\t\t$(\"#chatmessage\").html(\"\");\n\t\t\t\t$(\".loader\").show();\n\t\t\t\t client.getChannelByUniqueName(chname).then(function(channel) {\n\t\t\t\t\t\t\tconsole.log(\"channel\",channel)\n\t\t\t\t\t\t\tgeneralChannel = channel;\n\t\t\t\t\t\t \n\t\t\t\t\t$(\"#channel-title\").text(channel.state.friendlyName);\t\n\t\t\t\t\t\t\t\tsetupChannel(generalChannel);\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t},function (error){\n\t\t\t\t\n\t\t\t\t\t\t console.log(\"error\",error)\n\t\t\t\t\t\t});\n\t\n\t }, 10);\n \n \n}", "function ac_addChat(channel, line, isEvent) {\n\n\t//Discard invalid messages\n\tif (!channel || channel=='') {\n\t\treturn;\n\t}\n\tif (line == '') {\n\t\treturn;\n\t}\n\n\tvar isPrivate = (channel.indexOf(AC_PVT_ID)==0);\n\tvar isSender = false;\n\tvar newMode = (isEvent ? 'event' : 'chat');\n\n\t//If we don't have a tab for this channel yet, create one\n\tif (!document.getElementById('ac_tab_'+channel)) {\n\t\tac_addChannel(channel);\n\t}\n\n\tvar olddata = document.ac_chats[channel];\n\n\t// Mod Announcements / Warnings\n\tif (line.indexOf('<font color=\"green\">Mod Announcement</font>') != -1) {\n\t\tline = line + '</font>';\n\t}\n\tif (line.indexOf('<font color=\"red\">Mod Warning</font>') != -1) {\n\t\tline = line + '</font>';\n\t}\n\tif (line.indexOf('</font>') == 0) {\n\t\tline = line.replace('</font>','');\n\t}\n\n\t\n\tif (isEvent) {\n\t\tisSender = false;\n\t} else {\n\t\n\t\t//Do AFH Relay stuff\n\t\tif (ac_getValue('afhbots') && !isPrivate ) {\n\t\t\tline = afh_relayChat(line);\n\t\t}\n\t\n\t\t// Hide Tags\n\t\tif (ac_getValue('hidetags') && channel != 'alerts') {\n\t\t\tline = line.replace('[' + channel + ']', '');\n\t\t}\n\t\t\t\n\t\t// Add Timestamp\n\t\tif (ac_getValue('timestamp')) {\n\t\t\tline = ac_getTimeStamp() + \" \" + line;\n\t\t}\n\n\t\tif (isPrivate) {\n\t\t\tisSender = (line.indexOf('<b>private to <a') != -1);\n\t\t\tif ( (isSender && !ac_getValue('pmoutblue')) || (!isSender && !ac_getValue('pminblue'))){\n\t\t\t\tline = line.stripFont();\n\t\t\t}\n\t\t} else {\n\t\t\tisSender = (line.indexOf('showplayer.php?who=' + playerID) != -1);\n\t\t}\n\n\t\tline = '<p class=\"message\">' + line + '</p>';\n\t}\n\t\n\t//If we switched between a event and a chat message, put a HR between them\n\tif (document.ac_lastchat[channel] != newMode) {\n\t\tline = '<hr>' + line;\n\t\tdocument.ac_lastchat[channel] = newMode;\n\t}\n\t\n\t//Update the content\n\tvar newdata = ac_truncateData(olddata, ac_getValue('chatbuffer')) + line;\n\tnewdata = newdata.fixRules();\n\tdocument.ac_chats[channel] = newdata;\n\n\t//Determine if we should notify or not\n\tvar isLogOnOff = false;\n\tvar notify = true;\n\tif ( (line.indexOf('logged on') != -1) || (line.indexOf('logged off') != -1) ) {\n\t\tisLogOnOff = true;\n\t}\n\tif (isEvent) {\n\t\tif (chatCycles <= startupCycles) {\n\t\t\tnotify = false;\n\t\t} else if (isLogOnOff && ac_getValue('suppressevents')) {\n\t\t\tnotify = false;\n\t\t}\n\t} else {\n\t\tif (isSender) {\n\t\t\tnotify = false;\n\t\t}\n\t}\n\tif (document.ac_status[channel] == 'sleep') {\n\t\tnotify = false;\n\t}\n\t\n\t\n\tif (document.ac_currentTool == \"chat\") {\n\t\tif (channel == document.ac_currentChannel) {\n\t\t\tac_smartScroll('ac_chat_content', newdata);\n\t\t} else {\n\t\t\tif (notify) {\n\t\t\t\t$(\"#\" + 'ac_tab_' + channel + \" span\").attr(\"class\", \"ac_tab_new\");\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\tif (notify) {\n\t\t\t$(\"#\" + 'ac_tab_' + channel + \" span\").attr(\"class\", \"ac_tab_new\");\n\t\t}\n\t}\n\n}", "function requestChannel(id, creator){\n\t$('#which').attr('channel', id);\n\t$('#which').attr('creator', creator);\n}", "function OnChannelOpen()\n{\n}", "onReportButtonClicked(eventObject) {\n new RoKA.Reddit.Report(this.threadInformation.name, this, true);\n }", "function report(user) {\n if (user) {\n $.post(\"/reportUser\", {sender: username, receiver: user, chatroom: chatroomId}, function (data) {}, \"json\");\n }\n}", "function NewChannel(channelId, channelName) {\n this.channelId = channelId;\n this.channelName = channelName;\n this.location = \"varied.groom.outliving\";\n this.favourite = false;\n this.date = new Date();\n this.messages = {};\n this.messagesCount = 0;\n this.timerIntervalIds = {};\n} // display the add channel input section", "function handleChannel (channel) {\n // Log new messages\n channel.onmessage = function (msg) {\n console.log('Getting data')\n console.log(msg)\n handleMessage(JSON.parse(msg.data), channel)\n waitingOffer = msg.data\n }\n // Other events\n channel.onerror = function (err) { console.log(err) }\n channel.onclose = function () { console.log('Closed!') }\n channel.onopen = function (evt) { console.log('Opened') }\n}", "function showReportDialog(options) {\r\n if (options === void 0) {\r\n options = {};\r\n }\r\n if (!options.eventId) {\r\n options.eventId = Object(_sentry_core__WEBPACK_IMPORTED_MODULE_0__[\"getCurrentHub\"])().lastEventId();\r\n }\r\n var client = Object(_sentry_core__WEBPACK_IMPORTED_MODULE_0__[\"getCurrentHub\"])().getClient();\r\n if (client) {\r\n client.showReportDialog(options);\r\n }\r\n}", "function getActiveInfo(){ \n pubsub.publish('callInfo','notesInMemory') \n }", "function getHistorical(){\n pubsub.publish('callInfo','notesInHistory') \n }", "function setupChannel() {\n\n newChannel.join().then(function(channel) {\n print('Joined channel as ' + username);\n });\n\n // Get the last 5 messages\n newChannel.getMessages(5).then(function (messages) {\n for (var i = 0; i < messages.items.length; i++) {\n if (messages.items[i].author !== undefined) {\n printMessage(newChannel.uniqueName, messages.items[i].author, messages.items[i].body);\n }\n }\n });\n\n // Fired when a new Message has been added to the Channel on the server.\n newChannel.on('messageAdded', function(message) {\n console.log(message.body);\n printMessage(newChannel.uniqueName, message.author, message.body);\n });\n }", "function onDataChannelCreated(channel) {\n console.log('Created Data Channel:', channel);\n\n channel.onopen = function() {\n console.log('CHANNEL has been opened!!!');\n };\n\n channel.onmessage = (adapter.browserDetails.browser === 'firefox') ?\n receiveDataFirefoxFactory() : receiveDataChromeFactory();\n }", "onReportButtonClicked(eventObject) {\n new RoKA.Reddit.Report(this.commentObject.name, this.commentThread, false);\n }", "function sendReport() {\r\n\t framework.sendReport(); \r\n}", "function acceptReport(id, type) {\n if (id.substring(0, 15) == \"googCertificate\" ||\n id.substring(0, 9) == \"googTrack\" ||\n id.substring(0, 20) == \"googLibjingleSession\")\n return false;\n\n if (type == \"googComponent\")\n return false;\n\n return true;\n}", "function store_slack_channel_info_for_event(id, channel_id, channel_name, callback) {\n var url = \"/events/\" + id + \"/slack-channels\";\n var data = {\"channel_id\": channel_id, \"channel_name\": channel_name};\n $.post(url, data, callback);\n}", "function ac_addChannel(channel) {\n\t\n\tvar title = '';\n\tvar sClass = 'kol';\n\tvar\ttitle = channel;\n\t\n\tif (channel.indexOf(AC_PVT_ID)==0) {\n\t\ttitle = AC_PVT_TITLE + channel.substr(AC_PVT_ID.length);\n\t\tsClass = \"pm\";\n\t} else if (channel == 'events') {\n\t\tsClass = \"events\";\n\t} else if (channel == 'alerts') {\n\t\tsClass = \"alerts\";\n\t}\n\t\t\n\t//If the tab doesn't exist, create it and attach event listeners\n\tif (!document.getElementById('ac_tab_' + channel)) {\n\t\t$(\"#ac_toolbar\").append('<li id=\"ac_tab_' + channel + '\" class=\"ac_tab ac_tab_' + sClass + '\"></li> ');\n\t\t$(\"#ac_tab_\" + channel).append('<span class=\"ac_tab_off\">' + title + '</span> ');\n\n\t\t$(\"#ac_tab_\" + channel).click(function (event) {\n\t\t\tac_showChannel(channel);\n\t\t\t$(\"#graf\").focus();\n\t\t});\n\t\t$(\"#ac_tab_\" + channel).dblclick(function (event) {\n\t\t\tac_hideChannel(channel); \n\t\t\t$(\"#graf\").focus();\n\t\t});\n\t\t$(\"#ac_tab_\" + channel).bind(\"contextmenu\",function(e){\n\t\t\tac_toggleChannel(channel); \n\t\t\t$(\"#graf\").focus();\n\t\t\treturn false; //disable the context menu\n\t\t});\n\n\t\tdocument.ac_status[channel] = 'awake';\n\t\tdocument.ac_resizePanels();\n\t} else {\n\t\tif (document.ac_status[channel] == 'awake') {\n\t\t} else if (document.ac_status[channel] == 'dead') {\n\t\t\tdocument.ac_status[channel] = 'awake';\n\t\t\t//$(\"#ac_tab_\" + channel).attr('class', 'ac_tab ac_tab_off');\n\t\t\t$(\"#ac_tab_\" + channel + \" span\").attr(\"class\", \"ac_tab_off\");\n\t\t} else if (document.ac_status[channel] == 'sleep') {\n\t\t}\n\t\n\t}\n\n\tif (!document.ac_chats[channel]) { \n\t\tdocument.ac_chats[channel] = \"\"; \n\t}\n\tif (!document.ac_lastchat[channel]) { \n\t\tdocument.ac_lastchat[channel] = \"chat\"; \n\t}\n}", "function setupChannel() {\n // Join the general channel\n generalChannel.join().then(function(channel) {\n print('Joined channel as '\n + '<span class=\"is-owner\">' + username + '</span>.', true);\n });\n\n setTimeout(() => $chatOverlay.slideUp(), 1000);\n\n // Listen for new messages sent to the channel\n generalChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n });\n }", "function additionalInformation(event, senderId) {\n allSenders[senderId].states++;\n allSenders[senderId].aboutMe = event.message.text; \n sendFBmessage.sendQuickReplies(senderId, saveText, -1, model.answerVariants.savePostback);\n}", "function showReportDialog(options) {\n if (options === void 0) { options = {}; }\n if (!options.eventId) {\n options.eventId = Object(_sentry_core__WEBPACK_IMPORTED_MODULE_0__[\"getCurrentHub\"])().lastEventId();\n }\n var client = Object(_sentry_core__WEBPACK_IMPORTED_MODULE_0__[\"getCurrentHub\"])().getClient();\n if (client) {\n client.showReportDialog(options);\n }\n}", "function setupChannel() {\r\n\r\n\t\t// Join the general channel\r\n\t\tgeneralChannel.join().then(function(channel) {\r\n\t\t\tconsole.log('Enter Chat room');\r\n\r\n\t\t\t// Listen for new messages sent to the channel\r\n\t\t\tgeneralChannel.on('messageAdded', function(message) {\r\n\t\t\t\tremoveTyping();\r\n\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(message.index);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// 招待先プルダウンの描画\r\n\t\t\tvar storedInviteTo = storage.getItem('twInviteTo');\r\n\t\t\tgenerateInviteToList(storedInviteTo);\r\n\r\n\t\t\t// 招待先プルダウンの再描画\r\n\t\t\tgeneralChannel.on('memberJoined', function(member) {\r\n\t\t\t\tconsole.log('memberJoined');\r\n\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t});\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('memberLeft', function(member) {\r\n\t\t\t\tconsole.log('memberLeft');\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\r\n\t\t\t// Typing Started / Ended\r\n\t\t\tgeneralChannel.on('typingStarted', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing started');\r\n\t\t\t\tshowTyping();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('typingEnded', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing ended');\r\n\t\t\t\tclearTimeout(typingTimer);\r\n\t\t\t});\r\n\r\n\t\t\t// 最終既読メッセージindex取得\r\n\t\t\tgeneralChannel.getMembers().then(function(members) {\r\n\t\t\t\tfor (i = 0; i < members.length; i++) {\r\n\t\t\t\t\tvar member = members[i];\r\n\t\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tif (identity != member.identity && inviteToNames.indexOf(member.identity) != -1) {\r\n\t\t\t\t\t\treadStatusObj[identity] = member.lastConsumedMessageIndex;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Get Messages for a previously created channel\r\n\t\t\t\tgeneralChannel.getMessages().then(function(messages) {\r\n\t\t\t\t\t$chatWindow.empty();\r\n\t\t\t\t\tvar lastIndex = null;\r\n\t\t\t\t\tfor (i = 0; i < messages.length; i++) {\r\n\t\t\t\t\t\tvar message = messages[i];\r\n\t\t\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\t\t\tlastIndex = message.index;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (lastIndex && lastIndex >= 0) {\r\n\t\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(lastIndex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\thideSpinner();\r\n\t\t\t\t\t$('#chat-input').prop('disabled', false);\r\n\t\t\t\t});\r\n\r\n\t\t\t});\r\n\r\n\t\t});\r\n\r\n\t}", "function channelStateChange(event, channel) {\n console.log(util.format('Channel %s is now: %s', channel.name, channel.state));\n }", "function getChannel(channel){\n gapi.client.youtube.channels.list({\n part: 'snippet,contentDetails,statistics',\n forUsername: channel\n\n })\n .then(respone => {\n console.log(response);\n const channel = response.result.items[0];\n\n const output = `\n <ul class=\"collection\">\n <li class=\"collection-item\">Title : ${channel.snippet.title}</li>\n <li class=\"collection-item\">ID: ${channel.id}</li>\n <li class=\"collection-item\">Subscribers: ${channel.statistics.subscriberCount}</li>\n <li class=\"collection-item\">Views: ${ numberWithCommas(channel.statistics.viewCount)}</li>\n <li class=\"collection-item\">Videos: ${numberWithCommas(channel.statistics.videoCount)}</li>\n </ul>\n <p>${channel.snippet.description}</p>\n <hr>\n <a class=\"btn grey darken-2\" target=\"_blank\" href=\"https://youtube.com/${channel.snippet.customURL}\">Visit Channel</a>\n\n `;\n\n showChannelData(output);\n\n const playlistID = channel.contentDetails.relatedPlaylists.uploads;\n requestVideoPlaylist(playlistID);\n })\n .catch(err => alert('No Channel By That Name'));\n}", "function reactToReportQuestion(recipientId, qId) {\n var message = createTextWithButtonsMessage(\"Wow! I will have to review this question later.\", \n [{type: \"postback\", title: \"Next\", payload: \"QUESTION_NEXT/\" + qId}]);\n sendMessage(recipientId, message);\n}", "function channelMine(req, res) {\n MyChannel.findById(req.params.id, function(err, myChannel) {\n if (err) res.send(err);\n res.json(myChannel);\n });\n}", "async function askWhatToDoChan()\n{\n\tlet choice = []\n\tchoice.push(\n\t\t{\n\t\t\tname: \"Supprimer un channels\",\n\t\t\tvalue: \"delete\"\n\t\t},\n\t\t{\n\t\t\tname: \"Créer un channel\",\n\t\t\tvalue: \"create\"\n\t\t},\n\t\t{\n\t\t\tname: \"Retournez à la liste précédente\",\n\t\t\tvalue: -1\n\t\t},\n\t\treturnObjectLeave()\n\t)\n\n\tlet response = await ask(\n\t{\n\t\ttype: \"list\",\n\t\tmessage: \"Qulle channels voulez vous gèrer ?\",\n\t\tname: \"response\",\n\t\tchoices: choice\n\t})\n\n\tif (response.response == -1)\n\t{\n\t\tchooseWhatToHandle()\n\t}\n\telse if (response.response == -2)\n\t{\n\t\tendProcess()\n\t}\n\telse if (response.response == \"delete\")\n\t{\n\t\tChooseChanForDelete()\n\t}\n\telse if (response.response == \"create\")\n\t{\n\t\tcreateChan()\n\t}\n\n\n}", "function onReportClick() {\n\tcommonFunctions.sendScreenshot();\n}", "async grantMeChannel () {\n\t\t// subscription cheat must be provided by test script\n\t\tif (!this.subscriptionCheat) {\n\t\t\treturn;\n\t\t}\n\t\t// allow unregistered users to subscribe to me-channel, needed for mock email testing\n\t\tthis.api.warn(`NOTE - granting subscription permission to me channel for unregistered user ${this.model.id}, this had better be a test!`);\n\t\tawait this.api.services.broadcaster.grant(\n\t\t\t[this.model.id],\n\t\t\t`user-${this.model.id}`,\n\t\t\t() => {},\n\t\t\t{ request: this.request }\n\t\t);\n\t}", "function setupChannel() {\n // Join the general channel\n chatChannel.join().then(function(channel) {\n print('Joined channel as <span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n chatChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n });\n }", "function log(bot, channelID, message) {\n const channel = bot.channels.cache.get(channelID);\n console.log(new Date() + \" : \" + message);\n if (!channel) {\n console.log(\"Unable to get channel:\", channelID);\n return;\n }\n const embed = new Discord.MessageEmbed()\n .setTitle(new Date())\n .setColor(0x999999)\n .setDescription(message)\n return channel.send(embed);\n}", "function notifyOnSubmission() {\r\n \r\n var form = FormApp.openById(\"Redacted\");\r\n \r\n // get response that was just submitted.\r\n var mostRecentResponse = form.getResponses().pop();\r\n \r\n // access the boxes the user filled out - They're indexed in the order they appear\r\n var itemResponses = mostRecentResponse.getItemResponses(); // -> ItemResponse[]\r\n \r\n var responseObject = {\r\n name : itemResponses[0].getResponse(),\r\n email : itemResponses[1].getResponse(),\r\n platform : itemResponses[2].getResponse(),\r\n issue : itemResponses[3].getResponse(),\r\n };\r\n \r\n Logger.log(responseObject); \r\n \r\n var memberAssigned = getMemberToSendTo(responseObject);\r\n var emailBody = \r\n `\r\n New Support Ticket From ${responseObject.name} \\n\r\n Platform: ${responseObject.platform}\\n\r\n Issue: ${responseObject.issue}\r\n `;\r\n GmailApp.sendEmail(memberAssigned.email, `New Support Ticket From ${responseObject.name}`, emailBody);\r\n Logger.log(\"Sent to \" + memberAssigned.email);\r\n var admin_email = \"\";\r\n GmailApp.sendEmail(admin_email, `New Support Ticket From ${responseObject.name}`, emailBody);\r\n Logger.log(\"Sent to Admin\");\r\n }", "pusher_subscription_counter_part(channel_name) {\n\n const {email} = this.props.user;\n var channel = pusher.subscribe(channel_name);\n console.log(channel_name);\n\n channel.bind('my_event', function(data) {\n console.log(data);\n console.log('data at pusher subscription counter part..');\n if (data != null) {\n if (data.sender_email === email.toLowerCase()) {\n\n } else {\n if (data.message != null){\n console.log('data');\n console.log(data);\n //converting data to object that fits to the model.\n const object = {sender_email: data.sender_email, sender_first_name: data.sender_first_name, text:data.message, date: data.date};\n console.log(object);\n\n this.props.appendMessageCounterPart(object);\n }\n }\n }\n }.bind(this));\n }", "function handleAnswer(answer) { \n console.log('answer: ', answer)\n yourConn.setRemoteDescription(new RTCSessionDescription(answer));\n\n window.clearTimeout(callTimeout);\n document.getElementById('canvas').hidden = true;\n document.getElementById('show_IfCalling').innerHTML = '-- on call --';\n document.getElementById('visitor_callOngoing').style.display = 'block';\n \n}", "function getAndDisplayUserReport() {\n getUserInfo(displayUserReport);\n}", "function scanOne(channel){\r\n\tvar channelConfig=channels[channel.id]; // channel settings\r\n\tif(channel){\r\n\t\tif(channel.manageable){ //if the bot has permission to change the name\r\n\t\t\tvar newTitle=channelConfig[0];\r\n\t\t\tif(channel.members.size>0){ // if anyone is in the channel\r\n\t\t\t\tvar gameTitle=majority(channel, channelConfig[1] || 0.5);\r\n\t\t\t\tif(!noFlyList.includes(gameTitle)){\r\n\t\t\t\t\tif(channelConfig[2]){ //Template setting\r\n\t\t\t\t\t\tnewTitle=(channelConfig[2].replace(/X/,channelConfig[0]).replace(/Y/,gameTitle));\r\n\t\t\t\t\t}else{ // use default\r\n\t\t\t\t\t\tnewTitle=(channelConfig[0] + \" - \" + gameTitle);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(channel.name!==newTitle){\r\n\t\t\t\tchannel.setName(newTitle);\r\n\t\t\t}\r\n\t\t}\r\n\t}else{\r\n\t\tdelete channels[channel.id];\r\n\t\tconsole.log(\"Found deleted channel\");\r\n\t\tautosave();\r\n\t}\r\n}", "function priv_QuizGrader_reportQuestionsCMIData() {\n \n var theQuestion_id_list = this.priv_quiz_description.getDeliveredQuestionIDs();\n \n for( var i=0; i < theQuestion_id_list.length; i++ ) {\n var loopQuestion_id = theQuestion_id_list[i];\n var theResponse_question = this.getResponses().findQuestionResponseByID( loopQuestion_id );\n \n var theAnswer_is_correct = SCORM_ANSWER_WRONG;\n if( theResponse_question.isCorrect() == ADL_QD_TRUE ){\n theAnswer_is_correct = SCORM_ANSWER_CORRECT;\n }\n \n var theInteraction_prefix = \"cmi.interactions.\" \n + findInteraction( loopQuestion_id + \"#\" + this.priv_quiz_description.attempt) \n + \".\";\n doSetValue( theInteraction_prefix + \"learner_response\", theResponse_question.getAnswerPattern() );\n doSetValue( theInteraction_prefix + \"result\", theAnswer_is_correct );\n }\n \n}", "function doopenchannel() {\n ModalService.showModal({\n templateUrl: \"modals/openchannel.html\",\n controller: \"OpenChannelController\",\n }).then(function(modal) {\n modal.element.modal();\n $scope.$emit(\"child:showalert\",\n \"To open a new channel, enter or scan the remote node id and amount to fund.\");\n modal.close.then(function(result) {\n });\n });\n }", "setChannelName (callback) {\n\t\t// for the user originating the request, we use their me-channel\n\t\t// we'll be sending the data that we would otherwise send to the tracker\n\t\t// service on this channel, and then we'll validate the data\n\t\tthis.channelName = `user-${this.currentUser.user.id}`;\n\t\tcallback();\n\t}", "function createChannel() {\n asdb.create.channel({\n // UNCOMMENT THESE IN ORDER TO SAVE AGAIN\n //title: \"Bounty\",\n //type: \"Farmers Market\",\n //aka: \"Dallas\"\n }).then(function success(s) {\n console.log('SUCCESS:');\n console.log(s);\n }).catch(function error(e) {\n console.log('ERROR:');\n console.log(e);\n });\n}", "function setupChannel() {\n // Join the general channel\n generalChannel.join().then(function(channel) {\n print('Joined channel as '\n + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n generalChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n });\n }", "function check(d){\n alert.close\n logg(d)\n if(equals(code, hist)){\n console.log(`${hist.join(', ')}`)\n console.log('congrats!')\n alert('Congrats!')\n let index=0;\n }\n }", "function sendExcavationPermitIssuedNotificationReport() {\r\n\r\n\tlogDebug(\"Report Name: \" + reportName);\r\n\tvar rptParams = aa.util.newHashMap();\r\n\trptParams.put(\"RecordID\", capIDString);\r\n\r\n\tvar attachResults = runReportAttachAsync_DEV(capId, reportName, 3000, \"RecordID\", capIDString);\r\n\r\n\r\n\tif (!matches(reportName, null, undefined, \"\")) {\r\n\t\t//Call sendNotifcationAsync\r\n\t\tsendNotificationAsync(agencyReplyEmail, emailSendTo, emailStaffCC, emailTemplate, emailParameters, rptParams, reportName);\r\n\t}\r\n\telse {\r\n\t\t// Call sendNotification if you are not using a report\r\n\t\tsendNotification(agencyReplyEmail, emailSendTo, emailStaffCC, emailTemplate, emailParameters, null);\r\n\t}\r\n}", "function handleAccountChannel(req, res) {\n csrf.verify(req);\n\n if (!verifyReferrer(req, '/account/channels')) {\n res.status(403).send('Mismatched referrer');\n return;\n }\n\n var action = req.body.action;\n switch(action) {\n case \"new_channel\":\n handleNewChannel(req, res);\n break;\n case \"delete_channel\":\n handleDeleteChannel(req, res);\n break;\n default:\n res.send(400);\n break;\n }\n}", "function subscriber(channelID) {\r\n console.error('Subscriber Notice fired!');\r\n var channelDiv = $('#' + channelID + ' .stream-notice');\r\n $(channelDiv).text('New Sub!');\r\n $(channelDiv).addClass('subscriber');\r\n $.when($(channelDiv).fadeIn('fast').delay(10000).fadeOut('fast')).done(function() {\r\n $(channelDiv).removeClass('subscriber');\r\n });\r\n if ($('.notification-sound-input').prop('checked') === true) {\r\n $('.subscriber-sound')[0].play();\r\n }\r\n}", "function readAChannel(id) {\n // DEFINE LOCAL VARIABLES\n // NOTIFY PROGRESS\n console.log('reading a channel', id);\n\n //hit\n asdb.read.aChannel('-LdCgjSRL27Y9RruXGE4').then(function success(s) {\n console.log('Channel record:');\n console.log(s);\n }).catch(function error(e) {\n\t\tconsole.log(\"error\", e);\n\t}); \n}", "function onDataChannelCreated(channel, id) {\n var being = isInitiator ? \"am\" : \"am not\"\n console.log(\"My id is\", my_id, \"I\", being, \" an initiator, and I CREATED a DataChannel with\", id);\n\n channel.onopen = function () {\n console.log('Channel opened!');\n // send the photo if we initiated the data channel\n if (isInitiator) {\n sendPhoto();\n }\n // otherwise, just receive the bits and report the load medium\n else {\n $(\"#send_medium\")[0].innerHTML = \"browser\";\n }\n };\n\n channel.onerror = function (e) {\n console.log('CHANNEL error!', e);\n loadFromServer();\n };\n\n // when a channel closes, clean up the data channel from our globals\n channel.onclose = function() {\n delete dataChannels[id];\n delete peerConnections[id];\n delete connections[id];\n console.info(\"dataChannel killed on client!\");\n };\n\n channel.onmessage = (webrtcDetectedBrowser == 'firefox') ? \n receiveDataFirefoxFactory(id) :\n receiveDataChromeFactory(id);\n}", "function onNewSubscr(id, channels) {\n\tthis.emit('data', {\n\t\tid: id,\n\t\tchannels: channels\n\t});\n\tsendLast.call(this, id, channels);\n}", "function getChannel(channel) {\n gapi.client.youtube.channels\n .list({\n part: 'snippet,contentDetails,statistics',\n id: channel\n })\n .then(response => {\n console.log(response);\n const channel = response.result.items[0];\n\n const playlistId = channel.contentDetails.relatedPlaylists.uploads;\n requestVideoPlaylist(playlistId);\n })\n .catch(err => alert('No Channel By That Name'));\n}", "function viewTickets(agent) {\n agent.add(`Give us the name of the person whom the ticket was issued to.`);\n }", "function getReport(){\n\n }", "onReportAction(commentId) {\n this.setState({\n serverResponse: {\n event: \"report notification\",\n status: \"waiting\",\n commentId: commentId\n }\n });\n\n // every component remove any feedback, this will cause CommentItem report success status to go away\n setTimeout(() => this.clearServerResponse(), 5000)\n }", "function channelInfo(query) {\n return __awaiter(this, void 0, void 0, function* () {\n return api_1.get('channels.info', query, true);\n });\n}", "function appendChannel(channel) {\n let option = document.createElement(\"option\")\n option.innerHTML = channel;\n document.querySelector(\"#channel\").append(option);\n }", "async function step4(msgText, report) {\n console.log(\"Steeeeeeep 4444444444\");\n\n //Checks if any button has been used.\n if (cause.includes(msgText)) {\n //If it is the button Otro replys forthe user to write the cause\n if (msgText == \"Otro\") {\n report[0].response = {\n \"text\": 'Escriba la causa del problema'\n }\n //otherwise update the cause field and response\n } else {\n report[0].response = homeDamagesReply;\n report = fillReport(\"cause\", msgText, report);\n }\n //it the buttons has not been used saves the recive text as the cause\n } else {\n report[0].response = homeDamagesReply;\n report = fillReport(\"cause\", msgText, report);\n }\n\n //Returns the updated report\n return report;\n}", "function setupChannel() {\n // Join the general channel\n // generalChannel.getMembers().then(members => {\n // if (members.)\n // })\n\n generalChannel.join().then(function(channel) {\n print('Joined channel as ' + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n generalChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n });\n\n generalChannel.on('typingStarted', function(member) {\n console.log('typingStarted', member);\n typingIndicator.text(`${member.identity} is typing...`);\n typingIndicator.show();\n });\n\n generalChannel.on('typingEnded', function(member) {\n console.log('typingEnded', member);\n typingIndicator.hide();\n });\n }", "function Channel(n,d,c,s,e,m){\n\tthis.name = \"#\"+n;\n\tthis.createdOn = d;\n\tthis.createdBy = c;\n\tthis.starred = s;\n\tthis.expiresIn = e;\n\tthis.messageCount = m;\n}", "async function step3(msgText, report) {\n console.log(\"Steeeeeeep 33333333333333333333333333\");\n\n //If uses the buttons fill the correspondent field\n if (msgText == \"Comunidad\" || msgText == \"Hogar\") {\n report[0].response = causeReply;\n report = fillReport(\"homeOrComunitty\", msgText, report);\n\n //insist on using the buttons\n } else {\n report[0].responseAuxIndicator = 1;\n report[0].responseAux = {\n \"text\": 'Utilice los botones para responder'\n };\n report[0].response = homeOrComunityReply;\n }\n\n return report;\n}", "function ChatChannelDataReadyHandler() \n{\n\tvar str = null;\n \n\t//\n\t// Incoming data on the chat channel\n\t//\n\tstr = g_oChatChannel.ReceiveChannelData();\n\t \n\t//\n\t// Update chat history window\n\t//\n\tincomingChatText.value = incomingChatText.value + L_cszUserID + str; \n\tincomingChatText.doScroll(\"scrollbarPageDown\");\n\t \n\treturn;\n}", "function reportInstall(arg)\n{\n mpmetrics.track('hardware_report', {'graphics_card': arg, 'token' : metrics_token});\n mpmetrics.track_funnel(metrics_funnel_id, 5, 'complete_unity_install', {'userAgent' : navigator.userAgent, 'token' : metrics_token});\n setTimeout(\"window.location='unity_done.html';\", 500);\n}", "function sendNotification (record, action, done) {\n done()\n }", "createChannel() {\n\t\t// Set the depends - add self aggs query as well with depends\n\t\tlet depends = this.props.depends ? this.props.depends : {};\n\t\tdepends['aggs'] = {\n\t\t\tkey: this.props.inputData,\n\t\t\tsort: this.props.sort,\n\t\t\tsize: this.props.size\n\t\t};\n\t\t// create a channel and listen the changes\n\t\tvar channelObj = manager.create(depends);\n\t\tchannelObj.emitter.addListener(channelObj.channelId, function(res) {\n\t\t\tlet data = res.data;\n\t\t\tlet rawData;\n\t\t\tif(res.method === 'stream') {\n\t\t\t\trawData = this.state.rawData;\n\t\t\t\trawData.hits.hits.push(res.data);\n\t\t\t} else if(res.method === 'historic') {\n\t\t\t\trawData = data;\n\t\t\t}\n\t\t\tthis.setState({\n\t\t\t\trawData: rawData\n\t\t\t});\n\t\t\tthis.setData(rawData);\n\t\t}.bind(this));\n\t}", "addNewReport() {\n \n }", "async function step7(msgText, report) {\n console.log(\"Steeeeeeep 7777777777777\");\n\n //if the user replys to this las question with the No hubo muertos button, the pertinent field is filled \n //with a 0\n if (msgText == \"No hubo muertos\") {\n report[0].response = imageReply;\n report = fillReport(\"humansDeath\", 0, report)\n\n //Otherwise if the reply is not a number asks for a number\n } else if (isNaN(msgText)) {\n report[0].response = {\n \"text\": \"Señale el numero de muertes utilizando los números del teclado\"\n };\n\n //if it is a number updates this field with the value\n } else {\n report[0].response = imageReply;\n report = fillReport(\"humansDeath\", msgText, report)\n }\n\n //returns the updated report\n return report;\n}", "function reportJobs() {\n postAnswer(DATA_NOT_AVAILABLE + 'aaaaaaa ');\n}", "function record_company(company) {\n\tif (known_companies[company]) return;\t\t\t\t\t\t\t\t\t\t//if i've seen it before, stop\n\n\t// -- Show the new company Notification -- //\n\tif (start_up === false) {\n\t\tconsole.log('[ui] this is a new company! ' + company);\n\t\taddshow_notification(build_notification(false, 'Detected a new company \"' + company + '\"!'), true);\n\t}\n\n\tbuild_company_panel(company);\n\tif (start_up === true) addshow_notification(build_notification(false, 'Detected company \"' + company + '\".'), false);\n\n\tconsole.log('[ui] recorded company ' + company);\n\tknown_companies[company] = {\n\t\tname: company,\n\t\tcount: 0,\n\t\tvisible: 0\n\t};\n}", "channel(...args) {\n // emit to eden\n return this.eden.call('slack.channel', Array.from(args), true);\n }", "function get_channelInfo(APIKey , channel_id , callBackFunction ){\n $.getJSON( \"https://www.googleapis.com/youtube/v3/channels?part=statistics,snippet&id=\" + channel_id + \"&key=\" + APIKey , function(data) {\n /*On success callback*/\n var channel = new ChannelObj( data.items[0].snippet.title , data.items[0].snippet.description , data.items[0].snippet.thumbnails.default.url , new Date(data.items[0].snippet.publishedAt) );\n channel.id = channel_id;\n channel.stats.push( { key: \"views\", value: Number(data.items[0].statistics.viewCount) });\n channel.stats.push( { key: \"subscribers\", value: Number(data.items[0].statistics.subscriberCount) });\n channel.stats.push( { key: \"videoCount\", value: Number(data.items[0].statistics.videoCount) });\n callBackFunction(channel);\n });\n}", "function channelEnteredBridge(event, obj) {\n // console.log(util.format('Channel %s just entered Bridge testing : ' + obj.bridge.id , obj.channel.name));\n\n \n\n}", "function configureDataChannel() {\n\t\t\t\n\t\t\tchannel.onmessage = function (e) {\n\t\t\t\tconsole.log(\"message sent over RTC DataChannel> \", e.data);\n\t\t\t\tif (typeof SETTINGS.onMessage === 'function') {\n\t\t\t\t\tSETTINGS.onMessage(e.data);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tchannel.onerror = function (e) {\n\t\t\t\tconsole.log(\"channel error: \", e);\n\t\t\t};\n\t\t\t\n\t\t\tchannel.onclose = function (e) {\n\t\t\t\tconsole.log(\"channel closed: \", e);\n\t\t\t};\n\t\t\tchannel.onopen = function (e) {\n\t\t\t\tconsole.log(\"channel openned: \", e);\n\t\t\t};\n\t\t}", "function sendOut (mode, report) {\n console.log(report);\n var version = extensionVersion();\n sendLogs(mode, 2, version, [{content: report}]);\n}", "function setupChannel(generalChannel) {\n\t\t\tactivechannel=true;\n\t\t\t\tgeneralChannel.join().then(function(channel) {\n\t\t\t\tconsole.log(\"join\",channel)\n\t\t\t\t// $chatWindow.removeClass('loader');\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t//=============================Typinh Indicator for particular channel=========================================\n\t\t\t\t//========================================Fisrt time Typing start here(Two function=>1)start and eding =======================\n\t\t\t\t client.on('channelUpdated', updateChannels);\n\t\t\t\tgeneralChannel.on('typingStarted', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingStarted success\")\n\t\t\t\t\t\ttypingMembers.push(member.identity);\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(erro){\n\t\t\t\tconsole.log(\"typingStarted error\",erro)\n\t\t\t\t});\n\t\t\t\tgeneralChannel.on('typingEnded', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingEnded success\")\n\t\t\t\t\t\ttypingMembers.splice(typingMembers.indexOf(member.identity), 1 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(error){\n\t\t\t\t\n\t\t\t\t\t\tconsole.log(\"typingEnded eror\",error)\n\t\t\t\t});\n\t\t\t\t//============================================================Message Removed===============================================================\n\t\t\t\t generalChannel.on('messageRemoved', function(RemoveMessageFlag){\n\t\t\t\t\t\t\tconsole.log(\"removeMessage\",RemoveMessageFlag.state.index);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"#message_\"+RemoveMessageFlag.state.index).remove();\n\t\t\t\t\t\t \n client.on('channelUpdated', updateChannels);\n });\n\t\t\t\t//============================================================Message updated===================================\n\t\t\t generalChannel.on('messageUpdated', function(messageUpdatedFlag){\n\t\t\t\tconsole.log(\"messageUpdated\",messageUpdatedFlag);\n\t\t\t\t\n\t\t\t\t$(\"#editmessage_\"+messageUpdatedFlag.index).text(messageUpdatedFlag.body);\n\t\t\t\t \n\t\t\t \n\t\t\t \n\t\t\t client.on('channelUpdated', updateChannels);\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t });\n\t\t\t\t\n\t\t\t\t//===================================twilio channel message get frist time ==================================================================\n\t\t\t\t\n\t\t\t\tgeneralChannel.getMessages(20).then(function(messages) {\n\t\t\t\t\t\t\t\tconsole.log(\"messages\",messages);\n\t\t\t\t\t\t\t\tactiveMessageChannel=messages;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (messages.hasPrevPage == 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\tScrolldisable = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tScrolldisable = 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\tmsgI=0;\n\t\t\t\t\t\t\t\tLoopMessageShow(messages)\n\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\n\t\t\t\t});\n\t\t\t\t \n}", "function createNewChannel(channelInfo = undefined, msg = undefined, channelType = 'selected') {\n try {\n console.log('\\n*ENTERING createNewChannel()');\n\n let channel = {\n channelId: '',\n channelDisplayName: '',\n isUser: '',\n \n description: '',\n path: '',\n };\n\n if ( typeof(channelInfo) !== 'undefined' ) { //creating info for selected channel\n //console.log('createNewChannel(): creating based on given channel info');\n channel.channelId = ( typeof( channelInfo.channelId ) === 'undefined' ) ? '' : channelInfo.channelId;\n channel.channelDisplayName = ( typeof( channelInfo.channelDisplayName ) === 'undefined' ) ? '' : channelInfo.channelDisplayName;\n channel.isUser = ( typeof( channelInfo.isUser ) === 'undefined' ) ? '' : channelInfo.isUser;\n \n channel.description = ( typeof( channelInfo.description ) === 'undefined' ) ? '' : channelInfo.description;\n channel.path = ( typeof( channelInfo.path ) === 'undefined' ) ? '' : channelInfo.path;\n }\n\n else if ( typeof(msg) !== 'undefined' ) { //creating info for new channel (received from msg)\n //console.log('createNewChannel(): creating based on received msg'); \n let _isChannel = isChannel( msg.channelId ); //is the channel a direct message (false) or group chat (true)\n channel.channelId = ( typeof( msg.channelId ) === 'undefined' ) ? '' : msg.channelId;\n\n if ( _isChannel ) { //message for group chat\n channel.channelDisplayName = msg.channelId; //channel display name is the same as the channel id\n channel.isUser = false;\n channel.description = 'All about that ' + msg.channelId + ' talk';\n channel.path = msg.channelId;\n }\n\n else { //message for specific user (direct message)\n //channel.channelDisplayName = ' @ ' + msg.username;\n channel.channelDisplayName = msg.username;\n channel.isUser = true;\n channel.description = \"Sending D.M's to \" + msg.username;\n channel.path = (channelType === 'selected') ? msg.socketId : 'N/A'; //only stores socket id path if this is for a selected channel (path required in this case)\n }\n }\n\n else {\n //console.log('createNewChannel(): empty channel being returned - both channel info & msg not provided');\n }\n \n //if a regular channel is created (stored w/this.allMessages which includes the messages property)\n if ( channelType !== 'selected' ) {\n if ( typeof(msg) !== 'undefined' ) { //msg passed (first channel msg)\n channel.messages = [ createNewMsg(msg) ]; //stores a new reference for the msg object\n }\n\n else {\n channel.messages = ( typeof( channelInfo.messages ) === 'undefined' ) ? [] : JSON.parse( JSON.stringify( channelInfo.messages ) );\n }\n }\n \n console.log('*LEAVING createNewChannel()\\n');\n return channel;\n }\n catch(err) {\n console.log(`ERR Chat createNewChannel(): ${err.message}`);\n console.log('*LEAVING createNewChannel()\\n');\n return undefined;\n }\n}", "function onReportDiagnosticClick() {\r\n if (reportDiagnosticInput.checked) {\r\n reportDiagnosticToggleSwitch.click();\r\n } else {\r\n tau.openPopup(reportDiagnosticPopup);\r\n }\r\n }", "function feedback(message, guid){\n // var pid = getPidForUser(guid);\n var session = getSessionForUser(guid);\n var originalguid = getFirstGuid(guid);\n // send to session pages - control page can display\n io.to(session).emit('feedback', {\"message\": message, \"user\": originalguid});\n }", "function _callLineBoardReport()\r\n{\r\n\tvar htmlAreaObj = _getWorkAreaDefaultObj();\r\n\tvar objHTMLData = htmlAreaObj.getHTMLDataObj();\r\n var changeFields = objHTMLData.getChangeFields();\r\n var objAjax = htmlAreaObj.getHTMLAjax();\r\n bShowMsg = true;\r\n //when user doesn't enter anything and clicks on the report button for the\r\n //first time this check is done\r\n if(objHTMLData.hasUserModifiedData()==false)\r\n {\r\n var htmlErrors = objAjax.error();\r\n objAjax.error().addError(\"errorInfo\", 'Must enter values for: Season', true);\r\n messagingDiv(htmlErrors);\r\n return;\r\n }\r\n\tvar url = 'lineboardreport';// report action method name\r\n\t\r\n\tobjAjax.setActionMethod(url);\r\n\tobjAjax.setActionURL('lineboardreport.do');\r\n\tobjAjax.setProcessHandler(_loadLineBoardReport);\r\n\tobjHTMLData.performSaveChanges(_loadLineBoardReport, objAjax);\r\n}", "function findChannel(server, channelName) {\n\t//find the muddy points channel\n\tlet category = server.channels.cache.find(\n\t\tc => c.name == channelName && c.type == \"text\");\n\t\t\n\tconsole.log(\"Channel found in cache: \"+channelName);\n\t\n\treturn category;\n}", "function generateReport(id, name)\r\n{\r\n\t//Tracker#13895.Removing the invalid Record check and the changed fields check(Previous logic).\r\n\r\n // Tracker#: 13709 ADD ROW_NO FIELD TO CONSTRUCTION_D AND CONST_MODEL_D\r\n\t// Check for valid record to execute process(New logic).\r\n \tif(!isValidRecord(true))\r\n\t{\r\n\t\treturn;\r\n\t}\r\n\r\n\t//Tracker# 13972 NO MSG IS SHOWN TO THE USER IF THERE ARE CHANGES ON THE SCREEN WHEN USER CLICKS ON THE REPORT LINK\r\n\t//Check for the field data modified or not.\r\n\tvar objHtmlData = _getWorkAreaDefaultObj().checkForNavigation();\r\n\r\n\tif(objHtmlData!=null && objHtmlData.hasUserModifiedData()==true)\r\n {\r\n //perform save operation\r\n objHtmlData.performSaveChanges(_defaultWorkAreaSave);\r\n }\r\n else\r\n {\r\n\t\tvar str = 'report.do?id=' + id + '&reportname=' + name;\r\n \toW('report', str, 800, 650);\r\n }\r\n\r\n}", "function selectChannel () {\r\n let data = localStorage.getItem('channel');\r\n\r\n // select form can change channel - maybe this could be placed elsewhere?\r\n const select = document.querySelector('#channelDatalist');\r\n select.addEventListener(\"change\", (option) => {\r\n changeChannel(option.target.value);\r\n });\r\n if (data && data != \"undefined\") {\r\n currentChannel = data;\r\n loadChannel(data);\r\n } else {\r\n localStorage.removeItem('channel');\r\n }\r\n}", "static set reports(value) {}", "function irclient2(req, res, next){\n var db = require('../../lib/database')();\n db.query(`SELECT COUNT(*) AS CNT FROM tblreport INNER JOIN tbluser ON intReporterID = intID WHERE strType = 'Client' AND (datDateReported BETWEEN '${req.body.datefrom}' AND '${req.body.dateto}')`, function (err, results) {\n if (err) return res.send(err);\n req.irclient = results;\n return next();\n });\n}", "function requestHistory() {\n pubnub.history(\n {\n channel: CHANNEL_NAME_COLOR,\n count: 1, // how many items to fetch. For this demo, we only need the last item.\n },\n function (status, response) {\n if (status.error === false) {\n let lastColorMessage = response.messages[0].entry[CHANNEL_KEY_COLOR];\n let lastDuckName = response.messages[0].entry[CHANNEL_KEY_DUCKNAME];\n let timet = response.messages[0].timetoken;\n updateDuckColor(lastColorMessage, lastDuckName, timet);\n logReceivedMessage(response.messages, \"color history\");\n } else {\n console.log(\"Error recieving \" + CHANNEL_NAME_COLOR + \" channel history:\");\n console.log(status);\n }\n }\n );\n pubnub.history(\n {\n channel: CHANNEL_NAME_TALK,\n count: 1, // how many items to fetch. For this demo, we only need the last item.\n },\n function (status, response) {\n // Response returns messages in an array (even if request.count == 1)\n if (status.error === false) {\n let lastTalkMessage = response.messages[0].entry[CHANNEL_KEY_TEXT];\n let lastDuckName = response.messages[0].entry[CHANNEL_KEY_DUCKNAME];\n let timet = response.messages[0].timetoken;\n updateDuckTalk(lastTalkMessage, lastDuckName, timet);\n logReceivedMessage(response.messages, \"talk history\");\n } else {\n console.log(\"Error recieving \" + CHANNEL_NAME_TALK + \" channel history:\");\n console.log(status);\n }\n }\n );\n}", "function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}", "listenReports(socket) {\n socket.off(constants.SCC_SEMVER_REPORT_EVENT)\n socket.on(constants.SCC_SEMVER_REPORT_EVENT, this.checkIncomingReport.bind(this, socket))\n return 'listening for reports'\n }", "function slackSend() {\n var total = 0\n var attachments = []\n var statusColor\n Object.keys(stats).map(function(objectKey, i) {\n total += stats[objectKey][0]\n if (stats[objectKey][0] > stats[objectKey][3]) {\n statusColor = disqusRed\n statusIcon = \"🔥\"\n } else if (stats[objectKey][0] <= 5) {\n statusColor = disqusGreen\n statusIcon = \":partyporkchop:\"\n } else {\n statusColor = disqusGreen\n statusIcon = \"🆒\"\n }\n attachments.push({\n \"fallback\": stats[objectKey][0] + \" total\" + stats[objectKey][1] + \" new\" + stats[objectKey][2] + \" open\",\n \"color\": statusColor, \n \"title\": statusIcon + \" \" + objectKey + \": \" + stats[objectKey][0],\n \"text\": stats[objectKey][1] + \" new, \" + stats[objectKey][2] + \" open\"\n })\n });\n \n let statusMessage = {\n \"response_type\": \"in_channel\",\n \"text\": total + \" total cases right now.\",\n \"attachments\": attachments\n }\n // depending on request origin, also send the response as webhook for daily notifications\n if (type === 'notification') {\n webhook({text:\"Morning report incoming!\"});\n webhook(statusMessage);\n }\n res.send(statusMessage);\n // TODO Write function that stores this data to database\n //store(stats);\n }", "function getLastThingSpeakData3(){\n console.log(\"aaaaaaaaaaaaaaaaaaa\")\n var channel_id = 196384; //id do canal\n var field_number1 = 1; //numero do field\n var field_number2 = 2; //numero do field\n var field_number3 = 3 //3\n var field_number4 = 4 //4\n var num_results = 500; //numero de resultados requisitados\n\n\n}", "function channelHandler(agent) {\n console.log('in channel handler');\n var jsonResponse = `{\"ID\":10,\"Listings\":[{\"Title\":\"Catfish Marathon\",\"Date\":\"2018-07-13\",\"Time\":\"11:00:00\"},{\"Title\":\"Videoclips\",\"Date\":\"2018-07-13\",\"Time\":\"12:00:00\"},{\"Title\":\"Pimp my ride\",\"Date\":\"2018-07-13\",\"Time\":\"12:30:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:30:00\"},{\"Title\":\"Daria\",\"Date\":\"2018-07-13\",\"Time\":\"13:45:00\"},{\"Title\":\"The Real World\",\"Date\":\"2018-07-13\",\"Time\":\"14:00:00\"},{\"Title\":\"The Osbournes\",\"Date\":\"2018-07-13\",\"Time\":\"15:00:00\"},{\"Title\":\"Teenwolf\",\"Date\":\"2018-07-13\",\"Time\":\"16:00:00\"},{\"Title\":\"MTV Unplugged\",\"Date\":\"2018-07-13\",\"Time\":\"16:30:00\"},{\"Title\":\"Rupauls Drag Race\",\"Date\":\"2018-07-13\",\"Time\":\"17:30:00\"},{\"Title\":\"Ridiculousness\",\"Date\":\"2018-07-13\",\"Time\":\"18:00:00\"},{\"Title\":\"Punk'd\",\"Date\":\"2018-07-13\",\"Time\":\"19:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"20:00:00\"},{\"Title\":\"MTV Awards\",\"Date\":\"2018-07-13\",\"Time\":\"20:30:00\"},{\"Title\":\"Beavis & Butthead\",\"Date\":\"2018-07-13\",\"Time\":\"22:00:00\"}],\"Name\":\"MTV\"}`;\n var results = JSON.parse(jsonResponse);\n var listItems = {};\n textResults = getListings(results);\n\n for (var i = 0; i < results['Listings'].length; i++) {\n listItems[`SELECT_${i}`] = {\n title: `${getShowTime(results['Listings'][i]['Time'])} - ${results['Listings'][i]['Title']}`,\n description: `Channel: ${results['Name']}`\n }\n }\n\n if (agent.requestSource === 'hangouts') {\n const cardJSON = getHangoutsCard(results);\n const payload = new Payload(\n 'hangouts',\n cardJSON,\n {rawPayload: true, sendAsMessage: true},\n );\n agent.add(payload);\n } else {\n agent.add(textResults);\n }\n}", "function generateTeamReport() {\n var dialog1 = {\n 'title': 'Response Form',\n 'customTitle': false,\n 'subText': 'Would you like to generate a team report?'\n };\n \n var dialog2 = {\n 'title': 'Enter Time Tracking Response Link',\n 'subText': 'Please enter the response link to generate team report:'\n };\n \n reportDialog(dialog1, createTeamReport, dialog2);\n}", "onClientOpened() {\n this.channels = _.keys(this.slack.channels)\n .map(k => this.slack.channels[k])\n .filter(c => c.is_member);\n\n this.groups = _.keys(this.slack.groups)\n .map(k => this.slack.groups[k])\n .filter(g => g.is_open && !g.is_archived);\n\n this.dms = _.keys(this.slack.dms)\n .map(k => this.slack.dms[k])\n .filter(dm => dm.is_open);\n\n console.log(`Welcome to Slack. You are ${this.slack.self.name} of ${this.slack.team.name}`);\n\n if (this.channels.length > 0) {\n console.log(`You are in: ${this.channels.map(c => c.name).join(', ')}`);\n } else {\n console.log('You are not in any channels.');\n }\n\n if (this.groups.length > 0) {\n console.log(`As well as: ${this.groups.map(g => g.name).join(', ')}`);\n }\n\n if (this.dms.length > 0) {\n console.log(`Your open DM's: ${this.dms.map(dm => dm.name).join(', ')}`);\n }\n }" ]
[ "0.6045982", "0.60354316", "0.5868806", "0.58020276", "0.57129234", "0.5711092", "0.5693896", "0.5583567", "0.55673665", "0.5566418", "0.5545174", "0.5532798", "0.5529501", "0.5511182", "0.5510019", "0.54998803", "0.545792", "0.54545987", "0.5444427", "0.5440843", "0.54334974", "0.53771293", "0.5375108", "0.5374788", "0.53610843", "0.5323261", "0.5312313", "0.52934945", "0.5261032", "0.5259988", "0.52591085", "0.5256108", "0.5250262", "0.5244424", "0.5236341", "0.52262455", "0.52228206", "0.5197185", "0.5194472", "0.5187132", "0.5184132", "0.51797444", "0.5168584", "0.5168062", "0.5163505", "0.5157066", "0.515319", "0.5152743", "0.5143902", "0.5135128", "0.5134191", "0.5121372", "0.5117548", "0.51114196", "0.51089376", "0.5097451", "0.5096988", "0.5094205", "0.5086481", "0.50863636", "0.5078091", "0.50779384", "0.50759155", "0.50561", "0.5050541", "0.50458354", "0.50415194", "0.50414395", "0.5030457", "0.5025435", "0.5023008", "0.5019793", "0.5018566", "0.50162417", "0.50084585", "0.5004255", "0.5000064", "0.4995966", "0.4990607", "0.4987396", "0.49865893", "0.49865597", "0.49825075", "0.4979415", "0.49632806", "0.49597752", "0.4957599", "0.495523", "0.49494445", "0.49482116", "0.49472287", "0.49343207", "0.49323308", "0.49300787", "0.49294978", "0.4927832", "0.492578", "0.49230444", "0.49153867", "0.49135113" ]
0.49428362
91
cancels a user's asking time in a channel
function cancelAskingTime(user, channel) { controller.storage.teams.get('askingtimes', function(err, askingTimes) { if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) { return; } else { delete askingTimes[channel][user]; controller.storage.teams.save(askingTimes); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "cancel() {\n return this.channel.basicCancel(this.tag)\n }", "cancelA2HSprompt(_this) {\n document.getElementById('cancel-btn').addEventListener('click', () => {\n _this.delayA2HSprompt();\n _this.hideMsg();\n });\n }", "function OnCancelAndUnlockPressed()\n{\n\t// Unlock the team selection, allowing the players to change teams again\n\tGame.SetTeamSelectionLocked( false );\n\n\t// Stop the countdown timer\n\tGame.SetRemainingSetupTime( -1 ); \n}", "function cancelForgotUsername(){\n\tcloseWindow();\n}", "canceled() {}", "cancel(silent) {\n // Update database\n app.database.finishGame(this);\n\n if(this.staff_alert != null){\n clearInterval(this.staff_alert);\n this.staff_alert = null;\n }\n // Delete channels\n app.discordClient.channels.fetch(this.category).then(category => {\n (async ()=>{\n for(const channel of category['children']){\n await channel[1].delete()\n }\n category.delete().then(null);\n })();\n })\n\n // Remove object\n app.gamemap = removeItemAll(app.gamemap,this);\n\n // Message players\n if(silent === undefined || silent === false) {\n this.players.forEach(player => {\n // Give queue priority for 5 minutes\n app.queuemap[this.guild['id']].priority.push({\n player: player,\n expires: (new Date()).getTime()+60000\n });\n\n // Direct message player\n app.discordClient.users.resolve(player).send(new MessageEmbed().setColor(\"RED\").setTitle(\"Your match has been cancelled\").setDescription(`The game ${this.id} has been cancelled. You have been returned to the queue.\\n\\n**If you re-queue within a minute you will be at the top**`)).then(null);\n });\n }\n\n delete this;\n }", "async function ChooseChanForDelete()\n{\n\tlet choice = []\n\tawait objActualServer.server.channels.forEach((channel) =>\n\t{\n\t\tif (channel.type == \"text\")\n\t\t{\n\t\t\tchoice.push(\n\t\t\t{\n\t\t\t\tname: channel.name,\n\t\t\t\tvalue: channel\n\t\t\t})\n\t\t}\n\t})\n\tchoice.push(\n\t\t{\n\t\t\tname: \"Retournez au choix des actions\",\n\t\t\tvalue: -1\n\t\t},\n\t\treturnObjectLeave()\n\t)\n\n\tlet response = await ask(\n\t{\n\t\ttype: \"list\",\n\t\tmessage: \"Choissisez le serveur à supprimer DISCLAIMER !!!!! Cette action est irréversible !!!! DISCLAIMER\",\n\t\tchoices: choice,\n\t\tname: \"selectedChan\"\n\t})\n\tif (response.selectedChan == -1)\n\t{\n\t\taskWhatToDoChan()\n\t}\n\telse if (response.selectedChan == -2)\n\t{\n\t\tendProcess()\n\t}\n\telse\n\t{\n\t\tdoDeleteChannel(response.selectedChan)\n\t}\n\n\n}", "function Cancellation() { }", "function countdown() {\n if (timer > 0) {\n timer--;\n $(\"#time\").text(timer)\n }\n else {\n var buttonData = {\n userId: socket.id,\n buttonClicked: 'none',\n timeLeft: 0\n }\n userAnswers.push(buttonData);\n newMeme();\n return;\n }\n }", "function cancel() {\n\t// If enabled, play a sound.\n\tchrome.storage.sync.get({\n\t\tsounds: defaultSettings.sounds\n\t}, function(settings) {\n\t\tif(settings.sounds) {\n\t\t\tdocument.getElementById(\"cancelSound\").play();\n\t\t}\n\t});\n\tclosePopup();\n}", "cancel() {\n this.logout();\n this.isCancelled = true;\n }", "cancel() {\n if (this.midPrompt()) {\n this._cancel = true;\n this.submit('');\n this._midPrompt = false;\n }\n return this;\n }", "cancel() {\n\n }", "function decrement(){\n $(\"#timerArea\").html(\"Time remaining: \" + seconds)\n seconds--\n if (seconds < 0){\n $(\"#messageArea\").html(message.time);\n clearInterval(timer);\n timeOut = false\n answer();\n }\n}", "function cancelGame(){\n\t\t\n\t\t//show a warning message before cancelling \n\t\t $('<div>').simpledialog2({\n\t\t\t mode: 'button',\n\t\t\t headerText: 'Sure?',\n\t\t\t headerClose: true,\n\t\t\t buttonPrompt: 'This will reset all the images selected till now',\n\t\t\t buttons : {\n\t\t\t 'Yes': {\n\t\t\t click: function () { \n\t\t\t resetcreategamepage();\n\t\t\t }\n\t\t\t },\n\t\t\t 'No': {\n\t\t\t click: function () { \n\t\t\t //$('#buttonoutput').text('Cancel');\n\t\t\t // do nothing\n\t\t\t },\n\t\t\t icon: \"delete\",\n\t\t\t theme: \"b\"\n\t\t\t }\n\t\t\t }\n\t\t });\n\t}", "cancel() {}", "function cancelstehenbleiben(){\n clearTimeout(stehenbleibencancel);\n}", "function cancelOption(){\n document.getElementById(\"newOption\").style.display = \"none\";\n document.getElementById(\"pollSelection\").value = \"\";\n document.getElementById(\"newOptionValue\").value = \"\";\n document.getElementById(\"optionWarning\").innerHTML = \"\";\n }", "cancelInput() {\n this.closeSettings();\n }", "function decrement () {\n time--;\n $(\"#timeRemainingEl\").html(\"Time remaining: \" + time);\n\n if (time === 0) {\n clickOptionOn = false;\n guessResult = 2;\n correctAnsFunc();\n countMissedGuess++;\n transitionFunc();\n }\n }", "function cancelMyBid() {\n\n}", "function cancelAlarm(e) {\r\n if (e.keyCode !== 13)\r\n return;\r\n id = document.getElementById(\"alarmCancel\").value;\r\n chrome.alarms.getAll(function (alarms) {\r\n if (id <= 0 || alarms.length < id) {\r\n alert(\"Alarm \" + id + \" does not exist!\");\r\n return;\r\n }\r\n chrome.alarms.clear(alarms[id - 1].name);\r\n });\r\n}", "function cancel(event, response, model) {\n model.exitQuestionMode();\n const speech = speaker.get(\"WhatToDo\");\n response.speak(speech)\n .listen(speech)\n .send();\n}", "function count() {\n time--;\n displayCurrentTime();\n\n if (time < 1) {\n console.log('Out of time, I guess...');\n prependNewMessage('alert-danger', 'OUT OF TIME!!!!');\n stopTimer();\n setTimeout(nextQuestion, 1.2 * 1000);\n }\n }", "function user_disconnect() {\n\n console.log(\"User disconnected.\");\n\n\n if (consumer.paymentTx.amount - consumer.paymentTx.paid <= min_initial_payment)\n {\n console.log(\"User tried to disconnect but the channel is almost done\");\n jQuery('#repayment_prompt').html(\"Channel already depleted. Please wait one moment.\");\n }\n else\n {\n // we send an error message here to allow for possibility of reopening channel.\n // this should probably be made more robust in future\n var msg = new Message({\n \"type\": Message.MessageType.ERROR,\n \"error\": {\n \"code\": ChannelError.ErrorCode.OTHER\n }\n });\n send_message(msg);\n cancel_payments();\n\n // set this to false so websockets don't automatically reopen the channel\n open_channel = false;\n\n set_channel_state(CHANNEL_STATES.SENT_ERROR);\n set_ui_state(UI_STATES.USER_DISCONNECTED);\n }\n}", "function wrongAnswer() {\n secondsLeft -= 10;\n}", "_maybeCancelCountdown(lobby) {\n if (!this.lobbyCountdowns.has(lobby.name)) {\n return\n }\n\n const countdown = this.lobbyCountdowns.get(lobby.name)\n countdown.timer.reject(new Error('Countdown cancelled'))\n this.lobbyCountdowns = this.lobbyCountdowns.delete(lobby.name)\n this._publishTo(lobby, {\n type: 'cancelCountdown',\n })\n this._publishListChange('add', Lobbies.toSummaryJson(lobby))\n }", "function cancel() {\r\n click(getCancel());\r\n waitForElementToDisappear(getCancel());\r\n }", "function endCondition_outOfTime() {\n outOfTime_count++;\n let headingText = \"Out of Time\";\n let giveDetails = \"The correct answer was:\";\n callModal(headingText, giveDetails);\n }", "function decrement() {\n\n // Time decreasing (--)\n timer--;\n\n //Display remaining time\n $(\"#timeclock\").html(\"<h2>Time Left: \" + timer + \"</h2>\");\n \n // Surpassing the Time Limit for Questions\n if (timer === 0) {\n //Alert the user that time is up.\n $('#start').html('<h2>You ran out of time! The correct answer is: '+correctoptions[optionIndex]+'</h2>');\n\t\t$(\"#option0, #option1, #option2, #option3\").hide();\n\t\timagedisplay();\n\t endgame();\n\t\tsetTimeout(nextquestion, 5000);\n\t\tunanswered++;\n }\n \t}", "create_time_prompt(message,callback)\n{\n\nthis.trigger_count_down_bar(callback);\n\n//this.messages.showAndHideMessage('Will you enter the fear now?',0,1800);\nthis.messages.showAndHideMessage(message,0,1800);\n}", "cancel(req, err) {\n\t\tif (typeof req === 'object') {\n\t\t\treq = req.request_id; // unwrap request\n\t\t}\n\t\terr = wrap_error(err, 'user cancelled');\n\t\tconst query = this.req_map[req];\n\t\tif (!query) return;\n\t\tthis.reject_query(query, err);\n\t\tthis.schedule_idle();\n\t\treturn query.sent;\n\t}", "function LoopAndCancelRequests(data){\r\n\tfor (var i = 0; i < UserChallenges.length; i++) {\r\n\t\tvar tempArrray = UserChallenges[i].split(\" \");\r\n\t\tif(username == tempArrray[0] && data == tempArrray[1] || username == tempArrray[1] && data == tempArrray[0]){\r\n\t\t\tsocket.emit(\"challenge cancel\", {USER: tempArrray[0], OPPONENT: tempArrray[1]});\r\n\t\t}\r\n\t}\t\r\n}", "acceptCancel() {}", "function changeQIncorrect() {\n changeQ();\n messageArea.textContent = \"INCORRECT! -5 Sec!\";\n\n // Subtract 5 Seconds\n secondsLeft -= 5;\n\n }", "async function askWhatToDoChan()\n{\n\tlet choice = []\n\tchoice.push(\n\t\t{\n\t\t\tname: \"Supprimer un channels\",\n\t\t\tvalue: \"delete\"\n\t\t},\n\t\t{\n\t\t\tname: \"Créer un channel\",\n\t\t\tvalue: \"create\"\n\t\t},\n\t\t{\n\t\t\tname: \"Retournez à la liste précédente\",\n\t\t\tvalue: -1\n\t\t},\n\t\treturnObjectLeave()\n\t)\n\n\tlet response = await ask(\n\t{\n\t\ttype: \"list\",\n\t\tmessage: \"Qulle channels voulez vous gèrer ?\",\n\t\tname: \"response\",\n\t\tchoices: choice\n\t})\n\n\tif (response.response == -1)\n\t{\n\t\tchooseWhatToHandle()\n\t}\n\telse if (response.response == -2)\n\t{\n\t\tendProcess()\n\t}\n\telse if (response.response == \"delete\")\n\t{\n\t\tChooseChanForDelete()\n\t}\n\telse if (response.response == \"create\")\n\t{\n\t\tcreateChan()\n\t}\n\n\n}", "function outOfTime() {\n extraMessage.text(\"OOPS! TIME'S UP!\");\n extraMessage.css(\"visibility\", \"visible\");\n\n displayCorrectAnswer();\n\n // add 1 to count of unanswered questions\n unansweredCount++;\n\n // increment the question # counter\n questionCounter++;\n\n // stop the timer \n stopTimer();\n\n // after a delay, display a new question\n setTimeout(newQuestion, delayTime);\n }", "cancel() {\n if (!this._flying) {\n return;\n }\n this._flying = false;\n this._time1 = null;\n this._time2 = null;\n if (this._callback) {\n this._callback = null;\n }\n this.fire(\"canceled\", true, true);\n }", "clearUser(channel) {\n\t\treturn this._sendMessage(JSON.stringify({type: \"clearUser\", displayName: channel}), (resolve, reject) => {\n\t\t\tresolve([channel]);\n\t\t});\n\t}", "function onCanceled(cancelSender, cancelReason) {\n cancel = true;\n }", "function countdown() {\n time--;\n timerCountdown.textContent = time;\n\n // check if user ran out of time\n if (time <= 0) {\n quizEnd();\n }\n}", "function cancelBox() {\n\tvar cancelDiv=$('cancelPetFeeder');\n\tif (!cancelDiv && (GM_getValue('feeding',false)||GM_getValue('feedEquip',false))) {\n\t\tvar cancelDiv=makeBox('PotatoPetFeeder: ','cancelPetFeeder');\n\t\t\n\t\tvar cancelButton=makeButton('Let them starve!');\n\t\tcancelButton.addEventListener('click', \n\t\t\t\tfunction() {\n\t\t\t\t\tstopFeeding();\n\t\t\t\t\tdocument.body.removeChild($('cancelPetFeeder'));\n\t\t\t\t}, true);\n\t\tcancelDiv.appendChild(cancelButton);\n\t\tdocument.body.insertBefore(cancelDiv, document.body.firstChild);\n\t}\n\telse if (cancelDiv && !(GM_getValue('feeding',false)||GM_getValue('feedEquip',false)) ) {\n\t\tdocument.body.removeChild(cancelDiv);\n\t}\n}", "function actionCanceled() { \n\tOK = 3;\n\tdlg.hide();\n}", "function reject(){\n\tconsole.log('call rejected');\n\tsocket.emit('reject',$callerName.innerHTML);\n\t$acceptButtons.style.display = 'none';\n\t$addToConferenceButtons.style.display = 'none';\n\t$caller.style.display = 'none';\n\t$ringingSound.pause();\n}", "function handleCancelButton() {\n\t\tconsole.log(\"Now cancelling action..\");\n\t\tCounterStart = 0; \t// reset counter\t\t\t\t\n\t\tcloseCancelPopup();\n\t\trevertChanges(command);\n\t\tconsole.log(\"Reverting changes..\");\t\n\t}", "function closeQuest() {\n if ($scope.userToPay.user) {\n Issues.payAndClose(Number($scope.userToPay.user), $scope.questBounty, $scope.chosenQuest.id);\n $state.go('questFeed');\n } else {\n toastr.error(\"Please select the user who solved your issue\", {\n closeButton: true,\n timeOut: 5000,\n extendedTimeOut: 10000\n });\n }\n }", "async function clearGameStatusMsg (time) {\n await timeout(time);\n setGameStatusMsg('');\n }", "async function handleCancel() {\n if (\n name !== \"\" ||\n cpf_cnpj !== \"\" ||\n rg !== \"\" ||\n phone !== \"\" ||\n email !== \"\"\n ) {\n confirmationAlert(\n \"Atenção!\",\n \"Deseja realmente CANCELAR esse cadastro? Os dados não salvos serão perdidos.\",\n \"clearFields\"\n );\n }\n }", "function countdown() {\n\ttime--;\n $(\".timer\").html(\"Time Left: \" + time);\n if (time === 0) {\n clearInterval(intervalId);\n noAnswer();\n }\n }", "function watchCancelChatRequest(action) {\n var recUserId, authedUser, uid;\n return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_1___default.a.wrap(function watchCancelChatRequest$(_context13) {\n while (1) {\n switch (_context13.prev = _context13.next) {\n case 0:\n recUserId = action.payload.recUserId;\n _context13.next = 3;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_8__[\"select\"])(_store_reducers_authorize_authorizeSelector__WEBPACK_IMPORTED_MODULE_12__[\"authorizeSelector\"].getAuthedUser);\n\n case 3:\n authedUser = _context13.sent;\n uid = authedUser.get('uid');\n\n if (!uid) {\n _context13.next = 15;\n break;\n }\n\n _context13.prev = 6;\n _context13.next = 9;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_8__[\"call\"])(chatService.cancelChatRquest, recUserId);\n\n case 9:\n _context13.next = 15;\n break;\n\n case 11:\n _context13.prev = 11;\n _context13.t0 = _context13[\"catch\"](6);\n _context13.next = 15;\n return Object(redux_saga_effects__WEBPACK_IMPORTED_MODULE_8__[\"put\"])(_store_actions_globalActions__WEBPACK_IMPORTED_MODULE_11__[\"showMessage\"](_context13.t0.message));\n\n case 15:\n case \"end\":\n return _context13.stop();\n }\n }\n }, _marked13, null, [[6, 11]]);\n}", "function decrement() {\n \n // Decrease seconds by one.\n seconds--;\n \n // Show the seconds remaining in the #time tag.\n $(\"#time\").html(\"<h2>Time remaining: \" + seconds + \" Seconds</h2>\");\n \n // If seconds hits zero run the questionStatus function.\n if (seconds === 0) {\n \n questionStatus(\"unanswered\");\n \n }\n\n }", "function count() {\n time--;\n $(\".timer\").text(time);\n if (time <= 0) {\n clearInterval(questionInterval);\n buttonClicked(0);\n // calling the buttonClicked function as if unanswered = wrong.\n }\n }", "function getAskingTime(user, channel, cb) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {\n cb(null,null);\n } else {\n cb(null, askingTimes[channel][user]); \n }\n }); \n}", "function decrementQuestionTime() {\n\tquestionTime--;\n\tif (questionTime === 0) {\n\t\tisQuestionTimeout = true;\n\t}\n\telse {\n\t\tstrH4 = \"\";\n\t\tstrH4 = \"<h4 id=\\\"time-remaining\\\">Time Remaining: \" + questionTime + \" Seconds</h4>\";\n\t\t$(\"#time-remaining\").html(strH4);\n\t}\n}", "function PromptNotActive(){}", "cancel() {\n if (this.factionAction) this.player.role.side.setFactionAction(null);\n this.player.engine.events.emit(\"cancelAction\", this.player);\n this.player.action = null;\n }", "function incorrect() {\n timeLeft -=20;\n nextQuestion();\n}", "cancel() {\n cancel();\n }", "promptPlayerForExchangeChoice() {\n if (this.currentPlayer.isComputer) {\n let announcement = computerPlayerMessage(`Choosing influences to return`);\n this.currentPlayer.renderControls(announcement);\n const [idx1, idx2] = this.currentPlayer.randExchangeIdx();\n setTimeout(() => {\n this.currentPlayer.exchangePartTwo(idx1, idx2);\n this.endTurn();\n }, 1000);\n } else {\n let exchangeForm = exchangeSelectorForm(this.currentPlayer);\n this.currentPlayer.renderControls(exchangeForm);\n exchangeForm.addEventListener('submit', (e) => {\n e.preventDefault();\n exchangeForm.remove();\n this.domState = this.domState.refresh();\n const [idx1, idx2] = this.domState.exchangeIndices;\n this.currentPlayer.exchangePartTwo(idx1, idx2);\n this.endTurn();\n })\n }\n }", "function checkTimesAndAskStandup(bot) {\n getAskingTimes(function (err, askMeTimes) {\n \n if (!askMeTimes) {\n return;\n }\n\n for (var channelId in askMeTimes) {\n\n for (var userId in askMeTimes[channelId]) {\n\n var askMeTime = askMeTimes[channelId][userId];\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n if (compareHoursAndMinutes(currentHoursAndMinutes, askMeTime)) {\n\n hasStandup({user: userId, channel: channelId}, function(err, hasStandup) {\n\n // if the user has not set an 'ask me time' or has already reported a standup, don't ask again\n if (hasStandup == null || hasStandup == true) {\n var x = \"\";\n } else {\n doStandup(bot, userId, channelId);\n }\n });\n }\n }\n }\n });\n}", "async cancel() {\n throw new Error(this.cancelMessage);\n }", "function timeStop(){\n\tgameTime = clearInterval();\n\t//save score\n\tvar response = confirm(\"YOU WIN, CONGRATS!\\nYour game time was \" + t + \" seconds\\nDo you want to save your score?\");\n\tif(response == true)\n\t\tsaveScore();\n}", "cancel() {\n if (this.isCancelDisabled)\n return;\n this.isCancelDisabled = true;\n this.closeEnrollment_('cancel');\n }", "function cancel() {\r\n const wrapper = document.querySelector(\".afhalen-wrapper\");\r\n wrapper.style.display = \"none\";\r\n resetState();\r\n // just to clear the error box\r\n sendErrorMessage(\"\");\r\n\r\n }", "function facebookDisconnectAlertCancel(){\n\tfbDisconnectPlayerAlert.hide();\n\tbackHomeSettingsButton.touchEnabled = true;\n\tswitchSounds.touchEnabled = true;\n\tswitchMusic.touchEnabled = true;\n}", "function cancelBids () {\n}", "function timer() {\n time = 10;\n broadcastChannel.publish('timeUpdate', {\n 'time': time,\n 'timeout': 0\n });\n clock = setInterval(countdown, 1000);\n function countdown() {\n if (time > 1) {\n broadcastChannel.publish('timeUpdate', {\n 'time': time,\n 'timeout': 0\n });\n time--;\n } else {\n clearInterval(clock);\n broadcastChannel.publish('timeUpdate', {\n 'time': time,\n 'timeout': 1\n });\n publishCorrectAnswer(index)\n };\n };\n}", "function countdown () {\n\ttimer--;\n\t$(\"#timeRemaining\").text(timer);\n\n\t// User ran out of time to answer the question\n\tif (timer === 0) {\n\t\tcheckAnswer(\"timeUp\");\n\t}\n}", "function cancelHandler() {\n privacy.innerText = \"\";\n}", "function onPublisherCredOfferCancel() {\n socket.emit(\"publisher-cred-offer-unsub\", uuid);\n setPublisherCredentialOffer(false);\n }", "function waitForCancel(feed) {\n feed.once('cancelled', function() {\n cancelled = true;\n });\n }", "function cancel(domain, id) {\n \n\t$.getJSON(domain + \"/turtlebot-server/coffee_queue.php?update&id=\" \n + id + \"&status=failed\", function (data) {\n\t\t$.each(data, function (key, val) {\n\t\t\tif (data[\"updated\"] == \"1\") {\n\t\t\t\tconsole.log(\"success\");\n document.getElementById('status').innerHTML = \"success\";\n\t\t\t}\n\t\t});\n\t});\n}", "promptPlayerForLostChallengeChoice() {\n if (this.currentPlayer.isComputer) {\n let announcement = computerPlayerMessage(`Lost Challenge`);\n this.currentPlayer.renderControls(announcement);\n setTimeout(() => {\n this.playerLostChallenge = true;\n this.playerLostChallengeIdx = this.currentPlayer.randKillIdx();\n this.settled = true;\n this.endTurn();\n }, 1000);\n } else {\n let announcement = computerPlayerMessage(`Won Challenge`);\n this.currentTarget.renderControls(announcement);\n this.playerLostChallenge = true;\n let lostChallengeForm = loseCardSelector('challenge', this.currentPlayer);\n this.currentPlayer.renderControls(lostChallengeForm);\n lostChallengeForm.addEventListener('submit', (e) => {\n e.preventDefault();\n lostChallengeForm.remove();\n this.domState = this.domState.refresh();\n this.playerLostChallengeIdx = this.domState.playerLostChallengeIdx;\n this.settled = true;\n this.endTurn();\n })\n }\n }", "async run (client, message, args) {\n if (await this.checkGiveawayPerms(message)) return message.channel.send(`<@${message.author.id}> Sorry but you dont have the required role or permissions to run this command`);\n\n // There a lot going on here i wont add a comment through everything but ill give the basic structure of the actual parameters\n // message = the discord.js message class builder\n // questions = [\n // [{question : string},{answer validation : arrow-function}],\n // ...\n // ]\n // answers = []; this is just a chosen data structure for me to put the answers into\n // index = {number : int}; default is 0\n // retry = {number : int}; default is 0 and recommended to keep it that way\n\n this.askQuestions(message, [\n ['Alright lets get started (type **cancel** at any time to abort the giveaway),\\nHow long is this giveaway going to last for? **`in the format of days:hours:minutes:seconds`**', (answer) => {\n let time = Number(answer);\n if (isNaN(time)) {\n if (!answer.includes(':')) { message.channel.send(`**${answer}** is an invalid time format, try again`); return false; }\n answer = answer.split(':');\n if (answer.length > 4) { message.channel.send('too many time arguments passed in, try again'); return false; }\n\n let milli = 0;\n\n for (let i = 0; i < answer.length; i++) {\n const item = Number(answer[(answer.length - 1) - i]);\n if (isNaN(item)) { message.channel.send(`**${item}** is not a number, try again`); return false; }\n\n if (i == 3) { milli += item * 24 * (1000 * Math.pow(60, i - 1)); } else { milli += item * (1000 * Math.pow(60, i)); }\n }\n\n time = milli;\n }\n\n if (time <= 0) { message.channel.send('Giveaway duration can\\'t be 0 or smaller, try again'); return false; }\n if (time >= 5184000000) { message.channel.send('Giveaway duration can\\'t be larger than 2 months sorry, try again'); return false; }\n\n return true;\n }],\n ['Sweet, how many winners?', (answer) => {\n answer = Number(answer);\n if (isNaN(answer)) { message.channel.send(`**${answer}** is not a number, try again`); return false; }\n if (answer < 1) { message.channel.send(`**${answer}** is too small you fool, try again`); return false; }\n if (answer > message.guild.memberCount) { message.channel.send('Winner argument can\\'t be more than the guilds member count, try again'); return false; }\n return true;\n }],\n ['What about the title?', (answer) => {\n const val = answer.length < 256;\n if (!val) message.channel.send('Title needs to be 256 characters or less, try again');\n return val;\n }],\n ['An Image would look nice with this giveaway **(type `no` if you don\\'t want to see an image on this giveaway)**', (answer) => {\n if (answer.toLowerCase().includes('no')) return true;\n if (!isImageUrl(answer)) { message.channel.send('Ah! Either the image url is invalid or does not end with a image file extenstion (pst like **.png** or **.jpg**)'); return false; }\n return true;\n }],\n ['Oh! before I forget who is hosting the giveaway? **(type `me` if you want to set yourself as the host)**', (answer) => {\n if (answer.toLowerCase() == 'me') return true;\n\n if (!isNaN(Number(answer))) {\n const tag = message.channel.members.get(answer);\n if (!tag) { message.channel.send(`Can\\'t find the guild member by that id of **${answer}**, try again`); return false; }\n }\n\n return true;\n }],\n ['and... the channel? **(type `here` if you want the giveaway to be posted in this channel)**', async (answer) => {\n if (answer.toLowerCase() == 'here') answer = message.channel.id;\n\n const channel = await this.channelValidation(message, ['-c', answer]);\n if (channel.error) { message.channel.send(channel.error); return false; }\n\n return true;\n }]\n ], []);\n }", "quitSending() {\n getUserId((userID) => {\n location.deleteUserLocation(userID);\n });\n this.setState({isSendingPos: false, timeleft: visibleTimeInSeconds});\n clearInterval(this.timer);\n this.timer = null;\n }", "function askEnd(){\n botui.message.add({\n delay:2000,\n content: 'Do you have any other questions?'\n }).then(function() {\n\n // Show button.\n return botui.action.button({\n delay: 1500,\n action: [\n {icon: 'circle-o', text: 'Yes', value: true},\n {icon: 'close', text: 'No', value: false}]\n });\n }).then(function(res) {\n res.value ? showQuestions() : end();\n });\n }", "function cancelFinding() {\n\t//send request to server to make sure that the user doesn't show up for other clients\n\t$.ajax({\n\t\turl: 'api.php',\n\t\tmethod: 'POST',\n\t\tdata: 'action=remove&userid='+userID,\n\t\tsuccess: function(data) {\t\n\t\t\t//go back to the online menu\n\t\t\t$(\"#findingModal\").hide();\n\t\t\t$(\"#startOnline\").on(\"click\",function(){startOnline()}).one();\n\t\t\t$('#startOnline').addClass('startButton').removeClass('startButtonDisabled');\n\t\t\t$('#pNameInput').prop('disabled',false);\n\t\t}\n\t});\n}", "function cancelQuickClose(row) {\r\n //console.log('Cancel quickclose ' + row);\r\n if (rowCloseStatus[row] != 'waiting' && rowCloseStatus[row] != 'queued') {\r\n throw 'Invalid state sensed in cancelQuickClose(' + row + ')';\r\n }\r\n // Clear timer if set\r\n if (rowCloseTimers[row]) clearInterval(rowCloseTimers[row]);\r\n rowCloseTimers[row] = null;\r\n // Clear queued task if exists\r\n var tasks = findTasks(row, CloseMatchTask);\r\n for (var i = 0; i < tasks.length; i++) {\r\n if (!tasks[i].submitted) {\r\n tasks[i].cancel = true;\r\n } else {\r\n alert('Error in cancelQuickClose(' + row + '): Task already submitted.');\r\n return;\r\n }\r\n }\r\n updateCloseUI(row, 'canceled');\r\n}", "function countDown() {\n // backtick same as quotation marks... dollar sign inject\n timer.innerHTML = `<h2>Timer: ${timerCount}</h2>`;\n timerCount--;\n\n // at timer = 0 stop timer and prompt user to enter name and log score\n if (timerCount === 0) {\n userInitials = prompt(\n \"Game Over! Your score was \" +\n userScore +\n \" ! Please enter your initials to save score!\"\n );\n } else if (qIndex === 5) {\n userInitials = prompt(\n \" Game Over! Your score was \" +\n userScore +\n \" ! Please enter your initials to save score!\"\n );\n }\n}", "function decrement() {\n $(\"#time-remaining\").html(\"<h3>Time remaining: \" + timer + \"</h3>\");\n timer--;\n\n //if timer reaches 0, stop timer and display time is up\n if (timer === 0) {\n unansweredCounter++;\n stop();\n $(\"#answer-display\").html(\"<p>Time is up! The correct answer is: \" + questionSelected.choice[questionSelected.answer] + \"</p>\");\n outcome();\n }\n }", "function questionTimedout() {\n acceptingResponsesFromUser = false;\n\n console.log(\"timeout\");\n $(\"#timer-view\").html(\"- -\");\n $(\".footer\").html(\"Darn! Time out! <br> The correct answer is <strong>\" + questions[currentQuestionToPlay].correctResponse + \"</strong>. <br>Waiting 5 seconds to go next!\");\n\n timeoutCount++;\n $(\"#timeout-view\").html(timeoutCount);\n waitBeforeGoingNextAutomatically();\n}", "function cancel(event, response, model) {\n const pb = model.getPlaybackState();\n if (playbackState.isValid(pb) && !playbackState.isFinished(pb)) {\n response.audioPlayerStop();\n }\n else {\n response.speak(speaker.get(\"Goodbye\"));\n }\n\n response.send();\n}", "cancelAction(){}", "function userTimeout() {\n\t\tif (time === 0) {\n\t\t\t$(\"#gameScreen\").html(\"<p>You ran out of time!</p>\");\n\t\t\tincorrectGuesses++;\n\t\t\tvar correctAnswer = questions[questionCounter].correctAnswer;\n\t\t\t$(\"#gameScreen\").append(\"<p>The answer was <span class='answer'>\" + \n\t\t\t\tcorrectAnswer + \n\t\t\t\t\"</span></p>\" + \n\t\t\t\tquestions[questionCounter].image);\n\t\t\tsetTimeout(nextQuestion, 4000);\n\t\t\tquestionCounter++;\n\t\t}\n\t}", "function userTimeout() {\n\t\tif (time === 0) {\n\t\t\t$(\"#gameScreen\").html(\"<p>You ran out of time!</p>\");\n\t\t\tincorrectGuesses++;\n\t\t\tvar correctAnswer = questions[questionCounter].correctAnswer;\n\t\t\t$(\"#gameScreen\").append(\"<p>The answer was <span class='answer'>\" + \n\t\t\t\tcorrectAnswer + \n\t\t\t\t\"</span></p>\" + \n\t\t\t\tquestions[questionCounter].image);\n\t\t\tsetTimeout(nextQuestion, 4000);\n\t\t\tquestionCounter++;\n\t\t}\n\t}", "function cancelTrack(){\r\n window.arguments[1].action = \"q\";\r\n return true;\r\n}", "function decrement() {\n $(\"#timerL\").html(\"<h3>Watch the clock! \" + timer + \"</h3>\");\n timer--;\n if (timer === 0) {\n unAnswered++;\n stop();\n $(\"#answerblock\").html(\"<p>You didn't watch the clock! The correct answer is: \" + pick.choice[pick.answer] + \"</p>\");\n hidepicture();\n }\n }", "function cancelclosetime() {\n\tif (closetimer) {\n\t\twindow.clearTimeout(closetimer);\n\t\tclosetimer = null;\n\t}\n}", "cancel() {\n if (this.isCloseable_) {\n this.userActed('cancel');\n }\n }", "onCancel() {\n this.props.resetTempSettings();\n }", "function ntCancel() {\n removeMask();\n $('#nt-confirm-box').hide();\n if (nt.confirm_cancel_callback)\n nt.confirm_cancel_callback();\n nt.confirm_cancel_callback = null;\n}", "function unansweredQuestion() {\n unanswered++;\n $(\"#message\").html(\"<span style='color:red';>Time Out !! You failed to choose the answer.</span> <br> The Answer is \" + computerPick.choice[computerPick.answer] + \"</p>\");\n $(\"#time-remaining\").hide();\n $(\".choiceDiv\").hide();\n $(\"#ansImage\").html(\"<img src=\" + computerPick.image + \">\");\n $(\"#message\").show();\n $(\"#ansImage\").show();\n nextQuestion();\n\n }", "function customergetChannel(chname)\n\n{\t\t\tif(activechannel)\n\t\t\t{ \n\t\t\tclient.removeListener('channelUpdated', updateChannels);\n\t\t\t generalChannel.removeListener('typingStarted', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingStarted success\")\n\t\t\t\t\t\ttypingMembers.push(member.identity);\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(erro){\n\t\t\t\tconsole.log(\"typingStarted error\",erro)\n\t\t\t\t});\n\t\t\t\tgeneralChannel.removeListener('typingEnded', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingEnded success\")\n\t\t\t\t\t\ttypingMembers.splice(typingMembers.indexOf(member.identity), 1 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(error){\n\t\t\t\t\n\t\t\t\t\t\tconsole.log(\"typingEnded eror\",error)\n\t\t\t\t});\n\t\t\t}\n\n \n \n\t setTimeout(function() {\n\t\n\t\t\t\t$(\"#\"+chname+\" b\").text(\"\");\n\t\t\t\t$(\"#\"+chname+\" b\").removeClass(\"m-widget4__number\");\n\t\t\t\t$(\"#\"+chname+\" input\").val(0);\n\t\t\t\t$(\".m-widget4__item\").removeClass(\"active\");\n\t\t\t\t$(\"#\"+chname).addClass(\"active\");\n\t\t\t\t\n\t\t\t\t\t$(\"#chatmessage\").html(\"\");\n\t\t\t\t$(\".loader\").show();\n\t\t\t\t client.getChannelByUniqueName(chname).then(function(channel) {\n\t\t\t\t\t\t\tconsole.log(\"channel\",channel)\n\t\t\t\t\t\t\tgeneralChannel = channel;\n\t\t\t\t\t\t \n\t\t\t\t\t$(\"#channel-title\").text(channel.state.friendlyName);\t\n\t\t\t\t\t\t\t\tsetupChannel(generalChannel);\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t},function (error){\n\t\t\t\t\n\t\t\t\t\t\t console.log(\"error\",error)\n\t\t\t\t\t\t});\n\t\n\t }, 10);\n \n \n}", "function decrement() {\n timeRemaining.text(\"Time Remaining: \" + timerSeconds); // to HTML\n timerSeconds--; // reduce timerSeconds by 1 each interval\n\n // when time runs out...\n if (timerSeconds === 0) {\n clearInterval(currentTime); // reset interval\n lossCount++; // add to loss Count\n timerStop(); // stop timer\n answerSection.text(\"Time's Up! The correct answer was: \" + pick.choices[pick.answerIndex]); // show correct answer\n endGameCheck(); // check if all questions have been asked\n }\n }", "cancel() {\n if (this.timeoutId) {\n clearTimeout(this.timeoutId);\n }\n if (this.intervalId) {\n clearInterval(this.intervalId);\n }\n this.timeoutId = undefined;\n this.intervalId = undefined;\n this.sequence = 0;\n this.isActive = false;\n this.times = [];\n if (this.rejectCallback) {\n this.rejectCallback(new Error('cancel'));\n }\n this.rejectCallback = undefined;\n }", "function cancel_function() {\n var testV = 1;\n var pass1 = prompt('Please Enter Your Password','password');\n while (testV < 3) {\n if (pass1.toLowerCase() == \"letmein\") {\n cancel_rn = prompt(\"Which room would you like to cancel reservation?\");\n for (var i = 0; i < rooms.length; i++) {\n if(cancel_rn == rooms[i].number){\n rooms[i].duration_start = \"-\";\n rooms[i].duration_end = \"-\";\n rooms[i].open = \"Open\";\n rooms[i].breakTime = 0;\n break;\n }\n }\n loadRooms();\n \n break;\n } \n else {\n testV+=1;\n var pass1 = prompt('Access Denied - Password Incorrect, Please Try Again.','Password');\n }\n }\n if (pass1.toLowerCase()!=\"password\" & testV ==3)\n history.go(-1);\n return \" \";\n}", "function onLeavingChallengesAdvertising() {\n $timeout.cancel(updaterHndl);\n }", "function decrement(){\n // Decrease timeRemaining by one.\n timeRemaining--;\n // Show the timeRemaining in the #time-remaining div.\n $('#time-remaining').text(timeRemaining + \" seconds\");\n // When the timeRemaining is equal to zero, \n if (!timeRemaining){\n // run the stop function.\n stop();\n // Alert the user that time is up. Update the innerHTML of the message\n // div to say 'Game Over!'\n alert('time up!');\n checkAnswers();\n }\n }", "cancel() {\n\t\tif (!this.state.executing) {\n\t\t\tthis.opts.cancel && this.opts.cancel();\n\t\t}\n\t}", "cancel() {\n\t\tif (!this.state.executing) {\n\t\t\tthis.opts.cancel && this.opts.cancel();\n\t\t}\n\t}" ]
[ "0.62495184", "0.61248153", "0.60613745", "0.6051775", "0.5957667", "0.579878", "0.5796032", "0.5793594", "0.57708716", "0.5764484", "0.5754102", "0.5734898", "0.5730226", "0.57185125", "0.57181215", "0.5714681", "0.57004356", "0.56908435", "0.56721675", "0.56693536", "0.56413734", "0.5628383", "0.5627233", "0.56015784", "0.5597637", "0.55956554", "0.5570816", "0.554943", "0.5548131", "0.55253804", "0.55179703", "0.55142546", "0.5507706", "0.5503145", "0.54852414", "0.54771", "0.5473894", "0.5471141", "0.5470546", "0.5469294", "0.5463147", "0.54615843", "0.5459995", "0.5456214", "0.5455589", "0.54527485", "0.5451621", "0.54506993", "0.54476243", "0.54450595", "0.54449147", "0.5437023", "0.5436755", "0.5435184", "0.5431714", "0.543072", "0.54291713", "0.54257554", "0.5418425", "0.5412244", "0.54055303", "0.54053986", "0.5400909", "0.54008585", "0.5400853", "0.5391287", "0.5388287", "0.5385488", "0.5382146", "0.5380746", "0.53760606", "0.5375997", "0.5372293", "0.5368071", "0.53655094", "0.53599215", "0.53590506", "0.5355723", "0.5349845", "0.53486025", "0.5342002", "0.5334168", "0.5325024", "0.5323577", "0.5323577", "0.5320875", "0.5315718", "0.5312305", "0.5309997", "0.5307932", "0.5304975", "0.5304055", "0.52997994", "0.52950233", "0.5294845", "0.5292808", "0.5291278", "0.5289514", "0.5283859", "0.5283859" ]
0.8139517
0
adds a user's standup report to the standup data for a channel
function addStandupData(standupReport) { controller.storage.teams.get('standupData', function(err, standupData) { if (!standupData) { standupData = {}; standupData.id = 'standupData'; } if (!standupData[standupReport.channel]) { standupData[standupReport.channel] = {}; } standupData[standupReport.channel][standupReport.user] = standupReport; controller.storage.teams.save(standupData); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doStandup(bot, user, channel) {\n\n var userName = null;\n\n getUserName(bot, user, function(err, name) {\n if (!err && name) {\n userName = name;\n\n bot.startPrivateConversation({\n user: user\n }, function(err, convo) {\n if (!err && convo) {\n var standupReport = \n {\n channel: channel,\n user: user,\n userName: userName,\n datetime: getCurrentOttawaDateTimeString(),\n yesterdayQuestion: null,\n todayQuestion: null,\n obstacleQuestion: null\n };\n\n convo.ask('What did you work on yesterday?', function(response, convo) {\n standupReport.yesterdayQuestion = response.text;\n \n convo.ask('What are you working on today?', function(response, convo) {\n standupReport.todayQuestion = response.text;\n \n convo.ask('Any obstacles?', function(response, convo) {\n standupReport.obstacleQuestion = response.text;\n \n convo.next();\n });\n convo.say('Thanks for doing your daily standup, ' + userName + \"!\");\n \n convo.next();\n });\n \n convo.next();\n });\n \n convo.on('end', function() {\n // eventually this is where the standupReport should be stored\n bot.say({\n channel: standupReport.channel,\n text: \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime,\n //text: displaySingleReport(bot, standupReport),\n mrkdwn: true\n });\n\n addStandupData(standupReport);\n });\n }\n });\n }\n });\n}", "function postTeamStandUpsToChannel() {\n today = moment().format(\"YYYY-MM-DD\");\n let todayFormatted = moment(today, \"YYYY-MM-DD\").format(\"MMM Do YYYY\");\n let standupUpdate = `*📅 Showing Ona Team Standup Updates On ${todayFormatted}*\\n\\n`;\n repos.userStandupRepo.getByDatePosted(today)\n .then(data => {\n let attachments = [];\n data.forEach((item, index) => {\n let attachment = formatTeamsMessageAttachment(item, index, data);\n attachments.push(attachment);\n });\n return Promise.resolve(attachments);\n })\n .then(allAttachments => {\n if (allAttachments.length > 0) {\n postMessageToChannel(standupUpdate, allAttachments);\n } else {\n standupUpdate = `*📅 Nothing to show. No team standup updates for ${todayFormatted}*`;\n postMessageToChannel(standupUpdate, [])\n }\n });\n}", "function setStandupTime(channel, standupTimeToSet) {\n \n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n\n if (!standupTimes) {\n standupTimes = {};\n standupTimes.id = 'standupTimes';\n }\n\n standupTimes[channel] = standupTimeToSet;\n controller.storage.teams.save(standupTimes);\n });\n}", "function saveStandUp(standUpDetails) {\n repos.userStandupRepo.add(standUpDetails);\n}", "postTeamStandupsToChannel() {\n let todayFormatted = moment(today, \"YYYY-MM-DD\").format(\"MMM Do YYYY\")\n let standupUpdate = `*📅 Showing Ona Standup Updates On ${todayFormatted}*\\n\\n`;\n AppBootstrap.userStandupRepo\n .getByDatePosted(today)\n .then(data => {\n let attachments = [];\n\n data.forEach((item, index) => {\n let attachment = {\n color: \"#dfdfdf\",\n title: `<@${item.username}>`,\n fallback:\n \"Sorry Could not display standups in this type of device. Check in desktop browser\",\n fields: [\n {\n title: \"Today\",\n value: `${item.standup_today}`,\n short: false\n }\n ],\n footer: `Posted as ${item.team}`\n };\n if (item.standup_previous != null) {\n const previously = {\n title: \"Yesterday/Previously\",\n value: `${\n item.standup_previous == null\n ? \"Not specified\"\n : item.standup_previous\n }`,\n short: false\n };\n attachment.fields.push(previously);\n }\n if (index === 0) {\n attachment.pretext = `Team ${item.team} Standups`;\n attachment.color = \"#7DCC34\";\n }\n if (index > 0) {\n if (item.team != data[index - 1].team) {\n attachment.pretext = `Team ${item.team} Standups`;\n attachment.color = \"#7DCC34\";\n }\n }\n attachments.push(attachment);\n });\n return Promise.resolve(attachments);\n })\n .then(allAttachments => {\n if (allAttachments.length > 0) {\n web.channels.list().then(res => {\n const channel = res.channels.find(c => c.is_member);\n if (channel) {\n web.chat\n .postMessage({\n text: standupUpdate,\n attachments: allAttachments,\n channel: channel.id\n })\n .then(msg =>\n console.log(\n `Message sent to channel ${channel.name} with ts:${msg.ts}`\n )\n )\n .catch(console.error);\n } else {\n console.log(\n \"This bot does not belong to any channel, invite it to at least one and try again\"\n );\n }\n });\n } else {\n web.channels.list().then(res => {\n let todayFormatted = moment(today, \"YYYY-MM-DD\").format(\"MMM Do YYYY\")\n const channel = res.channels.find(c => c.is_member);\n if (channel) {\n web.chat\n .postMessage({\n text: `*📅 Nothing to show. No standup updates for ${todayFormatted}*`,\n channel: channel.id\n })\n .then(msg =>\n console.log(\n `Message sent to channel ${channel.name} with ts:${msg.ts}`\n )\n )\n .catch(console.error);\n } else {\n console.log(\n \"This bot does not belong to any channel, invite it to at least one and try again\"\n );\n }\n });\n }\n });\n }", "function getSingleReportDisplay(standupReport) {\n var report = \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime + \"\\n\";\n report += \"_What did you work on yesterday:_ `\" + standupReport.yesterdayQuestion + \"`\\n\";\n report += \"_What are you working on today:_ `\" + standupReport.todayQuestion + \"`\\n\";\n report += \"_Any obstacles:_ `\" + standupReport.obstacleQuestion + \"`\\n\\n\";\n return report;\n}", "saveStandup(standupDetails) {\n AppBootstrap.userStandupRepo.add(standupDetails);\n }", "function displayUserReport(data) {\n $('body').append(\n \t'<p>' + 'Report: ' + data.report + '</p>');\n}", "function startNewUserWorkout(app, workout_type, completed) {\n console.log(\"Tracking new user activity\");\n let trackUpdateRef = db.ref(\"last_activity/\" + USER);\n trackUpdateRef.set({\n \"last_done\" : {\n \"workout_type\": workout_type,\n \"completed\": completed,\n }\n });\n }", "function addReports(data) {\n console.log(` Adding: ${data.itemID} (${data.reporter})`);\n Reports.insert(data);\n}", "addToacceptedTimes() { this.acceptedStatsDB( {dbId:this.dbId, date:new Date().getTime()} ); }", "function streamPush() {\n // $('#streamstatus').html(user.streamdesc);\n $('#viewers').html(user.viewers);\n if (user.islive === 'true') {\n $('#useronline').removeClass('label-danger');\n $('#useronline').addClass('label-success');\n $('#useronline').html('ONLINE');\n $('#useronline').css('opacity','.70');\n $('.videoinfo').html(user.streamdesc);\n\n } else {\n\n $('#useronline').addClass('label-danger');\n $('#useronline').removeClass('label-success');\n $('#useronline').html('OFFLINE');\n $('#useronline').css('opacity','1.0');\n // $('.videoinfo').html(user.streamdesc);\n }\n }", "execute(message, args) { // omit args argument if not using args\n\n let userID = message.author.id;\n console.log(userID);\n if (!(\"\" + userID in users) ) users[userID] = {};\n \n if (!(\"notifications\" in users[userID]) ) users[userID][\"notifications\"] = [];\n let notifObj = {\n stock: args[0],\n percent_threshold: args[1],\n days: args.slice(2)\n };\n console.log(notifObj);\n users[userID].notifications.push(notifObj)\n fs.writeFile(path.join(__dirname, \"..\", \"db\", \"users.json\"), JSON.stringify(users, null, '\\t'), (err)=>{\n if (err) return message.channel.send(\"There was an error setting your notification.\")\n message.channel.send(\"Notification set successfully!\")\n });\n\n\t}", "function clearStandupData(channel) {\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel]) {\n return;\n } else {\n delete standupData[channel];\n controller.storage.teams.save(standupData);\n }\n });\n}", "function getReportDisplay(standupReports) {\n \n if (!standupReports) {\n return \"*There is no standup data to report.*\";\n }\n\n var totalReport = \"*Standup Report*\\n\\n\";\n for (var user in standupReports) {\n var report = standupReports[user];\n totalReport += getSingleReportDisplay(report);\n }\n return totalReport;\n}", "function hasStandup(who, cb) {\n \n var user = who.user;\n var channel = who.channel;\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel] || !standupData[channel][user]) {\n cb(null, false);\n } else {\n cb(null, true);\n }\n });\n}", "function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}", "function emitShipPowerUpUpdates(){\n var vessels = ships.shipGet();\n var out = {};\n\n // Only add to the output json that has changed since last send\n for (var id in vessels){\n var list = vessels[id].powerUps.active.join(' ');\n if (lastPowerUpData[id] != list) {\n lastShieldData[id] = list;\n out[id] = {\n status: 'powerup',\n addClasses: list,\n removeClasses: vessels[id].powerUps.inactive.join(' ')\n };\n }\n }\n\n // Only *if* there's useful data to be sent, send that data to all clients\n if (Object.keys(out).length) {\n io.sockets.emit('shipstat', out);\n }\n}", "function writeUserData(displayName,message) {\n var today = new Date()\n var year = today.getFullYear().toString()\n var month = monthName[(today.getMonth()+1)]\n var date = today.getDate().toString()\n var datoString = date + \" \" + month + \" \" + year;\n var hour = today.getHours()\n var minute = today.getMinutes()\n if(hour < 10) {\n hour = \"0\" + hour\n }\n if(minute < 10) {\n minute = \"0\" + minute\n }\n if(displayName == null) {\n displayName = \"Anonym\"\n }\n var newPostRef = meldinger.push();\n newPostRef.set({\n msg: message,\n datestamp: datoString,\n showTime: hour.toString() + \":\" + minute.toString(),\n name: displayName\n });\n}", "function attachNewUserToIncident() {\n attachNewUser = true;\n $(\"#user_add_username\").val($(\"#user_name\").val());\n openAddUser();\n }", "function addAskingTime(user, channel, timeToSet) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes) {\n askingTimes = {};\n askingTimes.id = 'askingtimes';\n }\n\n if (!askingTimes[channel]) {\n askingTimes[channel] = {};\n }\n\n askingTimes[channel][user] = timeToSet;\n controller.storage.teams.save(askingTimes);\n });\n}", "function addNewReport(userName, storeId, description, callable) {\n console.log(\"(model/store.js) Started addNewReport()\");\n store.update({_id: storeId}, {$push: {\"Reports\": {UserID: userName, Description: description}}}, function (err) {\n if (err) {\n console.log(err);\n }\n else {\n callable.call(this, err);\n }\n });\n}", "function user_update_lobby(user) {\n // Agent logs in or updates\n agent.add(user);\n update_interface();\n }", "function upUser(user){\n if (user.point > 10){\n // long upgrade logic..\n }\n}", "function getAndDisplayUserReport() {\n getUserInfo(displayUserReport);\n}", "function appendUsers() {\n queryRequest(uniqueProjectUsers);\n usersWithNumberOfIssues.length = 0;\n uniqueProjectUsers.forEach(function (user) {\n var numberOfIssues = 0;\n issuesOfProject.forEach(function (issue) {\n if (issue.assignee == user) {\n numberOfIssues++;\n }\n })\n if (user == 'Unassigned') {\n usersWithNumberOfIssues.push({\n user: user,\n numberOfIssues: numberOfIssues,\n color: 'color: #1678CC'\n })\n } else {\n usersWithNumberOfIssues.push({\n user: user,\n numberOfIssues: numberOfIssues\n })\n }\n })\n buildPieChart();\n}", "function updateDashboard() {\n request\n .get(\"https://dsrealtimefeed.herokuapp.com/\")\n .end(function(res) {\n console.log(\"Pinged Dashboard, \" + res.status)\n if(res.status != 200) {\n stathat.trackEZCount(config.STATHAT, 'dsrealtime-feed-cant_ping', 1, function(status, response){});\n }\n });\n}", "function report(user) {\n if (user) {\n $.post(\"/reportUser\", {sender: username, receiver: user, chatroom: chatroomId}, function (data) {}, \"json\");\n }\n}", "function saveStandup(room, time, utc) {\n var standups = getStandups();\n\n var newStandup = {\n time: time,\n room: room,\n utc: utc\n };\n\n standups.push(newStandup);\n updateBrain(standups);\n }", "function updateCalendarSignup(signup) {\n \n var event = groupMealCalendar.getEventById(signup.eventID);\n \n if (event.getColor() !== \"4\")\n event.setColor(\"4\"); // Set event color to pale red\n \n var description = 'Estimated people: ' + signup.peopToFeed + \n '\\nGraciously Provided By: ' + signup.name + \n '\\nContact Info: ' + signup.email + ', ' + signup.phone + \n '\\nAffiliation: ' + signup.student +\n '\\nPlanned Food: ' + signup.foodDescrip + \n '\\nAllergen Alerts: ' + signup.allergy + \n '\\n\\n' + signup.details;\n \n // Set calendar description\n if (event.getDescription() !== description)\n event.setDescription(description);\n \n}", "function createReasonUserLogForSchedule(newScheduleName, newScheduleFrequency, newScheduleEnabled, newStartDateTime, newEndDateTime) {\n var currentUserProfile;\n\n\n if (userProfilereq.readyState == 4) {\n var userProfileData = JSON.parse(showErrorMain(userProfilereq.responseText, \"Error Found\"));\n\n if (Object.entries(userProfileData).length != 0) {\n\n\n currentUserProfile = userProfileData['UserInfo'];\n\n\n var setNewScheduleName = \"\";\n var setNewScheduleFrequency = \"\";\n var setNewScheduleEnabled = \"\";\n var setNewStartDateTime = \"\";\n var setNewEndDateTime = \"\";\n //var selectedUserID = \"\";\n\n var loggedInUser = currentUserProfile['userLogin'];\n\n var setReason = \"User: \" + loggedInUser + \", set the SCHEDULE TEMPLATE with the following details: \";\n\n\n // setting reason\n\n setNewScheduleName = \"ScheduleName: \" + newScheduleName + \"\";\n\n\n setNewScheduleFrequency = \"newScheduleFrequency: \" + newScheduleFrequency + \"\";\n\n setNewScheduleEnabled = \"newScheduleEnabled: \" + newScheduleEnabled + \"\";\n\n\n setNewStartDateTime = \"new Start DateTime: \" + newStartDateTime + \"\";\n\n\n setNewEndDateTime = \"newEndDateTime: \" + newEndDateTime + \"\";\n\n\n var finalReason;\n // var intialQuery = \"SELECT InovoMonitor.tblSites.sitename, InovoMonitor.tblAlarms.hostid, InovoMonitor.tblAlarms.id, InovoMonitor.tblHosts.hostName, InovoMonitor.tblAlarms.description, InovoMonitor.tblAlarms.severity, InovoMonitor.tblAlarms.Message, InovoMonitor.tblAlarms.currentstatus, InovoMonitor.tblAlarms.source, InovoMonitor.tblAlarms.category, InovoMonitor.tblAlarms.created, InovoMonitor.tblAlarms.updated, InovoMonitor.tblAlarms.updatedby FROM InovoMonitor.tblAlarms INNER JOIN InovoMonitor.tblHosts ON InovoMonitor.tblAlarms.hostid = InovoMonitor.tblHosts.id INNER JOIN InovoMonitor.tblSites ON InovoMonitor.tblSites.id = InovoMonitor.tblHosts.siteid \";\n // var intialQuery = \"UPDATE InovoMonitor.tblUsers SET \";\n // + setNewUserName + \", \" + setNewUserSurname + \", \" + setNewUserPass + \", \" + setNewUserActive + \" , \" + setNewUserAccess + \" WHERE \" + +\";\"\n\n var clauseQuery = \"\";\n var queryArr = [];\n\n queryArr.push(setNewScheduleName);\n queryArr.push(setNewScheduleFrequency);\n queryArr.push(setNewScheduleEnabled);\n queryArr.push(setNewStartDateTime);\n queryArr.push(setNewEndDateTime);\n\n\n if (queryArr.length >= 2) {\n var n = 0;\n for (i = 0; i < queryArr.length - 1; i++) {\n n++;\n clauseQuery += queryArr[i] + \", \";\n }\n\n clauseQuery += queryArr[n];\n\n }\n\n finalReason = setReason + clauseQuery;\n\n\n return finalReason;\n }\n }\n}", "function addUser(name, ineff, eff, isRange, high, low){\n\t\tvar w = new waterUser(name, ineff, eff, isRange, high, low);\n\t\twaterUses.push(w);\n\t}", "addUserToEvent(event) {\n if (this.orgReference.child(`eventList/${event}`) !== undefined && event !== '') {\n this.orgReference.child(`eventList/${event}/people/${this.props.firebaseUser.uid}`).set(this.props.firebaseUser.displayName)\n this.orgReference.child(`userList/${this.props.firebaseUser.uid}/attendanceList`).push(event);\n }\n }", "function bootstrap_user(socket,data) {\n socket.join(data.game_uid);\n\n czar_refresh_selective(socket,data.game_uid,'socket');\n\n black_card_refresh_selective(socket,data.game_uid,'socket')\n\n build_white_card_hand(data.player_uid,data.game_uid,10,function(data){\n socket.emit('white_card_update',data);\n });\n\n // since we want all users to see the new user has joined, broadcast out\n update_score_selective(socket,data.game_uid,'broadcast');\n\n update_redraw_remaining(socket,data.player_uid,data.game_uid)\n\n update_submits_selective(socket,data.game_uid,'broadcast')\n}", "function appendStatistic(prof, res) {\n const profile1 = prof.toObject();\n profile1.setsCount = 0;\n profile1.notecardCount = 0;\n profile1.followerCount = 0;\n\n profile1.followerCount = profile1.follower.length;\n\n dbmodel.set.findByOwner(profile1.id, (err, sets) => {\n if (sets) {\n profile1.setsCount = sets.length;\n }\n dbmodel.notecard.findByOwner(profile1.id, (err1, cards) => {\n if (cards) {\n profile1.notecardCount = cards.length;\n }\n res.send(profile1);\n });\n });\n}", "function sendStats() {\n APP.xmpp.addToPresence(\"connectionQuality\", convertToMUCStats(stats));\n}", "function publishDatePlan(check){\n\tvar datePlanUser = new Object();\n\tdatePlanUser.datePlanID = datePlanActivity.DatePlanID;\n\tdatePlanUser.userID = user.UserID;\n\n\t$.ajax({\n\t\ttype: 'POST', \n\t\turl: 'api/index.php/shareDatePlan',\n\t\tcontent: 'application/json',\n\t\tdata: JSON.stringify(datePlanUser),\n\t\tsuccess: function(data){\n\t\t\tconsole.log(\"Date Plan is now public\");\n\t\t}\n\t});\n}", "function startMine(user){\n user.mining = true;\n user.mineID = window.setInterval(mine, 3000, user);\n snackbar(\"User: \"+user.name+\" begins mining\");\n // updateUser(user);\n}", "function logCreation(date, waterInput) {\n let waterRef = db.collection(\"Users\").doc(currentUser.uid).collection(\"Log\").doc(\"Water\");\n waterRef.set({ [date]: waterInput }, {merge: true}) // Logging the date as the key and the inputted water as the value\n .then(function () {\n alert(`Successfully updated water log for ${date} to ${waterInput} litres.`); // Successful log\n setLeader(date, waterInput);\n })\n .catch(function () {\n alert(\"Water log unsuccessful.\") // Unsuccessful log\n });\n}", "function userPush() {\n $('.name').html(user.name);\n\n if (user.bio === '') {\n user.bio = ('\\n'+ user.name + ' Is incredibly lazy and has not filled out his bio.');\n }\n $('#bio').html(user.bio);\n $('#logo').attr('src', user.logo);\n $('.chat').attr('src', user.chaturl);\n $('.videoinfo').html(user.streamdesc);\n\n }", "addStatusReportSetting (contributorId, sourceCollection, sourceId) {\n console.log('addStatusReportSetting:', contributorId, sourceCollection, sourceId);\n let user = Auth.requireAuthentication();\n \n // Validate the data is complete\n check(contributorId, String);\n check(sourceCollection, String);\n check(sourceId, String);\n \n // Validate that the current user is an administrator\n if (user.managesContributor(contributorId) || user.isAdmin()) {\n // Create the statusReportSetting\n let settingId = StatusReportSettings.insert({\n contributorId : contributorId,\n sourceCollection: sourceCollection,\n sourceId : sourceId,\n startDate : new Date()\n });\n \n // Set the first due date\n let setting = StatusReportSettings.findOne(settingId);\n setting.updateNextDue();\n } else {\n console.error('Non-authorized user tried to add a statusReportSetting:', user.username, sourceCollection, sourceId);\n throw new Meteor.Error(403);\n }\n }", "function join(call, callback) {\n users.push(call);\n notifyChat({ user: \"Server\", text: \"new user joined ...\" });\n}", "function pushSummaries() {\n buttonwood.getPortfolioSummaries().then(function(portfolioSummaries) {\n _.each(portfolioSummaries, function(portfolioSummary) {\n var botInstance = bot.botManager.getBot(portfolioSummary.applicationPlatformEntity);\n botInstance.sendPrivateMessage(portfolioSummary);\n });\n });\n}", "function channelPush() {\n $('.user_url').attr('href', user.profileurl);\n $('#stream_img').attr('src', user.streamlogo);\n}", "function showUserGifts(){\r\n \r\n // get from database mission type assigned for this day and appends to HTML\r\n appendGifts(userGifts,'neutral')\r\n }", "function pushMsg() {\n let userId = auth.currentUser.uid;\n\n var chanId1;\n var chanId2;\n database.ref('users'+ userId).on('value', snap =>{\n let profileData = snap.val();\n if (profileData == null) console.log('profileData == null');\n else{chanId1 = profileData.chanId_1; chanId2 = profileData.chanId_2;}\n })\n database.ref('chats/Data').on('value', snap =>{\n let profInfo = snap.val();\n if (profInfo == null){\n console.log('error profInfo == null')\n }else{\n for (let i in profInfo){\n var room;\n if (profInfo[i].Profile.channelId == chanId1) room = 'Line_1_room';\n else if (profInfo[i].Profile.channelId == chanId2) room = 'Line_2_room';\n else room = profInfo[i].Profile.channelId;\n name_list.push({'id': profInfo[i].Profile.userId, 'chanId':room});\n\n let profile = profInfo[i].Profile;\n\n $('#user-rooms').append('<option value=\"' + profile.userId + '\">' + profile.nickname + '</option>'); //new a option in select bar\n // name_list.push(profile.channelId+profile.userId); //make a name list of all chated user\n }\n }\n });\n }", "function reportInstall(arg)\n{\n mpmetrics.track('hardware_report', {'graphics_card': arg, 'token' : metrics_token});\n mpmetrics.track_funnel(metrics_funnel_id, 5, 'complete_unity_install', {'userAgent' : navigator.userAgent, 'token' : metrics_token});\n setTimeout(\"window.location='unity_done.html';\", 500);\n}", "function addToSubscribed(username) {\n\tvar subscribed = getSubscribedList();\n\tsubscribed[username] = true;\n\tsetSubscribedList(subscribed);\n}", "function addToCall(data) {\n /*console.log(data)\n var card = $('.card.'+data);\n if (!card.hasClass('session-select')) {\n card.addClass('session-select')\n } else {\n card.removeClass('session-select')\n }*/\n\n // OLD: Add to calendar\n var event = sessions[data];\n var description = buildEventDescription(event);\n var begin = '4/28/2018 ' + event.time.split('-')[0].trim();\n var end = '4/28/2018 ' + event.time.split('-')[1].trim();\n var beginF = new Date(begin.replace('am', ' am').replace('pm', ' pm'));\n var endF = new Date(end.replace('am', ' am').replace('pm', ' pm'));\n var cal = new ics();\n\n cal.addEvent(event.title, description, event.room_color + ' room', beginF, endF);\n cal.download(event.title);\n\n}", "function addToSubscribed(username) {\n var subscribed = getSubscribedList();\n subscribed[username] = true;\n setSubscribedList(subscribed);\n }", "function getStandupData(channel, cb) {\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel]) {\n cb(null, null);\n } else {\n cb(null, standupData[channel]);\n }\n });\n}", "function upgradeUser(ueser) {\n if (ueser.point > 10) {\n //long upgrade logic...\n }\n}", "hire(employee) {\n this.reports.push(employee)\n }", "function updateCalories(){\n if(!update){\n $(\".footer .maintain\").append(maintainWeight(newUser.level,calcBMR(newUser.gender,newUser.feet,newUser.inches,newUser.weight,newUser.age,totalInches)));\n $(\".footer .lose\").append(maintainWeight(newUser.level,calcBMR(newUser.gender,newUser.feet,newUser.inches,newUser.weight,newUser.age,totalInches))-500);\n $(\".footer .gain\").append(maintainWeight(newUser.level,calcBMR(newUser.gender,newUser.feet,newUser.inches,newUser.weight,newUser.age,totalInches))+500);\n }\n update = true;\n }", "function appendUser(user) {\n var username = user.username;\n /*\n * A new feature to Pepper, which is a permission value,\n * may be 1-5 afaik.\n *\n * 1: normal (or 0)\n * 2: bouncer\n * 3: manager\n * 4/5: (co-)host\n */\n var permission = user.permission;\n\n /*\n * If they're an admin, set them as a fake permission,\n * makes it easier.\n */\n if (user.admin) {\n permission = 99;\n }\n\n /*\n * For special users, we put a picture of their rank\n * (the star) before their name, and colour it based\n * on their vote.\n */\n var imagePrefix;\n switch (permission) {\n case 0:\n imagePrefix = 'normal';\n break;\n // Normal user\n case 1:\n // Featured DJ\n imagePrefix = 'featured';\n break;\n case 2:\n // Bouncer\n imagePrefix = 'bouncer';\n break;\n case 3:\n // Manager\n imagePrefix = 'manager';\n break;\n case 4:\n case 5:\n // Co-host\n imagePrefix = 'host';\n break;\n case 99:\n // Admin\n imagePrefix = 'admin';\n break;\n }\n\n /*\n * If they're the current DJ, override their rank\n * and show a different colour, a shade of blue,\n * to denote that they're playing right now (since\n * they can't vote their own song.)\n */\n if (API.getDJs()[0].username == username) {\n if (imagePrefix === 'normal') {\n drawUserlistItem('void', '#42A5DC', username);\n } else {\n drawUserlistItem(imagePrefix + '_current.png', '#42A5DC', username);\n }\n } else if (imagePrefix === 'normal') {\n /*\n * If they're a normal user, they have no special icon.\n */\n drawUserlistItem('void', colorByVote(user.vote), username);\n } else {\n /*\n * Otherwise, they're ranked and they aren't playing,\n * so draw the image next to them.\n */\n drawUserlistItem(imagePrefix + imagePrefixByVote(user.vote), colorByVote(user.vote), username);\n }\n}", "function setActivity() {\n\tclient.user.setActivity('over rigby.space', { type: 'WATCHING' })\n\t .then(presence => {})\n\t .catch(console.error);\n}", "addDefaultNewUserData(newestVersion, user){\n let userDataRef = firebase.database().ref('users/'+user.uid)\n userDataRef.once('value')\n .then((snapshot) => {\n let userData = snapshot.val()\n let newUserData = Object.assign(defaultNewUserData, userData, {version:newestVersion, name:user.displayName,} ) //newestVersion needs to write back over existing version, always update person's name as well\n firebase.database().ref('users/'+user.uid).set(newUserData).then(this.showMainScreen())\n })\n }", "function addData(data) {\n console.log(` Adding: ${data.name} (${data.icon})`);\n Reports.insert(data);\n}", "function data_ready() {\n // latest two weeks of data... subtract 13 instead of 14 because dtaes\n // are inclusive and -14 gives fencepost error\n var edate = telemetry.midnight(telemetry.maxDate);\n var sdate = telemetry.midnight(add_days(edate, -13));\n draw_dashboard(sdate, edate);\n}", "function toggle(user) {\n var idx;\n\n idx = me.lunchers().indexOf(user);\n if (idx === -1) {\n // user not part of lunchers, so exit early.\n return;\n }\n\n idx = me.attendee().indexOf(user);\n if (idx !== -1) {\n me.attendee().splice(idx, 1);\n } else {\n me.attendee().push(user);\n }\n }", "storeCurrentlyViewedReport() {\n const reportID = this.getReportID();\n updateCurrentlyViewedReportID(reportID);\n }", "function putUserStoriesOnPage() {\n console.debug(\"putUserStoriesOnPage\");\n\n $ownStories.empty();\n\n if (currentUser.ownStories.length === 0) {\n $ownStories.append(\"<h5>You haven't added any stories!</h5>\");\n } else {\n // loop through all of users stories and generate HTML for them\n for (let story of currentUser.ownStories) {\n let $story = generateStoryMarkup(story, true);\n $ownStories.append($story);\n }\n }\n\n $ownStories.show();\n}", "function saved(data){\n\t\t\tfor (var i = 0; i < user.newAktiviteter.length; i++) {\n\t\t\t\tuser.newAktiviteter[i]\n\t\t\t\tvar occation = {\n\t\t\t\t\t\"approved\":false,\n\t\t\t\t\t\"decided\":false,\n\t\t\t\t\t\"occasion_id\":user.newAktiviteter[i],\n\t\t\t\t\t\"uri\":\"http://cloud.wilhelmsson.eu:5521/bookerang/api/v1.0/userschedules/\"+user.newAktiviteter[i],\n\t\t\t\t\t\"user_id\":user.id,\n\t\t\t\t\t\"user_prio\":user.prioGroup\n\t\t\t\t};\n\t\t\t\tuserschedules.push(occation);\n\t\t\t}\n\n\t\t}", "async function setData() {\n await db.collection('users').doc(uid).set(userFields);\n await db.collection('users').doc(uid).collection('txs').add({\n receipt: {},\n date: Date.now(),\n number: 0,\n });\n await db.collection('users').doc(uid).collection('items').add({\n icon: '🍔',\n name: 'My-First-Item',\n price: 14,\n options: {\n extra_sauce: true\n }\n });\n }", "create(request, user, data, next) {\n\n request.log(['info'], `< ReportService.create >`);\n\n Object.assign(data, {userId : user._id.toString()});\n\n ReportDAO.insertOne(data, (err, report) => {\n if (err && err.code === 11000) return next('error while creating report');\n if (err) return next(Boom.wrap(err));\n\n const newScore = (user.score ? user.score : 0) + this._convertTypeToXP(report.type);\n UserService.updateScore(user._id.toString(),newScore , (err, user) => {\n if(err) return callback(Boom.wrap(err));\n\n return next(null, {report, gain:this._convertTypeToXP(report.type), totalXP : newScore});\n });\n });\n }", "function onConferenceJoined() {\n console.log('INFO (join.js): Conference joined!');\n isJoined = true;\n for (let i = 0; i < localTracks.length; i++) {\n room.addTrack(localTracks[i]);\n }\n /*$('#mainBtn').attr('disabled', false);*/ //No one leaves untill 5th person joins\n $.toast({\n text: 'You have joined the Panel.',\n icon: 'success',\n showHideTransition: 'fade',\n allowToastClose: false,\n hideAfter: 5000,\n stack: 5,\n\tloader: false,\n position: 'top-right',\n textAlign: 'left',\n bgColor: '#333333',\n textColor: '#ffffff'\n });\n}", "function appendTeamInfo(client, user, callback){\n var queryString = 'SELECT * FROM team JOIN playerteam ON team.teamid = playerteam.teamid WHERE playerteam.playerid = $1';\n var values = [user.playerid];\n // console.log(queryString);\n client.query(queryString, values, function(err, team){\n client.release();\n if(err){\n callback && callback(err, null);\n }\n else{\n //Format info\n user.activeTeam = new Array();\n user.inactiveTeam = new Array();\n for(var i = 0; i<team.rows.length; i++){\n if(team.rows[i].active){\n user.activeTeam.push(team.rows[i]);\n }\n else{\n user.inactiveTeam.push(team.rows[i]);\n }\n }\n callback && callback(null, user);\n }\n });\n}", "function enterReport(proj_name, proj_address, proj_city, proj_county, proj_state, proj_desc, bldg_size, proj_mgr, proj_sup, architect, civil_eng, mech_eng, elec_eng, plumb_eng, land_arch, int_design, sched_start, sched_compl, actual_start, actual_compl, sched_reason, init_budget, final_budget, budget_reason, sector, const_type, awards, proj_challenges, proj_strengths, UserId) {\n var UserId = currentUser.id;\n // function enterReport(pers_spir, pers_emot, pers_health, pers_pr_req) {\n $.post(\"/api/reportentry\", {\n proj_name: proj_name,\n proj_address: proj_address,\n proj_city: proj_city,\n proj_county: proj_county,\n proj_state: proj_state,\n proj_desc: proj_desc,\n bldg_size: bldg_size,\n proj_mgr: proj_mgr,\n proj_sup: proj_sup,\n architect: architect,\n civil_eng: civil_eng,\n mech_eng: mech_eng,\n elec_eng: elec_eng,\n plumb_eng: plumb_eng,\n land_arch: land_arch,\n int_design: int_design,\n sched_start: sched_start,\n sched_compl: sched_compl,\n actual_start: actual_start,\n actual_compl: actual_compl,\n sched_reason: sched_reason,\n init_budget: init_budget,\n final_budget: final_budget,\n budget_reason: budget_reason,\n sector: sector,\n const_type: const_type,\n awards: awards,\n proj_challenges: proj_challenges,\n proj_strengths: proj_strengths,\n UserId: UserId\n\n }).then(function (data) {\n console.log(\"abcde\")\n window.location.replace(data);\n // If there's an error, handle it by throwing up a bootstrap alert\n }).catch(handleLoginErr);\n }", "function addUser() {\n let time;\n time = minutes.toString() + \" : \" + seconds.toString();\n let level;\n if (y == 9)\n level = \"Easy\"\n else if (y == 16)\n level = \"Medium\"\n else\n level = \"Expert\"\n\n db.collection(\"winners\").doc(myName.toString()).set({\n name: myName,\n level: level,\n time: time,\n timeInSeconds: seconds + 60 * minutes,\n winner: true\n })\n .then(() => {\n console.log(\"Document successfully written!\");\n })\n .catch((error) => {\n console.error(\"Error writing document: \", error);\n });\n }", "function stasisStart(event, channel) {\n console.log(util.format(\n 'Channel %s just entered our application, adding it to bridge %s',\n channel.name,\n bridge.id));\n\n channel.answer(function (err) {\n if (err) {\n throw err;\n }\n\n bridge.addChannel({\n channel : channel.id\n }, function (err) {\n var id = chanArr.push(channel.name)\n console.log(\"User: \" + channel.name);\n if (err) {\n throw err;\n }\n\n //If else statement to start music for first user entering channel, music will stop once more than 1 enters the channel.\n if (chanArr.length <= 1) {\n bridge.startMoh(function (err) {\n if (err) {\n throw err;\n }\n });\n } else {\n bridge.stopMoh(function (err) {\n if (err) {\n throw err;\n }\n });\n }\n\n });\n });\n }", "function addReportElement(stream) {\n var actionFooters = stream.querySelectorAll(\"div.stream-item-footer\");\n\n for (var i = 0, tot = actionFooters.length; i < tot; i++) {\n // only create report button if one is not already present\n if (actionFooters[i].querySelector(\"[role=\\\"keep-calm-reporter\\\"]\") == null) {\n var tweetId = actionFooters[i].parentNode.parentNode.getAttribute(\"data-tweet-id\");\n var username = actionFooters[i].parentNode.parentNode.getAttribute(\"data-screen-name\");\n\n var reportButton = document.createElement(\"img\");\n reportButton.setAttribute(\"data-tweetId\", tweetId);\n reportButton.setAttribute(\"data-username\", username);\n reportButton.setAttribute(\"src\", \"chrome-extension://\" + chrome.i18n.getMessage(\"@@extension_id\") + \"/images/normal.png\");\n reportButton.setAttribute(\"role\", \"keep-calm-reporter\");\n reportButton.setAttribute(\"title\", \"Report this user\");\n\n reportButton.style.position = 'relative';\n reportButton.style.top = '32px';\n reportButton.style.left = '-40px';\n reportButton.style.width = '20px';\n reportButton.style.height = '20px';\n reportButton.style.zIndex = '999';\n\n actionFooters[i].insertBefore(reportButton, actionFooters[i].firstChild);\n\n reportButton.addEventListener(\"mouseover\", function () {\n if (this.getAttribute(\"data-no-change\") !== \"yes\") {\n this.setAttribute(\"src\", \"chrome-extension://\" + chrome.i18n.getMessage(\"@@extension_id\") + \"/images/hover.png\");\n }\n });\n reportButton.addEventListener(\"mouseout\", function () {\n if (this.getAttribute(\"data-no-change\") !== \"yes\") {\n this.setAttribute(\"src\", \"chrome-extension://\" + chrome.i18n.getMessage(\"@@extension_id\") + \"/images/normal.png\");\n }\n });\n\n reportButton.addEventListener(\"click\", function () {\n var uname = username;\n return function (e) {\n e.stopPropagation();\n this.setAttribute(\"src\", \"chrome-extension://\" + chrome.i18n.getMessage(\"@@extension_id\") + \"/images/loader.gif\");\n report(TWITTER, uname, this);\n };\n }());\n }\n }\n}", "receiveReport(report) {\n //this.removeReport(report);\n this.setReports(_reports.concat(report));\n }", "function sf(data){\n //sets user funds to data,\n //which may be an optional argument,\n //or null is returned when using as a cb,\n //which the ui is then appropriately updated\n if(data !== null && data !== undefined){\n userStats.money = data; //if an argument is passed, assign value to money\n }\n \n var mstr = userStats.money.toFixed(2),\n jqm = $('div#statBar label#money');\n //assign value to html element\n \n if(userStats.money <= 0){\n //userStats.money = 0; //can't have less than no money\n jqm.text('Refresh Dough???: ' + mstr);\n }\n else{\n jqm.text('Money: ' + mstr);\n }\n }", "function informNewClientAboutExistingPowerups(clientSocket){\n let uppers = powerupHandler.powerups;\n for (let key in uppers){\n let currUpper = uppers[key];\n let message = {\n powerupState: currUpper.state,\n key: key,\n type: currUpper.type\n }\n clientSocket.emit('message', {\n type: \"powerup-new\",\n message: message\n })\n }\n}", "constructor(user) {\n this.userId = user.id;\n this.date = date;\n this.hoursSleptToday = 0;\n this.sleepQualityToday = 0;\n this.hoursSleptAverage = 0;\n this.sleepQualityAverage = 0;\n this.hoursRecord = [];\n this.qualityRecord = []\n }", "function mushroomTraining(stat){\n if (playerStats[\"mushroomcoin\"] >= 2 && playerStats[stat] < maxStats){\n playerStats[stat] +=1;\n playerStats[\"mushroomcoin\"] -=2;\n healthCalc();\n localStorage.setItem('storedPlayerStats', JSON.stringify(playerStats));\n playerSetup();\n setStats();\n } \n}", "async scoutPlayer(channel, target) {\n\t\tlet now = new Date().getTime();\n\t\tlet player = await sql.getPlayer(channel, target);\n\t\tif(!player) {\n\t\t\tconsole.log('Player not found');\n\t\t\treturn null;\n\t\t}\n\t\tlet embed = new Discord.RichEmbed();\n\t\tembed.setTitle(`SCANNING ${player.name.toUpperCase()}...`)\n\t\t\t.setColor(0x00AE86);\n\n\t\tif(player.isNemesis) {\n\t\t\tembed.setDescription('NEMESIS');\n\t\t} else if(this.isFusion(player)) {\n\t\t\tembed.setDescription(`Fusion between ${player.fusionNames[0]} and ${player.fusionNames[1]}`);\n\t\t}\n\t\t\n\t\tstats = 'Power Level: '\n\t\tlet training = player.status.find(s => s.type == enums.StatusTypes.Training);\n\t\tlet trainingTime = now - (training ? training.startTime : 0);\n\t\tif(player.status.find(s => s.type == enums.StatusTypes.Fern)) {\n\t\t\tstats += 'Unknown';\n\t\t} else {\n\t\t\tlet seenLevel = this.getPowerLevel(player);\n\t\t\tif(training) {\n\t\t\t\t// Estimate post-training power level\n\t\t\t\tlet world = await sql.getWorld(player.channel);\n\t\t\t\tconst hours = trainingTime / hour;\n\t\t\t\tif (hours > 72) {\n\t\t\t\t\thours = 72;\n\t\t\t\t}\n\t\t\t\tconst newPowerLevel = Math.pow(100, 1 + (world.heat + hours) / 1200);\n\t\t\t\tif (this.isFusion(player)) {\n\t\t\t\t\tnewPowerLevel *= 1.3;\n\t\t\t\t}\n\t\t\t\tif (player.status.find(s => s.type == enums.StatusTypes.PowerWish)) {\n\t\t\t\t\tnewPowerLevel *= 1.5;\n\t\t\t\t}\n\t\t\t\tif (hours <= 16) {\n\t\t\t\t\tseenLevel += newPowerLevel * (hours / 16);\n\t\t\t\t} else {\n\t\t\t\t\tseenLevel += newPowerLevel * (1 + 0.01 * (hours / 16));\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet level = numeral(seenLevel.toPrecision(2));\n\t\t\tstats += level.format('0,0');\n\t\t}\n\t\tif(training) {\n\t\t\tstats += `\\nTraining for ${this.getTimeString(trainingTime)}`;\n\t\t}\n\t\tembed.addField('Stats', stats);\n\n\t\treturn embed;\n }", "function produceReport(){\n // this is were most functions are called\n\n userURL = getuserURL();\n\n // add this into the website\n vertifyHttps(userURL); // check if the url is http/s\n googleSafeBrowsingAPI(userURL);\n virusTotalAPI(userURL);\n apilityCheck(userURL);\n}", "function addReportedFieldForReadReport(data) {\n\t\t//Create the new elements to attach\n\t\tfor (var i = 0; i < currentNbrOfReports; i++) {\n\t\t\tvar newTableRow = $(document.createElement('tr'));\n\t\t\tnewTableRow.attr('id', 'survey_list_reports');\n\n\t\t\tvar newTdSurveyName = $(document.createElement('td'));\n\t\t\tnewTdSurveyName = $(newTdSurveyName);\n\t\t\tnewTdSurveyName.text(data[i]);\n\t\t\tnewTdSurveyName.appendTo(newTableRow);\n\t\t\tnewTableRow.appendTo(fillableReportList);\n\t\t}\n\t}", "announce(screens, event, data) {\n /**\n * @event event:announce\n */\n this.dispatcher.emit(\"announce\", { screens: screens, event: event, data: data });\n }", "AppendGrade(gradeObject) {\n //if this assignment was extra credit just make the grade to be 100\n if (this.totalPts == 0) {\n this.grades[gradeObject.user_name] = 100.0;\n } else {\n var roundedGrade = parseFloat(\n ((gradeObject.current_grade / this.totalPts) * 100).toFixed(1)\n );\n\n //if this assignment contained extraCredit make the flag true\n if (roundedGrade > 100) {\n this.extraCredit = true;\n }\n\n this.grades[gradeObject.user_name] = roundedGrade;\n }\n }", "function fetchSubscribedUserFacilitator() {\r\n\tvar emailId = sessionStorage.getItem(\"jctEmail\");\r\n\tvar userGrp = Spine.Model.sub();\r\n\tuserGrp.configure(\"/admin/manageuserFacilitator/populateSubscribedUser\", \"emailId\", \"type\", \"customerId\");\r\n\tuserGrp.extend( Spine.Model.Ajax );\r\n\t//Populate the model with data to transfer\r\n\tvar modelPopulator = new userGrp({ \r\n\t\temailId: emailId,\r\n\t\ttype: \"AD\",\r\n\t\tcustomerId : sessionStorage.getItem(\"customerId\")\r\n\t});\r\n\tmodelPopulator.save(); //POST\r\n\tuserGrp.bind(\"ajaxError\", function(record, xhr, settings, error) {\r\n\t\talertify.alert(\"Unable to connect to the server.\");\r\n\t});\r\n\tuserGrp.bind(\"ajaxSuccess\", function(record, xhr, settings, error) {\r\n\t\tvar jsonStr = JSON.stringify(xhr);\r\n\t\tvar obj = jQuery.parseJSON(jsonStr);\r\n\t\tvar statusCode = obj.statusCode;\r\n\t\tif(statusCode == 200) {\r\n\t\t\tsetSubscribedUser(obj.subscribedUsersList);\r\n\t\t} else {\r\n\t\t\t//Show error message\r\n\t\t\t//alertify.alert(obj.statusDesc);\r\n\t\t}\r\n\t});\r\n}", "function addVisitTimestampForUser(user_id, short_url) {\n let formatted = moment().subtract(7, 'hours').format('MMMM Do YYYY, h:mm:ss a');\n\n if(!databases.urlVisits[short_url][user_id]){\n databases.urlVisits[short_url][user_id] = [];\n }\n databases.urlVisits[short_url][user_id].push(formatted);\n}", "markAttendance(username, status = \"present\") {\n let foundStudent = this.findStudent(username);\n if (status === \"present\") {\n foundStudent.attendance.push(1);\n } else {\n foundStudent.attendance.push(0);\n }\n updateRoster(this);\n }", "async setUsersStatusToLoggedIn(user) {\n const hoursToStayLoggedIn = 24;\n const now = new Date();\n user.loggedInUntil = now.setHours(now.getHours() + hoursToStayLoggedIn);\n await this.chatDAO.updateUser(user);\n }", "spawnMunchkin(){\n this.munchkinSpawner.spawnMunchkin();\n MainGameScene.gameStats.addToCount(\"munchkins\");\n this.updateUI();\n }", "function formatUserData($user) {\n angular.forEach($user.settings.preferences.logs.events, function (event) {\n if (event.id == 'group') {\n event.name = 'account_event_group';\n event.icon = 'fa fa-fw icons8-google-groups';\n event.color = 'blue';\n }\n else if (event.id == 'channel') {\n event.name = 'account_event_channel';\n event.icon = 'fa fa-fw icons8-channel-mosaic';\n event.color = 'green';\n }\n else if (event.id == 'account') {\n event.name = 'account_event_account';\n event.icon = 'fa fa-fw icons8-user-male';\n event.color = 'blue';\n }\n else {\n event.name = 'account_event_social';\n event.icon = 'fa fa-fw icons8-user-groups';\n event.color = 'purple';\n }\n });\n angular.forEach($user.settings.preferences.groupsMembers.status, function (event) {\n if (event.id == 'kicked') {\n event.name = 'groups_kicked';\n event.icon = 'fa fa-fw icons8-lock';\n event.color = 'yellow';\n }\n else if (event.id == 'banned') {\n event.name = 'groups_banned';\n event.icon = 'fa fa-fw icons8-lock';\n event.color = 'yellow';\n }\n else {\n event.name = 'groups_admin';\n event.icon = 'fa fa-fw icons8-user-male';\n event.color = 'purple';\n }\n });\n angular.forEach($user.settings.preferences.groupsInvitations.types, function (event) {\n if (event.id == 0) {\n event.name = 'popup_groupsInvitations_filter_body_rejected';\n event.icon = 'fa fa-fw icons8-event-declined-filled';\n event.color = 'error';\n }\n else if (event.id == 1) {\n event.name = 'popup_groupsInvitations_filter_body_waiting';\n event.icon = 'fa fa-fw icons8-event-accepted-tentatively-filled';\n event.color = 'info';\n }\n else {\n event.name = 'popup_groupsInvitations_filter_body_accepted';\n event.icon = 'fa fa-fw icons8-event-accepted-filled';\n event.color = 'green';\n }\n });\n angular.forEach($user.settings.preferences.groupsLogs.events, function (event) {\n if (event.id == 'group') {\n event.name = 'account_event_group';\n event.icon = 'fa fa-fw icons8-google-groups';\n event.color = 'blue';\n }\n else if (event.id == 'warning') {\n event.name = 'account_event_warning';\n event.icon = 'fa fa-fw fa-exclamation-triangle';\n event.color = 'yellow';\n }\n else {\n event.name = 'account_event_channel';\n event.icon = 'fa fa-fw icons8-channel-mosaic';\n event.color = 'green';\n }\n });\n angular.forEach($user.settings.preferences.channelsMembers.status, function (event) {\n if (event.id == 'kicked') {\n event.name = 'groups_kicked';\n event.icon = 'fa fa-fw icons8-lock';\n event.color = 'yellow';\n }\n else if (event.id == 'banned') {\n event.name = 'groups_banned';\n event.icon = 'fa fa-fw icons8-lock';\n event.color = 'yellow';\n }\n else {\n event.name = 'groups_admin';\n event.icon = 'fa fa-fw icons8-user-male';\n event.color = 'purple';\n }\n });\n angular.forEach($user.settings.preferences.channelsInvitations.types, function (event) {\n if (event.id == 0) {\n event.name = 'popup_groupsInvitations_filter_body_rejected';\n event.icon = 'fa fa-fw icons8-event-declined-filled';\n event.color = 'error';\n }\n else if (event.id == 1) {\n event.name = 'popup_groupsInvitations_filter_body_waiting';\n event.icon = 'fa fa-fw icons8-event-accepted-tentatively-filled';\n event.color = 'info';\n }\n else {\n event.name = 'popup_groupsInvitations_filter_body_accepted';\n event.icon = 'fa fa-fw icons8-event-accepted-filled';\n event.color = 'green';\n }\n });\n angular.forEach($user.settings.preferences.channelsLogs.events, function (event) {\n if (event.id == 'social') {\n event.name = 'account_event_social';\n event.icon = 'fa fa-fw icons8-user-groups';\n event.color = 'purple';\n }\n else if (event.id == 'warning') {\n event.name = 'account_event_warning';\n event.icon = 'fa fa-fw fa-exclamation-triangle';\n event.color = 'yellow';\n }\n else {\n event.name = 'account_event_channel';\n event.icon = 'fa fa-fw icons8-channel-mosaic';\n event.color = 'green';\n }\n });\n return $user;\n }", "function sprintStories(){\n return getsprintStories().then((data) => {\n console.log(data);\n agent.add(data)\n }).catch((err) => {\n agent.add(\"No Stories in active sprint in JIRA\", err);\n }); \n }", "function kickAlert(server, admin, offender, reason) {\n\tvar htmlContent = \"<div class=\\\"alert alert-dismissable alert-warning\\\">\\\n <span class=\\\"glyphicon glyphicon-eject\\\"> </span> [Server: \" + server + \"] - <strong> \" + admin + \"</strong> kicked <strong>\" + offender + \"</strong> for \\\"\" + reason + \".\\\"</div>\";\n $('#newsFeed').prepend(htmlContent);\n}", "function addRoomUser(info) {\n\tvar dude = new PalaceUser(info);\n\tif (theRoom.lastUserLogOnID == dude.id && ticks()-theRoom.lastUserLogOnTime < 900) { // if under 15 seconds\n\t\ttheRoom.lastUserLogOnID = 0;\n\t\ttheRoom.lastUserLogOnTime = 0;\n\t\tif (!getGeneralPref('disableSounds')) systemAudio.signon.play();\n\t}\n\tif (theUserID == dude.id) {\n\t\ttheUser = dude;\n\t\tfullyLoggedOn();\n\t}\n\n\ttheRoom.users.push(dude);\n\tloadProps(dude.props);\n\tdude.animator();\n\tdude.grow(10);\n\tPalaceUser.setUserCount();\n}", "@track((undefined, state) => {\n return {action: `enter-attempt-to-channel: ${state.channel.name}`};\n })\n enterChannel(channel){\n\n let addNewMessage = this.props.addNewMessage;\n let updateMessage = this.props.updateMessage;\n\n sb.OpenChannel.getChannel(channel.url, (channel, error) => {\n if(error) return console.error(error);\n\n channel.enter((response, error) => {\n if(error) return console.error(error);\n\n //set app store to entered channel\n this.props.setEnteredChannel(channel);\n //fetch the current participantList to append\n this.fetchParticipantList(channel);\n //fetch 30 previous messages from channel\n this.fetchPreviousMessageList(channel);\n });\n });\n }", "function onUpgradeBtnClick() {\r\n let upgradeStats = game.upgradeTower(); \r\n \r\n // figure out how to add towerstats into here TODO: fix that\r\n setTowerStatFields(upgradeStats);\r\n}", "async upgradeGun() {\n await AdminWallet.ready\n const pkey = AdminWallet.wallets[AdminWallet.addresses[0]].privateKey.slice(2)\n await GunDBPublic.init(null, pkey, `publicdb0`, null)\n const gooddollarProfile = '~' + GunDBPublic.user.is.pub\n logger.info('GoodDollar profile id:', { gooddollarProfile })\n let ps = []\n GunDBPublic.gun.get('users/bywalletAddress').once(\n data => {\n const updatedIndex = {}\n Object.keys(data || {}).forEach(k => {\n if (data[k] == null || k === '_') return\n updatedIndex[sha3(k)] = data[k]\n })\n logger.info(`writing ${Object.keys(updatedIndex).length} records to bywalletAddress`)\n if (Object.keys(updatedIndex).length === 0) return\n ps.push(GunDBPublic.gun.get('users/bywalletAddress').putAck(updatedIndex))\n ps.push(GunDBPublic.user.get('users/bywalletAddress').putAck(updatedIndex))\n },\n { wait: 3000 }\n )\n GunDBPublic.gun.get('users/bymobile').once(\n data => {\n const updatedIndex = {}\n Object.keys(data || {}).forEach(k => {\n if (data[k] == null || k === '_') return\n updatedIndex[sha3(k)] = data[k]\n })\n logger.info(`writing ${Object.keys(updatedIndex).length} records to bymobile`)\n if (Object.keys(updatedIndex).length === 0) return\n ps.push(GunDBPublic.gun.get('users/bymobile').putAck(updatedIndex))\n ps.push(GunDBPublic.user.get('users/bymobile').putAck(updatedIndex))\n },\n { wait: 3000 }\n )\n GunDBPublic.gun.get('users/byemail').once(\n data => {\n const updatedIndex = {}\n Object.keys(data || {}).forEach(k => {\n if (data[k] == null || k === '_') return\n updatedIndex[sha3(k)] = data[k]\n })\n logger.info(`writing ${Object.keys(updatedIndex).length} records to byemail`)\n if (Object.keys(updatedIndex).length === 0) return\n ps.push(GunDBPublic.gun.get('users/byemail').putAck(updatedIndex))\n ps.push(GunDBPublic.user.get('users/byemail').putAck(updatedIndex))\n },\n { wait: 3000 }\n )\n return new Promise((res, rej) => {\n delay(\n () =>\n Promise.all(ps)\n .then(res)\n .catch(rej),\n 5000\n )\n })\n }", "function writeUserData(unixdate,link,venue,title,pushmeetuserArr){\n var taskType = \"Duties\";\n var newTaskKey = firebase.database().ref().child('Alerts/Core/').push().key;\n firebase.database().ref('Alerts/Core/' + newTaskKey).set({\n id: newTaskKey,\n time: unixdate,\n title: title,\n location: venue, \n link: link,\n type: taskType,\n users: pushmeetuserArr\n });\n\n firebase.database().ref('Home/Notification/' + newTaskKey).set({\n id: newTaskKey,\n time: unixdate,\n title: title,\n location: venue, \n link: link,\n type: taskType,\n users: pushmeetuserArr\n });\n sendNotif();\n // alert(\"Task Posted\"); \n // window.location.reload(); \n}", "playBeat(selectedDrum) {\n this.midiSounds.playDrumsNow([selectedDrum]);\n\n if (this.state.recordStatus) {\n this.state.recordTune.beatPlayed.push(selectedDrum);\n this.state.recordTune.timePlayed.push(new Date())\n console.log(this.state.recordTune);\n }\n }", "function createUserLogReasonForHostMaintenance(scheduleId, selectedSite, selectedHost, selectedService, selectedSource) {\n var currentUserProfile;\n\n if (userProfilereq.readyState == 4) {\n var userProfileData = JSON.parse(showErrorMain(userProfilereq.responseText, \"Error Found\"));\n\n if (Object.entries(userProfileData).length != 0) {\n currentUserProfile = userProfileData['UserInfo'];\n var setChosenScheduleId = \"\"\n\n var setSelectedSite = \"\";\n var setSelectedHost = \"\";\n var setSelectedService = \"\";\n var setSelectedSource = \"\";\n\n var loggedInUser = currentUserProfile['userLogin'];\n\n var setReason = \"User: \" + loggedInUser + \", created a HOST MAINTENANCE SCHEDULE with the following details: \";\n\n\n // setting reason\n\n setChosenScheduleId = \"Schedule ID : \" + scheduleId + \"\";\n setSelectedSite = \"Site: \" + selectedSite + \"\";\n setSelectedHost = \"Host: \" + selectedHost + \"\";\n\n\n\n if (selectedService != \"\" && selectedService != undefined) {\n setSelectedService = \"Service: \" + selectedService + \"\";\n }\n if (selectedSource != \"\" && selectedSource != undefined) {\n setSelectedSource = \"Source: \" + selectedSource + \"\";\n }\n // selectedUserID = \"InovoMonitor.tblUsers.ID=\" + selectUserID;\n\n\n\n var finalReason;\n // var intialQuery = \"SELECT InovoMonitor.tblSites.sitename, InovoMonitor.tblAlarms.hostid, InovoMonitor.tblAlarms.id, InovoMonitor.tblHosts.hostName, InovoMonitor.tblAlarms.description, InovoMonitor.tblAlarms.severity, InovoMonitor.tblAlarms.Message, InovoMonitor.tblAlarms.currentstatus, InovoMonitor.tblAlarms.source, InovoMonitor.tblAlarms.category, InovoMonitor.tblAlarms.created, InovoMonitor.tblAlarms.updated, InovoMonitor.tblAlarms.updatedby FROM InovoMonitor.tblAlarms INNER JOIN InovoMonitor.tblHosts ON InovoMonitor.tblAlarms.hostid = InovoMonitor.tblHosts.id INNER JOIN InovoMonitor.tblSites ON InovoMonitor.tblSites.id = InovoMonitor.tblHosts.siteid \";\n // var intialQuery = \"UPDATE InovoMonitor.tblUsers SET \";\n // + setNewUserName + \", \" + setNewUserSurname + \", \" + setNewUserPass + \", \" + setNewUserActive + \" , \" + setNewUserAccess + \" WHERE \" + +\";\"\n\n var clauseQuery = \"\";\n var queryArr = [];\n\n queryArr.push(setChosenScheduleId);\n queryArr.push(setSelectedSite);\n queryArr.push(setSelectedHost);\n\n\n\n if (setSelectedService != \"\") {\n queryArr.push(setSelectedService);\n }\n\n if (setSelectedSource != \"\") {\n queryArr.push(setSelectedSource);\n }\n\n\n\n if (queryArr.length >= 2) {\n var n = 0;\n for (i = 0; i < queryArr.length - 1; i++) {\n n++;\n clauseQuery += queryArr[i] + \", \";\n }\n\n clauseQuery += queryArr[n];\n\n }\n else if (queryArr.length == 1) {\n clauseQuery += queryArr[0];\n }\n\n finalReason = setReason + clauseQuery;\n\n\n\n return finalReason;\n }\n }\n}", "function addChampion(champion) {\n\n\n\tif (selectLevel.value === \"game-small\") {\n\n\t\tif(champion.recordSmall){\n\t\t\t\n\t\t\tconst recordSmallM = Math.floor(champion.recordSmall/ 60);\n\t\t\tconst recordSmallS = champion.recordSmall % 60;\n\t\t\tconst timeSmall = champion.recordSmallDate.toDate();\n\t\t\tconst timeSmallString = `${timeSmall.getDate()}.${timeSmall.getMonth() + 1}.${timeSmall.getFullYear()}`;\n\n\t\t\tchampionContainer.style.display = \"flex\";\n\t\t\tchampionDiv.innerHTML = `${champion.username}<br>שיא: ${recordSmallM}:${recordSmallS}<br>\n\t\t\t\t\t\t\t\t\t${timeSmallString}`;\n\t\t}else{\n\t\t\tchampionContainer.style.display = \"none\";\n\t\t};\n\n\t} else if (selectLevel.value === \"game-medium\"){\n\n\t\tif(champion.recordMedium){\n\n\t\t\tconst recordMediumM = Math.floor(champion.recordMedium/ 60);\n\t\t\tconst recordMediumS = champion.recordMedium % 60;\n\t\t\tconst timeMedium = champion.recordMediumDate.toDate();\n\t\t\tconst timeMediumString = `${timeMedium.getDate()}.${timeMedium.getMonth() + 1}.${timeMedium.getFullYear()}`;\n\n\t\t\tchampionContainer.style.display = \"flex\";\n\t\t\tchampionDiv.innerHTML = `${champion.username}<br>שיא: ${recordMediumM}:${recordMediumS}<br>\n\t\t\t\t\t\t\t\t\t${timeMediumString}`;\n\t\t}else{\n\t\t\tchampionContainer.style.display =\" none\";\n\t\t};\n\t};\n}", "function putUserStoriesOnPage() {\n console.debug(\"putUserStoriesOnPage\");\n\n $myStories.empty();\n\n if (currentUser.myStories.length === 0) {\n $myStories.append(\"<h4>No user stories yet!</h4>\");\n } else {\n for (let story of currentUser.myStories) {\n let $story = generateStoryMarkup(story, true);\n $myStories.append($story);\n }\n }\n $myStories.show();\n}", "addUser(user) {\n // normale Logik aufrufen\n super.addUser(user);\n // User-spezifische Spielvariable initialisieren\n this.SchiffePos[user.id] = {\n sindBooteGesetzt: false,\n Boote : \"\",\n Getroffen : \"\"\n };\n\n // Es kann 'richtig' losgehen, sobald 2 Leute im Raum sind\n\tif (this.currentGameState === WAITING_TO_START && this.users.length == 2) {\n\t\tthis.startGame();\n }\n\n}", "function checkTimesAndAskStandup(bot) {\n getAskingTimes(function (err, askMeTimes) {\n \n if (!askMeTimes) {\n return;\n }\n\n for (var channelId in askMeTimes) {\n\n for (var userId in askMeTimes[channelId]) {\n\n var askMeTime = askMeTimes[channelId][userId];\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n if (compareHoursAndMinutes(currentHoursAndMinutes, askMeTime)) {\n\n hasStandup({user: userId, channel: channelId}, function(err, hasStandup) {\n\n // if the user has not set an 'ask me time' or has already reported a standup, don't ask again\n if (hasStandup == null || hasStandup == true) {\n var x = \"\";\n } else {\n doStandup(bot, userId, channelId);\n }\n });\n }\n }\n }\n });\n}" ]
[ "0.6443461", "0.592248", "0.59018815", "0.58021027", "0.57642514", "0.5632085", "0.5553548", "0.5301624", "0.516726", "0.51363057", "0.5127875", "0.5127709", "0.5107881", "0.51040447", "0.50867414", "0.50698984", "0.5049063", "0.504188", "0.50250804", "0.5000019", "0.49985132", "0.49903136", "0.4987935", "0.49846178", "0.49741217", "0.49724045", "0.49674425", "0.49509475", "0.49315158", "0.48898286", "0.48733655", "0.4858274", "0.48533976", "0.48521408", "0.4851132", "0.48408535", "0.48403925", "0.4838794", "0.48370904", "0.48369405", "0.48196787", "0.4810918", "0.47998425", "0.47988293", "0.47828752", "0.47735894", "0.47709984", "0.4763101", "0.4758123", "0.47253856", "0.47225413", "0.47173762", "0.47162423", "0.47110304", "0.47066486", "0.47059238", "0.46992734", "0.46978894", "0.46954167", "0.4684762", "0.46811926", "0.46687868", "0.46678358", "0.46647868", "0.46619996", "0.46596777", "0.46584067", "0.465317", "0.46522492", "0.46498188", "0.4646797", "0.46374494", "0.46361718", "0.46316373", "0.46293738", "0.46236083", "0.46229535", "0.46203902", "0.46182397", "0.46177012", "0.461766", "0.4614363", "0.46142384", "0.46062827", "0.46042827", "0.45983645", "0.45981705", "0.4596784", "0.45966503", "0.45938253", "0.4592616", "0.4589645", "0.45877504", "0.457618", "0.45756167", "0.45731404", "0.4571737", "0.45701328", "0.45659852", "0.45643342" ]
0.74245036
0
gets all standup data for a channel
function getStandupData(channel, cb) { controller.storage.teams.get('standupData', function(err, standupData) { if (!standupData || !standupData[channel]) { cb(null, null); } else { cb(null, standupData[channel]); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLobbyData(){}", "function clearStandupData(channel) {\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel]) {\n return;\n } else {\n delete standupData[channel];\n controller.storage.teams.save(standupData);\n }\n });\n}", "function readChannelsList() {\n // DEFINE LOCAL VARIABLES\n\n // NOTIFY PROGRESS\n console.log('reading channels');\n\n // HIT METHOD\n asdb.read.channelsList().then(function success(s) {\n console.log('Channels collection:');\n \n var i = 1;\n Object.keys(s).forEach(function(key) {\n console.log(i + \". \" + s[key].title + \" (\" + key + \")\");\n i++;\n });\n\n }).catch(function error(e) {\n\t\tconsole.log(\"error\", e);\n\t});\n\n}", "function fetchChannels() {\n const top = async (total) => {\n const pages = Math.ceil(total / 100);\n results = [];\n channels = [];\n\n const args = \" -H 'query: username' -H 'history: default' -H 'clientid: \" + 'cli_f0d30ff74a331ee97e486558' +\n \"' -H 'token: \" + '7574a0b5ff5394fd628727f9d6d1da723a66736f3461930c79f4080073e09e349f5e8e366db4500f30c82335aa832b64b7023e0d8a6c7176c7fe9a3909fa43b7' +\n \"' -X GET https://matrix.sbapis.com/b/youtube/statistics\";\n\n for (let index = 0; index < pages; index++) {\n results.push(await client.youtube.top('subscribers', index + 1));\n }\n\n for (let page_index = 0; page_index < results.length; page_index++) {\n for (let index = 0; index < results[page_index].length; index++) {\n channel = results[page_index][index];\n channel['grade'] = \"N/A\";\n// channel_args = args;\n// exec('curl ' + channel_args.replace(\"username\",channel['id']['username']), function (error, stdout, stderr) {\n// console.log('stdout: ' + stdout)\n// if (stdout != null && stdout['data'] != undefined && stdout['data']['misc'] != undefined\n// && stdout['data']['misc']['grade'] != undefined && stdout['data']['misc']['grade']['grade'] != undefined) {\n// channel['grade'] = stdout['data']['misc']['grade']['grade'];\n// } else {\n// channel['grade'] = '';\n// }\n// console.log('stderr: ' + stderr);\n// if (error !== null) {\n// console.log('exec error: ' + error);\n// }\n// });\n channels.push(channel);\n }\n }\n\n var file = fs.createWriteStream('output.csv');\n file.write(\"id, username, display_name, created_at, channel_type, country, uploads, subscribers, views\" + \"\\n\");\n file.on('error', function(err) { /* error handling */ });\n channels.forEach(function(channel) {\n file.write(channel['id']['id'] + \", \" + channel['id']['username'] + \", \" + channel['id']['display_name'] + \", \"\n + channel['general']['created_at'] + \", \" + channel['general']['channel_type'] + \", \" + channel['general']['geo']['country'] + \", \"\n + channel['statistics']['total']['uploads'] + \", \" + channel['statistics']['total']['subscribers'] + \", \" + channel['statistics']['total']['views'] + \"\\n\");\n });\n\n file.end();\n\n return results;\n};\n\n top(500).then(\"done\").catch(console.error);\n}", "function getAllChannelDataTS(){\n getDataField1();\n getDataField2();\n getDataField3();\n getDataField4();\n getDataField5();\n getDataField6();\n getDataField7();\n getDataField8();\n }", "function populateInit() {\n for (var i = 0; i < channels.length; i++) {\n channel = channels[i];\n channelurl = baseUrl + \"/channels/\" + channel;\n $.ajax({\n \"url\": channelurl,\n dataType: \"jsonp\",\n success: populateDOM,\n error: errorChannel,\n });\n }\n }", "function getChannel() {\n channels.forEach(function(channel) {\n function makeURL(type, name) {\n return 'https://wind-bow.gomix.me/twitch-api/' + type + '/' + name + '?callback=?';\n };\n $.getJSON(makeURL(\"channels\", channel), function(data) {\n $(\"#\" + channel).attr('src',data.logo)\n $(\".\" + channel).html(channel)\n $(\"#\" + channel + '1').attr('href', data.url)\n $(\".game\" + channel).html('GAME:' + '<br>' + data.game)\n $(\".status\" + channel).html('STATUS:' + '<br>' + data.status)\n });\n $.getJSON(makeURL(\"streams\",channel), function(data) {\n console.log(data);\n var str1 = 'This user is currently not streaming.';\n if (data.stream === null) {\n $(\".\" + channel).addClass(\"offline\")\n $(\".game\" + channel).html(str1)\n $('.game' + channel).show();\n } else {\n $(\".\" + channel).addClass(\"online\")\n $(\".game\" + channel).removeClass('hidden')\n $(\".status\" + channel).removeClass('hidden')\n }\n });\n });\n}", "async function fetchStreamData() {\n await getStreamCommits(streamId, 1, null, token).then(str => {\n stream = str.data.stream\n\n // Split the branches into \"main\" and everything else\n mainBranch = stream.branches.items.find(b => b.name == \"main\")\n beams = stream.branches.items.filter(b => b.name.startsWith(\"beam\"))\n columns = stream.branches.items.filter(b => b.name.startsWith(\"column\"))\n console.log(\"main branch\", mainBranch)\n console.log(\"beam options\", beams)\n console.log(\"column options\", columns)\n })\n}", "function display_channels(){\n //clear the local storage current channel\n localStorage.setItem('channel', null);\n localStorage.setItem('id', null);\n //clear the current channel's list of users\n document.querySelector('.users').innerHTML = '';\n //get channels from the server\n const request = new XMLHttpRequest();\n request.open('GET', '/channels');\n request.onload = ()=>{\n const data = JSON.parse(request.responseText);\n if (data.length === 0) {\n var empty = false;\n channels(empty);\n } else {\n channels(data);\n }\n };\n data = new FormData;\n request.send(data)\n }", "function setupChannel() {\n\n // Join the control channel\n controlChannel.join().then(function(channel) {\n print('Joined controlchannel as '\n + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n controlChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n console.log('lenis')\n test();\n //printcontrol()\n if (message.body.search(\"@anon\")>=0)\n {\n $.get( \"alch/\"+message.body, function( data ) {\n\n console.log(data);\n });\n }\n else if (message.body.search(\"@time\")>=0)\n {\n\n test();\n // var date=new Date().toLocaleString();\n // controlChannel.sendMessage(date);\n\n }\n else if (message.body.search(\"@junk\")>=0)\n {\n console.log(\"penis\");\n// test();\n }\n\n\n });\n }", "prepareDataChannel(channel) {\n channel.onopen = () => {\n log('WebRTC DataChannel opened!');\n snowflake.ui.setActive(true);\n // This is the point when the WebRTC datachannel is done, so the next step\n // is to establish websocket to the server.\n return this.connectRelay();\n };\n channel.onclose = () => {\n log('WebRTC DataChannel closed.');\n snowflake.ui.setStatus('disconnected by webrtc.');\n snowflake.ui.setActive(false);\n this.flush();\n return this.close();\n };\n channel.onerror = function() {\n return log('Data channel error!');\n };\n channel.binaryType = \"arraybuffer\";\n return channel.onmessage = this.onClientToRelayMessage;\n }", "function getAllData() {\n fillPlayerList();\n}", "function getChannel(name) {\n\t\t$.ajax({\n\t\t\tdataType: 'json',\n\t\t\theaders: {\n\t\t\t\t'Client-ID': process.env.TWITCH_CLIENT_ID,\n\t\t\t},\n\t\t\turl: `https://api.twitch.tv/kraken/channels/${name}`\n\t\t})\n\t\t.done(json => {\n\t\t\tconst streamData = {\n\t\t\t\tstreamUrl: json.url,\n\t\t\t\tstreamLogo: json.logo || defaultLogo,\n\t\t\t\tstreamName: json.display_name,\n\t\t\t\tstreamInfo: json.status || defaultInfo,\n\t\t\t\tstreamStatus: 'offline'\n\t\t\t};\n\t\t\t$('#featuredDivider').append(streamTemplate(streamData));\n\t\t})\n\t\t.fail(err => {\n\t\t\tconsole.log(err);\n\t\t});\n\t}", "function loadWelcomeChannels() {\n\tpool.getConnection(function(err, connection) {\n\t\tconnection.query(\"SELECT * FROM wmtoggle\", function(err, results) {\n\t\t\tfor(var i in results) {\n\t\t\t\tif(welcomeServers.hasOwnProperty(\"server\" + results[i].serverID))\n\t\t\t\t\twelcomeServers[\"server\" + results[i].serverID]['channel' + results[i].channelID] = {'jtoggle': results[i].welcomeMessage, 'ltoggle': results[i].leaveMessage};\n\t\t\t\telse {\n\t\t\t\t\twelcomeServers[\"server\" + results[i].serverID] = {};\n\t\t\t\t\twelcomeServers[\"server\" + results[i].serverID]['channel' + results[i].channelID] = {'jtoggle': results[i].welcomeMessage, 'ltoggle': results[i].leaveMessage};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.log(localDateString() + \" | \" + colors.green(\"[LOAD]\") + \" Loaded all the Welcome Channels!\");\n\t\t\tconnection.release();\n\t\t});\n\t});\n}", "function getData() {\n if(app.connected) {\n // prepare thingspeak URL\n // set up a thingspeak channel and change the write key below\n var key = 'IKYH9WWZLG5TVYF2'\n var urlTS = 'https://api.thingspeak.com/update?api_key=' + key + '&field1=' + app.heartRate;\n // make the AJAX call\n $.ajax({\n url: urlTS,\n type: \"GET\",\n dataType: \"json\",\n success: onDataReceived,\n error: onError\n });\n }\n\t}", "function getInfo() {\n list.forEach(function(channel) {\n function makeURL(type, name) {\n return 'https://wind-bow.gomix.me/twitch-api/' + type + '/' + name + '?callback=?';\n };\n\n //Get logo, name, and display name from \"users\" URL\n $.getJSON(makeURL(\"users\", channel), function(data) {\n var logo = data.logo;\n var displayName = data.display_name;\n var name = data.name;\n\n //Get status and game from \"streams\" URL\n $.getJSON(makeURL(\"streams\", channel), function(data2) {\n if (data2.stream === null) {\n status = \"OFFLINE\";\n game = \"\";\n }\n\n if (data2.stream) {\n status = \"ONLINE\";\n game = data2.stream.game;\n }\n\n html = '<div class=\"box\"><div><img src=\"' + logo + '\" class=\"logoSize\" alt=\"Logo\"></div><div class=\"nameSize\"><a href=\"' + \"https://go.twitch.tv/\" + name + '\" target=\"_blank\">' + displayName + '</a></div>' + '<a href=\"' + \"https://go.twitch.tv/\" + name + '\" target=\"_blank\"><div class=\"statusSize\">' + status + '</div><div class=\"gameSize\">' + game + '</div></a></div>';\n\n $(\"#display\").prepend(html);\n\n //Add online users to \"onlines\" variable\n if (data2.stream) {\n onlines.push(html);\n }\n\n //Add offline users to \"offlines\" variable\n if (data2.stream === null) {\n offlines.push(html);\n }\n\n $(\"#all\").click(function() {\n $(\"#display\").empty();\n $(\"#display\").prepend(onlines);\n $(\"#display\").prepend(offlines);\n $(\"#offline\").removeClass(\"active\");\n $(\"#online\").removeClass(\"active\");\n $(\"#all\").addClass(\"active\");\n });\n\n $(\"#online\").click(function() {\n $(\"#display\").empty();\n $(\"#display\").prepend(onlines);\n $(\"#offline\").removeClass(\"active\");\n $(\"#all\").removeClass(\"active\");\n $(\"#online\").addClass(\"active\");\n });\n\n $(\"#offline\").click(function() {\n $(\"#display\").empty();\n $(\"#display\").prepend(offlines);\n $(\"#all\").removeClass(\"active\");\n $(\"#online\").removeClass(\"active\");\n $(\"#offline\").addClass(\"active\");\n });\n }); //End second getJSON\n }); //End first getJSON\n }); //End list.forEach(function(channel))\n}", "function getStandupTime(channel, cb) {\n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n if (!standupTimes || !standupTimes[channel]) {\n cb(null, null);\n } else {\n cb(null, standupTimes[channel]);\n }\n });\n}", "async function fetchData() {\n const channels = await getChannels();\n\n const data = {\n title: 'ChatX',\n content: component,\n state: {\n rooms: channels, // preload existing rooms\n messages: [],\n signedIn: req.session.user ? true : false\n }\n };\n\n res.status(200);\n res.render('index', data);\n }", "async initializeChannel(channel) {\r\n\t\tconst now = new Date().getTime();\r\n const queries = newChannelSql.split(';');\r\n\t\tfor(const i in queries) {\r\n\t\t\tconst query = queries[i];\r\n\t\t\tlet params = {};\r\n\t\t\tif(query.indexOf('$channel') > -1) {\r\n\t\t\t\tparams['$channel'] = channel;\r\n\t\t\t}\r\n\t\t\tif(query.indexOf('$now') > -1) {\r\n\t\t\t\tparams['$now'] = now;\r\n\t\t\t}\r\n\t\t\tawait sql.run(query, params);\r\n\t\t}\r\n\r\n\t\tlet offset = (await sql.get(`SELECT Offset FROM Worlds ORDER BY ID`)).Offset;\r\n\t\tif(!offset) offset = Math.floor(Math.random() * 1000);\r\n\t\tawait sql.run(`UPDATE Worlds SET Offset = $offset WHERE Channel = $channel`, {$offset: offset, $channel: channel});\r\n\r\n\t\treturn await this.getWorld(channel);\r\n\t}", "function setupChannelApis() {\n var fabricNet=require(__dirname+'/utils/fabric_net_api.js')(fcw,configer,logger);\n\n var channelinfo={\n low:0,\n high:0,\n currentBlockHash:\"\",\n previousBlockHash:\"\"\n };\n\n app.channelinfo=channelinfo;\n //enroll_admin\n fabricNet.enroll_admin(2,function (err,obj) {\n if(err==null) {\n logger.info(\"get genesis block\");\n var g_option = configer.makeEnrollmentOptions(0);\n g_option.chaincode_id=configer.getChaincodeId();\n g_option.chaincode_version=configer.getChaincodeVersion();\n logger.info(g_option.chaincode_id);\n g_option.event_url=configer.getPeerEventUrl(configer.getFirstPeerName(configer.getChannelId()))\n\n fcw.query_channel_info(obj,g_option,function (err,resp) {\n if (err!=null){\n logger.error(\"Error for getting channel info!\");\n }else {\n app.channelinfo.low=resp.height.low;\n app.channelinfo.high=resp.height.high;\n app.channelinfo.currentBlockHash=resp.currentBlockHash;\n app.channelinfo.previousBlockHash=resp.previousBlockHash\n }\n });\n\n var cc_api=require(__dirname+'/utils/creditcheck_cc_api.js')(obj,g_option,fcw,logger);\n cc_api.setupEventHub(app.wss,app.channelinfo);\n app.cc_api=cc_api;\n }else{\n logger.error(\"Error for enroll admin to channel!\");\n }\n });\n}", "async function getCMCData() {\n //WARNING! This will pull ALL cmc coins and cost you about 11 credits on your api account!\n let cmcJSON = await clientcmc.getTickers({ limit: 4200 }).then().catch(console.error);\n cmcArray = cmcJSON['data'];\n cmcArrayDictParsed = cmcArray;\n cmcArrayDict = {};\n try {\n cmcArray.forEach(function (v) {\n if (!cmcArrayDict[v.symbol])\n cmcArrayDict[v.symbol] = v;\n });\n } catch (err) {\n console.error(chalk.red.bold(\"failed to get cmc dictionary for metadata caching!\"));\n }\n //console.log(chalk.green(chalk.cyan(cmcArray.length) + \" CMC tickers updated!\"));\n}", "function displayChannels(data) {\n\t\t\t$(`#${userName}`).append(\"<div class='layout col-lg-3 col-md-3 col-sm-12'><div class='user-name'>\" + `${data.display_name}` + \"</div></div>\");\n\t\t\t$(`#${userName} div div`).append(`<a target=\"_blank\" href=\"${data.url}\"><img src=\"${data.logo}\"></img></a>`);\n\t\t\t$.getJSON(urlStreams, displayStatus);\n\t\t}", "function listChannels(){\n $http.get(baseUrl+\"/mobilegateway/masterdata/channels\")\n .then(function(response) {\n $scope.getChannelType = response.data.channelList;\n });\n }", "function startChannelStats() {\n stats = setInterval(() => {\n ApiHandle.getStats().then(data => {\n if (data == null) { // They are not live or the channel doesn't exist.\n console.log(\"The user is not live or there was an error getting stats.\")\n } else { // Sets the info from the request next to the icons on the chat page.\n if (data.channel.stream.countViewers !== undefined && data.channel.stream.countViewers !== null) {\n document.getElementById(\"fasUsers\").innerHTML = `<span><i class=\"fas fa-users\"></i></span> ${data.channel.stream.countViewers}`\n }\n if (data.followers.length !== undefined && data.followers.length !== null) {\n document.getElementById(\"fasHeart\").innerHTML = `<span><i class=\"fas fa-heart\"></i></span> ${data.followers.length}`\n }\n if (data.channel.stream.newSubscribers !== undefined && data.channel.stream.newSubscribers !== null) {\n document.getElementById(\"fasStar\").innerHTML = `<span><i class=\"fas fa-star\"></i></span> ${data.channel.stream.newSubscribers}`\n }\n }\n })\n }, 900000);\n}", "async channels(sender) {\n let channels = await slack.getAllChannels()\n channels = _.orderBy(channels, ['name'], ['asc'])\n const bundle = channels.map((c) => {\n if (c.is_archived || c.is_im || c.is_mpim) {\n return\n }\n let type = 'public'\n if (c.is_private || c.is_group) {\n type = 'private'\n }\n if (c.is_general) {\n type = 'general'\n }\n return `${c.name} | ${c.id} | ${type} | ${c.num_members || 0}`\n })\n bundle.unshift(`Name | ChannelId | Type | Members`)\n await slack.postEphemeral(sender, bundle.join('\\n'))\n }", "function getDataForAllChannels() {\n channels.forEach(function(channel) {\n // Data from the Channels API\n $.getJSON(\"https://wind-bow.gomix.me/twitch-api/channels/\" + channel + \"?callback=?\", function(data) {\n var status, url, name, logo;\n if (data.error === \"Not Found\") {\n status = false;\n url = '';\n name = '<div class=\"col-md-2\">' + channel + '</div>';\n logo = \"https://dummyimage.com/50x50/ecf0e7/5c5457.jpg&text=0x3F\";\n } else {\n status = true;\n url = '<a href=\"' + data.url + '\" target=\"_blank\">';\n name = '<div class=\"col-md-2\">' + data.name + '</div></a>';\n logo = data.logo;\n };\n // Data from the Streams API\n $.getJSON(\"https://wind-bow.gomix.me/twitch-api/streams/\" + channel + \"?callback=?\", function(streamdata) {\n if (status === false) {\n status = \"Not on twitch\";\n } else if (streamdata.stream === null) {\n status = \"Offline\";\n } else {\n url = '<a href=\"' + streamdata.stream.channel.url + '\" target=\"_blank\">';\n status = '<a href=\"' + streamdata.stream.channel.url + '\">' + streamdata.stream.channel.status + '</a>';\n }\n // Build the page from the pulled data\n var html = '<div class=\"row text-center\" id=\"datarow\">' +\n url + '<div class=\"col-xs-2 col-sm-1\"><img src=\"' +\n logo + '\"></div><div class=\"col-xs-10 col-sm-3\">' +\n name + '</div><div class=\"col-xs-10 col-sm-8\"\">' +\n status + '</div></div>';\n document.getElementById(\"rows\").innerHTML += html;\n });\n });\n });\n}", "initChannels() {\n this.initFetchAll();\n this.initGenerate();\n this.initSubmit();\n this.initDelete();\n this.initFetchOne();\n this.initUpdate();\n }", "function channelHandler(agent) {\n console.log('in channel handler');\n var jsonResponse = `{\"ID\":10,\"Listings\":[{\"Title\":\"Catfish Marathon\",\"Date\":\"2018-07-13\",\"Time\":\"11:00:00\"},{\"Title\":\"Videoclips\",\"Date\":\"2018-07-13\",\"Time\":\"12:00:00\"},{\"Title\":\"Pimp my ride\",\"Date\":\"2018-07-13\",\"Time\":\"12:30:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"13:30:00\"},{\"Title\":\"Daria\",\"Date\":\"2018-07-13\",\"Time\":\"13:45:00\"},{\"Title\":\"The Real World\",\"Date\":\"2018-07-13\",\"Time\":\"14:00:00\"},{\"Title\":\"The Osbournes\",\"Date\":\"2018-07-13\",\"Time\":\"15:00:00\"},{\"Title\":\"Teenwolf\",\"Date\":\"2018-07-13\",\"Time\":\"16:00:00\"},{\"Title\":\"MTV Unplugged\",\"Date\":\"2018-07-13\",\"Time\":\"16:30:00\"},{\"Title\":\"Rupauls Drag Race\",\"Date\":\"2018-07-13\",\"Time\":\"17:30:00\"},{\"Title\":\"Ridiculousness\",\"Date\":\"2018-07-13\",\"Time\":\"18:00:00\"},{\"Title\":\"Punk'd\",\"Date\":\"2018-07-13\",\"Time\":\"19:00:00\"},{\"Title\":\"Jersey Shore\",\"Date\":\"2018-07-13\",\"Time\":\"20:00:00\"},{\"Title\":\"MTV Awards\",\"Date\":\"2018-07-13\",\"Time\":\"20:30:00\"},{\"Title\":\"Beavis & Butthead\",\"Date\":\"2018-07-13\",\"Time\":\"22:00:00\"}],\"Name\":\"MTV\"}`;\n var results = JSON.parse(jsonResponse);\n var listItems = {};\n textResults = getListings(results);\n\n for (var i = 0; i < results['Listings'].length; i++) {\n listItems[`SELECT_${i}`] = {\n title: `${getShowTime(results['Listings'][i]['Time'])} - ${results['Listings'][i]['Title']}`,\n description: `Channel: ${results['Name']}`\n }\n }\n\n if (agent.requestSource === 'hangouts') {\n const cardJSON = getHangoutsCard(results);\n const payload = new Payload(\n 'hangouts',\n cardJSON,\n {rawPayload: true, sendAsMessage: true},\n );\n agent.add(payload);\n } else {\n agent.add(textResults);\n }\n}", "function setupDataChannel() {\n\t\tcheckDataChannelState();\n\t\tdataChannel.onopen = checkDataChannelState;\n\t\tdataChannel.onclose = checkDataChannelState;\n\t\tdataChannel.onmessage = Reversi.remoteMessage;\n\t}", "function handleChannel (channel) {\n // Log new messages\n channel.onmessage = function (msg) {\n console.log('Getting data')\n console.log(msg)\n handleMessage(JSON.parse(msg.data), channel)\n waitingOffer = msg.data\n }\n // Other events\n channel.onerror = function (err) { console.log(err) }\n channel.onclose = function () { console.log('Closed!') }\n channel.onopen = function (evt) { console.log('Opened') }\n}", "async getChannels() {\n const response = await fetch(`https://slack.com/api/conversations.list?token=${SLACK_TOKEN}`,\n );\n const responseJson = await response.json();\n this.setState({ channels: responseJson.channels });\n }", "function initData(){\n o_data = user.original_musics;\n d_data = user.derivative_musics;\n c_data = user.collected_musics;\n}", "function getdata() {\n\n var url = `/data`;\n\n d3.json(url).then(function(xx) {\n\n data = []\n // xx.slice(s, e)\n globaldata = xx;\n unfiltered = xx;\n actual = [], minute = []\n \n makedata();\n})\n}", "function getStreamByChannel(channel) {\n return twitchService.get(channel).then(function(response) {\n console.info(response.data);\n var data = response.data;\n data.name = channel;\n vm.streams.push(data);\n }, function(err) {\n console.log(err);\n vm.streams.errors = vm.streams.errors || [];\n vm.streams.errors.push({ name: channel, message: err.data.message});\n });\n }", "function loadChatStats() {\n startChannelStats();\n botToViewerRatio();\n}", "function GetSettings(){\n socket.emit('client_data', Update);\n }", "createChannel() {\n\t\t// Set the depends - add self aggs query as well with depends\n\t\tlet depends = this.props.depends ? this.props.depends : {};\n\t\tdepends['aggs'] = {\n\t\t\tkey: this.props.inputData,\n\t\t\tsort: this.props.sort,\n\t\t\tsize: this.props.size\n\t\t};\n\t\t// create a channel and listen the changes\n\t\tvar channelObj = manager.create(depends);\n\t\tchannelObj.emitter.addListener(channelObj.channelId, function(res) {\n\t\t\tlet data = res.data;\n\t\t\tlet rawData;\n\t\t\tif(res.method === 'stream') {\n\t\t\t\trawData = this.state.rawData;\n\t\t\t\trawData.hits.hits.push(res.data);\n\t\t\t} else if(res.method === 'historic') {\n\t\t\t\trawData = data;\n\t\t\t}\n\t\t\tthis.setState({\n\t\t\t\trawData: rawData\n\t\t\t});\n\t\t\tthis.setData(rawData);\n\t\t}.bind(this));\n\t}", "function getData()\n\t\t{\n\t\t\tvar newData = { hello : \"world! it's \" + new Date().toLocaleTimeString() }; // Just putting some sample data in for fun.\n\n\t\t\t/* Get my data from somewhere and populate newData with it... Probably a JSON API or something. */\n\t\t\t/* ... */\n\n\t\t\t// I'm calling updateCallback to tell it I've got new data for it to munch on.\n\t\t\tupdateCallback(newData);\n\t\t}", "function setupChannel() {\r\n\r\n\t\t// Join the general channel\r\n\t\tgeneralChannel.join().then(function(channel) {\r\n\t\t\tconsole.log('Enter Chat room');\r\n\r\n\t\t\t// Listen for new messages sent to the channel\r\n\t\t\tgeneralChannel.on('messageAdded', function(message) {\r\n\t\t\t\tremoveTyping();\r\n\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(message.index);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// 招待先プルダウンの描画\r\n\t\t\tvar storedInviteTo = storage.getItem('twInviteTo');\r\n\t\t\tgenerateInviteToList(storedInviteTo);\r\n\r\n\t\t\t// 招待先プルダウンの再描画\r\n\t\t\tgeneralChannel.on('memberJoined', function(member) {\r\n\t\t\t\tconsole.log('memberJoined');\r\n\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t});\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('memberLeft', function(member) {\r\n\t\t\t\tconsole.log('memberLeft');\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\r\n\t\t\t// Typing Started / Ended\r\n\t\t\tgeneralChannel.on('typingStarted', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing started');\r\n\t\t\t\tshowTyping();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('typingEnded', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing ended');\r\n\t\t\t\tclearTimeout(typingTimer);\r\n\t\t\t});\r\n\r\n\t\t\t// 最終既読メッセージindex取得\r\n\t\t\tgeneralChannel.getMembers().then(function(members) {\r\n\t\t\t\tfor (i = 0; i < members.length; i++) {\r\n\t\t\t\t\tvar member = members[i];\r\n\t\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tif (identity != member.identity && inviteToNames.indexOf(member.identity) != -1) {\r\n\t\t\t\t\t\treadStatusObj[identity] = member.lastConsumedMessageIndex;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Get Messages for a previously created channel\r\n\t\t\t\tgeneralChannel.getMessages().then(function(messages) {\r\n\t\t\t\t\t$chatWindow.empty();\r\n\t\t\t\t\tvar lastIndex = null;\r\n\t\t\t\t\tfor (i = 0; i < messages.length; i++) {\r\n\t\t\t\t\t\tvar message = messages[i];\r\n\t\t\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\t\t\tlastIndex = message.index;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (lastIndex && lastIndex >= 0) {\r\n\t\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(lastIndex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\thideSpinner();\r\n\t\t\t\t\t$('#chat-input').prop('disabled', false);\r\n\t\t\t\t});\r\n\r\n\t\t\t});\r\n\r\n\t\t});\r\n\r\n\t}", "static generateData() {\n\t\tconst data = {\n\t\t\taddress: util.generateRandomBitString(20),\n\t\t\tchannel: `000000${util.generateRandomBitString(4)}`,\n\t\t\tgroup: false,\n\t\t\tcmd: 'idle',\n\t\t};\n\t\t// If random bits were all 0 change the channel to 1\n\t\tdata.channel = data.channel === '0000000000' ? '0000000001' : data.channel;\n\t\tdata.id = `${data.address}:${data.channel}`;\n\t\treturn data;\n\t}", "get channels() {\n return this.getAllElements('channel');\n }", "async function fetchData(){\r\n\t//we'll hold the feed in feed\r\n\tlet feed;\r\n\t//fetch the text feed from our local copy\r\n\tawait fetch(\"/feed\")\r\n\t\t.then(response => response.json())\r\n\t\t.then(data => {feed = data.feed});\r\n\t//split to arr by lines\r\n\tmodbusValues = feed.split(\"\\n\");\r\n\t//store the date from first row\r\n\tserverLastUpdate = new Date(modbusValues[0]).toString();\r\n\tclientLastUpdate = new Date().toString();\r\n\t//remove an empty string from the end\r\n\tmodbusValues.pop();\r\n\t//goes through whole array and separates the register values from strings\r\n\tmodbusValues.forEach((item, index, arr) => {\r\n\t\tarr[index] = Number(item.split(\":\")[1]);\r\n\t});\r\n}", "function initDataChannel() {\n dc = pc.createDataChannel(\"chat\", { negotiated: true, id: 0 });\n\n pc.oniceconnectionstatechange = (e) => {\n log(pc.iceConnectionState);\n if (pc.iceConnectionState === \"disconnected\") attemptReconnection();\n };\n dc.onopen = () => {\n console.log(\"chat open\");\n chat.select();\n chat.disabled = false;\n };\n dc.onclose = () => {\n console.log(\"chat closed\");\n };\n dc.onmessage = (e) => log(`> ${e.data}`);\n\n chat.onkeypress = function (e) {\n localStorage.setItem(\"T1\", \"on\");\n if (e.keyCode != 13) return;\n dc.send(this.value);\n log(this.value);\n saveMessage(this.value); //Purely optional and can be removed if not needed\n this.value = \"\";\n };\n }", "function setupChannel() {\n\n newChannel.join().then(function(channel) {\n print('Joined channel as ' + username);\n });\n\n // Get the last 5 messages\n newChannel.getMessages(5).then(function (messages) {\n for (var i = 0; i < messages.items.length; i++) {\n if (messages.items[i].author !== undefined) {\n printMessage(newChannel.uniqueName, messages.items[i].author, messages.items[i].body);\n }\n }\n });\n\n // Fired when a new Message has been added to the Channel on the server.\n newChannel.on('messageAdded', function(message) {\n console.log(message.body);\n printMessage(newChannel.uniqueName, message.author, message.body);\n });\n }", "function appendSample(data){\n channelData = []\n console.log(active);\n for (i = 0; i < 8; i++) {\n if (active[i] == 1) {\n channelData[i] = data['data']['data'][i];\n }\n else {\n channelData[i] = null;\n }\n }\n\n\n sampleToPush = {time: data['time'],\n channel1: channelData[0],\n channel2: channelData[1],\n channel3: channelData[2],\n channel4: channelData[3],\n channel5: channelData[4],\n channel6: channelData[5],\n channel7: channelData[6],\n channel8: channelData[7]\n }\n samples.push(sampleToPush);\n}", "function soft_set_channel(channel) {\n /* render UI */\n start_spinner();\n remove_player_error('channel');\n channel_error = false;\n\n /* send client-init */\n that.send_client_init(channel);\n\n /* reset stats */\n set_channel_ts = Date.now();\n startup_delay_ms = null;\n\n rebuffer_start_ts = null;\n last_rebuffer_ts = null;\n cum_rebuffer_ms = 0;\n }", "async getChannels(url) {\n const res = await axios.get(url);\n this.setState({ channels: res.data.channels });\n }", "async GetChannelViewers(channel_name) {\n let cfg = this.Config.GetConfig();\n if (this.isEnabled() !== true) return Promise.reject(new Error('TwitchAPI is disabled.'));\n if (cfg['disabled_api_endpoints'].find(elt => elt === 'Get Channel Viewers')) return Promise.reject(new Error('Endpoint is disabled.'));\n\n //ADD TO STATS\n this.STAT_API_CALLS++;\n this.STAT_API_CALLS_PER_10++;\n\n if (this.API_LOG && cfg['log_api_calls']) {\n this.API_LOG.insert({\n endpoint: 'Channel Badges',\n token: 'NONE',\n querry_params: { channel_name },\n time: Date.now()\n }).catch(err => this.Logger.warn(\"API Logging: \" + err.message));;\n }\n\n return new Promise(async (resolve, reject) => {\n let output = null;\n try {\n await this.request(\"http://tmi.twitch.tv/group/user/\" + channel_name + \"/chatters\", {}, json => {\n output = json;\n });\n resolve(output);\n } catch (err) {\n reject(err);\n }\n });\n }", "function getViewData() {\n var data = {\n channels: {}\n };\n\n for (var channel in channels) {\n data[\"channels\"][channel] = {\n properties: {\n level: {\n min: 0,\n max: 1,\n step: 0.01,\n value: channels[channel][0].gain.value,\n type: \"slider\",\n onChange: utils.generateChangeCallback(channels[channel][0].gain)\n }\n },\n name: channel\n };\n }\n\n return data;\n }", "function ChatChannelDataReadyHandler() \n{\n\tvar str = null;\n \n\t//\n\t// Incoming data on the chat channel\n\t//\n\tstr = g_oChatChannel.ReceiveChannelData();\n\t \n\t//\n\t// Update chat history window\n\t//\n\tincomingChatText.value = incomingChatText.value + L_cszUserID + str; \n\tincomingChatText.doScroll(\"scrollbarPageDown\");\n\t \n\treturn;\n}", "async getChannels(){\n try {\n const response = await fetch(`/api/channels/${this.props.uid}`)\n const body = await response.json()\n if (response.status !== 200) throw Error(body.message)\n return body\n } catch(e) {\n console.log(e)\n }\n }", "function requestHistory() {\n pubnub.history(\n {\n channel: CHANNEL_NAME_COLOR,\n count: 1, // how many items to fetch. For this demo, we only need the last item.\n },\n function (status, response) {\n if (status.error === false) {\n let lastColorMessage = response.messages[0].entry[CHANNEL_KEY_COLOR];\n let lastDuckName = response.messages[0].entry[CHANNEL_KEY_DUCKNAME];\n let timet = response.messages[0].timetoken;\n updateDuckColor(lastColorMessage, lastDuckName, timet);\n logReceivedMessage(response.messages, \"color history\");\n } else {\n console.log(\"Error recieving \" + CHANNEL_NAME_COLOR + \" channel history:\");\n console.log(status);\n }\n }\n );\n pubnub.history(\n {\n channel: CHANNEL_NAME_TALK,\n count: 1, // how many items to fetch. For this demo, we only need the last item.\n },\n function (status, response) {\n // Response returns messages in an array (even if request.count == 1)\n if (status.error === false) {\n let lastTalkMessage = response.messages[0].entry[CHANNEL_KEY_TEXT];\n let lastDuckName = response.messages[0].entry[CHANNEL_KEY_DUCKNAME];\n let timet = response.messages[0].timetoken;\n updateDuckTalk(lastTalkMessage, lastDuckName, timet);\n logReceivedMessage(response.messages, \"talk history\");\n } else {\n console.log(\"Error recieving \" + CHANNEL_NAME_TALK + \" channel history:\");\n console.log(status);\n }\n }\n );\n}", "async getPlayers(channel) {\r\n\t\tconst rows = await sql.all(`SELECT ID, Name FROM Players WHERE Channel = $channel ORDER BY UPPER(Name)`, {$channel: channel});\r\n\t\tlet players = [];\r\n\t\tfor(const row of rows) {\r\n\t\t\tconst player = await this.getPlayerById(row.ID);\r\n\t\t\tplayers.push(player);\r\n\t\t}\r\n\t\treturn players;\r\n\t}", "async function fetchAndSetUser(){\r\n const data=await getch(mygroup);\r\n console.log(data)\r\n console.log(data[0])\r\n \r\n var recieve = []\r\n for(var i = 0; i < data[0].length; i++){\r\n if(data[0][i].send == 1){\r\n console.log(\"send it\")\r\n continue;\r\n }\r\n if(data[0][i].accept == 1){\r\n console.log(\"already accept\")\r\n continue;\r\n }\r\n\r\n if(data[0][i].send == 3){\r\n console.log(\"already rejected\")\r\n continue;\r\n }\r\n console.log(i);\r\n const index = i;\r\n const withgroup = data[0][i];\r\n var mem = {withgroup : <div>&nbsp;&nbsp;From.&nbsp;&nbsp;<br></br>&nbsp;&nbsp;<button className=\"SButton\" onClick={(e)=>open_button(index,withgroup)} variant=\"outlined\" color=\"primary\" >open</button> &nbsp; {data[0][i].withgroup}</div>}\r\n //var mem = { bet : data[0][i].bet, withgroup : <div><button className=\"SButton\" onClick={(e)=>open_button(index,withgroup)} variant=\"outlined\" color=\"primary\" >open</button> &nbsp; {data[0][i].withgroup}</div>, contents : data[0][i].contents}\r\n recieve.push(mem);\r\n }\r\n console.log(recieve)\r\n if (recieve.length == 0){\r\n recieve.push({withgroup : <div className = \"empty\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Empty...</div>})\r\n }\r\n setChallenge(recieve.reverse());\r\n const dati = data[0];\r\n setDatas(dati);\r\n //setChallenge(recieve.reverse());\r\n }", "function getInfo(channel, option) {\n $.ajax({\n type: \"GET\",\n url: \"https://wind-bow.glitch.me/twitch-api/\" + option + \"/\" + channel,\n datatype: \"json\",\n success: function(val) {\n if (!(\"stream\" in val)) {\n streamNull(val, channel);\n } else if (val.stream === null) {\n getInfo(channel, \"users\");\n } else {\n streamOn(val);\n }\n }\n });\n }", "initSocket() {\n const channels = this.get('channels');\n const pusher = this.get('pusher');\n const node = this.get('nodeId');\n const sensors = this.get('sensorMap').keys();\n\n for (const channel of channels) {\n pusher.unsubscribe(channel);\n }\n\n for (const sensor of sensors) {\n const channel = `private-${NETWORK};${node};${sensor}`;\n pusher.subscribe(channel, this.appendObservation.bind(this));\n channels.push(channel);\n }\n }", "function doStandup(bot, user, channel) {\n\n var userName = null;\n\n getUserName(bot, user, function(err, name) {\n if (!err && name) {\n userName = name;\n\n bot.startPrivateConversation({\n user: user\n }, function(err, convo) {\n if (!err && convo) {\n var standupReport = \n {\n channel: channel,\n user: user,\n userName: userName,\n datetime: getCurrentOttawaDateTimeString(),\n yesterdayQuestion: null,\n todayQuestion: null,\n obstacleQuestion: null\n };\n\n convo.ask('What did you work on yesterday?', function(response, convo) {\n standupReport.yesterdayQuestion = response.text;\n \n convo.ask('What are you working on today?', function(response, convo) {\n standupReport.todayQuestion = response.text;\n \n convo.ask('Any obstacles?', function(response, convo) {\n standupReport.obstacleQuestion = response.text;\n \n convo.next();\n });\n convo.say('Thanks for doing your daily standup, ' + userName + \"!\");\n \n convo.next();\n });\n \n convo.next();\n });\n \n convo.on('end', function() {\n // eventually this is where the standupReport should be stored\n bot.say({\n channel: standupReport.channel,\n text: \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime,\n //text: displaySingleReport(bot, standupReport),\n mrkdwn: true\n });\n\n addStandupData(standupReport);\n });\n }\n });\n }\n });\n}", "function listChannels() {\r\n $('#channels ul').append(createChannelElement(yummy));\r\n $('#channels ul').append(createChannelElement(sevenContinents));\r\n $('#channels ul').append(createChannelElement(killerApp));\r\n $('#channels ul').append(createChannelElement(firstPersonOnMars));\r\n $('#channels ul').append(createChannelElement(octoberFest));\r\n\r\n}", "getData() {\n const discover = this.config.discover;\n discover.api_key = this.config.api_key;\n discover.language = (this.config.language ? this.config.language : 'en');\n\n if (Object.prototype.hasOwnProperty.call(discover, 'primary_release_date.gte')) {\n discover['primary_release_date.gte'] = moment(discover['primary_release_date.gte'] === 'now' ?\n {} : discover['primary_release_date.gte']).format('YYYY-MM-DD');\n }\n\n if (Object.prototype.hasOwnProperty.call(discover, 'primary_release_date.lte')) {\n if (periods.includes(discover['primary_release_date.lte'])) {\n discover['primary_release_date.lte'] = moment()\n .add(1, `${discover['primary_release_date.lte']}s`).format('YYYY-MM-DD');\n } else {\n discover['primary_release_date.lte'] = moment(discover['primary_release_date.lte'])\n .format('YYYY-MM-DD');\n }\n }\n\n const options = {\n url: `https://api.themoviedb.org/3/discover/movie${this.serialize(discover)}`\n };\n\n request(options, (error, response, body) => {\n if (response.statusCode === 200) {\n this.sendSocketNotification('DATA', JSON.parse(body));\n } else {\n console.log(`Error getting movie info ${response.statusCode}`);\n }\n });\n }", "componentDidMount() {\n const url = process.env.REACT_APP_SR_API + process.env.REACT_APP_ROWS;\n this.getChannels(url);\n }", "function getData(){\n pos.board = [];\n fetch(\"/api/games\").then(function(response){if(response.ok){return response.json()}\n}).then(function (json){\n jsongames = json;\n app.player = json.player\n createPos();\n createGames();\n bottons();\n \n });\n }", "function setDataChannels (necessaryMinions, contact = myContactInfo) {\n var contactId = contact.email;\n for (var i = 0; i < necessaryMinions.length; i++) {\n var minionName = necessaryMinions[i];\n switch (minionName) {\n case 'Hit detection':\n var dataChannels = [findDataChannel(dataChannelsToConnect[0], contact), findDataChannel(dataChannelsToConnect[1], contact)];\n break;\n case 'Live Motion':\n var dataChannels = [findDataChannel(aggregationChannels[0].name, contact)];\n break;\n case 'Hit Classify':\n var dataChannels = [findDataChannel(dataChannelsToConnect[2], contact)];\n break;\n }\n for (var j = 0; j < dataChannels.length; j++) {\n var dataChannel = dataChannels[j];\n if (!dataChannel) {\n return setTimeout(function () {\n setDataChannels(necessaryMinions);\n }, 3000);\n }\n }\n necessaryMinions.splice(i, 1);\n _this.app.minionManager.setDataChannelsOfSingleInstance(minionName, configObject[contactId][minionName], dataChannels);\n if (minionName === 'Live Motion')\n _this.app.minionManager.hideMinion('Live Motion');\n i--;\n }\n }", "function getData()\n\t\t{\n\t\t\tvar newData = { hello : \"world! it's \" + new Date().toLocaleTimeString() }; // Just putting some sample data in for fun.\n\n\t\t\t/* Get my data from somewhere and populate newData with it... Probably a JSON API or something. */\n\t\t\t/* ... */\n\t\t\tupdateCallback(newData);\n\t\t}", "function fetchBuildingData() {\n\t\tvar keys, ukey;\n\t\tukey = this.options.ukey;\n\t\tkeys = universeList.map(\n\t\t\tfunction( loc ) { return ukey + loc; } );\n\t\tchrome.storage.sync.get( keys, onHaveBuildingData.bind(this) );\n\t}", "constructor()\n {\n this.dataready=0;\n\n this.getdata();\n this.getWin();\n }", "getTimeSliceForDay() {\n if (this.classType === 'virtual')\n return\n\n let args = {\n classRoomId: this.classRoom.value,\n currentClass: ''\n }\n\n // alert('before send')\n ipcRenderer.send('getAllFreeTimeSlice', args)\n ipcRenderer.on('responseGetAllFreeTimeSlice', (e, args) => {\n this.availableTimeSlices = args\n })\n\n }", "function getChatList() {\n // firstly we make ajax call to the server\n $.get('/jobs/' + jobId + '/chat_info')\n // if it returns assignment data to us\n .success(function(response){\n // we assign the global variable of main information\n chatData = JSON.parse(response.data);\n // console.log(chatData);\n // create list with appropriate interpreters if this assignment is private\n findInterpreterBlockSet(chatData);\n // fill in main info about this assignment\n setJobDescrInfo(chatData);\n // create and fill in chat container\n renderEventsFirstTime();\n // and set value of unread discussions for the Active discussion tab ot the top of the page\n setActiveDiscussionsCounter();\n })\n // if the server show us an error\n .error(function(response){\n var main_error = response.responseJSON.message;\n // we show it to the user\n if (main_error) {\n showErrorsModule.showMessage([main_error], \"main-error\");\n }\n });\n } // end of getting assignment main data function", "function onDataChannelCreated(channel) {\n console.log('Created Data Channel:', channel);\n\n channel.onopen = function() {\n console.log('CHANNEL has been opened!!!');\n };\n\n channel.onmessage = (adapter.browserDetails.browser === 'firefox') ?\n receiveDataFirefoxFactory() : receiveDataChromeFactory();\n }", "function getChannel(results, callback) {\n async.concatSeries(results.get_profile, getEachChannel, callback);\n }", "function processLineup(lineup) {\n\n\t\tvar data = lineup.data, groups = {}, byId = {}, group, channel, domain, i, domainIterator, groupIterator, dataLength = data.length;\n\t\t\t// All Zenders collection\n\t\t\tgroups['000'] = [];\n\t\t\t// Favorite channels collection\n\t\t\tgroups['001'] = [];\n\n\t\tfor (i = 0; i < dataLength; i++) {\n\t\t\tchannel = data[i];\n\t\t\t// save channel by id\n\t\t\tbyId[channel.id] = channel;\n\t\t\t// logo easy access THANK YOU!\n\t\t\tbyId[channel.id].logo = channel.logoLink.href;\n\t\t\t// save channels on All Zenders collection\n\t\t\tgroups['000'].push(channel);\n\t\t\t// a little cleanning\n\t\t\tdelete channel.logoLink;\n\t\t\tdelete channel.logicalPosition;\n\t\t\tdelete channel.channel;\n\t\t\t\n\t\t\t/*\n\t\t\t// iterate domains\n\t\t\tdomainIterator = channel.domains.length;\n\t\t\twhile(domainIterator--) {\n\t\t\t\tdomain = channel.domains[domainIterator];\n\t\t\t\t// domain cleanning\n\t\t\t\tgroupIterator = domain.groups.length;\n\t\t\t\twhile(groupIterator--) {\n\t\t\t\t\tgroup = domain.groups[groupIterator];\n\t\t\t\t\tif (!groups[group]) { groups[group] = []; }\n\t\t\t\t\tgroups[group].push(channel);\n\t\t\t\t}\n\t\t\t}*/\n\t\t}\n\n\t\t// TODO: sort channels \n\n\t\t// Save byId map\n\t\tChannelModel.set(c.BY_ID, byId);\n\t\t// Save groups map\n\t\tChannelModel.set(c.GROUPS, groups);\n\t\t// Set default selected group\n\t\t// ATTENTION: Read user preferences here\n\t\tChannelModel.set(c.SELECTED_GROUP, c.DEFAULT_GROUP);\n\n\t\tready(); //?\n\n\t\t// return raw data\n\t\treturn data;\n\t}", "async requestLatestData() {\n const latestDataUrl = this.apiVersion === 'v2' ? `http://${this.ip}/api/v2/latestdata` : `http://${this.ip}:8080/api/latestdata`;\n const data = (await (0, axios_1.default)({ url: latestDataUrl, ...this.requestOptions })).data;\n this.log.debug(`Latest data: ${JSON.stringify(data)}`);\n await this.setStateAsync('latestData.dcShutdownReason', this.decodeBitmapLikeObj(data.ic_status['DC Shutdown Reason'], 'Running'), true);\n await this.setStateAsync('latestData.eclipseLed', this.decodeBitmapLikeObj(data.ic_status['Eclipse Led'], 'Unknown'), true);\n await this.setStateAsync('latestData.secondsSinceFullCharge', data.ic_status.secondssincefullcharge, true);\n }", "function customergetChannel(chname)\n\n{\t\t\tif(activechannel)\n\t\t\t{ \n\t\t\tclient.removeListener('channelUpdated', updateChannels);\n\t\t\t generalChannel.removeListener('typingStarted', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingStarted success\")\n\t\t\t\t\t\ttypingMembers.push(member.identity);\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(erro){\n\t\t\t\tconsole.log(\"typingStarted error\",erro)\n\t\t\t\t});\n\t\t\t\tgeneralChannel.removeListener('typingEnded', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingEnded success\")\n\t\t\t\t\t\ttypingMembers.splice(typingMembers.indexOf(member.identity), 1 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(error){\n\t\t\t\t\n\t\t\t\t\t\tconsole.log(\"typingEnded eror\",error)\n\t\t\t\t});\n\t\t\t}\n\n \n \n\t setTimeout(function() {\n\t\n\t\t\t\t$(\"#\"+chname+\" b\").text(\"\");\n\t\t\t\t$(\"#\"+chname+\" b\").removeClass(\"m-widget4__number\");\n\t\t\t\t$(\"#\"+chname+\" input\").val(0);\n\t\t\t\t$(\".m-widget4__item\").removeClass(\"active\");\n\t\t\t\t$(\"#\"+chname).addClass(\"active\");\n\t\t\t\t\n\t\t\t\t\t$(\"#chatmessage\").html(\"\");\n\t\t\t\t$(\".loader\").show();\n\t\t\t\t client.getChannelByUniqueName(chname).then(function(channel) {\n\t\t\t\t\t\t\tconsole.log(\"channel\",channel)\n\t\t\t\t\t\t\tgeneralChannel = channel;\n\t\t\t\t\t\t \n\t\t\t\t\t$(\"#channel-title\").text(channel.state.friendlyName);\t\n\t\t\t\t\t\t\t\tsetupChannel(generalChannel);\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t},function (error){\n\t\t\t\t\n\t\t\t\t\t\t console.log(\"error\",error)\n\t\t\t\t\t\t});\n\t\n\t }, 10);\n \n \n}", "function genereateList() {\n channels.forEach(function(channel) {\n twitchAPI(channel);\n });\n}", "async function getStreamerMixer() {\n\tconst user = document.querySelector(\"#streamId\").value;\n\tconsole.log(\"Calling mixer api for user: \" + user);\n\n\tfetch(BASE_URL_MIXER + user, {\n\t\tmethod: 'GET', // or 'PUT'\n\t\theaders: {\n\t\t\t'Content-Type': 'application/json',\n\t\t},\n\t})\n\t\t.then((response) => response.json())\n\t\t.then((user) => {\n\t\t\tconsole.log('Success:', user);\n\n\t\t\t//User is already a parsed JSON object, can access data directly and check if user.online === true\n\t\t\tif(user.online === true) {\n\t\t\t\taddStreamer(user.online, user.token, user.viewersCurrent);\n\t\t\t\tconsole.log(user.online);\n\t\t\t\tconsole.log(user.viewersCurrent);\n\t\t\t}\n\t\t\telse\n\t\t\t\tconsole.log(\"Offline\");\n\t\t})\n}", "getChannels() {\n const slack_channels = this.bot.getChannels()._value.channels;\n\n for (let item = 0; item < slack_channels.length; item++) {\n this.channels[slack_channels[item].id] = slack_channels[item].name;\n }\n }", "fetchInitialData(args) {\n return Promise.all([\n makeRequest(\"browse/new-releases\"),\n makeRequest(\"browse/featured-playlists\"),\n makeRequest(\"browse/categories\"),\n ]);\n }", "initEmptyData(){\n this.data = new Array();\n\n // Start with a point at 0, 0 // REVIEW: is this needed?\n // if (!this.isReady) return;\n // const zeroPoint = this.channelNames.reduce((accumulated, channelName) => {\n // accumulated[channelName] = 0;\n // return accumulated;\n // }, {});\n // zeroPoint.timestamp = 0;\n //\n // this.data.push(zeroPoint);\n }", "function listChannels(){\r\n$('#channels ul').append(createChannelElement(yummy));\r\n$('#channels ul').append(createChannelElement(sevencontinents));\r\n$('#channels ul').append(createChannelElement(killerapp));\r\n$('#channels ul').append(createChannelElement(firstpersononmars));\r\n$('#channels ul').append(createChannelElement(octoberfest));\r\n\r\n// console.log('function list Channels executed');\r\n}", "async function getDisplayData() {\n const url = '/api/displays/data';\n const response = await fetch(url);\n const details = await response.json();\n\n displayContents = await fetchFileAsText('/displays/' + details.file);\n displayName = details.name;\n displayFile = details.file;\n displayTimer = (details.timer * 60) * 1000;\n displayModified = details.modified;\n\n document.title = displayName;\n displayRefresh = setInterval(serverCheckIn, displayTimer);\n\n console.log(\"HUB: Initial check in complete\");\n console.log(\"HUB: Display is named '\" + displayName + \"'\");\n console.log(\"HUB: Display is serving \" + displayFile);\n console.log(\"HUB: Display check in timer set to \" + details.timer + \" minutes\");\n}", "function getAllData(){\n\t$.get( getData_endpoint, function( data ) {\n\t\tconsole.log(data);\n\n //Don't refresh dataset unless it is necessary\n if (dataset.version == data.version){ console.log(\"No new data\"); return true;}\n\n\t\t//INIT MODE - Still not doing packet Capturing\n\t\tif (data.mode == \"init\"){\n //Avoid overfilling the dropdown for AP selection\n if (document.getElementById(\"setup_ap\").options.length <= 1){\n AP_update(data);\n }\n\t\t}\n //MONITOR MODE - Capturing mode\n\t\telse{\n\n //If we are switching from AP select to monitor mode. Then make all graphs and spaces visible.\n if (dataset.mode != \"mon\"){\n prep_monitor_mode(data)\n refreshMainTable(data)\n }\n\n //Update the list of APs in case it hasn;t already been updated\n if (document.getElementById(\"setup_ap\").options.length <= 1){\n AP_update(data);\n //TODO: Not that imporant, but perhaps fill the AP_select and AP_pass in\n }\n\n\t\t //Check if we need to add any more clients to the website.\n\t\t if ((dataset.clients == undefined) || (data.clients.length > dataset.clients.length)){\n\t\t \tn = 0\n\t\t \tif (dataset.clients != undefined){ n = dataset.clients.length}\n\n\t\t \tfor (i = n; i < data.clients.length; i++){\n if (data.clients[i].mac != data.monitor_info.mac){ //Don't Add The AP\n \t\t\t\taddClient(data.clients[i])\n \t\t\t\t//console.log(\"Created: \"+data.clients[i].mac)\t\n }\n\t\t \t}\n\n\t\t }\n\n refreshClientInfo(data) //Refresh Client Info (Leaks Usage, etc..)\n\t\t refreshClientGraphs(data)\t//Refresh Client Graphs\n refreshMainGraph(data) //Refresh Main Graph\n\t\t}\n\n\n\t\tdataset = data \t//Update Dataset\n\t});\t\n}", "async function getLatestStreamUpdate(clients) {\n /*for (let client = 0; client < clients; client++) {\n let data = await executeRequest('http://localhost:8080/RawData/latest');\n console.log(data);\n }*/\n}", "function updateChannel() {\n try { \n /* Selecting the discord server */\n const guild = client.guilds.cache.get(config.server_id);\n /* Selecting the channels */\n const memberCountChannel = guild.channels.cache.get(config.member_channel);\n const mpCountChannel = guild.channels.cache.get(config.mp_channel);\n /* Counting the members */\n let totalMembers = guild.members.cache.filter(member => member.roles.cache.has(config.party_member_role)).size;\n let mpMembers = guild.members.cache.filter(member => member.roles.cache.has(config.parliament_member_role)).size;\n /* Giving a heartbeat (still-alive-signal) to logfile (used as debug here) */\n console.log(`[HEARTBEAT] [${dateFormat(new Date(), \"yyyy-mm-dd h:MM:ss\")}] <Total ${totalMembers}> <MP ${mpMembers}>`);\n /* Trying to update channelnames */ \n memberCountChannel.setName('Total Members: ' + totalMembers); \n mpCountChannel.setName('In Parliament: ' + mpMembers);\n } catch (e) {\n console.error(`[ERROR] [${dateFormat(new Date(), \"yyyy-mm-dd h:MM:ss\")}] ${e}`);\n } \n}", "function getData() {\n animate();\n \n var url = window.API.getAPIUrl(\"comps\");\n \n //url += \"?env=development\"; //When needed the development branch, for lab.fermat.org\n\n window.API.getCompsUser(function (list){ \n\n window.loadMap(function() {\n\n window.tileManager.JsonTile(function() {\n\n window.preLoad(function() {\n\n window.tileManager.fillTable(list);\n TWEEN.removeAll();\n window.logo.stopFade();\n window.helper.hide('welcome', 1000, true);\n init();\n\n });\n });\n });\n });\n\n \n//Use when you don't want to connect to server\n/*setTimeout(function(){\n var l = JSON.parse(testData);\n \n window.preLoad(function() {\n \n window.tileManager.JsonTile(function() {\n \n window.loadMap(function() {\n tileManager.fillTable(l);\n\n TWEEN.removeAll();\n logo.stopFade();\n init();\n });\n })\n });\n\n }, 6000);*/\n}", "function getData() {\n animate();\n \n var url = window.API.getAPIUrl(\"comps\");\n \n //url += \"?env=development\"; //When needed the development branch, for lab.fermat.org\n\n window.API.getCompsUser(function (list){ \n\n window.loadMap(function() {\n\n window.tileManager.JsonTile(function() {\n\n window.preLoad(function() {\n\n window.tileManager.fillTable(list);\n TWEEN.removeAll();\n window.logo.stopFade();\n window.helper.hide('welcome', 1000, true);\n init();\n\n });\n });\n });\n });\n\n \n//Use when you don't want to connect to server\n/*setTimeout(function(){\n var l = JSON.parse(testData);\n \n window.preLoad(function() {\n \n window.tileManager.JsonTile(function() {\n \n window.loadMap(function() {\n tileManager.fillTable(l);\n\n TWEEN.removeAll();\n logo.stopFade();\n init();\n });\n })\n });\n\n }, 6000);*/\n}", "function getGameInfo() {\n limiter.request({\n url: `https://global.api.pvp.net/api/lol/static-data/euw/v1.2/champion?champData=all&${api}`,\n method: 'GET',\n json: true,\n }, (error, response) => {\n if (!error && response.statusCode === 200) {\n champions = response.body.data;\n version = response.body.version;\n console.log(champions);\n }\n if (error) {\n throw new Error('Cannot connect to Riot API');\n }\n });\n}", "function load_channel(channel) {\n setChannelLink();\n \n const request = new XMLHttpRequest();\n request.open('GET', `/channel/${channel}`);\n request.onload = () => {\n\n // Push state to URL.\n document.title = channel;\n\n // Store the selected channel in localStorage\n localStorage.setItem('activeChannel', channel);\n\n // Clear out the msgs div first\n document.querySelector('#msgs').innerHTML = '';\n\n document.querySelector(\"#channel-name\").innerHTML = '#' + channel;\n\n // Template for all the converstions in a channel\n const template = Handlebars.compile(document.querySelector(\"#conversations\").innerHTML);\n var users_msgs = JSON.parse(request.responseText);\n\n // Add a deleteOption to delete the message send by the respective user, By default it's False \n deleteOption = false;\n for (var i = 0; i < users_msgs.length; i++) {\n // If the sender of the message is viewing his own msgs then set the deleteOption to True\n if (localStorage.getItem('username') === users_msgs[i][0]){\n users_msgs[i].push(true);\n }\n }\n \n const content = template({'users_msgs': users_msgs});\n \n document.querySelector(\"#msgs\").innerHTML += content;\n // Set the amount of vertical scroll equal to total container size \n messages.scrollTop = messages.scrollHeight;\n SetDeleteButton();\n };\n request.send();\n }", "get availableChannels() {\n return this.db.groups.filteredSortedList(Application.filterRooms);\n }", "init() {\n let sources = [0];\n return si.battery().then((info) => {\n if (info.hasbattery) {\n sources.push(0);\n }\n return sources;\n });\n }", "init() {\n let sources = [0];\n return si.battery().then((info) => {\n if (info.hasbattery) {\n sources.push(0);\n }\n return sources;\n });\n }", "function getData() {\n\n\tuserIDHash = getuserIDHash();\n\n\tif(streamName != '') {\n\t\tif(!userIDHash) { // no userIDHash means first run\n\t\t\tinsertFirstRunMessage();\n\t\t\tbindFistRun();\n\t\t} else {\n\t\t\t// no error callback allowed due to cross domain\n\t\t\t// so, if all data isn't gathered within 10 seconds\n\t\t\t// then self detruct \n\t\t\tvar serverTimeout = setTimeout(function(){\n\t\t\t\tdataFailure('init');\n\t\t\t}, 10000);\n\n\t\t\t// first get communityTags\t\n\t\t\t$.ajax({\n\t\t\t\turl: tkServerHREF + 'read.php?function=communityTags&streamName=' + streamName,\n\t\t\t\tcache: false,\n\t\t\t\tdataType: 'text',\n\t\t\t\tsuccess: function(response) {\n\t\t\t\t\tif(!suppressLog){console.log('call:' + this.url + '\\nresponse:' + response);}\n\t\t\t\t\tconvertLocalCommunityTags(response);\n\t\t\t\t\t// next get userTags\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\turl: tkServerHREF + 'read.php?function=userTags&streamName=' + streamName + '&userIDHash=' + userIDHash,\n\t\t\t\t\t\tcache: false,\n\t\t\t\t\t\tdataType: 'text',\n\t\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\t\tif(!suppressLog){console.log('call:' + this.url + '\\nresponse:' + response);}\n\t\t\t\t\t\t\tconvertLocalUserTags(response);\n\t\t\t\t\t\t\t// next get searchTags\n\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\turl: tkServerHREF + 'read.php?function=searchTags',\n\t\t\t\t\t\t\t\tcache: false,\n\t\t\t\t\t\t\t\tdataType: 'text',\n\t\t\t\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\t\t\t\tif(!suppressLog){console.log('call:' + this.url + '\\nresponse:' + response);}\n\t\t\t\t\t\t\t\t\tconvertLocalSearchTags(response);\n\t\t\t\t\t\t\t\t\t// next get stats\n\t\t\t\t\t\t\t\t\t$.ajax({\n\t\t\t\t\t\t\t\t\t\turl: tkServerHREF + 'read.php?function=tagStats&userIDHash=' + userIDHash,\n\t\t\t\t\t\t\t\t\t\tcache: false,\n\t\t\t\t\t\t\t\t\t\tdataType: 'text',\n\t\t\t\t\t\t\t\t\t\tsuccess: function(response) {\n\t\t\t\t\t\t\t\t\t\t\tif(!suppressLog){console.log('call:' + this.url + '\\nresponse:' + response);}\n\t\t\t\t\t\t\t\t\t\t\tclearTimeout(serverTimeout);\n\t\t\t\t\t\t\t\t\t\t\tconvertLocalTagStats(response);\n\t\t\t\t\t\t\t\t\t\t\t// got all data, now start\n\t\t\t\t\t\t\t\t\t\t\tafterData();\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t} // not a stream so do nothing\n}", "async getData() {\n let data = {}\n data.numMonstersInStorage = BrowserStorage.numMonsters\n return data\n }", "function channelsMine(req, res) {\n res.json(req.user.myChannels);\n}", "function displayMyChannels() {\n\tif (!myChannels.length) {\n\t\tdisplayAlert('my-channels', 'You have no channels added to your list yet!', 'danger');\n\t} else {\n\t\t$('#my-channels').html('');\n\t\tfor (const ch of myChannels) {\n\t\t\tdisplayChannelCard('my-channels', ch.channelId, ch.channelImg, ch.channelTitle);\n\t\t}\n\t}\n}", "function update_channels(data){\n\t\tlet ch_win = document.querySelector('#channelPanel');\n\t\tlet ch = document.createElement(\"a\");\n\t\tch.setAttribute('class','list-group-item list-group-item-action pt-1 pb-1');\n\t\tch.setAttribute('href','javascript:void(0);');\n\t\tch.setAttribute('id',data['mychannels'][data['mychannels'].length-1]);\n\t\tch.setAttribute('data-name',data['mychannels'][data['mychannels'].length-1]);\n\t\tch.setAttribute('data-type','channel');\n\t\tch.innerHTML = data['mychannels'][data['mychannels'].length-1];\n\t\tch_win.appendChild(ch);\n\t\tdocument.querySelectorAll('.list-group-item').forEach(a => {\n\t\t\ta.onclick = () => {\n\t\t\t\tselectChannel(a);\n\t\t\t};\n\t\t});\n\t}", "function getNewsData() {\n return requestNews().then(extractNews);\n}", "fetchStreamerObjs() {\n return new Promise((resolve, reject) => {\n fetchUserId()\n .then(fetchFollowedChannels)\n .then(response => {\n this.streamer_objs = responseToStreamerObjs(response);\n this.status = true;\n this.last_success = Date.now();\n resolve(this.streamer_objs);\n })\n .catch(error => {\n console.log('Unable to reach Mixer: ', error);\n this.status = false;\n this.streamer_objs = [];\n resolve(this.streamer_objs);\n });\n });\n }", "synchronize() {\n var currentChannels = this.context.api.newsItem.getChannels(),\n activeChannelCount = 0,\n mainChannel = null\n\n this.state.channels.forEach((channel) => {\n if (currentChannels.some(currentChannel => channel.qcode === currentChannel['qcode'] && currentChannel['@why'] === 'imext:main')) {\n channel.main = true\n channel.active = true\n mainChannel = channel\n activeChannelCount++\n }\n else if (currentChannels.some(currentChannel => channel.qcode === currentChannel['qcode'])) {\n channel.active = true\n channel.main = false\n activeChannelCount++\n }\n else {\n channel.active = false\n channel.main = false\n }\n })\n\n this.extendState({\n activeChannelCount: activeChannelCount,\n mainChannel: mainChannel\n })\n }", "function get_page_data() {\n socket.emit('get_page_data', {data: ''});\n //call server to tell we want all data, so we can fill the ui (normally done once on full page load/refresh)\n}", "function getChannelList () {\n //Set the URL path\n var _url = WEBSERVICE_CONFIG.SERVER_URL + '/epg/channels?user=rovi';\n\n // $http returns a promise for the url data\n return $http({method: 'GET', url: _url});\n }", "function GetMemberList()\n{\n\t/* client.getMembers().then(function(members){\n\t\t\t\t\t\t\t\t\t console.log(members)\n // this.addMember(members);\n } ); */\n\tclient.getUserChannelDescriptors().then(function(paginator) {\n\t\t\t\t for (i = 0; i < paginator.items.length; i++) {\n\t\t\t\t\tconst channel = paginator.items[i];\n\t\t\t\t\tconsole.log('Channel: ' + channel.friendlyName);\n\t\t\t\t }\n\t\t\t});\n}" ]
[ "0.6174487", "0.6143607", "0.6024814", "0.6006331", "0.597928", "0.5950036", "0.5829109", "0.56514424", "0.56441987", "0.564225", "0.5628344", "0.55985993", "0.5591854", "0.5590676", "0.55876064", "0.5571876", "0.5569628", "0.55689764", "0.55517554", "0.55306715", "0.5503061", "0.5493065", "0.5473355", "0.54645115", "0.5462683", "0.5459969", "0.545293", "0.5448151", "0.5418286", "0.54118264", "0.54012465", "0.5396571", "0.53957534", "0.53802735", "0.53661805", "0.53510857", "0.5348659", "0.53484017", "0.5342241", "0.5336872", "0.5330417", "0.5328897", "0.53256947", "0.5307145", "0.5303643", "0.52969724", "0.52958816", "0.5289598", "0.52871346", "0.5286133", "0.5282837", "0.5278052", "0.5276712", "0.5268205", "0.52672285", "0.52559835", "0.5250413", "0.5250337", "0.5237483", "0.5229775", "0.52210826", "0.5220938", "0.5213225", "0.52129", "0.52095985", "0.52091", "0.52015436", "0.51994085", "0.51976776", "0.51947254", "0.5187926", "0.51746356", "0.5171304", "0.5164994", "0.5162115", "0.51505893", "0.51420385", "0.51412225", "0.5136916", "0.5136537", "0.51314884", "0.5129351", "0.51247764", "0.51247764", "0.51223665", "0.511074", "0.5110218", "0.5109632", "0.5109632", "0.51005703", "0.5092246", "0.50919276", "0.5091624", "0.5091273", "0.50886786", "0.5084598", "0.50842845", "0.5081383", "0.50783896", "0.5073909" ]
0.7028158
0
clears all standup reports for a channel
function clearStandupData(channel) { controller.storage.teams.get('standupData', function(err, standupData) { if (!standupData || !standupData[channel]) { return; } else { delete standupData[channel]; controller.storage.teams.save(standupData); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n\t\treturn this._sendMessage(JSON.stringify({type: \"clearHistory\"}), (resolve, reject) => {\n\t\t\tresolve([channel]);\n\t\t});\n\t}", "clearAllChannels() {\n this.state.channels.forEach((channel) => {\n if (channel.active) {\n this.context.api.newsItem.removeChannel('publicationchannel', channel)\n }\n })\n\n this.synchronize()\n }", "destroyAllBugs(){\n this.bugs = this.chort.getBugs()\n this.bugs.clear(true) // not working?!\n //tell chort\n this.chort.setBugs(this.bugs)\n }", "function\nclearReport(){\nAssert.reporter.setClear();\n}\t//---clearReport", "clearAll() {\r\n \r\n // reset sample data\r\n this.sampleData = [];\r\n\r\n // reset distribution paramters\r\n this.mu = null;\r\n this.sigma = null;\r\n\r\n // update the plots\r\n this.ecdfChart.updatePlot([], []);\r\n this.histChart.updateChart([])\r\n \r\n }", "function clearAll(day) {\n\t\t// reset time\n\t\tif (day === \"Saturday\" || day === \"Sunday\") {\n\t\t\t$(\"#time\").text(\"08:00\");\n\t\t} else {\n\t\t\t$(\"#time\").text(\"07:00\");\n\t\t}\n\t\t// reset count\n\t\tfor (let i = 0; i < STATION_NAMES.length; i++) {\n\t\t\t// reset count\n\t\t\t$(\"#\" + STATION_NAMES[i] + \"-count\").text(\"0\");\n\t\t\t// clear customers\n\t\t\twhile ($(\"#\" + STATION_NAMES[i] + \"-wait-area\").children().length > 1) {\n\t\t\t\t$(\"#\" + STATION_NAMES[i] + \"-wait-area\").children().last().remove();\n\t\t\t}\n\t\t\t// clear servers\n\t\t\t$(\"#\" + STATION_NAMES[i] + \"-server-area\").empty();\n\t\t\t// close all stations\n\t\t\t$(\"#\" + STATION_NAMES[i] + \"-title\").addClass(\"closed\");\n\t\t}\n\t}", "function clearScreen() {\n result.innerHTML = \"\";\n reportInfo.style.display = \"none\";\n }", "function clearWeek(){\n\n let errorExists = false;\n\n pool.getConnection(function(err, connection){\n\n if(_assertConnectionError(err)){\n return;\n }\n \n const streamersReg = [];\n const streamersWhitelist = [];\n connection.query(\"SELECT * FROM list_of_streamers;\",\n function(error, results, fields){\n\n if(errorExists || _assertError(error, connection)){\n errorExists = true;\n return;\n }\n\n for(let row of results){\n streamersReg.push(sql.raw(row[\"channel_id\"] \n + _REGULAR_SUFFIX));\n streamersWhitelist.push(sql.raw(row[\"channel_id\"] \n + _WHITELIST_SUFFIX));\n }\n\n });\n\n connection.query(\"UPDATE ?, ? SET ?.week=0, ?.week=0;\", \n [streamersReg, streamersWhitelist, \n streamersReg, streamersWhitelist], function(error){\n \n if(errorExists || _assertError(error)){\n errorExists = true;\n return;\n }\n\n });\n\n if(!errorExists){\n connection.release();\n }\n\n });\n\n}", "function clear() {\n appworks.notifications.clear();\n notifications = [];\n}", "function clear() {\n\n\t// IF the legacy logs has too many elements, start shifting the first item on each clear.\n\tif (_legacy.length > options.limit) {\n\t\t_legacy.shift()\n\t}\n\n\t_legacy.push(_logs)\n\n\t_logs = []\n\n}", "function unsubscribeAll() {\r\n\r\n if (socketMessage.session) {\r\n\r\n var confirmDeleteStream = function (response, project) {\r\n if (response.status === 'ok') {\r\n project.subscribed = false;\r\n } else {\r\n Y.log(\"delete \" + response.status + \" for \" + project.title + ' ' + JSON.stringify(response));\r\n }\r\n };\r\n\r\n var i, l;\r\n for (/*var*/i = 0, l = Y.postmile.gpostmile.projects.length; i < l; ++i) {\r\n var project = Y.postmile.gpostmile.projects[i];\r\n if (project.subscribed) {\r\n deleteJson('/stream/' + socketMessage.session + '/project/' + project.id, null, confirmDeleteStream, project);\r\n project.subscribed = false; // presume this works (we'd not do anything differently anyways)\r\n }\r\n }\r\n }\r\n }", "clearUser(channel) {\n\t\treturn this._sendMessage(JSON.stringify({type: \"clearUser\", displayName: channel}), (resolve, reject) => {\n\t\t\tresolve([channel]);\n\t\t});\n\t}", "function clearSearch(){\n for(var i=0;i<reporter_path.length;i++){\n reporter_path[i].setMap(null);\n }\n for(var i=0;i<reporter_record.length;i++){\n reporter_record[i].setMap(null);\n }\n reporter_path=[];\n reporter_record=[];\n}", "function reset() {\n Report.deleteMany({}, function (err, doc) {\n console.log(\"removeeeeeeeeeeeeeeeeeeeeeed\");\n });\n}", "function Clear()\n{\n\tUnspawnAll();\n\tavailable.Clear();\n\tall.Clear();\n}", "async clearSlackCredentials () {\n\t\tconst query = {\n\t\t\tteamIds: this.team.id\n\t\t};\n\t\tconst op = {\n\t\t\t$unset: {\n\t\t\t\t[`providerInfo.${this.team.id}.slack`]: true\n\t\t\t}\n\t\t};\n\t\tif (Commander.dryrun) {\n\t\t\tthis.log('\\t\\tWould have cleared all Slack credentials');\n\t\t}\n\t\telse {\n\t\t\tthis.log('\\t\\tClearing all Slack credentials');\n\t\t\tawait this.data.users.updateDirect(query, op);\n\t\t}\n\t\tthis.verbose(query);\n\t\tthis.verbose(op);\n\t}", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "function Clearup() {\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "function sched_clear() {\n\tfor (let name in schedule.list) {\n\t\t// Remove summary sidebar elements.\n\t\tdiv.summary_tbody.removeChild(schedule.list[name].tr);\n\n\t\t// Remove cards.\n\t\tfor (let i in schedule.list[name].cards)\n\t\t\tdiv.deck.removeChild(schedule.list[name].cards[i]);\n\n\t\tdelete schedule.list[name];\n\t}\n}", "function Clearup() {\n //TO DO:\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "function clearCoverage() {\n coverageData = {};\n disposeDecorators();\n isCoverageApplied = false;\n}", "function clearMonth(){\n\n let errorExists = false;\n\n pool.getConnection(function(err, connection){\n\n if(_assertConnectionError(err)){\n return;\n }\n \n const streamersReg = [];\n const streamersWhitelist = [];\n connection.query(\"SELECT * FROM list_of_streamers;\",\n function(error, results, fields){\n\n if(errorExists || _assertError(error, connection)){\n errorExists = true;\n return;\n }\n\n for(let row of results){\n streamersReg.push(sql.raw(row[\"channel_id\"] \n + _REGULAR_SUFFIX));\n streamersWhitelist.push(sql.raw(row[\"channel_id\"] \n + _WHITELIST_SUFFIX));\n }\n\n });\n\n connection.query(\"UPDATE ?, ? SET ?.month=0, ?.month=0;\", \n [streamersReg, streamersWhitelist, streamersReg, \n streamersWhitelist], function(error){\n \n if(errorExists || _assertError(error)){\n errorExists = true;\n return;\n }\n\n });\n\n if(!errorExists){\n connection.release();\n }\n\n });\n}", "clear() {\n this.dialOutputs.forEach(dialOutput => {\n dialOutput.clear()\n })\n }", "function clearAll() {\n var tableBody = document.getElementById(\"historyTableBody\");\n tableBody.innerHTML = '';\n storageLocal.removeItem('stopWatchData');\n historyData = [];\n cachedData = [];\n stopButtonsUpdate();\n}", "function clearWorkspace(){\n var len = 0;\n dashWorkspace.content = '';\n if(columns){\n len = columns.length;\n while(len--){\n dashWorkspace.remove(columns[len]);\n }\n }\n if(conditionals){\n len = conditionals.length;\n while(len--){\n dashWorkspace.remove(conditionals[len]);\n }\n }\n screen.render();\n}", "function clearTests() {\n tests = [];\n}", "function clearAll() {\n catQueue = new Queue();\n dogQueue = new Queue();\n userQueue = new Queue();\n }", "function clear() {\n newStats = {\n theyAreReady: false,\n iAmReady: false,\n currentTurn: null,\n firstTurn: null,\n openRows: null,\n history: null,\n future: null,\n iAmRed: null,\n moveStart: null,\n redTime: null,\n bluTime: null,\n winner: null,\n winBy: null,\n theyWantMore: false,\n iWantMore: false,\n };\n Object.assign(stats, newStats);\n }", "function clear_lists(){\n\tconsole.log(\"clear_lists\")\n\tusers=[]\n\tcontenders=[]\n\t//clears the potential winners list\n\t//clears contenders list\n\t//we should store winning user ID before clearing lists\n}", "function unsubscribeAll() {\n\t\t\tvar deferred = $q.defer(),\n\t\t\t\tparse \t = config.parse;\n\n\t\t\tinstance.then(function instanceSuccess() {\n\n\t\t\t\tparse.channels = [];\n\n\t\t\t\t_updateParseInstallation().then(function updateParseInstallationSuccess() {\n\t\t\t\t\tdeferred.resolve(parse.channels);\n\t\t\t\t}).catch(function updateParseInstallationCatch(error) {\n\t\t\t\t\tdeferred.reject(error);\n\t\t\t\t});\n\n\t\t\t}).catch(function instanceCatch(error) {\n\t\t\t\tdeferred.reject(error);\n\t\t\t});\n\n\t\t\treturn deferred.promise;\n\t\t}", "clear() {\n this.deactivateAlternateScreen();\n this.sections = this.sections.slice(-1);\n if (this.sections[0] instanceof VT100Section) {\n this.sections[0].userInitiatedClear();\n }\n this.emit('update');\n }", "empty() {\n this.total = 0;\n this.collected.clear();\n this.users.clear();\n this.checkEnd();\n }", "async function unsubAll() {\n lLog('Unsubscribing all channels...');\n await Promise.all(ipfsearch.subbedTopics.map((topic) => { return unsub(topic, -1); }));\n if (ipfsearch.subbedTopics.length === 0) return;\n lLog('Error: Did not unsubscribe from all channels.');\n}", "function clearSubs() {\n\tvar subsDiv = document.getElementById(\"subscriptions\");\n\n\tfor (var topic in subscriptions) {\n\t\tif (subscriptions.hasOwnProperty(topic)) {\n\t\t\t// remove row...\n\t\t\tsubsDiv.removeChild(subscriptions[topic].div);\n\t\t\t// remove from data structure\n\t\t\tdelete subscriptions[topic];\n\t\t\tsubCount--;\n\t\t}\n\t}\n}", "function clearDashboard() {\n \n while (dashboard.firstChild) {\n dashboard.removeChild(dashboard.firstChild);\n }\n}", "function execClear(msg) {\n async function clear() {\n msg.delete();\n const fetched = await msg.channel.fetchMessages({limit: 100});\n fetched.deleteAll();\n }\n clear();\n }", "function clear() {\n setNotification(\"\");\n }", "dispose() {\n\t\tlogger.debug('in cleanup');\n\t\tfor (const channel of this.channels.values()) {\n\t\t\tchannel._dispose();\n\t\t}\n\t\tthis.channels.clear();\n\t}", "function clearNotifications() {\n UrbanAirship.clearNotifications();\n}", "static flush() {\n Object.keys(Tracker._computations).forEach(c => Tracker._computations[c].stop());\n }", "function clearAll() {\n for (let i = 0; i < 11; i++) {\n setNone(i);\n }\n running = false;\n }", "function clearSchedule() {\n\t\tvar timeblocks = babysitterScheduleTable.getTimeblocks();\n\t\tfor (var i = 0; i < timeblocks.length; i++) {\n\t\t\tvar block = timeblocks[i];\n\t\t\tfor(var day = block.start.day; day <= block.end.day; day++) {\n\t\t\t\tfor(var time = earliestTimeOnSchedule; time <= latestTimeOnSchedule; time++) {\n\t\t\t\t\tbabysitterScheduleTable.paint(day, time, \"blank\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function resetAll() {\n //reset date\n entries = [];\n localStorage.clear();\n\n //clear most of the chart\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n drawAxis();\n\n //remove all items from list\n while (dataList.firstChild) dataList.removeChild(dataList.firstChild);\n}", "reset() {\n this._subscribers.clear();\n this._oncers.clear();\n }", "function chrClearLog () {\n $(\"#eventLog\").empty();\n}", "function wipe() {\n removeAllEventsFromDisplay();\n cosmo.view.cal.itemRegistry = new cosmo.util.hash.Hash();\n }", "clear() {\n debug('Clearing all previously stashed events.');\n this._eventsStash = [];\n }", "function clearMessages() {\n chrome.runtime.sendMessage({type: \"clearMessages\"}, function(response) {\n displayResponse(response);\n });\n }", "function clearChatData() {\n if (observer.current !== null) observer.current();\n var temp = 1701;\n console.log('Cleared chat data.');\n localStorage.removeItem('inActiveChat');\n localStorage.removeItem('activeSocket');\n while (localStorage.getItem(JSON.stringify(temp)) !== null) {\n localStorage.removeItem(JSON.stringify(temp));\n temp += 7;\n }\n }", "clear() {\r\n this._subscriptions.splice(0, this._subscriptions.length);\r\n }", "clear() {\n this._subscriptions.splice(0, this._subscriptions.length);\n }", "resetData() {\n this.clearFilters();\n this.data = [];\n this.metrics = ['MQM'];\n for (let key in this.metricsInfo) {\n /** Only retain the entry for 'MQM'. */\n if (key == 'MQM') continue;\n delete this.metricsInfo[key];\n }\n this.metricsVisible = [];\n this.sortByField = 'metric-0';\n this.sortReverse = false;\n this.closeMenuEntries('');\n }", "function resetReportList() {\n let len = globals.reportSelect.get(0).options.length;\n for (let i = 1; i < len; i++) {\n globals.reportSelect.get(0).remove(i);\n }\n\n // Set default option as selected\n globals.reportSelect.get(0).options[0].selected = true;\n}", "function clearTests() {\n fileArray = ['test1.js', 'test2.js', 'test3.js', 'test4.js', 'test5.js', 'test6.json'];\n myT.deleteFiles('./log', fileArray);\n}", "clearAll() {\n this.clearGraphic()\n this.clearData()\n }", "function clearAll() {\n while (service.heroes.length > 0) {\n service.heroes.splice(0, 1);\n }\n }", "function cleanReport() {\n\n // delete actual report contents and put on a loading gif\n $('#map-div').hide();\n $('#report-div').empty().hide();\n $('.nvtooltip').remove();\n svg.selectAll('*').remove();\n svg.style('display', 'none');\n\n // TODO: loading gif, a nice one\n}", "function clearList() {\n groceries = [];\n let message = showGroceriesList(resultDiv);\n resultDiv.innerHTML = '';\n messageDiv.innerText = message;\n}", "function resetAll() {\n credits = 1000;\n winnerPaid = 0;\n jackpot = 5000;\n turn = 0;\n bet = 0;\n winNumber = 0;\n lossNumber = 0;\n winRatio = 0;\n\n showPlayerStats();\n}", "function clear_all_data() {\n chrome.storage.sync.clear();\n}", "clear() {\n this.groups = this.groups.slice(-1);\n this.groups[0].clear();\n this.emit('update');\n }", "clearAllData() {\n this.startTime = 0;\n this.nowTime = 0;\n this.diffTime = 0;\n this.stopTimer();\n this.animateFrame = 0;\n this.gameNumbers = gameNumbers();\n this.colors = setButtonColor();\n this.checkCounter = 0;\n this.isShow = false;\n }", "function _clear() {\n angular.forEach(messages, function(msg, key) {\n delete messages[key];\n });\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n top.API.Pin.CancelGetData();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "clear() {\n this.notifications = [];\n }", "function clearSnapshots() {\n series = 1;\n colorArray = [colorSpectrum[0]];\n labelArray = [ \"frequency [Hz]\", \"amplitude [dB]\" ];\n doCalc();\n}", "function clearAll(){\r\n\tObject.keys(this.datastore).forEach((key)=>\r\n\t{\r\n\t\tdelete this.datastore[key];\r\n\t});\t\r\n}", "function clear(msg)\r\n{\r\n var thisData = getRoom(msg[\"room\"]);\r\n while (thisData.length) {\r\n\t\t thisData.pop();\r\n\t }\r\n web.io.emit(\"servermessage\", {\r\n \"room\": msg[\"room\"],\r\n \"command\": \"clear\"\r\n });\r\n}", "function clearScreens() {\n\n numericString = '';\n display.innerHTML = '';\n units.innerHTML = '';\n document.getElementById('results').innerHTML = 'Results will appear here...';\n document.getElementById('planet').className = \"\";\n\n enablePlaceholder();\n enableDisabled();\n\n }", "clear() {\n // let elements = $.all('.mt-log-item')\n // let parentNode = $.one('.mt-log')\n // for(let i = elements.length - 1; i >= 0; i--) {\n // parentNode.removeChild(elements[i]);\n // }\n\n $.remove($.one('.mt-log'))\n }", "function allClear () {\n calcDisplay.displayValue = '0';\n calcDisplay.firstOperand = null;\n calcDisplay.waitForSecondOperand = false;\n calcDisplay.operator = null;\n console.log('All Cleared');\n}", "removeAll() {\n\t\tfor (const key of Object.keys(this.cards)) { this.cards[key].df = null; }\n\t\tthis.cards = {}; this.multiple = []; this.ctrlDelete = []; this.tabs = null;\n }", "function reset() {\n subscribers.length = 0;\n cache = {};\n }", "function reset() {\n subscribers.length = 0;\n cache = {};\n }", "function reset() {\n subscribers.length = 0;\n cache = {};\n }", "function reset() {\n subscribers.length = 0;\n cache = {};\n }", "function reset() {\n subscribers.length = 0;\n cache = {};\n }", "clearWorkspace(){\n this.ffauWorkspace.clear();\n }", "clearWorkspace() {\n this.ffauWorkspace.clear();\n }", "function reset() {\n let da = new VMN.DAPI();\n da.db.cleanDB();\n da.cleanLog();\n VMN.DashCore.cleanStack();\n}", "function clearList() {\n $scope.compensationSearch = \"\";\n openCases('open');\n }", "_clearState() {\n this.log.debug('[Demux] Clearing demux state');\n\n clearTimeout(this.timeoutId);\n\n for (const sinkData of this.sinkMap.values()) {\n this._sinkClose(sinkData);\n }\n }", "function clearList() {\n $scope.medicSearch = {\n \"highPriority\": null,\n \"createDateFrom\": null,\n \"createDateTo\": null,\n \"dueDateFrom\": null,\n \"dueDateTo\": null,\n \"assignee\": null,\n \"caseId\": null,\n \"keyWords\": null\n };\n $('#assign').html('');\n openCases('open');\n }", "function clearActivities() {\n document.getElementById('presence-activity').innerHTML = ''\n}", "function reset() {\n\n //clear enemies\n allEnemies.length = 0;\n //clear any text messages from the heads-up display.\n hud.textElements.length = 0;\n }", "function clearAllTariff(){\n\tclearkmfields();\n\tclearhrfields();\n\tclearperdaykmfields();\n}", "function Clearup() {\n //TO DO:\n EventLogout();\n top.API.Fpi.CancelAcquireData();\n App.Timer.ClearTime();\n }", "removeAll(silent) {\n const me = this,\n storage = me.storage;\n\n // No reaction to the storage Collection's change event.\n if (silent) {\n storage.suspendEvents();\n\n // If silent, the storage Collection won't fire the event we react to\n // to unjoin, and we allow the removing flag in remove() to be true,\n // so *it* will not do the unJoin, so if silent, so do it here.\n const allRecords = Object.values(me.idRegister);\n\n for (let i = allRecords.length - 1, rec; i >= 0; i--) {\n rec = allRecords[i];\n if (rec && !rec.isDestroyed) {\n rec.unJoinStore(me);\n }\n }\n }\n\n me.clear();\n\n if (silent) {\n storage.resumeEvents();\n }\n }", "clear() {\n this.sendAction('clear');\n }", "function clearAll() {\n questionsAnswered = 0;\n trueAnswers = [];\n trueQuestions = [];\n userAnswers = [];\n}", "function _clearAllStreams() {\n // Stop all streaming.\n if ( screenStream ) {\n screenStream.getTracks().forEach(function( track ) {\n track.stop();\n });\n screenStream = null;\n }\n if ( micStream ) {\n micStream.getTracks().forEach(function( track ) {\n track.stop();\n });\n micStream = null;\n }\n }", "function clearAllSubmissions() {\n\treturn new Promise(function(resolve, reject) {\n\t\tUserSubLog.remove({}, { multi: true }, function(err, numRemoved) {\n\t\t\tif (err) {\n\t\t\t\treject(Error(\"Unable to clear all submissions\"));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tUserSubLog.loadDatabase(function(err) {\n\t\t\t\t\t// reload database to \"really\" clear all the contents.\n\t\t\t\t\t// (due to nedb).\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t});\n}", "function clearOutputData() {\n console.log('clearOutputData');\n gaOutputData = [];\n updateOutputDataDisplay();\n}", "clear () {\n for (let i = 0; i < this.listeningIpcs.length; i++) {\n let pair = this.listeningIpcs[i];\n _ipc.removeListener( pair[0], pair[1] );\n }\n this.listeningIpcs.length = 0;\n }", "function resetAll(){\n suicideCreeps();\n suicideInvader();\n resetMemory();\n return 'Reset all creeps, invaders and memory';\n}", "function flush_historial(){\n // get list of chldren elements\n let hist = document.getElementsByClassName('historial')[0];\n let hist_list = hist.children;\n // loop and destroy, but only from index 1 onwards\n for (let i = 1; i < hist_list.length; i++) {\n hist_list[i].remove();\n }\n}", "function clearChart() {\n\tfor(var i = 0; i < 3; i++) {\n\t\tchart.data.datasets[i].data = []\n\t\tchart.data.datasets[i].label = ''\n\t}\n\tchart.data.labels = []\n\tdocument.getElementById('message').innerHTML = ''\n\tchart.options.scales.yAxes[0].scaleLabel.labelString = ''\n\tchart.options.scales.yAxes[1].scaleLabel.labelString = ''\n\tdocument.getElementById('chartSelect').selectedIndex = 0\n\tdocument.getElementById('studySelect').selectedIndex = 0\n\tdocument.getElementById('compareSelect').selectedIndex = 0\n}", "clear() {\n this.requests = [];\n this.decoders = [];\n this.accountNextNonces = {};\n this.accountUsedNonces = {};\n }" ]
[ "0.6528912", "0.6494929", "0.64406866", "0.6426045", "0.62254184", "0.6205152", "0.62045234", "0.6150138", "0.61259806", "0.5997079", "0.5973085", "0.5954252", "0.5943247", "0.591203", "0.59086585", "0.5901544", "0.58659446", "0.58659446", "0.58659446", "0.5856577", "0.5851668", "0.58507645", "0.57735926", "0.57466334", "0.57434434", "0.57023615", "0.5698813", "0.5674449", "0.56618917", "0.5646667", "0.56382126", "0.5629107", "0.56273943", "0.56241256", "0.5608868", "0.55808824", "0.5577234", "0.5573818", "0.5573139", "0.55711377", "0.55665123", "0.5565539", "0.5562732", "0.55608875", "0.556078", "0.5559035", "0.5551796", "0.55481386", "0.5533101", "0.5530881", "0.5524425", "0.5508791", "0.5507351", "0.5506801", "0.550031", "0.5499901", "0.54992247", "0.54936296", "0.54917055", "0.5489357", "0.5475368", "0.54736775", "0.5470768", "0.546814", "0.54664123", "0.5465385", "0.5462578", "0.5460875", "0.5459421", "0.54521495", "0.54511535", "0.5448594", "0.54455394", "0.54425484", "0.5440021", "0.5440021", "0.5440021", "0.5440021", "0.5440021", "0.54396325", "0.54346216", "0.5432104", "0.5431874", "0.5431804", "0.5431205", "0.54298186", "0.54284716", "0.54260314", "0.5423933", "0.5423398", "0.54224396", "0.54130995", "0.5412292", "0.54115295", "0.540545", "0.5402891", "0.5401219", "0.54010755", "0.5401065", "0.53974205" ]
0.68249196
0
returns true (in a callback) if the specified user has a standup report saved
function hasStandup(who, cb) { var user = who.user; var channel = who.channel; controller.storage.teams.get('standupData', function(err, standupData) { if (!standupData || !standupData[channel] || !standupData[channel][user]) { cb(null, false); } else { cb(null, true); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isUserSaving () {\n\treturn !!( editorData.isSavingPost() && !editorData.isAutosavingPost() );\n}", "userCreated (project) {\n if (!userStore.data.scitran) {return false;}\n return project.group === userStore.data.scitran._id;\n }", "function _check_if_exist_change(){\n try{\n if(win.action_for_custom_report == 'add_job_custom_report'){\n return true;\n }\n var is_make_changed = false;\n if(_is_make_changed){\n is_make_changed = true;\n }\n return is_make_changed;\n }catch(err){\n self.process_simple_error_message(err,window_source+' - _check_if_exist_change');\n return false; \n } \n }", "function checkReportCompletion() {\n var completed;\n report = jsdo.find(function (jsrecord) {\n return (jsrecord.data.STAMP_DT == date && jsrecord.data.TEMP == null);\n });\n\n if (report == null) {\n completed = true;\n }\n else {\n completed = false;\n }\n console.log(\"Reported completed?: \" + completed);\n return completed;\n }", "userProfileHasLoaded(){\n\t\tif(resources.username().waitForVisible(10000) &&\n\t\tresources.settingsToolBar().waitForVisible(10000)){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "function isSetUp() {\n return getUserDetails() !== null;\n }", "function save() {\n if (!pro) {\n $ionicPopup.alert({\n title: 'Pro Feature',\n template: 'Workouts can only be saved in Ruckus Pro. You can however still share!'\n });\n return false;\n }\n\n if (vm.saved) {\n return false;\n }\n workoutService.editOrCreate(saveSnapShot.date, saveSnapShot).then(function(res) {\n vm.saved = true;\n }, function(err) {\n log.log('there was an error with saving to the datastore' + err);\n });\n }", "function isShowForUnifiedReport() {\n if (!$scope.dashboardType || !$scope.dashboardType.id) {\n return false;\n }\n return DASHBOARD_TYPE_JSON[$scope.dashboardType.id] === DASHBOARD_TYPE_JSON.UNIFIED_REPORT;\n }", "function checkReportExists(){\n $scope.reportFound = false;\n var arrayResultData = savedReportsService.all();\n if(arrayResultData && $scope.saveObject.reportName){\n angular.forEach(arrayResultData,function(item){\n if(item.attributes && item.getName() && (item.getName().toUpperCase()===$scope.saveObject.reportName.toUpperCase())){\n $scope.reportId = item.getId();\n $scope.reportFound = true;\n }\n });\n }\n }", "static canSave(){\n\t\tif(this.clearLevelFileLater || this.saving || this.writing || !this.needsSave){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\telse{\n\t\t\treturn this.levelFile != undefined;\n\t\t}\n\t}", "async saved() {\n return (await this.client.user.hasShows(this.id))[0] || false;\n }", "function getAndDisplayUserReport() {\n getUserInfo(displayUserReport);\n}", "function hasUserLost() {\n\tif(_selectedFighterObj.healthPoints <= 0 && _selectedDefenderObj.healthPoints > 0) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}", "submitStatusReport (statusReportId) {\n console.log('submitStatusReport:', statusReportId);\n let user = Auth.requireAuthentication();\n \n // Validate the data is complete\n check(statusReportId, String);\n \n // Load the statusReport to authorize the edit\n let statusReport = StatusReports.findOne(statusReportId);\n \n // Validate that the current user is an administrator\n if (user.managesContributor(statusReport.contributorId) || user.isAdmin() || user.contributorId() === statusReport.contributorId) {\n // Mark the report submitted\n StatusReports.update(statusReportId, {\n $set: {\n state : StatusReportStates.submitted,\n submitDate: Date.now()\n }\n });\n \n // Find any settings for this context and make sure they get updated\n let setting = StatusReportSettings.findOne({});\n if(setting){\n \n }\n } else {\n console.error('Non-authorized user tried to submit a statusReport:', user.username, statusReportId);\n throw new Meteor.Error(403);\n }\n }", "function check_and_report() {\n \n }", "function checkNew() {\n\tif(localStorage.getItem(\"newUser\") === null) {\n\t\twindow.newUserModal();\n\t}\n}", "function IsIngelogd() {\n return (localStorage.getItem('user_id') !== null);\n}", "isUserLoggedIn() {\n //console.log(`User registered button should be present`);\n return this.userRegisteredButton.isExisting();\n }", "function report(user) {\n if (user) {\n $.post(\"/reportUser\", {sender: username, receiver: user, chatroom: chatroomId}, function (data) {}, \"json\");\n }\n}", "storeCurrentlyViewedReport() {\n const reportID = this.getReportID();\n updateCurrentlyViewedReportID(reportID);\n }", "static async isReport (object) {\n return Report.validator.validate('report.schema.json', object);\n }", "function userSavesHandler() {\n\tif (!filepath) {\n\t\tdialog.showSaveDialog(savePathChosenHandler);\n\t} else {\n\t\twriteToFile(filepath)\n\t}\n}", "function file_save_check() {\n\tif (!fs || !schedule_path || !schedule.autosave) {\n\t\t// Show the holy button of justice.\n\t\timg.save.style.opacity = 1;\n\t\timg.save.style.pointerEvents = \"auto\";\n\t} else\n\t\t// The user is no fun. Just auto-save it.\n\t\tfile_save();\n}", "function saveUser() {\r\n\tif (document.getElementById(\"manual\").checked) {\r\n\t\tvar numberOfUsers = document.getElementById(\"inputNoOFUser\").options[document.getElementById(\"inputNoOFUser\").selectedIndex].value;\t\t\r\n\t\tif(numberOfUsers == \"\") {\t\t\t\r\n\t\t alertify.alert(\"Please select number of users.\");\r\n\t\t\treturn false;\r\n\t\t } else {\r\n\t\t\t validateUserForSave(prepareEmailIdString(), registeredUser, \"manual\");\r\n\t\t\t}\r\n\t} else if (document.getElementById(\"csv\").checked){\r\n\t\t\tvalidateUserForSave(emailIdCSVString, registeredUser, \"csv\");\t\r\n\t} else {\t\t\r\n\t alertify.alert('Please select an option first.');\r\n\t}\r\n}", "function reportUser() {\n xhr = new XMLHttpRequest();\n var url = document.URL + 'report';\n xhr.open(\"POST\", url, true);\n xhr.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n xhr.onreadystatechange = function () {\n if (xhr.readyState == 4 && xhr.status == 200) {\n console.log('User reported with success!');\n }\n }\n xhr.send();\n }", "function exists(user) {\n\tvar flag_e =false;\n\tfirebase.database().ref('users/' + user).once('value', function(snap) {\n\t\tif(snap.exists()){\n\t\t\tflag_e = true;\n\t\t}\n\t});\n\treturn flag_e;\n}", "function isItMyFloor(){\n //alert(\"Current Floor Owner: \" + current_floor_owner);\n //alert(\"My Email: \" + user_email);\n\n if(current_floor_owner == user_email)return true;\n return false;\n }", "isUserChange() {\n let lastLoadTimestamp = this.lastLoadTimestamp;\n let lastResetTimestamp = this.lastResetTimestamp;\n let currentTimestamp = Date.now();\n\n if (!lastLoadTimestamp) {\n console.debug('Ignoring text change as no notes is loaded currently');\n return false; // no loaded notes. cannot be user change.\n\n } else {\n let elapsedTimeSinceLoad = currentTimestamp - lastLoadTimestamp;\n let elapsedTimeSinceReset = currentTimestamp - lastResetTimestamp;\n\n if (elapsedTimeSinceLoad <= LOAD_WAIT_TIME) {\n console.debug('Ignoring text change as notes was loaded ' + elapsedTimeSinceLoad + ' ms ago');\n return false; // programmatic load happened very recently.\n\n } else if (elapsedTimeSinceReset <= RESET_WAIT_TIME) {\n console.debug('Ignoring text change as notes was reset ' + elapsedTimeSinceReset + ' ms ago');\n return false; // programmatic reset happened very recently.\n\n } else {\n return true; // user change.\n }\n }\n }", "function check(){\n return $storage.profile !== null;\n }", "function check(){\n return $storage.profile !== null;\n }", "function shouldAddUser(user) {\n if (user.type === 'anonymous') {\n return false;\n }\n\n if (typeof user.status === 'undefined') {\n console.error(\"User status is undefined. Not adding to relatedUsers aggregate.\");\n return false;\n }\n return user.status === 'current' && !usernames.has(user.username);\n }", "function shouldAddUser(user) {\n if (user.type === 'anonymous') {\n return false;\n }\n\n if (typeof user.status === 'undefined') {\n console.error(\"User status is undefined. Not adding to relatedUsers aggregate.\");\n return false;\n }\n return user.status === 'current' && !usernames.has(user.username);\n }", "editProfileHasLoaded(){\n\t\tif(resources.editProfileTitleBar().waitForVisible(10000)){\n\t\t\treturn true;\n\t\t}\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t}", "userPresent(username){\n console.log(\"userPreesent called\");\n \n if (this.users.length > 0) {\n for (var i =0; i < this.users.length; i++){\n if (this.users[i] === username){\n return true;\n }\n }\n }\n return false;\n }", "function validateUser(userVal) {\r\n\tif(userVal == \"\") {\r\n\t\talertify.alert(\"Please select new facilitator.\");\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}", "isUserHomePageLoaded() {\n return this.userSettingsIcon.waitForExist();\n }", "function _isWorkingOn(user, date) {\n var workWeek = user.profile.prefs ? user.profile.prefs.defaultWorkWeek : DEFAULT_WORK_WEEK;\n var dayStringOfThisDate = ['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'][date.day()];\n\n return _.contains(workWeek, dayStringOfThisDate);\n }", "get hasReporter() {\n return this._.root.reporter != null\n }", "function checkAutoSavedWork(){\n if(retrieving || loaded){\n return $q.reject();\n }\n retrieving = true;\n return tempFileService.checkSavedWork(AUTO_SAVE_FILE, foundAutoSavedCallbacks, true)\n .then(function(savedWork){\n dirtyDataCol = savedWork;\n })\n .catch(function(){\n removeAutoSavedWork();\n return $q.reject();\n })\n .finally(function(){\n retrieving = false;\n loaded = true;\n });\n }", "isRecording() {\n if (!this.recorder) {\n return false;\n }\n return this.recorder.isRecording();\n }", "function initialize_shit(){\n\tif(!user_exists('default')){\n\t\tadd_user('default', '', patients_default);\n\t}\n}", "function checkForNewTrack(){\n var trackCheckedRef = firebase.database().ref('users').child(userId).child('trackChecked');\n trackCheckedRef.once('value')\n .then(function(snapshot){\n var trackChecked = snapshot.child('trackChecked').val();\n console.log(\"The track has been checked: \" +trackChecked);\n \n if(trackChecked == 'false'){\n sendTrackEmail();\n trackCheckedRef.update({\n trackChecked:'true',\n emailSent:'false'\n });\n }\n else{\n console.log(\"no new tracks\");\n }\n });//end snapshot function\n }//end checkForNewTrack", "function getReportsManagerReport(userName, callable){\n console.log(\"(model/store.js) Started getReportsManagerReport()\");\n user.getStoresManagerByUsername(userName, function(err, docs){\n if(docs.StoresManager.length > 0) {\n store.find({StoreID: {\"$in\": docs.StoresManager}}, \"Reports\", function (err, docs) {\n if (err) {\n console.log(err)\n }\n else {\n callable(null, docs[0].Reports)\n }\n });\n }\n else{\n callable(null, null);\n }\n });\n}", "check() {\n let isLoggedIn = this.Storage.getFromStore('isLoggedIn');\n\n if(isLoggedIn) {\n return true;\n }\n\n return false;\n }", "function isPunched(user, row) {\n var offset = 2;\n // Find out col number\n var col = punchUserHash.labels[user] + 3;\n var punchSheet = punchCardSheet.getSheetByName(\"Punch\");\n // Punch: 1:punched, 0:not punched, -1:holiday\n if (punchSheet.getRange(row + offset, col).getValue() != 1) {\n return false;\n } else {\n return true;\n }\n}", "function userHasStorageAccess() {\n // If we're inside a running, editable notebook, anyone can save data.\n return true;\n}", "get healthReportUploadEnabled() {\n return !!this._healthReportPrefs.get(\"uploadEnabled\", true);\n }", "checkUser() {\n let doesExit = false\n this.state.admin.forEach(x => {\n if(x.email === this.state.email) {\n doesExit = true;\n }\n });\n return doesExit;\n }", "function showReportDialog() {\n return;\n}", "needsReview() {\n return this.isLoggedIn() && this.user.settings.needsReview\n }", "needsReview() {\n return this.isLoggedIn() && this.user.settings.needsReview\n }", "function checkNewUserStatus(e){\n var newUserStatus = localStorage.getItem(\"newUserStatus\");\n //console.log(something);\n if (newUserStatus){\n //show intro div\n alert(something);\n } else if (!newUserStatus){\n //show direction div\n alert(\"Oops something went wrong\");\n }\n \n return userStatus;\n}", "function recordsetIsDefined()\n{\n var retVal = false;\n \n var rsList = dwscripts.getRecordsetNames();\n if (rsList && rsList.length > 0)\n {\n retVal = true;\n }\n \n return retVal;\n}", "check(user, document) {\n if (options.newCheck) {\n return options.newCheck(user, document);\n }\n // if user is not logged in, disallow operation\n if (!user) return false;\n // else, check if they can perform \"foo.new\" operation (e.g. \"movies.new\")\n return Users.canDo(user, `${collectionName.toLowerCase()}.new`);\n }", "function checkUser() {\n\tif (user) {\n\t\tconsole.log(\"Signed in as user \" + user.email);\n\t\t// console.log(user);\n\t\thideLoginScreen();\n\t} else {\n\t\tconsole.log(\"No user is signed in\");\n\t}\n}", "static isAdmin(study, userLogged) {\n if (!study || !userLogged) {\n console.error(`No valid parameters, study: ${study}, user: ${userLogged}`);\n return false;\n }\n // Check if user is the Study owner\n const studyOwner = study.fqn.split(\"@\")[0];\n if (userLogged === studyOwner) {\n return true;\n } else {\n // Check if user is a Study admin, belongs to @admins group\n const admins = study.groups.find(group => group.id === \"@admins\");\n if (admins.userIds.includes(userLogged)) {\n return true;\n }\n }\n return false;\n }", "function check_save_required(){\n\tif(save_required){\n\t\treturn 'Please note that you have unsaved data. If you leave this page, you will lose all changes that took place after your last save.';\n\t}\n}", "function ownsRoom(user) {\n lunchrooms.forEach(function(room) {\n if (room['creator'] === user) {\n return true;\n }\n });\n return false;\n}", "isReviewer() {\n return this.isLoggedIn() && this.user.settings.isReviewer\n }", "isReviewer() {\n return this.isLoggedIn() && this.user.settings.isReviewer\n }", "new() {\n return this.user != null;\n }", "function checkPointsRecord() {\n console.log(\"Checking point scores\");\n\n // Check new points records\n if ( window.currentScore > window.highScores[window.gameMode]['points'] ) {\n console.log(\"New high point score for \" + window.gameMode);\n updateRecord(\"points\");\n return true;\n }\n else {\n return false;\n }\n}", "isLogged() {\n loadTemplate('api/loggedin',function(response) {\n /* Not logged */\n if (response === '0') {\n this.clear();\n this.login();\n return false;\n /* Login and getting user credential */\n }else {\n this.user = JSON.parse(response);\n /* Only call server if we not have loaded students */\n if (this.user.defaultSubject === 'default') {\n console.log(\"addSubject in isLogged\");\n addSubject(updateFromServer);\n }else if (Person.getStudentsSize() <= 0) {\n updateFromServer();\n }else {\n this.getTemplateRanking();\n }\n return true;\n }\n }.bind(this),'GET','',false);\n }", "function register(user) {\n return true;\n }", "function afterSaveCheck(){\n\n if(toDoAfterSaving == NOTHING){\n //do nothing\n }\n else if(toDoAfterSaving == NEW){\n NewProjectMenu();\n }\n else if(toDoAfterSaving == OPEN){\n chooseProject();\n }\n else if(toDoAfterSaving == QUIT){\n app.quit();\n }\n else{\n console.log(\"ERROR ON SOME ISLE OR OTHER \"+toDoAfterSaving);\n }\n toDoAfterSaving = NOTHING;\n}", "reopenStatusReport (statusReportId) {\n console.log('reopenStatusReport:', statusReportId);\n let user = Auth.requireAuthentication();\n \n // Validate the data is complete\n check(statusReportId, String);\n \n // Load the statusReport to authorize the edit\n let statusReport = StatusReports.findOne(statusReportId);\n \n // Validate that the current user is an administrator\n if (user.managesContributor(statusReport.contributorId) || user.isAdmin() || statusReport.contributorId === user.contributor()._id) {\n // Delete the statusReport\n StatusReports.update(statusReportId, {\n $set : {\n state: StatusReportStates.inProgress\n },\n $unset: {\n submitDate: true\n }\n });\n } else {\n console.error('Non-authorized user tried to reopen a statusReport:', user.username, statusReportId);\n throw new Meteor.Error(403);\n }\n }", "isMe() {\n if(this.$store.state.user.user.id === this.loadedUser.id)\n {\n return true;\n }\n else {\n return false;\n }\n }", "userRegister(user) {\n if(false) {\n throw new Error('Action cannot be billed');\n }\n\n return true;\n }", "function uptodate( user ){\n var age_collected = now - user.time_friends_collected;\n return age_collected < 3 * 24 * 3600 * 1000;\n }", "function checkSavedProgress() {\n var userSavedProgress = localStorage.getItem('savedProgress');\n\n if (userSavedProgress == 'false' || userSavedProgress === undefined || userSavedProgress === null) {\n gamePlay(1);\n } else {\n displayContinueGameQuestion();\n }\n}", "function checkuserstatus() {\n //资料等待提交\n $(\"#datadsubmit\").hide();\n// divhide('datadsubmit');\n //资料正在审核中\n $(\"#dataaudit\").hide();\n// divhide('dataaudit');\n //资料审核通过\n $(\"#datathrough\").hide();\n// divhide('datathrough');\n //资料被打回\n $(\"#databackto\").hide();\n// divhide('databackto');\n //资料已被拒绝\n $(\"#datarefused\").hide();\n// divhide('datarefused');\n if (localStorage.int32_apply_status != null) {\n switch (localStorage.int32_apply_status) {\n case \"0\":\n //资料等待提交\n divshow('datadsubmit');\n break;\n case \"1\":\n /*Data are waiting for the audit*/\n case \"2\":\n //资料正在审核中\n divshow('dataaudit');\n break;\n case \"3\":\n //资料审核通过\n// localStorage.int32_limit_amount\n $(\"#liamount\").html(500);\n divshow('datathrough');\n break;\n case \"4\":\n //资料被打回\n divshow('databackto');\n break;\n case \"5\":\n //资料已被拒绝\n divshow('datarefused');\n divshow('li_moreloan');\n break;\n }\n }\n}", "async handleClickSave() {\n const result = await this.props.screenProps.homeStore.saveTimeInfo(this.props.screenProps.auth.currentUser,\n { StartTime:this.state.SleepStartTime , EndTime:this.state.SleepEndTime })\n if (result.Status == 'Success') {\n //alert('The user info have saved successfully.')\n Alert.alert('','The user info have been saved successfully.',)\n } else {\n //alert('Could not save user info. Please try refreshing data or check your signal strength.')\n Alert.alert('','Could not save user info. Please refresh and try again.',)\n }\n }", "function checkIfUserInitialized() {\n if (currentuser) {\n loadHomePage();\n } else {\n updateCurrentUser().then(function () {\n loadHomePage();\n }).catch(function () {\n loadSettingsPage();\n });\n }\n}", "function isUserPresent(response) {\n\n if(response) {\n\n UserService.setCurrentUser(response);\n\n // if success from user present change url to profile\n $location.url(\"/profile\");\n }\n }", "function displayUserReport(data) {\n $('body').append(\n \t'<p>' + 'Report: ' + data.report + '</p>');\n}", "function enterReport(proj_name, proj_address, proj_city, proj_county, proj_state, proj_desc, bldg_size, proj_mgr, proj_sup, architect, civil_eng, mech_eng, elec_eng, plumb_eng, land_arch, int_design, sched_start, sched_compl, actual_start, actual_compl, sched_reason, init_budget, final_budget, budget_reason, sector, const_type, awards, proj_challenges, proj_strengths, UserId) {\n var UserId = currentUser.id;\n // function enterReport(pers_spir, pers_emot, pers_health, pers_pr_req) {\n $.post(\"/api/reportentry\", {\n proj_name: proj_name,\n proj_address: proj_address,\n proj_city: proj_city,\n proj_county: proj_county,\n proj_state: proj_state,\n proj_desc: proj_desc,\n bldg_size: bldg_size,\n proj_mgr: proj_mgr,\n proj_sup: proj_sup,\n architect: architect,\n civil_eng: civil_eng,\n mech_eng: mech_eng,\n elec_eng: elec_eng,\n plumb_eng: plumb_eng,\n land_arch: land_arch,\n int_design: int_design,\n sched_start: sched_start,\n sched_compl: sched_compl,\n actual_start: actual_start,\n actual_compl: actual_compl,\n sched_reason: sched_reason,\n init_budget: init_budget,\n final_budget: final_budget,\n budget_reason: budget_reason,\n sector: sector,\n const_type: const_type,\n awards: awards,\n proj_challenges: proj_challenges,\n proj_strengths: proj_strengths,\n UserId: UserId\n\n }).then(function (data) {\n console.log(\"abcde\")\n window.location.replace(data);\n // If there's an error, handle it by throwing up a bootstrap alert\n }).catch(handleLoginErr);\n }", "function pgp_fCheckSammeln()\t{\r\n\tif(GM_getValue(pgp_getVar('doSammeln'),false))\t{\r\n\t\tpgp_fDoSammeln();\r\n\t}\r\n}", "function SaveSettingsAndExit() {\n\t/*\n\t * Check for phone numver if using sms\n\t * check for email address if using email\n\t * check for paypal email if using paypal\n\t */\n\tvar currentUser = getCurrentUser();\n\n\tconsole.log(\"saving\");\n\tvar firstName = $('input#firstNameInput').val();\n\tvar lastName = $('input#lastNameInput').val();\n\tvar email = $('input#emailInput').val();\n\tvar phone = $('input#phoneInput').val();\n\tvar usePayPal = $('input#yesPayPal').is(':checked');\n\tvar payPalEmail = $('input#PayPalEmail').val();\n\tvar useEmail = $('input#emailAlertBox').is(':checked');\n\tvar useSMS = $('input#smsAlertBox').is(':checked');\n\n\t/*\n\t * Check for phone numver if using sms\n\t * check for email address if using email\n\t * check for paypal email if using paypal\n\t */\n\tvar saveUser = true;\n\n\tif (usePayPal == true && (payPalEmail == null || payPalEmail.length < 1)) {\n\t\tsaveUser = false;\n\t\talert(\"You must enter a PayPal Email Address if you want to use PayPal to receive payments.\");\n\t}\n\n\tif (useEmail == true && (email == null || email.length < 1)) {\n\t\tsaveUser = false;\n\t\talert(\"You must enter an email address if you want to receive email alerts.\");\n\t}\n\n\tif (useSMS == true && (phone == null || phone.length < 1)) {\n\t\tsaveUser = false;\n\t\talert(\"You must enter a phone number if you want to receive SMS alerts.\");\n\t}\n/*\n\tconsole.log(firstName);\n\tconsole.log(lastName);\n\tconsole.log(email);\n\tconsole.log(phone);\n\tconsole.log(usePayPal);\n\tconsole.log(payPalEmail);\n\tconsole.log(useEmail);\n\tconsole.log(useSMS);\n*/\n\tif (saveUser == true) {\n\t\t//updateUser(currentUser.UserID, currentUser.FirstName, currentUser.LastName, currentUser.Email, currentUser.Phone, currentUser.Latitude, currentUser.Longitude);\n\t\tupdateUser(currentUser.UserID, null, firstName, lastName, email, phone, currentUser.Latitude, currentUser.Longitude, usePayPal ? 1 : 0, payPalEmail, useEmail ? 1 : 0, useSMS ? 1 : 0);\n\t\tconsole.log(\"resetting currentUser\");\n\t\tsetTimeout(function() {\n\t\t\tsetCurrentUser(currentUser.UserID);\n\t\t\tconsole.log(\"exiting\");\n\t\t\talert(\"Your settings have been saved.\");\n\n\t\t\t//acts as the back button\n\t\t\t$.mobile.back();\n\t\t}, 500);\n\n\t}\n}", "function markUserSelected(){\n\tif(document.getElementById('selectUser').value==0){\n\t\talert(\"please select a user\");\n\t}else{\n\t\tCURRENT_USER_=document.getElementById('selectUser').value;\n\t\t//\n\t\tdocument.getElementById('projectBioContainer').style.display='block';\n\t}\n}", "function standupShouldFire(standup) {\n var standupTime = standup.time,\n utc = standup.utc;\n\n var now = new Date();\n\n var currentHours, currentMinutes;\n\n if (utc) {\n currentHours = now.getUTCHours() + parseInt(utc, 10);\n currentMinutes = now.getUTCMinutes();\n\n if (currentHours > 23) {\n currentHours -= 23;\n }\n\n }\n else {\n currentHours = now.getHours();\n currentMinutes = now.getMinutes();\n }\n\n var standupHours = standupTime.split(':')[0];\n var standupMinutes = standupTime.split(\":\")[1];\n\n try {\n standupHours = parseInt(standupHours, 10);\n standupMinutes = parseInt(standupMinutes, 10);\n }\n catch (_error) {\n return false;\n }\n\n if (standupHours === currentHours && standupMinutes === currentMinutes) {\n return true;\n }\n return false;\n }", "function GenerateReport(GenfromSavedFilters, Withemail) {\n\n //$('.loading').hide();\n //SetLoadingImageVisibility(false);\n hasExcelData = true;\n\n var isPageValid = ValidateScreen();\n\n if (!isPageValid)\n return false;\n\n GenerateReportAddCall();\n\n}", "async verifyUserLoggedIn() {\n if ((await browser.getCurrentUrl()).includes('inventory')) {\n return true;\n }\n else { return false; }\n }", "function fnStudentNotificationDefaultandValidate(operation) {\n\tvar $scope = angular.element(document.getElementById('SubScreenCtrl')).scope();\n\tswitch (operation) {\n\t\tcase 'View':\n\t\t\t/*if (!fnDefaultNotifificationID($scope))\n\t\t\t\treturn false; */\n\n\t\t\tbreak;\n\n\t\tcase 'Save':\n\t\t\tif (!fnDefaultNotifificationID($scope))\n\t\t\t\treturn false;\n\n\t\t\tbreak;\n\n\n\t}\n\treturn true;\n}", "function form_saveRecord()\n{\n var valid = true;\n valid = hasClientAgreedToTerms();\n\treturn valid;\n}", "function getSingleReportDisplay(standupReport) {\n var report = \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime + \"\\n\";\n report += \"_What did you work on yesterday:_ `\" + standupReport.yesterdayQuestion + \"`\\n\";\n report += \"_What are you working on today:_ `\" + standupReport.todayQuestion + \"`\\n\";\n report += \"_Any obstacles:_ `\" + standupReport.obstacleQuestion + \"`\\n\\n\";\n return report;\n}", "userExists(){\n // set Status for previous view in case server validation failed \n this.displayMode = 'none';\n this.isAgreed = false;\n // add xhr message into form error validation message object - will be shown on screen\n for(let i in this.messageService.xhr.warn){\n this.addform.emailid.$setValidity(i, !this.messageService.xhr.warn[i]);\n }\n\n this.abortForm = true;\n }", "function tellUser(sourceUser, targetUser) {\n var interested = Math.random();\n\n /**\n * This user has already seen the concept.\n **/\n if (pastUsers.hasOwnProperty(targetUser.name)) {\n return false;\n }\n\n /**\n * Did the source user's pitch convince the new user? Does the new\n * user see value in the product?\n **/\n if (interested < getConfig('userValue')) {\n return true;\n }\n \n return false;\n }", "function checkSavedSettings()\n {\n if(localStorage.getItem(\"startTime\") != null)\n {\n startTime = parseInt(localStorage.getItem(\"startTime\"));\n endTime = parseInt(localStorage.getItem(\"endTime\"));\n timeFormat = localStorage.getItem(\"timeFormat\");\n }\n else\n {\n startTime = 7;\n endTime = 17;\n timeFormat = \"12\";\n }\n }", "function hasPermissions(user) {\r\n if(user.status == 'admin') {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n}", "function SaveToMyReports(deleteReport) {\n\n var isPageValid = ValidateScreen();\n\n if (!isPageValid)\n return false;\n\n var searchCriteria = GetParameterValuesFromScreen();\n\n var parameterSet = [\n { SelectedSites: ERSites.getSelectedSites() },\n { ReportTitle: searchCriteria.ReportTitle },\n { ReportType: searchCriteria.ReportType },\n { ProgramServices: searchCriteria.ProgramIDs },\n { ChapterIDs: searchCriteria.SelectedChapterIDs },\n { StandardIDs: searchCriteria.SelectedStandardIDs },\n { EPScoreType: searchCriteria.SelectedScoreType },\n { EPAssignedTo: searchCriteria.SelectedAssignedToIDs },\n { IncludeFSAcheckbox: searchCriteria.IncludeFSAEPs },\n { EPDocRequiredCheckbox: searchCriteria.IncludeDocumentationRequired },\n { EPNewChangedCheckbox: searchCriteria.IncludeNewChangedEPs }\n ];\n\n //Include Score Value\n if (searchCriteria.ScoreValueList.indexOf(\"2\") > -1)\n parameterSet.push({ SatisfactoryCheckbox: true });\n else\n parameterSet.push({ SatisfactoryCheckbox: false });\n\n if (searchCriteria.ScoreValueList.indexOf(\"0\") > -1)\n parameterSet.push({ InsufficientCheckbox: true });\n else\n parameterSet.push({ InsufficientCheckbox: false });\n\n if (searchCriteria.ScoreValueList.indexOf(\"6\") > -1)\n parameterSet.push({ NotApplicableCheckbox: true });\n else\n parameterSet.push({ NotApplicableCheckbox: false });\n\n if (searchCriteria.ScoreValueList.indexOf(\"99\") > -1)\n parameterSet.push({ NotScoredCheckbox: true });\n else\n parameterSet.push({ NotScoredCheckbox: false });\n\n //DateRange\n //Add date parameters only there is a value\n GetObservationDate(parameterSet, searchCriteria.StartDate, searchCriteria.EndDate);\n\n parameterSet.push({ ScheduledReportName: $('#txtScheduledReportName').val() });\n\n //Add recurrence fields to the parameter set\n GetERRecurrenceParameters(parameterSet);\n\n //Save the parameters to the database\n SaveSchedule(parameterSet, deleteReport);\n}", "automatic_upgrader_work_check(roomName){\n var room = Game.rooms[roomName]\n var storage = f.get([room, 'storage'])\n var controller_level = f.get([room, 'controller', 'level'])\n if (! room || ! storage || ! storage.my || ! controller_level || controller_level < 5){\n console.log('This room is not suitable for an upgrader work check: '+roomName)\n return false\n }\n \n // If there is no snapshot on file, this is the first, so just take a\n // snapshot and return\n if (! Memory.room_strategy[roomName].storage_snapshot){\n console.log('Taking initial snapshot of storage')\n Memory.room_strategy[roomName].storage_snapshot = {'tick':Game.time, 'amount':storage.store.energy}\n return Memory.room_strategy[roomName].storage_snapshot \n }\n\n // There is a snapshot on file. Let's compare to it\n var ss = Memory.room_strategy[roomName].storage_snapshot\n\n // Make sure enough time has passed\n if (Game.time - ss.tick < 9000){\n console.log((Game.time - ss.tick)+' is not enough time since the last snapshot')\n return false\n }\n\n // Since enough time has passed, set another snapshot. This won't\n // mess up our processing with ss\n Memory.room_strategy[roomName].storage_snapshot = {'tick':Game.time, 'amount':storage.store.energy}\n\n // First order of business is to fix rooms that may be drawing too much\n // If the storage is low overall, and is decreasing in amount, reduce the work parts\n if (storage.store.energy < 50000 && storage.store.energy - ss.amount < 0){\n console.log('Room is low on energy and decreasing')\n console.log('Decreasing the upgrader work parts in '+roomName)\n return this.increase_upgrader_work(roomName, -2)\n }\n // If the room is suffering great decreases in energy, reduce. \n if (storage.store.energy - ss.amount < -7000){\n console.log('Room is decreasing rapidly')\n console.log('Decreasing the upgrader work parts in '+roomName)\n return this.increase_upgrader_work(roomName, -1)\n }\n \n // Now to check for happy excesses!\n // Make sure there is enough energy\n if (storage.store.energy < 50000){\n console.log('Not enough energy in storage for increase')\n return false\n }\n // Make sure there is an increase of energy, or a continuing excess of energy\n if (storage.store.energy - ss.amount < 7000 && storage.store.energy < 600000){\n console.log('Not enough increase in storage')\n return false\n }\n\n // At this point, we know that the storage has enough energy and is\n // increasing (or has a ton of energy). Now we increase upgrader capacity.\n console.log('Increasing the upgrader work parts in '+roomName)\n return this.increase_upgrader_work(roomName, 1)\n }", "function checkIsScrumMaster() {\n if ($rootScope.currentUserRole === 2 /*scrum master role id*/) {\n $rootScope.isScrumMaster = true;\n } else {\n $rootScope.isScrumMaster = false;\n }\n return $rootScope.isScrumMaster;\n }", "isExecutableUserPathSet() {\r\n return this._executableUserPath !== undefined;\r\n }", "isUploading () {\n // return <Boolean>\n console.log(\"isUploading called\")\n }", "function isItMyFloor(){\n if(current_floor_owner == user_email)return true;\n return false;\n /*\n //alert(\"Current Floor Owner: \" + current_floor_owner);\n //alert(\"My Email: \" + user_email);\n $.ajax({\n type: \"POST\",\n cache: false,\n url: \"/locking_turn_get_current_floor_owner/\",\n success: function (option) {\n current_floor_owner = option['current_floor_owner_srv'];\n //console.log(\"From Srv , Current Owner: \" + current_floor_owner);\n\n //if(current_floor_owner == user_email)return true;\n //return false;\n },\n error: function (xhr, status, error) {\n alert(\"Some Error Occured while Releasing Floor.\");\n },\n async:false\n\n });*/\n\n\n\n }", "function checkForUserProfile() {\n \n dataservice.getData(LENDER_INFO_API, {}, config).then(function(data, status) {\n if (data) {\n if (data.status) {\n if(data.data.ifsc!=\"\" && data.data.ifsc!=undefined){\n $rootRouter.navigate(['Payment']);\n }\n else{\n $('#lenderInfoModal').modal({\n backdrop: 'static',\n keyboard: false\n });\n }\n\n }\n }\n }, function() {\n $('#lenderInfoModal').modal({\n backdrop: 'static',\n keyboard: false\n });\n });\n\n }", "function isMyProfile(aUserId) {\n var mine = false;\n if ((location.href.match(/\\d+/) == aUserId) ||\n (/\\/profile\\/?$/.test(location.pathname))) {\n mine = true;\n }\n if (aUserId) {\n log += \"\\n* This is\" + (mine ? \" \" : \" NOT \") + \"your profile page.\";\n }\n return mine;\n}", "function setupUser() {\n updateCounts(); //count stuff\n console.log(\"Updated counts - iReport.js\");\n\n var TheTech = localStorage.getItem(\"tech\");\n //alert(\"Welcome: \"+ TheTech);\n //document.getElementById('TechName').innerHTML =localStorage.getItem(\"tech\");\n //var TheTech = localStorage.getItem(\"username\");\n if (TheTech == null || TheTech == '') {\n localStorage.setItem(\"Tech\", \"setup\");\n window.location.replace(\"setup.html\");\n }\n\n\n\n/* 8-16-13 commented out\n function initial_setup() {\n var name = prompt(\"eReport Setup - Please enter your Username\", \"\");\n var pw = prompt(\"eReport Setup - Please enter your Domino Password\", \"\");\n\n if (name != null && name != \"\" && pw != \"\") {\n\n daLogin = doDominoLogin(name, pw); // ajaxLogin.js\n if (daLogin) {\n //alert(\"daLogin succeeded\");\n //Set the tech name based on who is logged in\n localStorage.setItem(\"username\", name);\n localStorage.setItem(\"password\", pw);\n\n //var TheTech = localStorage.getItem(\"tech\");\n //var TheTech = localStorage.getItem(\"username\");\n document.getElementById('TechName').innerHTML = localStorage.getItem(\"Tech\");\n\n //alert(\"hello \" + TheTech);\n show('initSetup');\n }\n\n\n }\n }\n\t*/\n\t\n //see if there is a techname locally \n //var TheTech = localStorage.getItem(\"tech\");\n //alert(TheTech);\n //prompt them for a name\n/*\n if ( TheTech==\"\"){\n hide('daForm');\n show('initSetup');\n //show_prompt();\n }\n */\n\n}", "function hasUserChanged (user) {\n (user.latitude) ||\n (user.longitude) ||\n (user.profileText)\n }", "function storeUserLocal(user){\n try\n {\n LocalStorage.setObject(Constants.USER,user);\n return true;\n }\n catch(err)\n {\n return false;\n }\n }" ]
[ "0.649892", "0.6148491", "0.61291283", "0.59572446", "0.58156663", "0.576441", "0.5732094", "0.5696675", "0.56009287", "0.552245", "0.5477061", "0.5475031", "0.5408099", "0.53833044", "0.53567165", "0.53470856", "0.5345371", "0.53063864", "0.526573", "0.5260738", "0.5246342", "0.52227575", "0.52209425", "0.5217001", "0.5207676", "0.51868254", "0.5171927", "0.5143803", "0.51294106", "0.51294106", "0.51258695", "0.51258695", "0.5110206", "0.51101", "0.51025045", "0.5100423", "0.509634", "0.50636566", "0.5057919", "0.50562274", "0.5047569", "0.50360596", "0.5027352", "0.50264007", "0.50184023", "0.50180167", "0.50157136", "0.5015304", "0.5007292", "0.49907294", "0.49907294", "0.49894604", "0.49775144", "0.49684206", "0.49618423", "0.49561664", "0.49548602", "0.49493602", "0.4946065", "0.4946065", "0.49355015", "0.4934215", "0.49211568", "0.49194407", "0.4917267", "0.49146584", "0.49118802", "0.49109727", "0.49098668", "0.49073577", "0.49042922", "0.49004832", "0.48990756", "0.4893714", "0.4891605", "0.48909608", "0.4890011", "0.4888049", "0.48846644", "0.48804784", "0.48780787", "0.48707318", "0.48668602", "0.48658076", "0.4862885", "0.48622942", "0.48621732", "0.48603493", "0.48575243", "0.48572215", "0.48517942", "0.4844274", "0.48431185", "0.48394832", "0.4837936", "0.48339114", "0.4833886", "0.48283154", "0.48230383", "0.4822721" ]
0.5873136
4
intended to be called every minute. checks if there exists a user that has requested to be asked to give a standup report at this time, then asks them
function checkTimesAndAskStandup(bot) { getAskingTimes(function (err, askMeTimes) { if (!askMeTimes) { return; } for (var channelId in askMeTimes) { for (var userId in askMeTimes[channelId]) { var askMeTime = askMeTimes[channelId][userId]; var currentHoursAndMinutes = getCurrentHoursAndMinutes(); if (compareHoursAndMinutes(currentHoursAndMinutes, askMeTime)) { hasStandup({user: userId, channel: channelId}, function(err, hasStandup) { // if the user has not set an 'ask me time' or has already reported a standup, don't ask again if (hasStandup == null || hasStandup == true) { var x = ""; } else { doStandup(bot, userId, channelId); } }); } } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function promptStandup(promptMessage) {\n usersService.getLateSubmitters().then(lateSubmitters => {\n if (lateSubmitters.length > 0) {\n console.log(\"Behold late submitters members = > \" + lateSubmitters);\n lateSubmitters.forEach(user => {\n sendMessageToUser(user, promptMessage);\n });\n }\n });\n}", "function checkTimesAndReport(bot) {\n getStandupTimes(function(err, standupTimes) { \n if (!standupTimes) {\n return;\n }\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n for (var channelId in standupTimes) {\n var standupTime = standupTimes[channelId];\n if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) {\n getStandupData(channelId, function(err, standupReports) {\n bot.say({\n channel: channelId,\n text: getReportDisplay(standupReports),\n mrkdwn: true\n });\n clearStandupData(channelId);\n });\n }\n }\n });\n}", "function dailyCheck(){\n // set later to use local time\n later.date.localTime();\n // this is 8 PM on July 23rd\n var elevenAM = later.parse.recur().every(1).dayOfMonth().on(11).hour();\n var tenAM = later.parse.recur().every(1).dayOfMonth().on(10).hour();\n\n var timer2 = later.setInterval(remindPresentingGroups, elevenAM);\n var timer3 = later.setInterval(otherReminders, tenAM);\n}", "function getAndDisplayUserReport() {\n getUserInfo(displayUserReport);\n}", "promptIndividualStandup() {\n let rmUserArr = [];\n this.getUsers().then(res => {\n res.forEach(res => {\n rmUserArr.push(res.username);\n });\n });\n this.getChannelMembers().then(res => {\n let allChannelUsers = res.members;\n allChannelUsers = allChannelUsers.filter(\n item => !rmUserArr.includes(item)\n );\n\n allChannelUsers.forEach(user => {\n this.sendMessageToUser(user, pickRandomPromptMsg());\n });\n });\n }", "function checkNewUsers(){\n fetch(\"/userUpdate\", {method: \"post\"})\n .then(res => res.json())\n .then(response => {updateUsersList(response)})\n .catch((err) => {\n if(err.message === \"Unexpected end of JSON input\") //user disconnected\n stopIntervalAndReturn()\n else\n console.log(err.message)\n })\n }", "function pii_check_if_stats_server_up() {\n var stats_server_url = \"http://woodland.gtnoise.net:5005/\"\n\ttry {\n\t var wr = {};\n\t wr.guid = (sign_in_status == 'signed-in') ? pii_vault.guid : '';\n\t wr.version = pii_vault.config.current_version;\n\t wr.deviceid = (sign_in_status == 'signed-in') ? pii_vault.config.deviceid : 'Not-reported';\n\n\t var r = request({\n\t\t url: stats_server_url,\n\t\t content: JSON.stringify(wr),\n\t\t onComplete: function(response) {\n\t\t\tif (response.status == 200) {\n\t\t\t var data = response.text;\n\t\t\t var is_up = false;\n\t\t\t var stats_message = /Hey ((?:[0-9]{1,3}\\.){3}[0-9]{1,3}), Appu Stats Server is UP!/;\n\t\t\t is_up = (stats_message.exec(data) != null);\n\t\t\t my_log(\"Appu stats server, is_up? : \"+ is_up, new Error);\n\t\t\t}\n\t\t\telse {\n\t\t\t //This means that HTTP response is other than 200 or OK\n\t\t\t my_log(\"Appu: Could not check if server is up: \" + stats_server_url\n\t\t\t\t\t+ \", status: \" + response.status.toString(), new Error);\n\t\t\t print_appu_error(\"Appu Error: Seems like server was down. \" +\n\t\t\t\t\t \"Status: \" + response.status.toString() + \" \"\n\t\t\t\t\t + (new Date()));\n\t\t\t}\n\t\t }\n\t\t});\n\n\t r.post();\n\t}\n\tcatch (e) {\n\t my_log(\"Error while checking if stats server is up\", new Error);\n\t}\n last_server_contact = new Date();\n}", "checkForUserEmail(results) {\n // check if user email is in dbs\n // TO DO function calls based on what emerges\n apiCalls.checkUserByEmail(results.email).then(results => {\n if (results.data.data === \"new user\") {\n console.log(\"build new user\");\n } else {\n console.log(\"update old user\");\n }\n });\n }", "checkUser(user, onTakePill, onNotify){\n console.log('checking user', user);\n \n let handler = (err, res) => { \n console.log('checked user with res', res);\n let d = moment(res.d);\n \n if(that.checkIfShouldTakePill(user, d)){\n onTakePill(user);\n\n if(that.checkIfShouldNotify(user)){\n console.log('notifying');\n onNotify(user)\n }\n }\n \n };\n this.db.getLastTakenDate(user.id, handler)\n }", "function doStandup(bot, user, channel) {\n\n var userName = null;\n\n getUserName(bot, user, function(err, name) {\n if (!err && name) {\n userName = name;\n\n bot.startPrivateConversation({\n user: user\n }, function(err, convo) {\n if (!err && convo) {\n var standupReport = \n {\n channel: channel,\n user: user,\n userName: userName,\n datetime: getCurrentOttawaDateTimeString(),\n yesterdayQuestion: null,\n todayQuestion: null,\n obstacleQuestion: null\n };\n\n convo.ask('What did you work on yesterday?', function(response, convo) {\n standupReport.yesterdayQuestion = response.text;\n \n convo.ask('What are you working on today?', function(response, convo) {\n standupReport.todayQuestion = response.text;\n \n convo.ask('Any obstacles?', function(response, convo) {\n standupReport.obstacleQuestion = response.text;\n \n convo.next();\n });\n convo.say('Thanks for doing your daily standup, ' + userName + \"!\");\n \n convo.next();\n });\n \n convo.next();\n });\n \n convo.on('end', function() {\n // eventually this is where the standupReport should be stored\n bot.say({\n channel: standupReport.channel,\n text: \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime,\n //text: displaySingleReport(bot, standupReport),\n mrkdwn: true\n });\n\n addStandupData(standupReport);\n });\n }\n });\n }\n });\n}", "function pollUsers(client, storage) {\n const currentTime = DateTime.local();\n\n for (const [user, id] of storage.users) {\n if (user.unbanDate !== '0' && DateTime.fromISO(user.unbanDate) < currentTime) {\n // Unban user\n restrictUser(client, storage.channelId, id, false);\n user.unbanDate = '0';\n }\n }\n}", "function check_and_report() {\n \n }", "notifyBeforePostingStandup() {\n let rmUserArr = [];\n this.getUsers().then(res => {\n if (res.length > 0) {\n res.forEach(res => {\n rmUserArr.push(res.username);\n });\n console.log(\"Unsubscribed users = \" + rmUserArr)\n }\n });\n this.getLateSubmitters().then(res => {\n let lateSubmitters\n if (res.length > 0) {\n lateSubmitters = res\n console.log(\"Late submitters before filter = \" + lateSubmitters)\n lateSubmitters = lateSubmitters.filter(\n item => !rmUserArr.includes(item)\n );\n console.log(\"Late submitters after filter = \" + lateSubmitters)\n if (lateSubmitters.length > 0) {\n res.forEach(user => {\n this.sendMessageToUser(user, pickRandomReminderMsg());\n });\n }\n }\n\n });\n }", "function _verify_account_with_offline(){\n try{\n var db = Titanium.Database.open(self.get_db_name());\n var my_table_name = \"my_manager_user\";\n var rows = db.execute('SELECT type,name FROM sqlite_master WHERE type=? AND name=? LIMIT 1', 'table', my_table_name);\n var manager_row_count = rows.getRowCount();\n rows.close();\n db.close(); \n if(manager_row_count > 0){ \n db = Titanium.Database.open(self.get_db_name());\n rows = db.execute('SELECT * FROM my_manager_user WHERE username=? and password=? and status_code=1',(_user_name).toLowerCase(),_sha1_password);\n var rows_count = rows.getRowCount();\n if(rows_count > 0){\n self.update_message('Loading My Calendar ...');\n Ti.App.Properties.setString('current_login_user_id',rows.fieldByName('id'));\n Ti.App.Properties.setString('current_login_user_name',rows.fieldByName('display_name'));\n Ti.App.Properties.setString('current_company_id',rows.fieldByName('company_id'));\n Ti.App.Properties.setString('location_service_time','0');\n Ti.App.Properties.setBool('location_service_time_start',false);\n _user_id = rows.fieldByName('id');\n _company_id = rows.fieldByName('company_id');\n rows.close();\n \n //set properties: active_material_location\n rows = db.execute('SELECT * FROM my_company WHERE id=?',_company_id);\n if(rows.isValidRow()){\n Ti.App.Properties.setString('current_company_active_material_location',rows.fieldByName('active_material_location')); \n }\n rows.close(); \n\n rows = db.execute('SELECT * FROM my_login_info where id=1');\n if((rows.getRowCount() > 0) && (rows.isValidRow())){\n db.execute('UPDATE my_login_info SET name=?,value=? WHERE id=1','username',_user_name);\n }else{\n db.execute('INSERT INTO my_login_info (id,name,value)VALUES(?,?,?)',1,'username',_user_name);\n }\n rows.close();\n\n //SAVE LOGIN USER STATUS,SET STATUS IS 1,THEN IF CRASH OR SOMETHING ,CAN LOGIN AUTO\n db.execute('UPDATE my_manager_user SET local_login_status=1 WHERE id=?',_user_id);\n db.close();\n if(Ti.Network.online){\n _download_my_jobs(_first_login);\n }else{\n self.hide_indicator();\n if(_first_login){\n if(_tab_group_obj == undefined || _tab_group_obj == null){ \n }else{\n //_tab_group_obj.open();\n }\n }\n win.close({\n transition:Titanium.UI.iPhone.AnimationStyle.CURL_UP\n });\n }\n }else{ \n rows.close();\n db.close();\n self.hide_indicator();\n self.show_message(L('message_login_failure'));\n return;\n } \n }else{\n self.hide_indicator();\n self.show_message(L('message_login_failure'));\n return; \n } \n }catch(err){\n self.process_simple_error_message(err,window_source+' - _verify_account_with_offline');\n return;\n } \n }", "function checkUserState() {\n var user = firebaseData.getUser();\n if (user) {\n // logged in - hide this\n document.getElementById('not_logged_in').style.display = 'none';\n document.getElementById('submit_access_reminder').style.display = 'none';\n document.getElementById('not_reader').style.display = null;\n document.getElementById('login_explanation').style.display = null;\n firebaseData.getUserData(user,\n function(firebaseUserData) {\n // got the data\n if (firebaseData.isUserReader(firebaseUserData)) {\n // we are a reader\n document.getElementById('not_reader').style.display = 'none';\n document.getElementById('login_explanation').style.display = 'none';\n }\n else {\n // not a reader\n document.getElementById('not_reader').style.display = null;\n populateRegistrationForm(firebaseUserData);\n }\n if (firebaseUserData['isRequestPending']) {\n // let them send their reminder as the request is pending\n document.getElementById('submit_access_reminder').style.display = null;\n }\n }),\n function(error) {\n // failed\n console.log('failed to get the user data to see if a reader', error);\n document.getElementById('not_reader').style.display = null;\n }\n }\n else {\n // not logged in, show this\n document.getElementById('not_logged_in').style.display = null;\n document.getElementById('not_reader').style.display = 'none';\n document.getElementById('submit_access_reminder').style.display = 'none';\n }\n}", "function logUserScheduleCreateDetails() {\n if (createScheduleReq.readyState == 4) {\n\n var dbData = JSON.parse(showErrorCreate(userManagementProfileReq.responseText, \"Error Found\"));\n var userDetails = dbData['queryresult'];\n\n\n var userProfileData = JSON.parse(showErrorCreate(userProfilereq.responseText, \"Error Found\"));\n var userProfile = userProfileData['UserInfo'];\n\n if ((Object.entries(dbData).length != 0) && (Object.entries(userProfileData).length != 0)) {\n var newScheduleName = document.getElementById(\"newScheduleName\").value;\n\n\n var radioOnce = document.getElementById(\"radioOnce\");\n var radioDaily = document.getElementById(\"radioDaily\");\n var radioWeekly = document.getElementById(\"radioWeekly\");\n var radioEnable = document.getElementById(\"radioEnable\");\n var radioDisable = document.getElementById(\"radioDisable\");\n\n var newScheduleName = document.getElementById(\"newScheduleName\").value;\n\n\n\n // frequency\n if (radioOnce.checked == true) {\n var newScheduleFrequency = radioOnce.value;\n } else if (radioDaily.checked == true) {\n\n var newScheduleFrequency = radioDaily.value;\n } else if (radioWeekly.checked == true) {\n\n var newScheduleFrequency = radioWeekly.value;\n }\n\n if (radioEnable.checked == true) {\n var newScheduleEnabled = radioEnable.value;\n } else if (radioDisable.checked == true) {\n var newScheduleEnabled = radioDisable.value;\n }\n\n\n var newScheduleStartDate = document.getElementById(\"nStartDate\").value;\n var newScheduleStartTime = document.getElementById(\"StartTime\").value;\n var newScheduleEndDate = document.getElementById(\"EndDate\").value;\n var newScheduleEndTime = document.getElementById(\"EndTime\").value;\n\n var newStartDateTime = newScheduleStartDate + \" \" + newScheduleStartTime;\n var newEndDateTime = newScheduleEndDate + \" \" + newScheduleEndTime;\n\n loadActiveSchedules();\n\n var currentUser;\n var userProfileID = \"\";\n var dateNow;\n\n // var remoteVodaEXT = \"?remotehost=https://41.0.203.210:8443/InovoCentralMonitorClient/MonitorData&action=runopenquery&query=\";\n\n\n var newUserId;\n\n currentUser = userProfile['userLogin']\n for (var iAlarm = 0; iAlarm < userDetails.length; iAlarm++) {\n\n var rowData = userDetails[iAlarm];\n if (currentUser == rowData['userlogin']) {\n userProfileID = rowData['id'];\n }\n }\n\n // // --------------------------------------------------------------------------------------------------------------------------------------------------\n // // UPDATE USER LOG\n // // -------------------------------------------------------------------------------------------------------------------------------------------------- \n var updateReason = createReasonUserLogForSchedule(newScheduleName, newScheduleFrequency, newScheduleEnabled, newStartDateTime, newEndDateTime);\n // var query = \"SELECT * FROM InovoMonitor.tblAlarms;\"\n\n dateNow = new Date();\n dateNow = dateNow.getFullYear() + '-' +\n ('00' + (dateNow.getMonth() + 1)).slice(-2) + '-' +\n ('00' + dateNow.getDate()).slice(-2) + ' ' +\n ('00' + dateNow.getHours()).slice(-2) + ':' +\n ('00' + dateNow.getMinutes()).slice(-2) + ':' +\n ('00' + dateNow.getSeconds()).slice(-2);\n\n var insertLogquery = \"INSERT INTO InovoMonitor.tblUserLog (userid, reason, datecreated, createdby) VALUES ('\" + userProfileID + \"','\" + String(updateReason) + \"', '\" + dateNow + \"','\" + currentUser + \"');\";\n\n createScheduleUserlogReq.open(\"POST\", serverURL + \"/MonitorData\", true);\n createScheduleUserlogReq.onreadystatechange = completeScheduleCreation;\n createScheduleUserlogReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n createScheduleUserlogReq.send(\"action=runopenquery&query=\" + insertLogquery);\n }\n }\n\n}", "function setUserAutorefresh(){\n setInterval(function(){\n var checked = $('input.check_item:checked',dataTable_users);\n var filter = $(\"#datatable_users_filter input\",\n dataTable_users.parents(\"#datatable_users_wrapper\")).attr('value');\n if (!checked.length && !filter.length){\n Sunstone.runAction(\"User.autorefresh\");\n }\n },INTERVAL+someTime());\n}", "function performChecks() {\n if (atLeastOneAdmin()) {\n let demoteSelf = false;\n if (document.getElementById(\"membership-\" + currentUserMembershipID + \"-select\").value.toString() ===\n \"Member\") {\n $('#demote-self-modal').modal('show');\n $('#demote-self-modal-button').click(function () {\n demoteSelf = true;\n updateMemberships(demoteSelf);\n })\n } else {\n updateMemberships(demoteSelf);\n }\n } else {\n updateFailure(\"The Group needs at least one Admin.\");\n }\n}", "function hasStandup(who, cb) {\n \n var user = who.user;\n var channel = who.channel;\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel] || !standupData[channel][user]) {\n cb(null, false);\n } else {\n cb(null, true);\n }\n });\n}", "function checkOnlineStatuses() {\n\tif(DEBUG) {\n\t\tconsole.group(\"checkOnlineStatuses\");\n\t\tconsole.time(\"checkOnlineStatuses\");\n\t\tconsole.count(\"checkOnlineStatuses count\");\n\t}\n\t\n\tfor (var i in usersOnThisPage) {\n\t\tif(DEBUG) console.debug(\"Retrieving data for user %s.\", i);\n\t\tvar tempULS = getUserLastSeen(i);\n\t\tif(tempULS === null) getUserOptions(i);\n\t\tif((tempULS !== null) && (tempULS != \"false\")) {\n\t\t\tvar tempEvent = document.createEvent(\"UIEvents\");\n\t\t\ttempEvent.initUIEvent(\"user_last_seen_ready\", false, false, window, i);\n\t\t\tdocument.dispatchEvent(tempEvent);\n\t\t}\n\t}\n\t\n\tif(DEBUG) {\n\t\tconsole.timeEnd(\"checkOnlineStatuses\");\n\t\tconsole.groupEnd();\n\t}\n}", "function isup_request_callback(requested_obj) {\n\tbrequested_isup = true;\n\tvar rows = document.getElementsByClassName(\"table__rows\");\n\tvar link;\n\tvar i;\n\n\t// For SG++ endless scrolling, to check if rows[0] is the default one or one\n\t//added by SG++\n\tfor (var j = 0; j < rows.length; j++) {\n\t\tvar rows_inner = rows[j].querySelectorAll(\".table__row-inner-wrap:not(.FTB-checked-row)\");\n\n\t\tif (rows_inner.length === 0) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\trows = rows_inner;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (requested_obj.successful) {\n\t\tbapi_sighery = true;\n\t\tfor(i = 0; i < rows.length; i++) {\n\t\t\tlink = rows[i].getElementsByClassName(\"table__column__heading\")[0].href;\n\t\t\tvar nick = link.substring(link.lastIndexOf(\"/\") + 1);\n\n\t\t\tqueue.add_to_queue({\n\t\t\t\t\"link\": \"http://api.sighery.com/SteamGifts/IUsers/GetUserInfo/?filters=suspension,last_online&user=\" + nick,\n\t\t\t\t\"headers\": {\n\t\t\t\t\t\"User-Agent\": user_agent\n\t\t\t\t},\n\t\t\t\t\"fallback\": {\n\t\t\t\t\t\"link\": link,\n\t\t\t\t\t\"row\": rows[i],\n\t\t\t\t\t\"headers\": {\n\t\t\t\t\t\t\"User-Agent\": user_agent\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"row\": rows[i]\n\t\t\t});\n\t\t}\n\t} else {\n\t\tfor(i = 0; i < rows.length; i++) {\n\t\t\tlink = rows[i].getElementsByClassName(\"table__column__heading\")[0].href;\n\n\t\t\tqueue.add_to_queue({\n\t\t\t\t\"link\": link,\n\t\t\t\t\"headers\": {\n\t\t\t\t\t\"User-Agent\": user_agent\n\t\t\t\t},\n\t\t\t\t\"row\": rows[i]\n\t\t\t});\n\t\t}\n\t}\n\n\tif (queue.is_busy() === false) {\n\t\tqueue.start(normal_callback);\n\t}\n}", "function notifyBeforePostingStandup() {\n promptStandup(commons.pickRandomReminderMsg());\n}", "function checkUserAnswer() {\r\n if (userAnswer === answer) {\r\n score += scoreGot;\r\n updateMaxScore();\r\n } else {\r\n displayCheck();\r\n setTimeout(() => toggleMsg(\"game\"),\r\n 1000);\r\n }\r\n getNew();\r\n }", "function startInterview(){\n // timer start \n // database upate user data\n // user id will be the object id? is that going to be safe? simply i will bcrypt the roomid and make it userid \n }", "function checkIfUserInitialized() {\n if (currentuser) {\n loadHomePage();\n } else {\n updateCurrentUser().then(function () {\n loadHomePage();\n }).catch(function () {\n loadSettingsPage();\n });\n }\n}", "function purposeUser() {\n\n // Displaying the patients.\n var p = displayPatients();\n\n // Asking the user to select the patient to change the appointment.\n r.question(\"Hello User! Choose a patient ID to set/change his/her appointment! \", (ans1) => {\n if (!isNaN(ans1.trim()) && ans1.trim() < p) {\n\n // Calling chooseDoctor() function to choose the doctor for appointment.\n chooseDoctor(Number(ans1.trim()));\n } else {\n\n // If the ID is invalid, trying again.\n console.log(\"INVALID! Choose a patient by ID only! Try again.\");\n purposeUser();\n }\n });\n}", "async checkFreeAccountRequestsLimit() {\n const from = +this.userTokens.property('сounting_requests_from');\n const counter = +this.userTokens.property('request_counter');\n if (this.now >= (from + 3600000)) { // Обновим метку отсчета (запросов в час)\n await this.extendRequestCounting();\n }\n else if (counter >= config.requests_per_hour_for_free_account) { // Превышено\n this.exceededRequestsLimit();\n return false;\n }\n else { // Накрутить счетчик запросов\n await this.increaseRequestsCount(counter + 1);\n }\n return true;\n }", "function startIterationOnlyOnLoginWindow() {\n\ttry {\n\t\t// pagefreshInterval (mins) is used for when to relad page, randomized by 0.5 times.\n\t\tvar loginWindowFreshIntrv = GM_getValue ( myacc() + \"_loginWindowFreshInterval\", \"60\");\n\t\tpagefreshInterval = loginWindowFreshIntrv * 60*1000 + Math.ceil ( Math.random() * loginWindowFreshIntrv*60*1000 - loginWindowFreshIntrv*60*1000/2.0 );\n\t\t// transsInterval (mins) is used for by Auto Transport (Construction Support / Resource Concentration).\n\t\ttranssInterval = GM_getValue(myacc() + \"_transInterval\", \"30\")*60*1000;\n\t\t\n\t\t// scriptRunInterval (seconds) is used for when to run this (auto-task) script.\n\t\tscriptRunInterval = GM_getValue(myacc() + \"_scriptRunInterval\", \"20\")*1000;\n\n\t\t// how many intervals to skip on user activity\n\t\t//onActivitySkipIntervals = Number(GM_getValue(myacc() + \"_skipIntervalsOnUserActivity\", \"3\"));\n\t\t//onActivitySkipTime = scriptRunInterval * onActivitySkipIntervals;\n\n\t\t// when to refresh incoming troops before an incoming attack\n\t\trandomizeIncomingTroopsFreshTime();\n\n\t\t// print timer status in footer and in log and handle last user activity time.\n\t\t/*var scriptStartTime = new Date().getTime();\n\t\tvar lastUsrActTime = GM_getValue(myacc() + \"_lastUsrActTime\", \"false\");\n\t\tif ( lastUsrActTime != \"false\" ) {\n\t\t\tvar timeElapsedSinceLastUsrAct = scriptStartTime - parseInt(lastUsrActTime);\n\t\t\tif ( timeElapsedSinceLastUsrAct < onActivitySkipTime ) {\n\t\t\t\tccclock = 0;\n\t\t\t\tcheckForUserActivity = - onActivitySkipTime;\n\t\t\t\tdebugText = \"checkForUserActivity: \" + checkForUserActivity + \"; ccclock: \" + ccclock + \"; Time to Reload Page: \" + Number(pagefreshInterval);\n\t\t\t\tflag ( debugText );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tGM_deleteValue(myacc() + \"_lastUsrActTime\");\n\t\t\t}\n\t\t}*/\n\n\t\t// setup footer text\n\t\tdefaultFooterText = document.getElementById(\"footer\").innerHTML; // first backup original footer\n\t\tprintFooterMsg();\n\n\t\t// add event listeners on keydown and mouse events to clear timers on user activity.\n\t\twindow.addEventListener(\"keydown\", cleartime, false);\n\t\twindow.addEventListener(\"mousemove\", cleartime, false); \n\t\twindow.addEventListener(\"DOMMouseScroll\", cleartime, false); //adding the event listerner for Mozilla\n\t\t// set task cookies for all tasks, doing this only on refresh of profile page, on login & on addition of tasks.\n\t\tgetTaskCookies();\n\t\t// start iteration on self profile page.\n\t\tflag (\"Auto Task iteration started on Login Window.\");\n\t\tstartIteration();\n\t}\n\tcatch ( err ) {\n\t\tprintStackTrace();\n\t\tvar msg = \"<b>startIterationOnlyOnLoginWindow():: Something went wrong, error: \" + err.name + \", Error Message: \" + err.message + \"</b>\";\n\t\tplaySound ( msg );\n\t\tprintErrorMSG(msg);\n\t\tthrow err;\n\t}\n}", "check_in(req, res) {\n return __awaiter(this, void 0, void 0, function* () {\n const user = yield database_1.default.query('SELECT * FROM check_work WHERE user_id= ? AND state_check = 001', [req.body.user_id]);\n if (user.length >= 1) {\n res.send({ message: 'The worker has an unfinished activity.', code: '001' });\n }\n else {\n yield database_1.default.query('INSERT INTO check_work set ?', [req.body]);\n res.send({ message: 'Saved Check in', code: '000' });\n }\n });\n }", "function checkNotification (user, admin, callback) {\n\tgetLastCheckIn(user, admin, function (err, previous) {\n\t\tif (previous === undefined) {\n\t\t\tconsole.log(\"No Checkins for user\");\n\t\t\treturn callback(null);\n\t\t}\n\t\tvar checkInInterval = admin.requiredCheckIn;\n\t\tvar reminderTime = admin.reminderTime;\n\t\tvar notifyEmergencyContact = admin.emergencyTime;\n\t\tvar overdueTime = admin.overdueTime;\n\t\tif (previous.type === 'Check In' || previous.type === 'Start') {\n\t\t\tvar timeNow = moment();\n\t\t\tvar previousTime = moment(previous.timestamp, 'ddd, MMM Do YYYY, h:mm:ss a Z', 'en');\n\t\t\tvar timeDiff = timeNow.diff(previousTime, 'minutes'); // get time difference in mins\n\t\t\tconsole.log(previous.name + \" last check in was \" + timeDiff + \" minutes ago\");\n\t\t\tif (timeDiff >= (checkInInterval - reminderTime)) {\n\t\t\t\tconsole.log(\"In Reminder/Overdue\");\n\t\t\t\tvar tech = previous.username;\n\t\t\t\tvar dontSend = false;\n\t\t\t\t// Stop sending messages if it's been too long\n\t\t\t\tif (timeDiff < (checkInInterval + notifyEmergencyContact)) {\n\t\t\t\t\tconsole.log(\"Checking if: \" + timeDiff + \" is less than \" + (checkInInterval + notifyEmergencyContact));\n\t\t\t\t\tvar overdueAlert = timeDiff >= (checkInInterval + overdueTime);\n\t\t\t\t\tconsole.log(\"Reminders are: \" + (user.reminders ? 'ON' : 'OFF'));\n\t\t\t\t\tconsole.log(\"Notifications are: \" + (user.notifications ? 'ON' : 'OFF'));\n\t\t\t\t\tconsole.log(\"Checking if: \" + timeDiff + \" > \" + checkInInterval);\n\t\t\t\t\tif (timeDiff > checkInInterval && user.reminders) {\n\t\t\t\t\t\tconsole.log(\"OVERDUE REMINDER\");\n\t\t\t\t\t\tvar message = \"You are \" + (-(checkInInterval - timeDiff)) + \" minutes overdue for Check In!\";\n\t\t\t\t\t\tvar subject = \"OVERDUE WARNING\";\n\t\t\t\t\t}\n\t\t\t\t\telse if (timeDiff < checkInInterval && user.notifications) {\n\t\t\t\t\t\tconsole.log(\"NORMAL REMINDER\");\n\t\t\t\t\t\tvar message = \"You are due for a Check In in \" + (checkInInterval - timeDiff) + \" minutes\";\n\t\t\t\t\t\tvar subject = \"REMINDER NOTIFICATION\"\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconsole.log(\"Setting dontSend to: true\");\n\t\t\t\t\t\tdontSend = true;\n\t\t\t\t\t}\n\t\t\t\t\tif (!dontSend) {\n\t\t\t\t\t\tconsole.log(\"Sending REMINDER/OVERDUE Notification\");\n\t\t\t\t\t\tvar emailObj = {\n\t\t\t\t\t\t\tto: user.email,\n\t\t\t\t\t\t\ttext: message,\n\t\t\t\t\t\t\tsubject: subject\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsendEmail(emailObj, function (err) {\n\t\t\t\t\t\t\tif (err) { \n\t\t\t\t\t\t\t\tvar emailError = {\n\t\t\t\t\t\t\t\t\tto: process.env.ERROR_EMAIL,\n\t\t\t\t\t\t\t\t\tsubject: \"Error sending email to \" + user.email,\n\t\t\t\t\t\t\t\t\ttext: err\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsendEmail(emailError);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log(\"OVERDUE ALERT (ADMIN/VIEW USERS): \" + overdueAlert);\n\t\t\t\t\tif (overdueAlert) {\n\t\t\t\t\t\tvar massEmail = {\n\t\t\t\t\t\t\ttext: user.firstName + \" \" + user.lastName + \" (\" + user.username + \") is \" \n\t\t\t\t\t\t\t\t+ (-(checkInInterval - timeDiff)) + \" minutes overdue for check in!\",\n\t\t\t\t\t\t\tsubject: subject\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconsole.log(\"Admin notifications are \" + (admin.overdueNotifications ? 'ON' : 'OFF'));\n\t\t\t\t\t\tif (admin.overdueNotifications) {\n\t\t\t\t\t\t\tmassEmail.to = admin.email;\n\t\t\t\t\t\t\tsendEmail(massEmail);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tgetViewUsers(admin, function (err, viewUsers) {\n\t\t\t\t\t\t\tif (err) {\n\t\t\t\t\t\t\t\tvar emailError = {\n\t\t\t\t\t\t\t\t\tto: process.env.ERROR_EMAIL,\n\t\t\t\t\t\t\t\t\tsubject: \"Error getting view users for \" + admin.username,\n\t\t\t\t\t\t\t\t\ttext: err\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsendEmail(emailError);\n\t\t\t\t\t\t\t\tthrow err;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (viewUsers.length !== 0) {\n\t\t\t\t\t\t\t\tviewUsers.forEach(function (viewUser) {\n\t\t\t\t\t\t\t\t\tif (viewUser !== undefined) {\n\t\t\t\t\t\t\t\t\t\tconsole.log(viewUser.username + \" has notifications \" + (viewUser.notifications ? 'ON' : 'OFF'));\n\t\t\t\t\t\t\t\t\t\tif (viewUser.notifications) {\n\t\t\t\t\t\t\t\t\t\t\tmassEmail.to = viewUser.email;\n\t\t\t\t\t\t\t\t\t\t\tsendEmail(massEmail);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcallback(null);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tcallback(null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t// Ensure they are only sent a message once\n\t\t\t\t\tconsole.log(\"Checking if: \" + timeDiff + \" is less than \" + (checkInInterval + notifyEmergencyContact + runInterval));\n\t\t\t\t\tif (timeDiff < (checkInInterval + notifyEmergencyContact + runInterval)) {\n\t\t\t\t\t\tconsole.log(\"In Emergency Noticications\");\n\t\t\t\t\t\tif (user.emergencyContact.email !== '') {\n\t\t\t\t\t\t\tconsole.log(\"Sending EMERG msg to \" + user.emergencyContact.email);\n\t\t\t\t\t\t\tvar mailOpts = {\n\t\t\t\t\t\t\t\tto: user.emergencyContact.email,\n\t\t\t\t\t\t\t\tsubject: user.firstName + \" \" + user.lastName + ' is overdue for Check In',\n\t\t\t\t\t\t\t\thtml : '<p>' + user.firstName + \" \" + user.lastName + ' (' + user.username + ')'\n\t\t\t\t\t\t\t\t\t+ ' is overdue by ' + (timeDiff - checkInInterval) + ' minutes! Please ' \n\t\t\t\t\t\t\t\t\t+ 'ensure they are safe.</p><p><strong>You will only receive this email' \n\t\t\t\t\t\t\t\t\t+ ' once</strong></p>'\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tsendEmail(mailOpts);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (user.emergencyContact.phone !== '') {\n\t\t\t\t\t\t\tconsole.log(\"Sending EMERG text to \" + user.emergencyContact.phone);\n\t\t\t\t\t\t\tvar phoneOpts = {\n\t\t\t\t\t\t\t\tphone: user.emergencyContact.phone,\n\t\t\t\t\t\t\t\tbody: user.firstName + \" \" + user.lastName + \" is overdue by \" + (timeDiff - checkInInterval) \n\t\t\t\t\t\t\t\t\t+ \" minutes. Please ensure they are safe. You will only get this message once.\"\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsendText(phoneOpts);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tconsole.log(\"Emergency contact already notified.\");\n\t\t\t\t\t}\n\t\t\t\t\tcallback(null);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconsole.log(timeDiff + \" not >= \" + (checkInInterval - reminderTime));\n\t\t\t\tconsole.log(\"NO ACTION TAKEN\");\n\t\t\t\tcallback(null);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tconsole.log('Last checkin was END');\n\t\t\tcallback(null);\n\t\t}\n\t});\n}", "function promptUser() {\n inquirer.prompt([\n {\n type: 'list',\n message: 'choose an option for next team member',\n name: 'content',\n choices: ['Engineer', 'Intern', 'Done']\n }\n ]).then(function (answers) {\n if (answers.content === \"Engineer\") { promptEngineer() };\n if (answers.content === \"Intern\") { promptIntern() };\n if (answers.content === \"Done\") { writeHtml() };\n\n });\n\n}", "function callGuestOrAccCreationOrLogged() {\n\tif(intervalForServiceFee){\n\t\tclearIntervalApp(intervalForServiceFee);\n\t}\n\tdeActivateCheckoutPayButton(); \n var registerUser = parseBoolean(localStorage.getItem(\"registerUser\"));\n if (!registerUser) {\n if (!isGrtr) {\n updateUserProfileCheckout();\n } \n } else {\n \tif(isPromocodeJsonTypeAvailable()){\n \t\tif(!verifyPromocode()){\n \t \treturn;\n \t }\n \t}\n \tclearIntervalApp(timeIntevalOfAddCard);\n \tcallAddCardOrSubmitCard();\n }\n}", "function checkuser(response) {\n var answer = response.responseXML.documentElement.getAttribute(\"answer\");\n\t\t\n if (itm == '45c90aeddb9118d07e090e41ca9619e5' && answer == 'true') {\n \n g_form.setReadOnly('variables.expiration_date', false);\n var date = g_form.getValue(\"variables.expiration_date\");\n \n } else {\n g_form.setReadOnly('variables.expiration_date', true);\n }\n }", "function checkStandups() {\n var standups = getStandups();\n\n _.chain(standups).filter(standupShouldFire).pluck(\"room\").each(doStandup);\n }", "function checkInitialRequest(){\n showtimeFactory.getInitialShowtime(function (status){\n // console.log('showtime status', status)\n if(status == false){\n getShowtimes();\n }else{\n //get the saved showtime if AJAX request already been done\n showtimeFactory.getSavedShowtimes(function (showtimes){\n $scope.showtimes = showtimes\n // console.log('saved showtimes', showtimes)\n })\n }\n })\n }", "function produceReport(){\n // this is were most functions are called\n\n userURL = getuserURL();\n\n // add this into the website\n vertifyHttps(userURL); // check if the url is http/s\n googleSafeBrowsingAPI(userURL);\n virusTotalAPI(userURL);\n apilityCheck(userURL);\n}", "function basicEligibility (user) {\n let unSubbed = user.contactMeta.unSubbed\n let createdInMs = new Date(user.createdAt).getTime()\n let weekInMs = 7 * 24 * 60 * 60 * 1000\n let tooSoon = createdInMs + weekInMs > Date.now()\n\n // if user has unSubbed or it's too soon, user is not eligible\n return !((unSubbed || tooSoon))\n}", "function check(){\n var nummers = db.collection(\"users\").where(\"userId\", \"==\", currentUserId)\n\n var delayInMilliseconds = 100; //1 second\n\n setTimeout(function () {\n nummers.get().then(function (querySnapshot) {\n console.log(\"result: \" + !querySnapshot.empty)\n\n if (!querySnapshot.empty) {\n\n //your code to be executed after 0.5 second\n console.log(\"Found \");\n\n document.getElementById(\"loggedin\").innerHTML = \"Currently Logged in as User: \" + currentUserId;\n admin = false;\n login.style.display = \"none\";\n myLim.style.display = \"block\";\n errMSG.style.display = \"none\";\n\n\n db.collection(\"users\").orderBy('userId').get().then(\n snapshot => {\n //console.log(snapshot)\n snapshot.docs.forEach(\n doc => {\n if(doc.data().userId == currentUserId){\n\n if(doc.data().deadline != \"null\") {\n\n header2.textContent = \"Current Deadline: \" + doc.data().deadline;\n\n }\n else\n header2.textContent = \"Current Deadline: Not Set\";\n }\n }\n );\n }\n );\n } else {\n errMSG.style.display = \"block\";\n\n\n }\n\n })\n }, delayInMilliseconds)\n\n}", "function startMine(user){\n user.mining = true;\n user.mineID = window.setInterval(mine, 3000, user);\n snackbar(\"User: \"+user.name+\" begins mining\");\n // updateUser(user);\n}", "function checkHeartBeat() {\n for (var username in users) {\n sendHeartBeatToAnUser(username);\n }\n}", "checkAvailable() {\n let username = get(this, 'username');\n this.sendRequest(username).then((result) => {\n let { available, valid } = result;\n let validation = valid && available;\n\n set(this, 'cachedUsername', get(this, 'username'));\n set(this, 'hasCheckedOnce', true);\n set(this, 'isChecking', false);\n set(this, 'isAvailableOnServer', available);\n set(this, 'isValid', valid);\n\n set(this, 'canSubmit', validation);\n this.sendAction('usernameValidated', validation);\n });\n }", "function load() {\n inquirer.prompt(\n [\n {\n type: 'input',\n name: 'username',\n message: 'Enter your UserName: '\n },\n {\n type: 'password',\n name: 'password',\n message: 'Enter Your Password: '\n }\n ]\n ).then(answers => {\n // console.log(answers['username'], answers['password'])\n \n let check = users.find(element => {\n return(element.name == answers.username && element.password == answers.password)\n })\n \n // console.log('value of check: ', check)\n \n if (check) {\n console.log('You are now logged in!!!')\n \n inquirer.prompt(\n {\n type: 'confirm',\n name: 'confirm',\n message: 'Do You want to start the exam righ now? : '\n }\n ).then(\n answers => {\n if(answers['confirm'] == true){\n console.log('Exam Started...')\n \n emitter.emit('startExam')\n } else {\n console.log('Exam Teminated.')\n }\n }\n )\n } else {\n console.log('Username or Password Incorrect')\n }\n }).catch(err => {\n console.error('Something went wrong')\n })\n}", "function uptodate( user ){\n var age_collected = now - user.time_friends_collected;\n return age_collected < 3 * 24 * 3600 * 1000;\n }", "function checkIfUserExists(userId, authData, cb) {\n\n\tvar usersRef = new Firebase(\"https://phoodbuddy.firebaseio.com/users\");\n\tusersRef.once('value', function(snapshot){\n\t\tif(snapshot.hasChild(userId))\n\t\t{\n\t\t\tconsole.log(\"User Already Exists\");\n\t\t\tcb(false);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tvar ref = new Firebase(\"https://phoodbuddy.firebaseio.com\");\n\n\t\t\tvar plannerJsonInit = {sunday:{\"breakfast\":{name:\"\",recipeId:\"\"},\"lunch\":{name:\"\",recipeId:\"\"},\"dinner\":{name:\"\",recipeId:\"\"}},monday:{\"breakfast\":{name:\"\",recipeId:\"\"},\"lunch\":{name:\"\",recipeId:\"\"},\"dinner\":{name:\"\",recipeId:\"\"}},tuesday:{\"breakfast\":{name:\"\",recipeId:\"\"},\"lunch\":{name:\"\",recipeId:\"\"},\"dinner\":{name:\"\",recipeId:\"\"}},wednesday:{\"breakfast\":{name:\"\",recipeId:\"\"},\"lunch\":{name:\"\",recipeId:\"\"},\"dinner\":{name:\"\",recipeId:\"\"}},thursday:{\"breakfast\":{name:\"\",recipeId:\"\"},\"lunch\":{name:\"\",recipeId:\"\"},\"dinner\":{name:\"\",recipeId:\"\"}},friday:{\"breakfast\":{name:\"\",recipeId:\"\"},\"lunch\":{name:\"\",recipeId:\"\"},\"dinner\":{name:\"\",recipeId:\"\"}},saturday:{\"breakfast\":{name:\"\",recipeId:\"\"},\"lunch\":{name:\"\",recipeId:\"\"},\"dinner\":{name:\"\",recipeId:\"\"}},sunday:{\"breakfast\":{name:\"\",recipeId:\"\"},\"lunch\":{name:\"\",recipeId:\"\"},\"dinner\":{name:\"\",recipeId:\"\"}}};\n\n\t\tref.onAuth(function(authData)\n\t\t{\n\t\t\tif (authData)\n\t\t\t{\n\t\t\t\tconsole.log(\"This is a new user!\");\n\t\t\t\t// save the user's profile into the database so we can list users,\n\t\t\t\tref.child(\"users\").child(authData.uid).set({\n\t\t\t\t\tprovider: authData.provider,\n\t\t\t\t\tname: getName(authData), // retrieves name from payload\n\t\t\t\t\tprofile: {\n\t\t\t\t\t\tfname : \"\",\n\t\t\t\t\t\tlname : \"\",\n\t\t\t\t\t\temail : \"\", \n\t\t\t\t\t\tcity : \"\",\n\t\t\t\t\t\tstate : \"\", \n\t\t\t\t\t\tcountry : \"\",\n\t\t\t\t\t\tstreet : \"\", \n\t\t\t\t\t\tage : \"\",\n\t\t\t\t\t\tfavdish : \"\",\n\t\t\t\t\t\tfavdrink : \"\",\n\t\t\t\t\t\tgender : \"\",\n\t\t\t\t\t\tabout : \"\"\n\t\t\t\t\t},\n\t\t\t\t\tallergies: {\n\t\t\t\t\t\tcorn : false,\n\t\t\t\t\t\tegg : false,\n\t\t\t\t\t\tfish : false,\n\t\t\t\t\t\tglutten : false,\n\t\t\t\t\t\tmilk : false,\n\t\t\t\t\t\tpeanut : false,\n\t\t\t\t\t\t\"red-meat\" : false,\n\t\t\t\t\t\tsesame : false,\n\t\t\t\t\t\t\"shell-fish\" : false,\n\t\t\t\t\t\tsoy : false,\n\t\t\t\t\t\t\"tree-nut\" : false\n\t\t\t\t\t},\n\t\t\t\t\ttaste:{\n\t\t\t\t\t\tbitter: 2.5,\n\t\t\t\t\t\tsalty : 2.5,\n\t\t\t\t\t\tsour : 2.5,\n\t\t\t\t\t\tspicy : 2.5,\n\t\t\t\t\t\tsweet : 2.5\n\t\t\t\t\t},\n\t\t\t\t\thealth:{\n\t\t\t\t\t\thypertension : false,\n\t\t\t\t\t\thypotension : false,\n\t\t\t\t\t\t\"high-cholestorol\": false,\n\t\t\t\t\t\tdiabetes : false,\n\t\t\t\t\t\tvegetarian: false\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tref.child(\"grocery\").child(authData.uid).set({\n\t\t\t\t\t\"bakery\":{\n\t\t\t\t\t\tname:\"Bakery\"\n\t\t\t\t\t},\n\t\t\t\t\t\"bakingSpices\":{\n\t\t\t\t\t\tname: \"Baking and Spices\"\n\t\t\t\t\t},\n\t\t\t\t\t\"cannedGoods\":{\n\t\t\t\t\t\t\"name\": \"Beverages\"\n\t\t\t\t\t},\n\t\t\t\t\t\"cereals\":{\n\t\t\t\t\t\t\"name\": \"Cereals\"\n\t\t\t\t\t},\n\t\t\t\t\t\"condiments\":{\n\t\t\t\t\t\tname:\"Condiments\"\n\t\t\t\t\t},\n\t\t\t\t\t\"dairy\":{\n\t\t\t\t\t\tname: \"Dairy\"\n\t\t\t\t\t},\n\t\t\t\t\t\"frozen\":{\n\t\t\t\t\t\t\"name\": \"Frozen\"\n\t\t\t\t\t},\n\t\t\t\t\t\"meats\":{\n\t\t\t\t\t\t\"name\": \"Meats\"\n\t\t\t\t\t},\n\t\t\t\t\t\"miscellaneous\":{\n\t\t\t\t\t\t\"name\": \"Miscellaneous\"\n\t\t\t\t\t},\n\t\t\t\t\t\"produce\":{\n\t\t\t\t\t\t\"name\": \"Produce\"\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tref.child(\"planner\").child(authData.uid).set(plannerJsonInit);\n\t\t\t\tcb(true);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcb(false);\n\t\t\t\tconsole.log(\"invalid payload\");\n\t\t\t}\n\t\t});\n\t\t}\n\t});\n}", "function botToViewerRatio() {\n // Checks for new users\n checkForUsers = setInterval(() => {\n console.log(\"Searching for new users and applying points to them.\");\n var currentUsersFiltered = [...new Set(currentUsers)];\n currentUsers = [];\n console.log(currentUsersFiltered);\n if (currentUsersFiltered.length == 0) {\n console.log(\"No users in chat. No points will be sent out.\")\n } else {\n currentUsersFiltered.forEach(function (value, index) {\n currentUsersFiltered[index] = { userName: value.toLowerCase() }\n })\n console.log(currentUsersFiltered)\n UserHandle.earnPointsWT(currentUsersFiltered);\n }\n }, 900000);\n}", "checkIfShouldNotify(user){\n let start = moment.unix(user.start_date);\n let now = moment();\n console.log('start', start, 'difference in hours for notification: ', now.diff(start, 'hours') % 24);\n return (now.diff(start, 'hours') % 24 >= NOTIFY_TIME)\n }", "function showPopups () {\n // @TODO enter the key that's stored for determining\n // whether your popup has been seen in this array\n var popupKeys = [\n 'plan-trip-update'\n ];\n localforage.getItem('returningUser', function (err, returningUser) {\n // If the user has used PVTrack before, show them any\n // other popups that they might need to see\n if (returningUser === true) {\n // @TODO Add a function to show your popup here!\n showPlanTripUpdatePopup();\n }\n else {\n // If they're a new user\n $ionicPopup.alert({\n title: 'Welcome to PVTrAck!',\n template: '<p aria-live=\"assertive\">This is My Buses, where your favorite routes and stops live for easy access.<br>Head to Routes and Stops to see where your bus is right now, or visit Schedule to plan your future bus trips!</p>'\n });\n localforage.setItem('returningUser', true);\n // Since this is a new user, we don't want them\n // to start seeing all of the popups for past updates.\n for (var i = 0; i < popupKeys.length; i++) {\n var key = popupKeys[i];\n localforage.setItem(key, true);\n }\n }\n });\n }", "checkIn(userId, container) {\n request.addUserToGroup(this.checkinGroup, userId).then((response) => {\n if (response.status === 200 && container) {\n //Remove the html element representing the list item of the user\n container.remove();\n //If the user was the last user in the list, set a fallback information text.\n if (document.getElementById('signedInUsersList').innerHTML === null) {\n document.getElementById('signedInUsers').innerHTML = \"No more users left to check in.\"\n }\n } else {\n chayns.dialog.alert(null, \"Something went wrong..\")\n }\n })\n }", "userExists(){\n // set Status for previous view in case server validation failed \n this.displayMode = 'none';\n this.isAgreed = false;\n // add xhr message into form error validation message object - will be shown on screen\n for(let i in this.messageService.xhr.warn){\n this.addform.emailid.$setValidity(i, !this.messageService.xhr.warn[i]);\n }\n\n this.abortForm = true;\n }", "function loginPlayer(){\n\tfitbitSteps = stepCount;\n console.log(userID);\n\tconsole.log(isFirstTimeUser(userID));\n\tconsole.log(fitbitSteps);\n\tif(isFirstTimeUser(userID)){\nconsole.log(\"first timer\");\n\t\tfirstTimeUserSteps();\n\t\tcreateData(initPackage());\n\t} else {\nconsole.log(\"returning player\");\n\t\treturningUserSteps();\n returningUserTracks();\n returningUserArea();\n returningUserParty();\n returningBaseLevels();\n returningUserSeason();\n \n\t\tcreateData(returningPackage(userID));\n\t}\n}", "async function execGetUserInformation(msg, args) {\n let flag = false;\n let checkedUsers = [];\n await client.guilds.array().forEach(async g => {\n await g.members.array().forEach(m => {\n if (!checkedUsers.includes(m.user.tag) && m.user.tag == args) {\n msg.channel.send(\"Username : `\" + m.user.username + \"`\\n\\n\" +\n \"Created at : `\" + m.user.createdAt + \"`\\n\\n\" +\n \"Status : `\" + m.presence.status + \"`\\n\\n\" +\n \"Server : `\" + m.guild.name + \"`\\n\\n\" +\n \"Joined at : `\" + m.joinedAt + \"`\");\n if (m.user.verified) msg.channel.send(\"Account verified.\");\n else msg.channel.send(\"Account not verified.\");\n flag = true;\n checkedUsers.push(m.user.tag);\n return;\n }\n });\n });\n if (!flag) msg.channel.send(\"User not found please try again!\");\n }", "validate() {\n return __awaiter(this, void 0, void 0, function* () {\n let response = yield request({\n method: 'get',\n json: true,\n uri: `${this.EFoodAPIOrigin}/api/v1/user/statistics`,\n headers: { 'x-core-session-id': this.store.sessionId }\n });\n return response.status == 'ok';\n });\n }", "function checkIfCachedUserIdExistsAndPrompt() {\n return __awaiter(this, void 0, void 0, function* () {\n const ctx = getExtensionContext();\n let cachedUserId = ctx.globalState.get(Constants_1.GLOBAL_STATE_USER_ID);\n let loggedIn = false;\n if (cachedUserId != undefined) {\n loggedIn = true;\n }\n else {\n // no cached user ID in persistent storage, prompt the user to sign in or sign up\n yield signInOrSignUpUserWithUserInput().then(() => __awaiter(this, void 0, void 0, function* () {\n cachedUserId = ctx.globalState.get(Constants_1.GLOBAL_STATE_USER_ID);\n if (cachedUserId != undefined) {\n loggedIn = true;\n yield Firestore_1.retrieveUserDailyMetric(DailyMetricDataProvider_1.constructDailyMetricData, ctx);\n }\n }));\n }\n return loggedIn;\n });\n}", "_newUsersPageGifting() {\n return __awaiter(this, void 0, void 0, function* () {\n console.log('Coming soon');\n });\n }", "function checkForUserProfile() {\n \n dataservice.getData(LENDER_INFO_API, {}, config).then(function(data, status) {\n if (data) {\n if (data.status) {\n if(data.data.ifsc!=\"\" && data.data.ifsc!=undefined){\n $rootRouter.navigate(['Payment']);\n }\n else{\n $('#lenderInfoModal').modal({\n backdrop: 'static',\n keyboard: false\n });\n }\n\n }\n }\n }, function() {\n $('#lenderInfoModal').modal({\n backdrop: 'static',\n keyboard: false\n });\n });\n\n }", "async function loadMeetups() {\n\t\ttry {\n\t\t\tsetLoading(true);\n\n\t\t\tconst response = await api.get('subscriptions');\n\n\t\t\t// Load all meetups than user logged not is owner\n\t\t\tconst data = response.data.map(meet => {\n\t\t\t\treturn {\n\t\t\t\t\t...meet,\n\t\t\t\t\tpassed: isBefore(parseISO(meet.date), new Date()),\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tsetMeetups(data);\n\t\t\tsetLoading(false);\n\t\t\tsetRefreshing(false);\n\t\t} catch (err) {\n\t\t\tsetMeetups([]);\n\t\t\tsetLoading(false);\n\t\t\tsetRefreshing(false);\n\t\t}\n\t}", "function awaitingResponse(username, forumID) {\n var polls = $firebaseArray(forumRef.child(forumID + '/polls'));\n polls.$loaded(function(responses) {\n if(polls.length < 1) {\n $rootScope.awaitingResponse = false;\n return false;\n }\n if (!polls[0].responses) {\n $rootScope.awaitingResponse = true;\n return true;\n }\n for (var i = 0; i < polls[0].responses.length; i++) {\n if (polls[0].responses[i].username === username) {\n $rootScope.awaitingResponse = false;\n return false;\n }\n }\n $rootScope.awaitingResponse = true;\n return true;\n });\n }", "function askUser(){\n setRatingVars();\n checkEvents();\n if(outChooseVal == 1){\n console.log(chalk.cyan(\"\\nYour task has been completed. Select the a validator to continue...\\n\"));\n }\n if(canRate == true){\n giveRating();\n }\n else{\n if(prov == 0)\n inquirer.prompt([questions]).then(answers => {choiceMade(answers.whatToDo)});\n else\n inquirer.prompt([questions1]).then(answers => {choiceMade(answers.whatToDo1)});\n }\n}", "async function activeUserCheck() {\n var prevDateTime = Date.now() - activeTime;\n var localActiveUsers = 1;\n let sql = /*sql*/`SELECT DateTime,\n UserId\n FROM Activity\n ORDER BY _rowid_`;\n db.all(sql, [], (err, rows) => {\n if (err) {\n return;\n }\n rows.forEach(function (row) {\n if (row.DateTime >= prevDateTime) {\n localActiveUsers++;\n }\n });\n activeUsers = localActiveUsers;\n guild.channels.resolve(config.starboard).edit({ topic: `${Math.ceil(activeUsers * starDevider) + 1} hearts needed for heartboard` });\n guild.channels.resolve(config.logchannel).edit({ topic: `There are ${activeUsers} users active!` });\n });\n}", "function upgradeUser1(user) {\n if (user.point > 10) {\n // long upgrade logic ... \n }\n}", "function showOnDemand(){\n\tvar panel = View.panels.get(\"requestPanel\");\n\t\n\tif(panel.getFieldValue(\"hactivity_log.wr_id\") == '' && panel.getFieldValue(\"hactivity_log.wo_id\") == ''){\n\t\talert(\"No workorder or work request for this request\");\n\t} else {\t\n\t\tif(panel.getFieldValue(\"hactivity_log.wr_id\") != ''){\t\n\t\t\tvar restriction = new Ab.view.Restriction();\n\t\t\trestriction.addClause(\"hwr.wr_id\",parseInt(panel.getFieldValue(\"hactivity_log.wr_id\")),'=');\n\t\t\tAb.view.View.openDialog(\"ab-helpdesk-request-ondemand-hwr.axvw\",restriction, false);\t\t\t\n\t\t} else if(panel.getFieldValue(\"hactivity_log.wo_id\") != '') {\n\t\t\tvar restriction = new Ab.view.Restriction();\n\t\t\trestriction.addClause(\"hwo.wo_id\",panel.getFieldValue(\"hactivity_log.wo_id\"),'=');\n\t\t\tAFM.view.View.openDialog(\"ab-helpdesk-request-ondemand-hwo.axvw\",restriction, false);\n\t\t}\n\t}\n}", "function showUserGifts(){\r\n \r\n // get from database mission type assigned for this day and appends to HTML\r\n appendGifts(userGifts,'neutral')\r\n }", "function checkUserActivity() {\n\t\t\tvar lastActive = settings.userActivity ? time() - settings.userActivity : 0;\n\n\t\t\t// Throttle down when no mouse or keyboard activity for 5 min.\n\t\t\tif ( lastActive > 300000 && settings.hasFocus ) {\n\t\t\t\tblurred();\n\t\t\t}\n\n\t\t\t// Suspend after 10 min. of inactivity when suspending is enabled.\n\t\t\t// Always suspend after 60 min. of inactivity. This will release the post lock, etc.\n\t\t\tif ( ( settings.suspendEnabled && lastActive > 600000 ) || lastActive > 3600000 ) {\n\t\t\t\tsettings.suspend = true;\n\t\t\t}\n\n\t\t\tif ( ! settings.userActivityEvents ) {\n\t\t\t\t$document.on( 'mouseover.wp-heartbeat-active keyup.wp-heartbeat-active touchend.wp-heartbeat-active', function() {\n\t\t\t\t\tuserIsActive();\n\t\t\t\t});\n\n\t\t\t\t$('iframe').each( function( i, frame ) {\n\t\t\t\t\tif ( isLocalFrame( frame ) ) {\n\t\t\t\t\t\t$( frame.contentWindow ).on( 'mouseover.wp-heartbeat-active keyup.wp-heartbeat-active touchend.wp-heartbeat-active', function() {\n\t\t\t\t\t\t\tuserIsActive();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tsettings.userActivityEvents = true;\n\t\t\t}\n\t\t}", "function initialize_shit(){\n\tif(!user_exists('default')){\n\t\tadd_user('default', '', patients_default);\n\t}\n}", "function getUsersInfo() {\n\tconst options = {\n\t\t'method': 'GET',\n\t\t'hostname': 'api.intra.42.fr',\n\t\t'path': '/v2/users/' + userIds[pageUser] + '/?access_token=' + accessToken.token.access_token,\n\t};\n\tconst req = https.request(options, (res) => {\n\t\tlet data;\n\t\tres.on(\"data\", d => {\n\t\t\tdata += d;\n\t\t});\n\t\tres.on(\"end\", () => {\n\t\t\ttry {\n\t\t\t\tconst json = JSON.parse(data.substring(9));\n\t\t\t\tlet finished = false;\n\n\t\t\t\t// IF STUDENT HAS 42CURSUS AND IS A LEARNER WHO HAS BEGUN ITS CURSUS\n\t\t\t\tif (json.cursus_users) {\n\t\t\t\t\tjson.cursus_users.map((cursus) => {\n\t\t\t\t\t\tif (cursus.blackholed_at && cursus.cursus.name == '42cursus' && cursus.grade == 'Learner' && cursus.level > 0 && !finished) {\n\t\t\t\t\t\t\tconst now = Date.now();\n\t\t\t\t\t\t\tconst begin_at = new Date(cursus.begin_at);\n\t\t\t\t\t\t\tconst blackholed_at = new Date(cursus.blackholed_at);\n\t\t\t\t\t\t\tconst dureeun = now - begin_at.getTime();\n\t\t\t\t\t\t\tconst dureedeux = blackholed_at.getTime() - now;\n\n\t\t\t\t\t\t\tif (dureeun >= 0 && dureedeux >= 0) {\n\t\t\t\t\t\t\t\t// IF STUDENT IS ACTIVE AND HAS SUBMITED A PROJECT IN THE LAST 5 MONTH\n\t\t\t\t\t\t\t\tif (json.projects_users) {\n\t\t\t\t\t\t\t\t\tlet userIsActive = false;\n\t\t\t\t\t\t\t\t\tjson.projects_users.map((project) => {\n\t\t\t\t\t\t\t\t\t\tif (project.status == 'finished' && project.marked_at) {\n\t\t\t\t\t\t\t\t\t\t\tconst marked_at = new Date(project.marked_at);\n\t\t\t\t\t\t\t\t\t\t\tconst past_now = new Date(Date.now());\n\t\t\t\t\t\t\t\t\t\t\tpast_now.setMonth(past_now.getMonth() - 3);\n\t\t\t\t\t\t\t\t\t\t\tconst dureetrois = marked_at.getTime() - past_now.getTime();\n\t\t\t\t\t\t\t\t\t\t\tif (dureetrois >= 0) {\n\t\t\t\t\t\t\t\t\t\t\t\tuserIsActive = true;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tif (userIsActive) {\n\t\t\t\t\t\t\t\t\t\tusersData.push({ id: json.id, login: json.login, blackholed_at: cursus.blackholed_at });\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\tfinished = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t});\n\t});\n\treq.end();\n\tif (pageUser + 1 < userIds.length) {\n\t\tpageUser++;\n\t\tsetTimeout(getUsersInfo, 2000);\n\t} else {\n\t\tconsole.log('\\x1b[32mIteration ' + ite + ' Done\\x1b[0m');\n\t\tfs.writeFileSync('./userdata/users'+ite+'.json', JSON.stringify(usersData));\n\t\tfs.chmodSync('./userdata/users'+ite+'.json', 0o600);\n\t}\n}", "async function checkNewMessagesAllUsers() {\n let name = await getCurrentUserName();\n\n let new_message_selector = await getSelectorNewMessage();\n\n let user = await page.evaluate((selector_newMessage,selector_newMessageUser,selector_newMessageUserPicUrl) => {\n\n \t let nodes = document.querySelectorAll(selector_newMessage);\n\n \t let el = nodes[0].parentNode.parentNode.parentNode.parentNode.parentNode.querySelector(selector_newMessageUser);\n\n \t let name=el ? el.innerText : '';\n \t \n \t el=nodes[0].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.querySelector(selector_newMessageUserPicUrl);\n \t let number='';\n \t if (el && el.hasAttribute('src')){\n \t let arr=/&u=([0-9]+)/g.exec(el.getAttribute('src'));\n \t if (arr[1])\n \t\t number=arr[1]\n \t }\n \t return [name,number];\n\n }, new_message_selector, selector.new_message_user,selector.new_message_user_pic_url);\n \n if (user[0] && user[0] != name) {\n\n\n if (last_received_message_other_user != user[0]) {\n \n \tlet message = 'You have a new message by \"' + user[0]+\";\"+user[1] + '\". Switch to that user to see the message.';\n \n \tprint('\\n' + message, config.received_message_color_new_user);\n\n \t// show notification\n \tnotify(user[0]+\";\"+user[1], message);\n\n \tlast_received_message_other_user = user[0];\n }\n }\n }", "async fetchSingleUserBreaktime(id) {\n let loginUser = localStorage.getItem('token');\n try {\n dispatch.breaks.setIsFetchingUser(true);\n let response = await breakURL.get(`/breaktime?user=${id}`, {\n headers: { Authorization: `Bearer ${loginUser}` },\n });\n dispatch.breaks.setUserBreaktime(response.data.data);\n dispatch.breaks.setIsFetchingUser(false);\n } catch (err) {\n dispatch.breaks.setIsFetchingUser(false);\n console.log(err);\n }\n }", "function startup(snap) {\n me = snap.val(); // user profile\n if (me === null) { // new user\n var t = $.trim(prompt('ID \"'+id+'\" doesn\\'t exist. '+\n 'Retype to create it or switch to different name.'));\n if (t.length === 0) {\n window.location.href = 'http://jrslims.com';\n return;\n }\n if (t !== id) {\n id = t;\n $('#user').text(id);\n myuserdb = usersdb.child(id); // my profile\n myuserdb.once('value', startup);\n return;\n }\n me = { // default values for new user\n lastseen: null,\n avatar: 'avatars/newuser.png',\n modifierkey: modifierkey, // shift key\n enterkey: enterkey // return key\n };\n myuserdb.set(me); // inititalize\n $('#user, #logo').click();\n }\n if (me.lastseen !== undefined) { lastseen = me.lastseen; }\n if (me.email !== undefined) { email = me.email; }\n if (me.avatar !== undefined) { avatar = me.avatar; }\n if (me.modifierkey !== undefined) { modifierkey = +me.modifierkey; }\n if (me.enterkey !== undefined) { enterkey = +me.enterkey; }\n\n if (paramOverride) { getParams(window.location.href); }\n\n myonoffdb = onoffdb.child(id);\n mystatusdb = myonoffdb.child('status');\n\n connectdb.on('value', presencechange);\n\n var now = new Date();\n $('#usertime').html('<time>'+now.toLocaleTimeString()+'</time>').attr('title', now.toLocaleDateString()).click(uptime);\n\n timeout = now.valueOf() + 5000;\n setTimeout( function() { // delay until after logo appears\n msgdb.on('child_added', addmessages); // start getting messages\n msgdb.on('child_removed', dropmessages); // remove from messages list\n }, 10);\n } // end startup (get user profile)", "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 upgradeUser(user){\r\n if (user.plint>10){\r\n // long upgrade logic...\r\n }\r\n}", "function questionUser() {\n inquirer.prompt([\n {\n type: \"list\",\n name: \"builder\",\n message: \"Would you like to add a team member?\",\n choices: [\"Manager\", \"Engineer\", \"Intern\", \"No\"]\n }\n ]).then((response) => {\n //console.log(response.builder)\n //if Manager is selected, run the addManager function\n if (response.builder === \"Manager\") {\n //console.log(\"this works\")\n addManager();\n }\n //if Engineer is selected, run the addEngineer function\n else if (response.builder === \"Engineer\") {\n addEngineer();\n }\n //if Intern is selected, run the addIntern function\n else if (response.builder === \"Intern\") {\n addIntern();\n }\n //if No is selected, assuming the team is complete, render the HTML page\n else if (response.builder === \"No\") {\n //console.log(\"once user selects No\", teamMembers);\n buildHTML();\n }\n })\n }", "function upUser(user){\n if (user.point > 10){\n // long upgrade logic..\n }\n}", "function helper_userExists(loggingUser, type) {\n\n let allUsers = getAllUsers();\n let isLogin = false, isSignup = false;\n const message1 = document.getElementById('message1');\n const message2 = document.getElementById('message2');\n \n if (allUsers !== null || undefined) {\n \n for (let i=0;i<allUsers.length;i++) {\n \n // checking data at login\n if (type === 'login') {\n\n if ((allUsers[i].email === loggingUser[0]) && \n (allUsers[i].password === loggingUser[1])) {\n isLogin = true;\n } else {\n \n // search which data are faulty, if email or \n // password\n let mail = true, passw = true;\n \n for (let i=0;i<allUsers.length;i++) {\n if ((allUsers[i].email !== loggingUser[0]) &&\n (allUsers[i].password === loggingUser[1])) {\n mail = false;\n }\n if ((allUsers[i].email === loggingUser[0]) &&\n (allUsers[i].password !== loggingUser[1])) {\n passw = false;\n }\n }\n\n // write out which data are faulty\n if (!mail) {\n message2.innerText = 'You entered wrong e-mail.';\n }\n else if (!passw) {\n message2.innerText = 'You entered wrong password.';\n }\n else { message2.innerText = 'There is no such user. Enter correct data.'; }\n \n // clean up message\n if (mail && passw) { message2.innerText = ''; }\n }\n\n //checkimg data at signup if match existing user\n } else if (type === 'signup') {\n\n if ((allUsers[i].firstName === loggingUser[0]) && \n (allUsers[i].lastName === loggingUser[1]) &&\n (allUsers[i].email === loggingUser[2]) && \n (allUsers[i].password === loggingUser[3])) {\n \n message1.innerText = 'User with entered data already exists.';\n return false;\n } else {\n isSignup = true;\n }\n }\n\n if (isLogin) {\n // saves data of current user to variable and returns it\n const userId = allUsers[i].userId;\n const userFirstName = allUsers[i].firstName;\n const userLastName = allUsers[i].lastName;\n const userEmail = allUsers[i].email;\n const userPassword = allUsers[i].password;\n const curUser = [userId, userFirstName, userLastName, \n userEmail, userPassword];\n \n setCurrentUser(curUser);\n \n return true;\n }\n else if (isSignup) {\n\n // if sign up verification passed\n return true;\n }\n\n }\n } else { alert('no users in localStorage.'); }\n \n }", "runEmailUpdates() {\n return new Promise((fulfill, reject) => {\n // reference variables\n let userIds;\n let usersThatNeedToBeAlerted;\n\n // current date information\n const dayOfTheWeek = new Date().getDay();\n const hourOfTheDay = new Date().getHours();\n\n // Basically each user has an attribute \"email_alert_frequency\"\n // it is an integer set to a \"number of hours\" between which they would\n // like to get email alerts for unread messages.\n // We determine if it is \"the right day\" of the week by querying for those with an\n // alerts frequency integer that is less than the interval we come up with\n // in the below logic block.\n // TODO: Vastly improve.\n let interval = 25; // hours\n if ([1, 3, 5, ].indexOf(dayOfTheWeek) > -1) {\n interval = 50;\n } else if (dayOfTheWeek == 4) {\n interval = 175;\n }\n\n // TODO: Do not execute raw queries here, either move to a lib or user Model Classes\n // We jsut want to query for the users who qualify for this runs email update process\n db('cms')\n .where('email_alert_frequency', '<', interval)\n .andWhere('active', true)\n .then((resp) => {\n // We just want the userIds from the response\n userIds = resp.map(user => user.cmid);\n\n // want a sum total and only of unreads\n const rawQuery = ' SELECT count(msgid), MAX(msgs.created) AS made, cms.cmid, cms.first, cms.last, cms.email ' +\n ' FROM msgs ' +\n\n // lefts joings allow us to a link a message to a conversation then to a user (from client to user)\n ' LEFT JOIN (SELECT convos.convid, convos.cm FROM convos) AS convos ON (convos.convid = msgs.convo) ' +\n ' LEFT JOIN (SELECT cms.cmid, cms.first, cms.last, cms.email FROM cms) AS cms ON (cms.cmid = convos.cm) ' +\n\n // within this bracketed period of time (only of unreads)\n ' WHERE msgs.read = FALSE AND msgs.created > CURRENT_TIMESTAMP - INTERVAL \\'1 day\\' ' +\n ' AND msgs.created < CURRENT_TIMESTAMP ' +\n\n // break them up by unique users\n ' GROUP BY cms.cmid, cms.first, cms.last, cms.email ORDER BY made DESC; ';\n\n // executes the above query\n return db.raw(rawQuery);\n }).then((resp) => {\n // if you run a raw query, then you have to extract the rows\n // from the resp object hence resp.rows\n usersThatNeedToBeAlerted = resp.rows;\n\n // we are going to filter out any users that should not be updated on this run\n usersThatNeedToBeAlerted = usersThatNeedToBeAlerted.filter(user => userIds.indexOf(user.cmid) > -1);\n\n // iterate over the resulting users list, and create a message object for each, then\n // use the transporter library to send a message through the ClientComm Gmail account\n usersThatNeedToBeAlerted.forEach((msg, i) => {\n // the message copy that will be emailed\n const text = ` Hello, ${msg.first} ${msg.last}, this is Code for America. ` +\n ` You are receiving this automated email because you have ${msg.count} message(s) waiting for you in ClientComm. ` +\n ' To view this message go to ClientComm.org and login with your user name and password. ' +\n ' If you are having issues accessing your account, send me an email at clientcomm@codeforamerica.org and we will be happy to assist you any time, day or night!';\n\n // this is the formatted object that the transporter library needs\n const mailOptions = {\n from: '\"ClientComm - CJS\" <clientcomm@codeforamerica.org>',\n to: msg.email,\n subject: 'Alert: New Unread ClientComm Messages!',\n text,\n html: text,\n };\n\n // Send mail with defined transport object\n if (credentials.CCENV !== 'testing') {\n transporter.sendMail(mailOptions, (error, info) => {\n if (error) {\n console.log(error);\n }\n // TODO: here we are iterating through the array of clients to update\n // we then use the below if we want to fulfill() and exit array\n // but we should actually use a Promise array, map over it\n // and catch any and all errors instead of the above if statement\n if (i == usersThatNeedToBeAlerted.length - 1) {\n // kicks us out of this function successfully\n fulfill();\n }\n });\n\n // if we are in testing we need to exit successfully as well\n } else if (i == usersThatNeedToBeAlerted.length - 1) {\n fulfill();\n }\n });\n\n // if list is of length zero, then fulfill would never be called and the process would never completed\n // hence the below, which is why we should use Promise map\n if (usersThatNeedToBeAlerted.length == 0) {\n fulfill();\n }\n }).catch(reject);\n });\n }", "function callAPI() {\n FB.api('/me', function(response) { \n var fb_hngt = checkHangoutFacebookAccount(response.email);\n\t\t\n\t\tif(fb_hngt == 'true')\n {\n document.location.href = fbLogin(response.email);\n FB.logout(); //logout the user after validating his fb account\n } \n else\n {\n alert(\"Facebook account does not matched any users of Hangout Today.\");\n FB.logout(); //logout the user after validating his fb account\n return;\n } \n });\n }", "function fundRequests() {\n if (user.fundRequests.length === 0) {\n console.log(\"No-one has sent fund request to you, returning to menu.\");\n } else {\n console.log(\"\\nFUND REQUESTS\");\n console.log(\"-----------------------------\");\n console.log(user.name + \", (ID: \" + user.id + \")\");\n console.log(\"Current balance: \" + Math.floor(user.balance* 100) / 100);\n console.log(\"-----------------------------\");\n\n console.log(\"\\nYou have following fund requests (ID, amount):\");\n for (const i in user.fundRequests) {\n if (user.fundRequests) {\n console.log((Number(i)+1) + \": \" + user.fundRequests[i]);\n }\n }\n\n const acceptInput = readline.question(\"\\nPlease enter number of request to accept transfer \" +\n \"(or 'quit' to go back in menu)\\n>> \");\n\n if (acceptInput === \"quit\") {\n currentLoc = \"funds\";\n // If accept input is >= 1 and given fundRequest index is not undefined (there IS request by that number)\n } else if (user.fundRequests[Number(acceptInput) - 1][1] > user.balance) {\n console.log(\"You dont have enough balance to pay requested amount.\");\n fundRequests();\n } else if ((acceptInput >= 1) && (user.fundRequests[Number(acceptInput) - 1] !== undefined)) {\n // Check for ID of fundRequest matching acceptInput\n const transferTarget = user.fundRequests[Number(acceptInput) - 1][0];\n // Check for requested amount matching acceptInput\n const transferAmount = user.fundRequests[Number(acceptInput) - 1][1];\n\n const passwordCheck = readline.question(\"Please enter your password to accept payment \"+\n \"for following request: \\n\" + \"To ID: \" + transferTarget + \", Amount: \" + transferAmount +\n \". (or 'quit' to return back to menu)\\n>> \");\n\n if (passwordCheck === \"quit\") {\n fundRequests();\n } else if (passwordCheck === user.password) {\n user.balance = Number(user.balance) - Number(transferAmount);\n\n const userArray = JSON.parse(fs.readFileSync(\"./accountDetails.json\", \"utf8\"));\n\n // Search userArray for transferTarget and add it with modified values to newAllUsers array.\n const newAllUsers = userArray.map(balanceFunction);\n function balanceFunction(x) {\n if (x.id === transferTarget) {\n // Modify target's balance to receive transferAmount\n x.balance = Number(x.balance) + Number(transferAmount);\n return x;\n } else if (x.id === user.id) {\n // Modify balance in newAllUsers to match user.balance\n x.balance = user.balance;\n\n // Remove correct fundRequest from array\n x.fundRequests.splice((Number(acceptInput) - 1), 1);\n\n // Update user.fundRequests\n user.fundRequests = x.fundRequests;\n return x;\n } else {\n return x;\n }\n }\n\n // Saving newAllUsers back to accountDetails.json file\n fs.writeFileSync(\"./accountDetails.json\", JSON.stringify(newAllUsers), \"utf8\", (err) => {\n if (err) {\n console.log(\"Could not save userData to file!\");\n }\n });\n\n console.log(\"\\nTransfer successful, your balance in your account is now: \" +\n Math.floor(user.balance* 100) / 100);\n } else {\n console.log(\"Password was incorrect, please try again.\");\n fundRequests();\n }\n } else {\n console.log(\"You didn't have request matching that number, please try again.\");\n fundRequests();\n }\n }\n}", "function runUserLoginCount (requestObj, userName,alertType,maxValue,alertValue) {\n // Clear timer id if it exists \n if (timerId) {\n clearTimeout (timerId);\n }\n if (requestObj) {\n requestObj.onreadystatechange = function () {\n if (requestObj.readyState == 4) {\n\t\t\t\tvar current = requestObj.responseText;\n\t\tleft =parseInt (maxValue, 10) - parseInt (current, 10)\n if((left < parseInt(alertValue,10)) && left != 0) {\n\t\t if(alertType==0){\n\t\t\t// Seconds to Hours\n\t\t\tleft=left/(60*60)\n\t\t }\n\t\t else if(alertType==1){\n\t\t\t// Seconds to Days\n\t\t\tleft=left/(60*60*24) \n\t\t }\n\t\t else if(alertType==2){\n\t\t\t// into MB\n\t\t\tleft=left\n\t\t }\n\t\t else if(alertType==3){\n\t\t\t// into GB\n\t\t\tleft=left/1024\n\t\t } \n\t\t left=left.toFixed(2)\n alert (\"Quota remaining is \" + left + \" \" + showAlertArr[parseInt (alertType, 10)]);\n return;\n }\n else {\n // send query again\n setTimeout (function () {runUserLoginCount (requestObj, userName,alertType,maxValue,alertValue)}, 60000)\n }\n }\n }\n requestObj.open(\"GET\",\"?page=cpAccAlertCheck.html&userName=\" + userName + \"&alertType=\" + alertType + \"&time=\" + new Date(),true);\n \n requestObj.send(null);\n }\n \n}", "function upgradeUser(user){\n if (user.point > 10) {\n // long upgrade logic...\n }\n}", "function checkUser(){\n //console.log('check user started');\n cumputerTurn = false;\n if(userClicked == true){\n \n }\n}", "function upgradeUser(user){\n if(user.point >10){\n //long upgrade logic\n }\n}", "function checkRemainingTime(){\r\r\n\tif(kalender_user_role != 'restzeitnutzer') return false;\r\r\n\r\r\n\tjQuery.getJSON(kalender_ajax_object.getAnzahl,{\r\r\n\t\t// get parameter\r\r\n\t\t'jahr': kalender_data.jahr,\r\r\n\t\t'monat': kalender_data.monat + 1,\r\r\n\t\t'username': kalender_user\r\r\n\t}).success(function(result){\r\r\n\t\t// abbruch wenn result objekt ein feld \"error\" enthaelt\r\r\n\t\tif(result.hasOwnProperty('error')){\r\r\n\t\t\tconsole.error(\"ERROR: \", result);\r\r\n\t\t\treturn;\r\r\n\t\t}\r\r\n\t\t\r\r\n\t\t// neues uhrzeit objekt mit der restdauer fuellen\r\r\n\t\tkalender_restzeit = new Uhrzeit(0,0,0, false);\r\r\n\t\tkalender_restzeit.addMin(result.max - result.dauer);\r\r\n//\t\tconsole.debug(result, kalender_restzeit);\r\r\n\t}).fail(function(result){\r\r\n\t\tconsole.error(\"ERROR: \", result);\r\r\n\t});\r\r\n}", "function checkStatus() {\n\n var users = getUsers();\n // variable count is used to monitor how many users are loged in, if more than\n // one then it sets the loged in status of all users to false\n var count = 0;\n\n for(var k = 0; k < users.length; k++) {\n if(users[k].loggedIn == true) {\n loggedIn = [true, k];\n count += 1;\n }\n }\n //if user is logged in changes the login tab to user information tab\n if(loggedIn[0] && count == 1) {\n if(document.getElementById(\"LoggedInAs\") != null && document.getElementById(\"playersHighscore\") != null) {\n document.getElementById(\"LoggedInAs\").innerHTML = \"Logged in as: \" + users[loggedIn[1]].name;\n document.getElementById(\"playersHighscore\").innerHTML = \"Highest score: \" + users[loggedIn[1]].score;\n selectTab(event, 'logedIn');\n } else {\n //sets the login / sign up value inside the navigation bar to a users username\n document.getElementById(\"user\").innerHTML = users[loggedIn[1]].name;\n }\n } else {\n for(var l = 0; l < users.length; l++) {\n users[l].loggedIn = false;\n }\n }\n }", "async function available(user1, user2) {\n let sche1 = user1.schedule;\n let sche2 = user2.schedule;\n\n let schedule1;\n let schedule2;\n\n try {\n schedule1 = await ScheduleModel.getScheduleById(sche1);\n } catch (error) {\n console.log(error);\n }\n\n try {\n schedule2 = await ScheduleModel.getScheduleById(sche2);\n } catch (error) {\n console.log(error);\n }\n\n let monday1 = await DayModel.getDayById(schedule1.mon);\n let monday2 = await DayModel.getDayById(schedule2.mon);\n let mondayTime = await getAvailableHour(monday1, monday2);\n if (mondayTime != null) {\n console.log({dayOfWeek: \"monday\", time: mondayTime});\n return {dayOfWeek: \"monday\", time: mondayTime, user: user2}; // and something\n }\n\n let tuesday1 = await DayModel.getDayById(schedule1.tue);\n let tuesday2 = await DayModel.getDayById(schedule2.tue);\n let tuesdayTime = await getAvailableHour(tuesday1, tuesday2);\n if (tuesdayTime != null) {\n console.log({dayOfWeek: \"tuesday\", time: tuesdayTime});\n return {dayOfWeek: \"tuesday\", time: tuesdayTime, user: user2}; // and something\n }\n\n let wednesday1 = await DayModel.getDayById(schedule1.wed);\n let wednesday2 = await DayModel.getDayById(schedule2.wed);\n let wednesdayTime = await getAvailableHour(wednesday1, wednesday2);\n if (wednesdayTime != null) {\n console.log({dayOfWeek: \"wednesday\", time: wednesdayTime});\n return {dayOfWeek: \"wednesday\", time: wednesdayTime, user: user2};\n }\n\n let thursday1 = await DayModel.getDayById(schedule1.thu);\n let thursday2 = await DayModel.getDayById(schedule2.thu);\n let thursdayTime = await getAvailableHour(thursday1, thursday2);\n if (thursdayTime != null) {\n console.log({dayOfWeek: \"thursday\", time: thursdayTime});\n return {dayOfWeek: \"thursday\", time: thursdayTime, user: user2};\n }\n\n let friday1 = await DayModel.getDayById(schedule1.fri);\n let friday2 = await DayModel.getDayById(schedule2.fri);\n let fridayTime = await getAvailableHour(friday1, friday2);\n if (fridayTime != null) {\n console.log({dayOfWeek: \"friday\", time: fridayTime});\n return {dayOfWeek: \"friday\", time: fridayTime, user: user2};\n }\n\n let saturday1 = await DayModel.getDayById(schedule1.sat);\n let saturday2 = await DayModel.getDayById(schedule2.sat);\n let saturdayTime = await getAvailableHour(saturday1, saturday2);\n if (saturdayTime != null) {\n console.log({dayOfWeek: \"saturday\", time: saturdayTime});\n return {dayOfWeek: \"saturday\", time: saturdayTime, user: user2};\n }\n\n let sunday1 = await DayModel.getDayById(schedule1.sun);\n let sunday2 = await DayModel.getDayById(schedule2.sun);\n let sundayTime = await getAvailableHour(sunday1, sunday2);\n if (sundayTime != null) {\n console.log({dayOfWeek: \"sunday\", time: sundayTime});\n return {dayOfWeek: \"sunday\", time: sundayTime, user: user2};\n }\n return null;\n\n}", "function getUsersWanting(data) {\n setStatusMessage('Checking what games they’re trading…');\n \n var gamesAvailable = {};\n \n // Loop through users wanting the game\n var collectionRetrievers = [];\n $.each(data.UsersWant, function(index, user) {\n var collectionUrl = 'http://bgg-api.herokuapp.com/api/v1/collection?username=' + user.Name + '&trade=1';\n // Create array of AJAX calls that will get users’ collections\n collectionRetrievers.push(\n $.getJSON(collectionUrl, storeCollectionFactory(user.Name))\n );\n });\n \n // Get users’ collections\n $.when.apply($, collectionRetrievers).always(function() {\n // Loop through collections\n $.each(collectionsAvailable, function(userName, collection) {\n // loop through games user has for trade\n if(collection.items.hasOwnProperty('item')) {\n $.each(collection.items.item, function(index, item) {\n var gameName = item.name[0]['_'];\n var gameID = item['$'].objectid;\n \n if(!gamesAvailable.hasOwnProperty(gameName)) {\n gamesAvailable[gameName] = {};\n gamesAvailable[gameName].id = gameID;\n gamesAvailable[gameName].owners = [];\n }\n \n gamesAvailable[gameName].owners.push(userName);\n });\n }\n });\n \n // Display games available for trade\n $.each(gamesAvailable, displayGame);\n $('#olGamesAvailable li').sort(asc_sort).appendTo('#olGamesAvailable');\n \n // Set form back to “ready” status\n $('#btnGetUsersWanting').prop('disabled', false);\n setStatusMessage(readyStatusMessage);\n });\n}", "function logUserHostMaintainDetails() {\n if (createMaintenanceScheduleReq.readyState == 4) {\n\n var createMaintenanceScheduleReqdbData = JSON.parse(showErrorCreate(createMaintenanceScheduleReq.responseText, \"Error Found\"));\n\n if (Object.entries(createMaintenanceScheduleReqdbData).length != 0) {\n\n\n\n var scheduleId = document.getElementById(\"selectSchedule\").value;\n var selectedSite = document.getElementById(\"selectSite\").value;\n var selectedHost = document.getElementById(\"selectAgent\").value;\n\n // var selectedAgent = document.getElementById(\"selectAgent\").value;\n var selectedService = document.getElementById(\"selectService\").value;\n var selectedSource = document.getElementById(\"selectSource\").value;\n\n\n var currentUser;\n var userProfileID = \"\";\n var dateNow;\n\n // var remoteVodaEXT = \"?remotehost=https://41.0.203.210:8443/InovoCentralMonitorClient/MonitorData&action=runopenquery&query=\";\n\n\n var newUserId;\n\n var dbData = JSON.parse(showErrorMain(userManagementProfileReq.responseText, \"Error Found\"));\n\n\n var userProfileData = JSON.parse(showErrorMain(userProfilereq.responseText, \"Error Found\"));\n if ((Object.entries(dbData).length != 0) && (Object.entries(userProfileData).length != 0)) {\n var userDetails = dbData['queryresult'];\n var userProfile = userProfileData['UserInfo'];\n currentUser = userProfile['userLogin']\n for (var iAlarm = 0; iAlarm < userDetails.length; iAlarm++) {\n\n var rowData = userDetails[iAlarm];\n if (currentUser == rowData['userlogin']) {\n userProfileID = rowData['id'];\n }\n }\n\n // // --------------------------------------------------------------------------------------------------------------------------------------------------\n // // UPDATE USER LOG\n // // -------------------------------------------------------------------------------------------------------------------------------------------------- \n var updateReason = createUserLogReasonForHostMaintenance(scheduleId, selectedSite, selectedHost, selectedService, selectedSource);\n // var query = \"SELECT * FROM InovoMonitor.tblAlarms;\"\n\n dateNow = new Date();\n dateNow = dateNow.getFullYear() + '-' +\n ('00' + (dateNow.getMonth() + 1)).slice(-2) + '-' +\n ('00' + dateNow.getDate()).slice(-2) + ' ' +\n ('00' + dateNow.getHours()).slice(-2) + ':' +\n ('00' + dateNow.getMinutes()).slice(-2) + ':' +\n ('00' + dateNow.getSeconds()).slice(-2);\n\n var insertLogquery = \"INSERT INTO InovoMonitor.tblUserLog (userid, reason, datecreated, createdby) VALUES ('\" + userProfileID + \"','\" + String(updateReason) + \"', '\" + dateNow + \"','\" + currentUser + \"');\";\n\n\n\n createHMUserlogReq.open(\"POST\", serverURL + \"/MonitorData\", true);\n createHMUserlogReq.onreadystatechange = completeHostMaintain;\n createHMUserlogReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n createHMUserlogReq.send(\"action=runopenquery&query=\" + insertLogquery);\n }\n\n\n }\n }\n // else {\n // //set variables \n // var newScheduleName = document.getElementById(\"selectSchedule\").value;\n // var selectedSite = document.getElementById(\"selectSite\").value;\n // var selectedHost = document.getElementById(\"selectAgent\").value;\n\n // //set time \n // var toastDelayTime = 10000;\n // // set title\n // var toastTitle = \"ERROR!HOST MAINTENANCE SCHEDULE CREATION COMPLETE!\";\n // //Set Message\n // var toastMessage = \"FAILED to set the Schedule: \" + newScheduleName + \", for the Site: \" + selectedSite + \", Host: \" + selectedHost + \". Please Contact Inovo for assistance. \";\n\n // //set objects\n // var toastPopup = document.getElementById(\"mainPageToastAlert\");\n // var toastTITLEObj = document.getElementById(\"toastTitle\");\n // var toastMSGObj = document.getElementById(\"toastMessage\");\n\n\n // // run toast \n // toastPopup.setAttribute(\"data-delay\", toastDelayTime);\n // toastTITLEObj.innerHTML = toastTitle;\n // toastMSGObj.innerHTML = toastMessage;\n // $(function () { $('#mainPageToastAlert').toast('show'); });\n // }\n\n\n}", "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 checkUser() {\n\tif (user) {\n\t\tconsole.log(\"Signed in as user \" + user.email);\n\t\t// console.log(user);\n\t\thideLoginScreen();\n\t} else {\n\t\tconsole.log(\"No user is signed in\");\n\t}\n}", "function sch_next_check() {\n\t\tclearTimeout(checkPeriodically);\n\t\tcheckPeriodically = setTimeout(function () {\n\t\t\ttry {\n\t\t\t\tws_server.check_for_updates(null);\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\tconsole.log('');\n\t\t\t\tlogger.error('Error in sch next check\\n\\n', e);\n\t\t\t\tsch_next_check();\n\t\t\t\tws_server.check_for_updates(null);\n\t\t\t}\n\t\t}, cp_general.blockDelay + 2000);\n\t}", "function initGame() {\n fillUpUserObj();\n theUser = new User(\"default\");\n inquirer.prompt([\n {\n type: \"confirm\",\n name: \"wantsToPlay\",\n message: \"Oh hi! Would you like to play some Hangman?\",\n default: true,\n },\n {\n // if user said yes\n when: function(answers) {\n return answers.wantsToPlay;\n },\n name: \"userName\",\n type: \"name\",\n message: \"What is your user name?\"\n },\n {\n // checks to see if user already exists\n when: function(answers) {\n for (let key = 0; key < userObj.length; key++) {\n let nameInObj = userObj[key].name;\n let nameRequested = answers.userName;\n if (nameInObj == nameRequested) {\n return true;\n } \n }\n return false;\n },\n name: \"user_exists\",\n type: \"list\",\n message: function(answers) {\n return `would you to play as existing user: ${answers.userName}?`;\n },\n choices:[\"yes\",\"no\"]\n }\n ]).then(function(answers){\n theUser.name = answers.userName;\n if (answers.wantsToPlay) {\n // for if you are a user already and say yes\n if (answers.user_exists === \"yes\") {\n console.log(\"hello, existing user: \" + answers.userName);\n let userRecord = retrieveUser(theUser.name);\n // set all the important details to our current user object\n theUser.points = userRecord.points;\n theUser.lookups = userRecord.lookups;\n theUser.favoriteWords = userRecord.favoriteWords;\n theUser.storeUser();\n console.log(`here's your stats:`);\n console.log(`points: ${theUser.points}\\nfavorite words: ${theUser.favoriteWords.join(\", \")}`);\n // for if you are a user already and say no\n } else if (answers.user_exists === \"no\") {\n initGame();\n return;\n // for if neither choice is made (question not asked)\n } else {\n console.log(\"hello, new user \" + answers.userName);\n theUser.storeUser();\n }\n playHangman();\n } else {\n console.log(\"Oh well, maybe some other time then\");\n }\n });\n}", "async function manageUser()\n{\n\tlet server = objActualServer.server\n\tlet txt = \"Choissisez la personne que vous souhaitez manager : \"\n\n\tlet choice = [\n\t{\n\t\tname: \"Retournez au menu précédent\",\n\t\tvalue: -1\n\t}]\n\tchoice.push(returnObjectLeave())\n\tserver.members.forEach((usr) =>\n\t{\n\t\tlet actualUser = usr.user\n\t\tchoice.unshift(\n\t\t{\n\t\t\tname: actualUser.username,\n\t\t\tvalue: actualUser\n\t\t})\n\t})\n\n\tlet data = await ask(\n\t{\n\t\ttype: \"list\",\n\t\tname: \"selectedUser\",\n\t\tmessage: txt,\n\t\tchoices: choice,\n\t})\n\n\tif (data.selectedUser == -1)\n\t{\n\t\tchooseWhatToHandle(data)\n\t}\n\telse if (data.selectedUser == -2)\n\t{\n\t\tendProcess()\n\t}\n\telse\n\t{\n\t\tmanageSingleUser(data.selectedUser)\n\t}\n\n}", "function upgradeUser(user) {\n if (user.point > 10) {\n //long upgrade logic ...\n }\n}", "function checkUserStatus() {\n if (firebase.auth().currentUser === null) { loadLoginPage(); }\n else { loadHomePage(); }\n }", "function validate_first() {\n\n\t\t//Log that this function ran.\n\t\tconsole.log(\"validate_first()\")\n\n\t\t//If 21, tell the user they won!\n\t\tif(your_sum==21) {\n\t\t\tconsole.log(\"Initial user count is 21\");\n\t\t\twin();\n\t\t\tconsole.log(\"win 1\");\n\t\t}\n\t\t//If under 21, tell the user they can hit or stay via the \"deal\" function.\n\t\tif(your_sum<21) {\n\t\t\tconsole.log(\"Initial user count <21\");\n\t\t\tdeal();\n\t\t}\n\t\t//This should never happen, but if the cards are over 21, the user will lose, and we log an error to the console.\n\t\telse {\n\t\t\tconsole.log(\"Error: User lost. Please contact the developer of this app at http://dbarner.me\");\n\t\t\tlose();\n\t\t\tconsole.log(\"lose 1\");\n\t\t\t;\n\t\t}\n}", "function startCheck(){\r\n\telementSelectedProfileID();\r\n\telementSelectedActivity();\r\n\telementSelectedAmbience();\r\n\telementSelectedMinRSVP();\r\n\telementSelectedMaxRSVP();\r\n\telementSelectedStartDate();\r\n\telementSelectedEndDate();\r\n\telementSelectedDuration();\r\n\telementSelectedStartTime();\r\n\telementSelectedEndTime();\r\n\telementSelectedLocation();\r\n\telementSelectedFitness();\r\n}", "checkTheUserOnTheFirstLoad() {\n return this.me().toPromise();\n }", "function checkSignUp() {\n console.log(\"Called checkSignUp()\");\n console.log(\"Updating user statistics\");\n \n if(document.getElementById(\"password2\").value === document.getElementById(\"repeatPsw\").value) {\n var dataObject = {email: document.getElementById(\"email2\").value,\n password: document.getElementById(\"password2\").value,\n firstname: document.getElementById(\"firstName\").value,\n familyname: document.getElementById(\"familyName\").value,\n gender: document.getElementById(\"gender\").value,\n city: document.getElementById(\"city\").value,\n country: document.getElementById(\"country\").value};\n var signUpObject = null;\n\n var message = {\n \"email\": dataObject.email,\n \"first_name\": dataObject.firstname,\n \"family_name\": dataObject.familyname,\n \"gender\": dataObject.gender,\n \"country\": dataObject.country,\n \"city\": dataObject.city,\n \"password\": dataObject.password\n };\n\n var request = new TwiddlerRequest(\"POST\", \"/sign_up\",\n message, signUpHandler);\n request.send();\n }\n\n return false;\n}", "async waitForUser() {\n return this.testRig.waitForUser();\n }", "function upgradeUser(user) {\n if (user.point > 10) {\n //long upgrade logic...\n }\n}", "function sch_next_check() {\n\t\tclearTimeout(checkPerodically);\n\t\tcheckPerodically = setTimeout(function () {\n\t\t\ttry {\n\t\t\t\tws_server.check_for_updates(null);\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\tconsole.log('');\n\t\t\t\tlogger.error('Error in sch next check\\n\\n', e);\n\t\t\t\tsch_next_check();\n\t\t\t\tws_server.check_for_updates(null);\n\t\t\t}\n\t\t}, 8000);\t\t\t\t\t\t\t\t\t\t\t\t\t\t//check perodically, should be slighly shorter than the block delay\n\t}", "function scheduleRequest() {\n try {\n chrome.alarms.get(\"issues\", function(alarm) {\n if (alarm) {\n chrome.alarms.clear(\"issues\");\n }\n chrome.alarms.create(\"issues\", {'delayInMinutes': pollIntervalMin}); \n });\n } catch(err) {\n chrome.alarms.create(\"issues\", {'delayInMinutes': pollIntervalMin});\n }\n}" ]
[ "0.6484531", "0.6158379", "0.5830184", "0.579746", "0.57936287", "0.5697816", "0.5687309", "0.5672732", "0.5660969", "0.56362784", "0.5614853", "0.55957496", "0.5588634", "0.553915", "0.5532074", "0.55250454", "0.5511523", "0.5510523", "0.5507814", "0.54976106", "0.54964715", "0.54783666", "0.54762775", "0.5462905", "0.54583824", "0.54539317", "0.5453371", "0.54487145", "0.544773", "0.5443606", "0.5432904", "0.5407462", "0.53990793", "0.5398625", "0.5397647", "0.53893125", "0.5384962", "0.5383235", "0.53786385", "0.53781784", "0.5376803", "0.5370352", "0.53698313", "0.5368445", "0.5364437", "0.53558916", "0.535494", "0.5353841", "0.53394926", "0.5338286", "0.5337868", "0.53341496", "0.5331494", "0.5330645", "0.5328295", "0.5323776", "0.53181744", "0.53109515", "0.53039896", "0.5287326", "0.5286158", "0.5285051", "0.52763885", "0.5274547", "0.5267068", "0.5263884", "0.5259643", "0.5252706", "0.52478963", "0.524342", "0.5235985", "0.5234334", "0.5233511", "0.5231202", "0.5225873", "0.5225776", "0.5224963", "0.52249", "0.52246344", "0.52118754", "0.52042866", "0.51994354", "0.51993525", "0.51993513", "0.5197091", "0.51964563", "0.5192509", "0.5192327", "0.5184366", "0.51829225", "0.5181768", "0.5180866", "0.5179945", "0.51797885", "0.5179019", "0.51766163", "0.5175802", "0.51739377", "0.51669264", "0.51644516" ]
0.6836265
0
will initiate a private conversation with user and save the resulting standup report for the channel
function doStandup(bot, user, channel) { var userName = null; getUserName(bot, user, function(err, name) { if (!err && name) { userName = name; bot.startPrivateConversation({ user: user }, function(err, convo) { if (!err && convo) { var standupReport = { channel: channel, user: user, userName: userName, datetime: getCurrentOttawaDateTimeString(), yesterdayQuestion: null, todayQuestion: null, obstacleQuestion: null }; convo.ask('What did you work on yesterday?', function(response, convo) { standupReport.yesterdayQuestion = response.text; convo.ask('What are you working on today?', function(response, convo) { standupReport.todayQuestion = response.text; convo.ask('Any obstacles?', function(response, convo) { standupReport.obstacleQuestion = response.text; convo.next(); }); convo.say('Thanks for doing your daily standup, ' + userName + "!"); convo.next(); }); convo.next(); }); convo.on('end', function() { // eventually this is where the standupReport should be stored bot.say({ channel: standupReport.channel, text: "*" + standupReport.userName + "* did their standup at " + standupReport.datetime, //text: displaySingleReport(bot, standupReport), mrkdwn: true }); addStandupData(standupReport); }); } }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function initiateConversation(adminID){\n rainbowSDK.contacts.searchById(adminID).then((contact)=>{\n console.log(\"[DEMO] :: \" + contact);\n if(mocClicked == \"Chat\"){\n rainbowSDK.conversations.openConversationForContact(contact).then(function(conversation) {\n console.log(\"[DEMO] :: Conversation\", conversation);\n conversation1 = conversation;\n rainbowSDK.im.getMessagesFromConversation(conversation, 30).then(function() {\n console.log(\"[DEMO] :: Messages\", conversation);\n chat();\n }).catch(function(err) {\n console.error(\"[DEMO] :: Error Messages 1\", err);\n });\n }).catch(function(err) {\n console.error(\"[DEMO] :: Error conversation\", err);\n });\n }else{\n //check browser compatibility\n if(rainbowSDK.webRTC.canMakeAudioVideoCall()) {\n console.log(\"[DEMO] :: Audio supported\");\n if(rainbowSDK.webRTC.hasAMicrophone()) {\n /* A microphone is available, you can make at least audio call */\n console.log(\"[DEMO] :: microphone supported\");\n var res = rainbowSDK.webRTC.callInAudio(contact);\n if(res.label === \"OK\") {\n call();\n /* Your call has been correctly initiated. Waiting for the other peer to answer */\n console.log(\"[DEMO] :: Contact Successful\");\n let paragraph = document.getElementById(\"p1\");\n paragraph.innerHTML(\"Waiting for Admin to pick up.\");\n }\n else{console.log(\"[DEMO] :: Call not initialised successfully.\");}\n }else {\n alert(\"DEMO :: no microphone found\");\n }\n }else{\n alert(\"DEMO :: browser does not support audio\")\n }\n }\n }).catch((err)=>{\n console.log(err);\n });\n}", "function loginInitiateConversation(bot, identity) {\n\n\tvar SlackUserId = identity.user_id;\n\tvar botToken = bot.config.token;\n\tbot = _controllers.bots[botToken];\n\n\t_models2.default.User.find({\n\t\twhere: { SlackUserId: SlackUserId }\n\t}).then(function (user) {\n\t\tvar scopes = user.scopes;\n\t\tvar accessToken = user.accessToken;\n\n\n\t\tbot.startPrivateConversation({ user: SlackUserId }, function (err, convo) {\n\n\t\t\t/**\n * \t\tINITIATE CONVERSATION WITH LOGIN\n */\n\t\t\tconvo.say('Awesome!');\n\t\t\tconvo.say('Let\\'s win this day now. Let me know when you want to `/focus`');\n\t\t});\n\t});\n}", "function firstInstallInitiateConversation(bot, team) {\n\n\tvar config = {\n\t\tSlackUserId: team.createdBy\n\t};\n\n\tvar botToken = bot.config.token;\n\tbot = _controllers.bots[botToken];\n\n\tbot.startPrivateConversation({ user: team.createdBy }, function (err, convo) {\n\n\t\t/**\n * \t\tINITIATE CONVERSATION WITH INSTALLER\n */\n\n\t\tconvo.say('Hey! I\\'m Toki!');\n\t\tconvo.say('Thanks for inviting me to your team. I\\'m excited to work together :grin:');\n\n\t\tconvo.on('end', function (convo) {\n\t\t\t// let's save team info to DB\n\t\t\tconsole.log(\"\\n\\nteam info:\\n\\n\");\n\t\t\tconsole.log(team);\n\t\t});\n\t});\n}", "function startConversation(user, guid, callback) {\n\n\tvar endpoint = `${rest_endpoint}v3/conversations`;\n\tvar data = {\n\t\t\"bot\": {\n\t\t\t\"id\": \"28:\" + appID,\n\t\t\t\"name\": \"luislocalnotify\"\n\t\t},\n\t\t\"members\": [{\n\t\t\t\"id\": user\n\t\t}],\n\t\t\"channelData\": {\n\t\t\t\"tenant\": {\n\t\t\t\t\"id\": tenant_id[guid]\n\t\t\t}\n\t\t}\n\t};\n\n\trest.post(endpoint, {\n\t\t'headers': {\n\t\t\t'Authorization': 'Bearer ' + access_token[guid]\n\t\t},\n\t\t'data': JSON.stringify(data)\n\t}).on('complete', function (data) {\n\t\tconsole.log('Starting Conversation');\n\t\tcallback(data);\n\t});\n}", "function setupDecisionsUser() {\n\n // move ticket link for easier access\n $(\"#moderation-ticket-link-new\").remove();\n $(\"#moderation-ticket-link p a\").attr('id', 'moderation-ticket-link-new');\n $(\"#moderation-ticket-link p a\").appendTo($(\"div#moderation-form form div:nth-child(3)\"));\n //$(\"#moderation-ticket-link\").remove();\n\n // add decision selection in user column\n var decisionsHTML = \"\";\n for (var key in decisions) {\n if (decisions[key].message == \"\") {\n var message = \"[No message]\";\n } else {\n var message = \"Message: \" + decisions[key].message;\n }\n\n // extend decisions dialog html code\n decisionsHTML = decisionsHTML + (\"<li><input name='decisions' type='radio' id='\" + key + \"'/><label for='\" + key + \"' title='\" + message + \"' >\" + decisions[key].title + \"</label></li>\");\n }\n\n // inject decision dialog\n $(\".user-annotations-info\").append(\"\\\n <p><strong>User decisions:</strong></p>\\\n <ul id='decisions'>\" + decisionsHTML + \"</ul>\\\n \");\n\n // get username from user column\n var username = $(\".user-annotations-info p a:first\").text();\n\n // load already made decision\n chrome.storage.local.get('decisionsUsers', function(data) {\n var decisionsUsers = data.decisionsUsers;\n\n // create object if it does not exist yet\n if (typeof decisionsUsers == \"undefined\") {decisionsUsers = {};}\n\n // if current user has a decision\n if (username in decisionsUsers) {\n\n // set decision\n $(\"#\" + decisionsUsers[username]).prop('checked', true);\n\n }\n });\n\n /////////////////////////////////////////////////////////\n // highlight active sound and active user in sound ticket column and play sound\n\n // highlight user\n $('#assigned-tickets-table-wrapper table tbody tr').each(function (i, row) {\n\n // remove highlights on all sounds and users\n $(this).removeClass(\"loading loaded\");\n $(this).children(\"td:nth-child(3)\").removeClass(\"loaded\");\n $(this).children(\"td:nth-child(1)\").removeClass(\"loaded\");\n\n // add highlight if the user is right\n if ( username.indexOf($(this).children(\"td:nth-child(3)\").text()) > -1 ){\n $(this).children(\"td:nth-child(3)\").addClass(\"loaded\");\n }\n });\n\n // add loaded class to currently selected\n $(\"tr.mod-selected-row\").addClass(\"loaded\");\n $(\"tr.mod-selected-row td:nth-child(1)\").addClass(\"loaded\");\n\n /////////////////////////////////////////////////\n // bind radio buttons to local storage operations\n $('#decisions li input').each(function (i, radio) {\n\n $(radio).bind('click', function() {\n\n // get decision key (hidden in radio button's id)\n var decision = $(radio).attr(\"id\");\n chrome.storage.local.get('decisionsUsers', function(data) {\n\n var decisionsUsers = data.decisionsUsers;\n\n // create object if it does not exist yet\n if (jQuery.isEmptyObject(decisionsUsers)) { decisionsUsers = {}; };\n decisionsUsers[username] = decision;\n\n //\n chrome.storage.local.set( { \"decisionsUsers\": decisionsUsers }, function (result) {\n // remove classes of user's sounds\n // update user's sounds decision indicator\n $('#assigned-tickets-table-wrapper table tbody tr').each(function (i, row) {\n var userNameField = $(this).children(\"td:nth-child(3)\");\n\n // get username from user column\n var username = $(\".user-annotations-info p a\").first().text();\n\n if (userNameField.text() == username) {\n $(userNameField).removeClass(\"decNot decAcc decAcD decDfr decDel decSpm\");\n $(userNameField).addClass(decisions[decision].cssClass);\n $(userNameField).attr(\"data-user-decision\", decision);\n $(userNameField).attr(\"title\", decisions[decision].title);\n }\n });\n })\n });\n })\n })\n\n} // end function setupDecisionsUser()", "async sendInfoToChat() {\r\n let messageData = {\r\n user: game.user.id,\r\n speaker: ChatMessage.getSpeaker(),\r\n };\r\n\r\n let cardData = {\r\n ...this.data,\r\n owner: this.actor.id,\r\n };\r\n messageData.content = await renderTemplate(this.chatTemplate[this.type], cardData);\r\n messageData.roll = true;\r\n ChatMessage.create(messageData);\r\n }", "async initializeChat(conversationData, userInfo, botTranscript) {\n var buttonOverrides = new Array(process.env.BUTTON_ID);\n var preChatDetails = this.initializePrechatDetails(userInfo, botTranscript);\n var chasitorInit = this.initializeSalesForceChatObject(preChatDetails, userInfo, conversationData.sessionId, buttonOverrides);\n return await this.salesForceRepo.requestChat(chasitorInit, conversationData.affinityToken,conversationData.sessionKey);\n }", "function start_conversation(){\n $(\"#body-wrapper\").hide();\n\n var video_peer = new Peer({key: '57jf1vutabvjkyb9'});\n var audio_peer = new Peer({key: '57jf1vutabvjkyb9'});\n \n //musician\n if(if_musician){\n //we need to await the call\n initialize_musician(video_peer, audio_peer);\n } else {\n initialize_critiquer(video_peer, audio_peer);\n }\n\n video_peer.on('error', function(err){\n alert(err.message);\n });\n\n audio_peer.on('error', function(err){\n alert(err.message);\n });\n\n //draws a new timeline with specified totalDuration\n makeTimeline();\n }", "async function startChat(user) {\n // replace selector with selected user\n let user_chat_selector = selector.user_chat;\n user_chat_selector = user_chat_selector.replace('XXX', user);\n\n // type user into search to avoid scrolling to find hidden elements\n await page.click(selector.search_box)\n // make sure it's empty\n await page.evaluate(() => document.execCommand( 'selectall', false, null ))\n await page.keyboard.press(\"Backspace\");\n // find user\n await page.keyboard.type(user)\n await page.waitFor(user_chat_selector);\n await page.click(user_chat_selector);\n\t await page.click(selector.chat_input);\n\t \n let name = getCurrentUserName();\n\n if (name) {\n console.log(logSymbols.success, chalk.bgGreen('You can chat now :-)'));\n console.log(logSymbols.info, chalk.bgRed('Press Ctrl+C twice to exit any time.\\n'));\n } else {\n console.log(logSymbols.warning, 'Could not find specified user \"' + user + '\"in chat threads\\n');\n }\n }", "function callUser(user) {\n getCam()\n .then(stream => {\n if (window.URL) {\n document.getElementById(\"selfview\").srcObject = stream;\n } else {\n document.getElementById(\"selfview\").src = stream;\n }\n toggleEndCallButton();\n caller.addStream(stream);\n localUserMedia = stream;\n caller.createOffer().then(function (desc) {\n caller.setLocalDescription(new RTCSessionDescription(desc));\n channel.trigger(\"client-sdp\", {\n sdp: desc,\n room: user,\n from: id\n });\n room = user;\n });\n })\n .catch(error => {\n console.log(\"an error occured\", error);\n });\n}", "onDialogBegin(session, args, next) {\n return __awaiter(this, void 0, void 0, function* () {\n session.dialogData.isFirstTurn = true;\n this.showUserProfile(session);\n next();\n });\n }", "function setupChannel() {\n\n // Join the control channel\n controlChannel.join().then(function(channel) {\n print('Joined controlchannel as '\n + '<span class=\"me\">' + username + '</span>.', true);\n });\n\n // Listen for new messages sent to the channel\n controlChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n console.log('lenis')\n test();\n //printcontrol()\n if (message.body.search(\"@anon\")>=0)\n {\n $.get( \"alch/\"+message.body, function( data ) {\n\n console.log(data);\n });\n }\n else if (message.body.search(\"@time\")>=0)\n {\n\n test();\n // var date=new Date().toLocaleString();\n // controlChannel.sendMessage(date);\n\n }\n else if (message.body.search(\"@junk\")>=0)\n {\n console.log(\"penis\");\n// test();\n }\n\n\n });\n }", "function startInterview(){\n // timer start \n // database upate user data\n // user id will be the object id? is that going to be safe? simply i will bcrypt the roomid and make it userid \n }", "function startConversation() {\n var sync = true;\n var data = null;\n\n var params = {\n TableName: BLOCKBOT_PROJECT_ID,\n Item: {\n 'sender' : {S: getMessageSender()},\n },\n ConditionExpression: 'attribute_not_exists(sender)',\n // ExpressionAttributeNames: {'#i' : 'sender'},\n // ExpressionAttributeValues: {':val' : getMessageSender()}\n };\n ddb.putItem(params, function(err, result) {\n if (err) {\n // item exists\n } else {\n //console.log(\"success\");\n }\n data = result;\n sync = false;\n });\n while(sync) {deasync.sleep(100);}\n }", "function startConversation() {\n lmedia = new Twilio.Conversations.LocalMedia();\n Twilio.Conversations.getUserMedia().then(function(mediaStream) {\n lmedia.addStream(mediaStream);\n lmedia.attach('#lstream');\n }, function(e) {\n tlog('We were unable to access your Camera and Microphone.');\n });\n}", "ADD_USER_CONVERSATION (state, user) {\n state.userConversation = user\n }", "@track((undefined, state) => {\n return {action: `enter-attempt-to-channel: ${state.channel.name}`};\n })\n enterChannel(channel){\n\n let addNewMessage = this.props.addNewMessage;\n let updateMessage = this.props.updateMessage;\n\n sb.OpenChannel.getChannel(channel.url, (channel, error) => {\n if(error) return console.error(error);\n\n channel.enter((response, error) => {\n if(error) return console.error(error);\n\n //set app store to entered channel\n this.props.setEnteredChannel(channel);\n //fetch the current participantList to append\n this.fetchParticipantList(channel);\n //fetch 30 previous messages from channel\n this.fetchPreviousMessageList(channel);\n });\n });\n }", "function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}", "function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}", "function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}", "function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}", "function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say('I am a bot that has just joined your team');\n convo.say('You must now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}", "onOpen() {\n const {dataStore, activeUserId, activeTeamId} = this.slack.rtmClient;\n const user = dataStore.getUserById(activeUserId);\n const team = dataStore.getTeamById(activeTeamId);\n this.log(this.formatOnOpen({user, team}));\n }", "function setupChannel() {\r\n\r\n\t\t// Join the general channel\r\n\t\tgeneralChannel.join().then(function(channel) {\r\n\t\t\tconsole.log('Enter Chat room');\r\n\r\n\t\t\t// Listen for new messages sent to the channel\r\n\t\t\tgeneralChannel.on('messageAdded', function(message) {\r\n\t\t\t\tremoveTyping();\r\n\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(message.index);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t// 招待先プルダウンの描画\r\n\t\t\tvar storedInviteTo = storage.getItem('twInviteTo');\r\n\t\t\tgenerateInviteToList(storedInviteTo);\r\n\r\n\t\t\t// 招待先プルダウンの再描画\r\n\t\t\tgeneralChannel.on('memberJoined', function(member) {\r\n\t\t\t\tconsole.log('memberJoined');\r\n\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t});\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('memberLeft', function(member) {\r\n\t\t\t\tconsole.log('memberLeft');\r\n\t\t\t\tgenerateInviteToList();\r\n\t\t\t});\r\n\r\n\t\t\t// Typing Started / Ended\r\n\t\t\tgeneralChannel.on('typingStarted', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing started');\r\n\t\t\t\tshowTyping();\r\n\t\t\t});\r\n\t\t\tgeneralChannel.on('typingEnded', function(member) {\r\n\t\t\t\tconsole.log(member.identity + ' typing ended');\r\n\t\t\t\tclearTimeout(typingTimer);\r\n\t\t\t});\r\n\r\n\t\t\t// 最終既読メッセージindex取得\r\n\t\t\tgeneralChannel.getMembers().then(function(members) {\r\n\t\t\t\tfor (i = 0; i < members.length; i++) {\r\n\t\t\t\t\tvar member = members[i];\r\n\t\t\t\t\tmember.on('updated', function(updatedMember) {\r\n\t\t\t\t\t\tupdateMemberMessageReadStatus(updatedMember.identity, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumedMessageIndex || 0, \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tupdatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t\tconsole.log(updatedMember.identity, updatedMember.lastConsumedMessageIndex, updatedMember.lastConsumptionTimestamp);\r\n\t\t\t\t\t});\r\n\t\t\t\t\tif (identity != member.identity && inviteToNames.indexOf(member.identity) != -1) {\r\n\t\t\t\t\t\treadStatusObj[identity] = member.lastConsumedMessageIndex;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t// Get Messages for a previously created channel\r\n\t\t\t\tgeneralChannel.getMessages().then(function(messages) {\r\n\t\t\t\t\t$chatWindow.empty();\r\n\t\t\t\t\tvar lastIndex = null;\r\n\t\t\t\t\tfor (i = 0; i < messages.length; i++) {\r\n\t\t\t\t\t\tvar message = messages[i];\r\n\t\t\t\t\t\tprintMessage(message.author, message.body, message.index, message.timestamp);\r\n\t\t\t\t\t\tif (message.author != identity) {\r\n\t\t\t\t\t\t\tlastIndex = message.index;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (lastIndex && lastIndex >= 0) {\r\n\t\t\t\t\t\tgeneralChannel.updateLastConsumedMessageIndex(lastIndex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\thideSpinner();\r\n\t\t\t\t\t$('#chat-input').prop('disabled', false);\r\n\t\t\t\t});\r\n\r\n\t\t\t});\r\n\r\n\t\t});\r\n\r\n\t}", "function start() {\n\n gw_job_process.UI();\n gw_job_process.procedure();\n gw_com_module.startPage();\n\n var args = { ID: gw_com_api.v_Stream.msg_openedDialogue };\n gw_com_module.streamInterface(args);\n\n v_global.logic.login_cnt = 0;\n }", "function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.error(err)\n } else {\n convo.say('I am a bot that has just joined your team')\n convo.say('You must now /invite me to a channel so that I can be of use!')\n }\n })\n }\n}", "triggerUserActivity() {\n this._updateUserActivity();\n\n // This case means that recording was once stopped due to inactivity.\n // Ensure that recording is resumed.\n if (!this._stopRecording) {\n // Create a new session, otherwise when the user action is flushed, it\n // will get rejected due to an expired session.\n if (!this._loadAndCheckSession()) {\n return;\n }\n\n // Note: This will cause a new DOM checkout\n this.resume();\n return;\n }\n\n // Otherwise... recording was never suspended, continue as normalish\n this.checkAndHandleExpiredSession();\n\n this._updateSessionActivity();\n }", "async function step1(msgText, report) {\n console.log(\"Steeeeeeep 1111111111111111\");\n\n //Check if we recibe the text from the Quick Replys\n //If it is information we stay in the step\n if (msgText == \"Información\") {\n report[0].responseAuxIndicator = 1\n report[0].responseAux = {\n \"text\": 'Somos el asistente de daños de República Dominicana. Nuestro trabajo consiste en recoger información sobre los daños sufridos por desastre naturales para poder actuar mejor respecto a estos. Estamos a su disposición en caso de que ocurra algo /n Puede compartir nuestro trabajo en sus Redes Sociales: https://www.facebook.com/sharer/sharer.php?u=https%3A//www.facebook.com/Monitoreo-RRSS-Bot-110194503665276/'\n }\n report[0].response = grettingsInfoReply;\n report = fillReport(\"step\", 1, report);\n\n //if it is \"Si\"o \"Reportar daños avanzamos un paso\"\n } else if ((msgText == \"¡Si!\") || (msgText == \"Reportar daños\")) {\n report = nextStep(report);\n report[0].response = safePlaceReply;\n\n //If it is \"No\" remain in the step 1\n } else if (msgText == \"No\") {\n report[0].response = {\n \"text\": \"Nos alegramos de que no haya sufrido ningún problema, muchas gracias\"\n };\n report = fillReport(\"step\", 1, report)\n\n //If the message contains \"no\" and \"app\" we activates the auxiliar conversation for users without writting from the mobile browser\n } else if ((msgText.toLowerCase().includes(\"no\")) && (msgText.includes(\"app\"))) {\n report[0].responseAuxIndicator = 1;\n report[0].responseAux = {\n \"text\": \"De acuerdo, iniciaremos un reporte sin botones\"\n }\n report[0].response = {\n \"text\": \"¿Cual es la causa de los daños producidos?\"\n }\n\n //Change the field fromApp of the report to false and upgrade one step\n report = fillReport(\"fromApp\", false, report)\n\n //if the user dont use the buttons and don´t say No app, we understand that maybe the user can´t see the buttons and \n //inform him/her about the option of having an auxiliar conversation with nobuttons\n } else {\n\n console.log(report[0].response);\n console.log(grettingsReply);\n\n console.log(report[0].response == \"\");\n\n //Checks if the response field is empty. This let us know if the report was just created via writting a msg,\n //so we dont show the auxiliar message, or if we have already made a first reply and the user didnt use the buttons \n if (!report[0].response == \"\") {\n\n report[0].responseAuxIndicator = 1;\n report[0].responseAux = {\n \"text\": 'Si no le aparecen los botones quiere decir que no nos escribe desde la aplicación de messenger. Sería mejor que nos escribiera desde la app. En caso de que este usando el celular y no le sea posible escribanos \"No tengo la app\"'\n };\n }\n report[0].response = grettingsReply;\n\n //maintain the steo to 1 and update the response fields\n report = fillReport(\"step\", 1, report)\n }\n\n //Returns the report object after the pertinent modifications\n return report;\n}", "function sendPrivateMsg(user1, user2, bot, guild) {\n bot.users.fetch(user1, false).then((user) => {\n user.send(\n`>>> You have been matched with <@${user2}>, from ${guild.name}\nIn order to speak with them you must send them a message.\nIf you would like to continue using this service, please re-react to the message in ${guild.name}`);\n });\n\n bot.users.fetch(user2, false).then((user) => {\n user.send(\n`>>> You have been matched with <@${user1}>, from ${guild.name}\nIn order to speak with them you must send them a message.\nIf you would like to continue using this service, please re-react to the message in ${guild.name}`);\n });\n}", "function onInstallation(bot, installer) {\n if (installer) {\n bot.startPrivateConversation({user: installer}, function (err, convo) {\n if (err) {\n console.log(err);\n } else {\n convo.say(\"Hi there, I'm Taylor. I'm a bot that has just joined your team.\");\n convo.say('You can now /invite me to a channel so that I can be of use!');\n }\n });\n }\n}", "async connect() {\n Channel.botMessage('Welcome to Routefusion Chat!\\n\\n');\n this.user = await this.setUser();\n this.greetUser();\n }", "function callUser(user) {\n getCam()\n .then(stream => {\n const video = document.getElementById(\"selfview\");\n try {\n video.srcObject = stream;\n } catch (error) {\n video.src = URL.createObjectURL(stream);\n }\n // document.getElementById(\"selfview\").srcObject = stream;\n\n /*if (window.URL) {\n document.getElementById(\"selfview\").src = window.URL.createObjectURL(stream);\n } else {\n document.getElementById(\"selfview\").src = stream;\n }*/\n\n toggleEndCallButton();\n caller.addStream(stream);\n localUserMedia = stream;\n caller.createOffer().then(function(desc) {\n caller.setLocalDescription(new RTCSessionDescription(desc));\n channel.trigger(\"client-sdp\", {\n \"sdp\": desc,\n \"room\": user,\n \"from\": id\n });\n room = user;\n });\n\n })\n .catch(error => {\n console.log('an error occured', error);\n })\n}", "async captureLocalisation(step) {\n const user = await this.userProfile.get(step.context, {});\n\n // Perform a call to LUIS to retrieve results for the user's message.\n const results = await this.luisRecognizer.recognize(step.context);\n\n // Since the LuisRecognizer was configured to include the raw results, get the `topScoringIntent` as specified by LUIS.\n const topIntent = results.luisResult.topScoringIntent;\n const topEntity = results.luisResult.entities[0];\n\n if (step.result !== -1) {\n\n if (topIntent.intent == 'FindLocalisation') {\n user.localisation = topEntity.entity;\n await this.userProfile.set(step.context, user);\n\n await step.context.sendActivity(`Entity: ${topEntity.entity}`);\n await step.context.sendActivity(`I'm going to find the restaurant at this localisation : ${topEntity.entity}`);\n //return await step.next();\n }\n else {\n //user.localisation = step.result;\n await this.userProfile.set(step.context, user);\n await step.context.sendActivity(`Sorry, I do not understand or say cancel.`);\n return await step.replaceDialog(WHICH_LOCALISATION);\n }\n\n // await step.context.sendActivity(`I will remember that you want this kind of food : ${ step.result } `);\n } else {// si l'user ne sait pas quelle genre de food il veut\n\n const { ActionTypes, ActivityTypes, CardFactory } = require('botbuilder');\n\n const reply = { type: ActivityTypes.Message };\n\n // // build buttons to display.\n const buttons = [\n { type: ActionTypes.ImBack, title: '1. San Francisco', value: '1' },\n { type: ActionTypes.ImBack, title: '2. New York', value: '2' },\n { type: ActionTypes.ImBack, title: '3. Miami', value: '3' }\n ];\n\n // // construct hero card.\n const card = CardFactory.heroCard('', undefined,\n buttons, { text: 'Where do you want to eat 📍?' });\n\n // // add card to Activity.\n reply.attachments = [card];\n\n // // Send hero card to the user.\n await step.context.sendActivity(reply);\n\n }\n //return await step.beginDialog(WHICH_PRICE);\n //return await step.endDialog();\n}", "async onTurn(turnContext) {\n const dialogContext = await this.dialogs.createContext(turnContext);\n\n if (turnContext.activity.type === ActivityTypes.Message) {\n if (dialogContext.activeDialog) {\n await dialogContext.continueDialog();\n } else {\n await dialogContext.beginDialog(MENU_DIALOG);\n }\n } else if (turnContext.activity.type === ActivityTypes.ConversationUpdate) {\n if (this.memberJoined(turnContext.activity)) {\n await turnContext.sendActivity(`Hey there! Welcome to the food bank bot. I'm here to help orchestrate the delivery of excess food to local food banks!`);\n await dialogContext.beginDialog(MENU_DIALOG);\n }\n }\n await this.conversationState.saveChanges(turnContext);\n }", "function onConnectionSuccess(){\n\t\t\tconsole.log(\"onConnectionSuccess getting my display Name ::: \" + _roomCredentials.name);\n\t\t\t\n\t\t _room = _connection.initJitsiConference(_roomCredentials.name, _roomConfOptions);\n\t\t \n\t\t _room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);\n\t\t _room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, function (track) {\n\t\t console.log(\"track removed!!!\" + track);\n\t\t });\n\t\t _room.on(JitsiMeetJS.events.conference.CONFERENCE_JOINED, onConferenceJoined);\n\t\t _room.on(JitsiMeetJS.events.conference.CONFERENCE_FAILED, onConferenceFailed);\n\t\t _room.on(JitsiMeetJS.events.conference.KICKED, onUserKicked);\n\t\t \n\t\t //room.on(JitsiMeetJS.events.conference.USER_JOINED, function(id){ console.log(\"user join\");remoteTracks[id] = [];});\n\t\t _room.on(JitsiMeetJS.events.conference.USER_JOINED, onUserJoined);\n\t\t \n\t\t _room.on(JitsiMeetJS.events.conference.USER_LEFT, onUserLeft);\n\n _room.addCommandListener(CONFERENCE_BROADCAST.MEETING_ENDED,function (values) {\n // onUserKicked();\n\t\t\t\t$rootScope.$broadcast(MEETING_CUSTOM_COMMANDS.CUSTOM_END,values.attributes)\n });\n\n // room.addCommandListener(MEETING_CUSTOM_COMMANDS.MEMBER_REMOVED,function (values) {\n //\n // });\n\n\t\t /* room.on(JitsiMeetJS.events.conference.USER_ROLE_CHANGED, function (id ,role){\n\t\t \t console.log(\"USER_ROLE_CHANGED :: \"+id + \" - \" + role);\n\t\t \t userRole = role;\n\t\t \t console.log(\"USER_ROLE_CHANGED :: userRole ==== \"+userRole);\n\t\t \t var userDisplayName =\"Name : \" + id + \", Role : \" + userRole + \", Id : \" + id;\n\t\t \t var userRemoveRoleName =\"Name : \" + id + \", Role : \" + participantString + \", Id : \" + id;\n\t\t \t \n\t\t \t var index = participentsList.indexOf(userRemoveRoleName);\n\t\t \t if (index > -1) {\n\t\t \t \tparticipentsList.splice(index, 1);\n\t\t \t }\n\t\t \t setParticipentsList(participentsList);\n\t\t \t participentsList.push(userDisplayName);\n\t\t \t if(id === localId){\n\t\t \t\t isModerator = true;\n\t\t \t\t console.log(\"I'm moderator, locking room with password\" + password);\n\t\t \t\t room.lock(password);\n\t\t \t }\n\t\t \t \n\t\t \t getUserList();\n\t\t });\n\t\t \n\t\t \n\t\t */\n\t\t JitsiMeetJS.mediaDevices.addEventListener(JitsiMeetJS.events.mediaDevices.PERMISSION_PROMPT_IS_SHOWN, function(environmentType ){\n\t\t \t//environmentTypes : 'chrome'|'opera'|'firefox'|'iexplorer'|'safari'|'nwjs'|'react-native'|'android'\n\t\t\t\t // alert(\"Enable browser permission to access audio devices for \" + environmentType +\"browser.\" );\n\t\t\t });\n\t\t \n\t\t console.info('Room Joined ');\n\t\t \n\t\t // var password = \"sagar\";\n\t\t _room.setDisplayName(_roomCredentials.displayName);\n\t\t \n\t\t if (! _connectorRole.MODERATOR) {\n\t\t\t console.log(\"not moderator\");\n\t\t\t _room.join(_roomCredentials.password);\n\t\t } else {\n\t\t \tconsole.log(\" moderator\");\n\t\t \t_room.join();\n\t\t \t_room.lock(_roomCredentials.password);\n\t\t }\n\t\t \n\t\t _room.addCommandListener(\"AddedNewParticipant\", function(values){\n\t\t\t console.log(\"========= New participant is added to the conference =============\");\n\t\t });\n\t\t \n\t\t JitsiMeetJS.createLocalTracks({devices: [\"audio\"]}, true).\n\t\t then(onLocalTracks).catch(function (error) {\n\t\t \t console.log(\"connect localtrack erroe=r ::;\");\n\t\t throw error;\n\t\t });\n\t\t \n\t\t _room.addCommandListener(MEETING_CUSTOM_COMMANDS.NEW_MEMBER_ADDED, function (values) {\n\t\t\t console.log(\"MEETING_CUSTOM_COMMANDS.NEW_MEMBER_ADDED ::: \"+angular.toJson(values));\n\t\t\t\t$rootScope.$broadcast(MEETING_CUSTOM_COMMANDS.NEW_MEMBER_ADDED, {userDetails : values,\n\t\t\t});\n\t\t });\n\t\t \n\t\t _room.addCommandListener(MEETING_CUSTOM_COMMANDS.MEMBER_REMOVED, function (values) {\n\t\t\t console.log(\"MEETING_CUSTOM_COMMANDS.MEMBER_REMOVED ::: \"+angular.toJson(values));\n\t\t\t\t$rootScope.$broadcast(MEETING_CUSTOM_COMMANDS.MEMBER_REMOVED, {userDetails : values,\n\t\t\t});\n\t\t });\n\t\t \n\t\t _room.addCommandListener(MEETING_CUSTOM_COMMANDS.MEETING_EXTENDED, function (values) {\n\t\t\t console.log(\"MEETING_CUSTOM_COMMANDS.MEETING_EXTENDED ::: \"+angular.toJson(values));\n\t\t\t\t$rootScope.$broadcast(MEETING_CUSTOM_COMMANDS.MEETING_EXTENDED, values.attributes);\n\t\t });\n\t\t \n\t\t \n\t\t \n\t\t}", "function time_click() {\n\tSASocket.setDataReceiveListener(onreceive);\n\tSASocket.sendData(CHANNELID, \"Hello User\");\n\n}", "function checkConversationPossibility(){\n var obj = {};\n obj = getMessageObj();\n // console.log(\"obj >>\", obj);\n obj[\"job_id\"] = jobId;\n obj[\"name\"] = userName;\n obj[\"resume_id\"] = resumeId;\n obj[\"user_id\"] = user_id;\n obj[\"user_type\"] = user_type;\n obj[\"cid\"] = candidateId;\n obj[\"sll\"] = sll;\n obj[\"all_vars\"] = all_vars;\n socket.emit(\"checkIsConversationPossible\", obj);\n }", "function convertDialogToSituation(dialog) {\n const { userId, date, messages } = dialog;\n const situation = { userId, date, files: [] };\n const downloads = []; // promises to files we should download and save to server\n console.log(\"sit before\", situation);\n messages.forEach((msg, index) => {\n //console.log(msg.text, index);\n const field = dialogs.scenario[index].field;\n\n //если сообщение текстовое - один алгоритм\n if (msg.text) {\n situation[field] = msg.text;\n //если сообщение файловое - другой алгоритм\n } else {\n let fileId = \"\";\n if (msg.photo) {\n fileId = msg.photo[msg.photo.length - 1].file_id;\n }\n if (msg.voice) {\n fileId = msg.voice.file_id;\n }\n let filePromise = downloadAndRenameFile(fileId);\n filePromise.then(fileName => {\n let data = fs.readFileSync(`files/${fileName}`, { encoding: \"base64\" });\n situation.files.push({ name: fileName, data });\n });\n downloads.push(filePromise);\n }\n });\n\n // console.log(\"downloads: \", downloads);\n Promise.all(downloads).then(results => {\n console.log(\"promiseAll\", results);\n console.log(\"situation\", situation);\n fs.writeFileSync(\"tmp/situation.txt\", JSON.stringify(situation));\n //saveToDB(situation);\n //write data to 1C\n console.log(\"config.api1C_host\", config.api1C_host);\n request(\n {\n method: \"POST\",\n url: config.api1C_host,\n headers: {\n Authorization: auth1C\n },\n body: JSON.stringify(situation)\n },\n function(error, response, body) {\n console.log(\"response from 1C\", error, response, body);\n const nikolayId = \"121042827\";\n const rustamId = \"131455605\";\n bot.sendMessage(\n nikolayId,\n \"responce from 1C:\\n\" + JSON.stringify(response, null, 2)\n );\n }\n );\n dialogs.deleteDialog(situation.userId);\n });\n return situation;\n}", "function startConversation(match, res)\n{\n Match.find({ robin: match.ted, ted: match.robin, preference: true }).exec(function(err, matches) {\n if(matches == null || matches.length == 0) {\n return res.json(null);\n }\n matches.forEach(function(temp) {\n\n Conversation.findOne({ participants: {$all : [ temp.barney, match.barney ]}}).exec(function(err, conversation) {\n if (err) return res.send(err);\n if (!conversation)\n {\n Conversation.create({\n robins : [{\n barney : temp.barney,\n robin : temp.robin\n }, {\n barney : match.barney,\n robin : match.robin\n }],\n participants: [ match.barney, temp.barney ],\n unread : [\n {\n user : match.barney,\n unread : false\n },\n {\n user : temp.barney,\n unread : false\n }\n ]\n }, function(err, conversation) {\n if (err) return res.send(err);\n\n // Sends a notification to the person who didn't just swipe\n User.findOne({_id: temp.ted}).exec(function(err, ted) {\n if (err) console.log(err);\n User.findOne({_id: temp.barney}).exec(function(err, barney) {\n if (err) conosle.log(err);\n notifications.send(barney.profile.first_name + \" just got a match for you!\", ted.gcmId, function(err, res) {\n console.log(\"Notification send to: \" + ted._id);\n });\n notifications.sendMatchNotification(ted.profile.first_name, conversation._id, barney.gcmId, function(err, res) {\n console.log(\"Notification send to: \" + barney._id);\n });\n });\n });\n\n User.findOne({_id : match.ted}, function(err, ted) {\n User.findOne({_id : match.barney}, function(err2, barney) {\n notifications.send(barney.profile.first_name + \" just got a match for you!\", ted.gcmId, function(err, res) {\n console.log(\"Notification send to: \" + ted._id);\n });\n })\n })\n\n return res.json({\n \"result\" : 1,\n \"match\" : match,\n \"conversation\" : conversation\n });\n });\n } else {\n return res.json({\n \"result\" : 2,\n \"match\" : match,\n \"conversation\" : conversation\n });\n }\n });\n });\n });\n}", "function doopenchannel() {\n ModalService.showModal({\n templateUrl: \"modals/openchannel.html\",\n controller: \"OpenChannelController\",\n }).then(function(modal) {\n modal.element.modal();\n $scope.$emit(\"child:showalert\",\n \"To open a new channel, enter or scan the remote node id and amount to fund.\");\n modal.close.then(function(result) {\n });\n });\n }", "async function sendToStaff (user) {\n try {\n // prepare message\n let markdown = `${user.email} (${user.id}) has finished provisioning in the Webex CC v4 instant demo.`\n const url = 'https://webexapis.com/v1/messages'\n const token = globals.get('toolbotToken')\n const options = {\n method: 'POST',\n headers: {\n Authorization: 'Bearer ' + token\n },\n body: {\n roomId: globals.get('webexV4ProvisionRoomId'),\n markdown\n }\n }\n // send message\n await fetch(url, options)\n } catch (e) {\n console.log(`failed to notify staff of provision on Webex:`, e.message)\n }\n}", "function setupChannel() {\n // Join the general channel\n generalChannel.join().then(function(channel) {\n print('Joined channel as '\n + '<span class=\"is-owner\">' + username + '</span>.', true);\n });\n\n setTimeout(() => $chatOverlay.slideUp(), 1000);\n\n // Listen for new messages sent to the channel\n generalChannel.on('messageAdded', function(message) {\n printMessage(message.author, message.body);\n });\n }", "postTeamStandupsToChannel() {\n let todayFormatted = moment(today, \"YYYY-MM-DD\").format(\"MMM Do YYYY\")\n let standupUpdate = `*📅 Showing Ona Standup Updates On ${todayFormatted}*\\n\\n`;\n AppBootstrap.userStandupRepo\n .getByDatePosted(today)\n .then(data => {\n let attachments = [];\n\n data.forEach((item, index) => {\n let attachment = {\n color: \"#dfdfdf\",\n title: `<@${item.username}>`,\n fallback:\n \"Sorry Could not display standups in this type of device. Check in desktop browser\",\n fields: [\n {\n title: \"Today\",\n value: `${item.standup_today}`,\n short: false\n }\n ],\n footer: `Posted as ${item.team}`\n };\n if (item.standup_previous != null) {\n const previously = {\n title: \"Yesterday/Previously\",\n value: `${\n item.standup_previous == null\n ? \"Not specified\"\n : item.standup_previous\n }`,\n short: false\n };\n attachment.fields.push(previously);\n }\n if (index === 0) {\n attachment.pretext = `Team ${item.team} Standups`;\n attachment.color = \"#7DCC34\";\n }\n if (index > 0) {\n if (item.team != data[index - 1].team) {\n attachment.pretext = `Team ${item.team} Standups`;\n attachment.color = \"#7DCC34\";\n }\n }\n attachments.push(attachment);\n });\n return Promise.resolve(attachments);\n })\n .then(allAttachments => {\n if (allAttachments.length > 0) {\n web.channels.list().then(res => {\n const channel = res.channels.find(c => c.is_member);\n if (channel) {\n web.chat\n .postMessage({\n text: standupUpdate,\n attachments: allAttachments,\n channel: channel.id\n })\n .then(msg =>\n console.log(\n `Message sent to channel ${channel.name} with ts:${msg.ts}`\n )\n )\n .catch(console.error);\n } else {\n console.log(\n \"This bot does not belong to any channel, invite it to at least one and try again\"\n );\n }\n });\n } else {\n web.channels.list().then(res => {\n let todayFormatted = moment(today, \"YYYY-MM-DD\").format(\"MMM Do YYYY\")\n const channel = res.channels.find(c => c.is_member);\n if (channel) {\n web.chat\n .postMessage({\n text: `*📅 Nothing to show. No standup updates for ${todayFormatted}*`,\n channel: channel.id\n })\n .then(msg =>\n console.log(\n `Message sent to channel ${channel.name} with ts:${msg.ts}`\n )\n )\n .catch(console.error);\n } else {\n console.log(\n \"This bot does not belong to any channel, invite it to at least one and try again\"\n );\n }\n });\n }\n });\n }", "function loginPlayer(){\n\tfitbitSteps = stepCount;\n console.log(userID);\n\tconsole.log(isFirstTimeUser(userID));\n\tconsole.log(fitbitSteps);\n\tif(isFirstTimeUser(userID)){\nconsole.log(\"first timer\");\n\t\tfirstTimeUserSteps();\n\t\tcreateData(initPackage());\n\t} else {\nconsole.log(\"returning player\");\n\t\treturningUserSteps();\n returningUserTracks();\n returningUserArea();\n returningUserParty();\n returningBaseLevels();\n returningUserSeason();\n \n\t\tcreateData(returningPackage(userID));\n\t}\n}", "async captureFood(step) {\n const user = await this.userProfile.get(step.context, {});\n\n // Perform a call to LUIS to retrieve results for the user's message.\n const results = await this.luisRecognizer.recognize(step.context);\n\n // Since the LuisRecognizer was configured to include the raw results, get the `topScoringIntent` as specified by LUIS.\n const topIntent = results.luisResult.topScoringIntent;\n const topEntity = results.luisResult.entities[0];\n\n if (step.result !== -1) {\n\n if (topIntent.intent == 'ChooseTypeOfFood') {\n user.food = topEntity.entity;\n await this.userProfile.set(step.context, user);\n\n //await step.context.sendActivity(`Entity: ${topEntity.entity}`);\n await step.context.sendActivity(`I'm going to find the restaurant to eat : ${topEntity.entity}`);\n //return await step.next();\n }\n else {\n await this.userProfile.set(step.context, user);\n await step.context.sendActivity(`Sorry, I do not understand or say cancel.`);\n return await step.replaceDialog(WHICH_FOOD);\n }\n\n // await step.context.sendActivity(`I will remember that you want this kind of food : ${ step.result } `);\n } else {// si l'user ne sait pas quelle genre de food il veut\n\n const { ActionTypes, ActivityTypes, CardFactory } = require('botbuilder');\n\n const reply = { type: ActivityTypes.Message };\n\n // // build buttons to display.\n const buttons = [\n { type: ActionTypes.ImBack, title: '1. European 🍝 🍲', value: '1' },\n { type: ActionTypes.ImBack, title: '2. Chinese 🍜 🍚', value: '2' },\n { type: ActionTypes.ImBack, title: '3. American 🍔 🍟', value: '3' }\n ];\n\n // // construct hero card.\n const card = CardFactory.heroCard('', undefined,\n buttons, { text: 'What type of restaurant do you want ?' });\n\n // // add card to Activity.\n reply.attachments = [card];\n\n // // Send hero card to the user.\n await step.context.sendActivity(reply);\n\n }\n //return await step.beginDialog(WHICH_PRICE);\n //return await step.endDialog();\n}", "function createPrivateConversationRoom(penPal) {\n\n // Get the ID of the HTML element for this private convo, if there is one\n var roomName = 'private-room-'+penPal.id;\n\n // If HTML for the room already exists, return.\n if ($('#'+roomName).length) {\n return;\n }\n\n var penPalName = penPal.name == \"unknown\" ? (\"User #\"+penPal.id) : penPal.name;\n\n // Create a new div to contain the room\n var roomDiv = $('<div id=\"'+roomName+'\"></div>');\n\n // Create the HTML for the room\n var roomHTML = '<h2>Private conversation with <span id=\"private-username-'+penPal.id+'\">'+penPalName+'</span></h2>\\n' +\n '<div id=\"private-messages-'+penPal.id+'\" style=\"width: 50%; height: 150px; overflow: auto; border: solid 1px #666; padding: 5px; margin: 5px\"></div>'+\n '<input id=\"private-message-'+penPal.id+'\"/> <button id=\"private-button-'+penPal.id+'\">Send message</button\">';\n\n roomDiv.html(roomHTML);\n\n // Add the room to the private conversation area\n $('#convos').append(roomDiv);\n\n // Hook up the \"send message\" button\n $('#private-button-'+penPal.id).click(onClickSendPrivateMessage);\n\n}", "function initDataChannel() {\n dc = pc.createDataChannel(\"chat\", { negotiated: true, id: 0 });\n\n pc.oniceconnectionstatechange = (e) => {\n log(pc.iceConnectionState);\n if (pc.iceConnectionState === \"disconnected\") attemptReconnection();\n };\n dc.onopen = () => {\n console.log(\"chat open\");\n chat.select();\n chat.disabled = false;\n };\n dc.onclose = () => {\n console.log(\"chat closed\");\n };\n dc.onmessage = (e) => log(`> ${e.data}`);\n\n chat.onkeypress = function (e) {\n localStorage.setItem(\"T1\", \"on\");\n if (e.keyCode != 13) return;\n dc.send(this.value);\n log(this.value);\n saveMessage(this.value); //Purely optional and can be removed if not needed\n this.value = \"\";\n };\n }", "getInitiateConversationUI() {\n if (this.props.newSelectedUser !== null) {\n return (\n <div className=\"message-thread start-chatting-banner\">\n <p className=\"heading\">\n You haven't chatted with {this.props.newSelectedUser.username} in a while,\n <span className=\"sub-heading\"> Say Hi.</span>\n </p>\t\t\t\n </div>\n )\n } \n }", "function startChat() {\n let channel = client.join({ user: username});\n \n channel.on(\"data\", onData);\n \n rl.on(\"line\", function(text) {\n client.send({ user: username, text: text }, res => {});\n });\n}", "function setLoggedInGuest(user_response){\n\n\t//set vairables\n\tcurrentUserID = user_response.id;\n\tcurrentUserFirstName = user_response.firstName;\n\tcurrentUserLastName = user_response.lastName;\n\tcurrentUserFullName = user_response.firstName + \" \" + user_response.lastName;\n\tcurrentUserPictureURL = user_response.pictureURL;\n\n\t//echo to console\n\tconsole.log(\"currentUserID: \" + currentUserID);\n\tconsole.log(\"currentUserFirstName: \" + currentUserFirstName);\n\tconsole.log(\"currentUserLastName: \" + currentUserLastName);\n\tconsole.log(\"currentUserFullName: \" + currentUserFullName);\n\tconsole.log(\"currentUserPictureURL: \" + currentUserPictureURL);\n\t\n\t//setup global vars with new user\n\tsetCurrentUserInfo();\n\tuser_list.push(user_response);\n\tuser_id_list.push(user_response.id);\n\t\n\t//enable chat window adn connec to drums\n\t$(\"#drumkit\").show();\n\t$(\"#chat-main-div\").show();\n\trealignSVG();\n\t\n\t$('#login-modal').modal('toggle');\t\n\tstompClient = null;\n\tdrumsConnect();\n\t\n\t//connect to default room\n\tvar defaultRoom = room_list[0];\n\t$(\"#chat-rooms-list\").append(createRoomElement(defaultRoom).attr(\"default_room\",\"true\"));\n\t\n\tjoinRoom(default_room_id, false);\n}", "promptIndividualStandup() {\n let rmUserArr = [];\n this.getUsers().then(res => {\n res.forEach(res => {\n rmUserArr.push(res.username);\n });\n });\n this.getChannelMembers().then(res => {\n let allChannelUsers = res.members;\n allChannelUsers = allChannelUsers.filter(\n item => !rmUserArr.includes(item)\n );\n\n allChannelUsers.forEach(user => {\n this.sendMessageToUser(user, pickRandomPromptMsg());\n });\n });\n }", "function openChat(userID){\n if(page_type=='profile'){\n if($('#TenTimes-Modal .modal-title').text().search('Mutual')>-1){\n $('#TenTimes-Modal').modal('hide');\n }\n }\n showloading();\n channelChat.push(function() {\n channelizeUI.openChatBox(userID);\n });\n channelizeInit.callChannelize();\n}", "function userInfoStartWizardConversation(id) {\n userInfoMap[id].conversationTiming.push({start: +new Date(), end: undefined});\n}", "function handleOffer(offer, name) {\n //********************** \n //Starting a peer connection \n //********************** \n\n //using Google public stun server \n var configuration = {\n \"iceServers\": [{\"url\": \"stun:stun2.1.google.com:19302\"}]\n };\n\n users[contadorOfertas] = name;\n\n yourConn = new RTCPeerConnection(configuration);\n // Setup ice handling\n \n yourConn.connectedUser = name;\n \n yourConn.onicecandidate = function (event) {\n if (event.candidate) {\n send({\n type: \"candidate\",\n candidate: event.candidate,\n name: this.connectedUser\n });\n }\n };\n\n\n yourConn.ondatachannel = function (event) {\n var receiveChannel = event.channel;\n var blob = false;\n var origen = \"\";\n var chat = \"\";\n receiveChannel.onmessage = function (event) { //recibe evento \n if (blob) {\n var blobRecibido = new Blob([event.data], {type: 'audio/wav'});\n makeUrlBlob(blobRecibido);\n nuevaEntradaPlantilla2(origen, chat);\n blob = false;\n chat = \"\";\n } else{\n var info = JSON.parse(event.data);\n\n $('#buttonChat' + (info.chat).substring(5)).attr('class','btn btn-warning');\n\n chat = info.chat;\n if (info.blob) {\n blob = true; \n origen = info.origen;\n } else {\n nuevaEntradaPlantilla(info.origen, info.mensaje, info.chat);\n }\n }\n };\n };\n\n\n //creating data channel \n dataChannel = yourConn.createDataChannel(\"channel1\", {reliable: true});\n dataChannel.binaryType = \"blob\";\n\n dataChannel.onerror = function (error) {\n console.log(\"Ooops...error:\", error);\n };\n\n /* \t\n //when we receive a message from the other peer, display it on the screen \n dataChannel.onmessage = function (event) { \n }; \n */\n dataChannel.onclose = function () {\n\n console.log(\"data channel is closed\");\n };\n\n yourConn.setRemoteDescription(new RTCSessionDescription(offer));\n \n //create an answer to an offer \n yourConn.createAnswer(function (answer) {\n connectionMap.get(users[contadorOfertas]).setLocalDescription(answer);\n send({\n type: \"answer\",\n answer: answer,\n name: users[contadorOfertas]\n });\n contadorOfertas++;\n }, function (error) {\n alert(\"Error when creating an answer\");\n });\n\n\n connectionMap.set(name, yourConn);\n dataChannelMap.set(name, dataChannel);\n\n if (name !== \"admin\"){\n crearChat(name);\n }\n}", "function getChatsForAUser() {\n\n // Send GET request to mongoDB to get all chats associated with a specific userId\n chatFactory.getChatsForAUser(vm.userId).then(\n\n function(response) {\n \n // Zero out the # of channels and direct messages\n $rootScope.numberOfChannels = 0;\n $rootScope.numberOfDirectMessages = 0;\n\n // Display chatgroup names on the view \n $rootScope.chatGroups = response;\n \n // Determine how many chat channels and direct messages the user is subscribed to\n for (var i = 0; i < response.length; i++) {\n if (response[i].groupType !== \"direct\") {\n $rootScope.numberOfChannels++;\n } else {\n $rootScope.numberOfDirectMessages++;\n }\n }\n\n // Send socket.io server the full list of chat rooms the user is subscribed to\n chatFactory.emit('add user', {chatGroups: $rootScope.chatGroups, userid: vm.userId});\n\n // Jump to calendar state\n $state.go('main.calendar');\n },\n\n function(error) {\n\n // Jump to calendar state\n $state.go('main.calendar'); \n\n });\n\n }", "function 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 printValues(){\n /*console.log(inspection_data);\n console.log(report_data);\n console.log(iap_data);\n console.log(business_notes_data);*/\n\n noteBuilder();//should be called in new conversation\n\n}", "function triggerSnapinPostSprinkler(sprinklrChatBotObject) { \n snapInObject = sendGlobalSnapinObjToJson();\n snapInObject.caseNumber = sprinklrChatBotObject;\n snapInObject.sprinklrChatbotRouted = true;//FY21-0502:[Sprinklr Chat Bot] sprinkler chat bot reoted is true only in this scenario.\n saveGlobalSnapinObjToSession(snapInObject);//Added caseNumber to SnapInObject \n //FY22-0203: Sprinklr Chatbot : Retain Chat Context [START]\n if(isResumeSprinklr()){\n document.getElementById(\"cusPreChatSnapinDom\").style.display = \"block\";\n }\n //FY22-0203: Sprinklr Chatbot : Retain Chat Context [END]\n connectToSnapInAgent(snapInObject);\n}", "'click #cb-initial-dialog'( e, t ) {\n e.preventDefault();\n // SET PAGE COUNTS\n t.page.set( 1 );\n t.total.set( 1 );\n let credits = t.$( '#course-builder-credits' ).val()\n , name = t.$( '#course-builder-name' ).val()\n , percent = t.$( '#course-builder-percent' ).val()\n , keys = t.$( '#tags' ).val()\n , role\n , creator_id = Meteor.userId()\n , cid = Meteor.user() &&\n Meteor.user().profile &&\n Meteor.user().profile.company_id\n , roles = Meteor.user() &&\n Meteor.user().roles;\n \n if ( percent == '' ) percent = 1001; //completion is passing\n if ( name == '' || credits == '' ) {\n Bert.alert(\n 'BOTH Course Name AND Credits MUST be filled out!',\n 'danger',\n 'fixed-top',\n 'fa-frown-o'\n );\n return;\n }\n if ( Courses.findOne({ name: name }) != undefined )\n {\n Bert.alert(\n 'There is already a course with that name!',\n 'danger',\n 'fixed-top',\n 'fa-grown-o'\n );\n return;\n }\n if ( roles && roles.teacher ) role = 'teacher';\n if ( roles && roles.admin ) role = 'admin';\n if ( roles && roles.SuperAdmin ) role = 'SuperAdmin';\n \n if ( keys == null ) keys = [\"\"];\n \n Session.set('cinfo', {\n cname: name,\n credits: Number(credits),\n passing_percent: Number(percent),\n keywords: keys,\n icon: \"/img/icon-4.png\",\n company_id: cid,\n creator_type: role,\n creator_id: creator_id\n });\n let my_id = pp.insert({ pages: [] });\n Session.set( 'my_id', my_id );\n t.$( '#intro-modal' ).modal( 'hide' );\n//-----------------------------------------------/INITIAL DIALOG------\n }", "function handleOnAuthenticated(rtmStartData) {\n console.log(`I am the ${rtmStartData.self.name} bot and part of the team\n ${rtmStartData.team.name} but not yet part of channel`);\n}", "openIMChannel(userId) {\n\t\t//Calling API to create IM \n\t\tconst options = {\n\t\t\turl: 'https://slack.com/api/im.open',\n\t\t\tqs: {\n\t\t\t\ttoken: process.env.apiToken,\n\t\t\t\tuser: userId\n\t\t\t}\n\t\t};\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tthis._callRest(options).then((response) => {\n\t\t\t\tconst output = JSON.parse(response);\n\t\t\t\tif(this.logger.isSillyEnabled()) {\n\t\t\t\t\tthis.logger.silly('Output of im open api:-' + JSON.stringify(output));\n\t\t\t\t}\n\t\t\t\tif(output.ok) {\n\t\t\t\t\tresolve(output.channel.id);\n\t\t\t\t} else {\n\t\t\t\t\treject(output.error);\n\t\t\t\t}\n\t\t\t}).catch((error) => {\n\t\t\t\treject(error);\n\t\t\t});\n\t\t});\n\t}", "function sendRequestDetailsToWizard(wizard,user) {\n var fileName = getFilename(user);\n let label = \"u\";\n var text = userInfo[user]['conversationHistory'];\n var userMetadata = getUserData(user);\n var strData = JSON.stringify(userMetadata);\n console.log(\"data to String\", strData);\n\n console.log(\"history\", text);\n\n directBackAndForth(wizard, \"paired up with \"+user);\n directBackAndForth(wizard, \"User wrote:\\n\" + text);\n if(userMetadata!=\"\")\n sendUserDataToWizard(wizard, userMetadata);\n writeTextToFile(fileName, text, label);\n writeTextToFile(fileName, strData, label);\n}", "function C012_AfterClass_Jennifer_StartChat() {\n\tif (!ActorIsGagged()) {\n\t\tActorSetPose(\"\");\n\t\tC012_AfterClass_Jennifer_CurrentStage = 500;\n\t\tGameLogAdd(\"ChatDone\");\n\t\tLeaveIcon = \"\";\n\t\tC012_AfterClass_Jennifer_ChatAvail = false;\n\t} else C012_AfterClass_Jennifer_GaggedAnswer();\n}", "async function chatFiller(socket, user) {\n try {\n //pulls most recent concert and gets start data in valueOf (raw milliseconds)\n let recent = await getMostRecentUpcomingInfo();\n let recentConcertStart = new Date(\n recent.date + \" \" + recent.time\n ).valueOf();\n\n let timenow = new Date().valueOf();\n\n //checks if concert is after current date. If so, defaults to pulling chats 30 min back\n let timelim =\n timenow > recentConcertStart ? recentConcertStart : timenow - 1800 * 1000;\n\n //pull all data from the mongoose database between start of current concert and present time\n let info = await chat\n .find({ time: { $gte: timelim } })\n .sort({ time: 1 })\n .limit(100)\n .hint(\"time_index\");\n //push all messages to the user's chatroom\n info.forEach((message) => {\n socket.emit(\"message\", {\n user: message.user,\n text: message.message,\n });\n });\n } catch (e) {\n console.log(e);\n }\n}", "createTextChannel(){\n return new Promise((resolve, reject) => {\n //create Text Channel\n let channelName = this.player1.user.username + '-vs-' + this.player2.user.username\n let matchAnnounced = false\n //remove special characters from the channel name\n channelName = format_channel_name(channelName)\n\n let channelName2 = channelName;\n log(`channelName2 = ${channelName2}`)\n log(`Trying to create text channel with name: ${channelName}`)\n this.player1.guild.channels.create(channelName,\n {\n type: 'text',\n permissionOverwrites:[{\n type: 'role',\n id:this.player1.guild.id,\n deny:0x400 //'VIEW_CHANNEL'\n },{\n type: 'member',\n id:this.player1.id,\n allow:0x400 //'VIEW_CHANNEL'\n },{\n type: 'member',\n id:this.player2.id,\n allow:0x400 //'VIEW_CHANNEL'\n },{\n type: 'member',\n id:this.player1.guild.me.id, //add's permission for this bot's user to view the channel\n allow:0x400 //'VIEW_CHANNEL'\n }],\n reason: \"match text channel\"\n })\n .then(channel =>{\n this.textChannel = channel\n // TO DO: limit this.textChannel permissions\n this.coreAnnouncementMessage = `${channelName} is now in progress, <@&${matchmakingPlatforms[this.platformIndex].roleIDSpectators}>!\\nPlayers, please proceed to ${channel} to chat with your opponent.`\n //let msg = 'CHALLENGE ACCEPTED! \\nPlease proceed to ' + channel\n\n this.announceChannel.send(this.coreAnnouncementMessage)\n .then(messageSentSuccessfully => {\n this.matchAnnouncement = messageSentSuccessfully\n log('announced message for ' + channel.name)\n matchAnnounced = true\n resolve(this.matchAnnouncement)\n }).catch(err => {\n log('failed to announce ' + channel.name)\n matchAnnounced = false\n reject(err)\n })\n log(this.coreAnnouncementMessage)\n let controlPanelMessageContent = `${this.player1} vs ${this.player2}\\n\\n**Match Control Panel**\\n:unlock: (Default) Allow other people to join chat (text/voice)\\n:lock: Do not allow other people to join chat\\n:white_check_mark: Look for a new opponent\\n:bell: Leave match and change me to Potentially Available\\n:no_bell: Leave match and change me to Do Not Notify`\n this.textChannel.send(controlPanelMessageContent)\n .then(async controlPanelMessage =>{\n this.controlPanelMessage = controlPanelMessage\n await this.controlPanelMessage.react(reactionIdentUnlock)\n await this.controlPanelMessage.react(reactionIdentLock)\n await this.controlPanelMessage.react(matchmakingPlatforms[this.platformIndex].reactionIdentLookingForOpponent)\n await this.controlPanelMessage.react(matchmakingPlatforms[this.platformIndex].reactionIdentPotentiallyAvailable)\n await this.controlPanelMessage.react(matchmakingPlatforms[this.platformIndex].reactionIdentDND)\n })\n .catch(err =>{\n log(`Match channel creation failed. Here's the error:`)\n log(err)\n let errmsg = `MATCH ACCEPTED! ${this.player1} vs ${this.player2}\\n Match channel creation failed. Please DM eachother`\n //let errmsg = 'CHALLENGE ACCEPTED!\\n Match channel creation failed. Please DM eachother'\n this.announceChannel.send(errmsg)\n })\n .then(() => {\n //wait 10 seconds before adding a button for other users to join chat\n //this is to allow time for a player to lock the chat before a non-player jumps in.\n //granted, this is imperfect because the user could react themselves before the bot adds the reaction.\n sleep(delayInSecBeforeNonPlayersCanJoinChat*1000).then(async ()=>{\n //if the match chat isn't locked already\n log('It is now 10 seconds after the match start')\n if(!this.locked && !this.allowOthersToJoinDelayDone){\n log('Conditions met for adding reactions to the announcement')\n try{\n await this.matchAnnouncement.react(reactionIdentUnlock)\n await this.matchAnnouncement.react(reactionIdentGetMatchChannelPermissions)\n this.allowOthersToJoinDelayDone = true\n }\n catch (err) {\n log('Did not add room-join reactions to the match announcement')\n log('Perhaps the room has already been closed? Here\\'s the error:')\n log(err)\n }\n\n }else{\n log('Conditions not met for adding reactions to the announcement')\n }\n })\n })\n //maybe not here, but TO DO: remove any messages from the matchSeek.\n })\n })\n\n\n }", "function dataChannelWasOpened(channel){\n\t\tif(isInitializing === true){\n\t\t\tdocument.getElementById('chat_form').style.display = \"block\";\n\t\t\tisInitializing = false;\n\t\t}\n\n\t\tif(myUserName){\n\t\t\tvar nameMsg = JSON.stringify({\"username\": myUserName});\n\t\t\tchannel.send(nameMsg);\n\t\t}\n\t}", "run (message) {\n const messageArry = message.content.split(' ')\n const args = messageArry.slice(1)\n\n const kUser = message.guild.member(message.mentions.users.first() || message.guild.get(args[0]))\n if (!kUser) return message.channel.send('User cannot be found!')\n const kreason = args.join(' ').slice(22)\n\n // setting up the embed for report/log\n const kickEmbed = new RichEmbed()\n .setDescription(`Report: ${kUser} Kick`)\n .addField('Reason >', `${kreason}`)\n .addField('Time', message.createdAt)\n\n const reportchannel = message.guild.channels.find('name', 'report')\n if (!reportchannel) return message.channel.send('*`Report channel cannot be found!`*')\n\n // Delete the message command\n // eslint-disable-next-line camelcase\n message.delete().catch(O_o => {})\n // Kick the user with reason\n message.guild.member(kUser).kick(kreason)\n // sends the kick report into log/report\n reportchannel.send(kickEmbed)\n // Logs the kick into the terminal\n log(chalk.red('KICK', chalk.underline.bgBlue(kUser) + '!'))\n }", "async function logUserConversation (event, type) {\n if (event.type == \"message\" && event.text) {\n // console.log(event);\n var params = {\n fb_id: event.address.user.id,\n message_body: {\n message: event.text,\n message_type: type,\n }\n }; \n console.log(\"intercept is working\"); \n usersession.newMessageFromBot(params);\n } \n}", "function initiate() {\n console.log(\"Initiating payment channel\");\n\n // this makes sure the time_left counter will be accurate now that output\n // states have changed\n update_escrow_amount();\n\n if (escrow_amount < min_escrow) {\n waiting_to_initiate = true;\n console.log(\"Funding received is too small.\");\n // TODO don't refund user here, just notify them of their error\n jQuery('#repayment_prompt').html(\"The minimum amount to pay is \" + min_escrow + \" satoshis and you paid \" + escrow_amount + \" satoshis\");\n alert(\"The minimum amount to pay is \" + min_escrow + \" satoshis and you paid \" + escrow_amount + \" satoshis\");\n return;\n }\n\n //alert(\"Funding received! Please leave this tab open while you browse the internet.\");\n\n // this makes sure we don't initiate twice\n waiting_to_initiate = false;\n\n // if the websocket breaks, this will tell it to try toreopen same channel\n attempt_reopen_channel = true;\n\n // this creates Consumer object, attaches funding outputs\n create_payment_channel();\n\n set_channel_state(CHANNEL_STATES.INITIATED);\n}", "function generateTeamReport() {\n var dialog1 = {\n 'title': 'Response Form',\n 'customTitle': false,\n 'subText': 'Would you like to generate a team report?'\n };\n \n var dialog2 = {\n 'title': 'Enter Time Tracking Response Link',\n 'subText': 'Please enter the response link to generate team report:'\n };\n \n reportDialog(dialog1, createTeamReport, dialog2);\n}", "function directUserFromMain () {\n if (nextStep == \"View departments, roles, or employees\") {\n // Prompt them which info they would like to view\n viewInfoPrompt()\n // Then capture the response and invoke the direct user from view info function\n .then (response => {\n nextStep = response.itemToView;\n directUserFromViewInfo();\n })\n // If there is an error, log the error\n .catch(err => {if (err) throw err});\n }\n if (nextStep == \"Add new departments, roles, or employees\") {\n // Prompt them for what specific information they would like to add...\n addInfoPrompt()\n // Then capture the response and invoke the direct user from add info function...\n .then (response => {\n nextStep = response.itemToAdd;\n directUserFromAddInfo();\n })\n // If there is an error, log the error\n .catch(err => {if (err) throw err});\n }\n if (nextStep == \"Update the role for an existing employee\") {\n // Prompt them for what specific information they would like to update on role, and for whom they would like to update for\n updateInfoPrompt()\n // Then capture the response and invoke the direct user from updtate info functoin\n .then(response => {\n nextStep = response.itemToUpdate\n directUserFromUpdateInfo();\n })\n // If there is an error, log the error\n .catch(err => {if (err) throw err});\n }\n if (nextStep == \"Finish session\") {\n // Log to the user the session is completed..\n console.log(`\\nsession completed!\\n`);\n // And end the connectoin to the DB...\n endConnectionToSQL();\n return;\n }\n }", "async run(msg, { targetUser }) {\n\t\tsuper.run(msg);\n\n\t\t// Without any target\n\t\tif (targetUser === '') targetUser = msg.author;\n\n\t\t// Requires a valid user.\n\t\tif (!targetUser) \n\t\t\treturn MessagesHelper.selfDestruct(msg, '!lastsac requires a valid user target to provide results.');\n\n\t\t// Default status for last sacrifice date.\n\t\tlet lastSacrificeFmt = 'unknown';\n\n\t\t// Load and format last sacrifice time.\n\t\tconst lastSacSecs = await SacrificeHelper.getLastSacrificeSecs(targetUser.id);\n\t\tif (lastSacSecs) lastSacrificeFmt = TimeHelper.secsLongFmt(lastSacSecs);\n\t\t\n\t\t// Provide the result to the user.\n\t\tconst msgText = `${targetUser.username}'s last sacrifice was: ${lastSacrificeFmt}.`;\n\t\tMessagesHelper.selfDestruct(msg, msgText);\n }", "function User(name, privateKey) {\n const address = sign.getAddress(privateKey)\n const chats = []\n let ignore = false\n\n const color = colorsArray[counter++]\n const log = (txt) => console.log(colors[color](`--${name}: ${txt}`))\n\n return {\n ignore: (_ignore) => {\n ignore = _ignore\n },\n online: () => {\n log(`i'm online`)\n const payload = msg.online.encode(chatPrivateKey, address, privateKey);\n myEmitter.emit(imOnlineMsgTopic, payload);\n },\n join: (chatPrivateKey) => {\n chats.push(chatPrivateKey)\n myEmitter.on(regularMsgTopic, payload => {\n if (ignore) return\n // Ignore unauthorized messages\n const hashOfInterest = msg.regular.getHash(chatPrivateKey, address)\n const { hash, cipher } = msg.regular.decode(payload);\n if (hash === hashOfInterest) {\n const message = crypt.decrypt(cipher, chatPrivateKey)\n log(`received a msg of interest: ${message}`)\n }\n });\n },\n message: (addressRecepient, chatPrivateKey, message) => {\n log(`sent message: ${message}`)\n const cipher = crypt.encrypt(message, chatPrivateKey);\n const payload = msg.regular.encode(chatPrivateKey, addressRecepient, cipher);\n myEmitter.emit(regularMsgTopic, payload);\n },\n chats: () => chats,\n address\n }\n}", "function report(user) {\n if (user) {\n $.post(\"/reportUser\", {sender: username, receiver: user, chatroom: chatroomId}, function (data) {}, \"json\");\n }\n}", "userConnect(req, res) {\n\n // The socket ID of the currently connecting socket\n const socketId = sails.sockets.getId(req)\n\n LiveChat.create({\n socketID: socketId,\n displayName: req.param('displayName'),\n department: req.param('department'),\n subject: req.param('subject'),\n isAwaiting: true,\n user: req.user && req.user.id ? req.user.id : null\n }).exec(function (err, liveChatR) {\n if (err) {\n return res.json({\n error: err,\n errorMessage: err.message\n })\n } else {\n // Notify watchers that a new user has connected\n req.session.livechat = liveChatR\n LiveChat.publishCreate(liveChatR)\n return res.ok()\n }\n })\n }", "function printConversation(conver) {\n const right = document.getElementById(\"right\");\n const sameConversationOpen = right.num === conver.num && right.querySelector(\"section.messages\");\n if (!sameConversationOpen) {\n // if it's not the same conversation we do not need to be careful to not override the footer,\n // cllean it all\n right.innerHTML = \"\";\n }\n const header = right.querySelector(\"header\") || document.createElement('header');\n header.innerHTML = \"\";\n // the header holds all the info about the conversation and the buttons to administrate it\n const conversation = data.conversations[conver.num];\n const participants = conversationParticipants(conversation);\n const name = conversationName(conversation);\n const img = conversationImg(conversation, \"current-conversation-img\");\n header.appendChild(img);\n header.innerHTML +=\n `<div class=\"current-conversation-info\">\n <div class=\"current-conversation-name\">${name}</div>\n <div class=\"current-conversation-participants\">${participants}</div>\n </div>`;\n // if the user is the creator of the conversation AND the conversation is not private\n if (conversation.creator == data.user.id && conversation.private!=1) {\n // we show the options to add or remove participants or leave teh conversation\n header.innerHTML += `\n <div class=\"buttons\">\n <input type=\"button\" class=\"add\" value=\"Add Participant\" onclick=\"addSingleParticipant();\">\n <input type=\"button\" class=\"remove\" value=\"Remove Participant\" onclick=\"removeParticipant();\">\n <input type=\"button\" class=\"exit\" value=\"Leave Conversation\" onclick=\"leaveConversation();\">\n </div>`;\n } else {\n // if the conversation is private there's no possibility of adding or removing users\n // and if you are not the creator you don't have any power either, just the possibility to leave\n header.innerHTML += `\n <div class=\"buttons\">\n <input type=\"button\" class=\"exit\" value=\"Leave Conversation\" onclick=\"leaveConversation();\">\n </div>`;\n }\n if (!sameConversationOpen) {\n right.appendChild(header);\n }\n // here we repaint the message section\n const section = document.createElement('section') || right.querySelector(\"section\");\n section.innerHTML = \"\";\n section.classList.add(\"messages\");\n // ensure only one listener is added to mark the conversation as read once the user reach the bottom of it\n section.onscroll = function() {\n const atTheBottom = this.scrollHeight - this.scrollTop - this.clientHeight < 1;\n if (atTheBottom) {\n // mark as read conversation here\n markConversationAsRead(right.num);\n }\n };\n for (const msg of Object.values(data.conversations[conver.num].messages)) {\n section.appendChild(msgDiv(msg));\n }\n if (!sameConversationOpen) {\n right.appendChild(section);\n }\n if (!sameConversationOpen) {\n // if it's a different conversation we repaint the footer too\n // this has the input text, the button to attach images or files, and the send button\n const footer = document.createElement('footer');\n footer.innerHTML += \n `<form autocomplete=\"off\" id=\"send-message\">\n <input class=\"pill\" type=\"text\" name=\"inputmessage\" placeholder=\"Write here your message…\">\n <label for=\"attachment\">\n <svg id=\"clip\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\">\n <path fill=\"#FFF\" fill-opacity=\"1\" d=\"M1.816 15.556v.002c0 1.502.584 2.912 1.646 3.972s2.472 1.647 3.974 1.647a5.58 5.58 0 0 0 3.972-1.645l9.547-9.548c.769-.768 1.147-1.767 1.058-2.817-.079-.968-.548-1.927-1.319-2.698-1.594-1.592-4.068-1.711-5.517-.262l-7.916 7.915c-.881.881-.792 2.25.214 3.261.959.958 2.423 1.053 3.263.215l5.511-5.512c.28-.28.267-.722.053-.936l-.244-.244c-.191-.191-.567-.349-.957.04l-5.506 5.506c-.18.18-.635.127-.976-.214-.098-.097-.576-.613-.213-.973l7.915-7.917c.818-.817 2.267-.699 3.23.262.5.501.802 1.1.849 1.685.051.573-.156 1.111-.589 1.543l-9.547 9.549a3.97 3.97 0 0 1-2.829 1.171 3.975 3.975 0 0 1-2.83-1.173 3.973 3.973 0 0 1-1.172-2.828c0-1.071.415-2.076 1.172-2.83l7.209-7.211c.157-.157.264-.579.028-.814L11.5 4.36a.572.572 0 0 0-.834.018l-7.205 7.207a5.577 5.577 0 0 0-1.645 3.971z\"></path>\n </svg>\n </label>\n <input type=\"file\" name=\"attachment\" id=\"attachment\">\n <button type=\"submit\">\n <svg id=\"plane\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 -1 28 23\" width=\"24\" height=\"21\">\n <path fill=\"#FFF\" d=\"M5.101 21.757L27.8 12.028 5.101 2.3l.011 7.912 13.623 1.816-13.623 1.817-.011 7.912z\"></path>\n </svg>\n </button>\n </form>`;\n right.appendChild(footer);\n document.getElementById(\"attachment\").addEventListener('change', somethingAttached);\n document.getElementById(\"send-message\").addEventListener('submit', sendMessage);\n }\n section.scrollTop = section.scrollHeight;\n // we ensure the right side has a propriety marked that shows that the current conversation is _this_ one\n right.num = conver.num;\n // and mark the conversation as read since we just opened it\n markConversationAsRead(conver.num);\n}", "function establishRequestChat(surveyResult) {\n\t\t\t\tlogger.debug(\"establishRequestChat with surveyResults\", surveyResult);\n\t\t\t\tif (chat) {\n\t\t\t\t\t//preChatLines : lpCWTagConst.customPreChatLines,\n\t\t\t\t\tvar chatRequest = {\n\t\t\t\t\t\tsuccess : function(data) {\n\t\t\t\t\t\t\t\t\tisAudioOn = true;\n\t\t\t\t\t\t\t\t\tstartSession();\n\t\t\t\t\t\t\t\t} ,\n\t\t\t\t\t\terror : function(data){\n\t\t\t\t\t\t\t\tlogger.debug(\"checkForPreChatSurvey.error\", data);\n\t\t\t\t\t\t\t\testablishRequestChatFailure();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\tcontext: myChatWiz\n\t\t\t\t\t};\n\t\t\t\t\t\n\t\t\t\t\tif(typeof surveyResult != \"undefined\" && surveyResult != null && surveyResult.question && surveyResult.question.length > 0)\n\t\t\t\t\t\tchatRequest.survey = surveyResult;\n\t\t\t\t\t\t\n\t\t\t\t\tchatRequest.skill = skill;\n\t\t\t\t\t//chatRequest.buttonName = lpChatWizButtonName;\n\t\t\t\t\tchatRequest.chatReferrer = lpChatWizButtonName;\n\t\t\t\t\tchatRequest.visitorSessionId = lpVisitorSessionId;\n\t\t\t\t\tchatRequest.siteContainer = lpSiteContainer;\n\t\t\t\t\tchatRequest.runWithRules = true;\n\t\t\t\t\t//chatRequest.invitation = true; /* this flag have to be added to the chat request to highlight that this is a chat request based on the inivtation */\n\t\t\t\t\t\n\t\t\t\t\t// add this for Collaboration Getting the visitorId if we have one\n\t\t\t\t\tif (visitorId) {\n\t\t\t\t\t\tchatRequest.visitorId = visitorId;\n\t\t\t\t\t}\n\n\t\t\t\t\tlogger.debug(\"chatRequest parameters: \", chatRequest);\n\t\t\t\t\tchatWinCloseable = false; //not allow to close\n\t\t\t\t\tvar failedRequest = chat.requestChat(chatRequest);\n\t\t\t\t\t\n\t\t\t\t\tsessionMgr.start();\n\t\t\t\t\t\n\t\t\t\t\tif (failedRequest && failedRequest.error) {\n\t\t\t\t\t\tlogger.debug(\"checkForPreChatSurvey.error2\", failedRequest);\n\t\t\t\t\t\testablishRequestChatFailure();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}", "function startGame(guild,data) {\n\tconsole.log(\"Starting Game\");\n\t\n\tconst villagerRole = guild.roles.find(role => role.name === \"Town\");\n const everyoneRole = guild.roles.find(role => role.name === \"@everyone\");\n\tconst ghostRole = guild.roles.find(role => role.name === \"Dead\");\n const hostRole = guild.roles.find(role => role.name === \"Host\");\n\n\tnumAlive = numPlayer;\n\t\n\tisGameStarted = true;\n\tisDay = true;\n selectRoles(guild,data);\n guild.fetchMembers().then(r => {\n\t\tr.members.array().forEach(user => createUserChannels(user,guild))});\n\t\t\n guild.createChannel('day','text').then(channel => {\n channel.send(\"Welcome \" + villagerRole.toString() + \" to your first day!\");\n channel.overwritePermissions(everyoneRole, { VIEW_CHANNEL: false });\n \tchannel.overwritePermissions( \n\t\t villagerRole, \n\t\t { VIEW_CHANNEL: true });\n channel.overwritePermissions( \n\t\tghostRole, \n\t\t{\tVIEW_CHANNEL: true,\n\t\t\tSEND_MESSAGES: false,\n ADD_REACTIONS: true});\n outputGroups(channel);\n });\n guild.createChannel('dead','text').then(channel => {\n channel.overwritePermissions(everyoneRole, { VIEW_CHANNEL: false });\n channel.overwritePermissions( \n\t\tghostRole, \n\t\t{\tVIEW_CHANNEL: true,\n\t\t\tSEND_MESSAGES: true,\n ADD_REACTIONS: true});\n });\n \n guild.createChannel('night-werewolf','text').then(channel => {\n channel.overwritePermissions(everyoneRole, { VIEW_CHANNEL: false });\n channel.overwritePermissions(hostRole, { VIEW_CHANNEL: true });\n channel.overwritePermissions(ghostRole, { SEND_MESSAGES: false, ADD_REACTIONS: false });\n });\n \n guild.createChannel('day-voice','voice').then(channel => {\n channel.overwritePermissions(everyoneRole, { VIEW_CHANNEL: false });\n channel.overwritePermissions( \n\t\t villagerRole, \n\t\t { VIEW_CHANNEL: true });\n\n\t channel.overwritePermissions( \n\t\t ghostRole, \n\t\t {\tVIEW_CHANNEL: true,\n\t\t\tSPEAK: false});\n \n everyoneGetInHere(guild,channel);\n });\n\t\n guild.channels.find(channel => channel.name === \"join-game\").delete();\n}", "function msg_sit(data){\n\t/** Someone sat down\n\t *\n\t **/\n\tvar seatID = data.seat_no;\n\tvar username = data.info.user;\n\tvar stake = data.info.player_stake;\n\tvar userid = data.info.uid;\n\tSeatList[seatID].sit(username,stake,userid);\n\tif( userid == window.user_info.id){\n\t\twindow.user_info.sit_no = seatID;\n\t\twindow.user_info.userIsSat = true;\n\t\tfor (var i = 0; i < SeatList.length; i++) {\n\t\t\tSeatList[i].removeSeatdownbg();\n\t\t}\n\t\tSeatList[data.seat_no].showStand();\n\t\twindow.chat_dialog.display();\n\t}\n\tSeatList[data.seat_no].removeSeatdownbg();\n}", "function callPendingSurvey()\n {\n var userInfo = getUserInfo(false);\n userInfo.initial_flag = 1;\n userInfo.channel = 'ui';\n userInfo.uid = userInfo.emp_id;\n userInfo.context_type = 'all';\n socket.emit('getsurveylist',userInfo);\n }", "async capturePrice(step) {\n const user = await this.userProfile.get(step.context, {});\n\n const { ActionTypes, ActivityTypes, CardFactory } = require('botbuilder');\n\n const reply = { type: ActivityTypes.Message };\n\n // // build buttons to display.\n const buttons = [\n { type: ActionTypes.ImBack, title: '1. 💰', value: '1' },\n { type: ActionTypes.ImBack, title: '2. 💰💰', value: '2' },\n { type: ActionTypes.ImBack, title: '3. I do not care', value: '3' }\n ];\n\n // // construct hero card.\n const card = CardFactory.heroCard('', undefined,\n buttons, { text: 'For how much do you want to eat ?' });\n\n // // add card to Activity.\n reply.attachments = [card];\n\n // // Send hero card to the user.\n await step.context.sendActivity(reply);\n}", "function InitSessionData(client, userinfo) {\n\tvar clientNum = level.clients.indexOf(client);\n\tvar sess = client.sess;\n\n\tvar value = userinfo['team'];\n\n\tif (value === 's') {\n\t\t// A willing spectator, not a waiting-in-line.\n\t\tsess.team = TEAM.SPECTATOR;\n\t} else {\n\t\tif (level.arena.gametype === GT.TOURNAMENT) {\n\t\t\tsess.team = PickTeam(clientNum);\n\t\t} else if (level.arena.gametype >= GT.TEAM) {\n\t\t\t// Always auto-join for practice arena.\n\t\t\tif (level.arena.gametype === GT.PRACTICEARENA) {\n\t\t\t\tsess.team = PickTeam(clientNum);\n\t\t\t} else {\n\t\t\t\t// Always spawn as spectator in team games.\n\t\t\t\tsess.team = TEAM.SPECTATOR;\n\t\t\t}\n\t\t} else {\n\t\t\tsess.team = TEAM.SPECTATOR;\n\t\t}\n\t}\n\n\tsess.spectatorState = sess.team === TEAM.SPECTATOR ? SPECTATOR.FREE : SPECTATOR.NOT;\n\n\tPushClientToQueue(level.gentities[clientNum]);\n\n\tWriteSessionData(client);\n}", "function setupChannel() {\n\n newChannel.join().then(function(channel) {\n print('Joined channel as ' + username);\n });\n\n // Get the last 5 messages\n newChannel.getMessages(5).then(function (messages) {\n for (var i = 0; i < messages.items.length; i++) {\n if (messages.items[i].author !== undefined) {\n printMessage(newChannel.uniqueName, messages.items[i].author, messages.items[i].body);\n }\n }\n });\n\n // Fired when a new Message has been added to the Channel on the server.\n newChannel.on('messageAdded', function(message) {\n console.log(message.body);\n printMessage(newChannel.uniqueName, message.author, message.body);\n });\n }", "function login(k) {\n\tkey = k;\n\tlocalStorage.setItem(\"keyPair\", JSON.stringify(k));\n\tiris.Channel.initUser(gun, key);\n\tgun.user()\n\t\t.get(\"profile\")\n\t\t.get(\"username\")\n\t\t.on(async (name) => {\n\t\t\tusername = await name;\n\t\t\t$(\"#my-username\").text(username);\n\t\t\t$(\"#my-edit-username\").text(username);\n\t\t});\n\tgun.user()\n\t\t.get(\"profile\")\n\t\t.get(\"avatar\")\n\t\t.on(async (avatar) => {\n\t\t\tavatar = await avatar;\n\t\t\t$(\"#header-content\")\n\t\t\t\t.find(\".profile-avatar\")\n\t\t\t\t.attr(\"src\", generateAvatarURL(avatar));\n\t\t\t$(\"#my-edit-profile\")\n\t\t\t\t.find(\".profile-avatar\")\n\t\t\t\t.attr(\"src\", generateAvatarURL(avatar));\n\t\t\t$(\"#profile-settings-avatar\")\n\t\t\t\t.find(\".profile-avatar\")\n\t\t\t\t.attr(\"src\", generateAvatarURL(avatar));\n\t\t});\n\t$(\"#vibe-page\").show().siblings(\"div#start-page\").hide();\n\tsetOurOnlineStatus();\n\tiris.Channel.getChannels(gun, key, addFriend);\n\tvar chatId =\n\t\thelpers.getUrlParameter(\"vibeWith\") ||\n\t\thelpers.getUrlParameter(\"channelId\");\n\tvar inviter = helpers.getUrlParameter(\"inviter\");\n\tfunction go() {\n\t\tif (inviter !== key.pub) {\n\t\t\tnewFriend(chatId, window.location.href);\n\t\t}\n\t\twindow.history.pushState(\n\t\t\t{},\n\t\t\t\"letsVibe\",\n\t\t\t\"/\" +\n\t\t\t\twindow.location.href\n\t\t\t\t\t.substring(window.location.href.lastIndexOf(\"/\") + 1)\n\t\t\t\t\t.split(\"?\")[0]\n\t\t); // remove param\n\t}\n\tif (chatId) {\n\t\tif (inviter) {\n\t\t\tsetTimeout(go, 2000); // wait a sec to not re-create the same chat\n\t\t} else {\n\t\t\tgo();\n\t\t}\n\t}\n}", "onClientOpened() {\n this.channels = _.keys(this.slack.channels)\n .map(k => this.slack.channels[k])\n .filter(c => c.is_member);\n\n this.groups = _.keys(this.slack.groups)\n .map(k => this.slack.groups[k])\n .filter(g => g.is_open && !g.is_archived);\n\n this.dms = _.keys(this.slack.dms)\n .map(k => this.slack.dms[k])\n .filter(dm => dm.is_open);\n\n console.log(`Welcome to Slack. You are ${this.slack.self.name} of ${this.slack.team.name}`);\n\n if (this.channels.length > 0) {\n console.log(`You are in: ${this.channels.map(c => c.name).join(', ')}`);\n } else {\n console.log('You are not in any channels.');\n }\n\n if (this.groups.length > 0) {\n console.log(`As well as: ${this.groups.map(g => g.name).join(', ')}`);\n }\n\n if (this.dms.length > 0) {\n console.log(`Your open DM's: ${this.dms.map(dm => dm.name).join(', ')}`);\n }\n }", "function beginAnswering() {\n console.log('<<<<<<<<<Begin Answering the SDP Offer');\n console.log('Started: '+isStarted+' LocalStream: '+ localStream +' Channel Ready? '+ isChannelReady);\n if (!isStarted && typeof localStream !== 'undefined' && isChannelReady) {\n callReady();\n //create new RTCPeerConnection\n pc = peerService.beginAnswering(localStream, remoteStream, remoteVideo, isInitiator, dataChannel);\n isStarted = true;\n } else {\n modalOptions.headerText = 'Alert: Failed to answer SDP offer';\n modalOptions.bodyText = 'Please try again.';\n modalService.showModal({}, modalOptions);\n }\n }", "function startConv() {\n if (isCaller) {\n console.log (\"Initiating call...\");\n } else {\n console.log (\"Answering call...\");\n }\n\n // First thing to do is acquire media stream\n navigator.getUserMedia (constraints, onMediaSuccess, onMediaError);\n } // end of 'startConv()'", "async displayFoodChoice(step) {\n const user = await this.userProfile.get(step.context, {});\n if (user.food) {\n await step.context.sendActivity(`Your name is ${ user.name } and you would like this kind of food : ${ user.food }.`);\n } else {\n const user = await this.userProfile.get(step.context, {});\n\n //await step.context.sendActivity(`[${ step.context.activity.text }]-type activity detected.`);\n\n if (step.context.activity.text == 1) {\n user.food = \"European\";\n await this.userProfile.set(step.context, user);\n } else if (step.context.activity.text == 2) {\n user.food = \"Chinese\";\n await this.userProfile.set(step.context, user);\n } else if (step.context.activity.text == 3) {\n user.food = \"American\";\n await this.userProfile.set(step.context, user);\n }else {\n await this.userProfile.set(step.context, user);\n await step.context.sendActivity(`Sorry, I do not understand, please try again.`);\n return await step.beginDialog(WHICH_FOOD);\n }\n\n await step.context.sendActivity(`Your name is ${ user.name } and you would like this kind of food : ${ user.food }.`);\n }\n return await step.beginDialog(WHICH_PRICE);\n //return await step.endDialog();\n}", "function createChats(data){\n if (checkObject(data)) {\n history_found = true;\n for(var i=0; i< data.length; i++){\n \n //create bot message\n if(checkObject(data[i].answers)){\n for(var j=0; j< data[i].answers.length; j++){\n var botMsg = {};\n \n if(data[i].answers[j].answer != null){\n // preserve newlines, etc - use valid JSON\n var ans = data[i].answers[j].answer.replace(/\\\\n/g, \"\\\\n\")\n .replace(/\\\\'/g, \"\\\\'\")\n .replace(/\\\\\"/g, '\\\\\"')\n .replace(/\\\\&/g, \"\\\\&\")\n .replace(/\\\\r/g, \"\\\\r\")\n .replace(/\\\\t/g, \"\\\\t\")\n .replace(/\\\\b/g, \"\\\\b\")\n .replace(/\\\\%/g, \" \")\n .replace(/\\\\f/g, \"\\\\f\");\n // remove non-printable and other non-valid JSON chars\n ans = ans.replace(/[\\u0000-\\u0019]+/g,\"\");\n } else {\n var ans = data[i].answers[j].answer;\n }\n \n \n \n //get answer object\n var answerObj = {};\n try {\n answerObj = JSON.parse(ans);\n } catch(e) {\n // error in the above string (in this case, yes)!\n }\n \n // console.log('answerObj',answerObj);\n \n //create form\n if(answerObj && answerObj.form_data){\n botMsg['form_data'] = answerObj.form_data;\n }\n \n if(answerObj && answerObj.doc_name){\n botMsg['doc_name'] = answerObj.doc_name;\n }\n \n if(answerObj && answerObj.doc_html){\n botMsg['doc_html'] = answerObj.doc_html;\n }\n \n if(answerObj && answerObj.url_list){\n botMsg['url_list'] = answerObj.url_list;\n }\n \n //create buttons\n if (answerObj && answerObj.buttons.length) {\n botMsg['buttons'] = answerObj.buttons;\n }\n \n // botMsg['text'] = data[i].answers[j].answer;\n botMsg['text'] = (answerObj != null && answerObj.answer) ? answerObj.answer : \"\";\n botMsg['time'] = data[i].time;\n \n chatBuildRecieved(botMsg);\n \n }\n }\n \n \n \n //get query object\n var queryObj = {};\n //create user message\n var userMsg = {};\n try {\n queryObj = JSON.parse(data[i].query);\n } catch(e) {\n // error in the above string (in this case, yes)!\n }\n \n if(queryObj.query){\n userMsg['text'] = queryObj.query;\n // userMsg['text'] = data[i].query;\n userMsg['time'] = data[i].time;\n chatBuildSent(userMsg);\n }\n \n }\n if(jQuery('.div-pos-bot').length) {\n \n setTimeout(function(){\n \n jQuery(jQuery('#bot-content')).animate({\n scrollTop: jQuery('.div-pos-bot').offset().top\n }, 1, function(){\n jQuery('.div-pos-bot').removeClass('div-pos-bot');\n jQuery('#bot-content').children('.message-wrapper.me').first().addClass(\"div-pos-bot\");\n \n } );\n \n });\n } else {\n \n jQuery('#bot-content').children('.message-wrapper.me').first().addClass(\"div-pos-bot\");\n scrollBottom();\n }\n \n //disabled all input fields of form\n // jQuery(\".bot-section-div .form_card :input\").prop(\"disabled\", true);\n // jQuery(\".bot-section-div .form_container .btn\").prop(\"disabled\", true);\n // jQuery(\".bot-section-div .form_container .btn\").addClass(\"disabled\");\n \n //disable read more url\n jQuery('#bot-content').children('.message-wrapper.them').find('.readMoreBtnUrl').prop(\"disabled\", true).addClass(\"disabled\");\n \n //disable rating emoji\n jQuery('.emoji-rating').css('cursor', 'default');\n jQuery('.emoji-rating').css('pointer-events', 'none');\n \n //disable calendar\n jQuery('.common-button-sec').addClass('disabled');\n jQuery('.custom-time-button').addClass('disabled');\n jQuery('.calendar-div').addClass('disabled');\n \n // console.log(\"activate\", activate_form);\n \n //disable carousel cell\n // jQuery('#bot-content').find(\".carousel-cell\").not(\".selected-slide\").css('opacity', '0.5');\n \n if(activate_form){\n //activate primary buttons\n jQuery('#bot-content').children().last().find(\".inital-buttons-aiexpert\").css('cursor', 'pointer');\n jQuery('#bot-content').children().last().find(\".inital-buttons-aiexpert\").css('pointer-events', 'all');\n jQuery('#bot-content').children().last().find(\".inital-buttons-aiexpert\").removeClass(\"disabled\");\n \n \n jQuery('#bot-content').children().last().find(\".btn\").prop(\"disabled\", false).removeClass(\"disabled\");\n \n //disabled all input fields of form\n jQuery('#bot-content').children().last().find(\".form_card :input\").prop(\"disabled\", false);\n jQuery('#bot-content').children().last().find(\".form_container .btn\").prop(\"disabled\", false);\n jQuery('#bot-content').children().last().find(\".form_container .btn\").removeClass(\"disabled\");\n \n //disable read more url\n jQuery('#bot-content').children('.message-wrapper.them').last().find('.readMoreBtnUrl').prop(\"disabled\", false).removeClass(\"disabled\");\n \n //disable rating emoji\n jQuery('#bot-content').children().last().find('.emoji-rating').css('cursor', 'pointer');\n jQuery('#bot-content').children().last().find('.emoji-rating').css('pointer-events', 'all');\n \n //disable calendar\n jQuery('#bot-content').children().last().find('.common-button-sec').removeClass('disabled');\n jQuery('#bot-content').children().last().find('.custom-time-button').removeClass('disabled');\n jQuery('#bot-content').children().last().find('.calendar-div').removeClass('disabled');\n \n //to enable edit form if last div contains confirm\n var checkConfirmPresent = jQuery('#bot-content').children().last().find('confirm-button');\n if(checkObject(checkConfirmPresent)){\n jQuery(\".message-wrapper:nth-last-child(2)\").find('input').prop('disabled',false);\n jQuery(\".message-wrapper:nth-last-child(2)\").find('select').prop('disabled',false);\n }\n \n //enable confirm button is last\n jQuery('#bot-content').children().last().find('.confirm-submit-button').css('opacity', '1');\n jQuery('#bot-content').children().last().find('.confirm-submit-button').css('pointer-events', 'all');\n jQuery('#bot-content').children().last().find('input[type=\"checkbox\"]').removeAttr('checked');\n jQuery('#bot-content').children().last().find('.checkmark').show();\n }\n } else { history_found = false; }\n scroll_flag = true;\n }", "async function createConversation(userId, requesterId) {\n if (!await likesHandler.likeEachOther(requesterId, userId)) {\n return false;\n }\n if (await conversationExist(requesterId, userId)) {\n return false;\n }\n await convRep.createEmptyConversation(requesterId, userId)\n return true;\n}", "function setupPM(data){\n var privateID= \"user\" + data + \"-msgs\";\n if(document.getElementById(privateID)){\n document.getElementById(privateID).style.display = \"block\";\n } else {\n var username\n var chatBlock = document.createElement(\"div\");\n chatBlock.setAttribute(\"id\", privateID);\n chatBlock.className = \"chat-block\";\n var nameHeader=document.createElement(\"h3\");\n nameHeader.className =\"nameHeader\";\n nameHeader.appendChild(document.createTextNode(data));\n chatBlock.appendChild(nameHeader);\n var chatUL = document.createElement(\"ul\");\n chatUL.className = \"message-thread\";\n var something = \"appendChatToHere\" + data;\n chatUL.setAttribute(\"id\", something);\n chatBlock.appendChild(chatUL);\n var replyArea = document.createElement(\"div\");\n replyArea.className = \"reply-private\";\n var input = document.createElement(\"input\");\n input.setAttribute(\"type\", \"text\");\n input.className = \"messageInput\";\n var textID = \"pm-\" + data + \"-input\";\n input.setAttribute(\"id\", textID);\n var sendButton = document.createElement(\"button\");\n sendButton.className = \"btn btn-primary btn-md\";\n sendButton.addEventListener(\"click\", sendPrivateMessage);\n sendButton.innerHTML = \"send\";\n sendButton.setAttribute(\"value\", data);\n replyArea.appendChild(input);\n replyArea.appendChild(sendButton);\n chatBlock.appendChild(replyArea);\n document.getElementById(\"chat-page\").appendChild(chatBlock);\n\n var dropdownShow = document.createElement(\"li\");\n var dropdownHide = document.createElement(\"li\");\n var aShow = document.createElement(\"a\");\n var aHide = document.createElement(\"a\");\n\n aShow.setAttribute(\"href\", \"#\");\n aHide.setAttribute(\"href\", \"#\");\n var show = \"show-\" + data;\n aShow.setAttribute(\"id\", show);\n var hide = \"hide-\" + data;\n aHide.setAttribute(\"id\", hide);\n aShow.addEventListener(\"click\", function(){\n document.getElementById(privateID).style.display = \"block\";\n });\n aHide.addEventListener(\"click\", function(){\n document.getElementById(privateID).style.display = \"none\";\n });\n\n aShow.innerHTML = data;\n aHide.innerHTML = data;\n dropdownShow.appendChild(aShow);\n dropdownHide.appendChild(aHide);\n document.getElementById(\"dropdown-show\").appendChild(dropdownShow);\n document.getElementById(\"dropdown-hide\").appendChild(dropdownHide);\n document.getElementById(privateID).style.display = \"block\";\n\n return chatUL;\n }\n }", "processMessage(session) {\n\n let messageText = session.message.text;\n let sender = session.message.address.conversation.id;\n let name=session.message.user.name;\n let username=name.toLowerCase();\n let roletest=\"\";\n console.log(session.message.user.name);\n\n if (messageText && sender) {\n\n console.log(sender, messageText);\n\n if (!this._sessionIds.has(sender)) {\n this._sessionIds.set(sender, uuid.v1());\n }\n\n let apiaiRequest = this._apiaiService.textRequest(messageText,\n {\n sessionId: this._sessionIds.get(sender),\n originalRequest: {\n data: session.message,\n source: \"skype\"\n }\n });\n\n //Gerer la reponse\n apiaiRequest.on('response', (response) => {\n if (this._botConfig.devConfig) {\n console.log(sender, \"Recevoir api.ai reponse\");\n }\n //verifier l'autorisation\n db.any(`SELECT name,role FROM role WHERE name='${username}'`)\n .then(data1=>{\n let role;\n try{\n role=data1[0].role;\n }catch (e) {\n role=\"\";\n }\n //Si le bot a compris la demande\n if (SkypeBot.isDefined(response.result) && SkypeBot.isDefined(response.result.fulfillment)) {\n let responseText = response.result.fulfillment.speech;\n let responseMessages = response.result.fulfillment.messages;\n let intentName=response.result.metadata.intentName;\n let responses;\n let text=\"\";\n let projet;\n let fonction;\n let personne;\n let jalon;\n let doc;\n let sujet;\n\n //Traiter la reponse pour chaque intent dans l'api.ai\n //Demande un nom.\n if(intentName===\"projet_fonction\") {\n let fonction1 = response.result.parameters.fonction1;\n let fonction2 = response.result.parameters.fonction2;\n let fonction3 = response.result.parameters.fonction3;\n let projet1 = response.result.parameters.projet1;\n let projet2 = response.result.parameters.projet2;\n let projet3 = response.result.parameters.projet3;\n if (fonction2 === \"\" && fonction3 === \"\") {\n fonction = fonction1;\n } else if (fonction3 === \"\") {\n fonction = fonction1 + \" \" + fonction2;\n } else {\n fonction = fonction1 + \" \" + fonction2 + \" \" + fonction3;\n }\n if (projet2 === \"\" && projet3 === \"\") {\n projet = projet1;\n } else if (projet3 === \"\") {\n projet = projet1 + \" \" + projet2;\n } else {\n projet = projet1 + \" \" + projet2 + \" \" + projet3;\n }\n fonction=fonction.toLowerCase();\n projet=projet.toLowerCase();\n db.any(`SELECT personne FROM projet WHERE projet='${projet}' AND fonction='${fonction}'`)\n .then(data => {\n console.log(data);\n for (var i in data){\n text=text+data[i].personne+\" \";\n }\n if (text===\"\"){\n this.doRichContentResponse(session,config.messageError);\n } else {\n this.doRichContentResponse(session,text);\n }\n\n })\n .catch(error =>{\n console.log('ERROR:', error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n }\n //Demande les personnes qui travaillent sur un projet et ces fonctions\n else if(intentName===\"projet\"){\n let projet1=response.result.parameters.projet1;\n let projet2=response.result.parameters.projet2;\n let projet3=response.result.parameters.projet3;\n if (projet2===\"\" && projet3===\"\"){\n projet=projet1;\n }else if (projet3===\"\"){\n projet=projet1+\" \"+projet2;\n }else {\n projet=projet1+\" \"+projet2+\" \"+projet3;\n }\n projet=projet.toLowerCase();\n db.any(`SELECT personne,fonction FROM projet WHERE projet='${projet}'`)\n .then(data => {\n for (var i in data){\n text=text+\"La personne: \"+data[i].personne+\" et ca fonction: \"+data[i].fonction+\" \";\n }\n if (text===\"\"){\n this.doRichContentResponse(session,config.messageError);\n } else {\n this.doRichContentResponse(session,text);\n }\n })\n .catch(error =>{\n console.log('ERROR:', error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n }\n //Demande le role d'un personne\n else if (intentName===\"personne\"){\n let prenom=response.result.parameters.prenom1;\n let nom=response.result.parameters.nom1;\n personne=prenom+\" \"+nom;\n personne=personne.toLowerCase();\n db.any(`SELECT projet,fonction FROM projet WHERE personne='${personne}'`)\n .then(data => {\n for (var i in data){\n text=text+\"Le projet: \"+data[i].projet+\" et ca fonction: \"+data[i].fonction+\" \";\n }\n if (text===\"\"){\n this.doRichContentResponse(session,config.messageError);\n } else {\n this.doRichContentResponse(session,text);\n }\n })\n .catch(error =>{\n console.log('ERROR:', error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n }\n //Afficher les données dans la table projet\n else if (intentName===\"list\" && role) {\n let table=response.result.parameters.table1;\n table=table.toLowerCase();\n db.any(config.selectAll)\n .then(data => {\n for (var i in data){\n text=text+\"Le projet: \"+data[i].projet+\" et la fonction: \"+data[i].fonction+\" et le prenom nom: \"+data[i].personne+\" \";\n }\n if (text===\"\"){\n this.doRichContentResponse(session,config.messageError);\n } else {\n this.doRichContentResponse(session,text);\n }\n })\n .catch(error =>{\n console.log('ERROR:', error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n }\n //Si je suis pas un admin\n else if(intentName===\"list\" && !role){\n this.doRichContentResponse(session,config.messageAccess);\n }\n //Demande d'un signifie\n else if (intentName===\"signifie\"){\n let syno=response.result.parameters.syno1;\n syno=syno.toLowerCase();\n db.any(`SELECT def FROM synonyme WHERE synonyme='${syno}'`)\n .then(data => {\n for (var i in data){\n text=text+data[i].def+\" \";\n }\n if (text===\"\"){\n this.doRichContentResponse(session,config.messageError);\n } else {\n this.doRichContentResponse(session,text);\n }\n })\n .catch(error =>{\n console.log('ERROR:', error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n }\n //Demande une date\n else if (intentName===\"date\"){\n let jalon1 = response.result.parameters.date1;\n let jalon2 = response.result.parameters.date2;\n let jalon3 = response.result.parameters.date3;\n let projet1 = response.result.parameters.nom1;\n let projet2 = response.result.parameters.nom2;\n let projet3 = response.result.parameters.nom3;\n if (jalon2 === \"\" && jalon3 === \"\") {\n jalon = jalon1;\n } else if (jalon3 === \"\") {\n jalon = jalon1 + \" \" + jalon2;\n } else {\n jalon = jalon1 + \" \" + jalon2 + \" \" + jalon3;\n }\n if (projet2 === \"\" && projet3 === \"\") {\n projet = projet1;\n } else if (projet3 === \"\") {\n projet = projet1 + \" \" + projet2;\n } else {\n projet = projet1 + \" \" + projet2 + \" \" + projet3;\n }\n jalon=jalon.toLowerCase();\n projet=projet.toLowerCase();\n db.any(`SELECT date FROM date WHERE nomprojet='${projet}' AND jalon='${jalon}'`)\n .then(data => {\n for (var i in data){\n text=text+data[i].date+\" \";\n }\n if (text===\"\"){\n this.doRichContentResponse(session,config.messageError);\n } else {\n this.doRichContentResponse(session,text);\n }\n\n })\n .catch(error =>{\n console.log('ERROR:', error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n }\n //Ajoute une valeure dans la table projet\n else if (intentName===\"insert\" && role){\n let projet1=response.result.parameters.projet1;\n let projet2=response.result.parameters.projet2;\n let projet3=response.result.parameters.projet3;\n let fonction1 = response.result.parameters.fonction1;\n let fonction2 = response.result.parameters.fonction2;\n let fonction3 = response.result.parameters.fonction3;\n let prenom=response.result.parameters.prenom1;\n let nom=response.result.parameters.nom1;\n if (fonction2 === \"\" && fonction3 === \"\") {\n fonction = fonction1;\n } else if (fonction3 === \"\") {\n fonction = fonction1 + \" \" + fonction2;\n } else {\n fonction = fonction1 + \" \" + fonction2 + \" \" + fonction3;\n }\n if (projet2 === \"\" && projet3 === \"\") {\n projet = projet1;\n } else if (projet3 === \"\") {\n projet = projet1 + \" \" + projet2;\n } else {\n projet = projet1 + \" \" + projet2 + \" \" + projet3;\n }\n personne=prenom+\" \"+nom;\n personne=personne.toLowerCase();\n fonction=fonction.toLowerCase();\n projet=projet.toLowerCase();\n if (personne===\"\" || fonction===\"\" || projet===\"\"){\n this.doRichContentResponse(session,config.messageError);\n } else {\n db.any(`SELECT personne FROM projet WHERE projet='${projet}' AND fonction='${fonction}' AND personne='${personne}'`)\n .then(data2 =>{\n for (var i in data2){\n text=data2[i].personne;\n }\n if(text===''){\n db.any(`INSERT INTO projet (projet,fonction,personne) VALUES ('${projet}','${fonction}','${personne}')`)\n .then(data=>{\n this.doRichContentResponse(session,responseText);\n })\n .catch(error =>{\n console.log('ERROR:', error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n } else{\n this.doRichContentResponse(session,config.messageDoneesExistent);\n }\n })\n .catch(error =>{\n console.log('ERROR:', error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n })\n }\n }\n //Si je suis pas un admin\n else if (intentName==='insert' && !role){\n this.doRichContentResponse(session,config.messageAccess);\n }\n //Delete une valeure dans la table projet\n else if (intentName==='delete' && role){\n let projet1=response.result.parameters.projet1;\n let projet2=response.result.parameters.projet2;\n let projet3=response.result.parameters.projet3;\n let prenom=response.result.parameters.prenom1;\n let nom=response.result.parameters.nom1;\n let fonction1 = response.result.parameters.fonction1;\n let fonction2 = response.result.parameters.fonction2;\n let fonction3 = response.result.parameters.fonction3;\n if (projet2 === \"\" && projet3 === \"\") {\n projet = projet1;\n } else if (projet3 === \"\") {\n projet = projet1 + \" \" + projet2;\n } else {\n projet = projet1 + \" \" + projet2 + \" \" + projet3;\n }\n if (fonction2 === \"\" && fonction3 === \"\") {\n fonction = fonction1;\n } else if (fonction3 === \"\") {\n fonction = fonction1 + \" \" + fonction2;\n } else {\n fonction = fonction1 + \" \" + fonction2 + \" \" + fonction3;\n }\n personne=prenom+\" \"+nom;\n personne=personne.toLowerCase();\n projet=projet.toLowerCase();\n fonction=fonction.toLowerCase();\n if (fonction===\"\" && personne===\" \"){\n db.any(`DELETE FROM projet WHERE projet='${projet}'`)\n .then(data=>{\n this.doRichContentResponse(session,responseText);\n })\n .catch(error=>{\n console.log('ERROR:',error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n } else if (fonction===\"\"){\n db.any(`DELETE FROM projet WHERE projet='${projet}' AND personne='${personne}'`)\n .then(data=>{\n this.doRichContentResponse(session,responseText);\n })\n .catch(error=>{\n console.log('ERROR:',error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n } else {\n db.any(`DELETE FROM projet WHERE projet='${projet}' AND fonction='${fonction}' AND personne='${personne}'`)\n .then(data=>{\n this.doRichContentResponse(session,responseText);\n })\n .catch(error=>{\n console.log('ERROR:',error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n })\n }\n }\n //Si je suis pas un admin\n else if (intentName==='delete' && !role){\n this.doRichContentResponse(session,config.messageAccess);\n }\n //Demande une documentation\n else if (intentName==='documentation'){\n doc=response.result.parameters.doc1;\n doc=doc.toLowerCase();\n db.any(`SELECT chemin FROM doc WHERE nom='${doc}'`)\n .then(data=>{\n for (var i in data){\n text=text+data[i].chemin;\n }\n if(text===''){\n this.doRichContentResponse(session,config.messageError);\n }else{\n this.doRichContentResponse(session,text);\n }\n })\n .catch(error=>{\n console.log('ERROR:',error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n })\n }\n //Demande les referents sur un sujet\n else if(intentName==='referents'){\n sujet=response.result.parameters.sujet1;\n sujet=sujet.toLowerCase();\n db.any(`SELECT contact FROM referents WHERE sujet='${sujet}'`)\n .then(data=>{\n for(var i in data){\n text=text+data[i].contact;\n }\n if(text===''){\n this.doRichContentResponse(session,config.messageError);\n }else{\n this.doRichContentResponse(session,text);\n }\n })\n .catch(error=>{\n console.log('ERROR:',error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n })\n }\n //Si api.ai a compris la demande\n else if (SkypeBot.isDefined(responseText)) {\n this.doRichContentResponse(session,responseText);\n } else {\n console.log(sender, 'Recevoir message vide');\n }\n } else {\n console.log(sender, 'Recevoir resulta vide');\n }\n\n })\n .catch(error =>{\n console.log('ERROR1:', error);\n this.doRichContentResponse(session,config.messageServeurErrer);\n });\n\n\n });\n\n apiaiRequest.on('error', (error) => {\n console.error(sender, 'Error quand essayer de connecter avec api.ai', error);\n });\n\n apiaiRequest.end();\n } else {\n console.log('Message vide');\n }\n }", "function setupChannel(generalChannel) {\n\t\t\tactivechannel=true;\n\t\t\t\tgeneralChannel.join().then(function(channel) {\n\t\t\t\tconsole.log(\"join\",channel)\n\t\t\t\t// $chatWindow.removeClass('loader');\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t//=============================Typinh Indicator for particular channel=========================================\n\t\t\t\t//========================================Fisrt time Typing start here(Two function=>1)start and eding =======================\n\t\t\t\t client.on('channelUpdated', updateChannels);\n\t\t\t\tgeneralChannel.on('typingStarted', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingStarted success\")\n\t\t\t\t\t\ttypingMembers.push(member.identity);\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(erro){\n\t\t\t\tconsole.log(\"typingStarted error\",erro)\n\t\t\t\t});\n\t\t\t\tgeneralChannel.on('typingEnded', function(member) {\n\t\t\t\t\t\tconsole.log(\"typingEnded success\")\n\t\t\t\t\t\ttypingMembers.splice(typingMembers.indexOf(member.identity), 1 );\n\t\t\t\t\t\t\n\t\t\t\t\t\tupdateTypingIndicator();\n\t\t\t\t},function(error){\n\t\t\t\t\n\t\t\t\t\t\tconsole.log(\"typingEnded eror\",error)\n\t\t\t\t});\n\t\t\t\t//============================================================Message Removed===============================================================\n\t\t\t\t generalChannel.on('messageRemoved', function(RemoveMessageFlag){\n\t\t\t\t\t\t\tconsole.log(\"removeMessage\",RemoveMessageFlag.state.index);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"#message_\"+RemoveMessageFlag.state.index).remove();\n\t\t\t\t\t\t \n client.on('channelUpdated', updateChannels);\n });\n\t\t\t\t//============================================================Message updated===================================\n\t\t\t generalChannel.on('messageUpdated', function(messageUpdatedFlag){\n\t\t\t\tconsole.log(\"messageUpdated\",messageUpdatedFlag);\n\t\t\t\t\n\t\t\t\t$(\"#editmessage_\"+messageUpdatedFlag.index).text(messageUpdatedFlag.body);\n\t\t\t\t \n\t\t\t \n\t\t\t \n\t\t\t client.on('channelUpdated', updateChannels);\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t });\n\t\t\t\t\n\t\t\t\t//===================================twilio channel message get frist time ==================================================================\n\t\t\t\t\n\t\t\t\tgeneralChannel.getMessages(20).then(function(messages) {\n\t\t\t\t\t\t\t\tconsole.log(\"messages\",messages);\n\t\t\t\t\t\t\t\tactiveMessageChannel=messages;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (messages.hasPrevPage == 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\tScrolldisable = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tScrolldisable = 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\tmsgI=0;\n\t\t\t\t\t\t\t\tLoopMessageShow(messages)\n\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t \n\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\n\t\t\t\t});\n\t\t\t\t \n}", "function confermaFT(){\r\n \"use strict\";\r\n $(\"#fineTurnoDialog\").modal(\"hide\");\r\n\tsocket.emit('nextTurn', \"{}\", function(response) {\r\n\t\t\r\n\t}); \r\n\tsessionStorage.nomeGruppo=nomeGruppo;\r\n\t// salva i log nella sessionStorage\r\n\tvar storedLogs = JSON.parse(sessionStorage.logProduzione);\r\n\tstoredLogs.push(logs);\r\n\tsessionStorage.logProduzione = JSON.stringify(storedLogs);\r\n\t\r\n window.open('reportProduzione.html','_self');\r\n}", "async setUser() {\n return Channel.promptedMessage('What\\'s your username?\\n\\n> ');\n }", "getOrStartConversation(withUserObj, options) {\n return global.window.Talk.ready.then(\n this.getOrStartConversationOnReady.bind(this, withUserObj, options)\n );\n }", "function startMine(user){\n user.mining = true;\n user.mineID = window.setInterval(mine, 3000, user);\n snackbar(\"User: \"+user.name+\" begins mining\");\n // updateUser(user);\n}", "function postTeamStandUpsToChannel() {\n today = moment().format(\"YYYY-MM-DD\");\n let todayFormatted = moment(today, \"YYYY-MM-DD\").format(\"MMM Do YYYY\");\n let standupUpdate = `*📅 Showing Ona Team Standup Updates On ${todayFormatted}*\\n\\n`;\n repos.userStandupRepo.getByDatePosted(today)\n .then(data => {\n let attachments = [];\n data.forEach((item, index) => {\n let attachment = formatTeamsMessageAttachment(item, index, data);\n attachments.push(attachment);\n });\n return Promise.resolve(attachments);\n })\n .then(allAttachments => {\n if (allAttachments.length > 0) {\n postMessageToChannel(standupUpdate, allAttachments);\n } else {\n standupUpdate = `*📅 Nothing to show. No team standup updates for ${todayFormatted}*`;\n postMessageToChannel(standupUpdate, [])\n }\n });\n}", "createNewDirectMessage(){\n let {selectedUsers} = this.props\n let {content} = this.state\n let newDirectMessage = { \n channel: false,\n private: true,\n creator_id: this.state.creatorId,\n title: \"placeholder\",\n }\n this.props.createThread(newDirectMessage, selectedUsers, content)\n .then(action => {\n this.props.history.push(`/client/${action.threadId}`)\n })\n }", "function user_chats(name){\n //clear any current channel from the local storage\n localStorage.setItem('channel', null);\n const request = new XMLHttpRequest();\n request.open('POST', '/direct');\n request.onload = () => {\n const data = JSON.parse(request.responseText);\n //now, we crate a unique indentifier for every private chat,\n //which is the length of the two names of the chatting people\n let all_names = data.current + data.other;\n localStorage.setItem('id', all_names.length);\n localStorage.setItem('name', name);\n //clear nav about any channel aspects\n document.querySelector('#current-channel').innerHTML = '';\n document.querySelector('#users-number').innerHTML = '';\n\n //now get messages btn the two users\n get_user_messages(data);\n }\n const data = new FormData();\n data.append('name', name);\n request.send(data);\n }" ]
[ "0.5840379", "0.56874186", "0.5675624", "0.5628233", "0.55131686", "0.54803413", "0.5475566", "0.5454759", "0.5421371", "0.5414625", "0.5405184", "0.5356118", "0.5349045", "0.5308127", "0.5287822", "0.5276483", "0.52346283", "0.520408", "0.520408", "0.520408", "0.520408", "0.520408", "0.5195482", "0.5148355", "0.5142533", "0.51349086", "0.5126448", "0.51168704", "0.51136345", "0.5113416", "0.5104434", "0.5097117", "0.50928485", "0.5053021", "0.50442797", "0.5042569", "0.5037906", "0.503405", "0.5018043", "0.49998927", "0.49966037", "0.49930787", "0.4960921", "0.4950957", "0.49470422", "0.49402222", "0.49394196", "0.4926244", "0.49250942", "0.492251", "0.49020424", "0.48936817", "0.4892031", "0.48873368", "0.4885727", "0.48842606", "0.48816055", "0.48677763", "0.48660272", "0.4848867", "0.48486218", "0.48477158", "0.48465943", "0.48446983", "0.48445702", "0.4843616", "0.4840417", "0.48381543", "0.4835481", "0.48316088", "0.48310998", "0.4829945", "0.48256558", "0.48243427", "0.48176357", "0.48152354", "0.48065194", "0.47988084", "0.4797573", "0.479685", "0.47968286", "0.47922626", "0.47873473", "0.47871342", "0.47771734", "0.47770265", "0.47726148", "0.47721177", "0.4766634", "0.4764885", "0.47643593", "0.47576362", "0.47559327", "0.4753558", "0.47530288", "0.4749111", "0.4747159", "0.47443238", "0.4739087", "0.47369683" ]
0.69738185
0
when the time to report is hit, report the standup, clear the standup data for that channel
function checkTimesAndReport(bot) { getStandupTimes(function(err, standupTimes) { if (!standupTimes) { return; } var currentHoursAndMinutes = getCurrentHoursAndMinutes(); for (var channelId in standupTimes) { var standupTime = standupTimes[channelId]; if (compareHoursAndMinutes(currentHoursAndMinutes, standupTime)) { getStandupData(channelId, function(err, standupReports) { bot.say({ channel: channelId, text: getReportDisplay(standupReports), mrkdwn: true }); clearStandupData(channelId); }); } } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function clearStandupData(channel) {\n controller.storage.teams.get('standupData', function(err, standupData) {\n if (!standupData || !standupData[channel]) {\n return;\n } else {\n delete standupData[channel];\n controller.storage.teams.save(standupData);\n }\n });\n}", "function discard() {\n\t// Wenn der Timer aktiv ist,...\n\tif(time.Enable) {\n\t\t// ...dann anhalten\n\t\ttime.Stop();\n\t}\n\t\n\t// Die gespielte Zeit in die Statistiken einfließen lassen\n\tstatistics.addSeconds(difficulty, statistics.state.discard, seconds);\n\t// Die aufgedeckte Fläche in die Statistiken einfließen lassen\n\tstatistics.addDiscovered(difficulty, statistics.state.discard, calculateDiscoveredPercent());\n\t\n\t// DIe statistics speichern\n\tPersistanceManager.saveStatistics(statistics);\n}", "function onReport() {\n\t\t\tvar reportTime = t.getTimeBucket();\n\t\t\tvar curTime = reportTime;\n\t\t\tvar missedReports = 0;\n\n\t\t\tif (total === 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// if we had more polls than we expect in each\n\t\t\t// collection period (we allow one extra for wiggle room), we\n\t\t\t// must not have been able to report, so assume those periods were 100%\n\t\t\twhile (total > (POLLS_PER_REPORT + 1) &&\n\t\t\t missedReports <= MAX_MISSED_REPORTS) {\n\t\t\t\tt.set(\"busy\", 100, --curTime);\n\n\t\t\t\t// reset the period by one\n\t\t\t\ttotal -= POLLS_PER_REPORT;\n\t\t\t\tlate = Math.max(late - POLLS_PER_REPORT, 0);\n\n\t\t\t\t// this was a busy period\n\t\t\t\toverallTotal += POLLS_PER_REPORT;\n\t\t\t\toverallLate += POLLS_PER_REPORT;\n\n\t\t\t\tmissedReports++;\n\t\t\t}\n\n\t\t\t// update the total stats\n\t\t\toverallTotal += total;\n\t\t\toverallLate += late;\n\n\t\t\tt.set(\"busy\", Math.round(late / total * 100), reportTime);\n\n\t\t\t// reset stats\n\t\t\ttotal = 0;\n\t\t\tlate = 0;\n\t\t}", "function refreshBadge() {\n curTime--; //first we decrement the time given bc we've waited a sec\n //console.log('leak testing', interval, 'interval ', curTime)\n\n //gotta assess how much time is remaining for our user's period\n if (curTime > 86400) {\n let tempTime = Math.floor(curTime / 86400);\n badgeText = `>${tempTime}d`\n } else if (curTime > 3600) {\n let tempTime = Math.floor(curTime / 3600);\n badgeText = `>${tempTime}h`;\n } else if (curTime > 120) {\n let tempTime = Math.floor(curTime / 60);\n badgeText = `>${tempTime}m`\n } else if (curTime === 2) {\n chrome.action.setBadgeText({ text: '' });\n intervalStorage.clearAll();\n } else if (curTime === 1) {\n chrome.action.setBadgeText({ text: '' });\n intervalStorage.clearAll();\n } else if (curTime <= 0) {\n intervalStorage.clearAll();\n } else {\n badgeText = `${curTime}s`;\n }\n\n //then update the badge with how much time they have left if there's time remaining\n if (curTime > 2) chrome.action.setBadgeText({ text: badgeText });\n //console.log('counting down time, ', curTime);\n }", "function startMeasure(){\n socket.emit( 'newMeasure' );\n var intId = setTimeout( startMeasure, 5000 );\n if (stop == true) {\n console.log(\"Cleared\");\n clearTimeout( intId );\n }\n }", "clearECDistributionCountdown() {\n this.energyChunkDistributionCountdownTimer = 0;\n }", "function resetHUD() {\n score = gscore = tick = 0;\n tTime = 60;\n timeReturn = window.setInterval(mTime, 1000);\n clearMsgs();\n}", "function reportEmptyData(probe) {\n\t\tconst response = `boat ${probe} is online but not reporting data`;\n\t\tbot.sendMessage(process.env.CHAT_ID, response);\n\t\treportNotWorking = probe;\n\t\tconsole.log(response);\n\t}", "resetSW() {\r\n this.hmsElapsed = [];\r\n clearInterval(this.interval);\r\n this.view.playerInfo([\"00\", \"00\", \"00\", \"0\"].join(\":\"));\r\n }", "function clearAgentInfo() {\n console.log('Timer Triggered Server');\n for (var key in Keep_alive_lists) {\n if (Keep_alive_lists.hasOwnProperty(key)) {\n //console.log(\"Server AgentId \"+Keep_alive_lists[key].id);\n //console.log(\"Server Time \"+Keep_alive_lists[key].time);\n if (Keep_alive_lists[key].time == \"\") {\n var id = Keep_alive_lists[key].id.trim();\n //clearSessionId(id);\n //UpdateAgentStatus(id.trim(),Status.AVAILABLE);\n }\n Keep_alive_lists[key].time = \"\";\n }\n }\n}", "function setStandupTime(channel, standupTimeToSet) {\n \n controller.storage.teams.get('standupTimes', function(err, standupTimes) {\n\n if (!standupTimes) {\n standupTimes = {};\n standupTimes.id = 'standupTimes';\n }\n\n standupTimes[channel] = standupTimeToSet;\n controller.storage.teams.save(standupTimes);\n });\n}", "function flush() {\n sendEntries();\n events.length = 0;\n totalLogScore = 0;\n}", "function Clearup() {\n //TO DO:\n EventLogout();\n top.API.Fpi.CancelAcquireData();\n App.Timer.ClearTime();\n }", "buildStatistic() { // builds a statistic and removes values older than 48h\n setTimeout(() => {\n this.detectors.map((detector) =>\n // todo first build a statistic\n SensorDataModel.remove({\n sensor: this._id,\n detectorType: detector.type,\n timestamp: {$gt: moment().subtract(48, 'hours')},\n }).exec((err) => {\n if (err) {\n return logger.error;\n }\n }));\n }\n , STATISTIC_INTERVALL);\n }", "function Clearup() {\n App.Timer.ClearTime();\n }", "function Clearup() {\n App.Timer.ClearTime();\n EventLogout();\n //TO DO:\n }", "function\nclearReport(){\nAssert.reporter.setClear();\n}\t//---clearReport", "function finishCutting(c_num) {\n var user;\n if( c_num == 0 ){\n user = q[0];\n q[0] = null;\n } else if (c_num == 1 ){\n user = q[1];\n q[1] = null;\n } else {\n console.log(\"Lasercutter number not valid\")\n }\n ids.delete(user['email']);\n pulltoCutter();\n calculateTime();\n}", "async refresh({recording = true, sds011 = null, sensehat = null, log = false}) {\n //Dump sensors\n const t = Date.now()\n const {records} = data\n const d = {}\n if (log)\n console.log(`${t} : refreshing data`)\n //Save data\n if (sds011) {\n d.sds011 = await sds011.dump()\n if (records)\n [\"pm10\", \"pm25\"].forEach(k => records[k].push({t, y:d.sds011[k]}))\n }\n if (sensehat) {\n d.sensehat = await sensehat.dump({ledmatrix:true})\n if (recording) {\n ;[\"humidity\", \"pressure\"].forEach(k => records[k].push({t, y:d.sensehat[k]}))\n records.temperature_from_humidity.push({t, y:d.sensehat.temperature.humidity})\n records.temperature_from_pressure.push({t, y:d.sensehat.temperature.pressure})\n records.temperature.push({t, y:.5*(d.sensehat.temperature.humidity+d.sensehat.temperature.pressure)})\n }\n }\n data.dump = d\n //Filter old data\n for (let [key, record] of Object.entries(records))\n records[key] = record.filter(r => r.t >= t - 12*60*60*1000)\n }", "_cleanHits() {\n let now = Date.now();\n let xMilliSecondsAgo = now - this.minsAgoInMilli;\n\n console.log(\"Time now: \", this._toHHMMSS(now));\n console.log(`Time ${this.minsAgo} minute ago: `, this._toHHMMSS(xMilliSecondsAgo));\n\n console.log(\"total hits: \", this.hitsCount[\"totalCount\"]);\n\n\n for (; this.startPointer < xMilliSecondsAgo; this.startPointer++) {\n if (this.hitsCount[this.startPointer]) {\n // we need to delete the oldest visit entries from the total count\n\n // for example, if we logged 10 visits 5 min and 1 milliseconds ago\n // 1) we need to delete that key-value pair from the hash AND\n // 2) we need to subtract 10 visits from \"totalCount\"\n this.hitsCount[\"totalCount\"] -= this.hitsCount[this.startPointer];\n delete this.hitsCount[this.startPointer];\n }\n }\n\n }", "function resetTimer() {\n dashboardTimer = setInterval(function() {\n gridcells.forEach(gridcell => {\n if(gridcell.graph) {\n if(gridcell.graphType == 'Linechart') {\n if(dashboardIsOnline) {\n gridcell.graph.getData(undefined, false);\n } else {\n gridcell.graph.getData(undefined, true);\n }\n } else if(gridcell.graphType == 'Gauge') {\n gridcell.graph.getData(false);\n }\n }\n });\n setCurrentDateAndTime();\n }, refreshSettings.time);\n}", "function Clearup(){\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }", "function updateReporter(time){\n\t\n if(showReporter){\n\n\t\tvar posi=JSON.parse(httpGet(reporterPosiSource)); //Two dimensional array with reporter position\n\n\t\tfor(var i=0;i<posi.length;i++){\n\t\t\tif(typeof(reporterMap[posi[i][0].mac])=='undefined'){\n\t\t\t\n\t\t\t\treporterMap[posi[i][0].mac]=new reporterMarker(posi[i][0]);\n // console.log(reporterMap);\n\t\t\t\t// console.log(\"Add\");\n\t\t\t}else{ \n\t\t\t\treporterMap[posi[i][0].mac].setPosi({\"lat\":parseFloat(posi[i][0].lat),\"lng\":parseFloat(posi[i][0].long)}); \n\t\t\t\treporterMap[posi[i][0].mac].time=parseInt(posi[i][0].ts);\n reporterMap[posi[i][0].mac].rssi=parseInt(posi[i][0].rssi);\n\t\t\t\t// console.log(reporterMap);\n\t\t\t\t// console.log(posi[i][0]);\n\t\t\t}\n\t\t}\n\t\t\n\t}else{\n\n\t\t// Clear memory\n\t\tfor(var key in reporterMap){\n\t\t\treporterMap[key].marker.setMap(null);\n\t\t}\n\t\treporterMap={};\n\t\t\n\t}\n \n window.setTimeout(\"updateReporter(\"+time+\")\",time);\n}", "clearEnergyData() {\n this.batchRemoveSamples( this.dataSamples.slice() );\n this.sampleTimeProperty.reset();\n this.timeSinceSampleSave = 0;\n }", "_removeStatsPusher() {\n if (this._statsPusher) {\n this._holdStatsTimer();\n clearInterval(this._statsPusher);\n this._statsPusher = null;\n }\n }", "function clearWeek(){\n\n let errorExists = false;\n\n pool.getConnection(function(err, connection){\n\n if(_assertConnectionError(err)){\n return;\n }\n \n const streamersReg = [];\n const streamersWhitelist = [];\n connection.query(\"SELECT * FROM list_of_streamers;\",\n function(error, results, fields){\n\n if(errorExists || _assertError(error, connection)){\n errorExists = true;\n return;\n }\n\n for(let row of results){\n streamersReg.push(sql.raw(row[\"channel_id\"] \n + _REGULAR_SUFFIX));\n streamersWhitelist.push(sql.raw(row[\"channel_id\"] \n + _WHITELIST_SUFFIX));\n }\n\n });\n\n connection.query(\"UPDATE ?, ? SET ?.week=0, ?.week=0;\", \n [streamersReg, streamersWhitelist, \n streamersReg, streamersWhitelist], function(error){\n \n if(errorExists || _assertError(error)){\n errorExists = true;\n return;\n }\n\n });\n\n if(!errorExists){\n connection.release();\n }\n\n });\n\n}", "function resetTime () {\nstopClock();\ntimerOff = true;\ntime = 0;\ncountTime();\n}", "function clearSchedule() {\n\t\tvar timeblocks = babysitterScheduleTable.getTimeblocks();\n\t\tfor (var i = 0; i < timeblocks.length; i++) {\n\t\t\tvar block = timeblocks[i];\n\t\t\tfor(var day = block.start.day; day <= block.end.day; day++) {\n\t\t\t\tfor(var time = earliestTimeOnSchedule; time <= latestTimeOnSchedule; time++) {\n\t\t\t\t\tbabysitterScheduleTable.paint(day, time, \"blank\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "static flush() {\n Object.keys(Tracker._computations).forEach(c => Tracker._computations[c].stop());\n }", "cocktailHour() {\n this.cocktails.splice(this.index, 1);\n this.drinks += 1;\n if (this.drinks === 3) {\n this.secondsToSober = 5;\n this.drunk = true;\n drunkDrums.setVolume(0.6);\n drunkDrums.loop();\n setTimeout(() => {\n drunkDrums.stop();\n this.drunk = false;\n this.drinks = 0;\n }, 5000);\n }\n }", "async stop() {\n if(!this.stopped) {\n this.stopped = true;\n\n if(this.timerFull) {\n clearTimeout(this.timerFull);\n this.timerFull = null;\n }\n if(this.timerSnapshot) {\n clearTimeout(this.timerSnapshot);\n this.timerSnapshot = null;\n }\n\n // Send updates one final time, to encompass the last batch of changes\n if(this.isReportServer) {\n await this.writeSnapshot();\n }\n await this.writeFull();\n }\n }", "function reset() {\n clearInterval(myCounter);\n $(\".label\").html(getMessage());\n if (isSession) {\n color = \"#5cb85c\";\n totalTime = $(\"#session\").children(\".value\").html() * 60;\n } else {\n color = \"red\";\n totalTime = $(\"#break\").children(\".value\").html() * 60;\n }\n $(\".timer\").css({\n \"background-color\": color,\n \"border\": \"1px solid \" + color\n });\n count = totalTime;\n timeRemaining = totalTime;\n updateTimer(totalTime);\n updatePie(0);\n}", "clearAllData() {\n this.startTime = 0;\n this.nowTime = 0;\n this.diffTime = 0;\n this.stopTimer();\n this.animateFrame = 0;\n this.gameNumbers = gameNumbers();\n this.colors = setButtonColor();\n this.checkCounter = 0;\n this.isShow = false;\n }", "function init_old_status(sensor, clock_time)\r\n{\r\n sensor.old = false; // start with the assumption msg is not old, update will correct if needed\r\n update_old_status(sensor, clock_time);\r\n}", "function countDown() {\n if (_timeRemaining > 0) {\n\n // This function will be called as frequently as the _refreshRate variable\n // dictates so we reduce the number of milliseconds remaining by the\n // _refreshRate value for accurate timing\n _timeRemaining -= _refreshRate;\n\n // Publish the fact that the remaining time has changed, passing along the\n // new time remaining as a percentage - which will help when we come to display\n // the remaining time on the game board itself\n Frogger.observer.publish(\"time-remaining-change\", _timeRemaining / _timeTotal);\n } else {\n\n // If the remaining time reaches zero, we take one of the player's remaining\n // lives\n loseLife();\n }\n }", "function producedPastHour() {\n let currentTime = new Date();\n let hourago = new Date(currentTime.getTime() - (60 * 60 * 1000));\n let producedKWH = 0;\n //Get the production readings from the past hour on phase 1\n request('http://raspberrypi.local:1080/api/chart/1/energy_pos/from/' + hourago.toISOString() + '/to/' + currentTime.toISOString(), (error, response, body) => {\n let resultJson = JSON.parse(body);\n let values = resultJson[0].values;\n //Accumulate the total amount fed during the past hour\n values.forEach((measurment) => {\n producedKWH += measurment.value;\n });\n\n //Unlock the account for 15000 milliseconds\n Web3Service.unlockAccount(meterAccount, \"1234\", 15000);\n //Execute the produce smart contract\n SmartGridContract.produce(producedKWH, meterAccount);\n });\n}", "function refreshMonitoringData() {\r\n var startDate = new Date();\r\n startDate.setHours(0, 0, 0, 0);\r\n var endDate = new Date();\r\n endDate.setHours(23, 59, 59, 999);\r\n\r\n getAnalysisData()\r\n .then(function (res, status, headers, config) {\r\n calPowerEfficiencyData(res.data.AnalysisData);\r\n refreshPowerEfficiencyPerDevice(res.data);\r\n refreshPowerEfficiencyPerDate(res.data);\r\n })\r\n .catch(function (e) {\r\n var newMessage = 'XHR Failed for getPowerData'\r\n if (e.data && e.data.description) {\r\n newMessage = newMessage + '\\n' + e.data.description;\r\n }\r\n\r\n e.data.description = newMessage;\r\n });\r\n}", "function clearScreen() {\n result.innerHTML = \"\";\n reportInfo.style.display = \"none\";\n }", "function cancelAskingTime(user, channel) {\n controller.storage.teams.get('askingtimes', function(err, askingTimes) {\n\n if (!askingTimes || !askingTimes[channel] || !askingTimes[channel][user]) {\n return;\n } else {\n delete askingTimes[channel][user];\n controller.storage.teams.save(askingTimes); \n }\n }); \n}", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "function Clearup() {\n //TO DO:\n EventLogout();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "function doStandup(bot, user, channel) {\n\n var userName = null;\n\n getUserName(bot, user, function(err, name) {\n if (!err && name) {\n userName = name;\n\n bot.startPrivateConversation({\n user: user\n }, function(err, convo) {\n if (!err && convo) {\n var standupReport = \n {\n channel: channel,\n user: user,\n userName: userName,\n datetime: getCurrentOttawaDateTimeString(),\n yesterdayQuestion: null,\n todayQuestion: null,\n obstacleQuestion: null\n };\n\n convo.ask('What did you work on yesterday?', function(response, convo) {\n standupReport.yesterdayQuestion = response.text;\n \n convo.ask('What are you working on today?', function(response, convo) {\n standupReport.todayQuestion = response.text;\n \n convo.ask('Any obstacles?', function(response, convo) {\n standupReport.obstacleQuestion = response.text;\n \n convo.next();\n });\n convo.say('Thanks for doing your daily standup, ' + userName + \"!\");\n \n convo.next();\n });\n \n convo.next();\n });\n \n convo.on('end', function() {\n // eventually this is where the standupReport should be stored\n bot.say({\n channel: standupReport.channel,\n text: \"*\" + standupReport.userName + \"* did their standup at \" + standupReport.datetime,\n //text: displaySingleReport(bot, standupReport),\n mrkdwn: true\n });\n\n addStandupData(standupReport);\n });\n }\n });\n }\n });\n}", "function Clearup() {\n //TO DO:\n EventLogout();\n top.API.Pin.CancelGetData();\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "function cute()\r\n {\r\n var d = data;\r\n if(d.zeroFill || d.forceZeroFill)\r\n {\r\n if((d.mId !== null || d.forceZeroFill) && seconds <= 9)\r\n seconds = '0' + seconds;\r\n if((d.hId !== null || d.forceZeroFill) && minutes <= 9)\r\n minutes = '0' + minutes;\r\n if((d.dId !== null || d.forceZeroFill) && hours <= 9)\r\n hours = '0' + hours;\r\n }\r\n }", "function dataReset() {\n apiUrl = originalApiUrl;\n timeToScreen = \"\";\n city = \"\";\n currentCondition = \"\";\n iconUrl = originalIconUrl;\n humidity = \"\";\n windSpeed = \"\";\n speedFormat = \"\";\n clouds = \"\";\n }", "function stasisEnd(event, channel) {\n chanArr = null;\n console.log(util.format(\n 'Channel %s just left our application', channel.name));\n }", "function resetHandler() {\n count = 0,\n minutes = 0,\n seconds = 0,\n mseconds = 0;\n }", "function data_ready() {\n // latest two weeks of data... subtract 13 instead of 14 because dtaes\n // are inclusive and -14 gives fencepost error\n var edate = telemetry.midnight(telemetry.maxDate);\n var sdate = telemetry.midnight(add_days(edate, -13));\n draw_dashboard(sdate, edate);\n}", "watchReport () {\n this.unwatchReport = this.$watch('report', () => {\n this.$root.bus.$emit('setReportUrl', null)\n }, { deep: true })\n }", "function _clear() {\n //gGauge$.empty();\n } // _clear", "function countDown(){\n\t\t\ttime--;\n\t\t\tupdate($timer, time);\n\t\t\tif(time <= 0){\n\t\t\t\tgameOver();\n\t\t\t}\t\t\n\t\t}", "function timedCount() {\r\n // context.fillText(c,60,30);\r\n if(c>0 && patient_saved<10 && health>0){\r\n\tc = c - 1;\r\n\t t = setTimeout(function(){ timedCount() }, 1000);\r\n\t }\r\n\telse{\r\n\t\tstopCount();\r\n // t = setTimeout(function(){ timedCount() }, 1000);\r\n\t\t\r\n\t}\r\n}", "_clearState() {\n this.log.debug('[Demux] Clearing demux state');\n\n clearTimeout(this.timeoutId);\n\n for (const sinkData of this.sinkMap.values()) {\n this._sinkClose(sinkData);\n }\n }", "UnscheduleAt(time){\n \tconsole.log(\"unschedule\");\n }", "static set lastReport(value) {}", "function clear() {\n newStats = {\n theyAreReady: false,\n iAmReady: false,\n currentTurn: null,\n firstTurn: null,\n openRows: null,\n history: null,\n future: null,\n iAmRed: null,\n moveStart: null,\n redTime: null,\n bluTime: null,\n winner: null,\n winBy: null,\n theyWantMore: false,\n iWantMore: false,\n };\n Object.assign(stats, newStats);\n }", "function timePassed() {\r\n if (health === 0 || happiness === 0 || hunger === 0) {\r\n clearInterval(timer);\r\n dodo(); \r\n timer =null; \r\n groan();\r\n }\r\n \r\n message();\r\n screen();\r\n i++;\r\n decrease();\r\n changeStar();\r\n changeDonut();\r\n changeHeart();\r\n console.log(i)\r\n console.log(`health: ${health}, happiness: ${happiness}, hunger: ${hunger}`) \r\n }", "function resetTrack(mcpData){\n mcpData.color = \"white\";\n\t for (var i = 0; i < mcpData.segments.length; i++){\n changeTrack(mcpData.segments[i], mcpData.color);\n }\n mcpTable[key(mcpData.name)] = mcpData;\n}", "function timeTick() {\t\n\tif (messagetime != 0) {\n\t\tmessagetime--;\n\t}else{\n\t\tdocument.getElementById(\"fightmess\").innerHTML = \"\";\n\t}\n\tif (manualmessagetime != 0) {\n\t\tmanualmessagetime--;\n\t}else{\n\t\tdocument.getElementById(\"action\").innerHTML = \"&nbsp; <br> &nbsp;\";\n\t}\n\tif (deadmonsterflag == false){\n\t\tcalculatePower();\n\t\tif (power > 0)\n\t\t\tfightmonster();\t\t\t\n\t} else { power = 0; }\n\tupdatesaves();\n\tprintall();\t\n\tsetupHeroes();\n \ttickCount++;\t\t\n}", "analyse() {\n let player = this.player;\n let stats = buildStatsContainer(player);\n\n // should we play clean?\n let most = max(...stats.suits);\n let total = stats.numerals;\n if (this.playClean === false && !this.stopClean && most/total > this.cleanThreshold_high) {\n this.playClean = stats.suits.indexOf(most);\n console.debug(`${player.id} will play clean (${this.playClean})`);\n }\n\n // if we're already playing clean, should we _stop_ playing clean?\n if (this.playClean !== false) {\n if (player.locked.length > 0) {\n let mismatch = player.locked.some(set => set[0].getTileFace() !== this.playClean);\n if (mismatch) { this.playClean = false; }\n }\n if (most/total < this.cleanThreshold_low) { this.playClean = false; }\n if (this.playClean === false) {\n this.stopClean = true;\n console.debug(`${player.id} will stop trying to play clean.`);\n }\n }\n\n // if we haven't locked anything yet, is this gearing up to be a chow hand?\n if (!player.locked.length) {\n let chowScore = stats.cpairs/2 + stats.chows;\n this.playChowHand = (stats.honours <=3 && chowScore >= 2 && stats.pungs < stats.chows);\n // note that this is a fluid check until we claim something, when it locks.\n }\n\n /**\n * THIS CODE HAS BEEN COMMENTED OFF BECAUSE IT IS SUPER SLOW.\n *\n * // Also have a look at possible score improvements\n * let scoring = this.player.rules.determineImprovement(this.player);\n *\n **/\n\n return stats;\n }", "function checkTimesAndAskStandup(bot) {\n getAskingTimes(function (err, askMeTimes) {\n \n if (!askMeTimes) {\n return;\n }\n\n for (var channelId in askMeTimes) {\n\n for (var userId in askMeTimes[channelId]) {\n\n var askMeTime = askMeTimes[channelId][userId];\n var currentHoursAndMinutes = getCurrentHoursAndMinutes();\n if (compareHoursAndMinutes(currentHoursAndMinutes, askMeTime)) {\n\n hasStandup({user: userId, channel: channelId}, function(err, hasStandup) {\n\n // if the user has not set an 'ask me time' or has already reported a standup, don't ask again\n if (hasStandup == null || hasStandup == true) {\n var x = \"\";\n } else {\n doStandup(bot, userId, channelId);\n }\n });\n }\n }\n }\n });\n}", "reset() {\n show(cacheDOM.setButton);\n hide(cacheDOM.setDisplay, cacheDOM.snoozeButton, cacheDOM.stopButton);\n this.alarm.hours = 0;\n this.alarm.minutes = 0;\n this.alarm.isSet = false;\n }", "function countDown(time) {\n //received time should be our time in seconds because we multiply by 60 in our badges\n let curTime = time;\n let badgeText;\n\n //before initiating our interval we do an assessment of how much time is left\n //so that we can initiate the badge.\n if (curTime > 86400) {\n let tempTime = Math.floor(curTime / 86400);\n badgeText = `>${tempTime}d`\n } else if (curTime > 3600) {\n let tempTime = Math.floor(curTime / 3600);\n badgeText = `>${tempTime}h`;\n } else if (curTime > 120) {\n let tempTime = Math.floor(curTime / 60);\n badgeText = `>${tempTime}m`\n } else {\n badgeText = `${curTime}s`;\n }\n\n chrome.action.setBadgeText({ text: badgeText });\n\n //even though i have a named function going into intervals,\n //apparently chrome extension likes them to be wrapped in a function\n //now that I have this cute interval storage we'll use that\n let interval = setInterval(function () { refreshBadge() }, 1000);\n intervalStorage.intervals.add(interval);\n console.log('created new interval', intervalStorage.intervals);\n //including this inside of the countdown function so that it has access\n //to the variables curtime and interval to shut off the interval\n function refreshBadge() {\n curTime--; //first we decrement the time given bc we've waited a sec\n //console.log('leak testing', interval, 'interval ', curTime)\n\n //gotta assess how much time is remaining for our user's period\n if (curTime > 86400) {\n let tempTime = Math.floor(curTime / 86400);\n badgeText = `>${tempTime}d`\n } else if (curTime > 3600) {\n let tempTime = Math.floor(curTime / 3600);\n badgeText = `>${tempTime}h`;\n } else if (curTime > 120) {\n let tempTime = Math.floor(curTime / 60);\n badgeText = `>${tempTime}m`\n } else if (curTime === 2) {\n chrome.action.setBadgeText({ text: '' });\n intervalStorage.clearAll();\n } else if (curTime === 1) {\n chrome.action.setBadgeText({ text: '' });\n intervalStorage.clearAll();\n } else if (curTime <= 0) {\n intervalStorage.clearAll();\n } else {\n badgeText = `${curTime}s`;\n }\n\n //then update the badge with how much time they have left if there's time remaining\n if (curTime > 2) chrome.action.setBadgeText({ text: badgeText });\n //console.log('counting down time, ', curTime);\n }\n}", "_holdStatsTimer() {\n if (this._startTime !== null) {\n this._runningTime += Math.round(Date.now() / 1000) - this._startTime;\n this._startTime = null;\n }\n }", "restForBeatsEach(args){\n if(this._peripheral.AllConnected == false)\n return;\n if (this.inActionC1C2 == true)\n return;\n\n this.inActionC1C2 = true;\n beatsEach = this._clampBeats(args.BEATS); \n durationSecEach = this._beatsToDuration(args, beatsEach); \n console.log(\"durationSec \" + durationSecEach); \n\n TimeDelay = (durationSecEach * 10) + 30;\n\n return new Promise(resolve => {\n var repeat = setInterval(() => {\n this.inActionC1C2 = false;\n clearInterval(repeat);\n resolve();\n console.log(\"clearInterval \");\n }, TimeDelay);\n });\n }", "function timer(){\n countStartGame -= 1;\n console.log(countStartGame);\n if (countStartGame === 0){\n console.log (\"time's up\");\n //need to clear interval - add stop\n }\n}", "function refreshClientGraphs(data){\n\tclients = data.clients\n\t//Refresh a graph with new datapoints\n \tfor (i = 0; i < clients.length; i++){\n \t\t\n \t\t//Chart Type: 0 - Total Send/Recv usage\n \t\tif (chart_type[clients[i].mac] == 0){ \n\n \t\t\tsentpoints = []\n \t\t\trecvpoints = []\n //console.log\n //console.log(\"Here \"+data.timesteps[0]+5+\" - \"+data.timesteps[data.timesteps.length-1]+5)\n for (k = data.timesteps[0]+timestep; k < data.timesteps[data.timesteps.length-1]+timestep; k=k+timestep){\n //console.log(k)\n ys = 0;\n yr = 0;\n \n for (j = 0; j < clients[i][\"report\"].length; j++){\n \t\t\t\t//if (clients[i][\"mac\"] != ap_essid){\n report = clients[i][\"report\"]\n \t\t\t\t//X-Axis\n \t\t\t\t//time = new Date(report[j][0]*1000)\n\n \t\t\t\t//Y-Axis\n if (report[j][0] > k-timestep && report[j][0] <= k){\n ys += report[j][1][\"sent\"]\n yr += report[j][1][\"recv\"]\n }\n else if (report[j][0] > k){\n break;\n }\n \t\t\t}\n\n sentpoints.push({x: k*1000, y: ys})\n recvpoints.push({x: k*1000, y: yr})\n //console.log(sentpoints)\n\n }\n\n\t \t\tchartdata = {\n\t\t\t\tdatasets: [\n\t\t\t\t\t\t\t{label: 'Sent',\n\t\t\t\t\t data: sentpoints,\n\t\t\t\t\t fill: false,\n\t\t\t\t\t borderColor: colors.red,\n\t\t\t\t\t pointRadius: 3},\n\n\t\t\t\t\t \t{label: 'Recieved',\n\t\t\t\t\t data: recvpoints,\n\t\t\t\t\t fill: false,\n\t\t\t\t\t borderColor: colors.blue,\n\t\t\t\t\t pointRadius: 3}\n\t\t\t\t \t]\n\t\t\t}\n\n //Destroy the Previous Chart\n try{charts[clients[i].mac].destroy()}\n catch(err){/*Don't Worry be Happy*/}\n\n\t\t\tcharts[clients[i].mac] = new Chart(clients[i].mac+\"_chart\", {\n\t\t type: 'line',\n\t\t data: chartdata,\n\t\t options: options\n\t\t\t});\n\t\t}\n\n\t\t//Chart Type: 1 - UDP/TCP\n\t\telse if (chart_type[clients[i].mac] == 1){\n\n\t\t\tudppoints = []\n\t\t\ttcppoints = []\n\n for (k = data.timesteps[0]+timestep; k < data.timesteps[data.timesteps.length-1]+timestep; k=k+timestep){\n \n yu = 0;\n yt = 0;\n \n for (j = 0; j < clients[i][\"report\"].length; j++){\n //if (clients[i][\"mac\"] != ap_essid){\n report = clients[i][\"report\"]\n //X-Axis\n //time = new Date(report[j][0]*1000)\n\n //Y-Axis\n if (report[j][0] > k-timestep && report[j][0] <= k){\n yu += report[j][1][\"udp\"]\n yt += report[j][1][\"tcp\"]\n }\n else if (report[j][0] > k){\n break;\n }\n }\n\n udppoints.push({x: k*1000, y: yu})\n tcppoints.push({x: k*1000, y: yt})\n\n }\n\n\t \t\tchartdata = {\n\t\t\t\tdatasets: [\n\t\t\t\t\t\t\t{label: 'UDP',\n\t\t\t\t\t data: udppoints,\n\t\t\t\t\t fill: false,\n\t\t\t\t\t borderColor: colors.red,\n\t\t\t\t\t pointRadius: 3},\n\n\t\t\t\t\t \t{label: 'TCP',\n\t\t\t\t\t data: tcppoints,\n\t\t\t\t\t fill: false,\n\t\t\t\t\t borderColor: colors.blue,\n\t\t\t\t\t pointRadius: 3}\n\t\t\t\t \t]\n\t\t\t}\n\n //Destroy the Previous Chart\n try{charts[clients[i].mac].destroy()}\n catch(err){/*Don't Worry be Happy*/}\n\n\n\t\t\tcharts[clients[i].mac] = new Chart(clients[i].mac+\"_chart\", {\n\t\t type: 'line',\n\t\t data: chartdata,\n\t\t options: options\n\t\t\t});\n\t\t}\n\t\t\n\t\t//Chart Type: 3 - Portwise Chart\n\t\telse if (chart_type[clients[i].mac] == 2){\n\t\t //DO THIS PORTWISE\n\t\t //PICK TOP PORTS, otherwise it'll be impossible to read.\n\t\t no1points = []\n\t\t no2points = []\n\t\t no3points = []\n\t\t otherpoints = []\n\t\t var ports = clients[i][\"report\"][0][1][\"ports\"]\n\t\t for (k = data.timesteps[0]+timestep; k < data.timesteps[data.timesteps.length-1]+timestep; k=k+timestep){\n\t\t\tfor(m = 1; m < clients[i][\"report\"].length; m++) {\n\t\t\t if (clients[i][\"report\"][m][0] > k-timestep && clients[i][\"report\"][m][0] <= k){\n\t\t\t\tfor(key in clients[i][\"report\"][m][1][\"ports\"]) {\n\t\t\t\t if(ports[key] === undefined) {\n\t\t\t\t\tports[key] = clients[i][\"report\"][m][1][\"ports\"][key]\n\t\t\t\t }\n\t\t\t\t else {\n\t\t\t\t\tports[key] += clients[i][\"report\"][m][1][\"ports\"][key]\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t }\n\t\t\t}\n\t\t }\n\n\t\t var report = Object.keys(ports).map(function(key) { return [key, ports[key]]; });\n\t\t report.sort(function(first, second) { return second[1] - first[1]; });\n\t\t topports = [report[0][0], report[1][0], report[2][0]]\n\n\t\t for (k = data.timesteps[0]+timestep; k < data.timesteps[data.timesteps.length-1]+timestep; k=k+timestep){\n\t\t\t\n\t\t\ty1 = 0;\n\t\t\ty2 = 0;\n\t\t\ty3 = 0;\n\t\t\tyo = 0;\n\t\t\tfor (j = 0; j < clients[i][\"report\"].length; j++){\n report = clients[i][\"report\"]\n\n if (report[j][0] > k-timestep && report[j][0] <= k){\n\t\t\t\ty1 += report[j][1][\"ports\"][topports[0]]\n\t\t\t\ty2 += report[j][1][\"ports\"][topports[1]]\n\t\t\t\ty3 += report[j][1][\"ports\"][topports[2]]\n\n\t\t\t\tcount = 0;\n\t\t\t\tfor(key in report[j][1][\"ports\"]) {\n\t\t\t\t if(key != topports[0] && key != topports[1]&& key != topports[2]) {\n\t\t\t\t\tcount += report[j][1][\"ports\"][key]\n\t\t\t\t }\n\t\t\t\t}\n\t\t\t\tyo += count\n }\n else if (report[j][0] > k){\n\t\t\t\tbreak;\n }\n\t\t\t}\n\n\t\t\tno1points.push({x: k*1000, y: y1})\n\t\t\tno2points.push({x: k*1000, y: y2})\n\t\t\tno3points.push({x: k*1000, y: y3})\n\t\t\totherpoints.push({x: k*1000, y: yo})\n\n\t\t }\n\n\t \t chartdata = {\n\t\t\tdatasets: [\n\t\t\t {label: topports[0],\n\t\t\t data: no1points,\n\t\t\t fill: false,\n\t\t\t borderColor: colors.red,\n\t\t\t pointRadius: 3},\n\t\t\t \n\t\t\t {label: topports[1],\n\t\t\t data: no2points,\n\t\t\t fill: false,\n\t\t\t borderColor: colors.blue,\n\t\t\t pointRadius: 3},\n\n\t\t\t {label: topports[2],\n\t\t\t data: no3points,\n\t\t\t fill: false,\n\t\t\t borderColor: colors.green,\n\t\t\t pointRadius: 3},\n\n\t\t\t {label: 'Other',\n\t\t\t data: otherpoints,\n\t\t\t fill: false,\n\t\t\t borderColor: colors.black,\n\t\t\t pointRadius: 3}\n\t\t\t]\n\t\t }\n\t\t try{charts[clients[i].mac].destroy()}\n\t\t catch(err){/*Don't Worry be Happy*/}\n\n\n\t\t charts[clients[i].mac] = new Chart(clients[i].mac+\"_chart\", {\n\t\t type: 'line',\n\t\t data: chartdata,\n\t\t options: options\n\t\t });\n\t\t}\n\t \n\n\t\t//Chart Type: 4 - Portwise Chart\n\t\telse{\n\t\t\t//Some Default.\n\t\t}\n\n\n\t}\n}", "function refresh() {\n deleteCards();\n createNewDeck();\n createStars();\n moves = 0;\n second = 0;\n minute = 0;\n hour = 0;\n matchedCards = 0;\n timer.innerHTML = minute+\" min \"+second+\" sec\";\n}", "function reset() {\n Consts.stockTime = 0;\n Consts.currStatus = Status.stopped;\n clearInterval(incrementSecondMethod);\n $('#statusToggle').val('Start');\n}", "updateFighterStatus(){ logMessage( 'class FightState updateFighterStatus: do nothing', 'logUpdateFighterStatus' ); }", "function reset() {\n console.log(\"resetting graphs and indicators\");\n G1.reset();\n G2.reset();\n G3.reset();\n\n\n var trialTime = Date.now() - trialStartTime;\n console.log(trialTime);\n trialData.push(new TrialInfo(numTrialsCompleted, trialTime, G1.numPoints, G2.numPoints, G3.numPoints) );\n\n touchEnded = false;\n enableTrial = false;\n numTrialsCompleted ++;\n\n G1.poiSelected = false;\n G2.poiSelected = false;\n G3.poiSelected = false;\n\n displayG1 = false;\n displayG2 = false;\n displayG3 = false;\n\n if(G1.stopCondReached && G2.stopCondReached && G3.stopCondReached) {\n endExperiment();\n } else \n choosePOI();\n}", "function uiLog_flush() {\n _uiLog_flushSet = null;\n\n // nothing to flush?\n if(_uiLog_entries.length == 0)\n return;\n\n // prepare log for transfer\n var log = \"\";\n for(var i = 0; i < _uiLog_entries.length; i++) {\n // get an entry\n var entry = _uiLog_entries[i];\n\n // add the entry to the log\n log += entry[\"time\"] + \"\\t\" +\n entry[\"event\"] + \"\\t\" +\n entry[\"target\"] + \"\\t\" +\n entry[\"id\"];\n for(var j = 0; j < entry[\"paramNumber\"]; j++)\n // parameters can have new lines and other special characters\n log += \"\\t\" + escape(entry[\"param\"+j]);\n\n log += \"\\n\";\n }\n\n // use commFrame to communicate to the backend\n top.code.comm_scheduleLoad(\"/uiLog.php?log=\"+escape(log));\n\n // clean up the log\n _uiLog_entries = new Array();\n}", "function C012_AfterClass_Amanda_Ungag() {\n\tActorUngag();\n\tC012_AfterClass_Amanda_CalcParams();\n\tCurrentTime = CurrentTime + 50000;\n}", "function clearTime() {\n lcd.setCursor(0, 10);\n lcd.setTextSize(4);\n lcd.setTextColor(ili9341.ILI9341_BLACK);\n if (DEBUG >= 2) {\n console.log(\"LCD: Clearing time\");\n }\n lcd.print(lcdTime);\n}", "function resetList() {\n console.log(`reset list called`);\n activeTimeList.empty();\n clockOutTime.empty();\n getTime();\n }", "resetCharacteristic(char) {\n const pet_char = this.pet_characteristics.find(c => c.id === char.id)\n\n pet_char.check_time = new Date(Date.now() + char.interval)\n pet_char.action_status = false\n }", "function Clearup() {\n //TO DO:\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "@action\n async endShiftAction() {\n this.isSubmitting = true;\n const entry = this.args.onDutyEntry;\n try {\n // Pick up the most recent times.\n await entry.reload();\n if (entry.duration < TOO_SHORT_DURATION) {\n this.showTooShortDialog = true;\n } else {\n await this._signoff();\n }\n } catch (response) {\n this.house.handleErrorResponse(response)\n } finally {\n this.isSubmitting = false\n }\n }", "clear() {\n if (this.__timeout) {\n clearTimeout(this.__timeout);\n this.__timeout = null;\n }\n\n this.__schedEngines.length = 0;\n this.__schedTimes.length = 0;\n }", "timeUp () {\n setInterval(() => {\n this.time--;\n if (this.time === 0) {\n Msg.innerHTML = '<div class=\\'Msg\\'><span>Time is up! You lose!!</span></div>';\n console.log('Time is up! You lose!');\n }\n this.updateStats();\n }, 5000);\n }", "function chillOut() {\n Reporter_1.Reporter.debug(`wait for ${CHILL_OUT_TIME}ms`);\n browser.pause(CHILL_OUT_TIME);\n }", "function chillOut() {\n Reporter_1.Reporter.debug(`wait for ${CHILL_OUT_TIME}ms`);\n browser.pause(CHILL_OUT_TIME);\n }", "function Clearup() {\n App.Plugin.Voices.del();\n App.Timer.ClearTime();\n }", "updateRemainingTime() {\n\n this.callsCounter++;\n //cada 25 llamadas, quito un segundo\n if (this.callsCounter % 25 == 0) {\n if (this.time.seconds == 0) {\n this.time.minutes -= 1;\n this.time.seconds = 60;\n }\n this.time.seconds -= 1;\n }\n //Se activa el hurryUp\n if (this.callsCounter == this.hurryUpStartTime) {\n this.hurryUpTime = true;\n }\n //Se llama al metodo cada 5 llamadas \n if (this.callsCounter >= this.hurryUpStartTime\n && this.callsCounter % 5 == 0) {\n this.hurryUp();\n }\n\n }", "function pomodoroEnds() {\n\n stopTimer();\n stopAmbientSound();\n increasePomodorosToday();\n var title = \"Time's Up\"\n var msg = \"Pomodoro ended.\" + \"\\n\" + \"You have done \" + Vars.Histogram[getDate()].pomodoros + \" today!\"; //default msg if habit not enabled\n var setComplete = Vars.PomoSetCounter >= Vars.UserData.PomoSetNum - 1;\n //If Pomodoro / Pomodoro Set Habit + is enabled\n if (Vars.UserData.PomoHabitPlus || (setComplete && Vars.UserData.PomoSetHabitPlus)) {\n FetchHabiticaData(true);\n var result = (setComplete && Vars.UserData.PomoSetHabitPlus) ? ScoreHabit(Vars.PomodoroSetTaskId, 'up') : ScoreHabit(Vars.PomodoroTaskId, 'up');\n if (!result.error) {\n var deltaGold = (result.gp - Vars.Monies).toFixed(2);\n var deltaExp = (result.exp - Vars.Exp).toFixed(2);\n var expText = deltaExp < 0 ? \"You leveled up!\" : \"You Earned Exp: +\" + deltaExp;\n msg = \"You Earned Gold: +\" + deltaGold + \"\\n\" + expText;\n FetchHabiticaData(true);\n } else {\n msg = \"ERROR: \" + result.error;\n }\n }\n\n Vars.PomoSetCounter++; //Update set counter\n\n if (setComplete) {\n title = \"Pomodoro Set Complete!\";\n }\n if (Vars.UserData.ManualBreak) {\n manualBreak();\n } else {\n startBreak();\n }\n\n //Badge\n chrome.browserAction.setBadgeBackgroundColor({\n color: \"green\"\n });\n chrome.browserAction.setBadgeText({\n text: \"\\u2713\"\n });\n\n //notify\n notify(title, msg);\n\n //play sound\n playSound(Vars.UserData.pomodoroEndSound, Vars.UserData.pomodoroEndSoundVolume, false);\n}", "function clearData() {\n document.getElementById('mineSweeper').innerHTML = '';\n mineMap = {};\n flagMap = {};\n handleMessage('', 'hide');\n gameOver = false;\n }", "function consumedPastHour() {\n let currentTime = new Date();\n let hourago = new Date(currentTime.getTime() - (60 * 60 * 1000));\n let consumedKWH = 0;\n //Get the consumption readings from the past hour on phase 1\n request('http://raspberrypi.local:1080/api/chart/1/energy_neg/from/' + hourago.toISOString() + '/to/' + currentTime.toISOString(), (error, response, body) => {\n let resultJson = JSON.parse(body);\n let values = resultJson[0].values;\n //Accumulate the total amount fed during the past hour\n values.forEach((measurment) => {\n consumedKWH += measurment.value;\n });\n\n //Unlock the account for 15000 milliseconds\n Web3Service.unlockAccount(meterAccount, \"1234\", 15000);\n //Execute the consume smart contract\n SmartGridContract.consume(consumedKWH, meterAccount);\n });\n}", "function minuteTick(now) {\n var m = Switch.dateToMinutes(now);\n if (!switchStates || switchStates.length != config.switches.length) {\n switchStates = config.switches.map((d) => null);\n }\n var log = \"minuteTick \" + moment(new Date(now)).format(\"HH:mm\") + \" \" + m;\n config.switches.forEach((d, i) => {\n var s = new Switch(d.name, d.house, d.group, d.wakeUp, d.goToBed, d.weekendWakeUp, d.weekendGoToBed, config.latitude, config.longitude);\n var { sunrise, sunset } = s.getSun(now);\n if (sunset < sunrise) {\n sunset += 24 * 60;\n }\n if (i == 0) {\n log += \" \" + (m > sunrise && m < sunset ? \"day\" : \"night\");\n }\n var state = s.getState(now);\n log += \", \" + i + \": \" + switchStates[i] + \" => \" + state;\n if (switchStates[i] === null || switchStates[i] !== state) {\n switchStates[i] = state;\n log += \" command \" + d.house + \" \" + d.group + \" \" + state;\n comm.sendCommand(d.house, d.group, state);\n }\n });\n console.log(log);\n}", "reset() {\n heartRate.value.avg = null\n count = 0\n }", "started() {\n\t\tthis.clearStats();\n\n\t}", "function reset(){\n trainName = \"\";\n destination = \"\";\n startTime = \"\";\n frequency = 0;\n}", "_clearCheck() {\n if (this.onlineCheckId) {\n clearTimeout(this.onlineCheckId);\n this.onlineCheckId = 0;\n }\n }", "clearHeartbeat() {\n if (!this.heartbeatInterval) {\n this.emit('warn', 'Tried to clear a heartbeat interval that does not exist');\n return;\n }\n clearInterval(this.heartbeatInterval);\n this.heartbeatInterval = null;\n }", "function clearQueryData() {\n\t\t\tlastLogStamp = 0;\n\t\t\t$timeout.cancel(queryLogsTimeout);\n\t\t\t$timeout.cancel(displayLogsTimeout);\n\t\t\tcurQueryId = \"\";\n\t\t\t$scope.resultsAvailable = false;\n\t\t\t$scope.queryLogsBusy = false;\n\t\t\t$scope.resultsBusy = false;\n\t\t\t$scope.data.logs = [];\n\t\t\tupdateLogsText();\n\t\t\t$scope.data.queryResponse.schema = [];\n\t\t\t$scope.data.queryResponse.results = [];\n\t\t}", "function resetClockAndTime() {\n stopTimer();\n clockOff = true;\n hour = 0;\n minutes = 0;\n seconds = 0;\n displayTime();\n}" ]
[ "0.6351986", "0.57172143", "0.57172", "0.5665382", "0.5609832", "0.56097007", "0.5597038", "0.5584903", "0.5575114", "0.5570066", "0.55546856", "0.55154425", "0.55140424", "0.5512958", "0.54904246", "0.54677385", "0.5444892", "0.5407005", "0.54037684", "0.53916013", "0.5390941", "0.5373701", "0.53542405", "0.53542405", "0.53542405", "0.53542405", "0.5339238", "0.5327365", "0.5314967", "0.53036207", "0.52958685", "0.5286572", "0.5281395", "0.5277087", "0.5272463", "0.52636683", "0.52362627", "0.52160746", "0.5213216", "0.5211177", "0.52032053", "0.5200476", "0.51975715", "0.51935905", "0.51935905", "0.51935905", "0.5190491", "0.51560855", "0.51447153", "0.5144167", "0.51416594", "0.51276195", "0.5126605", "0.512653", "0.5126038", "0.512149", "0.51212806", "0.5113028", "0.5111617", "0.5109273", "0.5105183", "0.51046854", "0.51020205", "0.509917", "0.5085951", "0.5085256", "0.50824636", "0.5074077", "0.5073843", "0.5065472", "0.50617343", "0.5047894", "0.5046474", "0.50419515", "0.50385773", "0.5036721", "0.5033518", "0.5033212", "0.5030517", "0.5029668", "0.5028781", "0.50211334", "0.5019086", "0.50179696", "0.5017606", "0.50155646", "0.50155646", "0.5013683", "0.5010465", "0.50097865", "0.5008524", "0.5007778", "0.50063986", "0.500463", "0.5004197", "0.5003889", "0.49996597", "0.49987584", "0.49976724", "0.49971977" ]
0.63896483
0
returns an object (not date) with the current hours and minutes, Ottawa time
function getCurrentHoursAndMinutes() { var now = convertUTCtoOttawa(new Date()); return { hours: now.getHours(), minutes: now.getMinutes() }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getNow() {\n var now = new Date();\n return {\n hours: now.getHours() + now.getMinutes() / 60,\n minutes: now.getMinutes() * 12 / 60 + now.getSeconds() * 12 / 3600,\n seconds: now.getSeconds() * 12 / 60\n };\n }", "function time() {\r\n var data = new Date();\r\n var ora = addZero( data.getHours() );\r\n var minuti = addZero( data.getMinutes() );\r\n return orario = ora + ':' + minuti;\r\n }", "function getCurrentOttawaDateTimeString() {\n\n var date = convertUTCtoOttawa(new Date());\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n return year + \"-\" + month + \"-\" + day + \": \" + hour + \":\" + min;\n}", "function getTiempo() {\n\tvar date = new Date();\n\tvar time = date.getHours()+':'+\n\t\t\t date.getMinutes()+':'+\n\t\t\t date.getSeconds()+':'+\n\t\t\t date.getMilliseconds();\n\treturn time;\n}", "function getTime(){\n const d = new Date();\n let hours = d.getHours();\n let minutes = d.getMinutes();\n let mode = 'am';\n\n if(hours > 12){\n hours -= 12 ;\n mode = \"pm\"\n }\n\n return {time: `${hours}:${JSON.stringify(minutes).padStart(2,'0')}`, mode}\n}", "function getTime(data){\n let today = data;\n let date = today.getFullYear() + \"-\" + (today.getMonth() + 1) + \"-\" + today.getDate();\n let time = today.getHours() + \":\" + today.getMinutes() + \":\" + today.getSeconds();\n return {dateTime: date + \" \" + time , date: date , time: time};\n }", "function getTime() {\n\t\t\tvar date = new Date(),\n\t\t\t\thour = date.getHours();\n\t\t\treturn {\n\t\t\t\tday: weekdays[lang][date.getDay()],\n\t\t\t\tdate: date.getDate(),\n\t\t\t\tmonth: months[lang][date.getMonth()],\n\t\t\t\thour: appendZero(hour),\n\t\t\t\tminute: appendZero(date.getMinutes()),\n\t\t\t\t//second: appendZero(date.getSeconds())\n\t\t\t};\n\t\t}", "function getCurrentTime() {\n\tconst time = performance.now() / 1000;\n\tconst secs = Math.floor(time % 60);\n\tconst mins = Math.floor((time / 60) % 60);\n\tconst hrs = Math.floor(time / 60 / 60);\n\n\treturn { hrs: (hrs < 10 ? '0' : '') + hrs,\n\t\tmins: (mins < 10 ? '0' : '') + mins,\n\t\tsecs: (secs < 10 ? '0' : '') + secs};\n}", "function getCurrTimeFormated() {\n var d = new Date();\n return { h: addZero(d.getHours()), m: addZero(d.getMinutes()), s: addZero(d.getSeconds()) }\n}", "function returnTime(){\n let d = new Date();\n // Get the time settings\n let min = d.getMinutes();\n let hour = d.getHours();\n let time = hour + \":\" + min;\n return time;\n}", "function getCurrentTime() {\n\n \t\tvar now = new Date();\n \t\tvar dayMonth = now.getDate();\n \t\tvar meridien = \"AM\";\n \t\tvar hours = now.getHours();\n \t\tvar minutes = now.getMinutes();\n \t\tvar month = (now.getMonth()) + 1;\n \t\tvar start = new Date(now.getFullYear(), 0, 0);\n \t\tvar diff = now - start;\n \t\tvar oneDay = 1000 * 60 * 60 * 24;\n \t\tvar day = Math.floor(diff / oneDay);\n \t\tvar seconds = now.getSeconds();\n \n \t\tif ( hours >= 12 ) {\n \t\t \n \t\t\tmeridien = \"PM\"\n \t\t\thours = hours - 12; \n \t\t\t\n \t\t}//end of if statement\n \n \t\tif (minutes < 10 ){\n \t\t\tminutes = \"0\"+minutes;\n \t\t} //end of if statement\n \n \t\treturn{\n \t\t hours : hours,\n \t\t\tminutes : minutes,\n \t\t\tmeridien : meridien,\n \t\t\tmonth : month,\n \t\t\tday : day,\n \t\t\tseconds : seconds,\t\n\t\t\t\tdayMonth : dayMonth\t\t\n\t\t\t}//end of return\n }", "function now() {\n return new Time(new Date());\n}", "static get_time() {\n return (new Date()).toISOString();\n }", "function getTime() {\n\t//get absolute most current time and date\n\tvar localTime = new Date();\n\t//make sure we got it\n\tconsole.log( localTime );\n\t//extract time and date info and store it in an object\n\tvar theTime = {\n\t\tyear : localTime.getFullYear(),\n\t\tmonth : localTime.getMonth(),\n\t\tdate: localTime.getDate(),\n\t\tday : localTime.getDay(),\n\t\thour : localTime.getHours(),\n\t\tminute : localTime.getMinutes()\n\t};\n\t//makes sure it's working\n\tconsole.log( theTime )\n\t//return our time object\n\treturn theTime;\n\t// functionality goes here!\n\n} // end getTime()", "function getTimeObject(time) {\r\n\t\r\n\tvar hours = Math.floor(time / secondsInHours);\r\n\tvar totalTime = ((time / secondsInHours) - hours) * secondsInHours;\r\n\r\n\tvar minutes = 0;\r\n\twhile (totalTime >= 60) {\r\n\t\t\r\n\t\ttotalTime -= 60;\r\n\t\tminutes++;\r\n\t}\r\n\r\n\tvar seconds = totalTime;\r\n\r\n\tvar timeObj = {\r\n\t\t'hours': hours,\r\n\t\t'minutes': minutes,\r\n\t\t'seconds': seconds\r\n\t}\r\n\treturn timeObj;\r\n}", "function get_time(){\n const today = new Date()\n let time = today.getHours() + \":\" + today.getMinutes();\n return time;\n }", "function getTime(){\n \n hr = hour();\n mn = minute();\n sc = second();\n}", "time() {\n return (new Date()).valueOf() + this.offset;\n }", "function date(){\n var myDate = new Date();\n var time= {\n d : myDate.toLocaleDateString(),\n h : myDate.getHours(),\n m : myDate.getMinutes(),\n s : myDate.getSeconds()\n }\n return time;\n}", "function get_time() {\n return Date.now();\n}", "get timeDetails() {\n let now = new Date().getTime();\n return {\n quizTime: this._time,\n start: this._startTime,\n end: this._endTime,\n elapsedTime: ((this._endTime || now) - this._startTime) / 1000, // ms to sec\n remainingTime: secToTimeStr(this._remainingTime),\n timeOver: this[TIME_OVER_SYM]\n }\n }", "function getCurrentTime() {\r\n let today = new Date();\r\n let hours = today.getHours() >= 10 ? today.getHours() : '0' + today.getHours();\r\n let minutes = today.getMinutes() >= 10 ? today.getMinutes() : '0' + today.getMinutes();\r\n let day = today.getDate() >= 10 ? today.getDate() : '0' + today.getDate();\r\n let month = today.getMonth() + 1;\r\n month = month >= 10 ? month : '0' + month;\r\n\r\n let hoursAndMin = hours + ':' + minutes + ' ';\r\n let dayMonthAndYear = day + '/' + month + '/' + today.getFullYear();\r\n return hoursAndMin + dayMonthAndYear;\r\n}", "function getTime(t) {\r\n date = new Date(t);\r\n offset = date.getTimezoneOffset() / 60;\r\n //var milliseconds = parseInt((t % 1000) / 100),\r\n seconds = Math.floor((t / 1000) % 60);\r\n minutes = Math.floor((t / (1000 * 60)) % 60);\r\n hours = Math.floor((t / (1000 * 60 * 60)) % 24);\r\n hours = hours - offset;\r\n hours = (hours < 10) ? \"0\" + hours : hours;\r\n minutes = (minutes < 10) ? \"0\" + minutes : minutes;\r\n seconds = (seconds < 10) ? \"0\" + seconds : seconds;\r\n return hours + \":\" + minutes + \":\" + seconds;\r\n }", "function gettime() {\n //return Math.round(new Date().getTime() / 1000);\n return Math.round(Date.now() / 1000);\n}", "function getDateAndTime(){\n return new Date()\n}", "get() {\n let date = new Date();\n\n Object.assign(this.currentTime, {\n hours : date.getHours(),\n minutes : date.getMinutes(),\n seconds : date.getSeconds()\n })\n }", "function getTime() {\r\n var currentTime = new Date();\r\n var hours = currentTime.getHours();\r\n var minutes = currentTime.getMinutes();\r\n if (minutes < 10) {\r\n minutes = \"0\" + minutes;\r\n }\r\n return hours + \":\" + minutes;\r\n}", "function currentTime() {\n const today = new Date();\n let hours = today.getHours();\n let mins = today.getMinutes();\n let ampm = \"am\";\n\n if (hours >= 12) {\n ampm = \"pm\";\n }\n if (mins < 10) {\n mins = '0' + mins;\n }\n hours = hours % 12;\n let time = hours + \":\" + mins + ampm;\n return time;\n}", "function getCurrentTime() {\r\n //returns time in minutes\r\n return Math.round(new Date().getTime() / 1000 / 60);\r\n}", "function getCurrentTime() {\r\n //returns time in minutes\r\n return Math.round(new Date().getTime() / 1000 / 60);\r\n}", "function get_time() {\n return new Date().getTime();\n}", "function get_time() {\n return new Date().getTime();\n}", "function getTime()\n\t{\n\t\tvar monthNames = [\n\t\t\t{\n\t\t\t\tname: 'January',\n\t\t\t\tshort: 'Jan'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'February',\n\t\t\t\tshort: 'Feb'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'March',\n\t\t\t\tshort: 'Mar'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'April',\n\t\t\t\tshort: 'Apr'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'May',\n\t\t\t\tshort: 'May'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'June',\n\t\t\t\tshort: 'Jun'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'July',\n\t\t\t\tshort: 'Jul'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'August',\n\t\t\t\tshort: 'Aug'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'September',\n\t\t\t\tshort: 'Sep'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'October',\n\t\t\t\tshort: 'Oct'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'November',\n\t\t\t\tshort: 'Nov'\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'December',\n\t\t\t\tshort: 'Dec'\n\t\t\t}\n\t\t]\n\n\t\tvar date \t= new Date(),\n\t\t\treturnObj = {\n\t\t\thour: \t\t\t\tdate.getHours(),\n\t\t\tmin: \t\t\t\tdate.getMinutes(),\n\t\t\tday: \t\t\t\tdate.getDate(),\n\t\t\tmonth:\t\t\t\tdate.getMonth() + 1,\n\t\t\tmonthName: \t\t\tmonthNames[date.getMonth() + 1].name,\n\t\t\tmonthNameShort:\t\tmonthNames[date.getMonth() + 1].short,\n\t\t\tyear:\t\t\t\tdate.getFullYear()\n\t\t};\n\n\t\t// Change form\n\t\treturnObj.min = (returnObj.min < 10) ? '0' + returnObj.min : returnObj.min;\n\t\treturnObj.hour = (returnObj.hour < 10) ? '0' + returnObj.hour : returnObj.hour;\n\t\treturnObj.date = (returnObj.date < 10) ? '0' + returnObj.date : returnObj.date;\n\t\treturnObj.month = (returnObj.month < 10) ? '0' + returnObj.month : returnObj.month;\n\n\t\treturn returnObj;\n\t}", "getCurrentTime() {\n const today = new Date();\n var time = today.getHours() + \":\" + today.getMinutes();\n if (today.getMinutes() < 10) {\n time = today.getHours() + \":0\" + today.getMinutes();\n }\n return time;\n }", "function o2ws_get_time() { return o2ws_get_float(); }", "function time() {\n\treturn {\n\t\tcurrent : Date.now(),\n\t\tuptime : os.uptime()\n\t};\n}", "getTime(){return this.time;}", "function getCurrentTime(){\n\t//get timestamp and format it\n\t\tvar date = new Date();\n\t\tvar hours = date.getHours()\n\t\tvar ampm = (hours >= 12) ? \"PM\" : \"AM\";\n\t\thours = hours% 12||12;\n\t\tvar minutes =date.getMinutes();\n\t\tminutes = (minutes <10) ? \"0\" + minutes:minutes;\n\t\treturn \"(\" + hours + \":\" + minutes + ampm + \")\";\n}", "function time() {\n var date = new Date();\n var hours = date.getHours();\n var minutes = date.getMinutes();\n if (minutes < 10) {\n minutes = \"0\" + minutes;\n }\n var time = hours + \":\" + minutes\n return time;\n}", "function getTime() {\n\ttest = new Date();\n\thour = test.getHours();\n\tminutes = test.getMinutes();\n\tvar suffix = hour >= 12 ? \"pm\":\"am\";\n\thour = ((hour + 11) % 12 + 1);\n\ttime = hour + \":\" + minutes + suffix;\n\treturn time;\n}", "function getTime() {\n var date = new Date();\n var hours = date.getHours();\n var minutes = date.getMinutes();\n return \"(\" +hours + \":\" + minutes + \")\";\n}", "function dataAtual(){\r\n\tvar data = new Date();\r\n\tvar hora = data.getHours();\r\n\tvar minuto = data.getMinutes();\r\n\tvar segundo = data.getSeconds();\r\n\treturn hora + \":\" + minuto + \":\" + segundo;\r\n}", "function getCurrentDateTime() { //create the function\n return Date() //return the cuirrent data and time\n}", "function horas() {\n var date = new Date();\n var hours = date.getHours() < 10 ? \"0\" + date.getHours() : date.getHours();\n var minutes = date.getMinutes() < 10 ? \"0\" + date.getMinutes() : date.getMinutes();\n var seconds = date.getSeconds() < 10 ? \"0\" + date.getSeconds() : date.getSeconds();\n time = hours + \":\" + minutes + \":\" + seconds;\n return time;\n }", "getCurrentTime(){\n //Declaring & initialising variables\n\t\tlet crnt = new Date();\n\t\tlet hr = \"\";\n\t\tlet min = \"\";\n\n\t\t//checking if the hours are sub 10 if so concatenate a 0 before the single digit\n\t\tif (crnt.getHours() < 10){\n\t\t\thr = \"0\" + crnt.getHours();\n\t\t}\n\t\telse{\n\t\t\thr = crnt.getHours();\n\t\t}\n\n\t\t//checking if mins are sub 10 if so concatenate a 0 before the single digit\n\t\tif (crnt.getMinutes() < 10){\n\t\t\tmin = \"0\" + crnt.getMinutes()\n\t\t\treturn hr + \":\" + min\n\t\t}\n\t\telse{\n\t\t\tmin = crnt.getMinutes();\n\t\t\treturn hr + \":\" + min\n\t\t}\n\t}", "getTime(){\n var date = new Date();\n var heure= date.getHours().toString(); //l'heure\n var minute= date.getMinutes().toString();//a la minute\n if(heure===\"0\"){\n heure=\"00\";\n }\n if(heure.length===1 && heure!=\"0\"){\n heure=\"0\"+heure;\n }\n if(minute===\"0\"){\n minute=\"00\";\n }\n if(minute.length===1 && minute!=\"0\"){\n minute = \"0\"+minute;\n }\n\n var time = heure+\":\"+minute;\n return time;\n }", "function now(){\r\n const date = new Date()\r\n const hour = date.getHours()\r\n const minute = date.getMinutes()\r\n const day = date.getUTCDate()\r\n const month = date.getMonth()\r\n const year = date.getFullYear()\r\n return year + \"-\" + month + \"-\" + day + \" \" + hour + \":\" + minute + \":\" + date.getSeconds()\r\n}", "function time(){\n\tvar d = new Date();\n\tvar hours = function() {\n\t\th = d.getHours();\n\t\tif (h <= 9) {\n\t\t\th = 0 + \"\" + h;\n\t\t}\n\t\treturn h;\n\t};\n\tvar mins = function() {\n\t\tvar m = d.getMinutes();\n\t\tif (m <= 9 ) {\n\t\t\tm = 0 + \"\" + m;\n\t\t}\n\t\treturn m\n\t}\n\tt = hours() + \"\" + mins();\n\tt = parseFloat(t);\n\treturn t;\n}", "getCurrentTime() {\n return Math.floor(Date.now() / 1000);\n }", "function GetCurrentTime() {\n var date = new Date();\n var hours = date.getHours() > 12 ? date.getHours() - 12 : date.getHours();\n var am_pm = date.getHours() >= 12 ? \"PM\" : \"AM\";\n hours = hours < 10 ? \"0\" + hours : hours;\n var minutes = date.getMinutes() < 10 ? \"0\" + date.getMinutes() : date.getMinutes();\n var seconds = date.getSeconds() < 10 ? \"0\" + date.getSeconds() : date.getSeconds();\n return hours + \":\" + minutes + \":\" + seconds + \" \" + am_pm;\n}", "function getCurrentTime(){\n return '[' + moment.format(\"HH:mm\") + '] ';\n}", "function getTimeObj(strtime){\n var date = new Date(getTimestamp(strtime));\n\n return {\n hour: date.getHours(),\n minute: date.getMinutes(),\n second: date.getSeconds()\n };\n}", "function getCurrentTime() {\n var date = new Date();\n //var timestamp = date.toLocaleString('en-US', {\n // hour: 'numeric',\n // minute: 'numeric',\n // hour12: true\n //});\n var timestamp = date.toLocaleString('en-US', {});\n return timestamp;\n }", "now () {\n return this.t;\n }", "calculateTime(){\n let today = new Date();\n let currentTime = today.getHours() + \":\" + today.getMinutes();// + \":\" + today.getSeconds();\n return currentTime;\n }", "function currentTime(){\n let now = new Date();\n\n const hh = String(now.getHours()).padStart(2, '0');\n const mm = String(now.getMinutes()).padStart(2, '0');\n\n now = hh + ':' + mm;\n\n return now; \n}", "get time() {}", "time() {\n\n var d = new Date();\n\n t = d.getTime()\n\n return t;\n\n }", "function get_time() {\n let d = new Date();\n if (start_time != 0) {\n d.setTime(Date.now() - start_time);\n } else {\n d.setTime(0);\n }\n return d.getMinutes().toString().padStart(2,\"0\") + \":\" + d.getSeconds().toString().padStart(2,\"0\");\n }", "function timeNow(timeStamp){\n var now = {};\n var time = new Date(timeStamp*1000);\n var days = [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thrusday\", \"Friday\", \"Saturday\"];\n var months = [\"January\",\"February\", \"March\",\"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\n now.year = time.getFullYear();\n now.month = months[time.getMonth()];\n now.day = days[time.getDay()];\n now.date = time.getDate();\n now.minute = time.getHours() * 60 + time.getMinutes(); // hours and minutes in minute\n return now;\n}", "function atualizar_tempo(){\r\n\td = new Date();\r\n\treturn d.toLocaleTimeString();\r\n}", "function catturaData() {\n var d = new Date();\n var ora = d.getHours();\n var minuti = d.getMinutes();\n return addZero(ora) + ':' + addZero(minuti);\n }", "tempo() {\n return this.t\n }", "lastAccess(){\n var today = new Date();\n var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();\n var time = today.getHours() + \":\" + today.getMinutes();\n var dateTime = date +' '+ time;\n return dateTime;\n }", "function currentTime() {\n var now = new Date();\n var offset = now.getTimezoneOffset();\n var actual = now - offset;\n var str_date = new Date(actual).toLocaleDateString();\n var str_time = new Date(actual).toLocaleTimeString();\n return str_date + ' ' + str_time;\n}", "function getTime() {\n console.clear();\n \n let now = new Date(),\n timezone = Intl.DateTimeFormat().resolvedOptions().timeZone.replace('_', ' ').replace('/', ' / '),\n year = now.getFullYear(),\n month = (now.getMonth() + 1) > 9 ? now.getMonth() + 1 : '0' + (now.getMonth() + 1),\n day = now.getDate() > 9 ? now.getDate() : '0' + now.getDate(),\n date = year + '-' + month + '-' + day,\n hoursRaw = now.getHours(),\n hours = getHours(hoursRaw),\n minutes = now.getMinutes() > 9 ? now.getMinutes() : '0' + now.getMinutes(),\n seconds = now.getSeconds() > 9 ? now.getSeconds() : '0' + now.getSeconds(),\n time = hours + \":\" + minutes + \":\" + seconds;\n \n function getHours(hoursRaw) {\n let meridiem = hoursRaw > 11 ? 'pm' : 'am';\n \n if (military === 'true') {\n hoursFormatted = hoursRaw;\n } else {\n hoursFormatted = hoursRaw > 12 ? hoursRaw - 12 : hoursRaw;\n }\n \n let hoursDisplay = hoursFormatted > 9 ? hoursFormatted : '0' + hoursFormatted;\n \n return hoursDisplay;\n }\n \n console.log(timezone);\n console.log(date);\n console.log(time);\n \n updateTime(timezone, hoursRaw, hours, minutes, seconds)\n}", "function getTimeString() \n{\n var current_date = new Date();\n return current_date.getHours() + \":\" + current_date.getMinutes();\n}", "function getTimeNow () {\n\tvar x = new Date();\n\tvar h = x.getHours();\n\tvar m = x.getMinutes()/60;\n\tselectedTime = h + m;\n\treturn (h + m);\n}", "function time() {\n return dateFormat(\"isoUtcDateTime\");\n}", "getTime() {\n return new Promise((resolve, reject) => {\n this.doRequest('public', 'Time').then((response) => {\n resolve(response);\n }).catch(error => reject(error));\n });\n }", "function currTime() {\n const options = {\n //timeZone: \"Africa/Accra\",\n //hour12: true,\n //hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\"\n };\n\n var tempDate = new Date();\n return tempDate.toLocaleTimeString(\"en-US\", options);\n }", "function Hora(){\n var Digital=new Date();\n var hours=Digital.getHours();\n var minutes=Digital.getMinutes();\n var seconds=Digital.getSeconds();\n var dn=\"AM\";\n if (hours>12){\n dn=\"PM\";\n hours=hours-12;\n }\n if (hours==0)\n hours=12;\n if (minutes<=9)\n minutes=\"0\"+minutes;\n if (seconds<=9)\n seconds=\"0\"+seconds;\n return hours + \":\" + minutes;\n }", "get time() {\n return (process.hrtime()[0] * 1e9 + process.hrtime()[1]) / 1e6;\n }", "function tellTime() \r\n{ \r\n var now = new Date(); \r\n var theHr = now.getHours(); \r\n var theMin = now.getMinutes(); \r\n alert(\"Current time: \"+ theHr + \":\" + theMin); \r\n}", "function now() {\n var date = new Date();\n var time = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + (date.getMinutes() < 10 ? ('0' + date.getMinutes()) : date.getMinutes()) + \":\" + (date.getSeconds() < 10 ? ('0' + date.getSeconds()) : date.getSeconds());\n return time;\n }", "function data_time(){\r\n var current_datatime = new Date();\r\n var day = zero_first_format(current_datatime.getDate());\r\n var month = zero_first_format(current_datatime.getMonth()+1);\r\n var year = zero_first_format(current_datatime.getFullYear());\r\n var hours = zero_first_format(current_datatime.getHours());\r\n var minutes = zero_first_format(current_datatime.getMinutes());\r\n var seconds = zero_first_format(current_datatime.getSeconds());\r\n\r\n return day+\".\"+month+\".\"+year+\".\"+hours+\".\"+minutes+\".\"+seconds;\r\n\r\n}", "function getCurrentDateAndTime() {\n\tvar datetime = new Date();\n\tdatetime = datetime.toISOString().replace(/[^0-9a-zA-Z]/g,'');\t// current date+time ISO8601 compressed\n\tdatetime = datetime.substring(0,15) + datetime.substring(18,19); // remove extra characters\n\treturn datetime;\n}", "getTime() {\n const date = new Date();\n\n this.time = date.toLocaleString('en-GB', {\n //Pass in the timezone to get the proper time for the coordinates\n timeZone: this.timeZone,\n timeStyle: 'short',\n });\n }", "function getCurrentTime() {\n var today = new Date();\n var date =\n today.getFullYear() + \"-\" + (today.getMonth() + 1) + \"-\" + today.getDate();\n var time =\n today.getHours() + \":\" + today.getMinutes() + \":\" + today.getSeconds();\n var dateTime = date + \" \" + time;\n return dateTime;\n}", "function get10BaseTimeHoure(){\n return getDate10baseHoure();\n}", "function getTime() {\n\n var currentTime = new Date();\n var hours = currentTime.getHours();\n var minutes = currentTime.getMinutes();\n var amOrPm = (hours > 11 ? 'PM':'AM');\n \n if( hours===0 ) hours = 12;\n else if( hours>12 ) hours = hours - 12;\n\n minutes = ( minutes < 10 ? '0' + minutes : minutes );\n\n return hours + ':' + minutes + amOrPm;\n}", "function getTime() {\n const date = new Date(); //Create new date object\n\n let hours = date.getHours(); //Get the hours\n let minutes = date.getMinutes(); //Get the minutes\n let seconds = date.getSeconds(); //Get the seconds\n\n\n if (hours < 10) {\n hours = `0${hours}`; //Adds a 0 in front of the hours variable if the hours are before 10:00\n }\n\n if (minutes < 10) {\n minutes = `0${minutes}`; //Adds a 0 in front of the minutes variable if the minutes are before :10\n }\n\n if (seconds < 10) {\n seconds = `0${seconds}`; //Adds a 0 in front of the seconds variable if the secpmds are before ::10\n }\n\n return `${hours}:${minutes}:${seconds}`; //returns time properly formatted HH:MM:SS\n}", "function makeHMTM (hour, minute = 0) {\n return { hour, minute, totalminutes: hour * 60 + minute }\n}", "function get10BaseTimeMinute(){\n return getDate10baseHoure();\n}", "function getTime()\n{\n var time = new Date();\n var year = time.getFullYear();\n var month = time.getMonth() + 1;\n var date = time.getDate();\n var hours = time.getHours();\n var minutes = time.getMinutes();\n var seconds = time.getSeconds();\n\t\tvar milisec = time.getMilliseconds();\n\t\t\n\t\treturn year + \"-\" + month + \"-\" + date + \" \" + hours + \":\" + minutes + \":\" + seconds + \".\" + milisec; \n}", "function current_time() {\n var hh = today.getHours()\n var mm = today.getMinutes()\n\n if (mm < 10) {\n mm = \"0\" + mm\n }\n\n if (hh >= 12) {\n hh = hh % 12\n return (hh + \":\" + mm + \"pm\")\n } else {\n return (hh + \":\" + mm + \"am\")\n }\n}", "function horaCliente(){\n var anio= new Date();\n var mes= new Date();\n var dia=new Date();\n var hora=new Date(); \n var minuto= new Date();\n var segundo= new Date();\n mes.getUTCMonth();\n var h=hora.getHours();\n if(h<=9){\n h=\"0\"+h;\n }\n var minutos=minuto.getMinutes();\n if(minutos<=9){\n minutos=\"0\"+minutos;\n }\n var segundos=segundo.getSeconds();\n if(segundos<=9){\n segundos=\"0\"+segundos;\n }\n var ultActividad=anio.getFullYear()+\"-\"+(mes.getMonth()+1)+\"-\"+dia.getDate()+\" \"+h+\":\"+minutos+\":\"+segundos;\n return ultActividad;\n \n}", "function timeNow() {\n var d = new Date(),\n h = (d.getHours()<10?'0':'') + d.getHours(),\n m = (d.getMinutes()<10?'0':'') + d.getMinutes(),\n s = (d.getSeconds()<10?'0':'') + d.getSeconds();\n return h + ':' + m + ':' + s;\n }", "function getTime() {\n\t\tvar currentTime = new Date();\n\t\tvar day = getDay(currentTime.getDay());\n\t\tvar month = getMonth(currentTime.getMonth());\n\t\tvar date = currentTime.getDate();\n\t\tvar year = currentTime.getFullYear();\n\n\t\treturn day + \" \" + month + \" \" + date + \" \" + year;\n\n\t\t/*var currentTime = new Date();\n\t\t var hours = currentTime.getHours();\n\t\t var minutes = currentTime.getMinutes();\n\t\t return hours + \":\" + minutes;*/\n\t}", "function getCurTime () {\n var myDate = new Date();\n return myDate.toLocaleTimeString();\n }", "function getDateAndTime(){\n let stamp = new Date();\n let timestamp = ()=>{\n return {\n day: stringifyDay(stamp.getDay()),\n date : dateOrdial(stamp.getDate()),\n month : stringifyMonth(stamp.getMonth()),\n year : \"'\"+yearToShort(stamp.getFullYear()),\n hour : stringifyTime(stamp.getHours())+'h',\n min : stringifyTime(stamp.getMinutes())+'m',\n sec : stringifyTime(stamp.getSeconds()) + 's'\n }\n function stringifyTime(num){\n num = num.toString();\n return num.length<2 ? '0'+num : num\n }\n function stringifyDay(indexOfDay){\n let dayArray = ['Sun', 'Mon' ,'Tue','Wed','Thu','Fri','Sat'];\n return dayArray[indexOfDay]\n }\n function dateOrdial(date){\n return date===1 ? date+'st' :\n date===2 ? date+'nd' :\n date===3 ? date+'rd' :\n date+'th'\n }\n function stringifyMonth(indexOfMonth){\n let monthArray = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ];\n return monthArray[indexOfMonth]\n }\n function yearToShort(y){\n y = y.toString();\n return y = y.substring(2);\n }\n }\n return timestamp()\n }", "function getTime() {\n\tvar Time = new Date();\n\treturn Time.toISOString().slice(0,10) + \" \" + Time.getHours() + \":\" + Time.getMinutes() + \":\" + Time.getSeconds();\n}", "function getTime2() {\r\n // Don't delete this.\r\n const xmasDay = new Date(\"2021/12/24:00:00:00\");\r\n const today = new Date();\r\n\r\n // total raw value\r\n const totalSec = (xmasDay - today) / 1000;\r\n const totalMin = totalSec / 60;\r\n const totalHour = totalMin / 60;\r\n const totalDay = totalHour / 24;\r\n\r\n const time2 = {\r\n s: totalSec, \r\n m: totalMin, \r\n h: totalHour, \r\n d: totalDay,\r\n };\r\n \r\n // total rounded value\r\n const keys = Object.keys(time2);\r\n const rounded = Object.values(time2).map((v) => Math.floor(v));\r\n\r\n for(i = 0; i < rounded.length; i++) {\r\n time2[keys[i]] = rounded[i];\r\n }\r\n\r\n const {s, m, h, d} = time2;\r\n\r\n // actual value\r\n const sec = s > 60 ? s % 60 : s;\r\n const min = m > 60 ? m % 60 : m;\r\n const hour = h > 24 ? h % 24 : h;\r\n const day = d; \r\n\r\n return `d-day ${day} days ${hour} hrs ${min} mins ${sec} sec`;\r\n}", "function getDateTime() {\n\n var date = new Date();\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var sec = date.getSeconds();\n sec = (sec < 10 ? \"0\" : \"\") + sec; \n\n return hour + \":\" + min + \":\" + sec;\n\n}", "function getTime() {\n let date = new Date(),\n min = date.getMinutes(),\n sec = date.getSeconds(),\n hour = date.getHours();\n\n return (\n \"\" +\n (hour < 10 ? \"0\" + hour : hour) +\n \":\" +\n (min < 10 ? \"0\" + min : min) +\n \":\" +\n (sec < 10 ? \"0\" + sec : sec)\n );\n}", "function displayDateAndTime() {\n return new Date();\n}", "get time() {\n return this._time;\n }", "function getTime() {\n // fetch from the server:\n fetch('/time/' + 'America/New_York')\n .then(response => response.json())\n .then(json => {\n // get the datetime from the response as a Date object:\n let now = new Date(json.datetime);\n // convert Date to a locale Time String:\n let nowString = now.toLocaleTimeString();\n // get the relevant bits of the JSON response:\n myDiv.innerHTML = \"The time in \";\n myDiv.innerHTML += json.timezone;\n myDiv.innerHTML += \" is \";\n myDiv.innerHTML += nowString;\n myDiv.innerHTML += '<br>';\n myDiv.innerHTML += 'timezone: ';\n myDiv.innerHTML += json.abbreviation;\n myDiv.innerHTML += ', or ' + json.utc_offset + ' GMT';\n });\n}", "function getCurrentTime(){\n var today = new Date();\n var dd = formatToTwoDigit(today.getDate());\n var mm = formatToTwoDigit(today.getMonth()+1); \n var yyyy = today.getFullYear();\n var hour = formatToTwoDigit(today.getHours());\n var minute = formatToTwoDigit(today.getMinutes());\n return yyyy+\"-\"+mm+\"-\"+dd+\" \"+hour+\":\"+minute;\n}", "function getTime() {\n let date = new Date(),\n hour = date.getHours(),\n min = date.getMinutes();\n // sec = date.getSeconds();\n\n return \"\" +\n (hour < 10 ? (\"0\" + hour) : hour) +\n \":\" +\n (min < 10 ? (\"0\" + min) : min);\n // + \":\" + (sec < 10 ? (\"0\" + sec) : sec);\n}" ]
[ "0.7421034", "0.7070131", "0.7042703", "0.7019506", "0.7016044", "0.6983289", "0.69333446", "0.68698555", "0.68485516", "0.6821014", "0.68004423", "0.6745183", "0.67373943", "0.6730873", "0.6727982", "0.67008406", "0.66862845", "0.65916675", "0.6536028", "0.65289223", "0.65264136", "0.6493134", "0.6491401", "0.64850444", "0.6472812", "0.6457571", "0.6448586", "0.6445742", "0.6444603", "0.6444603", "0.6426565", "0.6426565", "0.6422939", "0.64191693", "0.6407745", "0.639376", "0.6392245", "0.63890773", "0.637664", "0.6375677", "0.63721406", "0.63659126", "0.6356331", "0.6345219", "0.6345108", "0.6343956", "0.6337778", "0.63352674", "0.63327014", "0.6312206", "0.6299693", "0.6292371", "0.6291661", "0.62845993", "0.62843865", "0.6272804", "0.6249373", "0.6246478", "0.619861", "0.6193221", "0.61876273", "0.6185877", "0.6181302", "0.6174768", "0.6172339", "0.6170368", "0.6168586", "0.6164773", "0.61569095", "0.6152215", "0.6147252", "0.612479", "0.6118283", "0.61079264", "0.60953254", "0.60762554", "0.60697246", "0.6058086", "0.6057003", "0.6056663", "0.6054466", "0.6053714", "0.60530907", "0.604909", "0.6045141", "0.6044981", "0.6044582", "0.6043378", "0.60433763", "0.6038448", "0.6037516", "0.6027807", "0.60276693", "0.60219526", "0.602078", "0.6018518", "0.6005931", "0.6003388", "0.6001522", "0.6001191" ]
0.7886335
0
compares two objects (not date) with hours and minutes
function compareHoursAndMinutes(t1, t2) { return (t1.hours === t2.hours) && (t1.minutes === t2.minutes); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compare(a,b) {\r\n var startTimeA = (a.StartTimeHour*60) + a.StartTimeMinute;\r\n var startTimeB = (b.StartTimeHour*60) + b.StartTimeMinute;\r\n return startTimeA - startTimeB;\r\n}", "equalsTo(operand){\r\n return (this.hours === operand.hours && this.minutes === operand.minutes);\r\n }", "function withInTime(minutes, timeOne, timeTwo){\n var hours = minutes / 60;\n minutes = minutes % 60;\n var diffTime = (timeTwo[0] - timeOne[0]) * 60 + timeTwo[1] - timeOne[1];\n return minutes >= Math.abs(diffTime);\n}", "function compare(a, b){\n // const dayA = a.startTime[0];\n // const dayB = b.startTime[0];\n // const hourA = parseInt(a.startTime.substring(\n // a.startTime.lastIndexOf(\":\") + 1,\n // a.startTime.lastIndexOf(\";\")\n // ));\n // const hourB = parseInt(b.startTime.substring(\n // b.startTime.lastIndexOf(\":\") + 1,\n // b.startTime.lastIndexOf(\";\")\n // ));\n // const minutesA = parseInt(a.startTime.split(\":\").pop());\n // const minutesB = parseInt(b.startTime.split(\":\").pop());\n\n if (a.people.length > b.people.length) {\n return -1;\n }\n else if (a.people.length == b.people.length && (a.startTime < b.startTime)) {\n return -1;\n }\n else{\n return 1;\n }\n }", "leastEqualThan(operand){\r\n return ((this.hours === operand.hours && this.minutes <= operand.minutes)\r\n || (this.hours < operand.hours));\r\n }", "function compareTime(timeA, timeB) {\n var startTimeParse = timeA.split(\":\");\n var endTimeParse = timeB.split(\":\");\n var firstHour = parseInt(startTimeParse[0]);\n var firstMinute = parseInt(startTimeParse[1]);\n var secondHour = parseInt(endTimeParse[0]);\n var secondMinute = parseInt(endTimeParse[1]);\n if (firstHour == secondHour) {\n if (firstMinute == secondMinute)\n return 0;\n if (firstMinute < secondMinute)\n return -1\n return 1\n }\n else {\n if (firstHour < secondHour)\n return -1\n return 1\n }\n}", "function compare (a,b){\n if (a.hoursInSpace < b.hoursInSpace){\n return 1;\n }\n if (a.hoursInSpace > b.hoursInSpace){\n return -1;\n }\n return 0;\n }", "function isTimeSmallerOrEquals(time1, time2, doNotInvolveMinutePart) {\r\n\t\t\tvar regex = '^(-|\\\\+)?([0-9]+)(.([0-9]{1,2}))?$';\r\n\t\t\t(new RegExp(regex, 'i')).test(time1);\r\n\t\t\tvar t1 = parseInt(RegExp.$2) * 60;\r\n\t\t\tif (RegExp.$4 && !doNotInvolveMinutePart) t1 += parseInt(RegExp.$4);\r\n\t\t\tif (RegExp.$1 == '-') t1 *= -1;\r\n\t\t\t(new RegExp(regex, 'i')).test(time2);\r\n\t\t\tvar t2 = parseInt(RegExp.$2) * 60;\r\n\t\t\tif (RegExp.$4 && !doNotInvolveMinutePart) t2 += parseInt(RegExp.$4);\r\n\t\t\tif (RegExp.$1 == '-') t2 *= -1;\r\n\t\t\tif (t1 <= t2) return true;\r\n\t\t\telse return false;\r\n\t\t}", "function IsTimeEqual(timeOne, timeTwo)\n{\n\treturn ((timeOne.getHours() == timeTwo.getHours()) && (timeOne.getMinutes() == timeTwo.getMinutes()) && (timeOne.getSeconds() == timeTwo.getSeconds()));\n}", "function compareDate(date1, date2) {\n\n //Hours equal\n if (date1.getHours() == date2.getHours()) {\n\n //Check minutes\n if (date1.getMinutes() == date2.getMinutes()) {\n return 0;\n } else {\n if (date1.getMinutes() > date2.getMinutes()) {\n return 1;\n } else {\n return -1;\n }\n }\n }\n\n //Hours not equal\n else {\n if (date1.getHours() > date2.getHours()) {\n return 1;\n } else {\n return -1;\n }\n }\n}", "function compare(a, b) {\n var date2 = new Date(parseInt(a.created_time) * 1000),\n date1 = new Date(parseInt(b.created_time) * 1000);\n\n if (date1 < date2)\n return -1;\n if (date1 > date2)\n return 1;\n return 0;\n }", "function compareReminders(a, b) {\r\n const reminderA = a.reminderTimeMin;\r\n const reminderB = b.reminderTimeMin;\r\n\r\n let comparison = 0;\r\n if (reminderA > reminderB) {\r\n comparison = 1;\r\n } else if (reminderA < reminderB) {\r\n comparison = -1;\r\n }\r\n return comparison;\r\n}", "function diffTopOfHour(a,b) {\n return a.minutes(0).diff(b.minutes(0),\"hours\");\n }", "function compare(objectA,objectB) {\n\n\t\tvar objectATime = Number(objectA.timestampms);\n\t\tvar objectBTime = Number(objectB.timestampms);\n\n\t\tif (objectATime < objectBTime){\n\t\t\t//timeDifference += \"##\" + objectATime+ \"is SMALLER than \" + objectBTime;\n\t\t\treturn -1;\n\t\t}\n\t\tif (objectATime > objectBTime){\n\t\t\t//timeDifference += \"##\" + objectATime+ \"is BIGGER than \" + objectBTime;\n\t\t\treturn 1;\n\t\t}\n\t\t//timeDifference += \"##\" + objectATime+ \"is EQUALS to \" + objectBTime;\n\t\treturn 0;\n\t}", "compareTime(time1, time2) {\n return new Date(time1) > new Date(time2);\n }", "matches(timeToCheck) {\n return this.time.getHours() === timeToCheck.getHours()\n && this.time.getMinutes() === timeToCheck.getMinutes()\n && this.time.getSeconds() === timeToCheck.getSeconds();\n }", "function timeCompare(time1, time2) {\n time1 = time1.toLowerCase();\n time2 = time2.toLowerCase();\n var regex = /^(\\d{1,2}):(\\d{2}) ?(am|pm)$/;\n regex.exec(time1);\n var time1amPm = RegExp.$3;\n var time1Hour = RegExp.$1;\n var time1Minute = RegExp.$2; \n regex.exec(time2);\n var time2amPm = RegExp.$3;\n var time2Hour = RegExp.$1;\n var time2Minute = RegExp.$2;\n\n //if am/pm are different, determine and return\n if(time1amPm == 'am' && time2amPm == 'pm') return -1;\n else if(time1amPm == 'pm' && time2amPm == 'am') return 1;\n //if hours are different determine and return\n if(time1hour < time2hour) return -1;\n else if(time1hour > time2hour) return 1;\n //if minutes are different determine and return\n if(time1Minute < time2Minute) return -1;\n else if(time1Minute > time2Minute) return 1;\n\n //times are the same\n return 0;\n}", "function compare(a, b) {\n if (a.timeInNumbers < b.timeInNumbers) {\n return -1;\n }\n if (a.timeInNumbers > b.timeInNumbers) {\n return 1;\n }\n return 0;\n}", "leastThan(operand){\r\n return ((this.hours === operand.hours && this.minutes < operand.minutes)\r\n || (this.hours < operand.hours));\r\n }", "function compare(a,b) {\n if (a.time < b.time)\n return -1;\n if (a.time > b.time)\n return 1;\n return 0;\n }", "function compare(a,b) {\n if(a.time < b.time) {\n return -1;\n }\n if(a.time > b.time) {\n return 1;\n }\n return 0;\n }", "function compareTime(t1, t2) {\n return t1 > t2;\n}", "function timeCompare(a, b) {\n if (a.time < b.time) return -1;\n if (a.time > b.time) return 1;\n return 0;\n }", "function dateDiffInMinutes(a, b) {\r\n var diff;\r\n var ms_minute = 1000 * 60;\r\n\tif(a instanceof Date && b instanceof Date)\r\n\t{\r\n//using UTC to discard time-zone information.\r\n var date1 = Date.UTC(a.getFullYear(), a.getMonth(), a.getDate(), a.getUTCHours(), a.getUTCMinutes(), a.getUTCSeconds());\r\n var date2 = Date.UTC(b.getFullYear(), b.getMonth(), b.getDate(), b.getUTCHours(), b.getUTCMinutes(), b.getUTCSeconds());\r\n\tdiff = Math.abs(Math.floor((date2 - date1) / ms_minute));\r\n//checking NaN value\r\n\t\tif (!diff){\r\n\t\t\tdiff = \"format error\";\r\n\t\t}\r\n\t} else {\r\n diff = \"wrong, not a date type\"; \r\n\t}\r\nreturn diff;\r\n}", "compare (a, b){\n if (a.time > b.time){\n return -1;\n }\n if (a.time < b.time){\n return 1;\n }\n return 0;\n }", "function compareDate(paramFirstDate,paramSecondDate)\n{\n\tvar fromDate = new Date(paramFirstDate);\n//\tvar hour = fromDate.getHours();\n\t\n\t\n\tvar toDate = new Date(paramSecondDate);\n\tvar diff = toDate.getTime() - fromDate.getTime();\n\treturn (diff);\n}", "function diffh(dt2, dt1) {\r\n var diff =(dt2.getTime() - dt1.getTime()) / 1000;\r\n diff /= (60 * 60);\r\n return Math.abs(Math.round(diff));\r\n}", "@computed('hour', 'minute', 'timeOfDay', 'hourWithinRange', 'minuteWithinRange')\n get timeValid() {\n const timeValid = this.hour && this.minute && this.timeOfDay && this.hourWithinRange && this.minuteWithinRange;\n return timeValid;\n }", "function compare(a,b) {\n if (a.time < b.time)\n return -1;\n else if (a.time > b.time)\n return 1;\n else \n return 0;\n}", "function compare(a, b) {\n\t\t\tif (a.when.startTime < b.when.startTime)\n\t\t\t\treturn -1;\n\t\t\tif (a.when.startTime > b.when.startTime)\n\t\t\t\treturn 1;\n\t\t\treturn 0;\n\t\t}", "function snapshotTimeCompare(a, b) {\n\t\tif (a.snapshot_time_ms < b.snapshot_time_ms)\n\t\t\treturn -1;\n\t\tif (a.snapshot_time_ms > b.snapshot_time_ms)\n\t\t\treturn 1;\n\t\treturn 0;\n\t}", "function compareTime(a, b){\r\n return (a.done ? !b.done : b.done) ? (a.done ? 1 : -1) : (a.date > b.date ? 1 : a.date < b.date ? -1 : 0);\r\n}", "function timeDiff(time1, time2) {\n return DMath.fixHour(time2- time1);\n}", "function timeCompare (tSta, tEnd, secSta, secEnd) {\n\t// 6:00 5:00\n\tif ( tEnd > secSta && secEnd > tSta ) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n}", "function compare(a,b){\n const varA = new Date(a.createdAt.seconds);\n const varB = new Date(b.createdAt.seconds);\n \n let comparison = 0;\n if (varA < varB) {\n comparison = -1;\n } else if (varA > varB) {\n comparison = 1;\n }\n return comparison;\n }", "function getDifference(aux1, aux2)\n{\n var hourStart = aux2.split(\":\");\n var hourEnd = aux1.split(\":\");\n var auxDate1 = new Date();\n var auxDate2 = new Date();\n\n //Sets the hours to milliseconds, then convert them into minutes for post usage in rule of 3 so we can get the total price\n auxDate1.setHours(hourStart[0], hourStart[1], hourStart[2]);\n auxDate2.setHours(hourEnd[0], hourEnd[1], hourEnd[2]);\n\n //var that stores milliseconds difference\n var difference = Math.abs(auxDate1 - auxDate2);\n\n //Convert milliseconds into minutes, then return them.\n return Math.floor((difference/1000)/60);\n}", "function compare(a, b) {\n // Use toUpperCase() to ignore character casing\n const timeA = new Date(a[1].created);\n const timeB = new Date(b[1].created);\n\n console.log(a, '--', b)\n\n let comparison = 0;\n if (timeA > timeB) {\n comparison = 1;\n } else if (timeA < timeB) {\n comparison = -1;\n }\n return comparison * -1;\n}", "function timeCompare(a,b){\n\t\t\t\tif(a.playtime_forever < b.playtime_forever){\n\t\t\t\t\treturn 1;\n\t\t\t\t}else if(a.playtime_forever > b.playtime_forever){\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function hrtimeDiff(a, b)\n{\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || (a[0] == b[0] && a[1] >= b[1]),\n\t 'negative differences not allowed');\n\n\tvar rv = [ a[0] - b[0], 0 ];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn (rv);\n}", "function sortByTime(a, b) {\n let comparison = 0;\n if (a.time >= b.time) {\n comparison = 1;\n } else if (a.time <= b.time) {\n comparison = -1;\n }\n return comparison;\n}", "function timeBetween(start, end){\n var startdate = Date.parseExact(start, \"HH:mm\").getTime();\n var enddate = Date.parseExact(end, \"HH:mm\").getTime();\n\tvar diff = enddate - startdate;\n var seconds = diff/1000;\n var minutes = seconds/60; \n\tvar hour = 0;\n\t\n\twhile(minutes >= 60){\n\t\thour++;\n\t\tminutes -= 60;\n\t}\n\tvar rs = new Date();\n\trs.setHours(hour);\n\trs.setMinutes(minutes);\n\t\treturn rs;\n\t}", "compareArrivalTimes(a, b){\n const stationA = a.timeTableRows.find(station => station.stationShortCode === this.state.station.stationShortCode\n && station.type === this.state.stopType);\n const stationB = b.timeTableRows.find(station => station.stationShortCode === this.state.station.stationShortCode\n && station.type === this.state.stopType);\n\n const timeA = new Date(stationA.liveEstimateTime || stationA.scheduledTime);\n const timeB = new Date(stationB.liveEstimateTime || stationB.scheduledTime);\n\n return timeA - timeB;\n }", "function CheckTimeAfterTime(time1,time2) {\r\n let time2arr = time2.split(\":\");\r\n let time3hr = parseInt(time2arr[0]) + 12;\r\n if (time3hr > 23) { time3hr = time3hr - 24; }\r\n let time3 = time3hr + \":\" + time2arr[1];\r\n \r\n if (CheckTimeBetween(time2,time3,time1)) { return 1; }\r\n else { return 0;}\r\n \r\n}", "function turnHoursToMinutes() {}", "function turnHoursToMinutes() {}", "function turnHoursToMinutes() {}", "function turnHoursToMinutes() {}", "function turnHoursToMinutes() {}", "function turnHoursToMinutes() {}", "function turnHoursToMinutes() {}", "function compareIng(a,b) {\n var Ta = a.cookTime + a.prepTime;\n var Tb = b.cookTime + b.prepTime;\n if (Ta < Tb) {\n return -1;\n }\n if (Ta > Tb) {\n return 1;\n }\n return 0;\n }", "function assertDurationsEqual(id, d1, d2){\n if (d1.year) jum.assertEquals(id + \": year\", d1.year, d2.year);\n else jum.assertFalse(id + \": year\", !!d2.year);\n if (d1.month) jum.assertEquals(id + \": month\", d1.month, d2.month);\n else jum.assertFalse(id + \": month\", !!d2.month);\n if (d1.day) jum.assertEquals(id + \": day\", d1.day, d2.day);\n else jum.assertFalse(id + \": day\", !!d2.day);\n if (d1.hour) jum.assertEquals(id + \": hour\", d1.hour, d2.hour);\n else jum.assertFalse(id + \": hour\", !!d2.hour);\n if (d1.minute) jum.assertEquals(id + \": minute\", d1.minute, d2.minute);\n else jum.assertFalse(id + \": minute\", !!d2.minute);\n if (d1.second) jum.assertEquals(id + \": second\", d1.second, d2.second);\n else jum.assertFalse(id + \": second\", !!d2.second);\n}", "function compareHour() {\n //update color code to display the calendar hours to match currentTime\n var updateHour = moment().hours();\n $(\".time-block > textarea\").each(function() {\n var hour = parseInt($(this).attr(\"id\").split(\"-\")[1]);\n //set background color if past hour\n if (hour < updateHour) {\n $(this).addClass(\"past\");\n //set background color if present hour\n } else if (hour === updateHour) {\n $(this)\n .addClass(\"present\");\n //set background color if future hour\n } else if (hour > updateHour) {\n $(this)\n .addClass(\"future\");\n }\n });\n }", "function diff_minutes(dt2, dt1) \r\n {\r\n console.log(dt1);\r\n var diff =(dt2.getTime() - dt1.getTime()) / 1000;\r\n diff /= 60;\r\n return Math.abs(Math.round(diff));\r\n \r\n }", "function hrtimeDiff(a, b) {\n\tassertHrtime(a);\n\tassertHrtime(b);\n\tmod_assert.ok(a[0] > b[0] || a[0] == b[0] && a[1] >= b[1], 'negative differences not allowed');\n\n\tvar rv = [a[0] - b[0], 0];\n\n\tif (a[1] >= b[1]) {\n\t\trv[1] = a[1] - b[1];\n\t} else {\n\t\trv[0]--;\n\t\trv[1] = 1e9 - (b[1] - a[1]);\n\t}\n\n\treturn rv;\n}", "function minutesBetween(a, b) {\n return msBetween(a, b) / exports.timeMinute;\n}", "function compareHours(index, time) {\n let moments = moment().hours(\"hh\");\n\n console.log(index, time)\n let parsedTime = moment(time, [\"h:m a\"])\n\n if (parsedTime.isBefore(moments, \"hour\")) {\n document.getElementById(index).classList.add(\"past\");\n } else if (parsedTime.isAfter(moments, \"hour\")) {\n document.getElementById(index).classList.add(\"future\");\n } else {\n document.getElementById(index).classList.add(\"present\");\n }\n}", "function trabalho(entrada, saida) {\n var horaInicio = entrada.split(\":\"); //Split starting hours\n var horaSaida = saida.split(\":\"); //Split finishing hours\n\n //Create 2 variables to set as the starting hour and ending\n hora1 = new Date();\n hora2 = new Date();\n\n //Filling the variables with data from the splited string\n hora1.setHours(horaInicio[0], horaInicio[1], horaInicio[2]); //Starting hour\n hora2.setHours(horaSaida[0], horaSaida[1], horaSaida[2]); //Ending hour\n\n ///Still working on this condition -------------- working hours only between 8:00:00 and 18:00:00\n if (hora1.getHours() < 8 || hora1.getHours() > 18 || hora2.getHours() > 18 || hora1.getHours() < 8 || hora1.getHours() > hora2.getHours()) {\n console.log(\"Erro\");\n } else {\n var difference = new Date(); //New variable this will be the hours difference or the hours worked\n\n //difference equals to ending hours - starting hours at the end we get the amout of time worked\n difference.setHours(hora2.getHours() - hora1.getHours(), hora2.getMinutes() - hora1.getMinutes(), hora2.getSeconds() - hora1.getSeconds());\n console.log(difference.getHours(), ':', difference.getMinutes(), ':', difference.getSeconds());\n }\n}", "compare(a, b) {\r\n const timestampA = a.timestamp;\r\n const timestampB = b.timestamp;\r\n let comparison = 0;\r\n if (timestampA > timestampB) {\r\n comparison = 1;\r\n } else if (timestampA < timestampB) {\r\n comparison = -1;\r\n }\r\n return comparison*-1;\r\n }", "function compareDateTime(paramFirstDate,paramSecondDate)\n{\n\tvar fromDate = new Date(paramFirstDate);\n\tvar toDate = new Date(paramSecondDate);\n\ttoDate.setHours(23);\n\ttoDate.setMinutes(59);\n\ttoDate.setSeconds(59);\n\tvar diff = toDate.getTime() - fromDate.getTime();\n\treturn (diff);\n}", "@computed('date', 'hour', 'minute', 'timeOfDay', 'hourValid', 'timeValid')\n get hearingDateTime() {\n let hearingDateTime;\n\n if (this.date && this.timeValid) {\n let numberHour;\n\n if (this.timeOfDay === 'PM') {\n const pmHour = parseInt(this.hour, 10) === 12 ? 12 : parseInt(this.hour, 10) + 12;\n numberHour = pmHour;\n } else if (parseInt(this.hour, 10) === 12) {\n numberHour = 0;\n } else {\n numberHour = this.hour;\n }\n\n const numberMinute = parseInt(this.minute, 10);\n\n // create a new date with numberHour and numberMinute\n // converts hours and minutes to date objects rather than integers\n const hearingTime = new Date(0, 0, 0, numberHour, numberMinute);\n\n // grab the minute and hour from our hearingTime object using moment.js\n const hearingMinute = moment(hearingTime).minute();\n const hearingHour = moment(hearingTime).hour();\n\n hearingDateTime = moment(this.date).add(hearingHour, 'h').add(hearingMinute, 'm').toDate();\n }\n\n return hearingDateTime;\n }", "compareTwoObjectsByDate(a,b) {\n let x = a.approach_date;\n let y = b.approach_date;\n if (x < y) {return -1;}\n if (x > y) {return 1;}\n return 0;\n }", "function compareDateTimes(date1, date2) {\n if (date1.year == date2.year) {\n if (date1.month == date2.month) {\n if (date1.day == date2.day) {\n if (date1.hour == date2.hour) {\n if (date1.minute == date2.minute) {\n return 0;\n }\n return date1.minute - date2.minute;\n }\n return date1.hour - date2.hour;\n }\n return date1.day - date2.day;\n }\n return date1.month - date2.month;\n }\n return date1.year - date2.year;\n}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function GetTimeDifference(time1, time2) {\n return parseInt(time1 / 60000) - parseInt(time2 / 60000);\n}", "function scheduleMeeting(startTime, durationMinutes) {\n debugger;\n let timehstart = dayStart.split(\":\")[0];\n let timemstart = dayStart.split(\":\")[1];\n let timeh = dayEnd.split(\":\")[0];\n let timem = dayEnd.split(\":\")[1];\n let starth = startTime.split(\":\")[0];\n let startm = startTime.split(\":\")[1];\n\n let duh = Math.floor(durationMinutes / 60);\n let dum = durationMinutes % 60;\n let duplusstartm = dum + Number(timem);\n let dmhour = Math.floor(duplusstartm / 60);\n if (Number(timeh) == Number(starth)) {\n if (Number(dmhour) + Number(timeh) > Number(timeh)) {\n alert(\"false\");\n }\n } else if (Number(timehstart) == Number(starth)) {\n if (Number(dmhour) + Number(timehstart) > Number(timehstart)) {\n alert(\"true\");\n }\n } else if (\n Number(starth) + duh == Number(timehstart) ||\n Number(starth) + duh == Number(timeh)\n ) {\n if (\n Number(timemstart) <= Number(startm) + dum &&\n Number(timem) >= Number(startm) + dum\n ) {\n alert(\"true\");\n }\n } else if (\n duh + Number(starth) >= timehstart &&\n duh + Number(starth) <= timeh\n ) {\n alert(\"true\");\n } else if (Number(starth) + timeh <= timeh) {\n alert(\"true\");\n } else if (Number(timeh) + Number(dmhour) <= Number(timeh)) {\n alert(\"true\");\n } else {\n alert(\"false\");\n }\n}", "compareHours(amount, comparedDate) {\r\n const result = this.dateTimeAdapter.addTimerHours(this.pickerMoment, amount);\r\n return this.dateTimeAdapter.compareDate(result, comparedDate);\r\n }", "function compareEventTime(ev1, ev2) {\n let time1 = Date.parse(ev1.startTime);\n let time2 = Date.parse(ev2.startTime);\n return (time1 - time2);\n}", "static compareTimes(t1, t2) {\n\t\twhile (t1.indexOf(\"p\") !== -1) {\n\t\t\tif (t1.substring(t1.indexOf(\"p\") - 5, t1.indexOf(\"p\") - 3) !== \"12\") {\n\t\t\t\tt1 = t1.substring(0, t1.indexOf(\"p\") - 5) +\n\t\t\t\t\t(~~t1.substring(t1.indexOf(\"p\") - 5, t1.indexOf(\"p\") - 3) + 12).toString()\n\t\t\t\t\t+ t1.substring(t1.indexOf(\"p\") - 3, t1.indexOf(\"p\")) +\n\t\t\t\t\tt1.substring(t1.indexOf(\"p\") + 1);\n\t\t\t} else {\n\t\t\t\tt1 = t1.substring(0, t1.indexOf(\"p\")) + t1.substring(t1.indexOf(\"p\") + 1);\n\t\t\t}\n\n\t\t}\n\t\twhile (t2.indexOf(\"p\") !== -1) {\n\t\t\tif (t2.substring(t2.indexOf(\"p\") - 5, t2.indexOf(\"p\") - 3) !== \"12\") {\n\t\t\t\tt2 = t2.substring(0, t2.indexOf(\"p\") - 5) +\n\t\t\t\t\t(~~t2.substring(t2.indexOf(\"p\") - 5, t2.indexOf(\"p\") - 3) + 12).toString()\n\t\t\t\t\t+ t2.substring(t2.indexOf(\"p\") - 3, t2.indexOf(\"p\")) +\n\t\t\t\t\tt2.substring(t2.indexOf(\"p\") + 1);\n\t\t\t} else {\n\t\t\t\tt2 = t2.substring(0, t2.indexOf(\"p\")) + t2.substring(t2.indexOf(\"p\") + 1);\n\t\t\t}\n\n\t\t}\n\n\t\tvar t11 = t1.substring(0, t1.indexOf(\"-\"));\n\t\tvar t12 = t1.substring(t1.indexOf(\"-\") + 1);\n\t\tvar t21 = t2.substring(0, t2.indexOf(\"-\"));\n\t\tvar t22 = t2.substring(t2.indexOf(\"-\") + 1);\n\n\t\tif ((t21 >= t11 && t21 <= t12) || (t22 >= t11 && t22 <= t12) || (t11 >= t21 && t11 <= t22)) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t}", "function getHours(start_time, end_time){\n\t\tvar timeStart = new Date(start_time).getTime();\n\t\tvar timeEnd = new Date(end_time).getTime();\n\t\tvar hourDiff = timeEnd - timeStart; //in ms\n\t\tvar secDiff = hourDiff / 1000; //in s\n\t\tvar minDiff = hourDiff / 60 / 1000; //in minutes\n\t\tvar hDiff = hourDiff / 3600 / 1000; //in hours\n\t\tvar humanReadable = {};\n\t\thumanReadable.hours = Math.floor(hDiff);\n\t\thumanReadable.min = Math.floor(minDiff);\n\t\tvar minutes = (humanReadable.hours*60) + humanReadable.min;\n\t\tconsole.log(\"total time \"+minutes);\n\t\treturn minutes;\n\t\t//console.log(\"%## \"+minDiff);\n\t\t/* if(humanReadable.hours<1){\n\t\t\t\n\t\t\treturn (Math.ceil(parseFloat(\"0.\"+ humanReadable.min)));\n\t\t}\n\t\t \n\t\telse{\n\t\t\treturn humanReadable.hours;\n\t\t} */\n\t}", "async timeToCompare(context, date) {\n try {\n\n let d = new Date(date),\n hour = \"\" + d.getHours(),\n minute = \"\" + d.getMinutes(),\n second = \"\" + d.getSeconds();\n\n if (hour.length < 2) hour = \"0\" + hour;\n if (minute.length < 2) minute = \"0\" + minute;\n if (second.length < 2) second = \"0\" + second;\n \n const now = hour + \":\" + minute + \":\" + second;\n\n context.commit('updateNow', now);\n\n } catch (error) {\n context.commit('getError', error);\n }\n }", "function calc_time_diff(timestamp1, timestamp2) {\n var tmp_s = Math.floor((timestamp2 - timestamp1) / 1000);\n var tmp_m = 0;\n var tmp_h = 0;\n if (tmp_s >= 60) {\n tmp_m = Math.floor(tmp_s / 60);\n tmp_s = Math.floor(tmp_s - (tmp_m * 60));\n if (tmp_m >= 60) {\n tmp_h = Math.floor(tmp_m / 60);\n tmp_m = Math.floor(tmp_m - (tmp_h * 60));\n }\n }\n if (tmp_m < 10) {\n tmp_m = '0' + tmp_m;\n }\n if (tmp_s < 10) {\n tmp_s = '0' + tmp_s;\n }\n return tmp_h + ':' + tmp_m + ':' + tmp_s;\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function _UltraGrid_Sort_Rows_Time(a, b)\n\t{\n\t\t//retrieve values\n\t\tvar valueA = Parse_Time(a.Value, 0xffffffff);\n\t\tvar valueB = Parse_Time(b.Value, 0xffffffff);\n\t\t//return direct comparison\n\t\treturn valueA < valueB ? -1 : 1;\n\t}", "function calcDiff() {\r\n var timeA = document.getElementById('timeA').value;\r\n var timeB = document.getElementById('timeB').value;\r\n\r\n if (timeA.length > 4 || timeA.length <= 0 || timeB.length > 4 || timeB.length <= 0) {\r\n alert('Not valid times.');\r\n return;\r\n }\r\n else if (Number(timeA.substring(0,2)) > 24 || Number(timeB.substring(0,2)) > 24) return;\r\n else if (Number(timeA.substring(2)) > 59 || Number(timeB.substring(2)) > 59) return;\r\n\r\n var minA = Number(timeA.substring(0,2))*60 + Number(timeA.substring(2));\r\n var minB = Number(timeB.substring(0,2))*60 + Number(timeB.substring(2));\r\n var diff = 0;\r\n var hours = 0;\r\n var mins = 0;\r\n\r\n if (minA < minB) {\r\n diff = minB - minA;\r\n hours = parseInt(diff / 60);\r\n mins = diff % 60;\r\n }\r\n else {\r\n diff = (1440 - minA) + minB;\r\n hours = parseInt(diff / 60);\r\n mins = diff % 60;\r\n }\r\n\r\n document.getElementById('diff').value = hours + \" hrs \" + mins + \" mins.\";\r\n document.getElementById('showDiff').style.display = 'inline';\r\n}", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) {\n timeless = true;\n }\n\n if (timeless !== false) {\n return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0);\n }\n\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function compareDates(date1, date2, timeless) {\n if (timeless === void 0) { timeless = true; }\n if (timeless !== false) {\n return (new Date(date1.getTime()).setHours(0, 0, 0, 0) -\n new Date(date2.getTime()).setHours(0, 0, 0, 0));\n }\n return date1.getTime() - date2.getTime();\n }", "function asorter(a, b) {\n return getTime(a.start_time) - getTime(b.start_time);\n}", "function computeTimeDifference(hh1,mm1,ampm1,hh2,mm2,ampm2) {\n\th1 = hh1;\n\tm1 = mm1;\n\th2 = hh2;\n\tm2 = mm2;\n\tvar er3a = 1;\n\tvar er3b = 0;\n\tif ((er3a==0) && (h1==12)) {h1=0}\n\n\tif ((er3a==0) && (er3b==1)) {\n\tt1= (60*h1) + m1;\n\tif (h2==12) {\n\tt2= ((h2) * 60) + m2;}\n\telse {\n\tt2= ((h2+12) * 60) + m2;}\n\tt3= t2-t1;\n\tt4= Math.floor(t3/60)\n\tt5= t3-(t4*60)\n\t}\n\telse if ((er3a==1) && (er3b==0)) {\n\tif (h2==12) {h2=0}\n\tif (h1==12) {h1=0}\n\tt1= (60*h1) + m1;\n\tt2= ((h2+12) * 60) + m2;\n\tt3= t2-t1;\n\tt4= Math.floor(t3/60)\n\tt5= t3-(t4*60)\n\t}\n\telse if ((er3a==0) && (er3b==0)) {\n\tt1= (h1*60) + m1;\n\n\tif (h2==12) {h2=0}\t\n\n\tt2= (h2*60) + m2;\n\t\tif (t2>t1) {\n\t\tt3= t2-t1;\n\t\tt4= Math.floor(t3/60)\n\t\tt5= t3-(t4*60)\n\t\t}\n\t\telse {\n\t\tt2= ((h2+24)*60) + m2;\n\t\tt3= t2-t1;\n\t\tt4= Math.floor(t3/60)\n\t\tt5= t3-(t4*60)\n\t\t}\n\t}\n\telse if ((er3a==1) && (er3b==1)) {\n\t\tif (h1!=12) {h1=h1+12}\n\t\tif (h2!=12) {h2=h2+12}\n\t\tt1= (h1*60) + m1;\n\t\tt2= (h2*60) + m2;\n\t\tif (t2>t1) {\n\t\tt3= t2-t1;\n\t\tt4= Math.floor(t3/60)\n\t\tt5= t3-(t4*60)\n\t\t}\n\t\telse {\n\t\tt2= ((h2+24)*60) + m2;\n\t\tt3= t2-t1;\n\t\tt4= Math.floor(t3/60)\n\t\tt5= t3-(t4*60)\n\t\t}\n\t\t}\n\t\n\t//alert(\" \" + t4 + \" hours \" + \" \" + t5 + \" minutes\");\n return t4+\":\"+t5;\n}", "function setHoursFromInputs() {\n if (self.hourElement === undefined || self.minuteElement === undefined)\n return;\n var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24,\n minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined\n ? (parseInt(self.secondElement.value, 10) || 0) % 60\n : 0;\n if (self.amPM !== undefined) {\n hours = ampm2military(hours, self.amPM.textContent);\n }\n var limitMinHours = self.config.minTime !== undefined ||\n (self.config.minDate &&\n self.minDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===\n 0);\n var limitMaxHours = self.config.maxTime !== undefined ||\n (self.config.maxDate &&\n self.maxDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===\n 0);\n if (limitMaxHours) {\n var maxTime = self.config.maxTime !== undefined\n ? self.config.maxTime\n : self.config.maxDate;\n hours = Math.min(hours, maxTime.getHours());\n if (hours === maxTime.getHours())\n minutes = Math.min(minutes, maxTime.getMinutes());\n if (minutes === maxTime.getMinutes())\n seconds = Math.min(seconds, maxTime.getSeconds());\n }\n if (limitMinHours) {\n var minTime = self.config.minTime !== undefined\n ? self.config.minTime\n : self.config.minDate;\n hours = Math.max(hours, minTime.getHours());\n if (hours === minTime.getHours() && minutes < minTime.getMinutes())\n minutes = minTime.getMinutes();\n if (minutes === minTime.getMinutes())\n seconds = Math.max(seconds, minTime.getSeconds());\n }\n setHours(hours, minutes, seconds);\n }", "function compareDateObject(date1, date2){\r\n if(date1 == null) return false;\r\n if(date2 == null) return false;\r\n\r\n var date1Long = date1.getTime();\r\n var date2Long = date2.getTime();\r\n\r\n if(date1Long - date2Long > 0) return '>';\r\n if(date1Long - date2Long == 0) return '=';\r\n if(date1Long - date2Long < 0) return '<';\r\n else\r\n return '';\r\n}", "MinuteDiff(expect, actual, tolerant){\n let status=0;// ok\n let thisActual=Date.fromMysqlDate(`${actual}`);\n let thisExpect=Date.fromMysqlDate(`${expect}`);\n let minutesDiff=(thisActual.getTime()-thisExpect.getTime())/(60*1000);\n if(minutesDiff>0&&minutesDiff<tolerant){\n status=1;// within tolerant\n }\n else if(minutesDiff>tolerant){\n status=2;// late\n }\n return status;\n \n }", "function setHoursFromInputs() {\n if (self.hourElement === undefined || self.minuteElement === undefined)\n return;\n var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined\n ? (parseInt(self.secondElement.value, 10) || 0) % 60\n : 0;\n if (self.amPM !== undefined) {\n hours = ampm2military(hours, self.amPM.textContent);\n }\n var limitMinHours = self.config.minTime !== undefined ||\n (self.config.minDate &&\n self.minDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.minDate, true) ===\n 0);\n var limitMaxHours = self.config.maxTime !== undefined ||\n (self.config.maxDate &&\n self.maxDateHasTime &&\n self.latestSelectedDateObj &&\n compareDates(self.latestSelectedDateObj, self.config.maxDate, true) ===\n 0);\n if (limitMaxHours) {\n var maxTime = self.config.maxTime !== undefined\n ? self.config.maxTime\n : self.config.maxDate;\n hours = Math.min(hours, maxTime.getHours());\n if (hours === maxTime.getHours())\n minutes = Math.min(minutes, maxTime.getMinutes());\n if (minutes === maxTime.getMinutes())\n seconds = Math.min(seconds, maxTime.getSeconds());\n }\n if (limitMinHours) {\n var minTime = self.config.minTime !== undefined\n ? self.config.minTime\n : self.config.minDate;\n hours = Math.max(hours, minTime.getHours());\n if (hours === minTime.getHours())\n minutes = Math.max(minutes, minTime.getMinutes());\n if (minutes === minTime.getMinutes())\n seconds = Math.max(seconds, minTime.getSeconds());\n }\n setHours(hours, minutes, seconds);\n }" ]
[ "0.7367753", "0.694777", "0.6863364", "0.6707897", "0.6653542", "0.6519639", "0.64801466", "0.64379394", "0.64292246", "0.63552475", "0.6304667", "0.624035", "0.6188942", "0.6164275", "0.6143916", "0.6035805", "0.6030706", "0.59936357", "0.59759927", "0.5975752", "0.5959879", "0.59533393", "0.594821", "0.59381163", "0.58956885", "0.58871573", "0.58735824", "0.58532643", "0.58504045", "0.5849191", "0.5838597", "0.57924086", "0.579177", "0.579076", "0.5772387", "0.5760169", "0.5742185", "0.5728966", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5717068", "0.5710746", "0.56933004", "0.56928635", "0.56853974", "0.56550986", "0.56550986", "0.56550986", "0.56550986", "0.56550986", "0.56550986", "0.56550986", "0.56461155", "0.56415915", "0.5635424", "0.56323457", "0.5629196", "0.5619694", "0.56176794", "0.5602789", "0.5558417", "0.55478686", "0.5545192", "0.5543565", "0.55265063", "0.55186176", "0.5510887", "0.54975903", "0.5493441", "0.54840326", "0.5473248", "0.546651", "0.54615045", "0.54398793", "0.542632", "0.5421268", "0.5411736", "0.54018855", "0.5379812", "0.53782827", "0.53782827", "0.53782827", "0.53782827", "0.53782827", "0.53768665", "0.537615", "0.53666645", "0.5361035", "0.53551674", "0.5345047" ]
0.81036144
0
if the given date is in UTC, converts it to Ottawa time. this is a 'reasonable' hack since the only two places that the js will be run will be on azure (UTC), and locally (Ottawa time)
function convertUTCtoOttawa(date) { var d = new Date(); if (d.getHours() === d.getUTCHours()) { d.setUTCHours(d.getUTCHours() - 5); } return d; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toMarketTime(date,tz){\n\t\t\t\tvar utcTime=new Date(date.getTime() + date.getTimezoneOffset() * 60000);\n\t\t\t\tif(tz && tz.indexOf(\"UTC\")!=-1) return utcTime;\n\t\t\t\telse return STX.convertTimeZone(utcTime,\"UTC\",tz);\n\t\t\t}", "toFinnishTime(date) {\n //var date = new Date();\n date.setHours(date.getHours()+2);\n return date.toJSON().replace(/T/, ' ').replace(/\\..+/, '');\n }", "utcToLocalTime(utcTime) {\r\n let dateIsoString;\r\n if (typeof utcTime === \"string\") {\r\n dateIsoString = utcTime;\r\n }\r\n else {\r\n dateIsoString = utcTime.toISOString();\r\n }\r\n return this.clone(TimeZone_1, `utctolocaltime('${dateIsoString}')`)\r\n .postCore()\r\n .then(res => hOP(res, \"UTCToLocalTime\") ? res.UTCToLocalTime : res);\r\n }", "localTimeToUTC(localTime) {\r\n let dateIsoString;\r\n if (typeof localTime === \"string\") {\r\n dateIsoString = localTime;\r\n }\r\n else {\r\n dateIsoString = dateAdd(localTime, \"minute\", localTime.getTimezoneOffset() * -1).toISOString();\r\n }\r\n return this.clone(TimeZone_1, `localtimetoutc('${dateIsoString}')`)\r\n .postCore()\r\n .then(res => hOP(res, \"LocalTimeToUTC\") ? res.LocalTimeToUTC : res);\r\n }", "static getUTCDateTime() {\n return new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '')\n }", "function time() {\n return dateFormat(\"isoUtcDateTime\");\n}", "function convertUTCDateToLocalDate(date) {\r\n if (IsNotNullorEmpty(date)) {\r\n var d = new Date(date);\r\n //var d = new Date(date.replace(/-/g, \"/\"))\r\n d = d - (d.getTimezoneOffset() * 60000);\r\n d = new Date(d);\r\n return d;\r\n }\r\n return null;\r\n //return d.toISOString().substr(0, 19) + \"Z\";\r\n}", "function toUTCtime(dateStr) {\n //Date(1381243615503+0530),1381243615503,(1381243615503+0800)\n \n dateStr += \"\";\n var utcPrefix = 0;\n var offset = 0;\n var dateFormatString = \"yyyy-MM-dd hh:mm:ss\";\n var utcTimeString = \"\";\n var totalMiliseconds = 0;\n\n var regMatchNums = /\\d+/gi;\n var regSign = /[\\+|\\-]/gi;\n var arrNums = dateStr.match(regMatchNums);\n utcPrefix = parseInt(arrNums[0]);\n if (arrNums.length > 1) {\n offset = arrNums[1];\n offsetHour = offset.substring(0, 2);\n offsetMin = offset.substring(2, 4);\n offset = parseInt(offsetHour) * 60 * 60 * 1000 + parseInt(offsetMin) * 60 * 1000;\n }\n if(dateStr.lastIndexOf(\"+\")>-1){\n totalMiliseconds= utcPrefix - offset;\n } else if (dateStr.lastIndexOf(\"-\") > -1) {\n totalMiliseconds = utcPrefix + offset;\n }\n\n utcTimeString = new Date(totalMiliseconds).format(dateFormatString);\n return utcTimeString;\n}", "function convertLocalDateToUTCDate(date, toUTC) {\n date = new Date(date);\n //Hora local convertida para UTC \n var localOffset = date.getTimezoneOffset() * 60000;\n var localTime = date.getTime();\n if (toUTC) {\n date = localTime + localOffset;\n } else {\n date = localTime - localOffset;\n }\n date = new Date(date);\n\n return date;\n }", "function getpass_at(e) {\n const minuteRelativeTime = /(\\d+)\\s*分钟前/;\n const hourRelativeTime = /(\\d+)\\s*小时前/;\n const yesterdayRelativeTime = /昨天\\s*(\\d+):(\\d+)/;\n const shortDate = /(\\d+)-(\\d+)\\s*(\\d+):(\\d+)/;\n\n // offset to ADD for transforming China time to UTC\n const chinaToUtcOffset = -8 * 3600 * 1000;\n // offset to ADD for transforming local time to UTC\n const localToUtcOffset = new Date().getTimezoneOffset() * 60 * 1000;\n // offset to ADD for transforming local time to china time\n const localToChinaOffset = localToUtcOffset - chinaToUtcOffset;\n\n let time;\n if (e === '刚刚') {\n time = new Date();\n } else if (minuteRelativeTime.test(e)) {\n const rel = minuteRelativeTime.exec(e);\n time = new Date(Date.now() - parseInt(rel[1]) * 60 * 1000);\n } else if (hourRelativeTime.test(e)) {\n const rel = hourRelativeTime.exec(e);\n time = new Date(Date.now() - parseInt(rel[1]) * 60 * 60 * 1000);\n } else if (yesterdayRelativeTime.test(e)) {\n const rel = yesterdayRelativeTime.exec(e);\n // this time is China time data in local timezone\n time = new Date(Date.now() - 86400 * 1000 + localToChinaOffset);\n time.setHours(parseInt(rel[1]), parseInt(rel[2]), 0, 0);\n // transform back to china timezone\n time = new Date(time.getTime() - localToChinaOffset);\n } else if (shortDate.test(e)) {\n const rel = shortDate.exec(e);\n const now = new Date(Date.now() + localToChinaOffset);\n const year = now.getFullYear();\n // this time is China time data in local timezone\n time = new Date(year, parseInt(rel[1]) - 1, parseInt(rel[2]), parseInt(rel[3]), parseInt(rel[4]));\n // transform back to china timezone\n time = new Date(time.getTime() - localToChinaOffset);\n } else {\n time = new Date(e);\n }\n return time;\n }", "function convertDateToUTC(day, month, year){\n return year + \"-\" + month + \"-\" + day + \"T00:00:00\";\n }", "function toLocalTime(date){\n var dateMsj = new Date(date);\n var hoy = new Date();\n // var ayer = new Date(hoy.getTime() - 24*60*60*1000);\n if (hoy.getDate() === dateMsj.getDate()){\n return String(dateMsj.getHours()) + ':' + String(dateMsj.getMinutes());\n }\n else if (dateMsj.getDate() === hoy.getDate() - 1) {\n return \"Ayer\";\n }\n else {\n return dateMsj.toLocaleDateString();\n }\n}", "function convertFromUTC(utcdate) {\n localdate = new Date(utcdate);\n return localdate;\n }", "function getCurrentOttawaDateTimeString() {\n\n var date = convertUTCtoOttawa(new Date());\n\n var hour = date.getHours();\n hour = (hour < 10 ? \"0\" : \"\") + hour;\n\n var min = date.getMinutes();\n min = (min < 10 ? \"0\" : \"\") + min;\n\n var year = date.getFullYear();\n\n var month = date.getMonth() + 1;\n month = (month < 10 ? \"0\" : \"\") + month;\n\n var day = date.getDate();\n day = (day < 10 ? \"0\" : \"\") + day;\n\n return year + \"-\" + month + \"-\" + day + \": \" + hour + \":\" + min;\n}", "function convertToUTCTimezone(date) {\n\t// Doesn't account for leap seconds but I guess that's ok\n\t// given that javascript's own `Date()` does not either.\n\t// https://www.timeanddate.com/time/leap-seconds-background.html\n\t//\n\t// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset\n\t//\n\treturn new Date(date.getTime() - date.getTimezoneOffset() * 60 * 1000)\n}", "function treatAsUTC(date) {\n var result = new Date(date);\n result.setMinutes(result.getMinutes() - result.getTimezoneOffset());\n return result;\n }", "static isoDateTime(date) {\n var pad;\n console.log('Util.isoDatetime()', date);\n console.log('Util.isoDatetime()', date.getUTCMonth().date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes, date.getUTCSeconds);\n pad = function(n) {\n if (n < 10) {\n return '0' + n;\n } else {\n return n;\n }\n };\n return date.getFullYear()(+'-' + pad(date.getUTCMonth() + 1) + '-' + pad(date.getUTCDate()) + 'T' + pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + pad(date.getUTCSeconds()) + 'Z');\n }", "function dateObjtoUT(dateTime) {\n var setUT = ((dateTime.getTime() - foundingMoment) / 1000);\n if (dateTime.toString().includes(\"Standard\")) setUT += 3600;\n return setUT;\n}", "function set_sonix_date()\n{\n var d = new Date();\n var dsec = get_utc_sec();\n var tz_offset = -d.getTimezoneOffset() * 60;\n d = (dsec+0.5).toFixed(0);\n var cmd = \"set_time_utc(\" + d + \",\" + tz_offset + \")\";\n command_send(cmd);\n}", "function convertUTC2Local(dateformat) {\r\n\tif (!dateformat) {dateformat = 'globalstandard'}\r\n\tvar $spn = jQuery(\"span.datetime-utc2local\").add(\"span.date-utc2local\");\r\n\t\r\n\t$spn.map(function(){\r\n\t\tif (!$(this).data(\"converted_local_time\")) {\r\n\t\t\tvar date_obj = new Date(jQuery(this).text());\r\n\t\t\tif (!isNaN(date_obj.getDate())) {\r\n\t\t\t\tif (dateformat = 'globalstandard') {\r\n\t\t\t\t\t//console.log('globalstandard (' + dateformat + ')');\r\n\t\t\t\t\tvar d = date_obj.getDate() + ' ' + jsMonthAbbr[date_obj.getMonth()] + ' ' + date_obj.getFullYear();\r\n\t\t\t\t} else {\r\n\t\t\t\t\t//console.log('other (' + dateformat + ')');\r\n\t\t\t\t\tvar d = (date_obj.getMonth()+1) + \"/\" + date_obj.getDate() + \"/\" + date_obj.getFullYear();\r\n\t\t\t\t\tif (dateformat == \"DD/MM/YYYY\") {\r\n\t\t\t\t\t\td = date_obj.getDate() + \"/\" + (date_obj.getMonth()+1) + \"/\" + date_obj.getFullYear();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif ($(this).hasClass(\"datetime-utc2local\")) {\r\n\t\t\t\t\tvar h = date_obj.getHours() % 12;\r\n\t\t\t\t\tif (h==0) {h = 12;}\r\n\t\t\t\t\tvar m = \"0\" + date_obj.getMinutes();\r\n\t\t\t\t\tm = m.substring(m.length - 2,m.length+1)\r\n\t\t\t\t\tvar t = h + \":\" + m;\r\n\t\t\t\t\tif (date_obj.getHours() >= 12) {t = t + \" PM\";} else {t = t + \" AM\";}\r\n\t\t\t\t\t\r\n\t\t\t\t\t$(this).text(d + \" \" + t);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$(this).text(d);\r\n\t\t\t\t}\r\n\t\t\t\t$(this).data(\"converted_local_time\",true);\r\n\t\t\t} else {console.log(\"isNaN returned true on \" + date_obj.getDate())}\r\n\t\t} else {console.log($(this).data(\"converted_local_time\"));}\r\n\t});\r\n}", "function ConvertToLocalTime(dateObject, style, locale) {\n // debugger;\n // If the caller didn't specify the style, use the \"short\" time format 1:30 pm\n if (!style) {\n style = \"short\";\n }\n // If the caller didn't specify the regional locale, use the web browser default locale\n if (!locale) {\n locale = GetPreferredRegion();\n }\n var valueAsShortDate = \"\";\n var conversionRules = {\n timeStyle: style,\n ////// or if you don't want to use timeStyle, you can specify things like this\n // hour:\t\"2-digit\",\n // minute:\t\"2-digit\",\n // hour12: true,\n }\n\n if (dateObject && dateObject.toLocaleString() !== undefined) {\n valueAsShortDate = dateObject.toLocaleString(locale, conversionRules);\n }\n return valueAsShortDate;\n}", "function dateUTC(date) {\n\treturn new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);\n}", "static isoDateTime(dateIn) {\n var date, pad;\n date = dateIn != null ? dateIn : new Date();\n console.log('Util.isoDatetime()', date);\n console.log('Util.isoDatetime()', date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes, date.getUTCSeconds);\n pad = function(n) {\n return Util.pad(n);\n };\n return date.getFullYear()(+'-' + pad(date.getUTCMonth() + 1) + '-' + pad(date.getUTCDate()) + 'T' + pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + pad(date.getUTCSeconds()) + 'Z');\n }", "function getTimeZone(date, long, savings, utc) {\n if (long === void 0) { long = false; }\n if (savings === void 0) { savings = false; }\n if (utc === void 0) { utc = false; }\n if (utc) {\n return long ? \"Coordinated Universal Time\" : \"UTC\";\n }\n var wotz = date.toLocaleString(\"UTC\");\n var wtz = date.toLocaleString(\"UTC\", { timeZoneName: long ? \"long\" : \"short\" }).substr(wotz.length);\n //wtz = wtz.replace(/[+-]+[0-9]+$/, \"\");\n if (savings === false) {\n wtz = wtz.replace(/ (standard|daylight|summer|winter) /i, \" \");\n }\n return wtz;\n}", "function changeTimezone(date){\n d = new Date(date);\n var offset = -(d.getTimezoneOffset());\n var newDate = new Date(d.getTime() + offset*60000 - 19800000);\n return newDate;\n}", "function transformUTCToTZ() {\n $(\".funnel-table-time\").each(function (i, cell) {\n var dateTimeFormat = \"MM:DD HH:mm\";\n transformUTCToTZTime(cell, dateTimeFormat);\n });\n }", "function getLocalTime() {\n\tvar date = new Date();\n\n\tvar options = {\n timezone: 'UTC',\n hour: 'numeric',\n minute: 'numeric',\n second: 'numeric'\n };\n\n return date.toLocaleString(\"ru\", options);\n}", "function ConvertUTCtoGPSTime() {\r\n\t\tvar day = $('#UTCDay').val();\r\n\t\tvar month = $('#UTCMonth').val();\r\n\t\tvar year = $('#UTCYear').val();\r\n\t\tvar hour = $('#UTCHour').val();\r\n\t\tvar minute = $('#UTCMinute').val();\r\n\t\tvar second = $('#UTCSecond').val();\r\n\t\tvar Leap = $('#LeapSecond').val();\r\n\t\tvar GPSTime = $('#gpsTime').val();\r\n\t\t\r\n\t\tif(GPSTime.length > 0){\r\n\t\t\t\r\n\t\t\treturn GPSTime;\r\n\t\t\t\r\n\t\t} else {\r\n\t\t\t\r\n\t\tvar D = new Date(Date.UTC(year, (month -1), day, hour, minute, second));\r\n\t\tvar UNIX = (D.getTime() / 1000);\r\n\t\tvar GPSTime = UNIX - 315964800 + +Leap;\r\n\t\treturn GPSTime;\r\n\t}\r\n\t\r\n}", "static toTargetTimezone(time) {\n return new Date(time + TARGET_TIMEZONE_OFFSET * 60 * 60 * 1000);\n }", "function sanitizeDate (date) {\n var utc = moment.tz(date['utc'], 'America/Guayaquil');\n return {\n utc: date['utc'],\n local: utc.format()\n };\n}", "function dateUTC( date ) {\n\t\tif ( !( date instanceof Date ) ) {\n\t\t\tdate = new Date( date );\n\t\t}\n\t\tvar timeoff = date.getTimezoneOffset() * 60 * 1000;\n\t\tdate = new Date( date.getTime() + timeoff );\n\t\treturn date;\n\t}", "function UTtoDateTime(setUT, local = false, fullYear = true) {\n var d = new Date();\n d.setTime(foundingMoment + (setUT * 1000));\n if (d.toString().includes(\"Standard\")) d.setTime(foundingMoment + ((setUT + 3600) * 1000));\n\n // if we ask for local time, apply the proper UTC offset\n if (local) d.setUTCHours(d.getUTCHours() - ops.UTC);\n \n // take off the first two digits of the year?\n if (!fullYear) {\n var strDateTime = formatDateTime(d);\n var strDateTrunc = strDateTime.substr(0, strDateTime.lastIndexOf(\"/\")+1);\n var strDateYear = strDateTime.split(\"/\")[2].split(\" \")[0];\n strDateYear = strDateYear.substr(2, 2);\n var strTime = strDateTime.split(\"@\")[1];\n return strDateTrunc + strDateYear + \" @\" + strTime;\n } else return formatDateTime(d);\n}", "function getDateTime(){\n var date = new Date() \n var dateTime = date.toISOString()\n utc = date.getTimezoneOffset() / 60\n dateTime = dateTime.slice(0, 19)\n dateTime += '-0' + utc + ':00'\n return dateTime\n}", "function utcDate(date) {\n\tdate.setMinutes(date.getMinutes() - date.getTimezoneOffset());\n\treturn date;\n}", "function calculateTime(timezone) {\n let date = new Date();\n let localizedTime = date.toLocaleString(\"en-US\", {\n timeZone: `${timezone}`,\n hour: \"2-digit\",\n minute: \"2-digit\",\n });\n // console.log(localizedTime);\n return localizedTime;\n}", "convertTimeToLocal(timestamp) {\n let localTime = etmjslib.utils.slots.getRealTime(timestamp);\n return new Date(localTime).toLocaleDateString();\n }", "function formatServerDateTimeTZ(t){\r\n\t/*\r\n\t// TODO Server time zone offset should be in server response along with tzName and ID (like America/New_York).\r\n\tvar tzOffset = 5 * 60 * 60 * 1000;\r\n\tvar tzName = responseObj.server_time.substr(-3);\r\n\tvar d = new Date(asDate(t).getTime() - tzOffset);\r\n\treturn d.format(Date.formats.default, true) + ' ' + tzName;\r\n\t*/\r\n\treturn responseObj.server_time;\r\n}", "function getLocaleTimeString(dateObj){\n console.log('entered into getLocaleTimeString function');\n // var obj = new Date(Date.parse(dateObj)-(330*60*1000))\n\n return dateObj.toLocaleTimeString('en-US',{ hour: 'numeric', hour12: true, timeZone: timeZone });\n}", "function getDate(){\n let newDateTime = new Date().toUTCString();\n return newDateTime;\n}", "function atualizar_tempo(){\r\n\td = new Date();\r\n\treturn d.toLocaleTimeString();\r\n}", "function DateUTC () {\n\ttime = new Date();\n\tvar offset = time.getTimezoneOffset() / 60;\n\ttime.setHours(time.getHours() + offset);\n\treturn time\n}", "function dateToOb(date){\n\tvar dd=Date.fromISO(date);\n\t\n\treturn {\n\t\tt: dd,\n\t\th: ((dd.getHours()>12?dd.getHours()-12:dd.getHours()).toString().length==1?\"0\":\"\")+(dd.getHours()>12?dd.getHours()-12:dd.getHours()).toString(),\n\t\tm: ((dd.getMinutes()).toString().length==1?\"0\":\"\")+(dd.getMinutes()).toString(),\n\t\ta: dd.getHours()>12?\"pm\":\"am\"\n\t}\n}", "function UtcToIst(data) {\r\n var dt = new Date(data);\r\n return dt;\r\n}", "getUTCDate(timestamp = null) {\n return new Date().toISOString().replace(\"T\", \" \").split(\".\")[0];\n }", "function getTrueDate(utc){\n var date = new Date(utc);\n return date.toString();\n}", "function calcTime(offset) {\r\n // create Date object for current location\r\n d = new Date();\r\n // convert to msec\r\n // add local time zone offset \r\n // get UTC time in msec\r\n utc = d.getTime() + (d.getTimezoneOffset() * 60000);\r\n // create new Date object for different city\r\n // using supplied offset\r\n nd = new Date(utc + (3600000 * offset));\r\n // return time as a string\r\n return /*\"The local time is \" +*/ nd.toLocaleString();\r\n}", "function UTtoDateTimeLocal(setUT) {\n var d = new Date();\n d.setTime(foundingMoment + (setUT * 1000));\n if (d.toString().includes(\"Standard\")) d.setTime(foundingMoment + ((setUT + 3600) * 1000));\n return d.toString();\n}", "function getUITime(theDate, theTime){\n\tvar tempTime = theTime.split(\":\");\n\tvar tempDate = theDate;\n\n\tvar returnTime = new Date();\n\tvar offset = returnTime.getTimezoneOffset() * 60000;\n\treturnTime.setTime(tempDate.getTime() + (tempTime[0] * 3600 * 1000) + (tempTime[1] * 60 * 1000) + offset);\n\treturn returnTime;\n}", "function converteDataParaUTC(data) {\r\n el = data.split('/');\r\n if (el[0].length < 2) el[0] = '0' + el[0];\r\n if (el[1].length < 2) el[1] = '0' + (el[1] - 1);\r\n return el[2] + '-' + el[1] + '-' + el[0] + 'T00:00:00-03:00';\r\n}", "function correctedTime(time) {\n\tconst timezoneOffsetMinutes = new Date().getTimezoneOffset();\n\t//console.log('timezoneOffsetMinutes', timezoneOffsetMinutes);\n\treturn time-(timezoneOffsetMinutes*60)\n}", "function localize_times() {\n // Localize all the UTC timestamps coming from the server to whatever\n // the user has set in their browser.\n\n require([\"dojo/date/locale\"], function(locale) {\n function format(date, datePattern, timePattern) {\n // The dojo guys like to add a sep between the date and the time\n // fields for us (based on locale). Since we want a standards\n // format, that sep is pure noise, so kill it with {...}.\n // https://bugs.dojotoolkit.org/ticket/17544\n return locale.format(new Date(date), {\n formatLength: 'short',\n datePattern: datePattern + '{',\n timePattern: '}' + timePattern\n }).replace(/{.*}/, ' ');\n }\n\n function long_date(date) { // RFC2822\n return format(date, 'EEE, dd MMM yyyy', 'HH:mm:ss z');\n }\n\n function short_date(date) {\n return format(date, 'EEE, dd MMM', 'HH:mm');\n }\n\n var now = new Date();\n var curr_year = now.getFullYear();\n\n var tzname = locale.format(now, {\n selector: 'time',\n timePattern: 'z'\n });\n\n var i, elements;\n\n // Convert all the fields that have a timezone already.\n elements = document.getElementsByName('date.datetz');\n for (i = 0; i < elements.length; ++i)\n elements[i].innerText = long_date(elements[i].innerText);\n\n // Convert all the fields that lack a timezone (which we know is UTC).\n // We'll assume the timestamps represent the current year as it'll only\n // really affect the short day-of-week name, and even then it'll only be\n // slightly off during the ~1st week of January.\n elements = document.getElementsByName('date.date');\n for (i = 0; i < elements.length; ++i)\n elements[i].innerText = short_date(elements[i].innerText + ' ' +\n curr_year + ' UTC');\n\n // Convert all the fields that are just a timezone.\n elements = document.getElementsByName('date.tz');\n for (i = 0; i < elements.length; ++i)\n elements[i].innerText = tzname;\n });\n}", "function calcTime(offset) {\r\n // create Date object for current location\r\n d = new Date();\r\n // convert to msec\r\n // add local time zone offset \r\n // get UTC time in msec\r\n utc = d.getTime() + (d.getTimezoneOffset() * 60000);\r\n // create new Date object for different city\r\n // using supplied offset\r\n nd = new Date(utc + (3600000*offset));\r\n // return time as a string\r\n return nd;\r\n}", "function calculateDate() {\n\t\tvar REPORTING_OFFSET = \"-8\";\n\t\t// create Date object for current location\n\t\tclientDate = new Date();\n\t\t// convert to milliseconds and add local timezone offset to get UTC time in milliseconds\n\t\tutcDate = clientDate.getTime() + (clientDate.getTimezoneOffset() * 60000);\n\t\t// create new Date object accounting for offset\n\t\tserverDate = new Date(utcDate + (3600000*(REPORTING_OFFSET)));\n\t\t// return time as a string\n\t\treturn(serverDate.getFullYear() + \"|\" + (serverDate.getMonth()+1) + \"|\" + serverDate.getDate());\n\t }", "function dateToUTC(d) {\n var arr = [];\n [\n d.getUTCFullYear(), (d.getUTCMonth() + 1), d.getUTCDate(),\n d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()\n ].forEach(function(n) {\n arr.push((n >= 10) ? n : '0' + n);\n });\n return arr.splice(0, 3).join('-') + ' ' + arr.join(':');\n }", "function convertTZ(date, tzString) {\n return new Date(\n (typeof date === \"string\" ? new Date(date) : date).toLocaleString(\n \"en-US\",\n { timeZone: tzString }\n )\n );\n }", "function convertTimetoDate(date) {\r\n var dateString = date.toString();\r\n return dateString.substring(0, dateString.indexOf(\":\") - 3); //might have to replace with regex\r\n}", "function adjustTimezone(myDate, myTimezone) {\n var offset = isNaN(myTimezone) ? new Date().getTimezoneOffset() : parseFloat(myTimezone) * 60;\n\n //TPV: use zone 0\n offset = 0;\n\n return new Date(myDate.getTime() + offset * 60 * 1000);\n }", "function formatDate(dateStr) {\n var year, month, day, hour, minute, dateUTC, date, ampm, d, time;\n var iso = (dateStr.indexOf(' ') == -1 && dateStr.substr(4, 1) == '-' && dateStr.substr(7, 1) == '-' && dateStr.substr(10, 1) == 'T') ? true : false;\n\n if (iso) {\n year = dateStr.substr(0, 4);\n month = parseInt((dateStr.substr(5, 1) == '0') ? dateStr.substr(6, 1) : dateStr.substr(5, 2)) - 1;\n day = dateStr.substr(8, 2);\n hour = dateStr.substr(11, 2);\n minute = dateStr.substr(14, 2);\n dateUTC = Date.UTC(year, month, day, hour, minute);\n date = new Date(dateUTC);\n } else {\n d = dateStr.split(' ');\n if (d.length != 6 || d[4] != 'at')\n return dateStr;\n time = d[5].split(':');\n ampm = time[1].substr(2);\n minute = time[1].substr(0, 2);\n hour = parseInt(time[0]);\n if (ampm == 'pm') hour += 12;\n date = new Date(d[1] + ' ' + d[2] + ' ' + d[3] + ' ' + hour + ':' + minute);\n date.setTime(date.getTime() - (1000 * 60 * 60 * 7));\n }\n day = (date.getDate() < 10) ? '0' + date.getDate() : date.getDate();\n month = date.getMonth() + 1;\n month = (month < 10) ? '0' + month : month;\n hour = date.getHours();\n minute = (date.getMinutes() < 10) ? '0' + date.getMinutes() : date.getMinutes();\n if (o.timeConversion == 12) {\n ampm = (hour < 12) ? 'am' : 'pm';\n if (hour == 0) hour == 12;\n else if (hour > 12) hour = hour - 12;\n if (hour < 10) hour = '0' + hour;\n return day + '.' + month + '.' + date.getFullYear() + ' at ' + hour + ':' + minute + ' ' + ampm;\n }\n return day + '.' + month + '.' + date.getFullYear() + ' ' + o.translateAt + ' ' + hour + ':' + minute;\n }", "function dateFormat(date){\n var newTime = new Date(date);\n //var utc8 = d.getTime();\n //var newTime = new Date(utc8);\n var Year = newTime.getFullYear();\n var Month = newTime.getMonth()+1;\n var myDate = newTime.getDate();\n var minute = newTime.getMinutes();\n if(minute<10){\n minute=\"0\"+minute;\n }\n if(myDate<10){\n myDate=\"0\"+myDate;\n }\n if(Month<10){\n Month=\"0\"+Month;\n }\n var hour = newTime.getHours()+\":\"+minute;\n var time = Year+\"-\"+Month+\"-\"+myDate+\" \"+hour;\n\n return time;\n}", "function toPRTime(date) {\n return date * 1000;\n}", "function createDate(date) {\n\tif (date)\n\t\treturn new Date(date);\n\telse\n\t\treturn new Date(new Date().toLocaleString(\"en-US\", { timeZone: \"America/Los_Angeles\" }));\n}", "formatDate(datestr) {\n\n // interpret date string as UTC always (comes from server this way)\n var d = new Date(datestr + 'UTC');\n\n // check if we have a valid date\n if (isNaN(d.getTime())) return null;\n\n // Convert to milliseconds, then add tz offset (which is in minutes)\n var nd = new Date(d.getTime() + (60000*this.state.timezoneOffset));\n\n // return time as a user-readable string\n return dateFormat(nd, \"mmmm d yyyy - hh:MM TT\")\n }", "function convert(date)\n{\n d = new Date(date);\n d.setTime(d.getTime() + (-1 * d.getTimezoneOffset() * 60 * 1000));\n return d;\n}", "function calcTime(timezone) {\r\n\tconst d = new Date(),\r\n\t\t\t\tutc = d.getTime() + (d.getTimezoneOffset() * 60000),\r\n\t\t\t\tnd = new Date(utc + (3600000 * timezone.offset));\r\n\r\n\treturn nd.toLocaleString();\r\n}", "function back_to_now()\n{\n var nowdate = new Date();\n var utc_day = nowdate.getUTCDate();\n var utc_month = nowdate.getUTCMonth() + 1;\n var utc_year = nowdate.getUTCFullYear();\n zone_comp = nowdate.getTimezoneOffset() / 1440;\n var utc_hours = nowdate.getUTCHours();\n var utc_mins = nowdate.getUTCMinutes();\n var utc_secs = nowdate.getUTCSeconds();\n utc_mins += utc_secs / 60.0;\n utc_mins = Math.floor((utc_mins + 0.5));\n if (utc_mins < 10) utc_mins = \"0\" + utc_mins;\n if (utc_mins > 59) utc_mins = 59;\n if (utc_hours < 10) utc_hours = \"0\" + utc_hours;\n if (utc_month < 10) utc_month = \"0\" + utc_month;\n if (utc_day < 10) utc_day = \"0\" + utc_day;\n\n document.planets.date_txt.value = utc_month + \"/\" + utc_day + \"/\" + utc_year;\n document.planets.ut_h_m.value = utc_hours + \":\" + utc_mins;\n\n /*\n if (UTdate == \"now\")\n {\n document.planets.date_txt.value = utc_month + \"/\" + utc_day + \"/\" + utc_year;\n }\n else\n {\n document.planets.date_txt.value = UTdate;\n }\n if (UTtime == \"now\")\n {\n document.planets.ut_h_m.value = utc_hours + \":\" + utc_mins;\n }\n else\n {\n document.planets.ut_h_m.value = UTtime;\n }\n */\n planets();\n}", "function setDepartureDatesToNoonUTC(criteria){\n let segments = _.get(criteria,'itinerary.segments',[])\n _.each(segments, (segment,id)=>{\n\n let d=segment.departureTime.substr(0,10).split(\"-\");\n let utc = new Date(Date.UTC(d[0],d[1]-1,d[2]))\n utc.setUTCHours(12);\n logger.debug(`Departure date from UI:${segment.departureTime}, UTC date which will be used for search:${utc}`)\n segment.departureTime=utc;\n });\n}", "function getTimeZoneCode(houtUTC) {\n\tlet rs = [];\n\tif (houtUTC >= 0 && houtUTC <= 11)\n\t\trs.push(-1 * ((houtUTC) % 12));//from 0 to 12\n\tif (houtUTC >= 10)\n\t\trs.push(((24 - houtUTC) % 24));//from 10 to 23\n\treturn rs;\n}", "function convertDateTime(dt, offset) {\n var d = new Date(dt.substring(0, 4), dt.substring(5, 7) - 1,\n dt.substring(8, 10), dt.substring(11, 13),\n dt.substring(14, 16));\n d = new Date(d.valueOf() - offset * 60000); /* minutes to milliseconds */\n /* Date part */\n var yyyy = d.getFullYear();\n var mm = d.getMonth() + 1; if (mm < 10) mm = \"0\" + mm;\n var dd = d.getDate(); if (dd < 10) dd = \"0\" + dd;\n /* Time part */\n var hour = d.getHours(); if (hour < 10) hour = \"0\" + hour;\n var min = d.getMinutes(); if (min < 10) min = \"0\" + min;\n /* Timezone offset */\n var sign = \"+\";\n if (offset > 0) sign = \"-\"; /* Reverse the sign */\n var zh = Math.abs(offset) / 60; if (zh < 10) zh = \"0\" + zh;\n var zm = Math.abs(offset) % 60; if (zm < 10) zm = \"0\" + zm;\n return yyyy + \"-\" + mm + \"-\" + dd + \" \" + hour + \":\" + min\n + \" \" + sign + zh + \":\" + zm;\n}", "function digital_clock() {\n var today=new Date();\n var option={timeZone:'Asia/kolkata'};\n var time=today.toLocaleTimeString('en-US',options);\n document.querySelector('#clock').textContent=time;\n}", "function undate(date) {\n\t// shift the time compensating for local timezone\n\treturn date.getTime()/1000+date.getTimezoneOffset()*60-5*3600;\n}", "static getTimeUTC() {\n return new Date().getTime().toString().slice(0, -3);\n }", "function getISOSDate(time) {\n\tconst tzoffset = (new Date()).getTimezoneOffset() * 60000;\n\tconst localISOTime = (new Date(time - tzoffset)).toISOString().slice(0,-1);\n\tlet ISOSDate;\n\tfor (var i = 0; i < localISOTime.length; i++) {\n\t\tif (localISOTime[i] === 'T') {\n\t\t\tISOSDate = localISOTime.substring(0, i + 1);\n\t\t}\n\t}\n\treturn ISOSDate;\n}", "getDateTime(ts) {\n return dateProcessor(ts * 1000).getDateTime() + ' GMT';\n }", "function adjustTime(time) {\n return time + 60 * (serverTimeZoneOffset + localTimeZoneOffset);\n}", "timestampToDate(utcTime) {\n var date;\n date = new Date(0);\n date.setUTCSeconds(utcTime);\n return date;\n }", "function formatDateInZform(originalDate)\n{\n\tvar formatedDate=\"\";\n\tvar dateComponants=[];\n\t//Check if at least it is timedate format\n\tvar dateCorrected=\"\";\n\tif(originalDate.includes(\"T\")==false)\n\t{\n\t\tdateCorrected=originalDate.replace(\" \",\"T\");\n\t\t//console.log(\"date: \"+originalDate);\n\t}\n\telse\n\t{\n\t\tdateCorrected=originalDate;\n\t}\n\t\n\t//console.log(\"Date :\"+dateCorrected);\n\tif(dateCorrected.includes(\"+\"))\n\t{\n\t\tvar dateComponants=dateCorrected.split(\"+\");\n\t\tif(dateComponants.length>0)\n\t\t{\n\t\t\tformatedDate=dateComponants[0];//+\"+00:00\"\n\t\t\t//formatedDate+=\"+00:00\";\n\t\t\tif(formatedDate.includes(\"Z\")||formatedDate.includes(\"z\"))\n\t\t\t{\n\t\t\t\tvar dateComponant2=formatedDate.split(\"Z\");\n\t\t\t\tformatedDate=dateComponant2[0];\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\t//add the timestamp part \n\t\t//console.log(dateCorrected+\"T00:00:00.000+01:00\");\n\t\tformatedDate=dateCorrected+\"T00:00:00.000\";\n\t}\n\t\n\treturn formatedDate+manifest.typeZone;\n}", "function convertTime(time) {\n return moment.unix(time).tz('UTC').format('h A');\n}", "function getTimeZone(date) {\n var totalMinutes = date.getTimezoneOffset();\n var isEast = totalMinutes <= 0;\n if (totalMinutes < 0) {\n totalMinutes = -totalMinutes;\n }\n var hours = Math.floor(totalMinutes / MINUTES_IN_HOUR);\n var minutes = totalMinutes - MINUTES_IN_HOUR * hours;\n var size = 2;\n hours = strPad(hours, size, '0');\n if (minutes === 0) {\n minutes = '';\n } else {\n minutes = strPad(minutes, size, '0');\n }\n return '' + (isEast ? '+' : '-') + hours + (minutes ? ':' + minutes : '');\n }", "function buildDateAndTimeGMT(date, timeEST) {\r\n\r\n var dateEST = moment.tz(date.format('YYYY/MM/DD') + \" \" + timeEST, \"YYYY/MM/DD h:mmA\", \"America/New_York\");\r\n return dateEST.clone().tz(\"Europe/London\");\r\n}", "function getCurrentUTCtime() {\n var date = new Date();\n var utcDate = date.toUTCString();\n\n // console.log(\"D----------------------------------------------\");\n // console.log(\"DATE: \",date);\n // console.log(\"UTC DATE: \",date.toUTCString());\n // console.log(\"D----------------------------------------------\");\n\n return utcDate;\n}", "function calcTime(city, offset) {\r\n // create Date object for current location\r\n d = new Date();\r\n // convert to msec\r\n // add local time zone offset\r\n // get UTC time in msec\r\n utc = d.getTime() + (d.getTimezoneOffset() * 60000);\r\n // create new Date object for different city\r\n // using supplied offset\r\n return utc + 3600000*offset;\r\n\t//nd = new Date(utc + (3600000*offset));\r\n // return time as a string\r\n //return nd;\r\n}", "function mostraHora (){\n let data = new Date();\n return data.toLocaleTimeString('pt-BR', {\n hour12: false\n });\n}", "function isoToUTCString(str) {\n var parts = str.match(/\\d+/g),\n isoTime = Date.UTC(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]),\n isoDate = new Date(isoTime);\n return isoDate.toUTCString();\n}", "function toLocalTime(time) {\n const localTime = new Date(time)\n return localTime.toLocaleString(\"en-AU\");\n}", "function formatDateUTC(date) {\n if (date instanceof Date) {\n return date.getUTCFullYear() + '-' +\n padZeros(date.getUTCMonth()+1, 2) + '-' +\n padZeros(date.getUTCDate(), 2);\n\n } else {\n return null;\n }\n}", "function convertChartDateToLocalDate(chartDate) {\n var m = moment.utc(chartDate);\n var offsetMinutes = m.toDate().getTimezoneOffset();\n m.add(offsetMinutes, 'minutes');\n return m.toDate();\n }", "function getStamp(date)\n{\n var year = '';\n for(let i = 0; i < 4; i++)\n {\n year += date.charAt(i);\n }\n var month = getMonth(parseInt(date.charAt(5) + date.charAt(6)));\n var day = date.charAt(8) + date.charAt(9);\n\n //Hour is 6 hours ahead of current time zone, subtract 6 to fix issue\n var hour = parseInt(date.charAt(11) + date.charAt(12))-6;\n if(hour < 0)\n {\n hour -= 12;\n hour *= -1;\n }\n var minute = date.charAt(13) + date.charAt(14) + date.charAt(15);\n //If hour is more than 12 we subtract 12 to convert time to standard time zone\n if(hour > 12)\n {\n hour -= 12;\n hour = hour + minute+ \"PM\";\n }\n //If hour is 12 then leave it as is and set it to PM\n else if(hour == 12)\n {\n hour = hour + minute + \"PM\";\n }\n //If hour is 0 we set it to 12 to convert to standard time zone\n else if(hour == 0)\n {\n hour = 12;\n hour = hour + minute + \"AM\";\n }\n //Otherwise we just set to AM\n else\n {\n hour = hour = hour + minute+ \"AM\";\n }\n\n return \"Date: \" + month + \" \" + day + \", \" + year + \", Time: \" + hour;\n}", "function dateToCRMFormat(date) {\n return dateFormat(date, \"yyyy-mm-ddThh:MM:ss+\" + (-date.getTimezoneOffset() / 60) + \":00\");\n}", "function convertDate(inputFormat) {\n function pad(s) { return (s < 10) ? '0' + s : s; }\n var asiaTime = new Date(inputFormat).toLocaleString(\"en-US\", {timeZone: \"Asia/Tokyo\"});\n var d = new Date(asiaTime);\n return d.getFullYear()+\"/\"+pad(d.getMonth()+1)+\"/\"+pad(d.getDate())+\" \"+pad(d.getHours())+\":\"+pad(d.getMinutes())+\":\"+pad(d.getSeconds());\n}", "function unixToLocal(t) {\n var dt = new Date(t*1000);\n var hr = dt.getHours();\n var m = '0' + dt.getMinutes();\n return hr+ ':' +m.substr(-2); \n }", "function ConvertTimeX(offset) {\n var myDate = new Date(offset);\n var ts_tostring = myDate.toGMTString();\n //\t\tvar ts_tolocalstring = \" \"+myDate.toLocaleString()\n return ts_tostring;\n }", "function convertTime(unixTimestamp) {\n let myDate = new Date(unixTimestamp * 1000);\n\n let hours = myDate.getHours();\n if (hours > 12) {\n hours = hours - 12 + \" pm\";\n }\n else if ((hours < 12) || (hours == 0)) {\n hours += \" am\";\n }\n else {\n hours += \" pm\";\n }\n let time = hours;\n return time;\n}", "function parseIsoToTimestamp(_date) {\n if ( _date !== null ) {\n var s = $.trim(_date);\n s = s.replace(/-/, \"/\").replace(/-/, \"/\");\n s = s.replace(/-/, \"/\").replace(/-/, \"/\");\n s = s.replace(/:00.000/, \"\");\n s = s.replace(/T/, \" \").replace(/Z/, \" UTC\");\n s = s.replace(/([\\+\\-]\\d\\d)\\:?(\\d\\d)/, \" $1$2\"); // -04:00 -> -0400\n return Number(new Date(s));\n }\n return null;\n }", "function ISODateString(a){function b(a){return a<10?\"0\"+a:a}return a.getUTCFullYear()+\"-\"+b(a.getUTCMonth()+1)+\"-\"+b(a.getUTCDate())+\"T\"+b(a.getUTCHours())+\":\"+b(a.getUTCMinutes())+\":\"+b(a.getUTCSeconds())+\"Z\"}", "function formatIso(date) {\n\t return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n\t}", "function formatIso(date) {\n\t return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n\t}", "function formatIso(date) {\n\t return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n\t}", "function formatIso(date) {\n\t return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n\t}", "toAppTimezone(value) {\n return value\n ? dayjs\n .tz(value, this.userTimezone)\n .clone()\n .tz(this.appConfig.timezone)\n .format('YYYY-MM-DD HH:mm:ss')\n : value\n }", "function formatIso(date) {\n return new Date(date.toDateString() + ' 12:00:00 +0000').toISOString().substring(0, 10);\n}" ]
[ "0.69358057", "0.66025054", "0.6601455", "0.65316075", "0.65142703", "0.6426732", "0.6398034", "0.63451177", "0.6302007", "0.63002443", "0.6222299", "0.61798775", "0.6176149", "0.6171457", "0.6171189", "0.61192024", "0.60711014", "0.6012052", "0.60070336", "0.5975017", "0.5961675", "0.5948713", "0.5931749", "0.5901644", "0.59014314", "0.5880948", "0.58370537", "0.5836581", "0.5826762", "0.58167225", "0.58140534", "0.5811058", "0.5791561", "0.5777261", "0.57503086", "0.574501", "0.57413167", "0.5731085", "0.5730424", "0.5727966", "0.5721479", "0.5690532", "0.5689189", "0.56708443", "0.56541497", "0.56484145", "0.5638336", "0.56289613", "0.56262124", "0.5625064", "0.5604812", "0.56000113", "0.55772537", "0.55708337", "0.55679584", "0.55548096", "0.55445814", "0.55416393", "0.5541354", "0.5540712", "0.55322963", "0.55282235", "0.5525725", "0.55017054", "0.55013686", "0.54979044", "0.5495819", "0.54914683", "0.5486104", "0.54860014", "0.54838026", "0.5479115", "0.5472715", "0.5452263", "0.5448741", "0.54457664", "0.54395807", "0.54245573", "0.5419468", "0.5400813", "0.53979987", "0.53948987", "0.53920746", "0.5370249", "0.5365025", "0.53551245", "0.5345346", "0.5343816", "0.5324281", "0.532281", "0.53183895", "0.53103477", "0.53073144", "0.5306638", "0.5302106", "0.5302106", "0.5302106", "0.5302106", "0.530001", "0.5279029" ]
0.79901075
0
returns a formatted string of the current datetime in Ottawa time
function getCurrentOttawaDateTimeString() { var date = convertUTCtoOttawa(new Date()); var hour = date.getHours(); hour = (hour < 10 ? "0" : "") + hour; var min = date.getMinutes(); min = (min < 10 ? "0" : "") + min; var year = date.getFullYear(); var month = date.getMonth() + 1; month = (month < 10 ? "0" : "") + month; var day = date.getDate(); day = (day < 10 ? "0" : "") + day; return year + "-" + month + "-" + day + ": " + hour + ":" + min; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFormattedCurrentDateTime() {\n return new Date().toJSON().slice(0, 19).replace('T', ' ');\n}", "function nowAsString() {\n return new Date().toISOString().replace(\"T\", \" \").replace(\"Z\",\" \");\n}", "function formatCurrentDateTime() {\n // Timestamp from API seems to be GMT, which the JS Date object handles\n var dayName = ['Sunday', 'Monday', 'Tuesday', \n 'Wednesday', 'Thursday', 'Friday', 'Saturday']; \n var localNow = new Date(),\n dayString = dayName[ localNow.getDay() ],\n localTime = localNow.toLocaleTimeString();\n // console.log(\"in formatCurrentDateTime\", dayString, localTime);\n return 'as of ' + dayString + ' ' + localTime;\n}", "function nowAsString() {\n return new Date().toISOString().substring(0, 10);\n}", "function currentDateTime(){\n let date_ob = new Date();\n // current date\n // adjust 0 before single digit date\n let day = (\"0\" + date_ob.getDate()).slice(-2);\n // current month\n let month = (\"0\" + (date_ob.getMonth() + 1)).slice(-2);\n // current year\n let year = date_ob.getFullYear();\n // current hours\n let hours = date_ob.getHours();\n // current minutes\n let minutes = date_ob.getMinutes();\n // current seconds\n let seconds = date_ob.getSeconds();\n return year+'-'+month+'-'+day+'T'+hours+\":\"+minutes+\":\"+seconds+\"Z\";\n }", "static currentDateToISOString()/*:string*/{\n const currentDateTime = new Date()\n currentDateTime.setMinutes(currentDateTime.getMinutes() - currentDateTime.getTimezoneOffset()) \n return currentDateTime.toISOString()\n }", "function matter_datetime(){\n var dt = curr_date() + ' ' + curr_time() + ' -0400';\n return dt;\n }", "function currentTime() {\n var now = new Date();\n var offset = now.getTimezoneOffset();\n var actual = now - offset;\n var str_date = new Date(actual).toLocaleDateString();\n var str_time = new Date(actual).toLocaleTimeString();\n return str_date + ' ' + str_time;\n}", "function timeFormatFn() {\n let now = new Date();\n return now.toUTCString();\n}", "function get_timestr() { \n\tvar d = new Date();\n\treturn d.toLocaleString() + \"<br />\\n\";\n}", "function getCurrentTime(){\n\t//get timestamp and format it\n\t\tvar date = new Date();\n\t\tvar hours = date.getHours()\n\t\tvar ampm = (hours >= 12) ? \"PM\" : \"AM\";\n\t\thours = hours% 12||12;\n\t\tvar minutes =date.getMinutes();\n\t\tminutes = (minutes <10) ? \"0\" + minutes:minutes;\n\t\treturn \"(\" + hours + \":\" + minutes + ampm + \")\";\n}", "function now() {\n return formatDateTime(moment());\n }", "function nowString () {\n const stamp = new Date()\n const h = stamp.getHours().toString().padStart(2, '0')\n const m = stamp.getMinutes().toString().padStart(2, '0')\n const s = stamp.getSeconds().toString().padStart(2, '0')\n const ms = stamp.getMilliseconds().toString().padStart(3, '0')\n return `${h}:${m}:${s}.${ms}`\n}", "static get_time() {\n return (new Date()).toISOString();\n }", "function atualizar_tempo(){\r\n\td = new Date();\r\n\treturn d.toLocaleTimeString();\r\n}", "getCurrentDate()\n {\n // get date:\n let date = new Date();\n // format:\n return date.toISOString().slice(0, 19).replace('T', ' ');\n }", "static getDateTimeString() {\n return `[${moment().format(\"DD.MM.YYYY HH:mm\")}] `;\n }", "getCurrentDateTime() {\n const today = new Date();\n let dd = today.getDate();\n let mm = today.getMonth() + 1; // January is 0!\n const yyyy = today.getFullYear();\n let hours = today.getHours();\n let minutes = today.getMinutes();\n\n if (dd < 10) {\n dd = `0${dd}`;\n }\n if (mm < 10) {\n mm = `0${mm}`;\n }\n if (hours < 10) {\n hours = `0${hours}`;\n }\n if (minutes < 10) {\n minutes = `0${minutes}`;\n }\n return `${dd}/${mm}/${yyyy}-${hours}:${minutes}`.replace(/\\//g, '').replace(/:/g, '').replace(' ', '');\n }", "function getFormattedTime() {\n var today = new Date();\n\n return moment(today).format(\"YYYYMMDDHHmmss\");\n }", "function getCurrentDateTime() {\n let today = new Date();\n let date = `${today.getMonth() +\n 1}/${today.getDate()}/${today.getFullYear()}`;\n\n return `${date} ${formatAMPM(today)}`;\n}", "function getFormattedTime() {\n var today = new Date();\n //return moment(today).format(\"YYYYMMDDHHmmssSSS\");\n return moment(today).format(\"YYYYMMDDHHmmss\");\n }", "function getDateString () {\n var time = new Date();\n // 14400000 is (GMT-4 Montreal)\n // for your timezone just multiply +/-GMT by 3600000\n var datestr = new Date(time - 14400000).toISOString().replace(/T/, ' ').replace(/Z/, '');\n return datestr;\n}", "function prettyDate() {\n var theTimeIsNow = new Date(Date.now());\n var hors = theTimeIsNow.getHours();\n var mens = theTimeIsNow.getMinutes();\n var sex = theTimeIsNow.getSeconds();\n return hors + \":\" + mens + \":\" + sex;\n }", "function currentTimeString(){\n\treturn new Date().toLocaleString(\"en-US\",{hour:\"numeric\",minute:\"numeric\",hour12:true,second:\"numeric\"});\n}", "function getCurrentTimeString() {\n const date = new Date();\n return date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();\n}", "function getCurrentDateAndTime() {\n\tvar datetime = new Date();\n\tdatetime = datetime.toISOString().replace(/[^0-9a-zA-Z]/g,'');\t// current date+time ISO8601 compressed\n\tdatetime = datetime.substring(0,15) + datetime.substring(18,19); // remove extra characters\n\treturn datetime;\n}", "function getCurrentDateString() {\n\t\tlet date = new Date();\n\t\tlet dateString = \"\" + date.getFullYear() + \"-\" + (date.getMonth() + 1) + \"-\" + date.getDate() + \"-\" + \n\t\t\t(date.getHours() + 1) + \"-\" + (date.getMinutes() + 1);\n\n\t\treturn dateString;\n}", "function getFormattedDate() {\n return \"[\" + new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '') + \"] \";\n}", "function GetDateTime() {\n return new Date().toISOString()\n .replace(/T/, ' ') // replace T with a space \n .replace(/\\..+/, ''); // delete the dot and everything after\n}", "function now() {\n return new Date().toISOString();\n}", "function now() {\n return new Date().toISOString();\n}", "function getFormattedTime() {\n var today = new Date();\n //return moment(today).format(\"YYYYMMDDHHmmssSSS\");\n return moment(today).format(\"DDHHmmssSSS\");\n }", "function time() {\n return dateFormat(\"isoUtcDateTime\");\n}", "function dateNow() {\n\tconst rightNow = new Date();\n\tconst hour = rightNow.getHours();\n\tconst min = rightNow.getMinutes();\n\tconst seconds = rightNow.getSeconds();\n\tconst res = rightNow.toISOString().slice(0, 10).replace(/-/g, \"/\");\n\treturn `${res} - ${hour % 12}:${min}:${seconds>=10? seconds:\"0\"+seconds} ${hour > 12 ? \"pm\" : \"am\"}`;\n}", "function getDateString() {\n var time = new Date().getTime();\n // 32400000 is (GMT+9 Japan)\n // for your timezone just multiply +/-GMT by 36000000\n var datestr = new Date(time +32400000).toISOString().replace(/T/, ' ').replace(/Z/, '');\n return datestr;\n}", "function getDateString() {\n var time = new Date().getTime();\n // 32400000 is (GMT+9 Korea, GimHae)\n // for your timezone just multiply +/-GMT by 3600000\n var datestr = new Date(time +32400000).toISOString().replace(/T/, ' ').replace(/Z/, '');\n return datestr;\n}", "function getLocalDateTimeISOString(dateTime) {\n return dateTime.getFullYear() + '-' +\n pad(dateTime.getMonth() + 1) + '-' + \n pad(dateTime.getDate()) + 'T' + \n pad(dateTime.getHours()) + ':' + \n pad(dateTime.getMinutes());\n}", "function getDateTimeSampleText(now) {\n\t\treturn now.clone().format(timestampFormat);\n\t}", "function getNow(){\n var date = new Date(); \n var day = date.getDate();\n var month = date.getMonth()+1;\n var year = date.getFullYear();\n var hours = date.getHours();\n var minutes = date.getMinutes();\n var seconds = date.getSeconds();\n \n if (day < 10) {\n day = \"0\" + day;\n }\n \n if (month < 10) {\n month = \"0\" + month;\n }\n \n if (hours < 10) {\n hours = \"0\" + hours;\n }\n \n if (minutes < 10) {\n minutes = \"0\" + minutes;\n }\n\n if (seconds < 10) {\n seconds = \"0\" + seconds;\n } \n \n return year + \"-\" + month + \"-\" + day + \" \" + hours + \"-\" + minutes + \"-\" + seconds;\n ;\n return datetime;\n}", "lastAccess(){\n var today = new Date();\n var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();\n var time = today.getHours() + \":\" + today.getMinutes();\n var dateTime = date +' '+ time;\n return dateTime;\n }", "function getCurrentTime() \n{\n // Compute date time information\n let today = new Date();\n let hour = (today.getHours() < 10) ? '0' + today.getHours() : today.getHours();\n let minute = (today.getMinutes() < 10) ? '0' + today.getMinutes() : today.getMinutes();\n let second = (today.getSeconds() < 10) ? '0' + today.getSeconds() : today.getSeconds();\n let year = today.getFullYear();\n let month = (today.getMonth() < 10) ? '0' + today.getMonth() : today.getMonth();\n let day = (today.getDate() < 10) ? '0' + today.getDate() : today.getDate();\n\n // Format datetime to YYYY-MM-DD_HH:mm:ss\n let time = hour + ':' + minute + ':' + second;\n let date = year + '-' + month + '-' + day;\n\n return date + '_' + time;\n}", "function datetimenow(){\n\n \n var today = new Date();\n var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();\n var time = today.getHours() + \":\" +today.getMinutes() + \":\" + today.getSeconds();\n var dateTime = date+' '+time;\n \n return dateTime;\n }", "function getCurrentDateString() {\n return dataUtils_1.formatDate.bind(new Date())('yyyy-MM-dd-hhmm');\n}", "function getRealSelectedTimeString() {\n return models[\"ChesapeakeBay_ADCIRCSWAN\"][\"lastForecast\"].clone().add(currentHourSetting, \"hours\").format(\"YYYY-MM-DD HH:MM:SS\")\n}", "function getCurrentTime() {\n var date = new Date();\n //var timestamp = date.toLocaleString('en-US', {\n // hour: 'numeric',\n // minute: 'numeric',\n // hour12: true\n //});\n var timestamp = date.toLocaleString('en-US', {});\n return timestamp;\n }", "function getCurDateTimeForOffice () {\n\t\tvar date = new Date ();\n\n\t\tvar year = date.getFullYear ();\n\t\tvar month = date.getMonth () + 1;\n\t\tvar day = date.getDate ();\n\t\tvar hour = date.getHours ();\n\t\tvar min = date.getMinutes ();\n\t\tvar sec = date.getSeconds ();\n\n\t\tmonth = (month < 10 ? \"0\" : \"\") + month;\n\t\tday = (day < 10 ? \"0\" : \"\") + day;\n\t\thour = (hour < 10 ? \"0\" : \"\") + hour;\n\t\tmin = (min < 10 ? \"0\" : \"\") + min;\n\t\tsec = (sec < 10 ? \"0\" : \"\") + sec;\n\n\t\treturn year + \"-\" + month + \"-\" + day + \"T\" + hour + \":\" + min + \":\" + sec + 'Z';\n\t}", "function now(){\r\n const date = new Date()\r\n const hour = date.getHours()\r\n const minute = date.getMinutes()\r\n const day = date.getUTCDate()\r\n const month = date.getMonth()\r\n const year = date.getFullYear()\r\n return year + \"-\" + month + \"-\" + day + \" \" + hour + \":\" + minute + \":\" + date.getSeconds()\r\n}", "function currDateTime(){\n var currDateTime = new Date();\n document.write(currDateTime);\n}", "function currDateTime(){\n var currDateTime = new Date();\n document.write(currDateTime);\n}", "function timeNow() {\n var d = new Date(),\n h = (d.getHours()<10?'0':'') + d.getHours(),\n m = (d.getMinutes()<10?'0':'') + d.getMinutes(),\n s = (d.getSeconds()<10?'0':'') + d.getSeconds();\n return h + ':' + m + ':' + s;\n }", "function timeUtil(){\n var timestr = new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '');\n return timestr;\n}", "function getTimeString() \n{\n var current_date = new Date();\n return current_date.getHours() + \":\" + current_date.getMinutes();\n}", "function date_now(){\n var fecha = new Date(); \n var hora = fecha.getHours();\n var minutos = fecha.getMinutes();\n var segundos = fecha.getSeconds();\n var dia = fecha.getDate();\n var mes = fecha.getMonth();\n var anio = fecha.getFullYear();\n var fecha_final = (round_num(segundos,minutos))+'_'+(dia)+(mes)+(anio);\n return fecha_final;\n }", "function getCurrentTime() {\n var current_date_time = new Date()\n .toISOString()\n .replace(\"T\", \" \")\n .substr(0, 19);\n return current_date_time;\n}", "function GetCurrentTime() {\n var date = new Date();\n var hours = date.getHours() > 12 ? date.getHours() - 12 : date.getHours();\n var am_pm = date.getHours() >= 12 ? \"PM\" : \"AM\";\n hours = hours < 10 ? \"0\" + hours : hours;\n var minutes = date.getMinutes() < 10 ? \"0\" + date.getMinutes() : date.getMinutes();\n var seconds = date.getSeconds() < 10 ? \"0\" + date.getSeconds() : date.getSeconds();\n return hours + \":\" + minutes + \":\" + seconds + \" \" + am_pm;\n}", "function getCurrentDateString() {\n return 'NAME_OF_BOT_HERE :: ' + (new Date()).toISOString() + ' ::';\n }", "function getDateTime() {\n //\n var now = new Date();\n var year = now.getFullYear();\n var month = now.getMonth() + 1;\n var day = now.getDate();\n\n var time = now.toLocaleTimeString();\n\n // Structured the way I am more used to: Month Day Year, for display on screen.\n var dateTime = month + \"/\" + day + \"/\" + year + \" \" + time;\n\n return dateTime;\n }", "function getCurrentTime () {\n const date = new Date()\n const m = date.getMonth() + 1\n const d = date.getDate()\n const y = date.getFullYear()\n const t = date.toLocaleTimeString().toLowerCase()\n\n return (m + '/' + d + '/' + y + ' ' + t)\n}", "function getCurrentTime() {\n var today = new Date();\n var date =\n today.getFullYear() + \"-\" + (today.getMonth() + 1) + \"-\" + today.getDate();\n var time =\n today.getHours() + \":\" + today.getMinutes() + \":\" + today.getSeconds();\n var dateTime = date + \" \" + time;\n return dateTime;\n}", "function data_time(){\r\n var current_datatime = new Date();\r\n var day = zero_first_format(current_datatime.getDate());\r\n var month = zero_first_format(current_datatime.getMonth()+1);\r\n var year = zero_first_format(current_datatime.getFullYear());\r\n var hours = zero_first_format(current_datatime.getHours());\r\n var minutes = zero_first_format(current_datatime.getMinutes());\r\n var seconds = zero_first_format(current_datatime.getSeconds());\r\n\r\n return day+\".\"+month+\".\"+year+\".\"+hours+\".\"+minutes+\".\"+seconds;\r\n\r\n}", "function getTodaysDateTime() {\n var dateToday = new Date();\n return dateToday.toDateString() + ' (' + dateToday.getHours() + \":\" + dateToday.getMinutes() + ')';\n}", "static getUTCDateTime() {\n return new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '')\n }", "getDateTime() {\n let currentdate = new Date();\n let datetime =\n currentdate.getDate() +\n \"/\" +\n (currentdate.getMonth() + 1) +\n \"/\" +\n currentdate.getFullYear() +\n \" @ \" +\n currentdate.getHours() +\n \":\" +\n currentdate.getMinutes() +\n \":\" +\n currentdate.getSeconds();\n return datetime;\n }", "function now() {\r\n\tvar y, m, d, h, i, s, dt;\r\n\r\n\tdt = new Date();\r\n\r\n\ty = String(dt.getFullYear());\r\n\r\n\tm = String(dt.getMonth() + 1);\r\n\tif (m.length === 1) {\r\n\t\tm = '0' + m;\r\n\t}\r\n\r\n\td = String(dt.getDate());\r\n\tif (d.length === 1) {\r\n\t\td = '0' + d.toString();\r\n\t}\r\n\r\n\th = String(dt.getHours() + 1);\r\n\tif (h.length === 1) {\r\n\t\th = '0' + h;\r\n\t}\r\n\r\n\ti = String(dt.getMinutes() + 1);\r\n\tif (i.length === 1) {\r\n\t\ti = '0' + i;\r\n\t}\r\n\r\n\ts = String(dt.getSeconds() + 1);\r\n\tif (s.length === 1) {\r\n\t\ts = '0' + s;\r\n\t}\r\n\treturn y + '-' + m + '-' + d + ' ' + h + ':' + i + ':' + s;\r\n}", "function getCurrentTime(){\n return '[' + moment.format(\"HH:mm\") + '] ';\n}", "function getCurTime () {\n var myDate = new Date();\n return myDate.toLocaleTimeString();\n }", "function getTimeAsString() {\n var currentTime = new Date(); //We use the JavaScript Date object/function and then configure it\n\n var currentHour;\n var currentMinute;\n var currentSecond;\n\n if(currentTime.getHours() < 10) {\n currentHour = \"0\" + String(currentTime.getHours());\n } else {\n currentHour = String(currentTime.getHours());\n }\n\n if(currentTime.getMinutes() < 10) {\n currentMinute = \"0\" + String(currentTime.getMinutes());\n } else {\n currentMinute = String(currentTime.getMinutes());\n }\n\n if(currentTime.getSeconds() < 10) {\n currentSecond = \"0\" + String(currentTime.getSeconds());\n } else {\n currentSecond = String(currentTime.getSeconds());\n }\n\n var time = currentHour + \":\" + currentMinute + \":\" + currentSecond;\n return time; //returns the time string\n}", "function GetCurrentTime() {\n var sentTime = new Date();\n var dateTime = sentTime.toLocaleString();\n return dateTime;\n}", "function retrieveTimestamp(){\n var DT_obj=new Date();\n // var date_string=DT_obj.getFullYear()+\"-\"+(padSingleDigits(10)+1)+\"-\"+padSingleDigits(DT_obj.getDate());\n var date_string=DT_obj.getFullYear()+\"-\"+(padSingleDigits(DT_obj.getMonth()+1))+\"-\"+padSingleDigits(DT_obj.getDate());\n \n var time_string=padSingleDigits(DT_obj.getHours())+\":\"+padSingleDigits(DT_obj.getMinutes())+\":\"+padSingleDigits(DT_obj.getSeconds());\n\n var date_time_string=date_string+\" \"+time_string;\n // console.log(date_time_string);\n\n return date_time_string;\n }", "function currentTime () {\n return new Date().toLocaleTimeString()\n}", "function getNow() {\n\tnow = new Date();\n\tyyyy = now.getFullYear().toString();\n\tm = now.getMonth() + 1;\n\tmm = m.toString();\n if (mm.length == 1) mm = '0' + mm;\n\tdd = now.getDate().toString();\n\tif (dd.length == 1) dd = '0' + dd;\n\thh = now.getHours().toString();\n\tmn = now.getMinutes().toString();\n\tif (mn.length == 1) mn = '0' + mn;\n\treturn yyyy + mm + dd + \"_\" + hh + \":\" + mn;\n}", "function now() {\n return new Date().toISOString().replace(/\\..+/, '');\n}", "static fmtTime(timestamp) {\n let str = ''\n if (timestamp != null) {\n let date = new Date(timestamp)\n date.setMinutes(date.getMinutes() - date.getTimezoneOffset())\n str = date.toISOString().slice(0, 19).replace('T', ' ')\n }\n return str\n }", "function now() {\n var date = new Date();\n var time = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + (date.getMinutes() < 10 ? ('0' + date.getMinutes()) : date.getMinutes()) + \":\" + (date.getSeconds() < 10 ? ('0' + date.getSeconds()) : date.getSeconds());\n return time;\n }", "function currTime() {\n const options = {\n //timeZone: \"Africa/Accra\",\n //hour12: true,\n //hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\"\n };\n\n var tempDate = new Date();\n return tempDate.toLocaleTimeString(\"en-US\", options);\n }", "function time_str() {\n var d = new Date();\n var date = two(d.getDate());\n var month = two(d.getMonth() + 1);\n var hour = two(d.getHours());\n var minutes = two(d.getMinutes());\n return month + date + '-' + hour + minutes;\n}", "function timeString(){\r\n var date = new Date()\r\n var current_hour = date.toLocaleString()\r\n current_hour = pad(current_hour, 23, 1, \" \")\r\n return current_hour\r\n}", "toString() {\n return this.time.toLocaleTimeString('en-US', {hour12: false});\n }", "function currentTime() {\n\tvar dataStamp = new Date();\n\tvar year = dataStamp.getFullYear().toString();\n\tvar month = (dataStamp.getMonth()+1).toString();\n\tmonth = ((month < 10) ? \"0\" : \"\") + month;\n\tvar day = dataStamp.getDate().toString();\n\tday = ((day < 10) ? \"0\" : \"\") + day;\n\tvar hour = dataStamp.getHours().toString();\n\thour = ((hour < 10) ? \"0\" : \"\") + hour;\n\tvar minute = dataStamp.getMinutes().toString();\n\tminute = ((minute < 10) ? \"0\" : \"\") + minute;\n\tvar second = dataStamp.getSeconds().toString();\n\tsecond = ((second < 10) ? \"0\" : \"\") + second;\n\treturn year+month+day+hour+minute+second;\n}", "getCurrentDate () {\n var dateTime = new Date()\n return '[' + dateTime.getFullYear() + '/' +\n (dateTime.getMonth() + 1).toString().padStart(2, '0') + '/' +\n dateTime.getDate().toString().padStart(2, '0') + ' ' +\n dateTime.getHours().toString().padStart(2, '0') + ':' +\n dateTime.getMinutes().toString().padStart(2, '0') + ':' +\n dateTime.getSeconds().toString().padStart(2, '0') + ']'\n }", "toUTCString() {\n return this.timestamp().toUTCString();\n }", "function get_date_time_now(){\n let today = new Date();\n let date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();\n let time = today.getHours() + \":\" + today.getMinutes() + \":\" + today.getSeconds();\n let dateTime = date+' '+time;\n return dateTime\n}", "function toLocalISOString() {\n var d = new Date();\n var off = d.getTimezoneOffset();\n return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes() - off, d.getSeconds(), d.getMilliseconds()).toISOString();\n }", "function getDateTime(){\n var date = new Date() \n var dateTime = date.toISOString()\n utc = date.getTimezoneOffset() / 60\n dateTime = dateTime.slice(0, 19)\n dateTime += '-0' + utc + ':00'\n return dateTime\n}", "function getNow(){\n\tvar mydate = new Date()\n\treturn mydate.getFullYear() +'-'+ (mydate.getMonth()+1) +'-'+ mydate.getDay() +' '+mydate.getHours()+':'+mydate.getMinutes()+':'+mydate.getSeconds()\n}", "function dateTime() {\n var dateTime = new Date();\n document.write(\"Current Date\", \" \" , dateTime , \"<br>\");\n }", "function getDateTimeString(date, time) {\n return getDateString(date) + 'T' + getTimeString(time);\n }", "function dateTodayStr() {\n\n var today = new Date();\n return dateFmtStr(today);\n}", "function getCurrentTime(){\n var today = new Date();\n var dd = formatToTwoDigit(today.getDate());\n var mm = formatToTwoDigit(today.getMonth()+1); \n var yyyy = today.getFullYear();\n var hour = formatToTwoDigit(today.getHours());\n var minute = formatToTwoDigit(today.getMinutes());\n return yyyy+\"-\"+mm+\"-\"+dd+\" \"+hour+\":\"+minute;\n}", "function returnCurrentTime()\n{\n\t//YYYY-MM-DD HH:MM:SS\n\tvar d = new Date();\n\tvar time=d.getFullYear()+'-'+if0((d.getMonth()+1))+'-'+if0(d.getDate())+' '+if0(d.getHours())+':'+if0(d.getMinutes())+':'+if0(d.getSeconds());\n\treturn time;\n}", "function getTimeStamp() {\n return (new Date().toISOString())\n}", "function formatDateStamp() {\n var now = new Date();\n return now.toLocaleTimeString() + now.getMilliseconds();\n}", "function getDateTime() {\n var now = new Date();\n var year,month,day,hour,minute,second;\n year = now.getFullYear().toString();\n if(now.getMonth() + 1 < 10) {\n month = \"0\" + (now.getMonth() + 1).toString();\n } else {month = now.getMonth + 1};\n if(now.getDate() < 10) {\n day = \"0\" + now.getDate().toString();\n } else {day = now.getDate().toString();}\n hour = now.getHours().toString();\n minute = now.getMinutes().toString();\n second = now.getSeconds().toString();\n miliseconds = now.getMilliseconds().toString();\n\n return year + \"-\" + month + \"-\" + day + \" \" + hour + \":\" + minute + \":\" + second + \".\" + miliseconds;\n}", "function datestring () {\n var d = new Date(Date.now() - 5*60*60*1000); //est timezone\n return d.getUTCFullYear() + '-'\n + (d.getUTCMonth() + 1) + '-'\n + d.getDate();\n}", "function datestring () {\n var d = new Date(Date.now() - 5*60*60*1000); //est timezone\n return d.getUTCFullYear() + '-'\n + (d.getUTCMonth() + 1) + '-'\n + d.getDate();\n}", "function getDateTimeString(date) {\n\tfunction pad10(n) {\n\t\treturn n < 10 ? '0' + n : n;\n\t}\t\n\treturn date.getFullYear() + \"-\" + pad10(date.getMonth()) + \"-\" + pad10(date.getDate()) + \" \" + pad10(date.getHours()) + \":\" + pad10(date.getMinutes()) + \":\" + pad10(date.getSeconds());\n}", "function getTime() {\n\treturn new Date().toUTCString();\n}", "function getDateTime(){\n console.log(\"date time\")\n var currentdate = new Date();\n return datetime = currentdate.getFullYear() + \"-\"\n + addZero(currentdate.getMonth()+1) + \"-\"\n + addZero(currentdate.getUTCDate()) + \"T\"\n + addZero(currentdate.getHours()) + \":\"\n + addZero(currentdate.getMinutes());\n\n}", "function currentTime() { //returns current time in \"[HH:MM] \" 24hr format (string)\n var d = new Date();\n return '['+d.toTimeString().substr(0,5)+'] ';\n}", "function currentTime(){\n var date = new Date().getDate();\n var month = new Date().getMonth() + 1;\n var year = new Date().getFullYear();\n var hours = new Date().getHours();\n var min = new Date().getMinutes();\n var sec = new Date().getSeconds();\n\n return month + '/' + date + '/' + year \n + ' ' + hours + ':' + min + ':' + sec;\n\n\n\n }" ]
[ "0.7872003", "0.7791804", "0.7354191", "0.73127687", "0.72452915", "0.7146017", "0.7138602", "0.7121298", "0.7103326", "0.7062861", "0.7016527", "0.70033497", "0.695631", "0.6956222", "0.69544303", "0.69452065", "0.69369656", "0.6936768", "0.6931186", "0.6926132", "0.6895374", "0.686413", "0.6823558", "0.6821653", "0.6821055", "0.68001187", "0.6772134", "0.676637", "0.67653745", "0.676448", "0.676448", "0.67571676", "0.6755967", "0.67533326", "0.67327493", "0.67288035", "0.6723761", "0.6715168", "0.67144793", "0.6694987", "0.66762936", "0.66758394", "0.66663545", "0.66529745", "0.66164696", "0.6610465", "0.6605672", "0.6602311", "0.6602311", "0.6593243", "0.6587884", "0.6578091", "0.6562799", "0.6557487", "0.65513605", "0.6543174", "0.65430665", "0.6536135", "0.6535548", "0.6532614", "0.6528439", "0.65246814", "0.6523718", "0.65225077", "0.6518624", "0.6518045", "0.65121967", "0.651183", "0.6487872", "0.64789414", "0.64757055", "0.64719176", "0.64448017", "0.64388317", "0.6434026", "0.6433839", "0.64327157", "0.6431884", "0.64261806", "0.64260244", "0.6419413", "0.641889", "0.6402824", "0.6402522", "0.6391863", "0.63875914", "0.6387316", "0.6381215", "0.63767546", "0.6369562", "0.6366397", "0.6355809", "0.63510877", "0.63472605", "0.63472605", "0.63465935", "0.6344041", "0.6343289", "0.6341337", "0.6336043" ]
0.8083763
0