Dataset Viewer (First 5GB)
The table contains 100 rows per page, up to 5GB.
Full Screen Viewer
Full Screen
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=\"🔴\"; //red\n cell.isRed=true;\n }\n else //if yellow turn\n {\n cell.innerHTML=\"😁\"; //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) {\n const targetBrowsers = Object.keys(browserConfig)\n (...TRUNCATED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | ["static Configurators() {\n const customizeNothing = []; // no customization steps\n (...TRUNCATED) | ["0.5952684","0.54929423","0.5462945","0.54263645","0.53882575","0.5377423","0.534919","0.5339271","(...TRUNCATED) | 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 &(...TRUNCATED) | ["0.6802336","0.6285311","0.62693626","0.626083","0.5824914","0.58229935","0.5817325","0.579206","0.(...TRUNCATED) | 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 = \"\"(...TRUNCATED) | ["0.6376763","0.62939286","0.6247481","0.6026614","0.5996649","0.5991714","0.5986352","0.5960493","0(...TRUNCATED) | 0.0 | -1 |
gets called when the user clicks on an observable link | "function observable_link_clicked(observable_id) {\n $(\"#frm-filter\").append('<input type=\"che(...TRUNCATED) | {
"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 (...TRUNCATED) | ["0.6859117","0.68423307","0.6615774","0.656904","0.65555376","0.65233034","0.6451522","0.6348706","(...TRUNCATED) | 0.5703929 | 77 |
gets called when the user clicks on a tag link | "function tag_link_clicked(tag_id) {\n $(\"#frm-filter\").append('<input type=\"checkbox\" name=\(...TRUNCATED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | ["function onTagClick(e) {\r\n console.log(e.detail);\r\n console.log(\"onTagC(...TRUNCATED) | ["0.75356567","0.74746776","0.7072557","0.7063431","0.6959302","0.67220116","0.6701569","0.6610266",(...TRUNCATED) | 0.58167 | 37 |
"gets called when the user clicks on the right triangle button next to each alert this loads the obs(...TRUNCATED) | "function load_alert_observables(alert_uuid) {\n // have we already loaded this?\n var existin(...TRUNCATED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | ["function afterAlertsLoad() {\n if (sessionStorage.getItem(\"search_all_selected_obj\") !== (...TRUNCATED) | ["0.6027999","0.5704662","0.56729025","0.5671811","0.55752796","0.55389655","0.55389655","0.55220586(...TRUNCATED) | 0.48475093 | 86 |
"1) Generate random number 2) Give user ability to guess 3) If they are wrong guess again, maybe get(...TRUNCATED) | "function guessGame() {\n let randomNr = Math.floor(Math.random() * 11);\n console.log(randomNr);\(...TRUNCATED) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | ["function randomNumber() {\n\tif (getyx(y,x) =='Y3X23' || getyx(y,x) =='Y3X2') {\n\t\tvar randomNum(...TRUNCATED) | ["0.79177094","0.7891137","0.7750411","0.7650739","0.7627652","0.7563111","0.754357","0.75278264","0(...TRUNCATED) | 0.6890487 | 75 |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
- Downloads last month
- 112